From 1bc00e8fc5a085e4fc10b8fb019a3a0755b9bb3b Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Tue, 17 May 2022 13:56:13 +0200 Subject: [PATCH 01/11] feat(onboarding): Add edit mode --- src/app/app-routing.module.ts | 27 --- src/app/carto/carto.component.ts | 2 +- .../footer-form/footer-form.component.html | 23 ++- .../form/footer-form/footer-form.component.ts | 17 +- .../form-view/form-view-routing.module.ts | 13 ++ .../form/form-view/form-view.component.html | 6 +- src/app/form/form-view/form-view.component.ts | 161 +++------------ .../progress-bar/progress-bar.component.html | 1 + .../progress-bar/progress-bar.component.scss | 3 + .../structure-form.component.html | 4 +- .../structure-form.component.ts | 57 ++---- .../structure-wifi.component.html | 2 +- .../structure-wifi.component.ts | 10 +- .../form/structure-form/form.component.html | 3 +- src/app/form/structure-form/form.component.ts | 12 +- src/app/profile/profile-routing.module.ts | 16 +- src/app/profile/profile.module.ts | 3 +- .../structure-edition-summary.component.html | 30 +++ .../structure-edition-summary.component.scss | 34 ++++ ...tructure-edition-summary.component.spec.ts | 25 +++ .../structure-edition-summary.component.ts | 45 +++++ src/app/services/structure.service.ts | 47 ++--- .../svg-icon/svg-icon.component.scss | 5 + src/app/utils/formUtils.ts | 184 ++++++++++++++++++ src/assets/ico/arrowBack.svg | 4 + src/assets/ico/sprite.svg | 5 + 26 files changed, 487 insertions(+), 252 deletions(-) create mode 100644 src/app/profile/structure-edition-summary/structure-edition-summary.component.html create mode 100644 src/app/profile/structure-edition-summary/structure-edition-summary.component.scss create mode 100644 src/app/profile/structure-edition-summary/structure-edition-summary.component.spec.ts create mode 100644 src/app/profile/structure-edition-summary/structure-edition-summary.component.ts create mode 100644 src/app/utils/formUtils.ts create mode 100644 src/assets/ico/arrowBack.svg diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 7bc8c50b9..eda41baac 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -175,33 +175,6 @@ const routes: Routes = [ path: 'new-password', component: PasswordFormComponent, }, - { - path: 'create-structure', - children: [ - { - path: '', - component: FormComponent, - canDeactivate: [DeactivateGuard], - }, - footerOutletRoute, - ], - }, - { - path: 'create-structure/:id', - children: [ - { - path: '', - component: FormComponent, - canDeactivate: [DeactivateGuard], - canActivate: [RoleGuard], - data: { allowedRoles: [RouteRole.structureAdmin] }, - resolve: { - structure: StructureResolver, - }, - }, - footerOutletRoute, - ], - }, { path: 'newsletter', children: [ diff --git a/src/app/carto/carto.component.ts b/src/app/carto/carto.component.ts index 504278456..73ed247ce 100644 --- a/src/app/carto/carto.component.ts +++ b/src/app/carto/carto.component.ts @@ -113,7 +113,7 @@ export class CartoComponent implements OnInit { if (this.geolocation) { structure = this.getStructurePosition(structure, lon, lat); } - return this.structureService.updateOpeningStructure(structure); + return structure; }) ).then((structureList) => { if (sortByDistance) { diff --git a/src/app/form/footer-form/footer-form.component.html b/src/app/form/footer-form/footer-form.component.html index e196d9891..1a2edbd93 100644 --- a/src/app/form/footer-form/footer-form.component.html +++ b/src/app/form/footer-form/footer-form.component.html @@ -5,18 +5,26 @@ fxLayoutGap="10px" fxLayoutAlign="center center" > + <!-- <ng-container *ngIf="isEditMode"> + +</ng-container> --> <app-button *ngIf="!isLastFormStep && !isNextFormTransition && !isStructureLastPage() && !isPersonalOfferFirstPage()" (action)="prevPage()" [text]="btnName[0]" [iconType]="'form'" - [iconBtn]="'chevronLeft'" + [iconBtn]="!isEditMode && 'chevronLeft'" ></app-button> - <app-button *ngIf="isLastFormStep" (action)="goToHome()" [text]="'Ok'" [style]="buttonTypeEnum.Primary"></app-button> + <app-button + *ngIf="isLastFormStep && !isEditMode" + (action)="goToHome()" + [text]="'Ok'" + [style]="buttonTypeEnum.Primary" + ></app-button> <app-button - *ngIf="!isLastFormStep && !isNextFormTransition" + *ngIf="!isLastFormStep && !isNextFormTransition && !isEditMode" (action)="nextPage()" [disabled]="!isValid" [text]="btnName[1]" @@ -26,4 +34,13 @@ [style]="buttonTypeEnum.Primary" > </app-button> + + <app-button + *ngIf="isEditMode" + (action)="saveEdit()" + [disabled]="!isValid" + [text]="'Valider'" + [style]="buttonTypeEnum.Primary" + > + </app-button> </div> diff --git a/src/app/form/footer-form/footer-form.component.ts b/src/app/form/footer-form/footer-form.component.ts index 768195efc..3f42f90cc 100644 --- a/src/app/form/footer-form/footer-form.component.ts +++ b/src/app/form/footer-form/footer-form.component.ts @@ -31,11 +31,13 @@ export class FooterFormComponent implements OnChanges { @Input() acceptNewsletter: boolean; @Input() currentStep: accountFormStep | profileFormStep | structureFormStep | personalOfferFormStep; @Input() hasOtherPersonalOffer: boolean; + @Input() isEditMode: boolean; @Output() goNext = new EventEmitter<any>(); @Output() goPrev = new EventEmitter<any>(); @Output() endPage = new EventEmitter<any>(); @Output() endForm = new EventEmitter<any>(); @Output() changeCurrentStep = new EventEmitter<any>(); + @Output() saveEditedStructure = new EventEmitter<any>(); public isLastFormStep: boolean = false; public isNextFormTransition: boolean = false; @@ -90,11 +92,15 @@ export class FooterFormComponent implements OnChanges { } public prevPage(): void { - if (this.currentForm === formType.structure && this.currentStep === structureFormStep.structureType) { - this.changeCurrentStep.emit(structureFormStep.structureFormTime); - return; + if (!this.isEditMode) { + if (this.currentForm === formType.structure && this.currentStep === structureFormStep.structureType) { + this.changeCurrentStep.emit(structureFormStep.structureFormTime); + return; + } + this.goToPreviousPage(); + } else { + history.back(); } - this.goToPreviousPage(); } public async nextPage(): Promise<void> { if (this.currentForm === formType.account && this.currentStep === accountFormStep.accountNewsletter) { @@ -140,6 +146,9 @@ export class FooterFormComponent implements OnChanges { } this.goToNextPage(); } + public saveEdit(): void { + this.saveEditedStructure.emit(); + } private isStructureChoiceValid(): boolean { return ( diff --git a/src/app/form/form-view/form-view-routing.module.ts b/src/app/form/form-view/form-view-routing.module.ts index 7a6b0dac1..9768d97d6 100644 --- a/src/app/form/form-view/form-view-routing.module.ts +++ b/src/app/form/form-view/form-view-routing.module.ts @@ -1,6 +1,10 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; +import { AdminGuard } from '../../guards/admin.guard'; import { AuthGuard } from '../../guards/auth.guard'; +import { RoleGuard } from '../../guards/role.guard'; +import { StructureResolver } from '../../resolvers/structure.resolver'; +import { RouteRole } from '../../shared/enum/routeRole.enum'; import { AccountFormComponent } from './account-form/account-form.component'; import { FormViewComponent } from './form-view.component'; import { PersonalOfferGuard } from './guards/personalOffer.guard'; @@ -9,6 +13,15 @@ import { ProfileFormComponent } from './profile-form/profile-form.component'; import { StructureFormComponent } from './structure-form/structure-form.component'; const routes: Routes = [ + { + path: 'structure/:id/:step', + component: FormViewComponent, + canActivate: [RoleGuard], + data: { allowedRoles: [RouteRole.structureAdmin] }, + resolve: { + structure: StructureResolver, + }, + }, { path: '', component: FormViewComponent, diff --git a/src/app/form/form-view/form-view.component.html b/src/app/form/form-view/form-view.component.html index 57097f410..0c6a549be 100644 --- a/src/app/form/form-view/form-view.component.html +++ b/src/app/form/form-view/form-view.component.html @@ -29,14 +29,16 @@ <ng-container *ngIf="formType[routeParam] === formType.structure"> <app-structure-form [nbSteps]="nbSteps" + [structure]="structure" [structureForm]="structureForm" [hoursForm]="hoursForm" [currentStep]="currentPage" - [structure]="structure" + [isEditMode]="isEditMode" (goNext)="nextPage()" (isNotExistingStructure)="nextPage()" (pageValid)="validatePage($event)" (updateHoursForm)="updateHours($event)" + (setEditStep)="setCurrentStep($event)" ></app-structure-form> </ng-container> <ng-container *ngIf="formType[routeParam] === formType.personaloffer"> @@ -59,9 +61,11 @@ [isValid]="isPageValid" [acceptNewsletter]="userAcceptNewsletter" [hasOtherPersonalOffer]="hasOtherPersonalOffer" + [isEditMode]="isEditMode" (goNext)="nextPage()" (goPrev)="prevPage()" (endForm)="endForm($event)" (changeCurrentStep)="setCurrentStep($event)" + (saveEditedStructure)="saveEditedStructure()" ></app-footer-form> </div> diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts index d5776889a..e7afc577a 100644 --- a/src/app/form/form-view/form-view.component.ts +++ b/src/app/form/form-view/form-view.component.ts @@ -3,17 +3,16 @@ import { FormGroup, FormControl, Validators, FormArray } from '@angular/forms'; import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; import { forkJoin, of } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; -import { Day } from '../../models/day.model'; import { PersonalOffer } from '../../models/personalOffer.model'; import { Structure } from '../../models/structure.model'; import { StructureWithOwners } from '../../models/structureWithOwners.model'; -import { Time } from '../../models/time.model'; import { User } from '../../models/user.model'; import { ProfileService } from '../../profile/services/profile.service'; import { PersonalOfferService } from '../../services/personal-offer.service'; import { StructureService } from '../../services/structure.service'; import { MustMatch } from '../../shared/validator/form'; import { CustomRegExp } from '../../utils/CustomRegExp'; +import { formUtils } from '../../utils/formUtils'; import { accountFormStep } from './account-form/accountFormStep.enum'; import { formType } from './formType.enum'; import { personalOfferFormStep } from './personal-offer-form/personalOfferFormStep.enum'; @@ -31,7 +30,7 @@ export class FormViewComponent implements OnInit { public currentPage: accountFormStep | profileFormStep | structureFormStep | personalOfferFormStep; public currentFormType: formType; public currentForm: FormGroup; - + public formUtils = new formUtils(); // Account Form public accountForm: FormGroup; public userAcceptNewsletter: boolean; @@ -66,7 +65,6 @@ export class FormViewComponent implements OnInit { public isClaimMode: boolean = false; public isJoinMode: boolean = false; public claimStructure: boolean = false; - public isWifiChoosen: boolean; public linkedStructureId; public structureWithOwners: StructureWithOwners; public isPageValid: boolean = false; @@ -106,24 +104,12 @@ export class FormViewComponent implements OnInit { this.linkedStructureId = data.user.pendingStructuresLink; this.currentPage = accountFormStep.accountInfo; } - //TODO: Edit mode - // if (data.structure) { - // this.isEditMode = true; - // this.isWifiChoosen = true; - // const editStructure = new Structure(data.structure); - // this.initForm(editStructure); - // this.structureService.getStructureWithOwners(editStructure._id, this.profile).subscribe((s) => { - // this.structureWithOwners = s; - // }); - // } - }); - - this.route.data.subscribe((data) => { - if (data.user) { - this.isAccountMode = true; - } if (data.structure) { this.isEditMode = true; + this.structure = data.structure; + this.editForm = this.formUtils.createStructureForm(data.structure, this.isEditMode); + this.structureForm = this.editForm; + this.hoursForm = this.formUtils.createHoursForm(data.structure); } }); @@ -153,27 +139,16 @@ export class FormViewComponent implements OnInit { this.currentForm = this.profileForm; } if (formType[this.routeParam] === formType.structure) { - this.nbSteps = 24; - this.currentPage = structureFormStep.structureChoice; - this.currentFormType = formType.structure; - this.structure = new Structure(); - this.createStructureForm(this.structure); - this.currentForm = this.structureForm; - //TODO: Edit mode - // if (this.isEditMode) { - // this.editForm = this.createStructureForm(structure); - // } - + if (!this.isEditMode) { + this.nbSteps = 24; + this.currentPage = structureFormStep.structureChoice; + this.currentFormType = formType.structure; + this.structure = new Structure(); + this.structureForm = this.formUtils.createStructureForm(this.structure); + this.currentForm = this.structureForm; + } // Init hours form - this.hoursForm = new FormGroup({ - monday: this.createDay(this.structure.hours.monday), - tuesday: this.createDay(this.structure.hours.tuesday), - wednesday: this.createDay(this.structure.hours.wednesday), - thursday: this.createDay(this.structure.hours.thursday), - friday: this.createDay(this.structure.hours.friday), - saturday: this.createDay(this.structure.hours.saturday), - sunday: this.createDay(this.structure.hours.sunday), - }); + this.hoursForm = this.formUtils.createHoursForm(this.structure); } if (formType[this.routeParam] === formType.personaloffer) { this.nbSteps = 3; @@ -189,19 +164,6 @@ export class FormViewComponent implements OnInit { this.hoursForm = form; } - private createDay(day: Day): FormGroup { - return new FormGroup({ - open: new FormControl(day.open, Validators.required), - time: new FormArray(day.time.map((oneTime) => this.createTime(oneTime))) as FormArray, - }); - } - private createTime(time: Time): FormGroup { - return new FormGroup({ - opening: new FormControl(time.opening), - closing: new FormControl(time.closing), - }); - } - private createAccountForm(email?: string): void { this.accountForm = new FormGroup( { @@ -234,88 +196,10 @@ export class FormViewComponent implements OnInit { }); } - private createStructureForm(structure): void { - this.structureForm = new FormGroup({ - _id: new FormControl(structure._id), - coord: new FormControl(structure.coord), - structureType: new FormControl(structure.structureType, Validators.required), - structureName: new FormControl(structure.structureName, Validators.required), - description: 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), - commune: new FormControl(structure.address.commune, Validators.required), - }), - contactMail: new FormControl(structure.contactMail, [ - Validators.required, - Validators.pattern(CustomRegExp.EMAIL), - ]), - contactPhone: new FormControl(structure.contactPhone, [ - Validators.required, - Validators.pattern(CustomRegExp.PHONE), - ]), - contactPersonFirstname: new FormControl(structure.contactPersonLastname, Validators.required), - contactPersonLastname: new FormControl(structure.contactPersonLastname, Validators.required), - contactPersonEmail: new FormControl(structure.contactPersonEmail, [ - Validators.pattern(CustomRegExp.EMAIL), - Validators.required, - ]), - website: new FormControl(structure.website, Validators.pattern(CustomRegExp.WEBSITE)), - facebook: new FormControl(structure.facebook, Validators.pattern(CustomRegExp.FACEBOOK)), - twitter: new FormControl(structure.twitter, Validators.pattern(CustomRegExp.TWITTER)), - instagram: new FormControl(structure.instagram, Validators.pattern(CustomRegExp.INSTAGRAM)), - linkedin: new FormControl(structure.linkedin, Validators.pattern(CustomRegExp.LINKEDIN)), - hours: new FormGroup({}), - pmrAccess: new FormControl(structure.pmrAccess, Validators.required), - placeOfReception: new FormControl(structure.placeOfReception, Validators.required), - choiceCompletion: new FormControl(structure.choiceCompletion, Validators.required), - exceptionalClosures: new FormControl(structure.exceptionalClosures), - labelsQualifications: this.loadArrayForCheckbox(structure.labelsQualifications, false), - accessModality: this.loadArrayForCheckbox(structure.accessModality, true), - publicsAccompaniment: this.loadArrayForCheckbox(structure.publicsAccompaniment, false), - proceduresAccompaniment: this.loadArrayForCheckbox(structure.proceduresAccompaniment, false), - //TODO: remettre ou migrer les données de accompagnements à distance - remoteAccompaniment: new FormControl(false), - otherDescription: new FormControl(structure.otherDescription), - equipmentsAndServices: this.loadArrayForCheckbox(structure.equipmentsAndServices, false), - publics: this.loadArrayForCheckbox(structure.publics, true), - baseSkills: new FormControl(structure.baseSkills), - accessRight: new FormControl(structure.accessRight), - parentingHelp: new FormControl(structure.parentingHelp), - socialAndProfessional: new FormControl(structure.socialAndProfessional), - digitalCultureSecurity: new FormControl(structure.digitalCultureSecurity), - nbComputers: new FormControl( - structure.equipmentsAndServices.includes('ordinateurs') ? structure.nbComputers : 0, - [Validators.required, Validators.pattern(CustomRegExp.NO_NEGATIVE_NUMBER), Validators.min(0)] - ), - nbPrinters: new FormControl(structure.equipmentsAndServices.includes('imprimantes') ? structure.nbPrinters : 0, [ - Validators.required, - Validators.pattern(CustomRegExp.NO_NEGATIVE_NUMBER), - Validators.min(0), - ]), - nbTablets: new FormControl(structure.equipmentsAndServices.includes('tablettes') ? structure.nbTablets : 0, [ - Validators.required, - Validators.pattern(CustomRegExp.NO_NEGATIVE_NUMBER), - Validators.min(0), - ]), - nbNumericTerminal: new FormControl( - structure.equipmentsAndServices.includes('bornesNumeriques') ? structure.nbNumericTerminal : 0, - [Validators.required, Validators.pattern(CustomRegExp.NO_NEGATIVE_NUMBER), Validators.min(0)] - ), - nbScanners: new FormControl(structure.equipmentsAndServices.includes('scanners') ? structure.nbScanners : 0, [ - Validators.required, - Validators.pattern(CustomRegExp.NO_NEGATIVE_NUMBER), - Validators.min(0), - ]), - freeWorkShop: new FormControl(structure.freeWorkShop, [Validators.required]), - dataShareConsentDate: new FormControl(structure.dataShareConsentDate), - personalOffers: new FormControl(structure.personalOffers), - }); - } public acceptReceiveNewsletter(isAccepted: boolean): void { this.userAcceptNewsletter = isAccepted; } + private createPersonalOfferForm(personalOffer: PersonalOffer): void { this.personalOfferForm = new FormGroup({ publicsAccompaniment: new FormControl(personalOffer.publicsAccompaniment), @@ -328,12 +212,6 @@ export class FormViewComponent implements OnInit { }); } - private loadArrayForCheckbox(array: string[], isRequired: boolean): FormArray { - return new FormArray( - array.map((str) => new FormControl(str)), - isRequired ? Validators.required : Validators.nullValidator - ); - } public validatePage(value: boolean = true): void { this.isPageValid = value; } @@ -448,4 +326,11 @@ export class FormViewComponent implements OnInit { public setCurrentStep(step: accountFormStep | profileFormStep | structureFormStep | personalOfferFormStep): void { this.currentPage = step; } + public async saveEditedStructure() { + let editStructure = this.editForm.value; + editStructure.hours = this.hoursForm.value; + this.structureService.editStructure(editStructure).subscribe(() => { + history.back(); + }); + } } diff --git a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.html b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.html index 7d9519939..e0bb31dfb 100644 --- a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.html +++ b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.html @@ -15,3 +15,4 @@ ></progress> </div> </div> +<div class="topSpacing" *ngIf="isEditMode"></div> diff --git a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss index 011fc106e..42bce1cb3 100644 --- a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss +++ b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss @@ -31,3 +31,6 @@ min-width: 26px; } } +.topSpacing { + margin-top: 1rem; +} diff --git a/src/app/form/form-view/structure-form/structure-form.component.html b/src/app/form/form-view/structure-form/structure-form.component.html index 49dc8407f..ddbb3f322 100644 --- a/src/app/form/form-view/structure-form/structure-form.component.html +++ b/src/app/form/form-view/structure-form/structure-form.component.html @@ -117,11 +117,9 @@ </div> <div *ngIf="currentStep == structureFormStep.structureWifi"> <app-structure-wifi - [structureForm]="structureForm" [isEditMode]="isEditMode" - [isWifiChoosen]="isWifiChoosen" + [structureForm]="structureForm" (validateForm)="setValidationsForm($event)" - (inArray)="isInArray($event)" (checkChange)="onCheckChange($event)" ></app-structure-wifi> </div> diff --git a/src/app/form/form-view/structure-form/structure-form.component.ts b/src/app/form/form-view/structure-form/structure-form.component.ts index d55a77f90..7f5df0770 100644 --- a/src/app/form/form-view/structure-form/structure-form.component.ts +++ b/src/app/form/form-view/structure-form/structure-form.component.ts @@ -1,5 +1,6 @@ import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { AbstractControl, FormArray, FormControl, FormGroup, Validators } from '@angular/forms'; +import { ActivatedRoute } from '@angular/router'; import { Address } from '../../../models/address.model'; import { User } from '../../../models/user.model'; import { ProfileService } from '../../../profile/services/profile.service'; @@ -19,9 +20,11 @@ export class StructureFormComponent implements OnChanges { @Input() currentStep: structureFormStep; @Input() structureForm: FormGroup; @Input() hoursForm: FormGroup; + @Input() isEditMode: boolean; @Output() pageValid = new EventEmitter<any>(); @Output() updateHoursForm = new EventEmitter<any>(); @Output() isNotExistingStructure = new EventEmitter<any>(); + @Output() setEditStep = new EventEmitter<any>(); public structureFormStep = structureFormStep; public formTypeEnum = formType; public isPageValid: boolean; @@ -35,8 +38,6 @@ export class StructureFormComponent implements OnChanges { public showProceduresAccompaniment: boolean; // Condition form - public isEditMode = false; - public isWifiChoosen = null; public isClaimMode = false; public isAccountMode: boolean = false; public userAcceptSavedDate = false; @@ -50,7 +51,11 @@ export class StructureFormComponent implements OnChanges { public publicsAccompaniment: Category; public publics: Category; - constructor(private searchService: SearchService, private profileService: ProfileService) {} + constructor( + private searchService: SearchService, + private profileService: ProfileService, + private route: ActivatedRoute + ) {} ngOnChanges(changes: SimpleChanges): void { if (changes.currentStep) { @@ -77,9 +82,11 @@ export class StructureFormComponent implements OnChanges { this.profileService.getProfile().then((user: User) => { this.profile = user; }); - // if (this.isEditMode) { - // this.showCollapse(structure); - // } + if (this.isEditMode) { + this.route.params.subscribe((params) => { + this.setEditStep.emit(structureFormStep[params.step]); + }); + } } public setAddressStructure(address?: Address): void { @@ -139,46 +146,37 @@ export class StructureFormComponent implements OnChanges { } else { this.pagesValidation[structureFormStep.structureChoice] = { valid: this.structureForm.get('_id').valid, - name: 'Structure existe', }; this.pagesValidation[structureFormStep.structureNameAndAddress] = { valid: this.structureForm.get('structureName').valid && this.structureForm.get('address').valid, - name: 'Nom et adresse', }; this.pagesValidation[structureFormStep.structureContact] = { valid: this.structureForm.get('contactMail').valid && this.structureForm.get('contactPhone').valid, - name: 'Contact structure', }; this.pagesValidation[structureFormStep.structureAccompanimentChoice] = { valid: this.structureForm.get('placeOfReception').valid, - name: 'Lieu d accueil', }; this.pagesValidation[structureFormStep.structureChoiceCompletion] = { - valid: this.structureForm.get('choiceCompletion').valid, - name: 'Completion info structure', + valid: this.isEditMode ? true : this.structureForm.get('choiceCompletion').valid, }; this.pagesValidation[structureFormStep.structureContactCompletion] = { - valid: - this.structureForm.get('contactPersonFirstname').valid && - this.structureForm.get('contactPersonLastname').valid && - this.structureForm.get('contactPersonEmail').valid, - name: 'Personne contact informations', + valid: this.isEditMode + ? true + : this.structureForm.get('contactPersonFirstname').valid && + this.structureForm.get('contactPersonLastname').valid && + this.structureForm.get('contactPersonEmail').valid, }; this.pagesValidation[structureFormStep.structureType] = { valid: this.structureForm.get('structureType').valid, - name: 'Type de structure', }; this.pagesValidation[structureFormStep.structureAccessModality] = { valid: this.structureForm.get('accessModality').valid, - name: "Modalités d'accueil", }; this.pagesValidation[structureFormStep.structureHours] = { valid: this.hoursForm.valid && this.structureForm.get('exceptionalClosures').valid, - name: "Horaires d'ouverture", }; this.pagesValidation[structureFormStep.structurePmr] = { valid: this.structureForm.get('pmrAccess').valid, - name: 'Accessibilité pour les personnes à mobilité réduite', }; this.pagesValidation[structureFormStep.structureWebAndSocialNetwork] = { valid: @@ -187,48 +185,37 @@ export class StructureFormComponent implements OnChanges { this.structureForm.get('twitter').valid && this.structureForm.get('instagram').valid) || !this.showSocialNetwork), - name: 'Présence sur internet', }; this.pagesValidation[structureFormStep.structurePublicTarget] = { valid: this.structureForm.get('publics').valid, - name: 'Public admis', }; this.pagesValidation[structureFormStep.structureDigitalHelpingAccompaniment] = { valid: this.structureForm.get('proceduresAccompaniment').valid, - name: 'Aides au numérique', }; this.pagesValidation[structureFormStep.structureTrainingType] = { valid: true, - name: 'Ateliers au numérique proposés', }; this.pagesValidation[structureFormStep.structureTrainingPrice] = { valid: this.structureForm.get('freeWorkShop').valid, - name: 'Gratuité des ateliers', }; this.pagesValidation[structureFormStep.structureWifi] = { - valid: this.structureForm.get('equipmentsAndServices').valid && this.isWifiChoosen !== null, - name: 'Gratuité du wifi', + valid: this.structureForm.get('equipmentsAndServices').valid, }; this.pagesValidation[structureFormStep.structureEquipments] = { valid: true, - name: 'Equipements mis à disposition', }; this.pagesValidation[structureFormStep.structureLabels] = { valid: true, - name: 'Labélisations proposées', }; this.pagesValidation[structureFormStep.structureOtherServices] = { valid: this.structureForm.get('equipmentsAndServices').valid, - name: 'Autres services proposés', }; this.pagesValidation[structureFormStep.structureDescription] = { valid: true, - name: 'Présentation de la structure', }; this.pagesValidation[structureFormStep.structureCovidInfo] = { valid: true, - name: 'Informations spécifiques à la période COVID', }; if (this.isEditMode) { this.pagesValidation[structureFormStep.structureConsent] = { @@ -238,6 +225,7 @@ export class StructureFormComponent implements OnChanges { } else { this.pagesValidation[structureFormStep.structureConsent] = { valid: this.userAcceptSavedDate }; } + this.updatePageValid(); } } @@ -288,9 +276,6 @@ export class StructureFormComponent implements OnChanges { formControlName: string; value: string; }): void { - if (value === 'wifiEnAccesLibre') { - this.isWifiChoosen = event; - } const formArray: FormArray = this.structureForm.get(formControlName) as FormArray; if (event) { // Add a new control in the arrayForm diff --git a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html index f20cf986b..ee30fb378 100644 --- a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html +++ b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html @@ -3,7 +3,7 @@ <h3>Le wifi est-il proposé en accès libre ?</h3> </div> <app-radio-form - [selectedOption]="isWifiChoosen !== null ? isWifiChoosen : isInArray('wifiEnAccesLibre', 'equipmentsAndServices')" + [selectedOption]="isEditMode ? isInArray('equipmentsAndServices', 'wifiEnAccesLibre') : null" (selectedEvent)="onCheckChange($event, 'equipmentsAndServices', 'wifiEnAccesLibre')" > </app-radio-form> diff --git a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts index b78192a39..8eec80606 100644 --- a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts +++ b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts @@ -8,17 +8,17 @@ import { FormGroup } from '@angular/forms'; export class StructureWifiComponent implements OnInit { @Input() structureForm: FormGroup; @Input() isEditMode: boolean; - @Input() isWifiChoosen: boolean; @Output() validateForm = new EventEmitter<any>(); - @Output() inArray = new EventEmitter<any>(); @Output() checkChange = new EventEmitter<any>(); ngOnInit(): void { this.validateForm.emit(); } - - public isInArray(accessModalityId: string, modality: string) { - this.inArray.emit({ formControlName: accessModalityId, value: modality }); + public isInArray(formControlName: string, term: string) { + if (this.structureForm.controls[formControlName].value) { + return this.structureForm.controls[formControlName].value.includes(term); + } + return false; } public onCheckChange(event, catId: string, modId: string): void { this.checkChange.emit({ event, formControlName: catId, value: modId }); diff --git a/src/app/form/structure-form/form.component.html b/src/app/form/structure-form/form.component.html index 64c56e835..88b997042 100644 --- a/src/app/form/structure-form/form.component.html +++ b/src/app/form/structure-form/form.component.html @@ -74,6 +74,7 @@ [isValid]="isPageValid" ></app-footer-form> </div> + <!-- ICIIIIIIIIIIII --> <div *ngIf="currentPage == pageTypeEnum.summary && isEditMode" class="editHome page" @@ -1042,8 +1043,6 @@ <app-radio-form [selectedOption]=" isEditMode - ? isInArray('wifiEnAccesLibre', 'equipmentsAndServices') - : isWifiChoosen ? isInArray('wifiEnAccesLibre', 'equipmentsAndServices') : null " diff --git a/src/app/form/structure-form/form.component.ts b/src/app/form/structure-form/form.component.ts index 29e9ebb37..f82cf2ec3 100644 --- a/src/app/form/structure-form/form.component.ts +++ b/src/app/form/structure-form/form.component.ts @@ -129,7 +129,7 @@ export class FormComponent implements OnInit { } if (data.structure) { this.isEditMode = true; - this.isWifiChoosen = true; + // this.isWifiChoosen = true; const editStructure = new Structure(data.structure); this.initForm(editStructure); this.structureService.getStructureWithOwners(editStructure._id, this.profile).subscribe((s) => { @@ -430,9 +430,9 @@ export class FormComponent implements OnInit { } public onCheckChange(event: boolean, formControlName: string, value: string): void { - if (value === 'wifiEnAccesLibre') { - this.isWifiChoosen = true; - } + // if (value === 'wifiEnAccesLibre') { + // this.isWifiChoosen = true; + // } const formArray: FormArray = this.structureForm.get(formControlName) as FormArray; if (event) { // Add a new control in the arrayForm @@ -565,7 +565,7 @@ export class FormComponent implements OnInit { name: 'Gratuité des ateliers', }; this.pagesValidation[PageTypeEnum.structureWifi] = { - valid: this.getStructureControl('equipmentsAndServices').valid && this.isWifiChoosen, + valid: this.getStructureControl('equipmentsAndServices').valid, name: 'Gratuité du wifi', }; this.pagesValidation[PageTypeEnum.structureEquipments] = { @@ -950,7 +950,7 @@ export class FormComponent implements OnInit { // If edit mode, update setbystep if (this.isEditMode) { this.structureService.editStructure(structure).subscribe((s: Structure) => { - this.createdStructure = this.structureService.updateOpeningStructure(s); + // this.createdStructure = this.structureService.updateOpeningStructure(s); this.editForm = this.createStructureForm(s); }); } else { diff --git a/src/app/profile/profile-routing.module.ts b/src/app/profile/profile-routing.module.ts index e6fd6675e..32aec5754 100644 --- a/src/app/profile/profile-routing.module.ts +++ b/src/app/profile/profile-routing.module.ts @@ -1,12 +1,26 @@ import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; +import { Routes, RouterModule, Route } from '@angular/router'; +import { DeactivateGuard } from '../guards/deactivate.guard'; +import { RoleGuard } from '../guards/role.guard'; +import { StructureResolver } from '../resolvers/structure.resolver'; +import { RouteRole } from '../shared/enum/routeRole.enum'; import { ProfileComponent } from './profile.component'; +import { StructureEditionSummaryComponent } from './structure-edition-summary/structure-edition-summary.component'; const routes: Routes = [ { path: '', component: ProfileComponent, }, + { + path: 'edit-structure/:id', + component: StructureEditionSummaryComponent, + canActivate: [RoleGuard], + data: { allowedRoles: [RouteRole.structureAdmin] }, + resolve: { + structure: StructureResolver, + }, + }, ]; @NgModule({ imports: [RouterModule.forChild(routes)], diff --git a/src/app/profile/profile.module.ts b/src/app/profile/profile.module.ts index 0de33f82d..6a2874aaf 100644 --- a/src/app/profile/profile.module.ts +++ b/src/app/profile/profile.module.ts @@ -3,9 +3,10 @@ import { ProfileComponent } from './profile.component'; import { SharedModule } from '../shared/shared.module'; import { CommonModule } from '@angular/common'; import { ProfileRoutingModule } from './profile-routing.module'; +import { StructureEditionSummaryComponent } from './structure-edition-summary/structure-edition-summary.component'; @NgModule({ - declarations: [ProfileComponent], + declarations: [ProfileComponent, StructureEditionSummaryComponent], imports: [CommonModule, ProfileRoutingModule, SharedModule], }) export class ProfileModule {} diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html new file mode 100644 index 000000000..030e4e2ae --- /dev/null +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html @@ -0,0 +1,30 @@ +<div class="container"> + <div class="header"> + <div fxLayout="row" fxLayoutAlign="start center" class="head" (click)="goBack()"> + <app-svg-icon [iconClass]="'backArrow'" [type]="'ico'" [icon]="'arrowBack'"></app-svg-icon> + <h2>Modifier la structure {{ structure.structureName }}</h2> + </div> + </div> + <div class="summary" *ngFor="let page of summary; let index = index"> + <div + *ngIf="!page.hideForEdit" + class="itemSummary" + [ngClass]="{ last: index == lastPage }" + fxLayout="row" + fxLayoutAlign="space-between center" + (click)="goToEdit(page.step)" + > + {{ page.name }} + <div fxLayout="row" fxLayoutAlign="space-between right"> + <div *ngIf="!isPageValid(page)" fxLayout="row" fxLayoutAlign="space-between center"> + <app-svg-icon [iconClass]="'validation'" [type]="'form'" [icon]="'notValidate'"></app-svg-icon> + <p class="invalidText"> + Informations <br /> + incomplètes + </p> + </div> + <app-svg-icon [iconClass]="'grey'" [type]="'form'" [icon]="'chevronRight'"></app-svg-icon> + </div> + </div> + </div> +</div> diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss b/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss new file mode 100644 index 000000000..51bb2f1c5 --- /dev/null +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss @@ -0,0 +1,34 @@ +@import '../../../assets/scss/color'; +@import '../../../assets/scss/typography'; + +.container { + margin: 1rem auto; + width: 100%; + max-width: 1000px; + padding: 2rem; + background: white; + border-radius: 8px; + border: 1px solid $grey-6; + .head { + cursor: pointer; + } + .summary { + width: 100%; + .h2 { + @include lato-regular-24; + } + .itemSummary { + height: 40px; + border-bottom: 1px solid $grey-6; + cursor: pointer; + &:hover:not(.invalidText) { + font-weight: bold; + } + .invalidText { + @include lato-regular-13; + margin: 0 0.5rem; + color: $orange-warning; + } + } + } +} diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.spec.ts b/src/app/profile/structure-edition-summary/structure-edition-summary.component.spec.ts new file mode 100644 index 000000000..102af1c0e --- /dev/null +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StructureEditionSummaryComponent } from './structure-edition-summary.component'; + +describe('StructureEditionSummaryComponent', () => { + let component: StructureEditionSummaryComponent; + let fixture: ComponentFixture<StructureEditionSummaryComponent>; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ StructureEditionSummaryComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(StructureEditionSummaryComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts new file mode 100644 index 000000000..03f027ad2 --- /dev/null +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts @@ -0,0 +1,45 @@ +import { Component, OnInit } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { ActivatedRoute, Router } from '@angular/router'; +import { structureFormStep } from '../../form/form-view/structure-form/structureFormStep.enum'; +import { Structure } from '../../models/structure.model'; +import { StructureService } from '../../services/structure.service'; +import { formUtils, IStructureSummary } from '../../utils/formUtils'; + +@Component({ + selector: 'app-structure-edition-summary', + templateUrl: './structure-edition-summary.component.html', + styleUrls: ['./structure-edition-summary.component.scss'], +}) +export class StructureEditionSummaryComponent implements OnInit { + public structure: Structure; + public structureForm: FormGroup; + constructor(private route: ActivatedRoute, private structureService: StructureService, private router: Router) {} + public summary: IStructureSummary[] = new formUtils().structureSummary; + + ngOnInit(): void { + this.route.data.subscribe((data) => { + if (data.structure) { + this.structure = new Structure(data.structure); + this.structureForm = new formUtils().createStructureForm(this.structure); + // this.structureService.getStructureWithOwners(this.structure._id, this.profile).subscribe((s) => { + // this.structureWithOwners = s; + // }); + } + }); + } + public goBack() { + this.router.navigateByUrl('/profile'); + } + public goToEdit(step: structureFormStep) { + this.router.navigate(['/form/structure', this.structure._id, structureFormStep[step]]); + } + public isPageValid(page: IStructureSummary) { + if (page.inputs) { + for (let input of page.inputs) { + if (!this.structureForm.get(input).valid) return false; + } + } + return true; + } +} diff --git a/src/app/services/structure.service.ts b/src/app/services/structure.service.ts index 76002c478..64939ec35 100644 --- a/src/app/services/structure.service.ts +++ b/src/app/services/structure.service.ts @@ -104,29 +104,30 @@ export class StructureService { }); } - /** - * Update opening hours of structure - * @param structure Structure model - */ - public updateOpeningStructure(structure: Structure): Structure { - // Get current day of week - const currentDate = DateTime.local(); - const dayOfWeek: number = currentDate.weekday; - - // Get the schedules of a structure according to his day to indicate if it's open - const structureSchedules: Day = structure.getDayhours(dayOfWeek); - - structure.isOpen = false; - if (structureSchedules.open) { - structureSchedules.time.forEach((period: Time) => { - if (this.compareSchedules(period.opening, period.closing, currentDate)) { - structure.isOpen = true; - } - }); - } - structure.openedOn = this.getNextOpening(structure, dayOfWeek, currentDate); //TODO: - return structure; - } + //TODO to delete + // /** + // * Update opening hours of structure + // * @param structure Structure model + // */ + // public updateOpeningStructure(structure: Structure): Structure { + // // Get current day of week + // const currentDate = DateTime.local(); + // const dayOfWeek: number = currentDate.weekday; + + // // Get the schedules of a structure according to his day to indicate if it's open + // const structureSchedules: Day = structure.getDayhours(dayOfWeek); + + // structure.isOpen = false; + // if (structureSchedules.open) { + // structureSchedules.time.forEach((period: Time) => { + // if (this.compareSchedules(period.opening, period.closing, currentDate)) { + // structure.isOpen = true; + // } + // }); + // } + // structure.openedOn = this.getNextOpening(structure, dayOfWeek, currentDate); //TODO: + // return structure; + // } /** * Checks if the current time is in the time interval of the structure diff --git a/src/app/shared/components/svg-icon/svg-icon.component.scss b/src/app/shared/components/svg-icon/svg-icon.component.scss index 72addb32c..c74649ebd 100644 --- a/src/app/shared/components/svg-icon/svg-icon.component.scss +++ b/src/app/shared/components/svg-icon/svg-icon.component.scss @@ -74,6 +74,11 @@ fill: $green-1; stroke: $green-1; } + &.backArrow { + height: 40px; + width: 40px; + margin-right: 1rem; + } } svg { diff --git a/src/app/utils/formUtils.ts b/src/app/utils/formUtils.ts new file mode 100644 index 000000000..ec7fa7984 --- /dev/null +++ b/src/app/utils/formUtils.ts @@ -0,0 +1,184 @@ +import { FormArray, FormControl, FormGroup, Validators } from '@angular/forms'; +import { structureFormStep } from '../form/form-view/structure-form/structureFormStep.enum'; +import { Day } from '../models/day.model'; +import { Time } from '../models/time.model'; +import { Structure } from '../models/structure.model'; +import { CustomRegExp } from './CustomRegExp'; + +export interface IStructureSummary { + step: structureFormStep; + name: string; + inputs: Array<string> | null; + hideForEdit?: boolean; +} +export class formUtils { + public structureSummary: Array<IStructureSummary> = [ + { step: structureFormStep.structureNameAndAddress, name: 'Nom et adresse', inputs: ['structureName', 'address'] }, + { step: structureFormStep.structureContact, name: 'Téléphone', inputs: ['contactMail', 'contactPhone'] }, + { step: structureFormStep.structureType, name: 'Type de structure', inputs: ['structureType'] }, + { step: structureFormStep.structureAccessModality, name: "Modalités d'accueil", inputs: ['accessModality'] }, + { step: structureFormStep.structureHours, name: "Horaires d'ouverture", inputs: ['exceptionalClosures'] }, + { + step: structureFormStep.structurePmr, + name: 'Accessibilité pour les personnes à mobilité réduite', + inputs: ['pmrAccess'], + }, + { + step: structureFormStep.structureWebAndSocialNetwork, + name: 'Présence sur internet', + inputs: ['website', 'facebook', 'twitter', 'instagram'], + }, + { step: structureFormStep.structurePublicTarget, name: 'Public admis', inputs: ['publics'] }, + + { + step: structureFormStep.structureDigitalHelpingAccompaniment, + name: 'Aides au numérique', + inputs: ['proceduresAccompaniment'], + }, + { step: structureFormStep.structureTrainingType, name: 'Ateliers au numérique proposés', inputs: null }, + { step: structureFormStep.structureTrainingPrice, name: 'Gratuité des ateliers', inputs: ['freeWorkShop'] }, + { step: structureFormStep.structureWifi, name: 'Wifi', inputs: ['equipmentsAndServices'] }, + { step: structureFormStep.structureEquipments, name: 'Equipements mis à disposition', inputs: null }, + { step: structureFormStep.structureLabels, name: 'Labélisations proposées', inputs: null }, + { + step: structureFormStep.structureOtherServices, + name: 'Autres services proposés', + inputs: ['equipmentsAndServices'], + }, + { step: structureFormStep.structureDescription, name: 'Présentation de la structure', inputs: null }, + { step: structureFormStep.structureCovidInfo, name: 'Informations spécifiques à la période COVID', inputs: null }, + { + step: structureFormStep.structureConsent, + name: 'Partage de données sur data.grandlyon.com', + inputs: ['dataShareConsentDate'], + }, + { + step: structureFormStep.structureChoiceCompletion, + name: 'Completion info structure', + inputs: ['choiceCompletion'], + hideForEdit: true, + }, + { + step: structureFormStep.structureContactCompletion, + name: 'Personne contact informations', + inputs: ['contactPersonFirstname', 'contactPersonLastname', 'contactPersonEmail'], + hideForEdit: true, + }, + { + step: structureFormStep.structureAccompanimentChoice, + name: "Lieu d'accueil", + inputs: ['placeOfReception'], + hideForEdit: true, + }, + ]; + public createStructureForm(structure: Structure, isEditMode?: boolean): FormGroup { + return new FormGroup({ + _id: new FormControl(structure._id), + coord: new FormControl(structure.coord), + structureType: new FormControl(structure.structureType, Validators.required), + structureName: new FormControl(structure.structureName, Validators.required), + description: 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), + commune: new FormControl(structure.address.commune, Validators.required), + }), + contactMail: new FormControl(structure.contactMail, [ + Validators.required, + Validators.pattern(CustomRegExp.EMAIL), + ]), + contactPhone: new FormControl(structure.contactPhone, [ + Validators.required, + Validators.pattern(CustomRegExp.PHONE), + ]), + contactPersonFirstname: new FormControl(structure.contactPersonLastName, !isEditMode && Validators.required), + contactPersonLastname: new FormControl(structure.contactPersonLastName, !isEditMode && Validators.required), + contactPersonEmail: new FormControl( + structure.contactPersonEmail, + !isEditMode && [Validators.pattern(CustomRegExp.EMAIL), Validators.required] + ), + website: new FormControl(structure.website, Validators.pattern(CustomRegExp.WEBSITE)), + facebook: new FormControl(structure.facebook, Validators.pattern(CustomRegExp.FACEBOOK)), + twitter: new FormControl(structure.twitter, Validators.pattern(CustomRegExp.TWITTER)), + instagram: new FormControl(structure.instagram, Validators.pattern(CustomRegExp.INSTAGRAM)), + linkedin: new FormControl(structure.linkedin, Validators.pattern(CustomRegExp.LINKEDIN)), + hours: new FormGroup({}), + pmrAccess: new FormControl(structure.pmrAccess, Validators.required), + placeOfReception: new FormControl(structure.placeOfReception, !isEditMode && Validators.required), + choiceCompletion: new FormControl(structure.choiceCompletion, !isEditMode && Validators.required), + exceptionalClosures: new FormControl(structure.exceptionalClosures), + labelsQualifications: this.loadArrayForCheckbox(structure.labelsQualifications, false), + accessModality: this.loadArrayForCheckbox(structure.accessModality, true), + publicsAccompaniment: this.loadArrayForCheckbox(structure.publicsAccompaniment, false), + proceduresAccompaniment: this.loadArrayForCheckbox(structure.proceduresAccompaniment, false), + //TODO: remettre ou migrer les données de accompagnements à distance + remoteAccompaniment: new FormControl(false), + otherDescription: new FormControl(structure.otherDescription), + equipmentsAndServices: this.loadArrayForCheckbox(structure.equipmentsAndServices, false), + publics: this.loadArrayForCheckbox(structure.publics, true), + baseSkills: new FormControl(structure.baseSkills), + accessRight: new FormControl(structure.accessRight), + parentingHelp: new FormControl(structure.parentingHelp), + socialAndProfessional: new FormControl(structure.socialAndProfessional), + digitalCultureSecurity: new FormControl(structure.digitalCultureSecurity), + nbComputers: new FormControl( + structure.equipmentsAndServices.includes('ordinateurs') ? structure.nbComputers : 0, + [Validators.required, Validators.pattern(CustomRegExp.NO_NEGATIVE_NUMBER), Validators.min(0)] + ), + nbPrinters: new FormControl(structure.equipmentsAndServices.includes('imprimantes') ? structure.nbPrinters : 0, [ + Validators.required, + Validators.pattern(CustomRegExp.NO_NEGATIVE_NUMBER), + Validators.min(0), + ]), + nbTablets: new FormControl(structure.equipmentsAndServices.includes('tablettes') ? structure.nbTablets : 0, [ + Validators.required, + Validators.pattern(CustomRegExp.NO_NEGATIVE_NUMBER), + Validators.min(0), + ]), + nbNumericTerminal: new FormControl( + structure.equipmentsAndServices.includes('bornesNumeriques') ? structure.nbNumericTerminal : 0, + [Validators.required, Validators.pattern(CustomRegExp.NO_NEGATIVE_NUMBER), Validators.min(0)] + ), + nbScanners: new FormControl(structure.equipmentsAndServices.includes('scanners') ? structure.nbScanners : 0, [ + Validators.required, + Validators.pattern(CustomRegExp.NO_NEGATIVE_NUMBER), + Validators.min(0), + ]), + freeWorkShop: new FormControl(structure.freeWorkShop, [Validators.required]), + dataShareConsentDate: new FormControl(structure.dataShareConsentDate), + personalOffers: new FormControl(structure.personalOffers), + }); + } + + public loadArrayForCheckbox(array: string[], isRequired: boolean): FormArray { + return new FormArray( + array.map((str) => new FormControl(str)), + isRequired ? Validators.required : Validators.nullValidator + ); + } + + public createDay(day: Day): FormGroup { + return new FormGroup({ + open: new FormControl(day.open, Validators.required), + time: new FormArray(day.time.map((oneTime) => this.createTime(oneTime))) as FormArray, + }); + } + public createTime(time: Time): FormGroup { + return new FormGroup({ + opening: new FormControl(time.opening), + closing: new FormControl(time.closing), + }); + } + public createHoursForm(structure: Structure): FormGroup { + return 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), + }); + } +} diff --git a/src/assets/ico/arrowBack.svg b/src/assets/ico/arrowBack.svg new file mode 100644 index 000000000..2fc7c8670 --- /dev/null +++ b/src/assets/ico/arrowBack.svg @@ -0,0 +1,4 @@ +<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M20 11L11 20L20 29" stroke="black" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/> +<line x1="12.5679" y1="20.0684" x2="29.8861" y2="20.0684" stroke="black" stroke-width="1.5" stroke-linecap="round"/> +</svg> diff --git a/src/assets/ico/sprite.svg b/src/assets/ico/sprite.svg index 7bc59a3ee..9e828aa8b 100644 --- a/src/assets/ico/sprite.svg +++ b/src/assets/ico/sprite.svg @@ -428,4 +428,9 @@ <path d="M28.0279 27.0279C28.5486 27.5486 28.6541 28.2873 28.2636 28.6778C27.8731 29.0683 27.1344 28.9628 26.6137 28.4421L11.5287 13.3572C11.008 12.8365 10.9025 12.0978 11.293 11.7072C11.6836 11.3167 12.4223 11.4222 12.943 11.9429L28.0279 27.0279Z" fill="#333333"/> </symbol> +<symbol id="arrowBack" width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M20 11L11 20L20 29" stroke="black" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/> +<line x1="12.5679" y1="20.0684" x2="29.8861" y2="20.0684" stroke="black" stroke-width="1.5" stroke-linecap="round"/> +</symbol> + </svg> -- GitLab From 0848f0a8c970297d66319f84db78e8468e203d1e Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Tue, 17 May 2022 17:43:50 +0200 Subject: [PATCH 02/11] add new screen + change step order --- .../footer-form/footer-form.component.html | 6 ++-- .../form/footer-form/footer-form.component.ts | 22 +++++++++--- src/app/form/form-view/form-view.component.ts | 10 +++++- .../information-step.component.html | 18 +++++++++- .../structure-access-modality.component.html | 3 +- .../structure-access-modality.component.ts | 1 + .../structure-form.component.html | 36 +++++++++++++------ .../structure-form.component.ts | 6 ++-- .../structure-wifi.component.ts | 2 +- .../structure-form/structureFormStep.enum.ts | 4 ++- 10 files changed, 84 insertions(+), 24 deletions(-) diff --git a/src/app/form/footer-form/footer-form.component.html b/src/app/form/footer-form/footer-form.component.html index 1a2edbd93..65e7c93a3 100644 --- a/src/app/form/footer-form/footer-form.component.html +++ b/src/app/form/footer-form/footer-form.component.html @@ -16,12 +16,14 @@ [iconBtn]="!isEditMode && 'chevronLeft'" ></app-button> - <app-button + <!-- + This button should no be here, for lastform step, it is inside the whit placeholder + <app-button *ngIf="isLastFormStep && !isEditMode" (action)="goToHome()" [text]="'Ok'" [style]="buttonTypeEnum.Primary" - ></app-button> + ></app-button> --> <app-button *ngIf="!isLastFormStep && !isNextFormTransition && !isEditMode" diff --git a/src/app/form/footer-form/footer-form.component.ts b/src/app/form/footer-form/footer-form.component.ts index 3f42f90cc..275aec8c2 100644 --- a/src/app/form/footer-form/footer-form.component.ts +++ b/src/app/form/footer-form/footer-form.component.ts @@ -5,7 +5,6 @@ import { User } from '../../models/user.model'; import { ProfileService } from '../../profile/services/profile.service'; import { AuthService } from '../../services/auth.service'; import { NewsletterService } from '../../services/newsletter.service'; -import { StructureService } from '../../services/structure.service'; import { ButtonType } from '../../shared/components/button/buttonType.enum'; import { Utils } from '../../utils/utils'; import { accountFormStep } from '../form-view/account-form/accountFormStep.enum'; @@ -47,7 +46,6 @@ export class FooterFormComponent implements OnChanges { private authService: AuthService, public utils: Utils, private router: Router, - private structureService: StructureService, private profileService: ProfileService, private newsletterService: NewsletterService ) {} @@ -73,6 +71,13 @@ export class FooterFormComponent implements OnChanges { this.isLastFormStep = true; } } + if ( + this.currentForm === formType.structure && + (this.currentStep === structureFormStep.noStructure || + this.currentStep === structureFormStep.StructureInfoUnknown) + ) { + this.isLastFormStep = true; + } } } @@ -119,7 +124,14 @@ export class FooterFormComponent implements OnChanges { if (this.currentStep === structureFormStep.structureChoiceCompletion) { const chooseCompleteStructInfo = this.form.get('choiceCompletion').value; if (!chooseCompleteStructInfo) { - this.changeCurrentStep.emit(structureFormStep.structureContactCompletion); + this.changeCurrentStep.emit(structureFormStep.StructureInfoUnknown); + return; + } + } + if (this.currentStep === structureFormStep.structureAccompanimentChoice) { + const hasPlaceOfReception = this.form.get('placeOfReception').value; + if (!hasPlaceOfReception) { + this.changeCurrentStep.emit(structureFormStep.noStructure); return; } } @@ -162,7 +174,9 @@ export class FooterFormComponent implements OnChanges { return ( this.currentForm === formType.structure && (this.currentStep === structureFormStep.mailSentInfo || - this.currentStep === structureFormStep.structureCreationFinishedInfo) + this.currentStep === structureFormStep.structureCreationFinishedInfo || + this.currentStep === structureFormStep.noStructure || + this.currentStep === structureFormStep.StructureInfoUnknown) ); } diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts index e7afc577a..dd7fa53e8 100644 --- a/src/app/form/form-view/form-view.component.ts +++ b/src/app/form/form-view/form-view.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, SimpleChanges } from '@angular/core'; import { FormGroup, FormControl, Validators, FormArray } from '@angular/forms'; import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; import { forkJoin, of } from 'rxjs'; @@ -275,6 +275,13 @@ export class FormViewComponent implements OnInit { if (type.formStep === structureFormStep.structureCreationFinishedInfo) { this.saveStructureForm(); } + if (type.formStep === structureFormStep.noStructure) { + this.router.navigateByUrl('/account'); + } + if (type.formStep === structureFormStep.StructureInfoUnknown) { + //Creation de coquille vide ?? + this.router.navigateByUrl('/account'); + } break; case formType.personaloffer: this.savePersonalOfferForm(); @@ -324,6 +331,7 @@ export class FormViewComponent implements OnInit { }); } public setCurrentStep(step: accountFormStep | profileFormStep | structureFormStep | personalOfferFormStep): void { + //THIS PROBABLY CREATES CONSOLE ERRORS this.currentPage = step; } public async saveEditedStructure() { diff --git a/src/app/form/form-view/global-components/information-step/information-step.component.html b/src/app/form/form-view/global-components/information-step/information-step.component.html index c69aa917d..0d85ba9b4 100644 --- a/src/app/form/form-view/global-components/information-step/information-step.component.html +++ b/src/app/form/form-view/global-components/information-step/information-step.component.html @@ -65,8 +65,24 @@ </p> </div> </ng-container> +<ng-container *ngIf="formType === formTypeEnum.structure && step === structureFormStepEnum.noStructure"> + <div class="information-step-container profile-updated no-max-width"> + <p>Votre structure ne disposant ni d’accompagnement, ni de formation, elle n’apparaitra pas sur Rés’in</p> + <h3>Votre profil a bien été mis à jour.</h3> + <svg aria-hidden="true"> + <use [attr.xlink:href]="'assets/form/sprite.svg#profileUpdated'"></use> + </svg> + <div class="btn"> + <app-button [style]="buttonTypeEnum.Primary" [text]="'Voir mon compte'" [iconType]="'form'" (action)="nextPage()"> + </app-button> + </div> + </div> +</ng-container> <ng-container - *ngIf="formType === formTypeEnum.personaloffer && step === personalOfferFormStep.personalOfferFinishedInfo" + *ngIf=" + (formType === formTypeEnum.personaloffer && step === personalOfferFormStep.personalOfferFinishedInfo) || + (formType === formTypeEnum.structure && step === structureFormStepEnum.StructureInfoUnknown) + " > <div class="information-step-container profile-updated no-max-width"> <h3>Merci, les informations de votre profil ont été mises à jour</h3> diff --git a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.html b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.html index 91fc6fcf8..196c87503 100644 --- a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.html +++ b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.html @@ -1,4 +1,5 @@ -<form [formGroup]="structureForm" *ngIf="structureForm" (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null"> +<form [formGroup]="structureForm" *ngIf="structureForm"> + <!-- <app-svg-icon *ngIf="isEditMode" [iconClass]="'backArrow'" [type]="'ico'" [icon]="'arrowBack'"></app-svg-icon> --> <div class="title"> <h3>Quelles sont les modalités d'accueil de la structure ?</h3> <p>Plusieurs choix possibles</p> diff --git a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts index 217afb1e3..91836cb35 100644 --- a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts +++ b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts @@ -9,6 +9,7 @@ import { Category } from '../../../../structure-list/models/category.model'; export class StructureAccessModalityComponent implements OnInit { @Input() structureForm: FormGroup; @Input() accessModality: Category; + @Input() isEditMode: boolean; @Output() checkChange = new EventEmitter<any>(); @Output() validateForm = new EventEmitter<any>(); diff --git a/src/app/form/form-view/structure-form/structure-form.component.html b/src/app/form/form-view/structure-form/structure-form.component.html index ddbb3f322..660bc729b 100644 --- a/src/app/form/form-view/structure-form/structure-form.component.html +++ b/src/app/form/form-view/structure-form/structure-form.component.html @@ -1,22 +1,23 @@ <div class="no-max-width"> <ng-container *ngIf="currentStep === structureFormStep.structureChoice"> <app-profile-structure-choice + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm()" (createStructure)="goToCreateStructure($event)" ></app-profile-structure-choice> </ng-container> - <ng-container *ngIf="currentStep === structureFormStep.structureFormTime" class="no-max-width"> - <app-information-step - [step]="structureFormStep.structureFormTime" - [structureName]="structureForm.value.structureName" - (goNext)="setValidationsForm()" - [formType]="formTypeEnum.structure" - ></app-information-step> - </ng-container> - <ng-container *ngIf="currentStep === structureFormStep.mailSentInfo"> + <ng-container + *ngIf=" + currentStep === structureFormStep.structureFormTime || + currentStep === structureFormStep.mailSentInfo || + currentStep === structureFormStep.noStructure || + currentStep === structureFormStep.StructureInfoUnknown + " + class="no-max-width" + > <app-information-step - [step]="structureFormStep.mailSentInfo" + [step]="currentStep" [structureName]="structureForm.value.structureName" (goNext)="setValidationsForm()" [formType]="formTypeEnum.structure" @@ -24,6 +25,7 @@ </ng-container> <div *ngIf="currentStep == structureFormStep.structureNameAndAddress"> <app-structure-name-and-address + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm()" (addressStructure)="setAddressStructure($event)" @@ -31,12 +33,14 @@ </div> <div *ngIf="currentStep == structureFormStep.structureContact"> <app-structure-contact + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm()" ></app-structure-contact> </div> <div *ngIf="currentStep == structureFormStep.structureAccompanimentChoice"> <app-structure-accompaniment-choice + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm()" (radioChange)="onRadioChange($event)" @@ -44,6 +48,7 @@ </div> <div *ngIf="currentStep == structureFormStep.structureChoiceCompletion"> <app-structure-choice-completion + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm()" (radioChange)="onRadioChange($event)" @@ -51,12 +56,14 @@ </div> <div *ngIf="currentStep == structureFormStep.structureContactCompletion"> <app-structure-contact-completion + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm()" ></app-structure-contact-completion> </div> <div *ngIf="currentStep == structureFormStep.structureType"> <app-structure-type + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm()" (typeStructure)="setTypeStructure($event)" @@ -64,6 +71,7 @@ </div> <div *ngIf="currentStep == structureFormStep.structureAccessModality"> <app-structure-access-modality + [isEditMode]="isEditMode" [structureForm]="structureForm" [accessModality]="accessModality" (validateForm)="setValidationsForm()" @@ -72,6 +80,7 @@ </div> <div *ngIf="currentStep == structureFormStep.structureHours"> <app-structure-hours + [isEditMode]="isEditMode" [structureForm]="structureForm" [hoursForm]="hoursForm" (validateForm)="setValidationsForm()" @@ -84,6 +93,7 @@ </div> <div *ngIf="currentStep == structureFormStep.structureWebAndSocialNetwork"> <app-structure-web-and-social-network + [isEditMode]="isEditMode" [structureForm]="structureForm" [showWebsite]="showWebsite" [showSocialNetwork]="showSocialNetwork" @@ -95,6 +105,7 @@ </div> <div *ngIf="currentStep == structureFormStep.structurePublicTarget"> <app-structure-public-target + [isEditMode]="isEditMode" [structureForm]="structureForm" [publics]="publics" (validateForm)="setValidationsForm()" @@ -104,12 +115,14 @@ </div> <div *ngIf="currentStep == structureFormStep.structureTrainingType"> <app-structure-training-type + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm()" ></app-structure-training-type> </div> <div *ngIf="currentStep == structureFormStep.structureTrainingPrice"> <app-structure-training-price + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm()" (radioChange)="onRadioChange($event)" @@ -152,6 +165,7 @@ </div> <div *ngIf="currentStep == structureFormStep.structureDigitalHelpingAccompaniment"> <app-structure-digital-helping-accompaniment + [isEditMode]="isEditMode" [structureForm]="structureForm" [proceduresAccompaniment]="proceduresAccompaniment" (validateForm)="setValidationsForm($event)" @@ -160,6 +174,7 @@ </div> <div *ngIf="currentStep == structureFormStep.structureDescription"> <app-structure-description + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm($event)" [isEditMode]="isEditMode" @@ -167,6 +182,7 @@ </div> <div *ngIf="currentStep == structureFormStep.structureCovidInfo"> <app-structure-covid-info + [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm($event)" [isEditMode]="isEditMode" diff --git a/src/app/form/form-view/structure-form/structure-form.component.ts b/src/app/form/form-view/structure-form/structure-form.component.ts index 7f5df0770..37b1a9522 100644 --- a/src/app/form/form-view/structure-form/structure-form.component.ts +++ b/src/app/form/form-view/structure-form/structure-form.component.ts @@ -1,5 +1,5 @@ -import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; -import { AbstractControl, FormArray, FormControl, FormGroup, Validators } from '@angular/forms'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; +import { AbstractControl, FormArray, FormControl, FormGroup } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { Address } from '../../../models/address.model'; import { User } from '../../../models/user.model'; @@ -15,7 +15,7 @@ import { structureFormStep } from './structureFormStep.enum'; selector: 'app-structure-form', templateUrl: './structure-form.component.html', }) -export class StructureFormComponent implements OnChanges { +export class StructureFormComponent implements OnChanges, OnInit { @Input() nbSteps: number; @Input() currentStep: structureFormStep; @Input() structureForm: FormGroup; diff --git a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts index 8eec80606..6e51c0162 100644 --- a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts +++ b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts @@ -12,7 +12,7 @@ export class StructureWifiComponent implements OnInit { @Output() checkChange = new EventEmitter<any>(); ngOnInit(): void { - this.validateForm.emit(); + if (this.isEditMode) this.validateForm.emit(); } public isInArray(formControlName: string, term: string) { if (this.structureForm.controls[formControlName].value) { diff --git a/src/app/form/form-view/structure-form/structureFormStep.enum.ts b/src/app/form/form-view/structure-form/structureFormStep.enum.ts index 288acebeb..3fdc5d4e1 100644 --- a/src/app/form/form-view/structure-form/structureFormStep.enum.ts +++ b/src/app/form/form-view/structure-form/structureFormStep.enum.ts @@ -1,8 +1,8 @@ export enum structureFormStep { structureChoice, + structureAccompanimentChoice, structureNameAndAddress, structureContact, - structureAccompanimentChoice, structureChoiceCompletion, structureFormTime, structureContactCompletion, @@ -24,4 +24,6 @@ export enum structureFormStep { structureConsent, structureCreationFinishedInfo, mailSentInfo, + noStructure, + StructureInfoUnknown, } -- GitLab From 365f0558b32a9e19d3009dea0869a55179e73731 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Wed, 18 May 2022 11:32:10 +0200 Subject: [PATCH 03/11] feat(editMode): auto toggle items in edit mode + add goback arrow --- .../form/form-view/form-view.component.scss | 14 ++++++++++- .../structure-access-modality.component.html | 16 +++++++++---- .../structure-access-modality.component.ts | 3 +++ ...tructure-accompaniment-choice.component.ts | 4 ++++ .../structure-choice-completion.component.ts | 4 ++++ .../structure-consent.component.html | 23 +++++++++++++------ .../structure-consent.component.ts | 3 +++ ...tructure-contact-completion.component.html | 16 +++++++++---- .../structure-contact-completion.component.ts | 3 +++ .../structure-contact.component.html | 13 +++++++++-- .../structure-contact.component.ts | 4 ++++ .../structure-covid-info.component.html | 15 +++++++++--- .../structure-covid-info.component.ts | 3 +++ .../structure-description.component.html | 15 +++++++++--- .../structure-description.component.ts | 3 +++ ...gital-helping-accompaniment.component.html | 16 +++++++++---- ...digital-helping-accompaniment.component.ts | 4 ++++ .../structure-equipments.component.html | 15 +++++++++--- .../structure-equipments.component.ts | 3 +++ .../structure-form.component.html | 7 ++++-- .../structure-hours.component.html | 15 +++++++++--- .../structure-hours.component.ts | 4 ++++ .../structure-labels.component.html | 15 +++++++++--- .../structure-labels.component.ts | 3 +++ .../structure-name-and-address.component.html | 21 +++++++++-------- .../structure-name-and-address.component.ts | 4 ++++ .../structure-other-services.component.html | 15 +++++++++--- .../structure-other-services.component.ts | 3 +++ .../structure-pmr.component.html | 13 +++++++++-- .../structure-pmr/structure-pmr.component.ts | 3 +++ .../structure-public-target.component.html | 15 +++++++++--- .../structure-public-target.component.ts | 4 ++++ .../structure-training-price.component.html | 13 +++++++++-- .../structure-training-price.component.ts | 4 ++++ .../structure-training-type.component.html | 15 +++++++++--- .../structure-training-type.component.ts | 4 ++++ .../structure-type.component.html | 16 ++++++++++--- .../structure-type.component.ts | 5 +++- ...ture-web-and-social-network.component.html | 15 +++++++++--- ...ucture-web-and-social-network.component.ts | 8 +++++++ .../structure-wifi.component.html | 13 +++++++++-- .../structure-wifi.component.ts | 3 +++ .../structure-type-picker.component.ts | 4 ++++ 43 files changed, 328 insertions(+), 71 deletions(-) diff --git a/src/app/form/form-view/form-view.component.scss b/src/app/form/form-view/form-view.component.scss index 301de21b4..d6c7296a6 100644 --- a/src/app/form/form-view/form-view.component.scss +++ b/src/app/form/form-view/form-view.component.scss @@ -16,7 +16,7 @@ border: 1px solid $grey-6; padding: 32px 48px; * { - max-width: 600px; + max-width: 700px; } .no-max-width { max-width: none; @@ -30,6 +30,7 @@ color: $grey-3; margin-bottom: 3px; } + h3 { @include lato-bold-24; margin: 0; @@ -43,6 +44,17 @@ font-style: italic; margin-top: 4px; } + .backArrow { + cursor: pointer; + } + &.editTitle { + display: flex; + align-items: center; + + p { + margin-bottom: 0; + } + } } ::ng-deep.textareaBlock { diff --git a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.html b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.html index 196c87503..fa182c437 100644 --- a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.html +++ b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.html @@ -1,8 +1,16 @@ <form [formGroup]="structureForm" *ngIf="structureForm"> - <!-- <app-svg-icon *ngIf="isEditMode" [iconClass]="'backArrow'" [type]="'ico'" [icon]="'arrowBack'"></app-svg-icon> --> - <div class="title"> - <h3>Quelles sont les modalités d'accueil de la structure ?</h3> - <p>Plusieurs choix possibles</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quelles sont les modalités d'accueil de la structure ?</h3> + <p>Plusieurs choix possibles</p> + </div> </div> <p class="missing-information" *ngIf="isEditMode && !structureForm.get('accessModality').valid"> <app-svg-icon [iconClass]="'icon-26'" [type]="'form'" [icon]="'notValidate'" class="validationIcon"></app-svg-icon> diff --git a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts index 91836cb35..894d00dc9 100644 --- a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts +++ b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts @@ -31,4 +31,7 @@ export class StructureAccessModalityComponent implements OnInit { } return false; } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-accompaniment-choice/structure-accompaniment-choice.component.ts b/src/app/form/form-view/structure-form/structure-accompaniment-choice/structure-accompaniment-choice.component.ts index 1ba18bc45..34cf9ca41 100644 --- a/src/app/form/form-view/structure-form/structure-accompaniment-choice/structure-accompaniment-choice.component.ts +++ b/src/app/form/form-view/structure-form/structure-accompaniment-choice/structure-accompaniment-choice.component.ts @@ -7,6 +7,7 @@ import { FormGroup } from '@angular/forms'; }) export class StructureAccompanimentChoiceComponent implements OnInit { @Input() structureForm: FormGroup; + @Input() isEditMode: boolean; @Output() radioChange = new EventEmitter<any>(); @Output() validateForm = new EventEmitter<any>(); @@ -17,4 +18,7 @@ export class StructureAccompanimentChoiceComponent implements OnInit { public onRadioChange(name: string, value: boolean): void { this.radioChange.emit({ name, value }); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-choice-completion/structure-choice-completion.component.ts b/src/app/form/form-view/structure-form/structure-choice-completion/structure-choice-completion.component.ts index 16eead91a..e6b277c4e 100644 --- a/src/app/form/form-view/structure-form/structure-choice-completion/structure-choice-completion.component.ts +++ b/src/app/form/form-view/structure-form/structure-choice-completion/structure-choice-completion.component.ts @@ -7,6 +7,7 @@ import { FormGroup } from '@angular/forms'; }) export class StructureChoiceCompletionComponent { @Input() structureForm: FormGroup; + @Input() isEditMode: boolean; @Output() radioChange = new EventEmitter<any>(); @Output() validateForm = new EventEmitter<any>(); @@ -17,4 +18,7 @@ export class StructureChoiceCompletionComponent { public onRadioChange(name: string, value: boolean): void { this.radioChange.emit({ name, value }); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.html b/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.html index dfb039c3b..9fd0ecbab 100644 --- a/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.html +++ b/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.html @@ -12,13 +12,22 @@ </app-checkbox-form> </div> <div class="section"> - <div class="title"> - <h3> - Acceptez-vous que les informations de votre structure soient mises à disposition sur la plateforme - data.grandlyon.com<span class="asterisk" *ngIf="!isEditMode">**</span - ><span class="asterisk" *ngIf="isEditMode">*</span> ? - </h3> - <p class="notRequired" *ngIf="!isEditMode">Facultatif</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3> + Acceptez-vous que les informations de votre structure soient mises à disposition sur la plateforme + data.grandlyon.com<span class="asterisk" *ngIf="!isEditMode">**</span + ><span class="asterisk" *ngIf="isEditMode">*</span> ? + </h3> + <p class="notRequired" *ngIf="!isEditMode">Facultatif</p> + </div> </div> <app-checkbox-form *ngIf="!isEditMode" diff --git a/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts b/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts index 4e4b39549..545e4ac7e 100644 --- a/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts +++ b/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts @@ -19,4 +19,7 @@ export class StructureConsentComponent { public acceptOpenData(event: boolean): void { this.onAcceptOpenData.emit(event); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.html b/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.html index 7cde49d81..1d026ec7f 100644 --- a/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.html +++ b/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.html @@ -1,9 +1,17 @@ <form [formGroup]="structureForm" *ngIf="structureForm" (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null"> - <div class="title"> - <h3>Quelle personne pourrait connaître ces informations ?</h3> - <p>Informations demandées : téléphone, email, accessibilité PMR, type de public...</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quelle personne pourrait connaître ces informations ?</h3> + <p>Informations demandées : téléphone, email, accessibilité PMR, type de public...</p> + </div> </div> - <div class="form-group" fxLayout="column"> <label for="contactPersonFirstname">Prénom</label> <div fxLayout="row" fxLayoutGap="13px"> diff --git a/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.ts b/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.ts index de25c3330..0c8fd6d02 100644 --- a/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.ts +++ b/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.ts @@ -17,4 +17,7 @@ export class StructureContactCompletionComponent implements OnInit { public setValidationsForm(): void { this.validateForm.emit(); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.html b/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.html index 30dbd27de..41a2fc780 100644 --- a/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.html +++ b/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.html @@ -1,6 +1,15 @@ <form [formGroup]="structureForm" *ngIf="structureForm" (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null"> - <div class="title"> - <h3>Comment joindre votre structure ?</h3> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Comment joindre votre structure ?</h3> + </div> </div> <p class="missing-information" diff --git a/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts b/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts index 441560ad0..0a4a26269 100644 --- a/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts +++ b/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts @@ -8,6 +8,7 @@ import { Utils } from '../../../../utils/utils'; }) export class StructureContactComponent implements OnInit { @Input() structureForm: FormGroup; + @Input() isEditMode: boolean; @Output() validateForm = new EventEmitter<any>(); constructor(public utils: Utils) {} @@ -19,4 +20,7 @@ export class StructureContactComponent implements OnInit { public setValidationsForm(): void { this.validateForm.emit(); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.html b/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.html index 6aaebaf99..aaf7f91da 100644 --- a/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.html +++ b/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.html @@ -1,7 +1,16 @@ <form [formGroup]="structureForm" (keyup.enter)="(!isEditMode ? '' : null)"> - <div class="title"> - <h3>Y a-t-il des informations spécifiques à la période COVID ?</h3> - <p class="notRequired">Facultatif</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Y a-t-il des informations spécifiques à la période COVID ?</h3> + <p class="notRequired">Facultatif</p> + </div> </div> <div class="textareaBlock" fxLayout="column"> <textarea diff --git a/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.ts b/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.ts index 31987b257..d7f06a5bc 100644 --- a/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.ts +++ b/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.ts @@ -13,4 +13,7 @@ export class StructureCovidInfoComponent { public getStructureControl(nameControl: string): AbstractControl { return this.structureForm.get(nameControl); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-description/structure-description.component.html b/src/app/form/form-view/structure-form/structure-description/structure-description.component.html index a00e1aca5..88b371d39 100644 --- a/src/app/form/form-view/structure-form/structure-description/structure-description.component.html +++ b/src/app/form/form-view/structure-form/structure-description/structure-description.component.html @@ -1,7 +1,16 @@ <form [formGroup]="structureForm" (keyup.enter)="(!isEditMode ? '' : null)"> - <div class="title"> - <h3>Pouvez-vous présenter la structure en quelques mots ?</h3> - <p class="notRequired">Facultatif</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Pouvez-vous présenter la structure en quelques mots ?</h3> + <p class="notRequired">Facultatif</p> + </div> </div> <div class="textareaBlock introduceStructure" fxLayout="column"> <textarea diff --git a/src/app/form/form-view/structure-form/structure-description/structure-description.component.ts b/src/app/form/form-view/structure-form/structure-description/structure-description.component.ts index 433532060..65b7a0cec 100644 --- a/src/app/form/form-view/structure-form/structure-description/structure-description.component.ts +++ b/src/app/form/form-view/structure-form/structure-description/structure-description.component.ts @@ -18,4 +18,7 @@ export class StructureDescriptionComponent implements OnInit { public getStructureControl(nameControl: string): AbstractControl { return this.structureForm.get(nameControl); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.html b/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.html index e7acb5f90..780d45093 100644 --- a/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.html +++ b/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.html @@ -1,9 +1,17 @@ <form [formGroup]="structureForm" *ngIf="structureForm" (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null"> - <div class="title"> - <h3>Quelles aides au numérique propose la structure ?</h3> - <p>Facultatif</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quelles aides au numérique propose la structure ?</h3> + <p>Facultatif</p> + </div> </div> - <div class="btn-grid"> <span *ngFor="let accompaniment of proceduresAccompaniment.modules"> <app-button diff --git a/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts b/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts index df8e7c18a..2cf256159 100644 --- a/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts +++ b/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts @@ -10,6 +10,7 @@ import { Category } from '../../../../structure-list/models/category.model'; export class StructureDigitalHelpingAccompanimentComponent implements OnInit { @Input() structureForm: FormGroup; @Input() proceduresAccompaniment: Category; + @Input() isEditMode: boolean; @Output() updateChoice = new EventEmitter<any>(); @Output() validateForm = new EventEmitter<any>(); @@ -31,4 +32,7 @@ export class StructureDigitalHelpingAccompanimentComponent implements OnInit { return true; return false; } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.html b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.html index dc9c33939..32c91a097 100644 --- a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.html +++ b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.html @@ -1,7 +1,16 @@ <form [formGroup]="structureForm" (keyup.enter)="(!isEditMode ? '' : null)"> - <div class="title"> - <h3>Quel matériel est mis à disposition par la structure ?</h3> - <p class="notRequired">Facultatif</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quel matériel est mis à disposition par la structure ?</h3> + <p class="notRequired">Facultatif</p> + </div> </div> <ng-container *ngFor="let equipment of equipmentsAndServices"> <div diff --git a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts index 7951a4504..a3316ca1c 100644 --- a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts +++ b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts @@ -48,4 +48,7 @@ export class StructureEquipmentsComponent implements OnInit { if (this.vowels.includes(equipment.toLocaleLowerCase()[0])) return `d'${equipment.toLocaleLowerCase()}`; return `de ${equipment.toLocaleLowerCase()}`; } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-form.component.html b/src/app/form/form-view/structure-form/structure-form.component.html index 660bc729b..a8febd148 100644 --- a/src/app/form/form-view/structure-form/structure-form.component.html +++ b/src/app/form/form-view/structure-form/structure-form.component.html @@ -89,7 +89,11 @@ ></app-structure-hours> </div> <div *ngIf="currentStep == structureFormStep.structurePmr"> - <app-structure-pmr [structureForm]="structureForm" (radioChange)="onRadioChange($event)"></app-structure-pmr> + <app-structure-pmr + [isEditMode]="isEditMode" + [structureForm]="structureForm" + (radioChange)="onRadioChange($event)" + ></app-structure-pmr> </div> <div *ngIf="currentStep == structureFormStep.structureWebAndSocialNetwork"> <app-structure-web-and-social-network @@ -185,7 +189,6 @@ [isEditMode]="isEditMode" [structureForm]="structureForm" (validateForm)="setValidationsForm($event)" - [isEditMode]="isEditMode" ></app-structure-covid-info> </div> <div *ngIf="currentStep == structureFormStep.structureConsent"> diff --git a/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.html b/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.html index 7cadbf5f9..40cccf9a6 100644 --- a/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.html +++ b/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.html @@ -1,7 +1,16 @@ <form [formGroup]="structureForm"> - <div class="title"> - <h3>Quels sont les horaires d'ouverture de la structure ?</h3> - <p class="notRequired">Facultatif</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quels sont les horaires d'ouverture de la structure ?</h3> + <p class="notRequired">Facultatif</p> + </div> </div> <app-hour-picker *ngIf="hoursForm" diff --git a/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts b/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts index 53e9ffb31..cf2a0f488 100644 --- a/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts +++ b/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts @@ -9,6 +9,7 @@ import { FormGroup } from '@angular/forms'; export class StructureHoursComponent implements OnInit { @Input() structureForm: FormGroup; @Input() hoursForm: FormGroup; + @Input() isEditMode: boolean; @Output() hours = new EventEmitter<any>(); @Output() hoursError = new EventEmitter<any>(); @Output() validateForm = new EventEmitter<any>(); @@ -23,4 +24,7 @@ export class StructureHoursComponent implements OnInit { public setHoursError() { this.hoursError.emit(); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.html b/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.html index 2531d13be..47f65e87f 100644 --- a/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.html +++ b/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.html @@ -1,7 +1,16 @@ <form [formGroup]="structureForm" class="labelStep" (keyup.enter)="(!isEditMode ? '' : null)"> - <div class="title"> - <h3>La structure est-elle labellisée ?</h3> - <p class="notRequired">Facultatif</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>La structure est-elle labellisée ?</h3> + <p class="notRequired">Facultatif</p> + </div> </div> <div class="labelsQualifications" *ngIf="labelsQualifications" fxLayout="row wrap" fxLayoutAlign="flex-start"> <app-checkbox-form diff --git a/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts b/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts index fe7918d9d..fb70effee 100644 --- a/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts +++ b/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts @@ -32,4 +32,7 @@ export class StructureLabelsComponent implements OnInit { value: modality, }); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.html b/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.html index 3b6b91a29..33f2de2f3 100644 --- a/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.html +++ b/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.html @@ -1,15 +1,16 @@ <form [formGroup]="structureForm" *ngIf="structureForm" (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null"> - <div class="title"> - <h3>Quelle structure voulez-vous référencer ?</h3> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quelle structure voulez-vous référencer ?</h3> + </div> </div> - <!-- TODO : keep edit ? --> - <!-- <p - class="missing-information" - *ngIf="isEditMode && (!getStructureControl('structureName').valid || !getStructureControl('address').valid)" -> - <app-svg-icon [iconClass]="'validation'" [type]="'form'" [icon]="'notValidate'" class="validationIcon"></app-svg-icon> - <span>Il faut renseigner tous les champs</span> -</p> --> <div class="form-group" fxLayout="column"> <label for="structureName">Nom de la structure</label> <div fxLayout="row" fxLayoutGap="13px"> diff --git a/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts b/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts index 54bc3cd65..b75b0ae38 100644 --- a/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts +++ b/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts @@ -10,6 +10,7 @@ import { Address } from '../../../../models/address.model'; }) export class StructureNameAndAddressComponent implements OnInit { @Input() structureForm: FormGroup; + @Input() isEditMode: boolean; @Output() validateForm = new EventEmitter<any>(); @Output() addressStructure = new EventEmitter<any>(); @@ -24,4 +25,7 @@ export class StructureNameAndAddressComponent implements OnInit { public setAddressStructure(address?: Address) { this.addressStructure.emit(address); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.html b/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.html index 9b805decf..3b4bc5aae 100644 --- a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.html +++ b/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.html @@ -1,7 +1,16 @@ <form [formGroup]="structureForm" (keyup.enter)="(!isEditMode ? '' : null)"> - <div class="title"> - <h3>Quels autres services sont proposés par la structure ?</h3> - <p class="notRequired">Facultatif</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quels autres services sont proposés par la structure ?</h3> + <p class="notRequired">Facultatif</p> + </div> </div> <div *ngIf="equipmentsAndServices" fxLayout="column wrap" fxLayoutAlign="flex-start" class="otherServices"> <ng-container *ngFor="let service of equipmentsAndServices"> diff --git a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts b/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts index 3834fdc11..0a400d1b9 100644 --- a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts +++ b/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts @@ -31,4 +31,7 @@ export class StructureOtherServicesComponent implements OnInit { value: modality, }); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.html b/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.html index e11b93fc8..76b215f8b 100644 --- a/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.html +++ b/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.html @@ -1,6 +1,15 @@ <form [formGroup]="structureForm" (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null"> - <div class="title"> - <h3>La structure est-elle accessible pour les personnes à mobilité réduite ?</h3> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>La structure est-elle accessible pour les personnes à mobilité réduite ?</h3> + </div> </div> <p class="missing-information" *ngIf="isEditMode && !structureForm.get('pmrAccess').valid"> <app-svg-icon [iconClass]="'icon-26'" [type]="'form'" [icon]="'notValidate'" class="validationIcon"></app-svg-icon> diff --git a/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.ts b/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.ts index 615282115..33b0ab2b3 100644 --- a/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.ts +++ b/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.ts @@ -20,4 +20,7 @@ export class StructurePmrComponent implements OnInit { public onRadioChange(name: string, value: boolean): void { this.radioChange.emit({ name, value }); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.html b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.html index 356631db6..4e2482ff8 100644 --- a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.html +++ b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.html @@ -1,7 +1,16 @@ <form [formGroup]="structureForm" *ngIf="structureForm" (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null"> - <div class="title"> - <h3>Quel public peut être accueilli dans cette structure ?</h3> - <p>Plusieurs choix possibles</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quel public peut être accueilli dans cette structure ?</h3> + <p>Plusieurs choix possibles</p> + </div> </div> <p class="missing-information" *ngIf="isEditMode && !structureForm.get('publics').valid"> <app-svg-icon [iconClass]="'icon-26'" [type]="'form'" [icon]="'notValidate'" class="validationIcon"></app-svg-icon> diff --git a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts index b9dd2f43a..36d082b0c 100644 --- a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts +++ b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts @@ -10,6 +10,7 @@ import { Category } from '../../../../structure-list/models/category.model'; export class StructurePublicTargetComponent implements OnInit { @Input() structureForm: FormGroup; @Input() publics: Category; + @Input() isEditMode: boolean; @Output() updateChoice = new EventEmitter<any>(); @Output() validateForm = new EventEmitter<any>(); @@ -27,4 +28,7 @@ export class StructurePublicTargetComponent implements OnInit { if (this.structureForm.get('publics') && this.structureForm.get('publics').value.includes(choice)) return true; return false; } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.html b/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.html index 8c075bd19..ee96a0686 100644 --- a/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.html +++ b/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.html @@ -1,6 +1,15 @@ <form [formGroup]="structureForm"> - <div class="title"> - <h3>Ces formations sont-elles gratuites ?</h3> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Ces formations sont-elles gratuites ?</h3> + </div> </div> <app-radio-form [selectedOption]="getStructureControl('freeWorkShop').value" diff --git a/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.ts b/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.ts index dcf22bdff..2f10412eb 100644 --- a/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.ts +++ b/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.ts @@ -7,6 +7,7 @@ import { AbstractControl, FormGroup } from '@angular/forms'; }) export class StructureTrainingPriceComponent implements OnInit { @Input() structureForm: FormGroup; + @Input() isEditMode: boolean; @Output() radioChange = new EventEmitter<any>(); @Output() validateForm = new EventEmitter<any>(); @@ -20,4 +21,7 @@ export class StructureTrainingPriceComponent implements OnInit { public onRadioChange(name: string, value: boolean): void { this.radioChange.emit({ name, value }); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.html b/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.html index 8f33ae8f3..c7007b058 100644 --- a/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.html +++ b/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.html @@ -1,7 +1,16 @@ <form [formGroup]="structureForm" *ngIf="structureForm"> - <div class="title"> - <h3>Quelles formations au numérique proposez-vous ?</h3> - <p class="notRequired">Facultatif</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quelles formations au numérique proposez-vous ?</h3> + <p class="notRequired">Facultatif</p> + </div> </div> <app-training-type-picker [baseSkills]="structureForm.get('baseSkills').value" diff --git a/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts b/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts index 8f58dc6c6..f47721b58 100644 --- a/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts +++ b/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts @@ -8,6 +8,7 @@ import { Category } from '../../../../structure-list/models/category.model'; }) export class StructureTrainingTypeComponent { @Input() structureForm: FormGroup; + @Input() isEditMode: boolean; @Output() validateForm = new EventEmitter<any>(); ngOnInit(): void { @@ -22,4 +23,7 @@ export class StructureTrainingTypeComponent { } } } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-type/structure-type.component.html b/src/app/form/form-view/structure-form/structure-type/structure-type.component.html index 631066a6b..0963d6d70 100644 --- a/src/app/form/form-view/structure-form/structure-type/structure-type.component.html +++ b/src/app/form/form-view/structure-form/structure-type/structure-type.component.html @@ -1,7 +1,16 @@ <form [formGroup]="structureForm" *ngIf="structureForm" (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null"> - <div class="title"> - <h3>Quel type de structure ?</h3> - <p>1 seul choix possible</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quel type de structure ?</h3> + <p>1 seul choix possible</p> + </div> </div> <p class="missing-information" *ngIf="isEditMode && !structureForm.get('structureType').valid"> <app-svg-icon [iconClass]="'icon-26'" [type]="'form'" [icon]="'notValidate'" class="validationIcon"></app-svg-icon> @@ -9,6 +18,7 @@ </p> <div class="type-picker"> <app-structure-type-picker + [isEditMode]="isEditMode" [pickedChoice]="structureForm.get('structureType').valid ? structureForm.get('structureType').value : null" (selectedType)="setTypeStructure($event)" ></app-structure-type-picker> diff --git a/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts b/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts index 46d4e63e6..7fe834300 100644 --- a/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts +++ b/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts @@ -7,7 +7,7 @@ import { FormGroup } from '@angular/forms'; }) export class StructureTypeComponent implements OnInit { @Input() structureForm: FormGroup; - @Input() isEditMode; + @Input() isEditMode: boolean; @Output() typeStructure = new EventEmitter<string>(); @Output() validateForm = new EventEmitter<any>(); @@ -18,4 +18,7 @@ export class StructureTypeComponent implements OnInit { public setTypeStructure(value) { this.typeStructure.emit(value); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.html b/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.html index a71fe34c3..c6187d89f 100644 --- a/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.html +++ b/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.html @@ -1,7 +1,16 @@ <form [formGroup]="structureForm" *ngIf="structureForm" (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null"> - <div class="title"> - <h3>Comment vous trouver la structure sur internet ?</h3> - <p class="notRequired">Facultatif</p> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Comment vous trouver la structure sur internet ?</h3> + <p class="notRequired">Facultatif</p> + </div> </div> <div class="collapse" [ngClass]="{ notCollapsed: !showWebsite }"> <div fxLayout="column"> diff --git a/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts b/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts index 430b62c8f..6dd632fb2 100644 --- a/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts +++ b/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts @@ -10,11 +10,16 @@ export class StructureWebAndSocialNetworkComponent implements OnInit { @Input() structureForm: FormGroup; @Input() showSocialNetwork: boolean; @Input() showWebsite: boolean; + @Input() isEditMode: boolean; @Output() toggleWebsite = new EventEmitter<any>(); @Output() toggleSocials = new EventEmitter<any>(); @Output() validateForm = new EventEmitter<any>(); ngOnInit(): void { + if (this.isEditMode) { + this.showSocialNetwork = true; + this.showWebsite = true; + } this.validateForm.emit(); } @@ -29,4 +34,7 @@ export class StructureWebAndSocialNetworkComponent implements OnInit { public setValidationsForm(): void { this.validateForm.emit(); } + public goBack() { + history.back(); + } } diff --git a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html index ee30fb378..8bb5df33d 100644 --- a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html +++ b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html @@ -1,6 +1,15 @@ <form [formGroup]="structureForm"> - <div class="title"> - <h3>Le wifi est-il proposé en accès libre ?</h3> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Le wifi est-il proposé en accès libre ?</h3> + </div> </div> <app-radio-form [selectedOption]="isEditMode ? isInArray('equipmentsAndServices', 'wifiEnAccesLibre') : null" diff --git a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts index 6e51c0162..a53ea42aa 100644 --- a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts +++ b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts @@ -23,4 +23,7 @@ export class StructureWifiComponent implements OnInit { public onCheckChange(event, catId: string, modId: string): void { this.checkChange.emit({ event, formControlName: catId, value: modId }); } + public goBack() { + history.back(); + } } 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 6013c6343..e40a915d6 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 @@ -20,6 +20,7 @@ export class StructureTypePickerComponent implements OnInit { public pickedType: string; public structureTypes: StructureType[]; @Input() public pickedChoice?: string; + @Input() public isEditMode?: boolean; @Output() selectedType: EventEmitter<string> = new EventEmitter<string>(); // Collapse var @@ -37,6 +38,9 @@ export class StructureTypePickerComponent implements OnInit { if (this.pickedChoice) { this.pickedType = this.getType(this.pickedChoice); } + if (this.isEditMode && this.pickedChoice) { + this.toggleCollapse(this.pickedType); + } }); } -- GitLab From d09fc72141bd4c4d66082aff30e0eb40b85baebd Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Wed, 18 May 2022 17:41:11 +0200 Subject: [PATCH 04/11] fix design info step + edit consent --- .../information-step.component.html | 6 ++++-- .../structure-consent.component.html | 7 +++---- .../structure-consent.component.ts | 5 +++++ .../structure-form/structure-form.component.ts | 15 ++++++--------- .../structure-type-picker.component.ts | 18 ------------------ 5 files changed, 18 insertions(+), 33 deletions(-) diff --git a/src/app/form/form-view/global-components/information-step/information-step.component.html b/src/app/form/form-view/global-components/information-step/information-step.component.html index 0d85ba9b4..ed108c903 100644 --- a/src/app/form/form-view/global-components/information-step/information-step.component.html +++ b/src/app/form/form-view/global-components/information-step/information-step.component.html @@ -67,11 +67,13 @@ </ng-container> <ng-container *ngIf="formType === formTypeEnum.structure && step === structureFormStepEnum.noStructure"> <div class="information-step-container profile-updated no-max-width"> - <p>Votre structure ne disposant ni d’accompagnement, ni de formation, elle n’apparaitra pas sur Rés’in</p> - <h3>Votre profil a bien été mis à jour.</h3> <svg aria-hidden="true"> <use [attr.xlink:href]="'assets/form/sprite.svg#profileUpdated'"></use> </svg> + <h3 style="text-align: center"> + Votre structure ne disposant ni d’accompagnement, ni de formation, elle n’apparaitra pas sur Rés’in. + </h3> + <p>Votre profil a bien été mis à jour.</p> <div class="btn"> <app-button [style]="buttonTypeEnum.Primary" [text]="'Voir mon compte'" [iconType]="'form'" (action)="nextPage()"> </app-button> diff --git a/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.html b/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.html index 9fd0ecbab..f0496ea7e 100644 --- a/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.html +++ b/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.html @@ -37,10 +37,9 @@ <div class="dataShareConsent"> <app-radio-form *ngIf="isEditMode" - name="{{ getStructureControl('structureName').value }}" - horizontal="true" - [selectedOption]="getStructureControl('dataShareConsentDate').value === null ? false : true" - (selectedEvent)="onRadioBtnChange('dataShareConsentDate', $event)" + horizontal="false" + [selectedOption]="structureForm.get('dataShareConsentDate').value ? true : false" + (selectedEvent)="onRadioChange($event)" > </app-radio-form> </div> diff --git a/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts b/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts index 545e4ac7e..8010f06b9 100644 --- a/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts +++ b/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts @@ -9,6 +9,7 @@ import { FormGroup } from '@angular/forms'; export class StructureConsentComponent { @Input() structureForm: FormGroup; @Input() isEditMode: boolean; + @Output() radioChange = new EventEmitter<any>(); @Output() onAcceptDataBeSaved = new EventEmitter<any>(); @Output() onAcceptOpenData = new EventEmitter<any>(); @@ -19,6 +20,10 @@ export class StructureConsentComponent { public acceptOpenData(event: boolean): void { this.onAcceptOpenData.emit(event); } + + public onRadioChange(value: boolean): void { + this.onAcceptOpenData.emit(value); + } public goBack() { history.back(); } diff --git a/src/app/form/form-view/structure-form/structure-form.component.ts b/src/app/form/form-view/structure-form/structure-form.component.ts index 37b1a9522..f4e58be22 100644 --- a/src/app/form/form-view/structure-form/structure-form.component.ts +++ b/src/app/form/form-view/structure-form/structure-form.component.ts @@ -70,7 +70,8 @@ export class StructureFormComponent implements OnChanges, OnInit { this.currentStep === structureFormStep.structureDescription || this.currentStep === structureFormStep.structureCovidInfo || this.currentStep === structureFormStep.mailSentInfo || - this.currentStep === structureFormStep.structureFormTime + this.currentStep === structureFormStep.structureFormTime || + (this.isEditMode && this.currentStep === structureFormStep.structureConsent) ) { this.pageValid.emit(); } @@ -217,14 +218,10 @@ export class StructureFormComponent implements OnChanges, OnInit { this.pagesValidation[structureFormStep.structureCovidInfo] = { valid: true, }; - if (this.isEditMode) { - this.pagesValidation[structureFormStep.structureConsent] = { - valid: this.structureForm.get('dataShareConsentDate').valid, - name: 'Partage de données sur data.grandlyon.com', - }; - } else { - this.pagesValidation[structureFormStep.structureConsent] = { valid: this.userAcceptSavedDate }; - } + + this.pagesValidation[structureFormStep.structureConsent] = { + valid: !this.isEditMode ? this.userAcceptSavedDate : true, + }; this.updatePageValid(); } 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 e40a915d6..f896a6258 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 @@ -48,34 +48,16 @@ export class StructureTypePickerComponent implements OnInit { this.showPublic = !this.showPublic; this.showPrivate = false; this.showPrivateLucrative = false; - if (!this.showPublic) { - // this.getStructureControl('website').reset(); - // remove to form - } - // this.setValidationsForm(); - // add to form } public togglePrivate(): void { this.showPrivate = !this.showPrivate; this.showPrivateLucrative = false; this.showPublic = false; - if (!this.showPublic) { - // this.getStructureControl('website').reset(); - // remove to form - } - // this.setValidationsForm(); - // add to form } public togglePrivateLucrative(): void { this.showPrivateLucrative = !this.showPrivateLucrative; this.showPrivate = false; this.showPublic = false; - if (!this.showPublic) { - // this.getStructureControl('website').reset(); - // remove to form - } - // this.setValidationsForm(); - // add to form } public getType(nameChoice: string): string { -- GitLab From 3912289eede98deb925879c44d29e42f17abac27 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Thu, 19 May 2022 15:57:50 +0200 Subject: [PATCH 05/11] fix unknown aptic mail --- src/app/form/form-view/form-view.component.scss | 8 ++++++++ .../structure-edition-summary.component.ts | 8 +++----- src/app/utils/formUtils.ts | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/form/form-view/form-view.component.scss b/src/app/form/form-view/form-view.component.scss index d6c7296a6..b36bce4c4 100644 --- a/src/app/form/form-view/form-view.component.scss +++ b/src/app/form/form-view/form-view.component.scss @@ -21,6 +21,14 @@ .no-max-width { max-width: none; } + .missing-information { + display: flex; + color: $orange-warning; + align-items: center; + span { + margin-left: 1rem; + } + } } ::ng-deep.title { diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts index 03f027ad2..a27b2ec1a 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts @@ -3,7 +3,6 @@ import { FormGroup } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { structureFormStep } from '../../form/form-view/structure-form/structureFormStep.enum'; import { Structure } from '../../models/structure.model'; -import { StructureService } from '../../services/structure.service'; import { formUtils, IStructureSummary } from '../../utils/formUtils'; @Component({ @@ -14,17 +13,16 @@ import { formUtils, IStructureSummary } from '../../utils/formUtils'; export class StructureEditionSummaryComponent implements OnInit { public structure: Structure; public structureForm: FormGroup; - constructor(private route: ActivatedRoute, private structureService: StructureService, private router: Router) {} + constructor(private route: ActivatedRoute, private router: Router) {} public summary: IStructureSummary[] = new formUtils().structureSummary; + // There is a non-blocking error in console when open edit mode that occurs only in development mode, please refer https://angular.io/errors/NG0100 for more info + ngOnInit(): void { this.route.data.subscribe((data) => { if (data.structure) { this.structure = new Structure(data.structure); this.structureForm = new formUtils().createStructureForm(this.structure); - // this.structureService.getStructureWithOwners(this.structure._id, this.profile).subscribe((s) => { - // this.structureWithOwners = s; - // }); } }); } diff --git a/src/app/utils/formUtils.ts b/src/app/utils/formUtils.ts index ec7fa7984..442f4c5c1 100644 --- a/src/app/utils/formUtils.ts +++ b/src/app/utils/formUtils.ts @@ -84,7 +84,7 @@ export class formUtils { street: new FormControl(structure.address.street, Validators.required), commune: new FormControl(structure.address.commune, Validators.required), }), - contactMail: new FormControl(structure.contactMail, [ + contactMail: new FormControl(structure.contactMail === 'unknown@unknown.com' ? ' ' : structure.contactMail, [ Validators.required, Validators.pattern(CustomRegExp.EMAIL), ]), -- GitLab From 4b4e0dcb606353ac2b8efea099b0ef76f7ab64e1 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Thu, 19 May 2022 16:47:49 +0200 Subject: [PATCH 06/11] remove comments --- .../footer-form/footer-form.component.html | 5 +--- src/app/form/structure-form/form.component.ts | 1 - src/app/services/structure.service.ts | 25 ------------------- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/src/app/form/footer-form/footer-form.component.html b/src/app/form/footer-form/footer-form.component.html index 65e7c93a3..0b68f0d45 100644 --- a/src/app/form/footer-form/footer-form.component.html +++ b/src/app/form/footer-form/footer-form.component.html @@ -5,9 +5,6 @@ fxLayoutGap="10px" fxLayoutAlign="center center" > - <!-- <ng-container *ngIf="isEditMode"> - -</ng-container> --> <app-button *ngIf="!isLastFormStep && !isNextFormTransition && !isStructureLastPage() && !isPersonalOfferFirstPage()" (action)="prevPage()" @@ -17,7 +14,7 @@ ></app-button> <!-- - This button should no be here, for lastform step, it is inside the whit placeholder + This button should no be here, for lastform step, it is inside the white placeholder <app-button *ngIf="isLastFormStep && !isEditMode" (action)="goToHome()" diff --git a/src/app/form/structure-form/form.component.ts b/src/app/form/structure-form/form.component.ts index f82cf2ec3..a9b1b0d95 100644 --- a/src/app/form/structure-form/form.component.ts +++ b/src/app/form/structure-form/form.component.ts @@ -950,7 +950,6 @@ export class FormComponent implements OnInit { // If edit mode, update setbystep if (this.isEditMode) { this.structureService.editStructure(structure).subscribe((s: Structure) => { - // this.createdStructure = this.structureService.updateOpeningStructure(s); this.editForm = this.createStructureForm(s); }); } else { diff --git a/src/app/services/structure.service.ts b/src/app/services/structure.service.ts index 64939ec35..26c49dc33 100644 --- a/src/app/services/structure.service.ts +++ b/src/app/services/structure.service.ts @@ -104,31 +104,6 @@ export class StructureService { }); } - //TODO to delete - // /** - // * Update opening hours of structure - // * @param structure Structure model - // */ - // public updateOpeningStructure(structure: Structure): Structure { - // // Get current day of week - // const currentDate = DateTime.local(); - // const dayOfWeek: number = currentDate.weekday; - - // // Get the schedules of a structure according to his day to indicate if it's open - // const structureSchedules: Day = structure.getDayhours(dayOfWeek); - - // structure.isOpen = false; - // if (structureSchedules.open) { - // structureSchedules.time.forEach((period: Time) => { - // if (this.compareSchedules(period.opening, period.closing, currentDate)) { - // structure.isOpen = true; - // } - // }); - // } - // structure.openedOn = this.getNextOpening(structure, dayOfWeek, currentDate); //TODO: - // return structure; - // } - /** * Checks if the current time is in the time interval of the structure * @param startTime start of period -- GitLab From 26c0d596813012a3047b141796cade56e01727de Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Fri, 20 May 2022 10:52:09 +0200 Subject: [PATCH 07/11] fix summary page design --- src/app/form/footer-form/footer-form.component.html | 2 +- .../structure-edition-summary.component.html | 4 ++-- .../structure-edition-summary.component.scss | 9 ++++++--- .../structure-edition-summary.component.ts | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app/form/footer-form/footer-form.component.html b/src/app/form/footer-form/footer-form.component.html index 0b68f0d45..91f237b54 100644 --- a/src/app/form/footer-form/footer-form.component.html +++ b/src/app/form/footer-form/footer-form.component.html @@ -8,7 +8,7 @@ <app-button *ngIf="!isLastFormStep && !isNextFormTransition && !isStructureLastPage() && !isPersonalOfferFirstPage()" (action)="prevPage()" - [text]="btnName[0]" + [text]="!isEditMode ? btnName[0] : 'Annuler'" [iconType]="'form'" [iconBtn]="!isEditMode && 'chevronLeft'" ></app-button> diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html index 030e4e2ae..9d50e1e12 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html @@ -9,12 +9,12 @@ <div *ngIf="!page.hideForEdit" class="itemSummary" - [ngClass]="{ last: index == lastPage }" + [ngClass]="{ last: page.step === structureFormStep.structureConsent }" fxLayout="row" fxLayoutAlign="space-between center" (click)="goToEdit(page.step)" > - {{ page.name }} + <span>{{ page.name }}</span> <div fxLayout="row" fxLayoutAlign="space-between right"> <div *ngIf="!isPageValid(page)" fxLayout="row" fxLayoutAlign="space-between center"> <app-svg-icon [iconClass]="'validation'" [type]="'form'" [icon]="'notValidate'"></app-svg-icon> diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss b/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss index 51bb2f1c5..7aad9aba3 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss @@ -19,10 +19,10 @@ } .itemSummary { height: 40px; - border-bottom: 1px solid $grey-6; cursor: pointer; - &:hover:not(.invalidText) { - font-weight: bold; + border-bottom: 1px solid $grey-6; + &:hover span { + text-decoration: underline; } .invalidText { @include lato-regular-13; @@ -30,5 +30,8 @@ color: $orange-warning; } } + .last { + border: none !important; + } } } diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts index a27b2ec1a..9b03520e2 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts @@ -15,6 +15,7 @@ export class StructureEditionSummaryComponent implements OnInit { public structureForm: FormGroup; constructor(private route: ActivatedRoute, private router: Router) {} public summary: IStructureSummary[] = new formUtils().structureSummary; + public structureFormStep = structureFormStep; // There is a non-blocking error in console when open edit mode that occurs only in development mode, please refer https://angular.io/errors/NG0100 for more info -- GitLab From db09ba91e44d1892fdcc06a643eb7d0e48cab3d1 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Fri, 20 May 2022 10:56:13 +0200 Subject: [PATCH 08/11] fix width --- .../structure-edition-summary.component.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss b/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss index 7aad9aba3..9aff57b33 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss @@ -4,7 +4,7 @@ .container { margin: 1rem auto; width: 100%; - max-width: 1000px; + max-width: 980px; padding: 2rem; background: white; border-radius: 8px; -- GitLab From 880326c9473087e8e28a113fa6fd4475343ca96d Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Fri, 20 May 2022 14:20:56 +0200 Subject: [PATCH 09/11] fix mail --- .../structure-contact/structure-contact.component.html | 2 +- src/app/utils/formUtils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.html b/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.html index 41a2fc780..82be64f1e 100644 --- a/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.html +++ b/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.html @@ -52,7 +52,7 @@ [icon]="'validate'" ></app-svg-icon> <app-svg-icon - *ngIf="structureForm.get('contactMail').invalid && structureForm.get('contactMail').value" + *ngIf="structureForm.get('contactMail').invalid" [iconClass]="'icon-26'" [type]="'form'" [icon]="'notValidate'" diff --git a/src/app/utils/formUtils.ts b/src/app/utils/formUtils.ts index 442f4c5c1..dc577ff3b 100644 --- a/src/app/utils/formUtils.ts +++ b/src/app/utils/formUtils.ts @@ -84,7 +84,7 @@ export class formUtils { street: new FormControl(structure.address.street, Validators.required), commune: new FormControl(structure.address.commune, Validators.required), }), - contactMail: new FormControl(structure.contactMail === 'unknown@unknown.com' ? ' ' : structure.contactMail, [ + contactMail: new FormControl(structure.contactMail === 'unknown@unknown.com' ? null : structure.contactMail, [ Validators.required, Validators.pattern(CustomRegExp.EMAIL), ]), -- GitLab From df5abd7e7f136b3fe6625212b11d57befc4fcc34 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Fri, 20 May 2022 17:26:19 +0200 Subject: [PATCH 10/11] fix review --- src/app/form/footer-form/footer-form.component.html | 9 --------- src/app/form/form-view/form-view.component.ts | 2 +- .../information-step/information-step.component.html | 2 +- .../information-step/information-step.component.scss | 3 +++ .../structure-access-modality.component.ts | 2 +- .../structure-accompaniment-choice.component.ts | 2 +- .../structure-choice-completion.component.ts | 2 +- .../structure-consent/structure-consent.component.ts | 2 +- .../structure-contact-completion.component.ts | 2 +- .../structure-contact/structure-contact.component.ts | 2 +- .../structure-covid-info.component.ts | 2 +- .../structure-description.component.ts | 2 +- .../structure-digital-helping-accompaniment.component.ts | 2 +- .../structure-equipments.component.ts | 2 +- .../structure-hours/structure-hours.component.ts | 2 +- .../structure-labels/structure-labels.component.ts | 2 +- .../structure-name-and-address.component.ts | 2 +- .../structure-other-services.component.ts | 2 +- .../structure-pmr/structure-pmr.component.ts | 2 +- .../structure-public-target.component.ts | 2 +- .../structure-training-price.component.ts | 2 +- .../structure-training-type.component.ts | 2 +- .../structure-type/structure-type.component.ts | 2 +- .../structure-web-and-social-network.component.ts | 2 +- .../structure-wifi/structure-wifi.component.ts | 4 ++-- src/app/profile/profile-routing.module.ts | 3 +-- .../structure-edition-summary.component.scss | 2 +- .../structure-edition-summary.component.ts | 6 +++--- 28 files changed, 32 insertions(+), 39 deletions(-) diff --git a/src/app/form/footer-form/footer-form.component.html b/src/app/form/footer-form/footer-form.component.html index 91f237b54..598ff4b92 100644 --- a/src/app/form/footer-form/footer-form.component.html +++ b/src/app/form/footer-form/footer-form.component.html @@ -13,15 +13,6 @@ [iconBtn]="!isEditMode && 'chevronLeft'" ></app-button> - <!-- - This button should no be here, for lastform step, it is inside the white placeholder - <app-button - *ngIf="isLastFormStep && !isEditMode" - (action)="goToHome()" - [text]="'Ok'" - [style]="buttonTypeEnum.Primary" - ></app-button> --> - <app-button *ngIf="!isLastFormStep && !isNextFormTransition && !isEditMode" (action)="nextPage()" diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts index cc1934bcb..967976283 100644 --- a/src/app/form/form-view/form-view.component.ts +++ b/src/app/form/form-view/form-view.component.ts @@ -334,7 +334,7 @@ export class FormViewComponent implements OnInit { }); } public setCurrentStep(step: accountFormStep | profileFormStep | structureFormStep | personalOfferFormStep): void { - //THIS PROBABLY CREATES CONSOLE ERRORS + //THIS PROBABLY CREATES CONSOLE ERRORS NG100 only in dev mode, please refer to https://angular.io/errors/NG0100 for more info this.currentPage = step; } public async saveEditedStructure() { diff --git a/src/app/form/form-view/global-components/information-step/information-step.component.html b/src/app/form/form-view/global-components/information-step/information-step.component.html index ed108c903..99d308847 100644 --- a/src/app/form/form-view/global-components/information-step/information-step.component.html +++ b/src/app/form/form-view/global-components/information-step/information-step.component.html @@ -70,7 +70,7 @@ <svg aria-hidden="true"> <use [attr.xlink:href]="'assets/form/sprite.svg#profileUpdated'"></use> </svg> - <h3 style="text-align: center"> + <h3 class="centered"> Votre structure ne disposant ni d’accompagnement, ni de formation, elle n’apparaitra pas sur Rés’in. </h3> <p>Votre profil a bien été mis à jour.</p> diff --git a/src/app/form/form-view/global-components/information-step/information-step.component.scss b/src/app/form/form-view/global-components/information-step/information-step.component.scss index 91ab20bfb..db5e928d0 100644 --- a/src/app/form/form-view/global-components/information-step/information-step.component.scss +++ b/src/app/form/form-view/global-components/information-step/information-step.component.scss @@ -84,6 +84,9 @@ } } &.profile-updated { + .centered { + text-align: center; + } .btn { margin-top: 17px; } diff --git a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts index 894d00dc9..fc4f43671 100644 --- a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts +++ b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts @@ -31,7 +31,7 @@ export class StructureAccessModalityComponent implements OnInit { } return false; } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-accompaniment-choice/structure-accompaniment-choice.component.ts b/src/app/form/form-view/structure-form/structure-accompaniment-choice/structure-accompaniment-choice.component.ts index 34cf9ca41..ff9f78373 100644 --- a/src/app/form/form-view/structure-form/structure-accompaniment-choice/structure-accompaniment-choice.component.ts +++ b/src/app/form/form-view/structure-form/structure-accompaniment-choice/structure-accompaniment-choice.component.ts @@ -18,7 +18,7 @@ export class StructureAccompanimentChoiceComponent implements OnInit { public onRadioChange(name: string, value: boolean): void { this.radioChange.emit({ name, value }); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-choice-completion/structure-choice-completion.component.ts b/src/app/form/form-view/structure-form/structure-choice-completion/structure-choice-completion.component.ts index e6b277c4e..2b901ed37 100644 --- a/src/app/form/form-view/structure-form/structure-choice-completion/structure-choice-completion.component.ts +++ b/src/app/form/form-view/structure-form/structure-choice-completion/structure-choice-completion.component.ts @@ -18,7 +18,7 @@ export class StructureChoiceCompletionComponent { public onRadioChange(name: string, value: boolean): void { this.radioChange.emit({ name, value }); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts b/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts index 8010f06b9..fc907cb7a 100644 --- a/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts +++ b/src/app/form/form-view/structure-form/structure-consent/structure-consent.component.ts @@ -24,7 +24,7 @@ export class StructureConsentComponent { public onRadioChange(value: boolean): void { this.onAcceptOpenData.emit(value); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.ts b/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.ts index 0c8fd6d02..2b574d6ba 100644 --- a/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.ts +++ b/src/app/form/form-view/structure-form/structure-contact-completion/structure-contact-completion.component.ts @@ -17,7 +17,7 @@ export class StructureContactCompletionComponent implements OnInit { public setValidationsForm(): void { this.validateForm.emit(); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts b/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts index 0a4a26269..6d10f40e2 100644 --- a/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts +++ b/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts @@ -20,7 +20,7 @@ export class StructureContactComponent implements OnInit { public setValidationsForm(): void { this.validateForm.emit(); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.ts b/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.ts index d7f06a5bc..f4d379d64 100644 --- a/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.ts +++ b/src/app/form/form-view/structure-form/structure-covid-info/structure-covid-info.component.ts @@ -13,7 +13,7 @@ export class StructureCovidInfoComponent { public getStructureControl(nameControl: string): AbstractControl { return this.structureForm.get(nameControl); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-description/structure-description.component.ts b/src/app/form/form-view/structure-form/structure-description/structure-description.component.ts index 65b7a0cec..28aebaa13 100644 --- a/src/app/form/form-view/structure-form/structure-description/structure-description.component.ts +++ b/src/app/form/form-view/structure-form/structure-description/structure-description.component.ts @@ -18,7 +18,7 @@ export class StructureDescriptionComponent implements OnInit { public getStructureControl(nameControl: string): AbstractControl { return this.structureForm.get(nameControl); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts b/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts index 2cf256159..8fde063cd 100644 --- a/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts +++ b/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts @@ -32,7 +32,7 @@ export class StructureDigitalHelpingAccompanimentComponent implements OnInit { return true; return false; } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts index a3316ca1c..d3881aa21 100644 --- a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts +++ b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts @@ -48,7 +48,7 @@ export class StructureEquipmentsComponent implements OnInit { if (this.vowels.includes(equipment.toLocaleLowerCase()[0])) return `d'${equipment.toLocaleLowerCase()}`; return `de ${equipment.toLocaleLowerCase()}`; } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts b/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts index cf2a0f488..73d13d7d9 100644 --- a/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts +++ b/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts @@ -24,7 +24,7 @@ export class StructureHoursComponent implements OnInit { public setHoursError() { this.hoursError.emit(); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts b/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts index fb70effee..22272c5c3 100644 --- a/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts +++ b/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts @@ -32,7 +32,7 @@ export class StructureLabelsComponent implements OnInit { value: modality, }); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts b/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts index b75b0ae38..416c40ed8 100644 --- a/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts +++ b/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts @@ -25,7 +25,7 @@ export class StructureNameAndAddressComponent implements OnInit { public setAddressStructure(address?: Address) { this.addressStructure.emit(address); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts b/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts index 0a400d1b9..81290442d 100644 --- a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts +++ b/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts @@ -31,7 +31,7 @@ export class StructureOtherServicesComponent implements OnInit { value: modality, }); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.ts b/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.ts index 33b0ab2b3..2c625cf6d 100644 --- a/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.ts +++ b/src/app/form/form-view/structure-form/structure-pmr/structure-pmr.component.ts @@ -20,7 +20,7 @@ export class StructurePmrComponent implements OnInit { public onRadioChange(name: string, value: boolean): void { this.radioChange.emit({ name, value }); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts index 36d082b0c..cc03d7bdf 100644 --- a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts +++ b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts @@ -28,7 +28,7 @@ export class StructurePublicTargetComponent implements OnInit { if (this.structureForm.get('publics') && this.structureForm.get('publics').value.includes(choice)) return true; return false; } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.ts b/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.ts index 2f10412eb..67030103f 100644 --- a/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.ts +++ b/src/app/form/form-view/structure-form/structure-training-price/structure-training-price.component.ts @@ -21,7 +21,7 @@ export class StructureTrainingPriceComponent implements OnInit { public onRadioChange(name: string, value: boolean): void { this.radioChange.emit({ name, value }); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts b/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts index f47721b58..df5b28783 100644 --- a/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts +++ b/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts @@ -23,7 +23,7 @@ export class StructureTrainingTypeComponent { } } } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts b/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts index 7fe834300..c3c96d611 100644 --- a/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts +++ b/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts @@ -18,7 +18,7 @@ export class StructureTypeComponent implements OnInit { public setTypeStructure(value) { this.typeStructure.emit(value); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts b/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts index 6dd632fb2..ef5fcc1c6 100644 --- a/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts +++ b/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts @@ -34,7 +34,7 @@ export class StructureWebAndSocialNetworkComponent implements OnInit { public setValidationsForm(): void { this.validateForm.emit(); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts index a53ea42aa..4d35222c7 100644 --- a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts +++ b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts @@ -14,7 +14,7 @@ export class StructureWifiComponent implements OnInit { ngOnInit(): void { if (this.isEditMode) this.validateForm.emit(); } - public isInArray(formControlName: string, term: string) { + public isInArray(formControlName: string, term: string): boolean { if (this.structureForm.controls[formControlName].value) { return this.structureForm.controls[formControlName].value.includes(term); } @@ -23,7 +23,7 @@ export class StructureWifiComponent implements OnInit { public onCheckChange(event, catId: string, modId: string): void { this.checkChange.emit({ event, formControlName: catId, value: modId }); } - public goBack() { + public goBack(): void { history.back(); } } diff --git a/src/app/profile/profile-routing.module.ts b/src/app/profile/profile-routing.module.ts index 32aec5754..20e114fbd 100644 --- a/src/app/profile/profile-routing.module.ts +++ b/src/app/profile/profile-routing.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; -import { Routes, RouterModule, Route } from '@angular/router'; -import { DeactivateGuard } from '../guards/deactivate.guard'; +import { Routes, RouterModule } from '@angular/router'; import { RoleGuard } from '../guards/role.guard'; import { StructureResolver } from '../resolvers/structure.resolver'; import { RouteRole } from '../shared/enum/routeRole.enum'; diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss b/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss index 9aff57b33..aeba5d2a0 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.scss @@ -6,7 +6,7 @@ width: 100%; max-width: 980px; padding: 2rem; - background: white; + background: $white; border-radius: 8px; border: 1px solid $grey-6; .head { diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts index 9b03520e2..27d520769 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts @@ -27,13 +27,13 @@ export class StructureEditionSummaryComponent implements OnInit { } }); } - public goBack() { + public goBack(): void { this.router.navigateByUrl('/profile'); } - public goToEdit(step: structureFormStep) { + public goToEdit(step: structureFormStep): void { this.router.navigate(['/form/structure', this.structure._id, structureFormStep[step]]); } - public isPageValid(page: IStructureSummary) { + public isPageValid(page: IStructureSummary): boolean { if (page.inputs) { for (let input of page.inputs) { if (!this.structureForm.get(input).valid) return false; -- GitLab From f2d1bcff29594a115522534bac438898572d4979 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Mon, 23 May 2022 10:23:52 +0200 Subject: [PATCH 11/11] fix edit mode link --- .../structure-edition-summary.component.html | 6 +++++- .../structure-edition-summary.component.ts | 2 +- .../structure-options-modal.component.ts | 2 +- .../structure-details/structure-details.component.ts | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html index 9d50e1e12..cda2a95b7 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html @@ -1,4 +1,4 @@ -<div class="container"> +<div class="container" tabindex="1"> <div class="header"> <div fxLayout="row" fxLayoutAlign="start center" class="head" (click)="goBack()"> <app-svg-icon [iconClass]="'backArrow'" [type]="'ico'" [icon]="'arrowBack'"></app-svg-icon> @@ -13,6 +13,10 @@ fxLayout="row" fxLayoutAlign="space-between center" (click)="goToEdit(page.step)" + (keyup.enter)="goToEdit(page.step)" + aria-label="item" + [attr.data-index]="index" + tabindex="0" > <span>{{ page.name }}</span> <div fxLayout="row" fxLayoutAlign="space-between right"> diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts index 27d520769..8acbb2b38 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts @@ -28,7 +28,7 @@ export class StructureEditionSummaryComponent implements OnInit { }); } public goBack(): void { - this.router.navigateByUrl('/profile'); + history.back(); } public goToEdit(step: structureFormStep): void { this.router.navigate(['/form/structure', this.structure._id, structureFormStep[step]]); diff --git a/src/app/shared/components/structure-options-modal/structure-options-modal.component.ts b/src/app/shared/components/structure-options-modal/structure-options-modal.component.ts index 75ae365b3..52ae98ad8 100644 --- a/src/app/shared/components/structure-options-modal/structure-options-modal.component.ts +++ b/src/app/shared/components/structure-options-modal/structure-options-modal.component.ts @@ -92,7 +92,7 @@ export class StructureOptionsModalComponent implements OnInit { this.editModal = TypeModalProfile.deleteAccount; break; case FunctionTypeModalOptions.editStructure: - this.router.navigateByUrl(`/create-structure/${this.structure.structure._id}`); + this.router.navigateByUrl(`/profile/edit-structure/${this.structure.structure._id}`); break; case FunctionTypeModalOptions.removeStructure: this.toggleDeleteStructureModal(); 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 92137181b..76f32d1e2 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 @@ -234,7 +234,7 @@ export class StructureDetailsComponent implements OnInit { } } public handleModify(): void { - this.router.navigate(['create-structure', this.structure._id]); + this.router.navigateByUrl(`/profile/edit-structure/${this.structure._id}`); } public deleteStructure(shouldDelete: boolean): void { -- GitLab