From c89ce891642f559fd46a7c327911e08610eb389b Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Mon, 8 Feb 2021 15:13:52 +0100 Subject: [PATCH 01/23] fix(form) : add edit logic to inputs default value --- src/app/form/form.component.ts | 158 +++++++++++++----- .../structure-type-picker.component.ts | 6 +- .../structure-details.component.html | 15 +- .../structure-details.component.ts | 19 --- 4 files changed, 121 insertions(+), 77 deletions(-) diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 6832ffc8a..41f05124b 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -13,7 +13,7 @@ import { MustMatch } from '../shared/validator/form'; import { Address } from '../models/address.model'; import { Module } from '../structure-list/models/module.model'; import { Equipment } from '../structure-list/enum/equipment.enum'; -import { Router } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { AuthService } from '../services/auth.service'; import { first } from 'rxjs/operators'; import { Regex } from '../shared/enum/regex.enum'; @@ -23,8 +23,6 @@ import { Regex } from '../shared/enum/regex.enum'; styleUrls: ['./form.component.scss'], }) export class FormComponent implements OnInit { - @Input() public idStructure?: string; - @Input() public isEditMode: boolean = true; public profile: User; public createdStructure: Structure; @@ -62,6 +60,7 @@ export class FormComponent implements OnInit { public isShowPassword = false; public userAcceptSavedDate = false; public showMenu = false; + public isEditMode = false; constructor( private structureService: StructureService, @@ -70,59 +69,54 @@ export class FormComponent implements OnInit { private authService: AuthService ) {} - ngOnInit(): void { + async ngOnInit(): Promise<void> { this.profileService.getProfile().then((user: User) => { this.profile = user; }); - + await this.setCategories(); // Check if it's a new structure or edit structure - if (this.idStructure) { - this.structureService.getStructure(this.idStructure).subscribe((structure) => { - this.initForm(structure); - this.idStructure = structure._id; - }); + if (history.state.data) { + this.isEditMode = true; + this.initForm(new Structure(history.state.data)); } else { this.initForm(new Structure()); } - this.setCategories(); } - private setCategories(): void { + async setCategories(): Promise<void> { this.searchService.getCategoriesAccompaniment().subscribe((categories: Category[]) => { this.proceduresAccompaniment = categories[0]; }); - this.searchService.getCategoriesMoreFilters().subscribe((categories: Category[]) => { - categories.forEach((categ) => { - switch (categ.id) { - case CategoryEnum.accessModality: { - this.accessModality = categ; - break; - } - case CategoryEnum.equipmentsAndServices: { - categ.modules.forEach((c) => { - this.equipmentsAndServices.push({ module: c, openned: false }); - }); - break; - } - case CategoryEnum.labelsQualifications: { - this.labelsQualifications = categ; - break; - } - case CategoryEnum.publics: { - this.publics = categ; - break; - } - case CategoryEnum.publicsAccompaniment: { - this.publicsAccompaniment = categ; - break; - } + const equipmentsCategs = await this.searchService.getCategoriesMoreFilters().toPromise(); + equipmentsCategs.forEach((categ) => { + switch (categ.id) { + case CategoryEnum.accessModality: { + this.accessModality = categ; + break; + } + case CategoryEnum.equipmentsAndServices: { + categ.modules.forEach((c) => { + this.equipmentsAndServices.push({ module: c, openned: false }); + }); + break; + } + case CategoryEnum.labelsQualifications: { + this.labelsQualifications = categ; + break; } - }); + case CategoryEnum.publics: { + this.publics = categ; + break; + } + case CategoryEnum.publicsAccompaniment: { + this.publicsAccompaniment = categ; + break; + } + } }); - this.searchService.getCategoriesTraining().subscribe((categories: Category[]) => { - categories.forEach((categ) => { - this.trainingCategories.push({ category: categ, openned: false }); - }); + let categs = await this.searchService.getCategoriesTraining().toPromise(); + categs.forEach((categ) => { + this.trainingCategories.push({ category: categ, openned: false }); }); } @@ -218,8 +212,84 @@ export class FormComponent implements OnInit { saturday: this.createDay(structure.hours.saturday), sunday: this.createDay(structure.hours.sunday), }); + if (this.isEditMode) { + this.showCollapse(structure); + } + this.setValidationsForm(); } + private showCollapse(s: Structure): void { + if (s.website) { + this.showWebsite = true; + } + if (s.facebook || s.twitter || s.instagram || s.linkedin) { + this.showSocialNetwork = true; + } + if (s.publicsAccompaniment.length) { + this.showPublicsAccompaniment = true; + } + if (s.proceduresAccompaniment.length) { + this.showProceduresAccompaniment = true; + } + this.trainingCategories.forEach((categ: { category: Category; openned: boolean }) => { + switch (categ.category.id) { + case 'accessRight': + if (s.accessRight.length) { + categ.openned = true; + } + break; + case 'socialAndProfessional': + if (s.socialAndProfessional.length) { + categ.openned = true; + } + break; + case 'baseSkills': + if (s.baseSkills.length) { + categ.openned = true; + } + break; + case 'parentingHelp': + if (s.parentingHelp.length) { + categ.openned = true; + } + break; + case 'digitalCultureSecurity': + if (s.digitalCultureSecurity.length) { + categ.openned = true; + } + break; + } + }); + this.equipmentsAndServices.forEach((equipment: { module: Module; openned: boolean }) => { + switch (equipment.module.id) { + case 'ordinateurs': + if (s.equipmentsAndServices.includes('ordinateurs')) { + equipment.openned = true; + } + break; + case 'tablettes': + if (s.equipmentsAndServices.includes('tablettes')) { + equipment.openned = true; + } + break; + case 'bornesNumeriques': + if (s.equipmentsAndServices.includes('bornesNumeriques')) { + equipment.openned = true; + } + break; + case 'imprimantes': + if (s.equipmentsAndServices.includes('imprimantes')) { + equipment.openned = true; + } + break; + case 'scanners': + if (s.equipmentsAndServices.includes('scanners')) { + equipment.openned = true; + } + break; + } + }); + } private loadArrayForCheckbox(array: string[], isRequired: boolean): FormArray { return new FormArray( @@ -254,8 +324,8 @@ export class FormComponent implements OnInit { } private createTime(time: Time): FormGroup { return new FormGroup({ - openning: new FormControl(time.openning, Validators.pattern('[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,3}$')), //NOSONAR - closing: new FormControl(time.closing, Validators.pattern('[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,3}$')), //NOSONAR + openning: new FormControl(time.openning), //NOSONAR + closing: new FormControl(time.closing), //NOSONAR }); } diff --git a/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts b/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts index 7de312486..63b880768 100644 --- a/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts +++ b/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts @@ -22,11 +22,11 @@ export class StructureTypePickerComponent implements OnInit { constructor(private structureTypeService: StructureTypeService) {} ngOnInit() { - if (this.pickedChoice) { - this.pickedType = this.getType(this.pickedChoice); - } this.structureTypeService.getStructureTypes().subscribe((types) => { this.structureTypes = types; + if (this.pickedChoice) { + this.pickedType = this.getType(this.pickedChoice); + } }); } diff --git a/src/app/structure-list/components/structure-details/structure-details.component.html b/src/app/structure-list/components/structure-details/structure-details.component.html index 58a2e2d98..7a84db49a 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.html +++ b/src/app/structure-list/components/structure-details/structure-details.component.html @@ -1,11 +1,3 @@ -<app-structureForm - *ngIf="showForm" - [idStructure]="structure._id" - [isEditMode]="isEditMode" - [profile]="currentProfile" - (closeEvent)="updateStructure($event)" - (clickOutside)="displayForm()" -></app-structureForm> <div class="structrue-details-container" *ngIf="structure && !isLoading"> <!-- Header info --> <div fxLayout="row" fxLayoutAlign="end center"> @@ -87,14 +79,15 @@ >Revendiquer cette structure</a > <!-- temporary remove edit --> - <!-- <a + <a *ngIf="profileService.isLinkedToStructure(structure._id) || profileService.isAdmin()" - (click)="editStructure()" + routerLink="/create-structure" + [state]="{ data: structure }" class="primary" tabindex="0" > Modifier cette structure - </a> --> + </a> <a *ngIf="profileService.isAdmin()" (click)="toggleDeleteModal()" class="primary" tabindex="0"> Supprimer cette structure </a> diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index 4395765f1..c94ea5747 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -23,7 +23,6 @@ import { PublicCategorie } from '../../enum/public.enum'; export class StructureDetailsComponent implements OnInit { @Input() public structure: Structure; @Output() public closeDetails: EventEmitter<boolean> = new EventEmitter<boolean>(); - @Output() public updatedStructure: EventEmitter<Structure> = new EventEmitter<Structure>(); public accessModality = AccessModality; public baseSkillssReferentiel: Category; @@ -33,10 +32,8 @@ export class StructureDetailsComponent implements OnInit { public tclStopPoints: TclStopPoint[] = []; public printMode = false; public isOtherSection = false; - public showForm = false; public isClaimed: boolean = null; public isLoading: boolean = false; - public isEditMode: boolean = false; public currentProfile: User = null; public deleteModalOpenned = false; public claimModalOpenned = false; @@ -119,11 +116,6 @@ export class StructureDetailsComponent implements OnInit { this.printService.printDocument('structure', this.structure); } - public editStructure(): void { - this.isEditMode = true; - this.displayForm(); - } - public toggleDeleteModal(): void { this.deleteModalOpenned = !this.deleteModalOpenned; } @@ -157,17 +149,6 @@ export class StructureDetailsComponent implements OnInit { }); } } - // Show/hide form structure - public displayForm(): void { - this.showForm = !this.showForm; - } - - public updateStructure(s: Structure): void { - this.structure = new Structure({ ...this.structure, ...s }); - this.updatedStructure.emit(this.structure); - this.displayForm(); - this.ngOnInit(); - } public getAccessLabel(accessModality: AccessModality): string { switch (accessModality) { -- GitLab From b894bc03eda5837354128cbedff4f1177cbedbde Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Mon, 8 Feb 2021 16:18:34 +0100 Subject: [PATCH 02/23] fix(form) : fix footer form when edit + init summary --- src/app/form/form.component.html | 31 ++++++++++-- src/app/form/form.component.scss | 19 +++++++- src/app/form/form.component.ts | 84 ++++++++++++++++++++++---------- src/assets/scss/_layout.scss | 3 +- 4 files changed, 105 insertions(+), 32 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 526e3a3ed..a09a877e4 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -7,7 +7,7 @@ <div class="content"> <div class="progressBar" - *ngIf="currentPage != 0" + *ngIf="currentPage != 0 && !isEditMode" fxLayout="row" fxLayoutAlign="space-between center" fxLayoutGap="20px" @@ -22,7 +22,7 @@ [value]="progressStatus" ></progress> </div> - <div *ngIf="currentPage == 0" class="home page" fxLayout="column" fxLayoutAlign="space-between"> + <div *ngIf="currentPage == 0 && !isEditMode" class="home page" fxLayout="column" fxLayoutAlign="space-between"> <h2>Ajouter votre structure</h2> <img src="../../assets/form/schedule.svg" alt="logo schedule" /> <div> @@ -33,6 +33,16 @@ <button class="btn start" (click)="nextPage()">C'est Parti</button> </div> </div> + <div *ngIf="currentPage == 0 && isEditMode" class="home page" fxLayout="column" fxLayoutAlign="space-between"> + <h2>Modification de la structure</h2> + <div> + <div class="summary" *ngFor="let page of pagesValidation; let index = index"> + <div class="itemSummary" *ngIf="page.name" (click)="goToSpecificPage(index)"> + {{ page.name }} + </div> + </div> + </div> + </div> <div *ngIf="currentPage == 1" class="informations page" fxLayout="column" fxLayoutGap="28px"> <h3>De quelles informations faut-il vous munir ?</h3> <img src="../../assets/form/factures.svg" alt="logo factures" /> @@ -171,7 +181,7 @@ </div> </div> </form> - <form [formGroup]="structureForm" *ngIf="structureForm"> + <form [formGroup]="structureForm" *ngIf="structureForm" [ngClass]="{ editMode: isEditMode }"> <div *ngIf="currentPage == 4" class="page"> <div class="title"> <h3>Quelle structure voulez-vous réferencer ?</h3> @@ -974,13 +984,16 @@ </div> </form> <div *ngIf="currentPage != 0" class="footer desktop"> - <div fxLayout="row" fxLayoutAlign="center center" *ngIf="currentPage != nbPagesForm"> + <div fxLayout="row" fxLayoutAlign="center center" *ngIf="currentPage != nbPagesForm && !isEditMode"> <app-footer-form (previousPage)="previousPage()" (nextPage)="nextPage()" [isValid]="isPageValid" ></app-footer-form> </div> + <div fxLayout="row" fxLayoutAlign="center center" *ngIf="isEditMode"> + <button class="btn" (click)="goToSpecificPage(0)">Validé</button> + </div> <button *ngIf="currentPage == nbPagesForm && !profile" class="btn validate unique" @@ -998,15 +1011,23 @@ Voir ma structure </button> </div> + <div *ngIf="isEditMode" class="footerEditMode"> + <div fxLayout="row" fxLayoutAlign="center center" *ngIf="isEditMode && currentPage == 0"> + <button class="btn unique" (click)="validateForm()">Terminé</button> + </div> + </div> </div> <div *ngIf="currentPage != 0" class="footer phone"> - <div fxLayout="row" fxLayoutAlign="center center" *ngIf="currentPage != nbPagesForm"> + <div fxLayout="row" fxLayoutAlign="center center" *ngIf="currentPage != nbPagesForm && !isEditMode"> <app-footer-form (previousPage)="previousPage()" (nextPage)="nextPage()" [isValid]="isPageValid" ></app-footer-form> </div> + <div fxLayout="row" fxLayoutAlign="center center" *ngIf="isEditMode"> + <button class="btn unique" (click)="goToSpecificPage(0)">Validé</button> + </div> <button *ngIf="currentPage == nbPagesForm && !profile" class="btn validate unique" diff --git a/src/app/form/form.component.scss b/src/app/form/form.component.scss index 203a87dac..2569f0c24 100644 --- a/src/app/form/form.component.scss +++ b/src/app/form/form.component.scss @@ -5,10 +5,18 @@ @import '../../assets/scss/shapes'; @import '../../assets/scss/z-index'; -$progressBar-height: 50px; h3 { margin: 0; } +form { + @media #{$tablet} { + &.editMode { + .page { + height: calc(100vh - #{$header-height-phone} - #{$footer-height-phone} - 1px); // -1px because of header border + } + } + } +} .form { background: white; width: 100vw; @@ -449,3 +457,12 @@ img { } } } +.footerEditMode { + width: 100%; + position: fixed; + bottom: 56px; + margin: 20px 0; + @media #{$tablet} { + bottom: 0; + } +} diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 41f05124b..ce8f865fc 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -367,13 +367,20 @@ export class FormComponent implements OnInit { }; this.pagesValidation[4] = { valid: this.getStructureControl('structureName').valid && this.getStructureControl('address').valid, + name: 'Nom et adresse', + }; + this.pagesValidation[5] = { valid: this.getStructureControl('contactPhone').valid, name: 'Téléphone' }; + this.pagesValidation[6] = { valid: this.getStructureControl('structureType').valid, name: 'Type de structure' }; + this.pagesValidation[7] = { valid: this.getStructureControl('accessModality').valid, name: "Modalités d'accueil " }; + this.pagesValidation[8] = { valid: this.hoursForm.valid, name: "Horaires d'ouverture" }; + this.pagesValidation[9] = { + valid: this.getStructureControl('exceptionalClosures').valid, + name: 'Précisions sur les horaires', + }; + this.pagesValidation[10] = { + valid: this.getStructureControl('pmrAccess').valid, + name: 'Accessibilité pour les personnes à mobilité réduite', }; - this.pagesValidation[5] = { valid: this.getStructureControl('contactPhone').valid }; - this.pagesValidation[6] = { valid: this.getStructureControl('structureType').valid }; - this.pagesValidation[7] = { valid: this.getStructureControl('accessModality').valid }; - this.pagesValidation[8] = { valid: this.hoursForm.valid }; - this.pagesValidation[9] = { valid: this.getStructureControl('exceptionalClosures').valid }; - this.pagesValidation[10] = { valid: this.getStructureControl('pmrAccess').valid }; this.pagesValidation[11] = { valid: this.getStructureControl('contactMail').valid && @@ -382,15 +389,18 @@ export class FormComponent implements OnInit { this.getStructureControl('twitter').valid && this.getStructureControl('instagram').valid) || !this.showSocialNetwork), + name: 'Présence sur internet', }; - this.pagesValidation[12] = { valid: this.getStructureControl('publics').valid }; + this.pagesValidation[12] = { valid: this.getStructureControl('publics').valid, name: 'Public admis' }; this.pagesValidation[13] = { valid: this.getStructureControl('publicsAccompaniment').valid && this.getStructureControl('proceduresAccompaniment').valid, + name: 'Accompagnements proposés', }; this.pagesValidation[14] = { valid: this.getStructureControl('otherDescription').value, + name: 'Autres démarches proposés', }; this.pagesValidation[15] = { valid: @@ -399,9 +409,10 @@ export class FormComponent implements OnInit { this.getStructureControl('baseSkills').valid && this.getStructureControl('parentingHelp').valid && this.getStructureControl('digitalCultureSecurity').valid, + name: 'Ateliers au numérique proposés', }; - this.pagesValidation[16] = { valid: this.getStructureControl('freeWorkShop').valid }; - this.pagesValidation[17] = { valid: this.getStructureControl('freeWifi').valid }; + this.pagesValidation[16] = { valid: this.getStructureControl('freeWorkShop').valid, name: 'Gratuité des ateliers' }; + this.pagesValidation[17] = { valid: this.getStructureControl('freeWifi').valid, name: 'Gratuité du wifi' }; this.pagesValidation[18] = { valid: this.getStructureControl('equipmentsAndServices').valid && @@ -410,11 +421,24 @@ export class FormComponent implements OnInit { this.getStructureControl('nbTablets').valid && this.getStructureControl('nbNumericTerminal').valid && this.getStructureControl('nbScanners').valid, + name: 'Matériels mis à disposition', + }; + this.pagesValidation[19] = { + valid: this.getStructureControl('labelsQualifications').valid, + name: 'Labélisations proposées', + }; + this.pagesValidation[20] = { + valid: this.getStructureControl('equipmentsAndServices').valid, + name: 'Autres services proposés', + }; + this.pagesValidation[21] = { + valid: this.getStructureControl('description').valid, + name: 'Présentation de la structure', + }; + this.pagesValidation[22] = { + valid: this.getStructureControl('lockdownActivity').valid, + name: 'Informations spécifiques à la période COVID', }; - this.pagesValidation[19] = { valid: this.getStructureControl('labelsQualifications').valid }; - this.pagesValidation[20] = { valid: this.getStructureControl('equipmentsAndServices').valid }; - this.pagesValidation[21] = { valid: this.getStructureControl('description').valid }; - this.pagesValidation[22] = { valid: this.getStructureControl('lockdownActivity').valid }; this.pagesValidation[23] = { valid: this.userAcceptSavedDate }; //this.pagesValidation[24] = { valid: true }; this.updatePageValid(); @@ -577,19 +601,23 @@ export class FormComponent implements OnInit { let structure: Structure = this.structureForm.value; structure.hours = this.hoursForm.value; let user: User; - if (this.profile) { - user = this.profile; - structure.accountVerified = true; - this.createStructure(structure, user); + if (this.isEditMode) { + console.log('ok'); } else { - if (this.accountForm.valid) { - user = new User(this.accountForm.value); - this.authService - .register(user) - .pipe(first()) - .subscribe(() => { - this.createStructure(structure, user); - }); + if (this.profile) { + user = this.profile; + structure.accountVerified = true; + this.createStructure(structure, user); + } else { + if (this.accountForm.valid) { + user = new User(this.accountForm.value); + this.authService + .register(user) + .pipe(first()) + .subscribe(() => { + this.createStructure(structure, user); + }); + } } } } @@ -627,4 +655,10 @@ export class FormComponent implements OnInit { this.resolve(hasAccept); this.showConfirmationModal = false; } + + // Function for editMode only + + public goToSpecificPage(numPage: number): void { + this.currentPage = numPage; + } } diff --git a/src/assets/scss/_layout.scss b/src/assets/scss/_layout.scss index b80043aa2..94ebedd43 100644 --- a/src/assets/scss/_layout.scss +++ b/src/assets/scss/_layout.scss @@ -1,4 +1,5 @@ $header-height: 70px; $footer-height: 56px; -$header-height-phone: 50px; +$header-height-phone: 70px; $footer-height-phone: 75px; +$progressBar-height: 50px; -- GitLab From e2285fab985a2eb166c5445784ad652e8ecb6e76 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Mon, 8 Feb 2021 18:55:28 +0100 Subject: [PATCH 03/23] fix(form) : fix api + add logic to cancel + validate form --- src/app/form/form.component.html | 50 ++++++++++++++++--- src/app/form/form.component.scss | 72 +++++++++++++++++++++++---- src/app/form/form.component.ts | 58 +++++++++++++-------- src/app/services/structure.service.ts | 3 +- 4 files changed, 144 insertions(+), 39 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index a09a877e4..1af4e1fcb 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -4,7 +4,17 @@ [content]="'Il vous faudra de nouveau remplir le formulaire si vous quittez'" (closed)="hasRedirectionAccepted($event)" ></app-modal-confirmation> - <div class="content"> + <div class="content" [ngClass]="{ editMode: isEditMode }"> + <div class="returnBtnSection" *ngIf="isEditMode && currentPage != 0"> + <button class="btn previous" (click)="goToSpecificPage(0, false)"> + <div class="rowBtn" fxLayout="row" fxLayoutAlign="center center"> + <svg class="chevronLeft" aria-hidden="true"> + <use [attr.xlink:href]="'assets/form/sprite.svg#chevronLeft'"></use> + </svg> + Retour + </div> + </button> + </div> <div class="progressBar" *ngIf="currentPage != 0 && !isEditMode" @@ -33,12 +43,22 @@ <button class="btn start" (click)="nextPage()">C'est Parti</button> </div> </div> - <div *ngIf="currentPage == 0 && isEditMode" class="home page" fxLayout="column" fxLayoutAlign="space-between"> + <div *ngIf="currentPage == 0 && isEditMode" class="editHome page" fxLayout="column" fxLayoutAlign="space-between"> <h2>Modification de la structure</h2> <div> <div class="summary" *ngFor="let page of pagesValidation; let index = index"> - <div class="itemSummary" *ngIf="page.name" (click)="goToSpecificPage(index)"> + <div + class="itemSummary" + [ngClass]="{ last: index == 22 }" + fxLayout="row" + fxLayoutAlign="space-between center" + *ngIf="page.name" + (click)="goToSpecificPage(index, false)" + > {{ page.name }} + <svg class="chevronRight" aria-hidden="true"> + <use [attr.xlink:href]="'assets/form/sprite.svg#chevronRight'"></use> + </svg> </div> </div> </div> @@ -181,7 +201,7 @@ </div> </div> </form> - <form [formGroup]="structureForm" *ngIf="structureForm" [ngClass]="{ editMode: isEditMode }"> + <form [formGroup]="structureForm" *ngIf="structureForm"> <div *ngIf="currentPage == 4" class="page"> <div class="title"> <h3>Quelle structure voulez-vous réferencer ?</h3> @@ -992,7 +1012,14 @@ ></app-footer-form> </div> <div fxLayout="row" fxLayoutAlign="center center" *ngIf="isEditMode"> - <button class="btn" (click)="goToSpecificPage(0)">Validé</button> + <button + class="btn" + [ngClass]="{ invalid: !isPageValid }" + [disabled]="!isPageValid" + (click)="goToSpecificPage(0, true)" + > + Validé + </button> </div> <button *ngIf="currentPage == nbPagesForm && !profile" @@ -1011,8 +1038,8 @@ Voir ma structure </button> </div> - <div *ngIf="isEditMode" class="footerEditMode"> - <div fxLayout="row" fxLayoutAlign="center center" *ngIf="isEditMode && currentPage == 0"> + <div *ngIf="isEditMode && currentPage == 0" class="footerEditMode"> + <div fxLayout="row" fxLayoutAlign="center center"> <button class="btn unique" (click)="validateForm()">Terminé</button> </div> </div> @@ -1026,7 +1053,14 @@ ></app-footer-form> </div> <div fxLayout="row" fxLayoutAlign="center center" *ngIf="isEditMode"> - <button class="btn unique" (click)="goToSpecificPage(0)">Validé</button> + <button + class="btn" + [ngClass]="{ invalid: !isPageValid }" + [disabled]="!isPageValid" + (click)="goToSpecificPage(0, true)" + > + Validé + </button> </div> <button *ngIf="currentPage == nbPagesForm && !profile" diff --git a/src/app/form/form.component.scss b/src/app/form/form.component.scss index 2569f0c24..514a150a0 100644 --- a/src/app/form/form.component.scss +++ b/src/app/form/form.component.scss @@ -8,15 +8,6 @@ h3 { margin: 0; } -form { - @media #{$tablet} { - &.editMode { - .page { - height: calc(100vh - #{$header-height-phone} - #{$footer-height-phone} - 1px); // -1px because of header border - } - } - } -} .form { background: white; width: 100vw; @@ -43,6 +34,9 @@ form { &.unique { width: 240px; } + &.invalid { + opacity: 0.4; + } } &.desktop { @media #{$tablet} { @@ -98,6 +92,23 @@ form { } } .content { + .editHome { + height: calc( + 100vh - #{$header-height} - #{$footer-height} - 81px - 1px + ) !important; // -1px because of header border + } + @media #{$tablet} { + &.editMode { + .page { + height: calc( + 100vh - #{$header-height-phone} - #{$footer-height-phone} - 87px - 1px + ); // -1px because of header border + } + .editHome { + height: calc(100vh - #{$header-height-phone} - 87px - 1px) !important; // -1px because of header border + } + } + } padding: 0 16px; display: block; overflow-y: auto; @@ -208,10 +219,29 @@ form { width: 192px; @include btn-bold; + &.previous { + background-color: initial; + color: $grey-2; + width: 120px; + border-radius: 6px; + border: 1px solid $grey-4; + } &.start { margin-bottom: 26px; } } +.chevronRight { + height: 24px; + width: 24px; + stroke: $grey-2; + margin-left: 10px; +} +.chevronLeft { + height: 24px; + width: 24px; + stroke: $black; + margin-right: 10px; +} .progressBar { height: #{$progressBar-height}; max-width: 960px; @@ -276,6 +306,7 @@ img { border: 1px solid $grey-4; border-radius: 4px; margin-bottom: 13px; + //margin-right: 40px; @media #{$tablet} { width: 296px; } @@ -461,8 +492,29 @@ img { width: 100%; position: fixed; bottom: 56px; - margin: 20px 0; + margin: 0; + background: $white; + left: 0; + border-top: 1px solid $grey-4; + padding: 20px 0; @media #{$tablet} { bottom: 0; + left: 0; + } +} +.returnBtnSection { + max-width: 960px; + margin: 24px auto; +} +.itemSummary { + height: 60px; + border-bottom: 1px solid $grey-4; + @include cn-bold-20; + cursor: pointer; + &:hover { + background: #0000000d; + } + &.last { + border: 0; } } diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index ce8f865fc..41603d55c 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -30,6 +30,7 @@ export class FormComponent implements OnInit { public structureForm: FormGroup; public accountForm: FormGroup; public hoursForm: FormGroup; + public editForm: FormGroup; public labelsQualifications: Category; public publics: Category; public accessModality: Category; @@ -66,7 +67,8 @@ export class FormComponent implements OnInit { private structureService: StructureService, private searchService: SearchService, private profileService: ProfileService, - private authService: AuthService + private authService: AuthService, + private router: Router ) {} async ngOnInit(): Promise<void> { @@ -138,7 +140,27 @@ export class FormComponent implements OnInit { ); // Init form - this.structureForm = new FormGroup({ + this.structureForm = this.createStructureForm(structure); + this.editForm = this.createStructureForm(structure); + + // Init hours form + this.hoursForm = new FormGroup({ + monday: this.createDay(structure.hours.monday), + tuesday: this.createDay(structure.hours.tuesday), + wednesday: this.createDay(structure.hours.wednesday), + thursday: this.createDay(structure.hours.thursday), + friday: this.createDay(structure.hours.friday), + saturday: this.createDay(structure.hours.saturday), + sunday: this.createDay(structure.hours.sunday), + }); + if (this.isEditMode) { + this.showCollapse(structure); + } + + this.setValidationsForm(); + } + private createStructureForm(structure): FormGroup { + const form = new FormGroup({ _id: new FormControl(structure._id), coord: new FormControl(structure.coord), structureType: new FormControl(structure.structureType, Validators.required), @@ -201,22 +223,7 @@ export class FormComponent implements OnInit { freeWorkShop: new FormControl(structure.freeWorkShop, Validators.required), freeWifi: new FormControl(structure.freeWifi, Validators.required), }); - - // Init hours form - this.hoursForm = new FormGroup({ - monday: this.createDay(structure.hours.monday), - tuesday: this.createDay(structure.hours.tuesday), - wednesday: this.createDay(structure.hours.wednesday), - thursday: this.createDay(structure.hours.thursday), - friday: this.createDay(structure.hours.friday), - saturday: this.createDay(structure.hours.saturday), - sunday: this.createDay(structure.hours.sunday), - }); - if (this.isEditMode) { - this.showCollapse(structure); - } - - this.setValidationsForm(); + return form; } private showCollapse(s: Structure): void { if (s.website) { @@ -232,6 +239,7 @@ export class FormComponent implements OnInit { this.showProceduresAccompaniment = true; } this.trainingCategories.forEach((categ: { category: Category; openned: boolean }) => { + categ.openned = false; switch (categ.category.id) { case 'accessRight': if (s.accessRight.length) { @@ -261,6 +269,7 @@ export class FormComponent implements OnInit { } }); this.equipmentsAndServices.forEach((equipment: { module: Module; openned: boolean }) => { + equipment.openned = false; switch (equipment.module.id) { case 'ordinateurs': if (s.equipmentsAndServices.includes('ordinateurs')) { @@ -602,7 +611,9 @@ export class FormComponent implements OnInit { structure.hours = this.hoursForm.value; let user: User; if (this.isEditMode) { - console.log('ok'); + this.structureService.editStructure(structure).subscribe((s: Structure) => { + this.router.navigateByUrl('home', { state: { data: s } }); + }); } else { if (this.profile) { user = this.profile; @@ -658,7 +669,14 @@ export class FormComponent implements OnInit { // Function for editMode only - public goToSpecificPage(numPage: number): void { + public goToSpecificPage(numPage: number, isSave: boolean): void { + if (isSave) { + this.editForm = this.createStructureForm(new Structure(this.structureForm.value)); + } else { + const structure = new Structure(this.editForm.value); + this.structureForm = this.createStructureForm(structure); + this.showCollapse(structure); + } this.currentPage = numPage; } } diff --git a/src/app/services/structure.service.ts b/src/app/services/structure.service.ts index 41a02af5a..e370f3c66 100644 --- a/src/app/services/structure.service.ts +++ b/src/app/services/structure.service.ts @@ -31,8 +31,9 @@ export class StructureService { return this.http.post(`${this.baseUrl}`, { structure, idUser }).pipe(map((item: Structure) => new Structure(item))); } - public editStructure(id: string, structure: Structure): Observable<Structure> { + public editStructure(structure: Structure): Observable<Structure> { structure.updatedAt = new Date().toString(); + const id = structure._id; delete structure._id; // id should not be provided for update return this.http.put(`${this.baseUrl}/${id}`, structure).pipe(map((item: Structure) => new Structure(item))); } -- GitLab From 0f3da6c5e657c550ce044be706619b362dc1f303 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Mon, 8 Feb 2021 19:03:21 +0100 Subject: [PATCH 04/23] fix(form) : fix deactivate condition --- 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 41603d55c..534201db7 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -651,7 +651,7 @@ export class FormComponent implements OnInit { public canExit(): Promise<boolean> { // Avoid confirmation when user submit form and leave. - if (this.currentPage == this.nbPagesForm) { + if (this.currentPage == this.nbPagesForm || this.isEditMode) { return new Promise((resolve) => resolve(true)); } else { return new Promise((resolve) => this.showModal(resolve)); -- GitLab From 3a6753a0ad7bedee5ed6bf54625a8912fec3a622 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Mon, 8 Feb 2021 19:14:36 +0100 Subject: [PATCH 05/23] fix(detailsStructure) : hide services on equipments tab --- src/app/structure-list/components/card/card.component.html | 2 +- src/app/structure-list/components/card/card.component.ts | 5 +++++ .../structure-details/structure-details.component.html | 5 +++-- .../structure-details/structure-details.component.ts | 5 +++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/app/structure-list/components/card/card.component.html b/src/app/structure-list/components/card/card.component.html index b9bc6cc92..2a02fd3a6 100644 --- a/src/app/structure-list/components/card/card.component.html +++ b/src/app/structure-list/components/card/card.component.html @@ -16,7 +16,7 @@ <span class="typeStructure">{{ structure.getLabelTypeStructure() }}</span> <div fxLayout="row" fxLayoutAlign="none flex-end" fxLayoutGap="7px" *ngIf="structure.hasEquipments()"> <app-svg-icon - *ngFor="let equipement of structure.equipmentsAndServices" + *ngFor="let equipement of filterOnlyEquipments(structure.equipmentsAndServices)" [type]="'ico'" [iconColor]="'grey'" [icon]="structure.getEquipmentsIcon(equipement)" diff --git a/src/app/structure-list/components/card/card.component.ts b/src/app/structure-list/components/card/card.component.ts index 58d7f395d..3f3b6d5af 100644 --- a/src/app/structure-list/components/card/card.component.ts +++ b/src/app/structure-list/components/card/card.component.ts @@ -35,4 +35,9 @@ export class CardComponent implements OnInit { public cardHover(): void { this.hover.emit(this.structure); } + public filterOnlyEquipments(equipmentsAndServices: string[]): string[] { + return equipmentsAndServices.filter((eqpt) => + ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners'].includes(eqpt) + ); + } } diff --git a/src/app/structure-list/components/structure-details/structure-details.component.html b/src/app/structure-list/components/structure-details/structure-details.component.html index 7a84db49a..effd118fd 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.html +++ b/src/app/structure-list/components/structure-details/structure-details.component.html @@ -12,8 +12,9 @@ <div class="typeInformationHeader" fxLayout="column"> <h3>{{ structure.getLabelTypeStructure() }}</h3> <div fxLayout="row" fxLayoutAlign="none flex-end" fxLayoutGap="7px" *ngIf="structure.hasEquipments()"> + <div></div> <app-svg-icon - *ngFor="let equipement of structure.equipmentsAndServices" + *ngFor="let equipement of filterOnlyEquipments(structure.equipmentsAndServices)" [type]="'ico'" [iconColor]="'currentColor'" [icon]="structure.getEquipmentsIcon(equipement)" @@ -215,7 +216,7 @@ <h2>Équipements</h2> </div> <div fxLayout="column"> - <p *ngFor="let equipement of structure.equipmentsAndServices" class="no-margin-bottom"> + <p *ngFor="let equipement of filterOnlyEquipments(structure.equipmentsAndServices)" class="no-margin-bottom"> {{ getEquipmentsLabel(equipement) }} <span *ngIf="equipement == 'ordinateurs' && structure.nbComputers"> : {{ structure.nbComputers }}</span> <span *ngIf="equipement == 'tablettes' && structure.nbTablets"> : {{ structure.nbTablets }}</span> diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index c94ea5747..9029f08a0 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -203,4 +203,9 @@ export class StructureDetailsComponent implements OnInit { this.tclStopPoints = res; }); } + public filterOnlyEquipments(equipmentsAndServices: string[]): string[] { + return equipmentsAndServices.filter((eqpt) => + ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners'].includes(eqpt) + ); + } } -- GitLab From 5cffa1b2dc5282a63e936c2cf0c3f5d19fdc90ab Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Tue, 9 Feb 2021 12:24:33 +0100 Subject: [PATCH 06/23] fix(form) : fix description/covid --- 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 534201db7..03290090e 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -166,7 +166,7 @@ export class FormComponent implements OnInit { structureType: new FormControl(structure.structureType, Validators.required), structureName: new FormControl(structure.structureName, Validators.required), description: new FormControl(structure.description), - lockdownActivity: new FormControl(structure.description), + lockdownActivity: new FormControl(structure.lockdownActivity), address: new FormGroup({ numero: new FormControl(structure.address.numero), street: new FormControl(structure.address.street, Validators.required), -- GitLab From 68b2eb8fb8e127ee2d27ac090b668131e05c5d2e Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Tue, 9 Feb 2021 12:28:40 +0100 Subject: [PATCH 07/23] fix(structureDetails) : add a forgot category --- .../components/structure-details/structure-details.component.ts | 2 ++ src/app/structure-list/enum/public.enum.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index 9029f08a0..49633ddf7 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -175,6 +175,8 @@ export class StructureDetailsComponent implements OnInit { return 'Séniors (+ de 65 ans)'; case PublicCategorie.all: return 'Tout public'; + case PublicCategorie.under16Years: + return 'Moins de 16 ans'; default: return null; } diff --git a/src/app/structure-list/enum/public.enum.ts b/src/app/structure-list/enum/public.enum.ts index 1f8371303..272561297 100644 --- a/src/app/structure-list/enum/public.enum.ts +++ b/src/app/structure-list/enum/public.enum.ts @@ -1,4 +1,5 @@ export enum PublicCategorie { + under16Years = 'moinsDe16Ans', young = 'jeunes1625Ans', adult = 'adultes', elderly = 'seniorsPlusDe65Ans', -- GitLab From 09ad13b03f5da9ccda9f178cd2768ed3ca01a798 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Tue, 9 Feb 2021 16:20:06 +0100 Subject: [PATCH 08/23] fix(form) : fix regex to accept space on surname --- src/app/shared/enum/regex.enum.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/enum/regex.enum.ts b/src/app/shared/enum/regex.enum.ts index 7a564960f..4f83475e6 100644 --- a/src/app/shared/enum/regex.enum.ts +++ b/src/app/shared/enum/regex.enum.ts @@ -1,6 +1,6 @@ export enum Regex { email = '[a-z0-9.-]+@[a-z0-9.-]+[.][a-z]{2,3}', - textWithoutNumber = '[A-Za-zÀ-ÖØ-öø-ÿ-]{1,}', + textWithoutNumber = '[A-Za-zÀ-ÖØ-öø-ÿ- ]{1,}', phone = '([0-9]{2} ){4}[0-9]{2}', website = '(www[.])[a-z0-9.-]*[.][a-z]{2,3}', linkedIn = '(linkedin.com/in/[a-z0-9A-Z.-]{1,})', -- GitLab From 23639cde03635327347209ffc1c268b55a379216 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Tue, 9 Feb 2021 16:21:52 +0100 Subject: [PATCH 09/23] fix(form) : fix text --- src/app/form/form.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 1af4e1fcb..37549e72e 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -277,7 +277,7 @@ </div> <div *ngIf="currentPage == 7" class="page"> <div class="title"> - <h3>Quels sont les modalités d'accueil ?</h3> + <h3>Quelles sont les modalités d'accueil ?</h3> <p>Plusieurs choix possibles</p> </div> <div *ngIf="accessModality" fxLayout="row wrap" fxLayoutGap="16px" fxLayoutAlign="flex-start"> -- GitLab From 0f4045503d6df24002ac21d174dd6b92462318a4 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Tue, 9 Feb 2021 17:44:54 +0100 Subject: [PATCH 10/23] fix(buttonForm) : export logic to buttons.scss --- .../footer-form/footer-form.component.html | 9 +++++-- .../footer-form/footer-form.component.scss | 11 +-------- src/app/form/form.component.html | 18 +++++++------- src/app/form/form.component.scss | 24 +------------------ .../modal-confirmation.component.html | 4 ++-- .../modal-confirmation.component.scss | 19 ++++----------- src/assets/scss/_buttons.scss | 15 ++++++++++++ 7 files changed, 39 insertions(+), 61 deletions(-) diff --git a/src/app/footer-form/footer-form.component.html b/src/app/footer-form/footer-form.component.html index b4c50c392..c2e91330f 100644 --- a/src/app/footer-form/footer-form.component.html +++ b/src/app/footer-form/footer-form.component.html @@ -1,5 +1,5 @@ <div fxLayout="row" fxLayoutGap="10px" fxLayoutAlign="center center"> - <button class="btn previous" (click)="goToPreviousPage()"> + <button class="btn-primary small previous" (click)="goToPreviousPage()"> <div class="rowBtn" fxLayout="row" fxLayoutAlign="center center"> <svg class="chevronLeft" aria-hidden="true"> <use [attr.xlink:href]="'assets/form/sprite.svg#chevronLeft'"></use> @@ -7,7 +7,12 @@ Précédent </div> </button> - <button class="btn next" (click)="goToNextPage()" [disabled]="!isValid" [ngClass]="{ invalid: !isValid }"> + <button + class="btn-primary small next" + (click)="goToNextPage()" + [disabled]="!isValid" + [ngClass]="{ invalid: !isValid }" + > <div class="rowBtn" fxLayout="row" fxLayoutAlign="center center"> Suivant<svg class="chevronRight" aria-hidden="true"> <use [attr.xlink:href]="'assets/form/sprite.svg#chevronRight'"></use> diff --git a/src/app/footer-form/footer-form.component.scss b/src/app/footer-form/footer-form.component.scss index dfecb8334..7df6b3dd1 100644 --- a/src/app/footer-form/footer-form.component.scss +++ b/src/app/footer-form/footer-form.component.scss @@ -1,16 +1,7 @@ @import '../../assets/scss/color'; @import '../../assets/scss/typography'; -.btn { - background: $secondary-color; - border-radius: 4px; - outline: none; - cursor: pointer; - border: 0; - color: $white; - height: 40px; - width: 149px; - @include btn-bold; +.btn-primary { &.previous { background-color: initial; color: $grey-2; diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 37549e72e..176b86f8f 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -6,7 +6,7 @@ ></app-modal-confirmation> <div class="content" [ngClass]="{ editMode: isEditMode }"> <div class="returnBtnSection" *ngIf="isEditMode && currentPage != 0"> - <button class="btn previous" (click)="goToSpecificPage(0, false)"> + <button class="btn-primary previous" (click)="goToSpecificPage(0, false)"> <div class="rowBtn" fxLayout="row" fxLayoutAlign="center center"> <svg class="chevronLeft" aria-hidden="true"> <use [attr.xlink:href]="'assets/form/sprite.svg#chevronLeft'"></use> @@ -40,7 +40,7 @@ <p>Une fois réalisé cela vous permettra d'être référencé sur la platefome</p> </div> <div class="btnStart"> - <button class="btn start" (click)="nextPage()">C'est Parti</button> + <button class="btn-primary start" (click)="nextPage()">C'est Parti</button> </div> </div> <div *ngIf="currentPage == 0 && isEditMode" class="editHome page" fxLayout="column" fxLayoutAlign="space-between"> @@ -1013,7 +1013,7 @@ </div> <div fxLayout="row" fxLayoutAlign="center center" *ngIf="isEditMode"> <button - class="btn" + class="btn-primary" [ngClass]="{ invalid: !isPageValid }" [disabled]="!isPageValid" (click)="goToSpecificPage(0, true)" @@ -1023,7 +1023,7 @@ </div> <button *ngIf="currentPage == nbPagesForm && !profile" - class="btn validate unique" + class="btn-primary validate unique" routerLink="/home" [routerLinkActive]="'active'" > @@ -1031,7 +1031,7 @@ </button> <button *ngIf="currentPage == nbPagesForm && profile" - class="btn unique" + class="btn-primary unique" routerLink="/home" [state]="{ data: createdStructure }" > @@ -1040,7 +1040,7 @@ </div> <div *ngIf="isEditMode && currentPage == 0" class="footerEditMode"> <div fxLayout="row" fxLayoutAlign="center center"> - <button class="btn unique" (click)="validateForm()">Terminé</button> + <button class="btn-primary unique" (click)="validateForm()">Terminé</button> </div> </div> </div> @@ -1054,7 +1054,7 @@ </div> <div fxLayout="row" fxLayoutAlign="center center" *ngIf="isEditMode"> <button - class="btn" + class="btn-primary" [ngClass]="{ invalid: !isPageValid }" [disabled]="!isPageValid" (click)="goToSpecificPage(0, true)" @@ -1064,7 +1064,7 @@ </div> <button *ngIf="currentPage == nbPagesForm && !profile" - class="btn validate unique" + class="btn-primary validate unique" routerLink="/home" [routerLinkActive]="'active'" > @@ -1072,7 +1072,7 @@ </button> <button *ngIf="currentPage == nbPagesForm && profile" - class="btn unique" + class="btn-primary unique" routerLink="/home" [state]="{ data: createdStructure }" > diff --git a/src/app/form/form.component.scss b/src/app/form/form.component.scss index 514a150a0..5766a9a3c 100644 --- a/src/app/form/form.component.scss +++ b/src/app/form/form.component.scss @@ -26,18 +26,6 @@ h3 { max-width: 960px; margin: 20px auto; text-align: center; - .btn { - width: 149px; - &.validate { - background-color: $green-1; - } - &.unique { - width: 240px; - } - &.invalid { - opacity: 0.4; - } - } &.desktop { @media #{$tablet} { display: none; @@ -208,17 +196,7 @@ h3 { } } -.btn { - background: $secondary-color; - border-radius: 4px; - outline: none; - cursor: pointer; - border: 0; - color: $white; - height: 40px; - width: 192px; - @include btn-bold; - +.btn-primary { &.previous { background-color: initial; color: $grey-2; diff --git a/src/app/shared/components/modal-confirmation/modal-confirmation.component.html b/src/app/shared/components/modal-confirmation/modal-confirmation.component.html index fe2cf5816..603c74f41 100644 --- a/src/app/shared/components/modal-confirmation/modal-confirmation.component.html +++ b/src/app/shared/components/modal-confirmation/modal-confirmation.component.html @@ -4,8 +4,8 @@ <h3>ATTENTION</h3> <p>{{ content }}</p> <div class="footerModal" fxLayout="row" fxLayoutAlign="space-around center"> - <button class="btn leave" (click)="closeModal(true)">Confirmer</button> - <button class="btn" (click)="closeModal(false)">Annuler</button> + <button class="btn-primary small leave" (click)="closeModal(true)">Confirmer</button> + <button class="btn-primary small" (click)="closeModal(false)">Annuler</button> </div> </div> </div> diff --git a/src/app/shared/components/modal-confirmation/modal-confirmation.component.scss b/src/app/shared/components/modal-confirmation/modal-confirmation.component.scss index 5411fa484..7e11f5659 100644 --- a/src/app/shared/components/modal-confirmation/modal-confirmation.component.scss +++ b/src/app/shared/components/modal-confirmation/modal-confirmation.component.scss @@ -29,21 +29,10 @@ width: 100%; margin-top: 14px; @include cn-bold-16; - .btn { - background: $secondary-color; - border-radius: 4px; - outline: none; - cursor: pointer; - border: 0; - color: $white; - height: 40px; - @include btn-bold; - width: 149px; - &.leave { - background: none; - color: $grey-1; - text-decoration: underline; - } + .leave { + background: none; + color: $grey-1; + text-decoration: underline; } } } diff --git a/src/assets/scss/_buttons.scss b/src/assets/scss/_buttons.scss index 6f8458fcf..76f220fca 100644 --- a/src/assets/scss/_buttons.scss +++ b/src/assets/scss/_buttons.scss @@ -62,3 +62,18 @@ line-height: 18px; padding: 8px 15px; } + +.btn-primary { + background: $secondary-color; + border-radius: 4px; + outline: none; + cursor: pointer; + border: 0; + color: $white; + height: 40px; + width: 192px; + @include btn-bold; + &.small { + width: 149px; + } +} -- GitLab From c68f9baf3e433db7f34d06446d205e17d5ed48cd Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Tue, 9 Feb 2021 17:59:41 +0100 Subject: [PATCH 11/23] fix(editForm): fix logic validate/close form --- src/app/form/form.component.html | 2 +- src/app/form/form.component.ts | 8 ++++++-- src/assets/scss/_buttons.scss | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 176b86f8f..fcac27064 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -1040,7 +1040,7 @@ </div> <div *ngIf="isEditMode && currentPage == 0" class="footerEditMode"> <div fxLayout="row" fxLayoutAlign="center center"> - <button class="btn-primary unique" (click)="validateForm()">Terminé</button> + <button class="btn-primary unique" (click)="closeEditMode()">Terminé</button> </div> </div> </div> diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 03290090e..55847505a 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -612,7 +612,7 @@ export class FormComponent implements OnInit { let user: User; if (this.isEditMode) { this.structureService.editStructure(structure).subscribe((s: Structure) => { - this.router.navigateByUrl('home', { state: { data: s } }); + this.editForm = this.createStructureForm(s); }); } else { if (this.profile) { @@ -671,7 +671,7 @@ export class FormComponent implements OnInit { public goToSpecificPage(numPage: number, isSave: boolean): void { if (isSave) { - this.editForm = this.createStructureForm(new Structure(this.structureForm.value)); + this.validateForm(); } else { const structure = new Structure(this.editForm.value); this.structureForm = this.createStructureForm(structure); @@ -679,4 +679,8 @@ export class FormComponent implements OnInit { } this.currentPage = numPage; } + + public closeEditMode(): void { + this.router.navigateByUrl('home', { state: { data: this.editForm.value } }); + } } diff --git a/src/assets/scss/_buttons.scss b/src/assets/scss/_buttons.scss index 76f220fca..ec08d9b85 100644 --- a/src/assets/scss/_buttons.scss +++ b/src/assets/scss/_buttons.scss @@ -76,4 +76,7 @@ &.small { width: 149px; } + &.invalid { + opacity: 0.4; + } } -- GitLab From dfa65ec175cb18593408166212ae0140bf6546b8 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Wed, 10 Feb 2021 14:54:08 +0100 Subject: [PATCH 12/23] fix(form): bug homePage blink on editForm --- src/app/form/form.component.html | 2 +- src/app/form/form.component.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index fcac27064..d495e9ef1 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -4,7 +4,7 @@ [content]="'Il vous faudra de nouveau remplir le formulaire si vous quittez'" (closed)="hasRedirectionAccepted($event)" ></app-modal-confirmation> - <div class="content" [ngClass]="{ editMode: isEditMode }"> + <div class="content" *ngIf="!isLoading" [ngClass]="{ editMode: isEditMode }"> <div class="returnBtnSection" *ngIf="isEditMode && currentPage != 0"> <button class="btn-primary previous" (click)="goToSpecificPage(0, false)"> <div class="rowBtn" fxLayout="row" fxLayoutAlign="center center"> diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 55847505a..94fc88cb6 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -62,6 +62,7 @@ export class FormComponent implements OnInit { public userAcceptSavedDate = false; public showMenu = false; public isEditMode = false; + public isLoading = false; constructor( private structureService: StructureService, @@ -72,11 +73,13 @@ export class FormComponent implements OnInit { ) {} async ngOnInit(): Promise<void> { + this.isLoading = true; this.profileService.getProfile().then((user: User) => { this.profile = user; }); await this.setCategories(); // Check if it's a new structure or edit structure + this.isLoading = false; if (history.state.data) { this.isEditMode = true; this.initForm(new Structure(history.state.data)); -- GitLab From c0ca979379ad5b6eefb6d9b3ff26c217b3e488d2 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Wed, 10 Feb 2021 15:05:52 +0100 Subject: [PATCH 13/23] fix(form) : fix modifiedAt on detail structure after edit --- src/app/form/form.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 94fc88cb6..233f6af6f 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -615,6 +615,7 @@ export class FormComponent implements OnInit { let user: User; if (this.isEditMode) { this.structureService.editStructure(structure).subscribe((s: Structure) => { + this.createdStructure = s; this.editForm = this.createStructureForm(s); }); } else { @@ -684,6 +685,6 @@ export class FormComponent implements OnInit { } public closeEditMode(): void { - this.router.navigateByUrl('home', { state: { data: this.editForm.value } }); + this.router.navigateByUrl('home', { state: { data: this.createdStructure } }); } } -- GitLab From 6c4d27004f7f8b73bb030d68763cc9edceaac1a7 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Wed, 10 Feb 2021 15:20:39 +0100 Subject: [PATCH 14/23] fix(structureDetails) : update isOpen on edit hours structure --- src/app/form/form.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 233f6af6f..29618ad4b 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -17,6 +17,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { AuthService } from '../services/auth.service'; import { first } from 'rxjs/operators'; import { Regex } from '../shared/enum/regex.enum'; +const { DateTime } = require('luxon'); @Component({ selector: 'app-structureForm', templateUrl: './form.component.html', @@ -615,7 +616,7 @@ export class FormComponent implements OnInit { let user: User; if (this.isEditMode) { this.structureService.editStructure(structure).subscribe((s: Structure) => { - this.createdStructure = s; + this.createdStructure = this.structureService.updateOpeningStructure(s, DateTime.local()); this.editForm = this.createStructureForm(s); }); } else { -- GitLab From d203667ace6afd1e48e1dfd3776bb01e77823478 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Wed, 10 Feb 2021 16:35:45 +0100 Subject: [PATCH 15/23] fix(form) : fix text + css --- src/app/form/form.component.html | 6 +++--- src/app/form/form.component.scss | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index d495e9ef1..040e4cc7c 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -1018,7 +1018,7 @@ [disabled]="!isPageValid" (click)="goToSpecificPage(0, true)" > - Validé + Valider </button> </div> <button @@ -1040,7 +1040,7 @@ </div> <div *ngIf="isEditMode && currentPage == 0" class="footerEditMode"> <div fxLayout="row" fxLayoutAlign="center center"> - <button class="btn-primary unique" (click)="closeEditMode()">Terminé</button> + <button class="btn-primary unique" (click)="closeEditMode()">Terminer</button> </div> </div> </div> @@ -1059,7 +1059,7 @@ [disabled]="!isPageValid" (click)="goToSpecificPage(0, true)" > - Validé + Valider </button> </div> <button diff --git a/src/app/form/form.component.scss b/src/app/form/form.component.scss index 5766a9a3c..cec676cd2 100644 --- a/src/app/form/form.component.scss +++ b/src/app/form/form.component.scss @@ -284,7 +284,6 @@ img { border: 1px solid $grey-4; border-radius: 4px; margin-bottom: 13px; - //margin-right: 40px; @media #{$tablet} { width: 296px; } @@ -490,7 +489,7 @@ img { @include cn-bold-20; cursor: pointer; &:hover { - background: #0000000d; + background: $grey-6; } &.last { border: 0; -- GitLab From 273b9e0d614d1471e22b00ff62f21569ec869f3d Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Wed, 10 Feb 2021 17:04:25 +0100 Subject: [PATCH 16/23] fix(editForm) : add header name structure on page too --- src/app/form/form.component.html | 4 +++- src/app/form/form.component.scss | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 040e4cc7c..58d7bafd0 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -5,6 +5,9 @@ (closed)="hasRedirectionAccepted($event)" ></app-modal-confirmation> <div class="content" *ngIf="!isLoading" [ngClass]="{ editMode: isEditMode }"> + <div class="headerEditMode" *ngIf="isEditMode"> + <h2>Modification de {{ editForm.get('structureName').value }}</h2> + </div> <div class="returnBtnSection" *ngIf="isEditMode && currentPage != 0"> <button class="btn-primary previous" (click)="goToSpecificPage(0, false)"> <div class="rowBtn" fxLayout="row" fxLayoutAlign="center center"> @@ -44,7 +47,6 @@ </div> </div> <div *ngIf="currentPage == 0 && isEditMode" class="editHome page" fxLayout="column" fxLayoutAlign="space-between"> - <h2>Modification de la structure</h2> <div> <div class="summary" *ngFor="let page of pagesValidation; let index = index"> <div diff --git a/src/app/form/form.component.scss b/src/app/form/form.component.scss index cec676cd2..edf259514 100644 --- a/src/app/form/form.component.scss +++ b/src/app/form/form.component.scss @@ -82,7 +82,7 @@ h3 { .content { .editHome { height: calc( - 100vh - #{$header-height} - #{$footer-height} - 81px - 1px + 100vh - #{$header-height} - #{$footer-height} - 81px - 1px - 55px ) !important; // -1px because of header border } @media #{$tablet} { @@ -93,7 +93,7 @@ h3 { ); // -1px because of header border } .editHome { - height: calc(100vh - #{$header-height-phone} - 87px - 1px) !important; // -1px because of header border + height: calc(100vh - #{$header-height-phone} - 87px - 1px - 55px) !important; // -1px because of header border } } } @@ -495,3 +495,12 @@ img { border: 0; } } +.headerEditMode { + max-width: 960px; + margin: auto; + h2 { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + } +} -- GitLab From 7cf77c3272902d895e8db5a65401447d2bcfaf9f Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Thu, 11 Feb 2021 10:47:12 +0100 Subject: [PATCH 17/23] fix(form) : fix wifi equipments --- src/app/form/form.component.html | 4 ++-- src/app/form/form.component.ts | 6 ++++-- src/app/models/structure.model.ts | 1 - src/app/structure-list/components/card/card.component.ts | 2 +- .../structure-details/structure-details.component.ts | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 58d7bafd0..22cf64f49 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -706,8 +706,8 @@ <h3>Proposez-vous le wifi en accès libre ?</h3> </div> <app-radio-form - [selectedOption]="getStructureControl('freeWifi').value" - (selectedEvent)="onRadioBtnChange('freeWifi', $event)" + [selectedOption]="isInArray('wifiEnAccesLibre', 'equipmentsAndServices')" + (selectedEvent)="onCheckChange($event, 'equipmentsAndServices', 'wifiEnAccesLibre')" > </app-radio-form> </div> diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 29618ad4b..58d8f0d11 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -225,7 +225,6 @@ export class FormComponent implements OnInit { [Validators.required, Validators.pattern(Regex.noNullNumber)] //NOSONAR ), freeWorkShop: new FormControl(structure.freeWorkShop, Validators.required), - freeWifi: new FormControl(structure.freeWifi, Validators.required), }); return form; } @@ -425,7 +424,10 @@ export class FormComponent implements OnInit { name: 'Ateliers au numérique proposés', }; this.pagesValidation[16] = { valid: this.getStructureControl('freeWorkShop').valid, name: 'Gratuité des ateliers' }; - this.pagesValidation[17] = { valid: this.getStructureControl('freeWifi').valid, name: 'Gratuité du wifi' }; + this.pagesValidation[17] = { + valid: this.getStructureControl('equipmentsAndServices').valid, + name: 'Gratuité du wifi', + }; this.pagesValidation[18] = { valid: this.getStructureControl('equipmentsAndServices').valid && diff --git a/src/app/models/structure.model.ts b/src/app/models/structure.model.ts index 3c4569dc4..8ff53a5ee 100644 --- a/src/app/models/structure.model.ts +++ b/src/app/models/structure.model.ts @@ -37,7 +37,6 @@ export class Structure { public equipmentsAndServices: string[] = []; public hours: Week; public freeWorkShop: boolean = null; - public freeWifi: boolean = null; public otherDescription: string = null; public isOpen: boolean = false; diff --git a/src/app/structure-list/components/card/card.component.ts b/src/app/structure-list/components/card/card.component.ts index 3f3b6d5af..8a64274b6 100644 --- a/src/app/structure-list/components/card/card.component.ts +++ b/src/app/structure-list/components/card/card.component.ts @@ -37,7 +37,7 @@ export class CardComponent implements OnInit { } public filterOnlyEquipments(equipmentsAndServices: string[]): string[] { return equipmentsAndServices.filter((eqpt) => - ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners'].includes(eqpt) + ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners', 'wifiEnAccesLibre'].includes(eqpt) ); } } diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index 49633ddf7..2b4bb09e5 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -207,7 +207,7 @@ export class StructureDetailsComponent implements OnInit { } public filterOnlyEquipments(equipmentsAndServices: string[]): string[] { return equipmentsAndServices.filter((eqpt) => - ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners'].includes(eqpt) + ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners', 'wifiEnAccesLibre'].includes(eqpt) ); } } -- GitLab From 3c037a3f441d9569ba6f47ef9ff047bab6181630 Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Thu, 11 Feb 2021 11:37:33 +0100 Subject: [PATCH 18/23] fix: add page type --- src/app/form/form.component.html | 53 ++++++++++--------- src/app/form/form.component.ts | 88 ++++++++++++++++++++------------ src/app/form/pageType.enum.ts | 27 ++++++++++ 3 files changed, 111 insertions(+), 57 deletions(-) create mode 100644 src/app/form/pageType.enum.ts diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 22cf64f49..9a6d244c7 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -46,7 +46,12 @@ <button class="btn-primary start" (click)="nextPage()">C'est Parti</button> </div> </div> - <div *ngIf="currentPage == 0 && isEditMode" class="editHome page" fxLayout="column" fxLayoutAlign="space-between"> + <div + *ngIf="currentPage == pageTypeEnum.summary && isEditMode" + class="editHome page" + fxLayout="column" + fxLayoutAlign="space-between" + > <div> <div class="summary" *ngFor="let page of pagesValidation; let index = index"> <div @@ -65,7 +70,7 @@ </div> </div> </div> - <div *ngIf="currentPage == 1" class="informations page" fxLayout="column" fxLayoutGap="28px"> + <div *ngIf="currentPage == pageTypeEnum.info" class="informations page" fxLayout="column" fxLayoutGap="28px"> <h3>De quelles informations faut-il vous munir ?</h3> <img src="../../assets/form/factures.svg" alt="logo factures" /> <div> @@ -79,7 +84,7 @@ </div> </div> <form [formGroup]="accountForm" *ngIf="accountForm && !profile"> - <div *ngIf="currentPage == 2" class="page"> + <div *ngIf="currentPage == pageTypeEnum.accountInfo" class="page"> <div class="title"> <h3>Qui êtes-vous ?</h3> <p>Ces informations ne seront pas visibles sur la plateforme</p> @@ -126,7 +131,7 @@ </div> </div> </div> - <div *ngIf="currentPage == 3" class="page"> + <div *ngIf="currentPage == pageTypeEnum.accountCredentials" class="page"> <div class="title"> <h3>Quels identifiants utiliserez-vous pour vous connecter ?</h3> </div> @@ -204,7 +209,7 @@ </div> </form> <form [formGroup]="structureForm" *ngIf="structureForm"> - <div *ngIf="currentPage == 4" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureNameAndAddress" class="page"> <div class="title"> <h3>Quelle structure voulez-vous réferencer ?</h3> </div> @@ -237,7 +242,7 @@ </div> </div> </div> - <div *ngIf="currentPage == 5" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structurePhone" class="page"> <div class="title"> <h3>Quel numéro appelé pour joindre votre structure ?</h3> </div> @@ -263,7 +268,7 @@ </div> </div> </div> - <div *ngIf="currentPage == 6" class="page" fxLayout="column"> + <div *ngIf="currentPage == pageTypeEnum.structureType" class="page" fxLayout="column"> <div class="title"> <h3>Quel type de structure ?</h3> <p>1 seul choix possible</p> @@ -277,7 +282,7 @@ ></app-structure-type-picker> </div> </div> - <div *ngIf="currentPage == 7" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureAccessModality" class="page"> <div class="title"> <h3>Quelles sont les modalités d'accueil ?</h3> <p>Plusieurs choix possibles</p> @@ -293,7 +298,7 @@ </app-checkbox-form> </div> </div> - <div *ngIf="currentPage == 8" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureHours" class="page"> <div class="title"> <h3>Quels sont les horaires d'ouverture ?</h3> <p class="notRequired">facultatif</p> @@ -306,7 +311,7 @@ [isEditMode]="!isEditMode" ></app-hour-picker> </div> - <div *ngIf="currentPage == 9" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureHoursDetails" class="page"> <div class="title"> <h3>Avez-vous des précisions à apporter sur les horaires ?</h3> <p class="notRequired">facultatif</p> @@ -327,7 +332,7 @@ </p> </div> </div> - <div *ngIf="currentPage == 10" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structurePmr" class="page"> <div class="title"> <h3>Est-ce accessible pour les personnes à mobilité réduite ?</h3> </div> @@ -337,7 +342,7 @@ > </app-radio-form> </div> - <div *ngIf="currentPage == 11" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureWebAndSocialNetwork" class="page"> <div class="title"> <h3>Comment vous trouver sur internet ?</h3> </div> @@ -527,7 +532,7 @@ </div> </div> </div> - <div *ngIf="currentPage == 12" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structurePublicTarget" class="page"> <div class="title"> <h3>Quel public peut venir vous consulter ?</h3> <p>Plusieurs choix possibles</p> @@ -549,7 +554,7 @@ </button> </div> </div> - <div *ngIf="currentPage == 13" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureAccompaniment" class="page"> <div class="title"> <h3>Quel(s) accompagnement(s) proposez-vous ?</h3> <p class="notRequired">facultatif</p> @@ -629,7 +634,7 @@ </div> </div> </div> - <div *ngIf="currentPage == 14" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureOtherAccompaniment" class="page"> <div class="title"> <h3>Quelles sont les autres démarches ?</h3> </div> @@ -648,7 +653,7 @@ </p> </div> </div> - <div *ngIf="currentPage == 15" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureWorkshop" class="page"> <div class="title"> <h3>Quel(s) atelier(s) au numérique proposez-vous ?</h3> <p class="notRequired">facultatif</p> @@ -691,7 +696,7 @@ </div> </div> </div> - <div *ngIf="currentPage == 16" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureWorkshopPrice" class="page"> <div class="title"> <h3>Ces ateliers sont-ils gratuits ?</h3> </div> @@ -701,7 +706,7 @@ > </app-radio-form> </div> - <div *ngIf="currentPage == 17" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureWifi" class="page"> <div class="title"> <h3>Proposez-vous le wifi en accès libre ?</h3> </div> @@ -711,7 +716,7 @@ > </app-radio-form> </div> - <div *ngIf="currentPage == 18" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureEquipments" class="page"> <div class="title"> <h3>Quel matériel mettez-vous à disposition ?</h3> <p class="notRequired">facultatif</p> @@ -852,7 +857,7 @@ </div> </ng-container> </div> - <div *ngIf="currentPage == 19" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureLabels" class="page"> <div class="title"> <h3>Quelle(s) labelisation proposez-vous ?</h3> <p class="notRequired">facultatif</p> @@ -869,7 +874,7 @@ </app-checkbox-form> </div> </div> - <div *ngIf="currentPage == 20" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureOtherServices" class="page"> <div class="title"> <h3>Quels autres services proposez-vous ?</h3> <p class="notRequired">facultatif</p> @@ -891,7 +896,7 @@ </ng-container> </div> </div> - <div *ngIf="currentPage == 21" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureDescription" class="page"> <div class="title"> <h3>Pouvez vous présentez votre structure ?</h3> <p class="notRequired">facultatif</p> @@ -908,7 +913,7 @@ </p> </div> </div> - <div *ngIf="currentPage == 22" class="page"> + <div *ngIf="currentPage == pageTypeEnum.structureCovidInfo" class="page"> <div class="title"> <h3>Y a-t-il des informations spécifique à la période COVID ?</h3> <p class="notRequired">facultatif</p> @@ -927,7 +932,7 @@ </p> </div> </div> - <div *ngIf="currentPage == 23" class="page"> + <div *ngIf="currentPage == pageTypeEnum.cgu" class="page"> <div class="title"> <h3> Acceptez-vous que les informations saisies soient enregistrées par la Métropole de Lyon<span diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 58d8f0d11..dfc550c6d 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -17,6 +17,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { AuthService } from '../services/auth.service'; import { first } from 'rxjs/operators'; import { Regex } from '../shared/enum/regex.enum'; +import { PageTypeEnum } from './pageType.enum'; const { DateTime } = require('luxon'); @Component({ selector: 'app-structureForm', @@ -39,6 +40,7 @@ export class FormComponent implements OnInit { public proceduresAccompaniment: Category; public equipmentsAndServices: { module: Module; openned: boolean }[] = []; public trainingCategories: { category: Category; openned: boolean }[] = []; + public pageTypeEnum = PageTypeEnum; // Page and progress var public currentPage = 0; @@ -84,6 +86,8 @@ export class FormComponent implements OnInit { if (history.state.data) { this.isEditMode = true; this.initForm(new Structure(history.state.data)); + } else if (history.state.new) { + console.log('Create user only'); } else { this.initForm(new Structure()); } @@ -336,8 +340,8 @@ export class FormComponent implements OnInit { } private createTime(time: Time): FormGroup { return new FormGroup({ - openning: new FormControl(time.openning), //NOSONAR - closing: new FormControl(time.closing), //NOSONAR + openning: new FormControl(time.openning), + closing: new FormControl(time.closing), }); } @@ -363,37 +367,46 @@ export class FormComponent implements OnInit { } public setValidationsForm(): void { - this.pagesValidation[0] = { valid: true }; - this.pagesValidation[1] = { valid: true }; - this.pagesValidation[2] = { + this.pagesValidation[PageTypeEnum.summary] = { valid: true }; + this.pagesValidation[PageTypeEnum.info] = { valid: true }; + this.pagesValidation[PageTypeEnum.accountInfo] = { valid: this.accountForm.get('surname').valid && this.accountForm.get('name').valid && this.accountForm.get('phone').valid, }; - this.pagesValidation[3] = { + this.pagesValidation[PageTypeEnum.accountCredentials] = { valid: this.accountForm.get('email').valid && this.accountForm.get('password').valid && this.accountForm.get('confirmPassword').valid, }; - this.pagesValidation[4] = { + this.pagesValidation[PageTypeEnum.structureNameAndAddress] = { valid: this.getStructureControl('structureName').valid && this.getStructureControl('address').valid, name: 'Nom et adresse', }; - this.pagesValidation[5] = { valid: this.getStructureControl('contactPhone').valid, name: 'Téléphone' }; - this.pagesValidation[6] = { valid: this.getStructureControl('structureType').valid, name: 'Type de structure' }; - this.pagesValidation[7] = { valid: this.getStructureControl('accessModality').valid, name: "Modalités d'accueil " }; - this.pagesValidation[8] = { valid: this.hoursForm.valid, name: "Horaires d'ouverture" }; - this.pagesValidation[9] = { + this.pagesValidation[PageTypeEnum.structurePhone] = { + valid: this.getStructureControl('contactPhone').valid, + name: 'Téléphone', + }; + this.pagesValidation[PageTypeEnum.structureType] = { + valid: this.getStructureControl('structureType').valid, + name: 'Type de structure', + }; + this.pagesValidation[PageTypeEnum.structureAccessModality] = { + 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[10] = { + this.pagesValidation[PageTypeEnum.structurePmr] = { valid: this.getStructureControl('pmrAccess').valid, name: 'Accessibilité pour les personnes à mobilité réduite', }; - this.pagesValidation[11] = { + this.pagesValidation[PageTypeEnum.structureWebAndSocialNetwork] = { valid: this.getStructureControl('contactMail').valid && (this.getStructureControl('website').valid || !this.showWebsite) && @@ -403,18 +416,21 @@ export class FormComponent implements OnInit { !this.showSocialNetwork), name: 'Présence sur internet', }; - this.pagesValidation[12] = { valid: this.getStructureControl('publics').valid, name: 'Public admis' }; - this.pagesValidation[13] = { + this.pagesValidation[PageTypeEnum.structurePublicTarget] = { + valid: this.getStructureControl('publics').valid, + name: 'Public admis', + }; + this.pagesValidation[PageTypeEnum.structureAccompaniment] = { valid: this.getStructureControl('publicsAccompaniment').valid && this.getStructureControl('proceduresAccompaniment').valid, name: 'Accompagnements proposés', }; - this.pagesValidation[14] = { + this.pagesValidation[PageTypeEnum.structureOtherAccompaniment] = { valid: this.getStructureControl('otherDescription').value, name: 'Autres démarches proposés', }; - this.pagesValidation[15] = { + this.pagesValidation[PageTypeEnum.structureWorkshop] = { valid: this.getStructureControl('accessRight').valid && this.getStructureControl('socialAndProfessional').valid && @@ -423,12 +439,15 @@ export class FormComponent implements OnInit { this.getStructureControl('digitalCultureSecurity').valid, name: 'Ateliers au numérique proposés', }; - this.pagesValidation[16] = { valid: this.getStructureControl('freeWorkShop').valid, name: 'Gratuité des ateliers' }; - this.pagesValidation[17] = { + this.pagesValidation[PageTypeEnum.structureWorkshopPrice] = { + valid: this.getStructureControl('freeWorkShop').valid, + name: 'Gratuité des ateliers', + }; + this.pagesValidation[PageTypeEnum.structureWifi] = { valid: this.getStructureControl('equipmentsAndServices').valid, name: 'Gratuité du wifi', }; - this.pagesValidation[18] = { + this.pagesValidation[PageTypeEnum.structureEquipments] = { valid: this.getStructureControl('equipmentsAndServices').valid && this.getStructureControl('nbComputers').valid && @@ -438,24 +457,24 @@ export class FormComponent implements OnInit { this.getStructureControl('nbScanners').valid, name: 'Matériels mis à disposition', }; - this.pagesValidation[19] = { + this.pagesValidation[PageTypeEnum.structureLabels] = { valid: this.getStructureControl('labelsQualifications').valid, name: 'Labélisations proposées', }; - this.pagesValidation[20] = { + this.pagesValidation[PageTypeEnum.structureOtherServices] = { valid: this.getStructureControl('equipmentsAndServices').valid, name: 'Autres services proposés', }; - this.pagesValidation[21] = { + this.pagesValidation[PageTypeEnum.structureDescription] = { valid: this.getStructureControl('description').valid, name: 'Présentation de la structure', }; - this.pagesValidation[22] = { + this.pagesValidation[PageTypeEnum.structureCovidInfo] = { valid: this.getStructureControl('lockdownActivity').valid, name: 'Informations spécifiques à la période COVID', }; - this.pagesValidation[23] = { valid: this.userAcceptSavedDate }; - //this.pagesValidation[24] = { valid: true }; + this.pagesValidation[PageTypeEnum.cgu] = { valid: this.userAcceptSavedDate }; + //this.pagesValidation[PageTypeEnum.addUserToStructure] = { valid: true }; this.updatePageValid(); } @@ -464,13 +483,16 @@ export class FormComponent implements OnInit { } public nextPage(): void { // Check if user already connected to skip accountForm pages. - if (this.currentPage == 1 && this.profile) { - this.currentPage += 2; // Skip 2 pages from AccountForm + if (this.currentPage == PageTypeEnum.info && this.profile) { + this.currentPage += 2; // Skip accountInfo pages from AccountForm this.progressStatus += 2 * (100 / this.nbPagesForm); } // Check if "other" isn't check to hide "other description" page - if (this.currentPage == 13 && !this.isInArray('autres', 'proceduresAccompaniment')) { - this.currentPage++; // page 14 skip and go to page 15 + if ( + this.currentPage == PageTypeEnum.structureAccompaniment && + !this.isInArray('autres', 'proceduresAccompaniment') + ) { + this.currentPage++; // page structureOtherAccompaniment skip and go to page structureWorkshop this.progressStatus += 100 / this.nbPagesForm; } @@ -485,13 +507,13 @@ export class FormComponent implements OnInit { } public previousPage(): void { // Check if user already connected to skip accountForm pages. - if (this.currentPage == 4 && this.profile) { + if (this.currentPage == PageTypeEnum.structureNameAndAddress && this.profile) { this.currentPage -= 2; // Skip 2 pages from AccountForm this.progressStatus -= 2 * (100 / this.nbPagesForm); } // Check if "other" isn't check to hide "other description" page - if (this.currentPage == 15 && !this.isInArray('autres', 'proceduresAccompaniment')) { + if (this.currentPage == PageTypeEnum.structureWorkshop && !this.isInArray('autres', 'proceduresAccompaniment')) { this.currentPage--; // page 14 skip and go to page 13 this.progressStatus -= 100 / this.nbPagesForm; } diff --git a/src/app/form/pageType.enum.ts b/src/app/form/pageType.enum.ts new file mode 100644 index 000000000..4742e76b2 --- /dev/null +++ b/src/app/form/pageType.enum.ts @@ -0,0 +1,27 @@ +export enum PageTypeEnum { + summary = 0, + info = 1, + accountInfo = 2, + accountCredentials = 3, + structureNameAndAddress = 4, + structurePhone = 5, + 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, + addUserToStructure = 24, +} -- GitLab From 2f2e7baa422b788d590c5dafced0cb69a2c35f83 Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Thu, 11 Feb 2021 11:39:29 +0100 Subject: [PATCH 19/23] fix: move footer-form --- src/app/app.module.ts | 2 +- src/app/{ => form}/footer-form/footer-form.component.html | 0 src/app/{ => form}/footer-form/footer-form.component.scss | 0 src/app/{ => form}/footer-form/footer-form.component.spec.ts | 0 src/app/{ => form}/footer-form/footer-form.component.ts | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename src/app/{ => form}/footer-form/footer-form.component.html (100%) rename src/app/{ => form}/footer-form/footer-form.component.scss (100%) rename src/app/{ => form}/footer-form/footer-form.component.spec.ts (100%) rename src/app/{ => form}/footer-form/footer-form.component.ts (100%) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8bcb3953a..76b6da88f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -29,7 +29,7 @@ import { ResetPasswordComponent } from './reset-password/reset-password.componen import { AdminModule } from './admin/admin.module'; import { AdminGuard } from './guards/admin.guard'; import { DeactivateGuard } from './guards/deactivate.guard'; -import { FooterFormComponent } from './footer-form/footer-form.component'; +import { FooterFormComponent } from './form/footer-form/footer-form.component'; @NgModule({ declarations: [ diff --git a/src/app/footer-form/footer-form.component.html b/src/app/form/footer-form/footer-form.component.html similarity index 100% rename from src/app/footer-form/footer-form.component.html rename to src/app/form/footer-form/footer-form.component.html diff --git a/src/app/footer-form/footer-form.component.scss b/src/app/form/footer-form/footer-form.component.scss similarity index 100% rename from src/app/footer-form/footer-form.component.scss rename to src/app/form/footer-form/footer-form.component.scss diff --git a/src/app/footer-form/footer-form.component.spec.ts b/src/app/form/footer-form/footer-form.component.spec.ts similarity index 100% rename from src/app/footer-form/footer-form.component.spec.ts rename to src/app/form/footer-form/footer-form.component.spec.ts diff --git a/src/app/footer-form/footer-form.component.ts b/src/app/form/footer-form/footer-form.component.ts similarity index 100% rename from src/app/footer-form/footer-form.component.ts rename to src/app/form/footer-form/footer-form.component.ts -- GitLab From cc61eedb495879f173ac91f2ae1d716f60906de7 Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Thu, 11 Feb 2021 11:39:46 +0100 Subject: [PATCH 20/23] fix: upadte import --- src/app/form/footer-form/footer-form.component.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/form/footer-form/footer-form.component.scss b/src/app/form/footer-form/footer-form.component.scss index 7df6b3dd1..31dbd2f3b 100644 --- a/src/app/form/footer-form/footer-form.component.scss +++ b/src/app/form/footer-form/footer-form.component.scss @@ -1,5 +1,5 @@ -@import '../../assets/scss/color'; -@import '../../assets/scss/typography'; +@import '../../../assets/scss/color'; +@import '../../../assets/scss/typography'; .btn-primary { &.previous { -- GitLab From 0bbb3f0e1b55ff2461cdbf48d0380774aebaea4c Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Thu, 11 Feb 2021 14:50:19 +0100 Subject: [PATCH 21/23] feat: add registration for claim when not connected --- src/app/form/form.component.html | 112 +++--- src/app/form/form.component.ts | 351 +++++++++++------- .../structure-details.component.html | 4 +- .../structure-details.component.ts | 8 + 4 files changed, 275 insertions(+), 200 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 9a6d244c7..8f4e22987 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -35,7 +35,12 @@ [value]="progressStatus" ></progress> </div> - <div *ngIf="currentPage == 0 && !isEditMode" class="home page" fxLayout="column" fxLayoutAlign="space-between"> + <div + *ngIf="currentPage == pageTypeEnum.summary && !isEditMode" + class="home page" + fxLayout="column" + fxLayoutAlign="space-between" + > <h2>Ajouter votre structure</h2> <img src="../../assets/form/schedule.svg" alt="logo schedule" /> <div> @@ -932,36 +937,6 @@ </p> </div> </div> - <div *ngIf="currentPage == pageTypeEnum.cgu" class="page"> - <div class="title"> - <h3> - Acceptez-vous que les informations saisies soient enregistrées par la Métropole de Lyon<span - class="asterisk" - >*</span - > - ? - </h3> - </div> - <app-checkbox-form - [isChecked]="userAcceptSavedDate" - [text]="'J\'accepte'" - (checkEvent)="acceptDataBeSaved($event)" - > - </app-checkbox-form> - <p class="informationEndForm"> - <span class="asterisk">*</span> Les informations recueillies sont enregistrées dans un fichier par la - Métropole de Lyon en vue de l'animation du réseau des acteurs de la médiation numérique. Elles sont conservées - pendant 24 mois et sont destinées aux seuls intervenants habilités de la Métropole de Lyon. Vos données - personnelles sont traitées dans ce cadre aux fins de Ârecensement des actions de médiation numérique sur le - territoire de la métropole. Conformément à la loi 78-17 du 6 janvier 1978 modifiée relative à l'information, - aux fichiers et aux libertés, et au Règlement Général européen à la Protection des Données, vous avez la - possibilité d’exercer vos droits d’accès, de rectification, d’effacement, d’opposition, de limitation du - traitement et de révocation de votre consentement. Afin d'exercer vos droits, vous pouvez vous adresser : par - courrier postal à : Métropole de Lyon - Direction des Affaires Juridiques et de la Commande Publique - 20, rue - du Lac - BP 33569 - 69505 Lyon Cedex par courrier électronique en remplissant le formulaire dédié sur Toodego, - le site des services et démarches en ligne dans la Métropole de Lyon - </p> - </div> <div *ngIf="false" class="page"> <div class="title"> <h3>Voulez-vous inviter d’autres personnes dans cette structure ?</h3> @@ -983,33 +958,62 @@ </div> </div> </div> - <div *ngIf="currentPage == nbPagesForm && !profile" class="page" fxLayout="column" fxLayoutGap="69px"> - <svg aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#emailVerification'"></use> - </svg> - <h3>Un courriel vous a été envoyé afin de finaliser votre inscription</h3> + </form> + <div *ngIf="currentPage == pageTypeEnum.cgu" class="page"> + <div class="title"> + <h3> + Acceptez-vous que les informations saisies soient enregistrées par la Métropole de Lyon<span class="asterisk" + >*</span + > + ? + </h3> + </div> + <app-checkbox-form + [isChecked]="userAcceptSavedDate" + [text]="'J\'accepte'" + (checkEvent)="acceptDataBeSaved($event)" + > + </app-checkbox-form> + <p class="informationEndForm"> + <span class="asterisk">*</span> Les informations recueillies sont enregistrées dans un fichier par la Métropole + de Lyon en vue de l'animation du réseau des acteurs de la médiation numérique. Elles sont conservées pendant 24 + mois et sont destinées aux seuls intervenants habilités de la Métropole de Lyon. Vos données personnelles sont + traitées dans ce cadre aux fins de Ârecensement des actions de médiation numérique sur le territoire de la + métropole. Conformément à la loi 78-17 du 6 janvier 1978 modifiée relative à l'information, aux fichiers et aux + libertés, et au Règlement Général européen à la Protection des Données, vous avez la possibilité d’exercer vos + droits d’accès, de rectification, d’effacement, d’opposition, de limitation du traitement et de révocation de + votre consentement. Afin d'exercer vos droits, vous pouvez vous adresser : par courrier postal à : Métropole de + Lyon - Direction des Affaires Juridiques et de la Commande Publique - 20, rue du Lac - BP 33569 - 69505 Lyon + Cedex par courrier électronique en remplissant le formulaire dédié sur Toodego, le site des services et + démarches en ligne dans la Métropole de Lyon + </p> + </div> + <div *ngIf="currentPage == nbPagesForm && !profile" class="page" fxLayout="column" fxLayoutGap="69px"> + <svg aria-hidden="true"> + <use [attr.xlink:href]="'assets/form/sprite.svg#emailVerification'"></use> + </svg> + <h3>Un courriel vous a été envoyé afin de finaliser votre inscription</h3> + </div> + <div *ngIf="currentPage == nbPagesForm && profile" class="page"> + <div class="title"> + <h3> + Bravo !<br /> + Votre structure a bien été référencée. + </h3> </div> - <div *ngIf="currentPage == nbPagesForm && profile" class="page"> - <div class="title"> - <h3> - Bravo !<br /> - Votre structure a bien été référencée. - </h3> - </div> - <div class="structureInfoBlock" fxLayout="row" fxLayoutAlign=" center"> - <div class="structureInfoContent" fxLayout="column"> - {{ getStructureControl('structureName').value }} - <span>{{ getStructureControl('structureType').value }}</span> - </div> - <div class="validateSvg"> - <svg class="validate" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#checkVector'"></use> - </svg> - </div> + <div class="structureInfoBlock" fxLayout="row" fxLayoutAlign=" center"> + <div class="structureInfoContent" fxLayout="column"> + {{ getStructureControl('structureName').value }} + <span>{{ getStructureControl('structureType').value }}</span> + </div> + <div class="validateSvg"> + <svg class="validate" aria-hidden="true"> + <use [attr.xlink:href]="'assets/form/sprite.svg#checkVector'"></use> + </svg> </div> </div> - </form> + </div> <div *ngIf="currentPage != 0" class="footer desktop"> <div fxLayout="row" fxLayoutAlign="center center" *ngIf="currentPage != nbPagesForm && !isEditMode"> <app-footer-form diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index dfc550c6d..a3b3c84dc 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -41,6 +41,7 @@ export class FormComponent implements OnInit { public equipmentsAndServices: { module: Module; openned: boolean }[] = []; public trainingCategories: { category: Category; openned: boolean }[] = []; public pageTypeEnum = PageTypeEnum; + public claimStructureId = null; // Page and progress var public currentPage = 0; @@ -65,6 +66,7 @@ export class FormComponent implements OnInit { public userAcceptSavedDate = false; public showMenu = false; public isEditMode = false; + public isClaimMode = false; public isLoading = false; constructor( @@ -86,8 +88,11 @@ export class FormComponent implements OnInit { if (history.state.data) { this.isEditMode = true; this.initForm(new Structure(history.state.data)); - } else if (history.state.new) { - console.log('Create user only'); + } else if (history.state.newUser) { + this.isClaimMode = true; + this.createAccountForm(); + this.claimStructureId = history.state.newUser; + this.setValidationsForm(); } else { this.initForm(new Structure()); } @@ -132,20 +137,7 @@ export class FormComponent implements OnInit { private initForm(structure: Structure): void { // Init account Form - this.accountForm = new FormGroup( - { - email: new FormControl('', [Validators.required, Validators.pattern(Regex.email)]), //NOSONAR - name: new FormControl('', [Validators.required, Validators.pattern(Regex.textWithoutNumber)]), //NOSONAR - surname: new FormControl('', [Validators.required, Validators.pattern(Regex.textWithoutNumber)]), //NOSONAR - phone: new FormControl('', [Validators.required, Validators.pattern(Regex.phone)]), //NOSONAR - password: new FormControl('', [ - Validators.required, - Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/), //NOSONAR - ]), - confirmPassword: new FormControl(''), - }, - [MustMatch('password', 'confirmPassword')] - ); + this.createAccountForm(); // Init form this.structureForm = this.createStructureForm(structure); @@ -167,6 +159,24 @@ export class FormComponent implements OnInit { this.setValidationsForm(); } + + private createAccountForm(): void { + this.accountForm = new FormGroup( + { + email: new FormControl('', [Validators.required, Validators.pattern(Regex.email)]), //NOSONAR + name: new FormControl('', [Validators.required, Validators.pattern(Regex.textWithoutNumber)]), //NOSONAR + surname: new FormControl('', [Validators.required, Validators.pattern(Regex.textWithoutNumber)]), //NOSONAR + phone: new FormControl('', [Validators.required, Validators.pattern(Regex.phone)]), //NOSONAR + password: new FormControl('', [ + Validators.required, + Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/), //NOSONAR + ]), + confirmPassword: new FormControl(''), + }, + [MustMatch('password', 'confirmPassword')] + ); + } + private createStructureForm(structure): FormGroup { const form = new FormGroup({ _id: new FormControl(structure._id), @@ -367,142 +377,197 @@ export class FormComponent implements OnInit { } public setValidationsForm(): void { - this.pagesValidation[PageTypeEnum.summary] = { valid: true }; - this.pagesValidation[PageTypeEnum.info] = { valid: true }; - this.pagesValidation[PageTypeEnum.accountInfo] = { - valid: - this.accountForm.get('surname').valid && - this.accountForm.get('name').valid && - this.accountForm.get('phone').valid, - }; - this.pagesValidation[PageTypeEnum.accountCredentials] = { - valid: - this.accountForm.get('email').valid && - this.accountForm.get('password').valid && - this.accountForm.get('confirmPassword').valid, - }; - this.pagesValidation[PageTypeEnum.structureNameAndAddress] = { - valid: this.getStructureControl('structureName').valid && this.getStructureControl('address').valid, - name: 'Nom et adresse', - }; - this.pagesValidation[PageTypeEnum.structurePhone] = { - valid: this.getStructureControl('contactPhone').valid, - name: 'Téléphone', - }; - this.pagesValidation[PageTypeEnum.structureType] = { - valid: this.getStructureControl('structureType').valid, - name: 'Type de structure', - }; - this.pagesValidation[PageTypeEnum.structureAccessModality] = { - 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.structurePmr] = { - valid: this.getStructureControl('pmrAccess').valid, - name: 'Accessibilité pour les personnes à mobilité réduite', - }; - this.pagesValidation[PageTypeEnum.structureWebAndSocialNetwork] = { - valid: - this.getStructureControl('contactMail').valid && - (this.getStructureControl('website').valid || !this.showWebsite) && - ((this.getStructureControl('facebook').valid && - this.getStructureControl('twitter').valid && - this.getStructureControl('instagram').valid) || - !this.showSocialNetwork), - name: 'Présence sur internet', - }; - this.pagesValidation[PageTypeEnum.structurePublicTarget] = { - valid: this.getStructureControl('publics').valid, - name: 'Public admis', - }; - this.pagesValidation[PageTypeEnum.structureAccompaniment] = { - valid: - this.getStructureControl('publicsAccompaniment').valid && - this.getStructureControl('proceduresAccompaniment').valid, - name: 'Accompagnements proposés', - }; - this.pagesValidation[PageTypeEnum.structureOtherAccompaniment] = { - valid: this.getStructureControl('otherDescription').value, - name: 'Autres démarches proposés', - }; - this.pagesValidation[PageTypeEnum.structureWorkshop] = { - valid: - this.getStructureControl('accessRight').valid && - this.getStructureControl('socialAndProfessional').valid && - this.getStructureControl('baseSkills').valid && - this.getStructureControl('parentingHelp').valid && - this.getStructureControl('digitalCultureSecurity').valid, - name: 'Ateliers au numérique proposés', - }; - this.pagesValidation[PageTypeEnum.structureWorkshopPrice] = { - valid: this.getStructureControl('freeWorkShop').valid, - name: 'Gratuité des ateliers', - }; - this.pagesValidation[PageTypeEnum.structureWifi] = { - valid: this.getStructureControl('equipmentsAndServices').valid, - name: 'Gratuité du wifi', - }; - this.pagesValidation[PageTypeEnum.structureEquipments] = { - valid: - this.getStructureControl('equipmentsAndServices').valid && - this.getStructureControl('nbComputers').valid && - this.getStructureControl('nbPrinters').valid && - this.getStructureControl('nbTablets').valid && - this.getStructureControl('nbNumericTerminal').valid && - this.getStructureControl('nbScanners').valid, - name: 'Matériels mis à disposition', - }; - this.pagesValidation[PageTypeEnum.structureLabels] = { - valid: this.getStructureControl('labelsQualifications').valid, - name: 'Labélisations proposées', - }; - this.pagesValidation[PageTypeEnum.structureOtherServices] = { - valid: this.getStructureControl('equipmentsAndServices').valid, - name: 'Autres services proposés', - }; - this.pagesValidation[PageTypeEnum.structureDescription] = { - valid: this.getStructureControl('description').valid, - name: 'Présentation de la structure', - }; - this.pagesValidation[PageTypeEnum.structureCovidInfo] = { - valid: this.getStructureControl('lockdownActivity').valid, - name: 'Informations spécifiques à la période COVID', - }; - this.pagesValidation[PageTypeEnum.cgu] = { valid: this.userAcceptSavedDate }; - //this.pagesValidation[PageTypeEnum.addUserToStructure] = { valid: true }; - this.updatePageValid(); + if (this.isClaimMode) { + this.pagesValidation[PageTypeEnum.summary] = { valid: true }; + this.pagesValidation[PageTypeEnum.accountInfo] = { + valid: + this.accountForm.get('surname').valid && + this.accountForm.get('name').valid && + this.accountForm.get('phone').valid, + }; + this.pagesValidation[PageTypeEnum.accountCredentials] = { + valid: + this.accountForm.get('email').valid && + this.accountForm.get('password').valid && + this.accountForm.get('confirmPassword').valid, + }; + this.pagesValidation[PageTypeEnum.cgu] = { valid: this.userAcceptSavedDate }; + this.updatePageValid(); + } else { + this.pagesValidation[PageTypeEnum.summary] = { valid: true }; + this.pagesValidation[PageTypeEnum.info] = { valid: true }; + this.pagesValidation[PageTypeEnum.accountInfo] = { + valid: + this.accountForm.get('surname').valid && + this.accountForm.get('name').valid && + this.accountForm.get('phone').valid, + }; + this.pagesValidation[PageTypeEnum.accountCredentials] = { + valid: + this.accountForm.get('email').valid && + this.accountForm.get('password').valid && + this.accountForm.get('confirmPassword').valid, + }; + this.pagesValidation[PageTypeEnum.structureNameAndAddress] = { + valid: this.getStructureControl('structureName').valid && this.getStructureControl('address').valid, + name: 'Nom et adresse', + }; + this.pagesValidation[PageTypeEnum.structurePhone] = { + valid: this.getStructureControl('contactPhone').valid, + name: 'Téléphone', + }; + this.pagesValidation[PageTypeEnum.structureType] = { + valid: this.getStructureControl('structureType').valid, + name: 'Type de structure', + }; + this.pagesValidation[PageTypeEnum.structureAccessModality] = { + 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.structurePmr] = { + valid: this.getStructureControl('pmrAccess').valid, + name: 'Accessibilité pour les personnes à mobilité réduite', + }; + this.pagesValidation[PageTypeEnum.structureWebAndSocialNetwork] = { + valid: + this.getStructureControl('contactMail').valid && + (this.getStructureControl('website').valid || !this.showWebsite) && + ((this.getStructureControl('facebook').valid && + this.getStructureControl('twitter').valid && + this.getStructureControl('instagram').valid) || + !this.showSocialNetwork), + name: 'Présence sur internet', + }; + this.pagesValidation[PageTypeEnum.structurePublicTarget] = { + valid: this.getStructureControl('publics').valid, + name: 'Public admis', + }; + this.pagesValidation[PageTypeEnum.structureAccompaniment] = { + valid: + this.getStructureControl('publicsAccompaniment').valid && + this.getStructureControl('proceduresAccompaniment').valid, + name: 'Accompagnements proposés', + }; + this.pagesValidation[PageTypeEnum.structureOtherAccompaniment] = { + valid: this.getStructureControl('otherDescription').value, + name: 'Autres démarches proposés', + }; + this.pagesValidation[PageTypeEnum.structureWorkshop] = { + valid: + this.getStructureControl('accessRight').valid && + this.getStructureControl('socialAndProfessional').valid && + this.getStructureControl('baseSkills').valid && + this.getStructureControl('parentingHelp').valid && + this.getStructureControl('digitalCultureSecurity').valid, + name: 'Ateliers au numérique proposés', + }; + this.pagesValidation[PageTypeEnum.structureWorkshopPrice] = { + valid: this.getStructureControl('freeWorkShop').valid, + name: 'Gratuité des ateliers', + }; + this.pagesValidation[PageTypeEnum.structureWifi] = { + valid: this.getStructureControl('equipmentsAndServices').valid, + name: 'Gratuité du wifi', + }; + this.pagesValidation[PageTypeEnum.structureEquipments] = { + valid: + this.getStructureControl('equipmentsAndServices').valid && + this.getStructureControl('nbComputers').valid && + this.getStructureControl('nbPrinters').valid && + this.getStructureControl('nbTablets').valid && + this.getStructureControl('nbNumericTerminal').valid && + this.getStructureControl('nbScanners').valid, + name: 'Matériels mis à disposition', + }; + this.pagesValidation[PageTypeEnum.structureLabels] = { + valid: this.getStructureControl('labelsQualifications').valid, + name: 'Labélisations proposées', + }; + this.pagesValidation[PageTypeEnum.structureOtherServices] = { + valid: this.getStructureControl('equipmentsAndServices').valid, + name: 'Autres services proposés', + }; + this.pagesValidation[PageTypeEnum.structureDescription] = { + valid: this.getStructureControl('description').valid, + name: 'Présentation de la structure', + }; + this.pagesValidation[PageTypeEnum.structureCovidInfo] = { + valid: this.getStructureControl('lockdownActivity').valid, + name: 'Informations spécifiques à la période COVID', + }; + this.pagesValidation[PageTypeEnum.cgu] = { valid: this.userAcceptSavedDate }; + //this.pagesValidation[PageTypeEnum.addUserToStructure] = { valid: true }; + this.updatePageValid(); + } } private updatePageValid(): void { this.isPageValid = this.pagesValidation[this.currentPage].valid; } - public nextPage(): void { - // Check if user already connected to skip accountForm pages. - if (this.currentPage == PageTypeEnum.info && this.profile) { - this.currentPage += 2; // Skip accountInfo pages from AccountForm - this.progressStatus += 2 * (100 / this.nbPagesForm); + + /** + * Pgae algo for claim structure case + */ + public nextPageClaim(): void { + if (this.currentPage == this.nbPagesForm - 1) { + const user = new User(this.accountForm.value); + // Create user and claim structure + this.authService.register(user).subscribe(() => { + this.structureService.claimStructureWithAccount(this.claimStructureId, user).subscribe(() => { + this.progressStatus = 100; + }); + }); } - // Check if "other" isn't check to hide "other description" page - if ( - this.currentPage == PageTypeEnum.structureAccompaniment && - !this.isInArray('autres', 'proceduresAccompaniment') - ) { - this.currentPage++; // page structureOtherAccompaniment skip and go to page structureWorkshop - this.progressStatus += 100 / this.nbPagesForm; + + if (this.currentPage == PageTypeEnum.summary) { + this.currentPage = PageTypeEnum.accountInfo; + this.updatePageValid(); + } else if (this.currentPage == PageTypeEnum.accountInfo) { + this.currentPage = PageTypeEnum.accountCredentials; + this.updatePageValid(); + } else if (this.currentPage == PageTypeEnum.accountCredentials) { + this.currentPage = PageTypeEnum.cgu; + this.updatePageValid(); + } else if (this.currentPage == PageTypeEnum.cgu) { + this.currentPage = this.nbPagesForm; } - // Check if going to the last page to submit form and send email verification. - if (this.currentPage == this.nbPagesForm - 1) { - this.validateForm(); + if (this.currentPage !== this.nbPagesForm - 1) { + this.progressStatus += 25; + } + } + + public nextPage(): void { + if (this.isClaimMode) { + this.nextPageClaim(); } else { - this.currentPage++; - this.progressStatus += 100 / this.nbPagesForm; - this.updatePageValid(); + // Check if user already connected to skip accountForm pages. + if (this.currentPage == PageTypeEnum.info && this.profile) { + this.currentPage += 2; // Skip accountInfo pages from AccountForm + this.progressStatus += 2 * (100 / this.nbPagesForm); + } + // Check if "other" isn't check to hide "other description" page + if ( + this.currentPage == PageTypeEnum.structureAccompaniment && + !this.isInArray('autres', 'proceduresAccompaniment') + ) { + this.currentPage++; // page structureOtherAccompaniment skip and go to page structureWorkshop + 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(); + } else { + this.currentPage++; + this.progressStatus += 100 / this.nbPagesForm; + this.updatePageValid(); + } } } public previousPage(): void { diff --git a/src/app/structure-list/components/structure-details/structure-details.component.html b/src/app/structure-list/components/structure-details/structure-details.component.html index effd118fd..12b27e22e 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.html +++ b/src/app/structure-list/components/structure-details/structure-details.component.html @@ -76,9 +76,7 @@ </div> </div> <div fxLayout="row" fxLayoutAlign="center center" class="hide-on-print"> - <a *ngIf="!isClaimed && userIsLoggedIn()" (click)="toggleClaimModal()" class="primary" tabindex="0" - >Revendiquer cette structure</a - > + <a *ngIf="!isClaimed" (click)="handleClaim()" class="primary" tabindex="0">Revendiquer cette structure</a> <!-- temporary remove edit --> <a *ngIf="profileService.isLinkedToStructure(structure._id) || profileService.isAdmin()" diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index 2b4bb09e5..adcac606a 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -124,6 +124,14 @@ export class StructureDetailsComponent implements OnInit { this.claimModalOpenned = !this.claimModalOpenned; } + public handleClaim(): void { + if (this.userIsLoggedIn()) { + this.toggleClaimModal(); + } else { + this.router.navigate(['create-structure'], { state: { newUser: this.structure._id } }); + } + } + public deleteStructure(shouldDelete: boolean): void { this.toggleDeleteModal(); if (shouldDelete) { -- GitLab From ee7b65a8a1f48c218796b145d2b4ed51db2690b9 Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Thu, 11 Feb 2021 18:26:25 +0100 Subject: [PATCH 22/23] fix: add previous page handling for claim --- src/app/form/form.component.ts | 48 ++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index fe17f84f1..716865200 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -516,7 +516,7 @@ export class FormComponent implements OnInit { } /** - * Pgae algo for claim structure case + * Page algo for claim structure case */ public nextPageClaim(): void { if (this.currentPage == this.nbPagesForm - 1) { @@ -542,9 +542,25 @@ export class FormComponent implements OnInit { this.currentPage = this.nbPagesForm; } - if (this.currentPage !== this.nbPagesForm - 1) { - this.progressStatus += 25; + this.progressStatus += 25; + } + + /** + * Page algo for claim structure case + */ + public previousPageClaim(): void { + if (this.currentPage == PageTypeEnum.accountInfo) { + this.currentPage = PageTypeEnum.summary; + this.updatePageValid(); + } else if (this.currentPage == PageTypeEnum.accountCredentials) { + this.currentPage = PageTypeEnum.accountInfo; + this.updatePageValid(); + } else if (this.currentPage == PageTypeEnum.cgu) { + this.currentPage = PageTypeEnum.accountCredentials; + this.updatePageValid(); } + + this.progressStatus -= 25; } public nextPage(): void { @@ -576,20 +592,24 @@ export class FormComponent implements OnInit { } } public previousPage(): void { - // Check if user already connected to skip accountForm pages. - if (this.currentPage == PageTypeEnum.structureNameAndAddress && this.profile) { - this.currentPage -= 2; // Skip 2 pages from AccountForm - this.progressStatus -= 2 * (100 / this.nbPagesForm); - } + if (this.isClaimMode) { + this.previousPageClaim(); + } else { + // Check if user already connected to skip accountForm pages. + if (this.currentPage == PageTypeEnum.structureNameAndAddress && this.profile) { + this.currentPage -= 2; // Skip 2 pages from AccountForm + this.progressStatus -= 2 * (100 / this.nbPagesForm); + } - // Check if "other" isn't check to hide "other description" page - if (this.currentPage == PageTypeEnum.structureWorkshop && !this.isInArray('autres', 'proceduresAccompaniment')) { - this.currentPage--; // page 14 skip and go to page 13 + // Check if "other" isn't check to hide "other description" page + if (this.currentPage == PageTypeEnum.structureWorkshop && !this.isInArray('autres', 'proceduresAccompaniment')) { + this.currentPage--; // page 14 skip and go to page 13 + this.progressStatus -= 100 / this.nbPagesForm; + } + this.currentPage--; this.progressStatus -= 100 / this.nbPagesForm; + this.updatePageValid(); } - this.currentPage--; - this.progressStatus -= 100 / this.nbPagesForm; - this.updatePageValid(); } public showPassword(): void { this.isShowPassword = !this.isShowPassword; -- GitLab From 41cfbb801537b662fe08ed4133e803a15d914088 Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Fri, 12 Feb 2021 16:10:41 +0100 Subject: [PATCH 23/23] fix: add claim structure message --- src/app/form/form.component.html | 24 ++++++++++++++----- src/app/form/form.component.scss | 8 +++++-- src/app/form/form.component.ts | 14 ++++++++--- .../structure-details.component.ts | 2 +- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 1599d7889..f1b1929d9 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -35,12 +35,7 @@ [value]="progressStatus" ></progress> </div> - <div - *ngIf="currentPage == pageTypeEnum.summary && !isEditMode" - class="home page" - fxLayout="column" - fxLayoutAlign="space-between" - > + <div *ngIf="displayAddStructure()" class="home page" fxLayout="column" fxLayoutAlign="space-between"> <h2>Ajouter votre structure</h2> <img src="../../assets/form/schedule.svg" alt="logo schedule" /> <div> @@ -51,6 +46,23 @@ <button class="btn-primary start" (click)="nextPage()">C'est Parti</button> </div> </div> + <div + *ngIf="displayClaimStructure()" + class="home page" + fxLayout="column" + fxLayoutAlign="space-between center" + fxLayoutAlign.lt-sm="center" + > + <h2> + Revendiquer la structure <span>{{ claimStructure.structureName }}</span> + </h2> + <div> + <p>Une fois réalisé cela vous permettra de devenir propriétaire de cette structure</p> + </div> + <div class="btnStart"> + <button class="btn-primary start" (click)="nextPage()">C'est Parti</button> + </div> + </div> <div *ngIf="currentPage == pageTypeEnum.summary && isEditMode" class="editHome page" diff --git a/src/app/form/form.component.scss b/src/app/form/form.component.scss index 17ced3d6b..8ab5aa6f4 100644 --- a/src/app/form/form.component.scss +++ b/src/app/form/form.component.scss @@ -86,6 +86,7 @@ h3 { ) !important; // -1px because of header border } @media #{$tablet} { + height: 100%; &.editMode { .page { height: calc( @@ -103,8 +104,11 @@ h3 { height: auto; h2 { @include cn-bold-28; - color: $secondary-color; + color: $black; margin-bottom: 0; + span { + color: $secondary-color; + } } h3 { @include cn-bold-22; @@ -163,7 +167,7 @@ h3 { color: $grey-3; margin-top: 4px; - width: 256px; + width: 280px; &.invalid { color: $orange-warning; } diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 716865200..a09015170 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -41,7 +41,7 @@ export class FormComponent implements OnInit { public equipmentsAndServices: { module: Module; openned: boolean }[] = []; public trainingCategories: { category: Category; openned: boolean }[] = []; public pageTypeEnum = PageTypeEnum; - public claimStructureId = null; + public claimStructure: Structure = null; // Page and progress var public currentPage = 0; @@ -93,7 +93,7 @@ export class FormComponent implements OnInit { } else if (history.state.newUser) { this.isClaimMode = true; this.createAccountForm(); - this.claimStructureId = history.state.newUser; + this.claimStructure = history.state.newUser; this.setValidationsForm(); } else { this.initForm(new Structure()); @@ -523,7 +523,7 @@ export class FormComponent implements OnInit { const user = new User(this.accountForm.value); // Create user and claim structure this.authService.register(user).subscribe(() => { - this.structureService.claimStructureWithAccount(this.claimStructureId, user).subscribe(() => { + this.structureService.claimStructureWithAccount(this.claimStructure._id, user).subscribe(() => { this.progressStatus = 100; }); }); @@ -814,4 +814,12 @@ export class FormComponent implements OnInit { }); } } + + public displayAddStructure(): boolean { + return this.currentPage == this.pageTypeEnum.summary && !this.isEditMode && !this.isClaimMode; + } + + public displayClaimStructure(): boolean { + return this.currentPage == this.pageTypeEnum.summary && !this.isEditMode && this.isClaimMode; + } } diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index a46e89ef8..a3c33e731 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -126,7 +126,7 @@ export class StructureDetailsComponent implements OnInit { if (this.userIsLoggedIn()) { this.toggleClaimModal(); } else { - this.router.navigate(['create-structure'], { state: { newUser: this.structure._id } }); + this.router.navigate(['create-structure'], { state: { newUser: this.structure } }); } } -- GitLab