6b1508671a72bad325973741aec842e89bca172214277ce586c31b9f1a71fbf7.json 10 KB

1
  1. {"ast":null,"code":"import { __decorate } from \"tslib\";\nimport __NG_CLI_RESOURCE__0 from \"./formulaire.component.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./formulaire.component.scss?ngResource\";\nimport { ConfirmComponent } from './confirm/confirm.component';\nimport { Component } from '@angular/core';\nimport { Validators, FormBuilder } from '@angular/forms';\nimport { ContactService } from 'src/app/services/contact.service';\nimport { AuthService } from 'src/app/services/auth.service';\nconst googleLogoURL = \"../assets/img/social/google+.svg\";\nconst facebookLogoURL = \"../assets/img/social/facebook.svg\";\nimport { MatDialog } from '@angular/material/dialog';\nlet FormulaireComponent = class FormulaireComponent {\n constructor(contactService, authService, formBuilder, dialog) {\n this.contactService = contactService;\n this.authService = authService;\n this.formBuilder = formBuilder;\n this.dialog = dialog;\n this.submitted = false;\n this.loading = false;\n }\n ngOnInit() {\n this.createForm();\n }\n createForm() {\n let caracereregex = /^[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð ,.'-]+$/;\n let emailregex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n this.formGroup = this.formBuilder.group({\n lastname: [null, [Validators.required, Validators.pattern(caracereregex)]],\n email: [null, [Validators.required, Validators.pattern(emailregex)]],\n message: [null, Validators.required]\n });\n }\n getErrorLastname() {\n return this.formGroup.get('lastname').hasError('required') ? 'Nom requis' : this.formGroup.get('lastname').hasError('pattern') ? 'Nom non valide' : '';\n }\n getErrorEmail() {\n return this.formGroup.get('email').hasError('required') ? 'Adresse email requise' : this.formGroup.get('email').hasError('pattern') ? 'Adresse email non valide' : '';\n }\n getErrorMessage() {\n return this.formGroup.get('message').hasError('required') ? 'Message requis' : '';\n }\n get f() {\n return this.formGroup.controls;\n }\n sendMsgContact() {\n this.submitted = true;\n if (this.formGroup.invalid) {\n return;\n }\n this.loading = true;\n this.contactService.sendMsgContact(this.formGroup.value).subscribe(data => {\n console.log(data);\n this.response = data.message;\n this.loading = false;\n this.openDialog();\n }, err => {\n this.loading = false;\n console.log(err.error.message);\n this.authService.openSnackBar(err.error.message);\n });\n }\n openDialog() {\n const dialogRef = this.dialog.open(ConfirmComponent, {\n height: '40%',\n width: '38%',\n data: {\n response: this.response\n }\n });\n dialogRef.afterClosed().subscribe(() => {\n location.reload();\n });\n }\n static #_ = this.ctorParameters = () => [{\n type: ContactService\n }, {\n type: AuthService\n }, {\n type: FormBuilder\n }, {\n type: MatDialog\n }];\n};\nFormulaireComponent = __decorate([Component({\n selector: 'app-formulaire',\n template: __NG_CLI_RESOURCE__0,\n styles: [__NG_CLI_RESOURCE__1]\n})], FormulaireComponent);\nexport { FormulaireComponent };","map":{"version":3,"names":["ConfirmComponent","Component","Validators","FormBuilder","ContactService","AuthService","googleLogoURL","facebookLogoURL","MatDialog","FormulaireComponent","constructor","contactService","authService","formBuilder","dialog","submitted","loading","ngOnInit","createForm","caracereregex","emailregex","formGroup","group","lastname","required","pattern","email","message","getErrorLastname","get","hasError","getErrorEmail","getErrorMessage","f","controls","sendMsgContact","invalid","value","subscribe","data","console","log","response","openDialog","err","error","openSnackBar","dialogRef","open","height","width","afterClosed","location","reload","_","__decorate","selector","template","__NG_CLI_RESOURCE__0"],"sources":["C:\\FatboarProject\\angular-client\\src\\app\\components\\shared\\contact\\formulaire\\formulaire.component.ts"],"sourcesContent":["import { ConfirmComponent } from './confirm/confirm.component';\r\nimport { Component, OnInit } from '@angular/core';\r\nimport { FormControl, FormGroupDirective, NgForm, Validators, FormGroup, FormBuilder } from '@angular/forms';\r\nimport { ErrorStateMatcher } from '@angular/material/core';\r\nimport { DomSanitizer } from \"@angular/platform-browser\";\r\nimport { MatIconRegistry } from '@angular/material/icon';\r\nimport { ContactService } from 'src/app/services/contact.service'\r\nimport { AuthService } from 'src/app/services/auth.service'\r\nconst googleLogoURL = \"../assets/img/social/google+.svg\";\r\nconst facebookLogoURL = \"../assets/img/social/facebook.svg\";\r\nimport {MatDialog} from '@angular/material/dialog';\r\n\r\n@Component({\r\n selector: 'app-formulaire',\r\n templateUrl: './formulaire.component.html',\r\n styleUrls: ['./formulaire.component.scss']\r\n})\r\nexport class FormulaireComponent implements OnInit {\r\n\r\n constructor(private contactService: ContactService, private authService: AuthService, private formBuilder: FormBuilder,public dialog: MatDialog) { }\r\n\r\n formGroup: FormGroup;\r\n submitted = false;\r\n loading = false;\r\n response : string;\r\n\r\n\r\n\r\n\r\n ngOnInit(): void {\r\n\r\n this.createForm();\r\n }\r\n\r\n createForm() {\r\n let caracereregex : RegExp = /^[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð ,.'-]+$/;\r\n let emailregex: RegExp = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\r\n\r\n this.formGroup = this.formBuilder.group({\r\n lastname: [null,[Validators.required, Validators.pattern(caracereregex)]],\r\n email: [null, [Validators.required, Validators.pattern(emailregex)]],\r\n message: [null, Validators.required],\r\n });\r\n }\r\n\r\n\r\n getErrorLastname() {\r\n return this.formGroup.get('lastname').hasError('required') ? 'Nom requis' : \r\n this.formGroup.get('lastname').hasError('pattern') ? 'Nom non valide' : '';\r\n }\r\n\r\n getErrorEmail() {\r\n return this.formGroup.get('email').hasError('required') ? 'Adresse email requise' :\r\n this.formGroup.get('email').hasError('pattern') ? 'Adresse email non valide' : '';\r\n }\r\n\r\n getErrorMessage() {\r\n return this.formGroup.get('message').hasError('required') ? 'Message requis' : '';\r\n }\r\n\r\n\r\n get f() { return this.formGroup.controls; }\r\n\r\n\r\n\r\n sendMsgContact() {\r\n\r\n this.submitted = true;\r\n if (this.formGroup.invalid) {\r\n return;\r\n }\r\n this.loading = true;\r\n this.contactService.sendMsgContact(this.formGroup.value).subscribe(\r\n data => {\r\n console.log(data);\r\n this.response = data.message;\r\n this.loading = false;\r\n this.openDialog();\r\n },\r\n err => {\r\n this.loading = false;\r\n console.log(err.error.message);\r\n this.authService.openSnackBar(err.error.message);\r\n });\r\n }\r\n\r\n\r\n openDialog() {\r\n const dialogRef =\r\n this.dialog.open(ConfirmComponent, {\r\n height: '40%',\r\n width: '38%',\r\n data: {\r\n response: this.response\r\n }});\r\n\r\n dialogRef.afterClosed().subscribe(() => {\r\n location.reload();\r\n });\r\n }\r\n\r\n}\r\n"],"mappings":";;;AAAA,SAASA,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAgB,eAAe;AACjD,SAAkDC,UAAU,EAAaC,WAAW,QAAQ,gBAAgB;AAI5G,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,WAAW,QAAQ,+BAA+B;AAC3D,MAAMC,aAAa,GAAG,kCAAkC;AACxD,MAAMC,eAAe,GAAG,mCAAmC;AAC3D,SAAQC,SAAS,QAAO,0BAA0B;AAO3C,IAAMC,mBAAmB,GAAzB,MAAMA,mBAAmB;EAE9BC,YAAoBC,cAA8B,EAAUC,WAAwB,EAAUC,WAAwB,EAAQC,MAAiB;IAA3H,KAAAH,cAAc,GAAdA,cAAc;IAA0B,KAAAC,WAAW,GAAX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