From 88216e5f2dc86465de9f06df1576ab20547f9fe4 Mon Sep 17 00:00:00 2001 From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com> Date: Wed, 28 Apr 2021 15:14:53 +0200 Subject: [PATCH 1/7] feat: regex web + precision horaire + placeholder (ticket 496/497/500) --- src/app/form/form.component.html | 9 +++--- src/app/form/form.component.scss | 4 +++ src/app/form/form.component.ts | 7 ++--- src/app/form/pageType.enum.ts | 29 +++++++++---------- .../reset-password.component.html | 20 +++++++------ .../create-account-form.component.html | 2 +- .../signup-modal/signup-modal.component.html | 2 +- src/app/utils/CustomRegExp.ts | 2 +- 8 files changed, 39 insertions(+), 36 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index c32ffbbf9..f50fc2e17 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -186,7 +186,7 @@ <h3>Quels identifiants utiliserez-vous pour vous connecter ?</h3> </div> <div class="form-group" fxLayout="column"> - <label for="email">Courriel personnel</label> + <label for="email">Courriel du compte</label> <p class="special invalid" *ngIf="this.accountForm.get('email').hasError('alreadyExist')"> L'email est déja utilisé. </p> @@ -196,6 +196,7 @@ (input)="setValidationsForm()" (keyup)="verifyUserExist($event.target.value)" formControlName="email" + placeholder="thomas@grandlyon.com" class="form-input" [readonly]="isAccountMode" [ngClass]="{ disabled: isAccountMode }" @@ -416,9 +417,7 @@ (updateFormError)="setHoursError()" [structureInput]="hoursForm" ></app-hour-picker> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureHoursDetails" class="page"> - <div class="title"> + <div class="nextTitle"> <h3>Avez-vous des précisions à apporter sur les horaires ?</h3> <p class="notRequired">facultatif</p> </div> @@ -472,7 +471,7 @@ <div fxLayout="row" fxLayoutGap="27px"> <input type="text" - placeholder="www.resonum.com" + placeholder="www.resin.grandlyon.com" (input)="setValidationsForm()" formControlName="website" class="form-input" diff --git a/src/app/form/form.component.scss b/src/app/form/form.component.scss index f8e9ca165..c17214a05 100644 --- a/src/app/form/form.component.scss +++ b/src/app/form/form.component.scss @@ -160,6 +160,10 @@ h3 { .title { margin-bottom: 26px; } + .nextTitle { + margin-bottom: 10px; + margin-top: 10px; + } .type-picker { height: 100%; } diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 4e25894a4..f98e30a38 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -484,10 +484,9 @@ export class FormComponent implements OnInit { valid: this.getStructureControl('accessModality').valid, name: "Modalités d'accueil", }; - this.pagesValidation[PageTypeEnum.structureHours] = { valid: this.hoursForm.valid, name: "Horaires d'ouverture" }; - this.pagesValidation[PageTypeEnum.structureHoursDetails] = { - valid: this.getStructureControl('exceptionalClosures').valid, - name: 'Précisions sur les horaires', + this.pagesValidation[PageTypeEnum.structureHours] = { + valid: this.hoursForm.valid && this.getStructureControl('exceptionalClosures').valid, + name: "Horaires d'ouverture", }; this.pagesValidation[PageTypeEnum.structurePmr] = { valid: this.getStructureControl('pmrAccess').valid, diff --git a/src/app/form/pageType.enum.ts b/src/app/form/pageType.enum.ts index 3b3f5071a..fbe238d63 100644 --- a/src/app/form/pageType.enum.ts +++ b/src/app/form/pageType.enum.ts @@ -8,19 +8,18 @@ export enum PageTypeEnum { structureType = 6, structureAccessModality = 7, structureHours = 8, - structureHoursDetails = 9, - structurePmr = 10, - structureWebAndSocialNetwork = 11, - structurePublicTarget = 12, - structureAccompaniment = 13, - structureOtherAccompaniment = 14, - structureWorkshop = 15, - structureWorkshopPrice = 16, - structureWifi = 17, - structureEquipments = 18, - structureLabels = 19, - structureOtherServices = 20, - structureDescription = 21, - structureCovidInfo = 22, - cgu = 23, + structurePmr = 9, + structureWebAndSocialNetwork = 10, + structurePublicTarget = 11, + structureAccompaniment = 12, + structureOtherAccompaniment = 13, + structureWorkshop = 14, + structureWorkshopPrice = 15, + structureWifi = 16, + structureEquipments = 17, + structureLabels = 18, + structureOtherServices = 29, + structureDescription = 20, + structureCovidInfo = 21, + cgu = 22, } diff --git a/src/app/reset-password/reset-password.component.html b/src/app/reset-password/reset-password.component.html index 2983fe1f7..13b83e7cc 100644 --- a/src/app/reset-password/reset-password.component.html +++ b/src/app/reset-password/reset-password.component.html @@ -4,16 +4,18 @@ <h1>Réinitialisation du mot de passe</h1> <form *ngIf="!token" [formGroup]="resetForm" (ngSubmit)="onSubmit()"> <div class="form-group"> - <label for="email">Courriel personnel</label> - <div fxLayout="row" fxLayoutGap="13px"> - <input type="text" - autocomplete="on" - formControlName="email" - class="form-input" - [ngClass]="{ 'is-invalid': submitted && f.email.errors }"/> - </div> + <label for="email">Courriel du compte</label> + <div fxLayout="row" fxLayoutGap="13px"> + <input + type="text" + autocomplete="on" + formControlName="email" + class="form-input" + [ngClass]="{ 'is-invalid': submitted && f.email.errors }" + /> + </div> <div *ngIf="submitted && f.email.errors" class="invalid-feedback"> - <div *ngIf="f.email.errors.required" >L'adresse e-mail est requise</div> + <div *ngIf="f.email.errors.required">L'adresse e-mail est requise</div> </div> </div> <div class="button" fxLayout="row" fxLayoutAlign="space-around center"> diff --git a/src/app/shared/components/create-account-form/create-account-form.component.html b/src/app/shared/components/create-account-form/create-account-form.component.html index 6b547d7fd..f515c1480 100644 --- a/src/app/shared/components/create-account-form/create-account-form.component.html +++ b/src/app/shared/components/create-account-form/create-account-form.component.html @@ -1,6 +1,6 @@ <form [formGroup]="accountForm" *ngIf="accountForm" (ngSubmit)="onSubmit(accountForm)"> <div class="form-group" fxLayout="column"> - <label for="email">Courriel personnel</label> + <label for="email">Courriel du compte</label> <div fxLayout="row" fxLayoutGap="13px"> <input type="text" autocomplete="on" formControlName="email" class="form-input" /> <img *ngIf="f.email.invalid && f.email.value" src="../../assets/form/notvalidate.svg" alt="logo invalid" /> diff --git a/src/app/shared/components/signup-modal/signup-modal.component.html b/src/app/shared/components/signup-modal/signup-modal.component.html index 492b39e29..caa8fd967 100644 --- a/src/app/shared/components/signup-modal/signup-modal.component.html +++ b/src/app/shared/components/signup-modal/signup-modal.component.html @@ -11,7 +11,7 @@ <h3>Se connecter</h3> <form [formGroup]="loginForm" (ngSubmit)="onSubmit()"> <div class="form-group" fxLayout="column"> - <label for="email">Courriel personnel</label> + <label for="email">Courriel du compte</label> <div fxLayout="row" fxLayoutGap="13px"> <input type="text" autocomplete="on" formControlName="email" class="form-input" /> <svg *ngIf="f.email.invalid && f.email.value" class="notValidate" aria-hidden="true"> diff --git a/src/app/utils/CustomRegExp.ts b/src/app/utils/CustomRegExp.ts index ab2b98c59..af6b6f83d 100644 --- a/src/app/utils/CustomRegExp.ts +++ b/src/app/utils/CustomRegExp.ts @@ -12,7 +12,7 @@ export class CustomRegExp { * Validate a password (at least 8 characters, 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character) */ public static readonly PHONE: RegExp = /^(?:(?:\+|00)|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/; //NOSONAR - public static readonly WEBSITE: RegExp = /^(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/; //NOSONAR + public static readonly WEBSITE: RegExp = /^(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,}|[a-zA-Z0-9]+\.[^\s]{2,})/; //NOSONAR public static readonly LINKEDIN: string = '(linkedin.com/in/.{1,})'; public static readonly FACEBOOK: string = '(facebook.com/.{1,})'; public static readonly TWITTER: string = '(twitter.com/.{1,})'; -- GitLab From b1d1ec36418ae0602d64a9a87bc649d1789ee18f Mon Sep 17 00:00:00 2001 From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com> Date: Wed, 28 Apr 2021 17:13:32 +0200 Subject: [PATCH 2/7] feat: remove workshop price if no workshop --- src/app/form/form.component.html | 2 +- src/app/form/form.component.ts | 34 ++++++++++++++++++++++++++++++-- src/app/form/pageType.enum.ts | 2 +- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index f50fc2e17..279e2672a 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -1041,7 +1041,7 @@ </div> <div *ngIf="currentPage == pageTypeEnum.structureCovidInfo" class="page"> <div class="title"> - <h3>Y a-t-il des informations spécifique à la période COVID ?</h3> + <h3>Y a-t-il des informations spécifiques à la période COVID ?</h3> <p class="notRequired">facultatif</p> </div> <div class="textareaBlock" fxLayout="column"> diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index f98e30a38..9d4d64af4 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -49,7 +49,7 @@ export class FormComponent implements OnInit { // Page and progress var public currentPage = 0; public progressStatus = 0; - public nbPagesForm = 24; + public nbPagesForm = 23; public isPageValid: boolean; public pagesValidation = []; @@ -280,7 +280,7 @@ export class FormComponent implements OnInit { Validators.required, Validators.pattern(CustomRegExp.NO_NULL_NUMBER), ]), - freeWorkShop: new FormControl(structure.freeWorkShop, Validators.required), + freeWorkShop: new FormControl(structure.freeWorkShop), }); return form; } @@ -684,6 +684,22 @@ export class FormComponent implements OnInit { this.currentPage++; // page structureOtherAccompaniment skip and go to page structureWorkshop this.progressStatus += 100 / this.nbPagesForm; } + + if (this.currentPage == PageTypeEnum.structureWorkshop) { + //console.log('procedure:', this.proceduresAccompaniment.); + // console.log('public:', this..modules); + if ( + !this.structureForm.get('baseSkills').value.length && + !this.structureForm.get('accessRight').value.length && + !this.structureForm.get('parentingHelp').value.length && + !this.structureForm.get('socialAndProfessional').value.length && + !this.structureForm.get('digitalCultureSecurity').value.length + ) { + this.getStructureControl('freeWorkShop').reset(); + this.currentPage++; + this.progressStatus += 100 / this.nbPagesForm; + } + } // Check if going to the last page to submit form and send email verification. if (this.currentPage == this.nbPagesForm - 1) { this.validateForm(); @@ -711,6 +727,20 @@ export class FormComponent implements OnInit { this.currentPage--; // page 14 skip and go to page 13 this.progressStatus -= 100 / this.nbPagesForm; } + if (this.currentPage == PageTypeEnum.structureWifi) { + //console.log('procedure:', this.proceduresAccompaniment.); + // console.log('public:', this..modules); + if ( + !this.structureForm.get('baseSkills').value.length && + !this.structureForm.get('accessRight').value.length && + !this.structureForm.get('parentingHelp').value.length && + !this.structureForm.get('socialAndProfessional').value.length && + !this.structureForm.get('digitalCultureSecurity').value.length + ) { + this.currentPage--; + this.progressStatus -= 100 / this.nbPagesForm; + } + } this.currentPage--; this.progressStatus -= 100 / this.nbPagesForm; this.updatePageValid(); diff --git a/src/app/form/pageType.enum.ts b/src/app/form/pageType.enum.ts index fbe238d63..708f64b15 100644 --- a/src/app/form/pageType.enum.ts +++ b/src/app/form/pageType.enum.ts @@ -18,7 +18,7 @@ export enum PageTypeEnum { structureWifi = 16, structureEquipments = 17, structureLabels = 18, - structureOtherServices = 29, + structureOtherServices = 19, structureDescription = 20, structureCovidInfo = 21, cgu = 22, -- GitLab From 2ef36f46abec6010b4c1e8ec6fea8fe0c166d0e8 Mon Sep 17 00:00:00 2001 From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com> Date: Thu, 29 Apr 2021 17:14:25 +0200 Subject: [PATCH 3/7] WIP: login on structure form --- src/app/form/form.component.html | 12 ++++++++++++ src/app/form/form.component.ts | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 279e2672a..a96763da0 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -121,6 +121,13 @@ <h3>Qui êtes-vous ?</h3> <p>Ces informations ne seront pas visibles sur la plateforme</p> </div> + <div class="title"> + <h4>Vous possédez déja un compte ? Connectez-vous:</h4> + <button class="btn-primary small next" *ngIf="!isLoggedIn" (click)="isPopUpOpen = !isPopUpOpen"> + Se connecter + </button> + <h4>Sinon, inscrivez-vous en suivant le formulaire ci-dessous:</h4> + </div> <div class="form-group" fxLayout="column"> <label for="surname">Nom</label> <div fxLayout="row" fxLayoutGap="13px"> @@ -1213,4 +1220,9 @@ Voir ma structure </button> </div> + <app-signup-modal + *ngIf="displaySignUp" + [openned]="isPopUpOpen" + (closed)="closeSignUpModal($event)" + ></app-signup-modal> </div> diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 9d4d64af4..6051a2538 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -77,6 +77,9 @@ export class FormComponent implements OnInit { public isWifiChoosen = null; public structureWithOwners: StructureWithOwners; + public isPopUpOpen = false; + public displaySignUp = true; + constructor( private structureService: StructureService, private searchService: SearchService, @@ -138,6 +141,27 @@ export class FormComponent implements OnInit { } } + public closeSignUpModal(value: boolean): void { + if (!value) { + this.displaySignUp = false; + } else { + this.isPopUpOpen = false; + } + if (this.isLoggedIn) { + this.updateFormOnLogin(); + } + } + + public updateFormOnLogin() { + //TODO -> switch to signed mode, update user data, validate/delete previous field, skip 2 pages + this.isAccountMode = true; + this.currentPage = PageTypeEnum.structureNameAndAddress; + } + + public get isLoggedIn(): boolean { + return this.authService.isLoggedIn(); + } + async setCategories(): Promise<void> { this.searchService.getCategoriesAccompaniment().subscribe((categories: Category[]) => { this.proceduresAccompaniment = categories[0]; -- GitLab From 4e7ee0722a28f66e2a9f0f5d14805d107fe5920a Mon Sep 17 00:00:00 2001 From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com> Date: Fri, 30 Apr 2021 11:16:31 +0200 Subject: [PATCH 4/7] feat: allow connexion from structure form --- src/app/form/form.component.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 6051a2538..e0367bf0a 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -153,8 +153,12 @@ export class FormComponent implements OnInit { } public updateFormOnLogin() { - //TODO -> switch to signed mode, update user data, validate/delete previous field, skip 2 pages - this.isAccountMode = true; + this.profileService.getProfile().then((user: User) => { + this.profile = user; + }); + this.router.navigateByUrl('create-structure'); + this.pagesValidation[PageTypeEnum.accountInfo] = { valid: true }; + this.pagesValidation[PageTypeEnum.accountCredentials] = { valid: true }; this.currentPage = PageTypeEnum.structureNameAndAddress; } -- GitLab From 66287ff7c54a670fdfc688a80d998087e90f4799 Mon Sep 17 00:00:00 2001 From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com> Date: Fri, 30 Apr 2021 17:20:11 +0200 Subject: [PATCH 5/7] fix: changes after review --- src/app/form/form.component.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index e0367bf0a..74de67430 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -157,6 +157,7 @@ export class FormComponent implements OnInit { this.profile = user; }); this.router.navigateByUrl('create-structure'); + this.progressStatus += (100 / this.nbPagesForm) * 2; this.pagesValidation[PageTypeEnum.accountInfo] = { valid: true }; this.pagesValidation[PageTypeEnum.accountCredentials] = { valid: true }; this.currentPage = PageTypeEnum.structureNameAndAddress; @@ -714,8 +715,6 @@ export class FormComponent implements OnInit { } if (this.currentPage == PageTypeEnum.structureWorkshop) { - //console.log('procedure:', this.proceduresAccompaniment.); - // console.log('public:', this..modules); if ( !this.structureForm.get('baseSkills').value.length && !this.structureForm.get('accessRight').value.length && @@ -756,8 +755,6 @@ export class FormComponent implements OnInit { this.progressStatus -= 100 / this.nbPagesForm; } if (this.currentPage == PageTypeEnum.structureWifi) { - //console.log('procedure:', this.proceduresAccompaniment.); - // console.log('public:', this..modules); if ( !this.structureForm.get('baseSkills').value.length && !this.structureForm.get('accessRight').value.length && -- GitLab From fd520be55efbc4f42f445c52d4bffca520c94aa2 Mon Sep 17 00:00:00 2001 From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com> Date: Wed, 5 May 2021 11:59:27 +0200 Subject: [PATCH 6/7] fix: workshop price to required and default value --- src/app/form/form.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 74de67430..d01cd1041 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -309,7 +309,7 @@ export class FormComponent implements OnInit { Validators.required, Validators.pattern(CustomRegExp.NO_NULL_NUMBER), ]), - freeWorkShop: new FormControl(structure.freeWorkShop), + freeWorkShop: new FormControl(structure.freeWorkShop, [Validators.required]), }); return form; } @@ -888,6 +888,9 @@ export class FormComponent implements OnInit { } public validateForm(): void { + if (this.getStructureControl('freeWorkShop').value === null) { + this.getStructureControl('freeWorkShop').setValue(false); + } if (this.structureForm.valid && this.hoursForm.valid) { let structure: Structure = this.structureForm.value; structure.hours = this.hoursForm.value; -- GitLab From d47ec01448d93b86b5ada4ab86c14f123472b5b1 Mon Sep 17 00:00:00 2001 From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com> Date: Wed, 5 May 2021 14:47:08 +0200 Subject: [PATCH 7/7] fix: missing type --- src/app/form/form.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index d01cd1041..ecb8b91cc 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -152,7 +152,7 @@ export class FormComponent implements OnInit { } } - public updateFormOnLogin() { + public updateFormOnLogin(): void { this.profileService.getProfile().then((user: User) => { this.profile = user; }); -- GitLab