diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html index 1a43f149278f9500d2967a3a6410262adb489c9f..1599d788955d506bf2c29a1edb005929b140b210 100644 --- a/src/app/form/form.component.html +++ b/src/app/form/form.component.html @@ -322,7 +322,6 @@ (updateForm)="updateHours($event)" (updateFormError)="setHoursError()" [structureInput]="hoursForm" - [isEditMode]="!isEditMode" ></app-hour-picker> </div> <div *ngIf="currentPage == pageTypeEnum.structureHoursDetails" class="page"> @@ -725,7 +724,7 @@ <h3>Proposez-vous le wifi en accès libre ?</h3> </div> <app-radio-form - [selectedOption]="isInArray('wifiEnAccesLibre', 'equipmentsAndServices')" + [selectedOption]="isEditMode ? isInArray('wifiEnAccesLibre', 'equipmentsAndServices') : null" (selectedEvent)="onCheckChange($event, 'equipmentsAndServices', 'wifiEnAccesLibre')" > </app-radio-form> diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 87b23eb3b33543276edc0a4b5b7d675c3c2bd295..fe17f84f144558ee00b9c58de0d06a575d1ca7c2 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -68,6 +68,7 @@ export class FormComponent implements OnInit { public isEditMode = false; public isClaimMode = false; public isLoading = false; + public isWifiChoosen = false; constructor( private structureService: StructureService, @@ -87,6 +88,7 @@ export class FormComponent implements OnInit { this.isLoading = false; if (history.state.data) { this.isEditMode = true; + this.isWifiChoosen = true; this.initForm(new Structure(history.state.data)); } else if (history.state.newUser) { this.isClaimMode = true; @@ -356,6 +358,9 @@ export class FormComponent implements OnInit { } public onCheckChange(event: boolean, formControlName: string, value: string): void { + if (value == 'wifiEnAccesLibre') { + this.isWifiChoosen = true; + } const formArray: FormArray = this.structureForm.get(formControlName) as FormArray; if (event) { // Add a new control in the arrayForm @@ -471,7 +476,7 @@ export class FormComponent implements OnInit { name: 'Gratuité des ateliers', }; this.pagesValidation[PageTypeEnum.structureWifi] = { - valid: this.getStructureControl('equipmentsAndServices').valid, + valid: this.getStructureControl('equipmentsAndServices').valid && this.isWifiChoosen, name: 'Gratuité du wifi', }; this.pagesValidation[PageTypeEnum.structureEquipments] = { @@ -745,7 +750,7 @@ export class FormComponent implements OnInit { public canExit(): Promise<boolean> { // Avoid confirmation when user submit form and leave. - if (this.currentPage == this.nbPagesForm || this.isEditMode) { + if (this.currentPage == this.nbPagesForm || this.currentPage < 3 || this.isEditMode) { return new Promise((resolve) => resolve(true)); } else { return new Promise((resolve) => this.showModal(resolve)); @@ -772,6 +777,7 @@ export class FormComponent implements OnInit { this.showCollapse(structure); } this.currentPage = numPage; + this.updatePageValid(); } public closeEditMode(): void { diff --git a/src/app/shared/components/hour-picker/hour-picker.component.html b/src/app/shared/components/hour-picker/hour-picker.component.html index 0a509ad52dd5895c6d6c3aef3c5de0a915a07dbe..ff785893b3a1f3adaf7b8aea1eda28f3cb06e8f8 100644 --- a/src/app/shared/components/hour-picker/hour-picker.component.html +++ b/src/app/shared/components/hour-picker/hour-picker.component.html @@ -19,7 +19,6 @@ id="{{ day.name }}" (click)="toggleOpenDay(day, $event.target.checked)" [checked]="day.open" - [disabled]="isEditMode" /> <span class="slider"></span> </label> @@ -52,13 +51,13 @@ <div>de</div> <div class="input-container"> - <input type="time" [(ngModel)]="hour.start" (change)="submitForm()" [disabled]="isEditMode" /> + <input type="time" [(ngModel)]="hour.start" (change)="submitForm()" /> </div> <div>à </div> <div class="input-container"> - <input type="time" [(ngModel)]="hour.end" (change)="submitForm()" [disabled]="isEditMode" /> + <input type="time" [(ngModel)]="hour.end" (change)="submitForm()" /> </div> <div> @@ -70,7 +69,7 @@ </div> </div> </div> - <div class="add" *ngIf="day.hours.length === 1 && !isEditMode"> + <div class="add" *ngIf="day.hours.length === 1"> <div (click)="addHours(day)" fxLayout="row" diff --git a/src/app/shared/components/hour-picker/hour-picker.component.ts b/src/app/shared/components/hour-picker/hour-picker.component.ts index 6114ce012c57b7a989b263ced5f0b87428ee49a3..63f42f543c5790b2439704108135b12edbf340b5 100644 --- a/src/app/shared/components/hour-picker/hour-picker.component.ts +++ b/src/app/shared/components/hour-picker/hour-picker.component.ts @@ -14,7 +14,6 @@ import { CheckHours } from '../../validator/form'; export class HourPickerComponent implements OnChanges, OnDestroy { @Input() modifiedFields: any; @Input() structureInput: FormGroup; - @Input() isEditMode: boolean; @Output() updateFormError = new EventEmitter<any>(); @Output() updateForm = new EventEmitter<FormGroup>(); diff --git a/src/app/shared/components/modal-confirmation/modal-confirmation.component.html b/src/app/shared/components/modal-confirmation/modal-confirmation.component.html index d2bc29320a9ffd3cafaf17d0b5d1bc5597795618..018d67fad261bcca0cdc5a6252a94a82ee50ef9a 100644 --- a/src/app/shared/components/modal-confirmation/modal-confirmation.component.html +++ b/src/app/shared/components/modal-confirmation/modal-confirmation.component.html @@ -4,8 +4,8 @@ <h3>ATTENTION</h3> <p>{{ content }}</p> <div class="footerModal" fxLayout="row" fxLayoutAlign="space-around center"> - <button class="btn confirm" (click)="closeModal(true)">Confirmer</button> - <button class="btn" (click)="closeModal(false)">Annuler</button> + <button class="btn-primary small leave" (click)="closeModal(true)">Confirmer</button> + <button class="btn-primary small" (click)="closeModal(false)">Annuler</button> </div> </div> </div> diff --git a/src/app/shared/components/modal-confirmation/modal-confirmation.component.scss b/src/app/shared/components/modal-confirmation/modal-confirmation.component.scss index 5f111d0b57f48fb94e8b7d3c564436bf76760667..8b50ba8f37e2ece4fcd66a534a6e91027d7bc364 100644 --- a/src/app/shared/components/modal-confirmation/modal-confirmation.component.scss +++ b/src/app/shared/components/modal-confirmation/modal-confirmation.component.scss @@ -3,12 +3,45 @@ @import '../../../../assets/scss/shapes'; @import '../../../../assets/scss/z-index'; -h3 { - @include cn-bold-18; - color: $orange-warning; -} -p { - @include cn-bold-16; - color: $grey-1; - text-align: center; +.modalExitContainer { + width: 100%; + height: 100%; + z-index: $modal-z-index; + position: absolute; + content: ''; + top: 0; + background-color: $modal-background; + .modal { + .contentModal { + width: 100%; + background: $white; + padding: 35px 20px 18px 20px; + h3 { + @include cn-bold-18; + color: $orange-warning; + } + p { + @include cn-bold-16; + color: $grey-1; + text-align: center; + } + .footerModal { + width: 100%; + margin-top: 14px; + @include cn-bold-16; + .leave { + background: none; + color: $grey-1; + text-decoration: underline; + } + } + } + width: 350px; + margin: auto; + border-radius: 6px; + @include background-hash; + border: 1px solid $grey-4; + margin-top: 50vh; + transform: translateY(-50%); + } } diff --git a/src/app/shared/components/structure-type-picker/structure-type-picker.component.html b/src/app/shared/components/structure-type-picker/structure-type-picker.component.html index 3c6fa1bb62feabd9dc263db1b43c65c507766189..3613f3efbca5bf4f8735d573dde09087f72dffc8 100644 --- a/src/app/shared/components/structure-type-picker/structure-type-picker.component.html +++ b/src/app/shared/components/structure-type-picker/structure-type-picker.component.html @@ -26,7 +26,7 @@ <svg *ngIf="choice == pickedChoice" class="validate" aria-hidden="true"> <use [attr.xlink:href]="'assets/form/sprite.svg#checkVector'"></use> </svg> - {{ choice }} + {{ getStructureTypeName(choice) }} </button> </div> </div> diff --git a/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts b/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts index 63b880768612287158cfbc1b753575b4d94107dc..b64a4718fdd9a00e6ec230e052f97725312195ec 100644 --- a/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts +++ b/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts @@ -1,6 +1,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { StructureType } from '../../../models/structure-type.model'; import { StructureTypeService } from '../../../services/structure-type.service'; +import { typeStructureEnum } from '../../enum/typeStructure.enum'; export enum structureTypes { public = 'Publique', @@ -67,4 +68,7 @@ export class StructureTypePickerComponent implements OnInit { throw new Error('Structure type not handle'); } } + public getStructureTypeName(type: string): string { + return typeStructureEnum[type]; + } } diff --git a/src/app/shared/enum/regex.enum.ts b/src/app/shared/enum/regex.enum.ts index 4f83475e69dd10778e6b45e19c6fd70a95bec875..6011651df41e73e756b4bacdbcab714fcfe6afe3 100644 --- a/src/app/shared/enum/regex.enum.ts +++ b/src/app/shared/enum/regex.enum.ts @@ -2,10 +2,10 @@ export enum Regex { email = '[a-z0-9.-]+@[a-z0-9.-]+[.][a-z]{2,3}', textWithoutNumber = '[A-Za-zÀ-ÖØ-öø-ÿ- ]{1,}', phone = '([0-9]{2} ){4}[0-9]{2}', - website = '(www[.])[a-z0-9.-]*[.][a-z]{2,3}', - linkedIn = '(linkedin.com/in/[a-z0-9A-Z.-]{1,})', - facebook = '(facebook.com/[a-z0-9A-Z.-]{1,})', - twitter = '(twitter.com/[a-z0-9A-Z.-]{1,})', - instagram = '(instagram.com/[a-z0-9A-Z.-]{1,})', + website = '(www[.])?(https://)?(http://)?[a-zA-Z0-9.-]*[.][a-z]{2,3}((/)[a-zA-Z0-9-/]*)?', + linkedIn = '(linkedin.com/in/.{1,})', + facebook = '(facebook.com/.{1,})', + twitter = '(twitter.com/.{1,})', + instagram = '(instagram.com/.{1,})', noNullNumber = '[1-9]{1}[0-9]*', } diff --git a/src/app/shared/enum/typeStructure.enum.ts b/src/app/shared/enum/typeStructure.enum.ts index e21c7cb40812286b8a490a5cad92bfbf74aad12c..e23ed6665387765f6a697d4c1773bf2ab2e743ef 100644 --- a/src/app/shared/enum/typeStructure.enum.ts +++ b/src/app/shared/enum/typeStructure.enum.ts @@ -1,19 +1,32 @@ export enum typeStructureEnum { - associationCaritative = 'Association caritative', - centreSocio = 'Centre socio-culturel', - cyber = 'Cyberbase / Cybercentre', - coworking = 'Espace de coworking', fablab = 'Fablab', + // A supprimer ? + + //A remplacer par Association ? + associationQuartier = 'Structure associative de quartier', + associationCaritative = 'Association caritative', + + // En attente de suppression remplacer par CAF CARSAT, Pole Emploi et CCAS grandOrganismePublic = 'Grand organisme public (CAF, CARSAT, Pôle emploi...)', + + mdm = 'Maison de la métropole', mairie = 'Mairie', - mdm = 'Maison de la Métropole (MDM)', - mediatheque = 'Médiathèque / Bibliothèque', + CAF = 'CAF', + CCAS = 'CCAS', + CARSAT = 'CARSAT', + poleEmploi = 'Pole Emploi', + mediatheque = 'Médiathèque/Bibliothèque', + prefecture = 'Préfecture', + bijPij = 'BIJ/PIJ', + logement = 'Logement', + + association = 'Association', + centreSocio = 'Centre socio-culturel', + mjc = 'MJC / Cyberbase', + pimms = 'PIMMS', + sij = 'Structure information jeunesse (SIJ)', missionsLocales = 'Missions locales', - mjc = 'MJC', - pimms = 'Pimms', - ressourcerie = 'Ressourcerie (matériel moindre coût / recyclé)', - associationQuartier = 'Structure associative de quartier', + formation = 'Structure de formation', insertion = "Structure d'insertion", - sij = 'Structure information jeunesse (SIJ)', } 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 9602090007224539255c7f80cdc8ac999a50abd6..a46e89ef8ddeb2c6cc08407c8ec403cf09ddabcc 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 @@ -31,10 +31,7 @@ export class StructureDetailsComponent implements OnInit { public accessRights: Module[]; public tclStopPoints: TclStopPoint[] = []; public printMode = false; - public isOtherSection = false; - public showForm = false; public isClaimed: boolean = null; - Z; public isLoading: boolean = false; public currentProfile: User = null; public deleteModalOpenned = false;