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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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/24] 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 7e9c27d2dac450f8841f53e6c2512fc38d450c70 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Thu, 11 Feb 2021 12:06:01 +0100 Subject: [PATCH 18/24] fix(form) : fix wifi + structureType --- src/app/form/form.component.html | 2 +- .../structure-type-picker.component.html | 2 +- .../structure-type-picker.component.ts | 4 +++ src/app/shared/enum/typeStructure.enum.ts | 34 +++++++++++++------ 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 22cf64f49..3af12920f 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -706,7 +706,7 @@ <h3>Proposez-vous le wifi en accès libre ?</h3> </div> <app-radio-form - [selectedOption]="isInArray('wifiEnAccesLibre', 'equipmentsAndServices')" + [selectedOption]="isEditMode ? isInArray('wifiEnAccesLibre', 'equipmentsAndServices') : null" (selectedEvent)="onCheckChange($event, 'equipmentsAndServices', 'wifiEnAccesLibre')" > </app-radio-form> diff --git a/src/app/shared/components/structure-type-picker/structure-type-picker.component.html b/src/app/shared/components/structure-type-picker/structure-type-picker.component.html index 3c6fa1bb6..3613f3efb 100644 --- a/src/app/shared/components/structure-type-picker/structure-type-picker.component.html +++ b/src/app/shared/components/structure-type-picker/structure-type-picker.component.html @@ -26,7 +26,7 @@ <svg *ngIf="choice == pickedChoice" class="validate" aria-hidden="true"> <use [attr.xlink:href]="'assets/form/sprite.svg#checkVector'"></use> </svg> - {{ choice }} + {{ getStructureTypeName(choice) }} </button> </div> </div> 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 63b880768..b64a4718f 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 @@ -1,6 +1,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { StructureType } from '../../../models/structure-type.model'; import { StructureTypeService } from '../../../services/structure-type.service'; +import { typeStructureEnum } from '../../enum/typeStructure.enum'; export enum structureTypes { public = 'Publique', @@ -67,4 +68,7 @@ export class StructureTypePickerComponent implements OnInit { throw new Error('Structure type not handle'); } } + public getStructureTypeName(type: string): string { + return typeStructureEnum[type]; + } } diff --git a/src/app/shared/enum/typeStructure.enum.ts b/src/app/shared/enum/typeStructure.enum.ts index e21c7cb40..e34375908 100644 --- a/src/app/shared/enum/typeStructure.enum.ts +++ b/src/app/shared/enum/typeStructure.enum.ts @@ -1,19 +1,31 @@ export enum typeStructureEnum { - associationCaritative = 'Association caritative', - centreSocio = 'Centre socio-culturel', - cyber = 'Cyberbase / Cybercentre', - coworking = 'Espace de coworking', fablab = 'Fablab', + // A supprimer ? + + //A remplacer par Association ? + associationQuartier = 'Structure associative de quartier', + associationCaritative = 'Association caritative', + + // En attente de suppression remplacer par CAF CARSAT, Pole Emploi et CCAS grandOrganismePublic = 'Grand organisme public (CAF, CARSAT, Pôle emploi...)', + + mdm = 'Maison de la métropole', mairie = 'Mairie', - mdm = 'Maison de la Métropole (MDM)', - mediatheque = 'Médiathèque / Bibliothèque', + CAF = 'CAF', + CCAS = 'CCAS', + CARSAT = 'CARSAT', + poleEmploi = 'Pole Emploi', + mediatheque = 'Médiathèque/Bibliothèque', + prefecture = 'Préfecture', + bijPij = 'BIJ/PIJ', + + association = 'Association', + centreSocio = 'Centre socio-culturel', + mjc = 'MJC / Cyberbase', + pimms = 'PIMMS', + sij = 'Structure information jeunesse (SIJ)', missionsLocales = 'Missions locales', - mjc = 'MJC', - pimms = 'Pimms', - ressourcerie = 'Ressourcerie (matériel moindre coût / recyclé)', - associationQuartier = 'Structure associative de quartier', + formation = 'Structure de formation', insertion = "Structure d'insertion", - sij = 'Structure information jeunesse (SIJ)', } -- GitLab From 79b00f9b1e331556525cbebaac2be8590fad057e Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Thu, 11 Feb 2021 12:10:58 +0100 Subject: [PATCH 19/24] fix(editForm) : fix validate btn --- src/app/form/form.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 58d8f0d11..e324c15f5 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -685,6 +685,7 @@ export class FormComponent implements OnInit { this.showCollapse(structure); } this.currentPage = numPage; + this.updatePageValid(); } public closeEditMode(): void { -- GitLab From 60083224f7229ebdf01a771ae5d98d148a179b9d Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Thu, 11 Feb 2021 12:38:06 +0100 Subject: [PATCH 20/24] fix(form) : add a new Type structure --- src/app/shared/enum/typeStructure.enum.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/shared/enum/typeStructure.enum.ts b/src/app/shared/enum/typeStructure.enum.ts index e34375908..e23ed6665 100644 --- a/src/app/shared/enum/typeStructure.enum.ts +++ b/src/app/shared/enum/typeStructure.enum.ts @@ -18,6 +18,7 @@ export enum typeStructureEnum { mediatheque = 'Médiathèque/Bibliothèque', prefecture = 'Préfecture', bijPij = 'BIJ/PIJ', + logement = 'Logement', association = 'Association', centreSocio = 'Centre socio-culturel', -- GitLab From a694b7694cf87ed441a99cd6b759052ca01a8b52 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Thu, 11 Feb 2021 14:54:46 +0100 Subject: [PATCH 21/24] fix(hour-picker) : fix editMode on hour --- src/app/form/form.component.html | 1 - .../components/hour-picker/hour-picker.component.html | 7 +++---- .../shared/components/hour-picker/hour-picker.component.ts | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 3af12920f..6f3458d83 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -303,7 +303,6 @@ (updateForm)="updateHours($event)" (updateFormError)="setHoursError()" [structureInput]="hoursForm" - [isEditMode]="!isEditMode" ></app-hour-picker> </div> <div *ngIf="currentPage == 9" class="page"> diff --git a/src/app/shared/components/hour-picker/hour-picker.component.html b/src/app/shared/components/hour-picker/hour-picker.component.html index 0a509ad52..ff785893b 100644 --- a/src/app/shared/components/hour-picker/hour-picker.component.html +++ b/src/app/shared/components/hour-picker/hour-picker.component.html @@ -19,7 +19,6 @@ id="{{ day.name }}" (click)="toggleOpenDay(day, $event.target.checked)" [checked]="day.open" - [disabled]="isEditMode" /> <span class="slider"></span> </label> @@ -52,13 +51,13 @@ <div>de</div> <div class="input-container"> - <input type="time" [(ngModel)]="hour.start" (change)="submitForm()" [disabled]="isEditMode" /> + <input type="time" [(ngModel)]="hour.start" (change)="submitForm()" /> </div> <div>à </div> <div class="input-container"> - <input type="time" [(ngModel)]="hour.end" (change)="submitForm()" [disabled]="isEditMode" /> + <input type="time" [(ngModel)]="hour.end" (change)="submitForm()" /> </div> <div> @@ -70,7 +69,7 @@ </div> </div> </div> - <div class="add" *ngIf="day.hours.length === 1 && !isEditMode"> + <div class="add" *ngIf="day.hours.length === 1"> <div (click)="addHours(day)" fxLayout="row" diff --git a/src/app/shared/components/hour-picker/hour-picker.component.ts b/src/app/shared/components/hour-picker/hour-picker.component.ts index 6114ce012..63f42f543 100644 --- a/src/app/shared/components/hour-picker/hour-picker.component.ts +++ b/src/app/shared/components/hour-picker/hour-picker.component.ts @@ -14,7 +14,6 @@ import { CheckHours } from '../../validator/form'; export class HourPickerComponent implements OnChanges, OnDestroy { @Input() modifiedFields: any; @Input() structureInput: FormGroup; - @Input() isEditMode: boolean; @Output() updateFormError = new EventEmitter<any>(); @Output() updateForm = new EventEmitter<FormGroup>(); -- GitLab From 4ebd7115f8e80b7bc302be1524dadddd7490c037 Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Thu, 11 Feb 2021 15:06:52 +0100 Subject: [PATCH 22/24] fix(regex) : fix website regex to include http and https --- 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 4f83475e6..451336f7b 100644 --- a/src/app/shared/enum/regex.enum.ts +++ b/src/app/shared/enum/regex.enum.ts @@ -2,7 +2,7 @@ export enum Regex { email = '[a-z0-9.-]+@[a-z0-9.-]+[.][a-z]{2,3}', textWithoutNumber = '[A-Za-zÀ-ÖØ-öø-ÿ- ]{1,}', phone = '([0-9]{2} ){4}[0-9]{2}', - website = '(www[.])[a-z0-9.-]*[.][a-z]{2,3}', + website = '(www[.])?(https://)?(http://)?[a-zA-Z0-9.-]*[.][a-z]{2,3}((/)[a-zA-Z0-9-/]*)?', linkedIn = '(linkedin.com/in/[a-z0-9A-Z.-]{1,})', facebook = '(facebook.com/[a-z0-9A-Z.-]{1,})', twitter = '(twitter.com/[a-z0-9A-Z.-]{1,})', -- GitLab From 90018181f0795da18825a59be3c80780c795d33d Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Thu, 11 Feb 2021 16:44:29 +0100 Subject: [PATCH 23/24] fix(form) : fix wifi + fix confirmation modal exit --- src/app/form/form.component.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index e324c15f5..d46aa1071 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -64,6 +64,7 @@ export class FormComponent implements OnInit { public showMenu = false; public isEditMode = false; public isLoading = false; + public isWifiChoosen = false; constructor( private structureService: StructureService, @@ -83,6 +84,7 @@ export class FormComponent implements OnInit { this.isLoading = false; if (history.state.data) { this.isEditMode = true; + this.isWifiChoosen = true; this.initForm(new Structure(history.state.data)); } else { this.initForm(new Structure()); @@ -342,6 +344,9 @@ export class FormComponent implements OnInit { } public onCheckChange(event: boolean, formControlName: string, value: string): void { + if (value == 'wifiEnAccesLibre') { + this.isWifiChoosen = true; + } const formArray: FormArray = this.structureForm.get(formControlName) as FormArray; if (event) { // Add a new control in the arrayForm @@ -425,7 +430,7 @@ export class FormComponent implements OnInit { }; this.pagesValidation[16] = { valid: this.getStructureControl('freeWorkShop').valid, name: 'Gratuité des ateliers' }; this.pagesValidation[17] = { - valid: this.getStructureControl('equipmentsAndServices').valid, + valid: this.getStructureControl('equipmentsAndServices').valid && this.isWifiChoosen, name: 'Gratuité du wifi', }; this.pagesValidation[18] = { @@ -658,7 +663,7 @@ export class FormComponent implements OnInit { public canExit(): Promise<boolean> { // Avoid confirmation when user submit form and leave. - if (this.currentPage == this.nbPagesForm || this.isEditMode) { + if (this.currentPage == this.nbPagesForm || this.currentPage < 3 || this.isEditMode) { return new Promise((resolve) => resolve(true)); } else { return new Promise((resolve) => this.showModal(resolve)); -- GitLab From 082ae5246e6506ae01f9e8bee69142d8823075dc Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Thu, 11 Feb 2021 16:48:22 +0100 Subject: [PATCH 24/24] fix(form) : fix regex social network --- src/app/shared/enum/regex.enum.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/shared/enum/regex.enum.ts b/src/app/shared/enum/regex.enum.ts index 451336f7b..6011651df 100644 --- a/src/app/shared/enum/regex.enum.ts +++ b/src/app/shared/enum/regex.enum.ts @@ -3,9 +3,9 @@ export enum Regex { textWithoutNumber = '[A-Za-zÀ-ÖØ-öø-ÿ- ]{1,}', phone = '([0-9]{2} ){4}[0-9]{2}', website = '(www[.])?(https://)?(http://)?[a-zA-Z0-9.-]*[.][a-z]{2,3}((/)[a-zA-Z0-9-/]*)?', - linkedIn = '(linkedin.com/in/[a-z0-9A-Z.-]{1,})', - facebook = '(facebook.com/[a-z0-9A-Z.-]{1,})', - twitter = '(twitter.com/[a-z0-9A-Z.-]{1,})', - instagram = '(instagram.com/[a-z0-9A-Z.-]{1,})', + linkedIn = '(linkedin.com/in/.{1,})', + facebook = '(facebook.com/.{1,})', + twitter = '(twitter.com/.{1,})', + instagram = '(instagram.com/.{1,})', noNullNumber = '[1-9]{1}[0-9]*', } -- GitLab