From a98fe372fef63898970b61bd41c05cc43e1458a1 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Tue, 24 May 2022 10:49:35 +0200 Subject: [PATCH 1/3] feat(form): Remove old form components --- src/app/app-routing.module.ts | 19 - src/app/app.module.ts | 2 - .../form/structure-form/form.component.html | 1447 ----------------- .../form/structure-form/form.component.scss | 665 -------- .../structure-form/form.component.spec.ts | 131 -- src/app/form/structure-form/form.component.ts | 1082 ------------ src/app/form/structure-form/pageType.enum.ts | 26 - 7 files changed, 3372 deletions(-) delete mode 100644 src/app/form/structure-form/form.component.html delete mode 100644 src/app/form/structure-form/form.component.scss delete mode 100644 src/app/form/structure-form/form.component.spec.ts delete mode 100644 src/app/form/structure-form/form.component.ts delete mode 100644 src/app/form/structure-form/pageType.enum.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 743bc6852..b31e4497f 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -5,11 +5,8 @@ import { ContactComponent } from './contact/contact.component'; import { FooterComponent } from './footer/footer.component'; import { StructureListPrintComponent } from './form/orientation-form/component/structure-list-print/structure-list-print.component'; import { OrientationFormComponent } from './form/orientation-form/orientation-form.component'; -import { FormComponent } from './form/structure-form/form.component'; import { AdminGuard } from './guards/admin.guard'; import { AuthGuard } from './guards/auth.guard'; -import { DeactivateGuard } from './guards/deactivate.guard'; -import { RoleGuard } from './guards/role.guard'; import { LegalNoticeComponent } from './legal-notice/legal-notice.component'; import { LoginComponent } from './login/login.component'; import { NewsletterSubscriptionComponent } from './newsletter-subscription/newsletter-subscription.component'; @@ -18,9 +15,7 @@ import { EditComponent } from './profile/edit/edit.component'; import { ResetEmailComponent } from './reset-email/reset-email.component'; import { ResetPasswordComponent } from './reset-password/reset-password.component'; import { StructureResolver } from './resolvers/structure.resolver'; -import { TempUserResolver } from './resolvers/temp-user.resolver'; import { PasswordFormComponent } from './shared/components'; -import { RouteRole } from './shared/enum/routeRole.enum'; import { StructureJoinComponent } from './structure-join/structure-join.component'; import { StructureDetailsComponent } from './structure-list/components/structure-details/structure-details.component'; import { StructureListComponent } from './structure-list/structure-list.component'; @@ -126,20 +121,6 @@ const routes: Routes = [ footerOutletRoute, ], }, - { - path: 'register', - children: [ - { - path: '', - component: FormComponent, - canDeactivate: [DeactivateGuard], - resolve: { - user: TempUserResolver, - }, - }, - footerOutletRoute, - ], - }, { path: 'change-email/:id', children: [ diff --git a/src/app/app.module.ts b/src/app/app.module.ts index ad9e60d69..22058ee5b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -21,7 +21,6 @@ import { ModalFilterComponent } from './structure-list/components/modal-filter/m import { LegalNoticeComponent } from './legal-notice/legal-notice.component'; import { PageComponent } from './page/page.component'; import { ContactComponent } from './contact/contact.component'; -import { FormComponent } from './form/structure-form/form.component'; import { AuthGuard } from './guards/auth.guard'; import { CustomHttpInterceptor } from './config/http-interceptor'; import { ResetEmailComponent } from './reset-email/reset-email.component'; @@ -62,7 +61,6 @@ import { LoginComponent } from './login/login.component'; ContactComponent, ResetEmailComponent, ResetPasswordComponent, - FormComponent, StructureJoinComponent, NewsletterSubscriptionComponent, OrientationFormComponent, diff --git a/src/app/form/structure-form/form.component.html b/src/app/form/structure-form/form.component.html deleted file mode 100644 index b6aea90ed..000000000 --- a/src/app/form/structure-form/form.component.html +++ /dev/null @@ -1,1447 +0,0 @@ -<div class="form" fxLayout="column"> - <app-modal-confirmation - [openned]="showConfirmationModal" - [content]="'Il vous faudra de nouveau remplir le formulaire si vous quittez maintenant'" - [customConfirmationText]="'Quitter quand même'" - (closed)="hasRedirectionAccepted($event)" - ></app-modal-confirmation> - <div class="content" *ngIf="!isLoading" [ngClass]="{ editMode: isEditMode }"> - <div class="headerEditMode" *ngIf="isEditMode" fxLayout="row" fxLayoutAlign="space-between center"> - <h2 class="no-margin">Modification de {{ editForm.get('structureName').value }}</h2> - <app-structure-options-modal - [structure]="structureWithOwners" - [isEditFormView]="true" - (closed)="structureDeleted()" - ></app-structure-options-modal> - </div> - <div class="returnBtnSection" *ngIf="isEditMode && currentPage != 0"> - <button class="btn-primary previous" (click)="goToSpecificPage(0, false)"> - <div class="rowBtn" fxLayout="row" fxLayoutAlign="center center"> - <svg class="chevronLeft" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#chevronLeft'"></use> - </svg> - Retour - </div> - </button> - </div> - <div class="progressBar" *ngIf="currentPage != 0 && !isEditMode"> - <p>Création de compte</p> - <div fxLayout="row" fxLayoutAlign="space-between center" fxLayoutGap="20px"> - <label [ngClass]="{ validate: currentPage == nbPagesForm }" for="progressForm" - >{{ progressStatus | number: '1.0-0' }}% - </label> - <progress - id="progressForm" - [ngClass]="{ validate: currentPage == nbPagesForm }" - max="100" - [value]="progressStatus" - ></progress> - </div> - </div> - <div *ngIf="displayAddStructure()" class="home page" fxLayout="column" fxLayoutAlign="center center"> - <h2>Ajouter votre structure</h2> - <img src="../../assets/form/schedule.svg" alt="logo schedule" /> - <div> - <p class="titleDesc">Cela va prendre une quinzaine de minutes</p> - <p>Une fois réalisé cela vous permettra d'être référencé sur la platefome</p> - </div> - <app-footer-form - class="btnStart" - [btnName]="['Précédent', 'C\'est parti']" - (previousPage)="previousUrl()" - (nextPage)="nextPage()" - [isValid]="isPageValid" - ></app-footer-form> - </div> - <div - *ngIf="displayClaimStructure()" - class="home page" - fxLayout="column" - fxLayoutAlign="space-between center" - fxLayoutAlign.lt-sm="center" - > - <h2> - {{ isJoinMode ? 'Rejoindre' : 'Revendiquer' }} la structure <span>{{ claimStructure.structureName }}</span> - </h2> - <div> - <p>Une fois réalisé cela vous permettra de devenir propriétaire de cette structure</p> - </div> - <app-footer-form - class="btnStart" - [btnName]="['Précédent', 'C\'est parti']" - (previousPage)="previousUrl()" - (nextPage)="nextPage()" - [isValid]="isPageValid" - ></app-footer-form> - </div> - <!-- ICIIIIIIIIIIII --> - <div - *ngIf="currentPage == pageTypeEnum.summary && isEditMode" - class="editHome page" - fxLayout="column" - fxLayoutAlign="space-between" - > - <div class="summary" *ngFor="let page of pagesValidation; let index = index"> - <div - class="itemSummary" - [ngClass]="{ last: index == lastPage }" - fxLayout="row" - fxLayoutAlign="space-between center" - *ngIf="page.name && shouldDisplayPage(index)" - (click)="goToSpecificPage(index, false)" - > - {{ page.name }} - <div fxLayout="row" fxLayoutAlign="space-between center"> - <app-svg-icon - *ngIf="!updatePageValid(index, page)" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - <svg class="chevronRight" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#chevronRight'"></use> - </svg> - </div> - </div> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.info" class="informations page" fxLayout="column" fxLayoutGap="28px"> - <h3>De quelles informations faut-il vous munir ?</h3> - <img src="../../assets/form/factures.svg" alt="logo factures" /> - <div> - <ul> - <li><span>les coordonnées de votre structure</span></li> - - <li><span>les horaires d’ouverture</span></li> - - <li><span>la liste des ateliers que vous dispensez (optionnel)</span></li> - </ul> - </div> - </div> - <form - [formGroup]="accountForm" - *ngIf="accountForm && !profile" - (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null" - > - <div *ngIf="currentPage == pageTypeEnum.accountInfo" class="page"> - <div class="title"> - <h3>Qui êtes-vous ?</h3> - <p>Vous pourrez choisir de rendre visibles ces informations sur votre profil public</p> - </div> - <div *ngIf="!isClaimMode" class="title"> - <h4> - Vous possédez déja un compte ?<br /> - Connectez-vous : - </h4> - <button class="btn-primary small next" *ngIf="!isLoggedIn" (click)="isPopUpOpen = !isPopUpOpen"> - Se connecter - </button> - <h4>Sinon, inscrivez-vous en suivant le formulaire ci-dessous :</h4> - </div> - <div class="form-group" fxLayout="column"> - <label for="name">Prénom</label> - <div fxLayout="row" fxLayoutGap="13px"> - <input type="text" (input)="setValidationsForm()" formControlName="name" class="form-input" /> - <app-svg-icon - *ngIf="accountForm.get('name').valid" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="accountForm.get('name').invalid && accountForm.get('name').value" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - </div> - </div> - <div class="form-group" fxLayout="column"> - <label for="surname">Nom</label> - <div fxLayout="row" fxLayoutGap="13px"> - <input type="text" (input)="setValidationsForm()" formControlName="surname" class="form-input" /> - <app-svg-icon - *ngIf="accountForm.get('surname').valid" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="accountForm.get('surname').invalid && accountForm.get('surname').value" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - </div> - </div> - <div class="form-group" fxLayout="column"> - <label for="phone">Téléphone</label> - <div fxLayout="row" fxLayoutGap="13px"> - <input - type="text" - formControlName="phone" - class="form-input phone" - (input)="utils.modifyPhoneInput(accountForm, 'phone', $event.target.value); setValidationsForm()" - /> - <app-svg-icon - *ngIf="accountForm.get('phone').valid" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="accountForm.get('phone').invalid && accountForm.get('phone').value" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - </div> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.accountCredentials" class="page"> - <div class="title"> - <h3>Quels identifiants utiliserez-vous pour vous connecter ?</h3> - </div> - <div class="form-group" fxLayout="column"> - <label for="email">Email du compte</label> - <p class="special invalid" *ngIf="this.accountForm.get('email').hasError('alreadyExist')"> - L'email est déja utilisé. - </p> - <div fxLayout="row" fxLayoutGap="13px"> - <input - type="text" - (input)="setValidationsForm()" - (keyup)="verifyUserExist($event.target.value)" - formControlName="email" - placeholder="exemple: prenom.nom@grandlyon.com" - class="form-input email-placeholder" - [readonly]="isAccountMode" - [ngClass]="{ disabled: isAccountMode }" - /> - <app-svg-icon - *ngIf="accountForm.get('email').valid" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="accountForm.get('email').invalid && accountForm.get('email').value" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - </div> - </div> - <div class="form-group" fxLayout="column"> - <label for="password">Création de mot de passe</label> - <p - class="special" - [ngClass]="{ invalid: accountForm.get('password').invalid && accountForm.get('password').value }" - ></p> - <span class="passwordInfo">Le mot de passe doit contenir au minimum</span> - <ul> - <li - [ngClass]="{ - invalid: accountForm.get('password').value.length < 8, - valid: accountForm.get('password').value.length >= 8 - }" - class="" - > - <app-svg-icon - *ngIf="accountForm.get('password').value.length >= 8" - [iconClass]="'icon-16'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="accountForm.get('password').value.length < 8" - [iconClass]="'icon-16'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - <p>8 caractères</p> - </li> - <li - [ngClass]="{ - invalid: !checkIfPasswordHasSpecialChar(accountForm.get('password').value), - valid: checkIfPasswordHasSpecialChar(accountForm.get('password').value) - }" - > - <app-svg-icon - *ngIf="checkIfPasswordHasSpecialChar(accountForm.get('password').value)" - [iconClass]="'icon-16'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="!checkIfPasswordHasSpecialChar(accountForm.get('password').value)" - [iconClass]="'icon-16'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - <p>un caractère spécial</p> - </li> - <li - [ngClass]="{ - invalid: !checkIfPasswordHasLowerCase(accountForm.get('password').value), - valid: checkIfPasswordHasLowerCase(accountForm.get('password').value) - }" - > - <app-svg-icon - *ngIf="checkIfPasswordHasLowerCase(accountForm.get('password').value)" - [iconClass]="'icon-16'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="!checkIfPasswordHasLowerCase(accountForm.get('password').value); s" - [iconClass]="'icon-16'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - <p>un caractère en minuscule</p> - </li> - <li - [ngClass]="{ - invalid: !checkIfPasswordHasUpperCase(accountForm.get('password').value), - valid: checkIfPasswordHasUpperCase(accountForm.get('password').value) - }" - > - <app-svg-icon - *ngIf="checkIfPasswordHasUpperCase(accountForm.get('password').value)" - [iconClass]="'icon-16'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="!checkIfPasswordHasUpperCase(accountForm.get('password').value); s" - [iconClass]="'icon-16'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - <p>un caractère en majuscule</p> - </li> - <li - [ngClass]="{ - invalid: !checkIfPasswordHasDigit(accountForm.get('password').value), - valid: checkIfPasswordHasDigit(accountForm.get('password').value) - }" - > - <app-svg-icon - *ngIf="checkIfPasswordHasDigit(accountForm.get('password').value)" - [iconClass]="'icon-16'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="!checkIfPasswordHasDigit(accountForm.get('password').value)" - [iconClass]="'icon-16'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - <p>un chiffre</p> - </li> - </ul> - <div fxLayout="row" fxLayoutAlign="none center" fxLayoutGap="13px"> - <input - [type]="isShowPassword ? 'text' : 'password'" - formControlName="password" - class="form-input password" - (input)="setValidationsForm()" - autocomplete="on" - /> - <app-svg-icon - [iconClass]="'validation grey hover'" - [type]="'form'" - [icon]="'eyePassword'" - (click)="showPassword()" - ></app-svg-icon> - - <app-svg-icon - *ngIf="accountForm.get('password').valid" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="accountForm.get('password').invalid && accountForm.get('password').value" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - </div> - </div> - <div class="form-group" fxLayout="column"> - <label for="confirmPassword">Vérification du mot de passe</label> - <div fxLayout="row" fxLayoutAlign="none center" fxLayoutGap="13px"> - <input - [type]="isShowConfirmPassword ? 'text' : 'password'" - formControlName="confirmPassword" - class="form-input password" - (input)="setValidationsForm()" - autocomplete="on" - /> - <app-svg-icon - [iconClass]="'validation grey hover'" - [type]="'form'" - [icon]="'eyePassword'" - (click)="showConfirmPassword()" - ></app-svg-icon> - <app-svg-icon - *ngIf="accountForm.get('confirmPassword').valid && accountForm.get('confirmPassword').value" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="accountForm.get('confirmPassword').invalid && accountForm.get('confirmPassword').value" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - </div> - </div> - </div> - </form> - <form - [formGroup]="structureForm" - *ngIf="structureForm" - (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null" - > - <div *ngIf="currentPage == pageTypeEnum.structureNameAndAddress" class="page"> - <div class="title"> - <h3>Quelle structure voulez-vous référencer ?</h3> - </div> - <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"> - <input - type="text" - (input)="setValidationsForm()" - formControlName="structureName" - class="form-input structureName" - /> - <app-svg-icon - *ngIf="getStructureControl('structureName').valid" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - </div> - </div> - <div class="form-group" fxLayout="column"> - <label for="address">Adresse de la structure</label> - - <div class="addressRow" fxLayout="row" fxLayoutGap="13px"> - <app-address-autocomplete - [address]="getStructureControl('address').valid ? getStructureControl('address').value : null" - (inputAddress)="setAddressStructure()" - (selectedAddress)="setAddressStructure($event)" - ></app-address-autocomplete> - <app-svg-icon - *ngIf="getStructureControl('address').valid" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'validate'" - class="validateIcon" - ></app-svg-icon> - </div> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structurePhone" class="page"> - <div class="title"> - <h3>Comment joindre votre structure ?</h3> - </div> - <p - class="missing-information" - *ngIf=" - isEditMode && (!getStructureControl('contactPhone').valid || !getStructureControl('contactMail').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="contactPhone">Téléphone de la structure</label> - <div fxLayout="row" fxLayoutGap="13px"> - <input - type="text" - formControlName="contactPhone" - class="form-input" - (input)="utils.modifyPhoneInput(structureForm, 'contactPhone', $event.target.value); setValidationsForm()" - /> - <app-svg-icon - *ngIf="getStructureControl('contactPhone').valid" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="getStructureControl('contactPhone').invalid && getStructureControl('contactPhone').value" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - </div> - </div> - <div class="form-group" fxLayout="column"> - <label for="structureName">Email de la structure</label> - <div fxLayout="row" fxLayoutGap="13px"> - <input type="text" (input)="setValidationsForm()" formControlName="contactMail" class="form-input" /> - <app-svg-icon - *ngIf="getStructureControl('contactMail').valid" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'validate'" - ></app-svg-icon> - <app-svg-icon - *ngIf="getStructureControl('contactMail').invalid && getStructureControl('contactMail').value" - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - ></app-svg-icon> - </div> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureType" class="page" fxLayout="column"> - <div class="title"> - <h3>Quel type de structure ?</h3> - <p>1 seul choix possible</p> - </div> - <p class="missing-information" *ngIf="isEditMode && !getStructureControl('structureType').valid"> - <app-svg-icon - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - class="validationIcon" - ></app-svg-icon> - <span>Il faut renseigner un champ</span> - </p> - <div class="type-picker"> - <app-structure-type-picker - [pickedChoice]=" - getStructureControl('structureType').valid ? getStructureControl('structureType').value : null - " - (selectedType)="setTypeStructure($event)" - ></app-structure-type-picker> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureAccessModality" class="page"> - <div class="title"> - <h3>Quelles sont les modalités d'accueil de la structure ?</h3> - <p>Plusieurs choix possibles</p> - </div> - <p class="missing-information" *ngIf="isEditMode && !getStructureControl('accessModality').valid"> - <app-svg-icon - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - class="validationIcon" - ></app-svg-icon> - <span>Il faut renseigner au moins un champ</span> - </p> - <div - *ngIf="accessModality" - fxLayout="row wrap" - fxLayoutGap="16px" - fxLayoutAlign="flex-start" - class="welcomingTerms" - > - <app-checkbox-form - *ngFor="let module of accessModality.modules" - [isChecked]="isInArray(module.id, accessModality.id)" - [text]="module.text" - [iconSvg]="module.id" - (checkEvent)="onCheckChange($event, accessModality.id, module.id)" - > - </app-checkbox-form> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureHours" class="page"> - <div class="section"> - <div class="title"> - <h3>Quels sont les horaires d'ouverture de la structure ?</h3> - <p class="notRequired">Facultatif</p> - </div> - <app-hour-picker - *ngIf="hoursForm" - (updateForm)="updateHours($event)" - (updateFormError)="setHoursError()" - [structureInput]="hoursForm" - ></app-hour-picker> - </div> - <div> - <div class="title"> - <h3>Avez-vous des précisions à apporter sur les horaires ?</h3> - <p class="notRequired">Facultatif</p> - </div> - <div class="textareaBlock" fxLayout="column"> - <textarea - rows="8" - placeholder="Exemple : nous ne sommes ouvert que le 1er mercredi du mois." - maxlength="500" - formControlName="exceptionalClosures" - ></textarea> - <p> - {{ - getStructureControl('exceptionalClosures').value - ? getStructureControl('exceptionalClosures').value.length - : 0 - }} / 500 - </p> - </div> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structurePmr" class="page"> - <div class="title"> - <h3>La structure est-elle accessible pour les personnes à mobilité réduite ?</h3> - </div> - <p class="missing-information" *ngIf="isEditMode && !getStructureControl('pmrAccess').valid"> - <app-svg-icon - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - class="validationIcon" - ></app-svg-icon> - <span>Il faut renseigner un champ</span> - </p> - <app-radio-form - [selectedOption]="getStructureControl('pmrAccess').value" - (selectedEvent)="onRadioBtnChange('pmrAccess', $event)" - > - </app-radio-form> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureWebAndSocialNetwork" class="page"> - <div class="title"> - <h3>Comment vous trouver la structure sur internet ?</h3> - <p class="notRequired">Facultatif</p> - </div> - <div class="collapse" [ngClass]="{ notCollapsed: !showWebsite }"> - <div fxLayout="column"> - <div class="collapseHeader" fxLayout="row" fxLayoutAlign=" center" (click)="toggleWebSite()"> - <div class="titleCollapse"> - <p [ngClass]="{ show: showWebsite, hide: !showWebsite }" class="no-margin">J'ajoute un site web</p> - <p [ngClass]="{ show: !showWebsite, hide: showWebsite }" class="no-margin">Je retire un site web</p> - </div> - <div class="logo"> - <svg class="show" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use> - </svg> - <svg class="hide" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use> - </svg> - </div> - </div> - <div *ngIf="showWebsite" class="inputSection"> - <div class="form-group website" fxLayout="column"> - <label for="website">Adresse du site web</label> - <div fxLayout="row" fxLayoutGap="7px"> - <input - type="text" - placeholder="www.resin.grandlyon.com" - (input)="setValidationsForm()" - formControlName="website" - class="form-input" - /> - <app-svg-icon - *ngIf="getStructureControl('website').valid && getStructureControl('website').value" - [iconClass]="'icon-26'" - [type]="'form'" - [icon]="'validate'" - class="validationIcon" - ></app-svg-icon> - <app-svg-icon - *ngIf="getStructureControl('website').invalid" - [iconClass]="'icon-26'" - [type]="'form'" - [icon]="'notValidate'" - class="validationIcon" - ></app-svg-icon> - </div> - </div> - </div> - </div> - </div> - <div class="collapse" [ngClass]="{ notCollapsed: !showSocialNetwork }"> - <div fxLayout="column"> - <div class="collapseHeader" fxLayout="row" fxLayoutAlign=" center" (click)="toggleSocialNetwork()"> - <div class="titleCollapse"> - <p [ngClass]="{ show: showSocialNetwork, hide: !showSocialNetwork }" class="no-margin"> - J’ajoute les réseaux sociaux - </p> - <p [ngClass]="{ show: !showSocialNetwork, hide: showSocialNetwork }" class="no-margin"> - Je retire des réseaux sociaux - </p> - </div> - <div class="logo"> - <svg class="show" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use> - </svg> - <svg class="hide" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use> - </svg> - </div> - </div> - <div *ngIf="showSocialNetwork" class="inputSection"> - <div class="form-group facebook"> - <div fxLayout="row" fxLayoutGap="7px"> - <svg class="facebook" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#facebook'"></use> - </svg> - <input - type="text" - (input)="setValidationsForm()" - placeholder="facebook.com/resin" - formControlName="facebook" - class="form-input withIcon" - /> - <app-svg-icon - *ngIf=" - getStructureControl('facebook').valid && - getStructureControl('facebook').value != null && - getStructureControl('facebook').value != '' - " - [iconClass]="'icon-26'" - [type]="'form'" - [icon]="'validate'" - class="validationIcon" - ></app-svg-icon> - <app-svg-icon - *ngIf="getStructureControl('facebook').invalid" - [iconClass]="'icon-26'" - [type]="'form'" - [icon]="'notValidate'" - class="validationIcon" - ></app-svg-icon> - </div> - </div> - <div class="form-group twitter"> - <div fxLayout="row" fxLayoutGap="7px"> - <svg class="twitter" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#twitter'"></use> - </svg> - <input - type="text" - (input)="setValidationsForm()" - placeholder="twitter.com/resin" - formControlName="twitter" - class="form-input withIcon" - /> - <app-svg-icon - *ngIf=" - getStructureControl('twitter').valid && - getStructureControl('twitter').value != null && - getStructureControl('twitter').value != '' - " - [iconClass]="'icon-26'" - [type]="'form'" - [icon]="'validate'" - class="validationIcon" - ></app-svg-icon> - <app-svg-icon - *ngIf="getStructureControl('twitter').invalid" - [iconClass]="'icon-26'" - [type]="'form'" - [icon]="'notValidate'" - class="validationIcon" - ></app-svg-icon> - </div> - </div> - <div class="form-group instagram"> - <div fxLayout="row" fxLayoutGap="7px"> - <svg class="instagram" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#instagram'"></use> - </svg> - <input - type="text" - (input)="setValidationsForm()" - formControlName="instagram" - placeholder="instagram.com/resin" - class="form-input withIcon" - /> - - <app-svg-icon - *ngIf=" - getStructureControl('instagram').valid && - getStructureControl('instagram').value != null && - getStructureControl('instagram').value != '' - " - [iconClass]="'icon-26'" - [type]="'form'" - [icon]="'validate'" - class="validationIcon" - ></app-svg-icon> - <app-svg-icon - *ngIf="getStructureControl('instagram').invalid" - [iconClass]="'icon-26'" - [type]="'form'" - [icon]="'notValidate'" - class="validationIcon" - ></app-svg-icon> - </div> - </div> - <div class="form-group linkedin"> - <div fxLayout="row" fxLayoutGap="7px"> - <svg class="linkedin" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#linkedin'"></use> - </svg> - <input - type="text" - (input)="setValidationsForm()" - formControlName="linkedin" - placeholder="linkedin.com/in/resin" - class="form-input withIcon" - /> - <app-svg-icon - *ngIf=" - getStructureControl('linkedin').valid && - getStructureControl('linkedin').value != null && - getStructureControl('linkedin').value != '' - " - [iconClass]="'icon-26'" - [type]="'form'" - [icon]="'validate'" - class="validationIcon" - ></app-svg-icon> - <app-svg-icon - *ngIf="getStructureControl('linkedin').invalid" - [iconClass]="'icon-26'" - [type]="'form'" - [icon]="'notValidate'" - class="validationIcon" - ></app-svg-icon> - </div> - </div> - </div> - </div> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structurePublicTarget" class="page"> - <div class="title"> - <h3>Quel public peut être accueilli dans cette structure ?</h3> - <p>Plusieurs choix possibles</p> - </div> - <p class="missing-information" *ngIf="isEditMode && !getStructureControl('publics').valid"> - <app-svg-icon - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - class="validationIcon" - ></app-svg-icon> - <span>Il faut renseigner au moins un champ</span> - </p> - <div class="tags" *ngIf="publics"> - <button - *ngFor="let choice of publics.modules" - (click)="updateChoice(choice.id, 'publics')" - [ngClass]="{ selectedChoice: isInArray(choice.id, 'publics') }" - > - <div fxLayout="row" fxLayoutAlign="center"> - <svg class="validate" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#checkVector'"></use> - </svg> - <div class="textBtn"> - {{ choice.text }} - </div> - </div> - </button> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureAccompaniment" class="page"> - <div class="title"> - <h3>Quel(s) accompagnement(s) proposez-vous ?</h3> - <p class="notRequired">Facultatif</p> - </div> - <div class="collapse" [ngClass]="{ notCollapsed: !showProceduresAccompaniment }"> - <div fxLayout="column"> - <div - class="collapseHeader" - fxLayout="row" - fxLayoutGap="20px" - fxLayoutAlign=" center" - (click)="toggleProceduresAccompaniment()" - > - <div class="titleCollapse">Démarches en ligne</div> - <div class="logo"> - <svg class="show" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use> - </svg> - <svg class="hide" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use> - </svg> - </div> - </div> - <div *ngIf="showProceduresAccompaniment && publics" class="tags"> - <button - *ngFor="let choice of proceduresAccompaniment.modules" - (click)="updateChoice(choice.id, 'proceduresAccompaniment')" - [ngClass]="{ selectedChoice: isInArray(choice.id, 'proceduresAccompaniment') }" - > - <div fxLayout="row" fxLayoutAlign=" center"> - <svg class="validate" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#checkVector'"></use> - </svg> - <div class="textBtn"> - {{ choice.text }} - </div> - </div> - </button> - </div> - </div> - </div> - <div class="collapse" [ngClass]="{ notCollapsed: !showPublicsAccompaniment }"> - <div fxLayout="column"> - <div - class="collapseHeader" - fxLayout="row" - fxLayoutGap="20px" - fxLayoutAlign=" center" - (click)="togglePublicsAccompaniment()" - > - <div class="titleCollapse">Publics spécifiques (handicap...) ?</div> - <div class="logo"> - <svg class="show" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use> - </svg> - <svg class="hide" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use> - </svg> - </div> - </div> - <div *ngIf="showPublicsAccompaniment && publics" class="tags"> - <button - *ngFor="let choice of publicsAccompaniment.modules" - (click)="updateChoice(choice.id, 'publicsAccompaniment')" - [ngClass]="{ selectedChoice: isInArray(choice.id, 'publicsAccompaniment') }" - > - <div fxLayout="row" fxLayoutAlign=" center"> - <svg class="validate" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#checkVector'"></use> - </svg> - <div class="textBtn"> - {{ choice.text }} - </div> - </div> - </button> - </div> - </div> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureOtherAccompaniment" class="page"> - <div class="title"> - <h3>Quelles sont les autres démarches ?</h3> - </div> - <div class="textareaBlock procedureContainer" fxLayout="column"> - <textarea - rows="8" - placeholder="Exemple : tout ce qui est en lien avec la création d'entreprise..." - maxlength="500" - formControlName="otherDescription" - (input)="setValidationsForm()" - ></textarea> - <p> - {{ - getStructureControl('otherDescription').value ? getStructureControl('otherDescription').value.length : 0 - }} - / 500 - </p> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureRemoteAccompaniment" class="page"> - <div class="title"> - <h3>Proposez vous un accompagnement à distance ?</h3> - </div> - <p class="missing-information" *ngIf="isEditMode && !getStructureControl('remoteAccompaniment').valid"> - <app-svg-icon - [iconClass]="'validation'" - [type]="'form'" - [icon]="'notValidate'" - class="validationIcon" - ></app-svg-icon> - <span>Il faut renseigner un champ</span> - </p> - <app-radio-form - [selectedOption]="getStructureControl('remoteAccompaniment').value" - (selectedEvent)="onRadioBtnChange('remoteAccompaniment', $event)" - > - </app-radio-form> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureWorkshop" class="page"> - <div class="title"> - <h3>Quelles formations au numérique sont proposées ?</h3> - <p class="notRequired">Facultatif</p> - </div> - <div class="collapse" *ngFor="let categ of trainingCategories" [ngClass]="{ notCollapsed: !categ.openned }"> - <div fxLayout="column"> - <div - class="collapseHeader" - fxLayout="row" - fxLayoutGap="20px" - fxLayoutAlign=" center" - (click)="toggleTrainingCategories(categ)" - > - <div class="titleCollapse">{{ categ.category.name }}</div> - <div class="logo"> - <svg class="show" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use> - </svg> - <svg class="hide" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use> - </svg> - </div> - </div> - <div *ngIf="categ.openned" class="tags"> - <button - *ngFor="let choice of categ.category.modules" - (click)="updateChoice(choice.id, categ.category.id)" - [ngClass]="{ selectedChoice: isInArray(choice.id, categ.category.id) }" - > - <div fxLayout="row" fxLayoutAlign=" center"> - <svg class="validate" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#checkVector'"></use> - </svg> - <div class="textBtn"> - {{ choice.text }} - </div> - </div> - </button> - </div> - </div> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureWorkshopPrice" class="page"> - <div class="title"> - <h3>Ces ateliers sont-ils gratuits ?</h3> - </div> - <app-radio-form - [selectedOption]="getStructureControl('freeWorkShop').value" - (selectedEvent)="onRadioBtnChange('freeWorkShop', $event)" - > - </app-radio-form> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureWifi" class="page"> - <div class="title"> - <h3>Le wifi est-il proposé en accès libre ?</h3> - </div> - <app-radio-form - [selectedOption]="isEditMode ? isInArray('wifiEnAccesLibre', 'equipmentsAndServices') : null" - (selectedEvent)="onCheckChange($event, 'equipmentsAndServices', 'wifiEnAccesLibre')" - > - </app-radio-form> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureEquipments" class="page"> - <div class="title"> - <h3>Quel matériel est mis à disposition par la structure ?</h3> - <p class="notRequired">Facultatif</p> - </div> - <ng-container *ngFor="let equipment of equipmentsAndServices"> - <div - class="controller equipments" - *ngIf=" - ['ordinateurs', 'tablettes', 'bornesNumeriques', 'imprimantes', 'scanners'].includes(equipment.module.id) - " - > - <div fxLayout="column"> - <div class="contorllerHeader" fxLayout="row" fxLayoutAlign="space-between center"> - <div class="flex-item"> - <p class="no-margin">Nombre de {{ equipment.module.text | lowercase }}</p> - </div> - <div class="inputSection flex-item equipments" fxLayout="row" fxLayoutAlign="center center"> - <ng-container *ngIf="equipment.module.id == 'ordinateurs'"> - <svg - class="hide" - aria-hidden="true" - (click)="changeValueHandler(equipment.module.id, -1)" - [ngClass]="{ disabled: structureForm.value.nbComputers === 0 }" - > - <use [attr.xlink:href]="'assets/form/sprite.svg#minus'"></use> - </svg> - <input - type="number" - (input)="setValidationsForm()" - formControlName="nbComputers" - min="0" - class="form-input nbEquipment" - [(value)]="structureForm.value.nbComputers" - /> - </ng-container> - <ng-container *ngIf="equipment.module.id == 'tablettes'"> - <svg - class="hide" - aria-hidden="true" - (click)="changeValueHandler(equipment.module.id, -1)" - [ngClass]="{ disabled: structureForm.value.nbTablets === 0 }" - > - <use [attr.xlink:href]="'assets/form/sprite.svg#minus'"></use> - </svg> - <input - type="number" - (input)="setValidationsForm()" - formControlName="nbTablets" - min="0" - class="form-input nbEquipment" - [(value)]="structureForm.value.nbTablets" - /> - </ng-container> - <ng-container *ngIf="equipment.module.id == 'imprimantes'"> - <svg - class="hide" - aria-hidden="true" - (click)="changeValueHandler(equipment.module.id, -1)" - [ngClass]="{ disabled: structureForm.value.nbPrinters === 0 }" - > - <use [attr.xlink:href]="'assets/form/sprite.svg#minus'"></use> - </svg> - <input - type="number" - (input)="setValidationsForm()" - formControlName="nbPrinters" - min="0" - class="form-input nbEquipment" - [(value)]="structureForm.value.nbPrinters" - /> - </ng-container> - <ng-container *ngIf="equipment.module.id == 'bornesNumeriques'"> - <svg - class="hide" - aria-hidden="true" - (click)="changeValueHandler(equipment.module.id, -1)" - [ngClass]="{ disabled: structureForm.value.nbNumericTerminal === 0 }" - > - <use [attr.xlink:href]="'assets/form/sprite.svg#minus'"></use> - </svg> - <input - type="number" - (input)="setValidationsForm()" - formControlName="nbNumericTerminal" - min="0" - class="form-input nbEquipment" - [(value)]="structureForm.value.nbNumericTerminal" - /> - </ng-container> - <ng-container *ngIf="equipment.module.id == 'scanners'"> - <svg - class="hide" - aria-hidden="true" - (click)="changeValueHandler(equipment.module.id, -1)" - [ngClass]="{ disabled: structureForm.value.nbScanners === 0 }" - > - <use [attr.xlink:href]="'assets/form/sprite.svg#minus'"></use> - </svg> - <input - type="number" - (input)="setValidationsForm()" - formControlName="nbScanners" - min="0" - class="form-input nbEquipment" - [(value)]="structureForm.value.nbScanners" - /> - </ng-container> - <svg class="show" aria-hidden="true" (click)="changeValueHandler(equipment.module.id, 1)"> - <use [attr.xlink:href]="'assets/form/sprite.svg#plus'"></use> - </svg> - </div> - </div> - </div> - </div> - </ng-container> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureLabels" class="page"> - <div class="title"> - <h3>La sturcture est labellisée ?</h3> - <p class="notRequired">Facultatif</p> - </div> - <div class="labelsQualifications" *ngIf="labelsQualifications" fxLayout="row wrap" fxLayoutAlign="flex-start"> - <app-checkbox-form - *ngFor="let module of labelsQualifications.modules" - [isChecked]="isInArray(module.id, labelsQualifications.id)" - [text]="module.text" - [iconSvg]="module.id" - [iconType]="'labels'" - (checkEvent)="onCheckChange($event, labelsQualifications.id, module.id)" - > - </app-checkbox-form> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureOtherServices" class="page"> - <div class="title"> - <h3>Quels autres services sont proposées par la structure ?</h3> - <p class="notRequired">Facultatif</p> - </div> - <div - *ngIf="labelsQualifications" - fxLayout="row wrap" - fxLayoutGap="16px" - fxLayoutAlign="flex-start" - class="otherServices" - > - <ng-container *ngFor="let equipment of equipmentsAndServices"> - <app-checkbox-form - *ngIf=" - [ - 'donDeMateriels', - 'reconditionnementsDeMateriel', - 'accesLivresInformatiques', - 'venteMaterielPrixSolidaire' - ].includes(equipment.module.id) - " - [isChecked]="isInArray(equipment.module.id, 'equipmentsAndServices')" - [text]="equipment.module.text" - [iconSvg]="equipment.module.id" - (checkEvent)="onCheckChange($event, 'equipmentsAndServices', equipment.module.id)" - > - </app-checkbox-form> - </ng-container> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureDescription" class="page"> - <div class="title"> - <h3>Pouvez-vous présentez votre structure en quelques mots ?</h3> - <p class="notRequired">Facultatif</p> - </div> - <div class="textareaBlock introduceStructure" fxLayout="column"> - <textarea - rows="8" - placeholder="Exemple : nous sommes une équipe de 7 bénévoles qui orientons les personnes pour qui le numérique est une langue étrangère" - maxlength="500" - formControlName="description" - ></textarea> - <p> - {{ - getStructureControl('description').value ? getStructureControl('description').value.length : 0 - }} / 500 - </p> - </div> - </div> - <div *ngIf="currentPage == pageTypeEnum.structureCovidInfo" class="page"> - <div class="title"> - <h3>Y a-t-il des informations spécifiques à la période COVID ?</h3> - <p class="notRequired">Facultatif</p> - </div> - <div class="textareaBlock" fxLayout="column"> - <textarea - rows="8" - placeholder="Exemple : nous ne sommes joignables que par visio" - maxlength="500" - formControlName="lockdownActivity" - ></textarea> - <p> - {{ - getStructureControl('lockdownActivity').value ? getStructureControl('lockdownActivity').value.length : 0 - }} / 500 - </p> - </div> - </div> - </form> - <form> - <div *ngIf="currentPage == pageTypeEnum.cgu" class="page cgu"> - <div class="section" *ngIf="!isEditMode"> - <div class="title"> - <h3> - Acceptez-vous que les informations saisies soient enregistrées par la Métropole de Lyon<span - class="asterisk" - >*</span - > - ? - </h3> - </div> - <app-checkbox-form - [isChecked]="userAcceptSavedDate" - [text]="'J\'accepte'" - (checkEvent)="acceptDataBeSaved($event)" - > - </app-checkbox-form> - </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> - <app-checkbox-form - *ngIf="!isEditMode" - [text]="'J\'accepte'" - (checkEvent)="acceptOpenData($event)" - ></app-checkbox-form> - <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)" - > - </app-radio-form> - </div> - </div> - <div *ngIf="!profile"> - <div class="title"> - <h3>Souhaitez-vous vous abonner à la lettre d’information de Res'in ?</h3> - <p class="notRequired" *ngIf="!isEditMode">Facultatif</p> - </div> - <app-checkbox-form - [isChecked]="userAcceptNewsletter" - [text]="'J\'accepte'" - (checkEvent)="acceptReceiveNewsletter($event)" - > - </app-checkbox-form> - </div> - <p *ngIf="!isEditMode" class="informationEndForm"> - <span class="asterisk">*</span> Les informations recueillies sont enregistrées dans un fichier par la - Métropole de Lyon en vue de l'animation du réseau des acteurs de la médiation numérique. Elles sont conservées - pendant 24 mois et sont destinées aux seuls intervenants habilités de la Métropole de Lyon.<br /> - Vos données personnelles sont traitées dans ce cadre aux fins de recensement des actions de médiation - numérique sur le territoire de la métropole. Conformément à la loi 78-17 du 6 janvier 1978 modifiée relative à - l'information, aux fichiers et aux libertés, et au Règlement Général européen à la Protection des Données, - vous avez la possibilité d’exercer vos droits d’accès, de rectification, d’effacement, d’opposition, de - limitation du traitement et de révocation de votre consentement. Afin d'exercer vos droits, vous pouvez vous - adresser : <br /> - - par courrier postal à : Métropole de Lyon - Direction des Affaires Juridiques et de la Commande Publique - - 20, rue du Lac - BP 33569 - 69505 Lyon Cedex<br /> - - par courrier électronique en remplissant le formulaire dédié sur Toodego, le site des services et démarches - en ligne dans la Métropole de Lyon - </p> - <p class="informationEndForm" *ngIf="currentPage == pageTypeEnum.cgu"> - <span class="asterisk" *ngIf="!isEditMode">**</span><span class="asterisk" *ngIf="isEditMode">*</span> La - Métropole de Lyon, engagée pour la transparence de l’action publique et la valorisation de ses partenaires, - encourage l’ouverture des données. Les données de votre structure seront publiées sur la plateforme - <a href="https://data.grandlyon.com/" target="_blank">https://data.grandlyon.com/</a> sous la licence ouverte - (open data) et seront donc librement accessibles et réutilisables. Vous pourrez modifier votre choix à tout - moment, exercer vos droits d’accès et de modification, en le signifiant, par tout moyen à votre convenance, - auprès de vos interlocuteurs de la Métropole de Lyon. - </p> - </div> - </form> - <div - *ngIf="currentPage == nbPagesForm && !profile" - class="page" - fxLayout="column" - fxLayoutAlign="center center" - fxLayoutGap="69px" - > - <img src="../../assets/form/emailVerification.svg" alt="Image de validation du courriel" /> - <h3>Un courriel vous a été envoyé afin de valider votre inscription</h3> - </div> - <div *ngIf="currentPage == nbPagesForm && profile && !isEditMode" class="lastPage"> - <div class="lastPage"> - <div class="title"> - <h3> - Bravo !<br /> - Votre structure a bien été référencée. - </h3> - </div> - - <div class="structureInfoBlock" fxLayout="row" fxLayoutAlign="center"> - <div class="structureInfoContent" fxLayout="column"> - {{ getStructureControl('structureName').value }} - <span>{{ getStructureControl('structureType').value }}</span> - </div> - <div class="validateSvg"> - <svg class="validate" aria-hidden="true"> - <use [attr.xlink:href]="'assets/form/sprite.svg#checkVector'"></use> - </svg> - </div> - </div> - </div> - </div> - <div *ngIf="currentPage != 0" class="footer desktop"> - <div fxLayout="row" fxLayoutAlign="center center" *ngIf="currentPage != nbPagesForm && !isEditMode"> - <app-footer-form - [btnName]="['Précédent', 'Suivant']" - (previousPage)="previousPage()" - (nextPage)="nextPage()" - [isValid]="isPageValid" - ></app-footer-form> - </div> - <div fxLayout="row" fxLayoutAlign="center center" *ngIf="isEditMode"> - <button - class="btn-primary" - [ngClass]="{ invalid: !isPageValid }" - [disabled]="!isPageValid" - (click)="goToSpecificPage(0, true)" - > - Valider - </button> - </div> - <button - *ngIf="currentPage == nbPagesForm && !profile" - class="btn-primary validate unique" - routerLink="/acteurs" - [routerLinkActive]="'active'" - > - Ok - </button> - <button - *ngIf="currentPage == nbPagesForm && profile && !isEditMode" - class="btn-primary unique" - routerLink="/acteurs" - [queryParams]="{ id: createdStructure._id }" - [state]="{ data: createdStructure }" - > - Voir ma structure - </button> - </div> - <div *ngIf="isEditMode && currentPage == 0" class="footerEditMode"> - <div fxLayout="row" fxLayoutAlign="center center"> - <button class="btn-primary unique" (click)="closeEditMode()">Terminer</button> - </div> - </div> - </div> - <div *ngIf="currentPage != 0" class="footer phone"> - <div fxLayout="row" fxLayoutAlign="center center" *ngIf="currentPage != nbPagesForm && !isEditMode"> - <app-footer-form - [btnName]="['Précédent', 'Suivant']" - (previousPage)="previousPage()" - (nextPage)="nextPage()" - [isValid]="isPageValid" - ></app-footer-form> - </div> - <div fxLayout="row" fxLayoutAlign="center center" *ngIf="isEditMode"> - <button - class="btn-primary" - [ngClass]="{ invalid: !isPageValid }" - [disabled]="!isPageValid" - (click)="goToSpecificPage(0, true)" - > - Valider - </button> - </div> - <button - *ngIf="currentPage == nbPagesForm && !profile" - class="btn-primary validate unique" - routerLink="/acteurs" - [routerLinkActive]="'active'" - > - Ok - </button> - <button - *ngIf="currentPage == nbPagesForm && profile" - class="btn-primary unique" - routerLink="/acteurs" - [queryParams]="{ id: createdStructure._id }" - [state]="{ data: createdStructure }" - > - Voir ma structure - </button> - </div> -</div> diff --git a/src/app/form/structure-form/form.component.scss b/src/app/form/structure-form/form.component.scss deleted file mode 100644 index b9e9e2ff6..000000000 --- a/src/app/form/structure-form/form.component.scss +++ /dev/null @@ -1,665 +0,0 @@ -@import '../../../assets/scss/layout'; -@import '../../../assets/scss/breakpoint'; -@import '../../../assets/scss/color'; -@import '../../../assets/scss/typography'; -@import '../../../assets/scss/shapes'; -@import '../../../assets/scss/z-index'; - -.disabled { - opacity: 0.4; - cursor: not-allowed; -} - -h3 { - margin: 0; -} - -h4 { - margin-bottom: 16px; -} - -.form { - background: $grey-7; - width: 100vw; - height: calc(var(--vh, 1vh) * 100 - #{$header-height}); - top: #{$header-height}; - z-index: $structure-details-z-index; - @media #{$tablet} { - height: calc(var(--vh, 1vh) * 100 - #{$header-height}); - position: fixed; //Hide default header app. - } -} - -.footer { - width: 100%; - max-width: 980px; - margin: 20px auto; - text-align: center; - &.desktop { - @media #{$tablet} { - display: none; - } - } - - &.phone { - display: none; - @media #{$tablet} { - margin: 0 auto; - //border-top: 1px solid $grey-4; - display: block; - } - } -} -.header { - height: #{$header-height-phone}; - line-height: #{$header-height-phone}; - display: none; - align-items: center; - justify-content: space-between; - text-align: center; - border-bottom: solid 1px $grey-4; - background-color: $grey-1; - color: $white; - padding: 0 20px; - @media #{$tablet} { - display: block !important; - } - .container-icoMenu { - width: 100%; - position: absolute; - height: 50px; - - .block-iconMenu { - right: 44px; - width: 50px; - height: 50px; - position: absolute; - } - .ico-menu { - right: 13px; - top: 24px; - background: $white; - &::after { - background: $white; - } - &::before { - background: $white; - } - } - } -} -.content { - .editHome { - height: calc( - 100vh - #{$header-height} - #{$footer-height} - 81px - 1px - 55px - 48px - ) !important; // -1px because of header border - } - @media #{$tablet} { - &.editMode { - .page { - height: calc( - 100vh - #{$header-height-phone} - #{$footer-height-phone} - 87px - 1px - ); // -1px because of header border - } - .editHome { - height: unset !important; // -1px because of header border - margin-bottom: 80px; - } - } - } - padding: 0 16px; - display: block; - overflow-y: auto; - height: auto; - h2 { - @include lato-bold-26; - color: $black; - margin-bottom: 0; - span { - color: $primary-color; - } - } - h3 { - @include lato-bold-26; - - @media #{$tablet} { - @include lato-bold-22; - } - } - .page { - max-width: 980px; - box-sizing: border-box; - margin: auto; - min-height: 450px; - max-height: 75vh; - overflow-y: auto; - color: $grey-1; - background: $white; - border-radius: 8px; - border: 1px solid $grey-6; - padding: 32px 24px 32px 48px; - * { - max-width: 600px; - } - &.home { - .btnStart { - margin-top: 90px; - margin-bottom: 10px; - text-align: center; - } - } - &.informations { - ul { - padding-left: 24px; - li::marker { - color: $primary-color; - font-size: 26px; - } - li > * { - vertical-align: text-bottom; - } - li { - @include lato-regular-18; - line-height: 24px; - margin: 10px 0; - } - } - } - .title { - margin-bottom: 16px; - } - .nextTitle { - margin-bottom: 10px; - margin-top: 10px; - } - .type-picker { - height: 100%; - } - .welcomingTerms, - .procedureContainer, - .otherServices, - .textareaBlock { - max-width: 600px; - } - .labelsQualifications { - gap: 0 8px; - } - } - .titleDesc { - @include lato-bold-20; - margin-bottom: 20px; - } - p { - color: $grey-1; - @include lato-regular-14; - margin: 7px 0 0 0; - &.special { - @include lato-regular-14; - color: $grey-3; - - margin-top: 4px; - width: 280px; - &.invalid { - color: $orange-warning; - } - } - &.informationEndForm { - margin-top: 18px; - color: $grey-2; - @include lato-regular-14; - a { - color: $default-link-color; - text-decoration: underline; - font-weight: bold; - } - } - &.notRequired { - @include lato-regular-18; - color: $grey-3; - font-style: italic; - margin-top: 4px; - } - } - .passwordInfo { - @include lato-regular-14; - font-style: italic; - color: $grey-3; - } - .textareaBlock { - @media #{$tablet} { - max-width: 90%; - } - p { - text-align: right; - @include lato-regular-14; - color: $grey-3; - font-style: italic; - } - } -} - -.btn-primary { - &.previous { - background-color: initial; - color: $grey-2; - width: 120px; - border-radius: 6px; - border: 1px solid $grey-4; - } - &.start { - margin-bottom: 26px; - } -} -.chevronRight { - height: 24px; - width: 24px; - stroke: $grey-2; - margin-left: 10px; -} -.chevronLeft { - height: 24px; - width: 24px; - stroke: $black; - margin-right: 10px; -} -.form-group { - &.facebook, - &.twitter, - &.instagram, - &.linkedin, - &.website, - &.equipments { - div { - height: 52px; - .validationIcon { - margin-right: -53px; - } - } - } - div { - height: 44px; - } - ul { - padding-left: 0; - li { - display: flex; - margin-left: 1%; - font-size: $font-size-xsmall; - align-items: center; - p { - margin-left: 10px; - margin-top: unset; - @include lato-regular-14; - } - &.valid { - color: $green; - } - &.invalid { - color: $orange-warning; - p { - color: $orange-warning; - } - } - } - } - .addressRow { - height: auto; - .validateIcon { - height: 38px !important; - } - } -} - -input { - &.email-placeholder::placeholder { - color: $white; - font-style: italic; - } - &.phone { - width: 205px; - } - &.password { - width: 256px; - } - &.structureName { - width: 250px; - } -} -img { - max-height: 340px; - &.eyePassword { - cursor: pointer; - &:hover { - opacity: 0.8; - } - } -} - -//section equipments controller -.controller { - border: 1px solid $grey-5; - border-radius: 4px; - margin-bottom: 13px; - max-width: 600px; - @media #{$small-phone} { - width: 95% !important; - } - @media #{$tablet} { - width: 296px; - } - .contorllerHeader { - height: 65px; - padding: 0 15px 0 12px; - p { - @include lato-bold-14; - } - } - .equipments { - svg { - width: 32px; - height: 32px; - background-color: $grey-8; - border-radius: 50%; - cursor: pointer; - } - input { - width: 56px; - margin: 0 6px; - } - input::-webkit-outer-spin-button, - input::-webkit-inner-spin-button { - -webkit-appearance: none; - margin: 0; - } - input[type='number'] { - -moz-appearance: textfield; - } - } -} - -// collapse -.collapse { - border: 1px solid $grey-5; - border-radius: 4px; - margin-bottom: 13px; - max-width: 600px; - @media #{$small-phone} { - width: 95% !important; - } - @media #{$tablet} { - width: 296px; - } - &.notCollapsed { - margin-bottom: 8px; - background: $grey-8; - .logo { - .hide { - display: none; - } - .show { - display: block; - } - } - } - .form-group { - margin: 0; - color: $grey-2; - @include lato-regular-14; - &.website, - &.facebook, - &.twitter, - &.instagram, - &.linkedin { - svg { - height: 22px; - width: 22px; - padding: 6px; - } - &:focus-within { - input { - border-color: $grey-3; - fill: $primary-color; - } - } - } - app-svg-icon { - padding-top: 12px; - margin-right: 0 !important; - } - &.website { - &:focus-within { - svg { - &.website { - border-color: $grey-3; - fill: $primary-color; - } - } - } - } - &.facebook { - &:focus-within { - svg { - &.facebook { - border-color: $grey-3; - fill: $primary-color; - } - } - } - } - &.instagram { - &:focus-within { - svg { - &.instagram { - border-color: $grey-3; - fill: $primary-color; - } - } - } - } - &.twitter { - &:focus-within { - svg { - &.twitter { - border-color: $grey-3; - fill: $primary-color; - } - } - } - } - &.linkedin { - &:focus-within { - svg { - &.linkedin { - border-color: $grey-3; - fill: $primary-color; - } - } - } - } - } - .inputSection { - input { - width: 100%; - margin-top: 8px; - &.withIcon { - border-radius: 0 4px 4px 0; - border-left: 0; - } - } - padding: 0px 15px 19px 12px; - svg { - margin-top: 8px; - width: 22px; - height: 38px; - fill: $grey-3; - margin-right: 0 !important; - border: 1px solid $grey-5; - border-radius: 4px 0 0 4px; - border-right: 0; - padding-left: 16px; - background: $grey-8; - } - } - .titleCollapse { - width: 100%; - @include lato-bold-16; - color: $grey-2; - p { - color: $grey-2; - @include lato-bold-16; - } - } - .collapseHeader { - height: 65px; - padding: 0 15px 0 12px; - cursor: pointer; - } - .logo { - height: 24px; - width: 24px; - svg { - width: 100%; - height: 100%; - fill: $grey-1; - } - } - .logo, - .titleCollapse { - .hide { - display: block; - } - .show { - display: none; - } - } -} - -.tags { - padding: 8px; - button { - background: $grey-8; - border-radius: 20px; - margin: 4px; - max-width: 100%; - height: 40px; - padding: 0 13px; - @include lato-bold-14; - outline: none; - border: none; - cursor: pointer; - &.selectedChoice { - background: $green-1 !important; - color: $white; - } - } - svg { - width: 20px; - height: 10px; - margin-right: 4px; - stroke: $grey-8; - } -} -.textBtn { - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - display: -webkit-box; - -webkit-box-orient: vertical; - width: 100%; - margin-right: 12px; -} - -.cgu { - h3 { - @include lato-bold-18; - } - .asterisk { - color: $primary-color; - } -} - -.structureInfoBlock { - background: $green-1; - color: $white; - padding: 16px; - border-radius: 6px; - @include lato-bold-18; - .structureInfoContent { - width: 100%; - } - span { - font-style: italic; - @include lato-regular-14; - } - .validateSvg { - stroke: $white; - text-align: right; - svg { - height: 14px; - width: 14px; - } - } -} -.footerEditMode { - width: 100%; - position: fixed; - bottom: 56px; - margin: 0; - background: $white; - left: 0; - border-top: 1px solid $grey-4; - padding: 20px 0; - @media #{$tablet} { - bottom: 0; - left: 0; - } -} -.returnBtnSection { - max-width: 960px; - margin: 24px auto; -} -.itemSummary { - height: 60px; - border-bottom: 1px solid $grey-4; - @include lato-bold-20; - cursor: pointer; - &:hover { - background: $grey-8; - } - &.last { - border: 0; - } -} -.headerEditMode { - max-width: 960px; - margin: auto; - margin-top: 24px; - margin-bottom: 24px; - h2 { - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - } -} - -.lastPage { - max-width: 530px; - margin: 0 auto; -} - -.section { - padding-bottom: 2rem; -} -.dataShareConsent { - ::ng-deep button p { - font-weight: normal !important; - } -} -.missing-information { - display: flex; - color: $orange-warning; - span { - margin-top: 12px; - margin-left: 1%; - } -} diff --git a/src/app/form/structure-form/form.component.spec.ts b/src/app/form/structure-form/form.component.spec.ts deleted file mode 100644 index 24041eeed..000000000 --- a/src/app/form/structure-form/form.component.spec.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormArray, FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; -import { SharedModule } from '../../shared/shared.module'; - -import { FormComponent } from './form.component'; - -describe('FormComponent', () => { - let component: FormComponent; - let fixture: ComponentFixture<FormComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [FormComponent], - imports: [HttpClientTestingModule, FormsModule, ReactiveFormsModule, SharedModule], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(FormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - component.structureForm = new FormGroup({ - structureType: new FormArray([new FormControl('mediatheque'), new FormControl('cyber')]), - structureName: new FormControl('structure.structureName', Validators.required), - structureRepresentation: new FormControl('structure.structureRepresentation', 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), - }), - contactPhone: new FormControl('structure.contactPhone', Validators.required), - contactMail: new FormControl('structure.contactMail', Validators.required), - website: new FormControl('structure.website'), - facebook: new FormControl('structure.facebook'), - twitter: new FormControl('structure.twitter'), - instagram: new FormControl('structure.instagram'), - gender: new FormControl('structure.gender'), - contactName: new FormControl('structure.contactName'), - contactSurname: new FormControl('structure.contactSurname'), - fonction: new FormControl('structure.fonction'), - pmrAccess: new FormControl('structure.pmrAccess'), - hours: new FormGroup({ - monday: new FormGroup({ - open: new FormControl(true, Validators.required), - time: new FormArray([ - new FormGroup({ - opening: new FormControl(900, Validators.required), - closing: new FormControl(1200, Validators.required), - }), - ]), - }), - tuesday: new FormGroup({ - open: new FormControl(true, Validators.required), - time: new FormArray([]), - }), - wednesday: new FormGroup({ - open: new FormControl(true, Validators.required), - time: new FormArray([]), - }), - thursday: new FormGroup({ - open: new FormControl(true, Validators.required), - time: new FormArray([]), - }), - friday: new FormGroup({ - open: new FormControl(true, Validators.required), - time: new FormArray([]), - }), - saturday: new FormGroup({ - open: new FormControl(false, Validators.required), - time: new FormArray([]), - }), - sunday: new FormGroup({ - open: new FormControl(false, Validators.required), - time: new FormArray([]), - }), - }), - exceptionalClosures: new FormControl('structure.exceptionalClosures'), - labelsQualifications: new FormControl([]), - accessModality: new FormControl([]), - publicsAccompaniment: new FormControl([]), - equipmentsAndServices: new FormControl([]), - publics: new FormControl([]), - baseSkills: new FormControl([]), - accessRight: new FormControl([]), - parentingHelp: new FormControl([]), - socialAndProfessional: new FormControl([]), - digitalCultureSecurity: new FormControl([]), - nbComputers: new FormControl('structure.nbComputers'), - nbPrinters: new FormControl('structure.nbPrinters'), - nbTablets: new FormControl('structure.nbTablets'), - nbNumericTerminal: new FormControl('structure.nbNumericTerminal'), - equipmentsDetails: new FormControl('structure.equipmentsDetails'), - personalOffers: new FormControl([]), - }); - }); - - it('should return the correct Abstract Control', () => { - const nameControl = 'structureName'; - const control = component.getStructureControl(nameControl); - const expectControl = component.structureForm.get(nameControl); - expect(control).toEqual(expectControl); - }); - - it('should return the correct Abstract Control from address', () => { - const nameControl = 'street'; - const control = component.getAddressControl(nameControl); - const addressForm = component.structureForm.get('address').get(nameControl); - expect(control).toEqual(addressForm); - }); - it('should return the correct Time from a specific day', () => { - // const day = 'monday'; - // const control = component.getTime(day); - // const TimeForm = component.structureForm.get('hours').get(day).get('time'); - // expect(control).toEqual(TimeForm); - }); - it('should return true', () => { - // const day = 'monday'; - // const control = component.isOpen(day); - // expect(control).toEqual(true); - }); - it('should return check if value is in formArray', () => { - const nameControl = 'structureType'; - const isInArray = component.isInArray('cyber', nameControl); - const isntInArray = component.isInArray('unknowType', nameControl); - expect(isInArray).toEqual(true); - expect(isntInArray).toEqual(false); - }); -}); diff --git a/src/app/form/structure-form/form.component.ts b/src/app/form/structure-form/form.component.ts deleted file mode 100644 index a9b1b0d95..000000000 --- a/src/app/form/structure-form/form.component.ts +++ /dev/null @@ -1,1082 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { AbstractControl, FormArray, FormControl, FormGroup, Validators } from '@angular/forms'; -import { Structure } from '../../models/structure.model'; -import { Time } from '../../models/time.model'; -import { Day } from '../../models/day.model'; -import { StructureService } from '../../services/structure.service'; -import { SearchService } from '../../structure-list/services/search.service'; -import { Category } from '../../structure-list/models/category.model'; -import { CategoryEnum } from '../../shared/enum/category.enum'; -import { ProfileService } from '../../profile/services/profile.service'; -import { User } from '../../models/user.model'; -import { MustMatch } from '../../shared/validator/form'; -import { Address } from '../../models/address.model'; -import { Module } from '../../structure-list/models/module.model'; -import { Equipment } from '../../structure-list/enum/equipment.enum'; -import { ActivatedRoute, Router } from '@angular/router'; -import { AuthService } from '../../services/auth.service'; -import { first } from 'rxjs/operators'; -import { PageTypeEnum } from './pageType.enum'; -import { CustomRegExp } from '../../utils/CustomRegExp'; -import { StructureWithOwners } from '../../models/structureWithOwners.model'; -import { RouterListenerService } from '../../services/routerListener.service'; -import { NewsletterService } from '../../services/newsletter.service'; -import { Utils } from '../../utils/utils'; -//TODO: Delete whole component when form refacto is done -@Component({ - selector: 'app-structure-form', - templateUrl: './form.component.html', - styleUrls: ['./form.component.scss'], -}) -export class FormComponent implements OnInit { - public profile: User; - public createdStructure: Structure; - // Form var - public structureForm: FormGroup; - public accountForm: FormGroup; - public hoursForm: FormGroup; - public editForm: FormGroup; - public labelsQualifications: Category; - public publics: Category; - public accessModality: Category; - public publicsAccompaniment: Category; - public proceduresAccompaniment: Category; - public equipmentsAndServices: { module: Module; openned: boolean }[] = []; - public trainingCategories: { category: Category; openned: boolean }[] = []; - public pageTypeEnum = PageTypeEnum; - public claimStructure: Structure = null; - public linkedStructureId: Array<string> = null; - - // Page and progress var - public currentPage = 0; // Change this value to start on a different page for dev testing - public progressStatus = 0; - public nbPagesForm = 24; - public isPageValid: boolean; - public pagesValidation = []; - - // Collapse var - public showWebsite: boolean; - public showSocialNetwork: boolean; - public showPublicsAccompaniment: boolean; - public showProceduresAccompaniment: boolean; - - // ModalExit var - public showConfirmationModal = false; - private resolve: Function; - - // Condition form - public isShowConfirmPassword = false; - public isShowPassword = false; - public userAcceptSavedDate = false; - public userAcceptNewsletter = false; - public showMenu = false; - public isEditMode = false; - public isClaimMode = false; - public isAccountMode = false; - public isJoinMode = false; - public isLoading = false; - public isWifiChoosen = null; - public structureWithOwners: StructureWithOwners; - - public isPopUpOpen = false; - public displaySignUp = true; - - // Structure id for edit mode - public structureId: string; - // last page for edit form - public lastPage = this.pageTypeEnum.cgu; - - constructor( - private structureService: StructureService, - private searchService: SearchService, - private profileService: ProfileService, - private authService: AuthService, - private router: Router, - private route: ActivatedRoute, - private routerListener: RouterListenerService, - private newsletterService: NewsletterService, - public utils: Utils - ) {} - - async ngOnInit(): Promise<void> { - this.isLoading = true; - this.profileService.getProfile().then((user: User) => { - this.profile = user; - }); - await this.setCategories(); - // Check if it's a new structure or edit structure - this.isLoading = false; - if (history.state.newUser) { - this.isClaimMode = true; - // Handle join structure, the case is very similar to claim - if (history.state.isJoin) { - this.isJoinMode = true; - } - this.createAccountForm(); - this.claimStructure = history.state.newUser; - this.setValidationsForm(); - } else { - this.initForm(new Structure()); - } - // Handle account creation when pre-register - this.route.data.subscribe((data) => { - if (data.user) { - this.isAccountMode = true; - this.createAccountForm(data.user.email); - this.linkedStructureId = data.user.pendingStructuresLink; - this.setValidationsForm(); - this.currentPage = PageTypeEnum.accountInfo; - } - 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; - }); - } - }); - } - - public previousUrl(): void { - if (this.claimStructure) { - this.routerListener.goToPreviousUrl(this.claimStructure); - } else if (this.editForm) { - this.routerListener.goToPreviousUrl(this.editForm.value); - } else { - this.routerListener.goToPreviousUrl(); - } - } - - public closeSignUpModal(value: boolean): void { - if (!value) { - this.displaySignUp = false; - } else { - this.isPopUpOpen = false; - } - if (this.isLoggedIn) { - this.updateFormOnLogin(); - } - } - - public updateFormOnLogin(): void { - this.profileService.getProfile().then((user: User) => { - this.profile = user; - this.router.navigateByUrl('create-structure'); - this.progressStatus += (100 / this.nbPagesForm) * 2; - this.pagesValidation[PageTypeEnum.accountInfo] = { valid: true }; - this.pagesValidation[PageTypeEnum.accountCredentials] = { valid: true }; - this.currentPage = PageTypeEnum.structureNameAndAddress; - }); - } - - public get isLoggedIn(): boolean { - return this.authService.isLoggedIn(); - } - - async setCategories(): Promise<void> { - this.searchService.getCategoriesAccompaniment().subscribe((categories: Category[]) => { - this.proceduresAccompaniment = categories[0]; - }); - const equipmentsCategs = await this.searchService.getCategoriesOthers().toPromise(); - equipmentsCategs.forEach((categ) => { - switch (categ.id) { - case CategoryEnum.accessModality: { - this.accessModality = categ; - break; - } - case CategoryEnum.equipmentsAndServices: { - categ.modules.forEach((c) => { - this.equipmentsAndServices.push({ module: c, openned: false }); - }); - break; - } - case CategoryEnum.labelsQualifications: { - this.labelsQualifications = categ; - break; - } - case CategoryEnum.publics: { - this.publics = categ; - break; - } - case CategoryEnum.publicsAccompaniment: { - this.publicsAccompaniment = categ; - break; - } - } - }); - const categs = await this.searchService.getCategoriesTraining().toPromise(); - categs.forEach((categ) => { - this.trainingCategories.push({ category: categ, openned: false }); - }); - } - - private initForm(structure: Structure): void { - // Init account Form - this.createAccountForm(); - - // Init form - this.structureForm = this.createStructureForm(structure); - if (this.isEditMode) { - this.editForm = this.createStructureForm(structure); - } - - // Init hours form - this.hoursForm = new FormGroup({ - monday: this.createDay(structure.hours.monday), - tuesday: this.createDay(structure.hours.tuesday), - wednesday: this.createDay(structure.hours.wednesday), - thursday: this.createDay(structure.hours.thursday), - friday: this.createDay(structure.hours.friday), - saturday: this.createDay(structure.hours.saturday), - sunday: this.createDay(structure.hours.sunday), - }); - if (this.isEditMode) { - this.showCollapse(structure); - } - - this.setValidationsForm(); - } - - private createAccountForm(email?: string): void { - this.accountForm = new FormGroup( - { - email: new FormControl(email ? email : '', [Validators.required, Validators.pattern(CustomRegExp.EMAIL)]), - name: new FormControl('', [Validators.required, Validators.pattern(CustomRegExp.TEXT_WITHOUT_NUMBER)]), - surname: new FormControl('', [Validators.required, Validators.pattern(CustomRegExp.TEXT_WITHOUT_NUMBER)]), - phone: new FormControl('', [Validators.required, Validators.pattern(CustomRegExp.PHONE)]), - password: new FormControl('', [ - Validators.required, - Validators.pattern(CustomRegExp.PASSWORD), //NOSONAR - ]), - confirmPassword: new FormControl(''), - }, - [MustMatch('password', 'confirmPassword')] - ); - } - - private createStructureForm(structure): 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), - ]), - 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), - 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), - remoteAccompaniment: new FormControl(structure.remoteAccompaniment, Validators.required), - otherDescription: new FormControl(structure.otherDescription), - equipmentsAndServices: this.loadArrayForCheckbox(structure.equipmentsAndServices, false), - publics: this.loadArrayForCheckbox(structure.publics, true), - baseSkills: this.loadArrayForCheckbox(structure.baseSkills, false), - accessRight: this.loadArrayForCheckbox(structure.accessRight, false), - parentingHelp: this.loadArrayForCheckbox(structure.parentingHelp, false), - socialAndProfessional: this.loadArrayForCheckbox(structure.socialAndProfessional, false), - digitalCultureSecurity: this.loadArrayForCheckbox(structure.digitalCultureSecurity, false), - 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), - }); - } - - private showCollapse(s: Structure): void { - if (s.website) { - this.showWebsite = true; - } - if (s.facebook || s.twitter || s.instagram || s.linkedin) { - this.showSocialNetwork = true; - } - if (s.publicsAccompaniment.length) { - this.showPublicsAccompaniment = true; - } - if (s.proceduresAccompaniment.length) { - this.showProceduresAccompaniment = true; - } - this.trainingCategories.forEach((categ: { category: Category; openned: boolean }) => { - categ.openned = false; - switch (categ.category.id) { - case 'accessRight': - if (s.accessRight.length) { - categ.openned = true; - } - break; - case 'socialAndProfessional': - if (s.socialAndProfessional.length) { - categ.openned = true; - } - break; - case 'baseSkills': - if (s.baseSkills.length) { - categ.openned = true; - } - break; - case 'parentingHelp': - if (s.parentingHelp.length) { - categ.openned = true; - } - break; - case 'digitalCultureSecurity': - if (s.digitalCultureSecurity.length) { - categ.openned = true; - } - break; - } - }); - this.equipmentsAndServices.forEach((equipment: { module: Module; openned: boolean }) => { - equipment.openned = false; - switch (equipment.module.id) { - case 'ordinateurs': - if (s.equipmentsAndServices.includes('ordinateurs')) { - equipment.openned = true; - } - break; - case 'tablettes': - if (s.equipmentsAndServices.includes('tablettes')) { - equipment.openned = true; - } - break; - case 'bornesNumeriques': - if (s.equipmentsAndServices.includes('bornesNumeriques')) { - equipment.openned = true; - } - break; - case 'imprimantes': - if (s.equipmentsAndServices.includes('imprimantes')) { - equipment.openned = true; - } - break; - case 'scanners': - if (s.equipmentsAndServices.includes('scanners')) { - equipment.openned = true; - } - break; - } - }); - } - - private loadArrayForCheckbox(array: string[], isRequired: boolean): FormArray { - return new FormArray( - array.map((str) => new FormControl(str)), - isRequired ? Validators.required : Validators.nullValidator - ); - } - public getStructureControl(nameControl: string): AbstractControl { - return this.structureForm.get(nameControl); - } - - public getAddressControl(nameControl: string): AbstractControl { - return this.structureForm.get('address').get(nameControl); - } - - 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), - }); - } - - 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 - formArray.push(new FormControl(value)); - } else { - // Remove uncheck control in the arrayForm - const index = formArray.controls.findIndex((element) => element.value === value); - formArray.removeAt(index); - } - this.setValidationsForm(); - } - - // Check if a FormControl value is in FormArray - public isInArray(term: string, formControlName: string): boolean { - if (this.structureForm.controls[formControlName].value) { - return this.structureForm.controls[formControlName].value.includes(term); - } - return false; - } - - public setValidationsForm(): void { - if (this.isClaimMode) { - this.pagesValidation[PageTypeEnum.summary] = { valid: true }; - this.pagesValidation[PageTypeEnum.accountInfo] = { - valid: - this.accountForm.get('surname').valid && - this.accountForm.get('name').valid && - this.accountForm.get('phone').valid, - }; - this.pagesValidation[PageTypeEnum.accountCredentials] = { - valid: - this.accountForm.get('email').valid && - this.accountForm.get('password').valid && - this.accountForm.get('confirmPassword').valid, - }; - this.pagesValidation[PageTypeEnum.cgu] = { valid: this.userAcceptSavedDate }; - this.updatePageValid(); - } else if (this.isAccountMode) { - this.pagesValidation[PageTypeEnum.accountInfo] = { - valid: - this.accountForm.get('surname').valid && - this.accountForm.get('name').valid && - this.accountForm.get('phone').valid, - }; - this.pagesValidation[PageTypeEnum.accountCredentials] = { - valid: - this.accountForm.get('email').valid && - this.accountForm.get('password').valid && - this.accountForm.get('confirmPassword').valid, - }; - this.pagesValidation[PageTypeEnum.cgu] = { valid: this.userAcceptSavedDate }; - this.updatePageValid(); - } else { - this.pagesValidation[PageTypeEnum.summary] = { valid: true }; - this.pagesValidation[PageTypeEnum.info] = { valid: true }; - this.pagesValidation[PageTypeEnum.accountInfo] = { - valid: - this.accountForm.get('surname').valid && - this.accountForm.get('name').valid && - this.accountForm.get('phone').valid, - }; - this.pagesValidation[PageTypeEnum.accountCredentials] = { - valid: - this.accountForm.get('email').valid && - this.accountForm.get('password').valid && - this.accountForm.get('confirmPassword').valid, - }; - this.pagesValidation[PageTypeEnum.structureNameAndAddress] = { - valid: this.getStructureControl('structureName').valid && this.getStructureControl('address').valid, - name: 'Nom et adresse', - }; - this.pagesValidation[PageTypeEnum.structurePhone] = { - valid: this.getStructureControl('contactMail').valid && this.getStructureControl('contactPhone').valid, - name: 'Contact structure', - }; - this.pagesValidation[PageTypeEnum.structureType] = { - valid: this.getStructureControl('structureType').valid, - name: 'Type de structure', - }; - this.pagesValidation[PageTypeEnum.structureAccessModality] = { - valid: this.getStructureControl('accessModality').valid, - name: "Modalités d'accueil", - }; - this.pagesValidation[PageTypeEnum.structureHours] = { - valid: this.hoursForm.valid && this.getStructureControl('exceptionalClosures').valid, - name: "Horaires d'ouverture", - }; - this.pagesValidation[PageTypeEnum.structurePmr] = { - valid: this.getStructureControl('pmrAccess').valid, - name: 'Accessibilité pour les personnes à mobilité réduite', - }; - this.pagesValidation[PageTypeEnum.structureWebAndSocialNetwork] = { - valid: - (this.getStructureControl('website').valid || !this.showWebsite) && - ((this.getStructureControl('facebook').valid && - this.getStructureControl('twitter').valid && - this.getStructureControl('instagram').valid) || - !this.showSocialNetwork), - name: 'Présence sur internet', - }; - this.pagesValidation[PageTypeEnum.structurePublicTarget] = { - valid: this.getStructureControl('publics').valid, - name: 'Public admis', - }; - this.pagesValidation[PageTypeEnum.structureAccompaniment] = { - valid: - this.getStructureControl('publicsAccompaniment').valid && - this.getStructureControl('proceduresAccompaniment').valid, - name: 'Accompagnements proposés', - }; - this.pagesValidation[PageTypeEnum.structureOtherAccompaniment] = { - valid: this.getStructureControl('otherDescription').value, - name: 'Autres démarches proposés', - }; - this.pagesValidation[PageTypeEnum.structureRemoteAccompaniment] = { - valid: this.getStructureControl('remoteAccompaniment').valid, - name: 'Accompagnement à distance', - }; - this.pagesValidation[PageTypeEnum.structureWorkshop] = { - valid: - this.getStructureControl('accessRight').valid && - this.getStructureControl('socialAndProfessional').valid && - this.getStructureControl('baseSkills').valid && - this.getStructureControl('parentingHelp').valid && - this.getStructureControl('digitalCultureSecurity').valid, - name: 'Ateliers au numérique proposés', - }; - this.pagesValidation[PageTypeEnum.structureWorkshopPrice] = { - valid: this.getStructureControl('freeWorkShop').valid, - name: 'Gratuité des ateliers', - }; - this.pagesValidation[PageTypeEnum.structureWifi] = { - valid: this.getStructureControl('equipmentsAndServices').valid, - name: 'Gratuité du wifi', - }; - this.pagesValidation[PageTypeEnum.structureEquipments] = { - valid: - this.getStructureControl('equipmentsAndServices').valid && - this.getStructureControl('nbComputers').valid && - this.getStructureControl('nbPrinters').valid && - this.getStructureControl('nbTablets').valid && - this.getStructureControl('nbNumericTerminal').valid && - this.getStructureControl('nbScanners').valid, - name: 'Matériels mis à disposition', - }; - this.pagesValidation[PageTypeEnum.structureLabels] = { - valid: this.getStructureControl('labelsQualifications').valid, - name: 'Labélisations proposées', - }; - this.pagesValidation[PageTypeEnum.structureOtherServices] = { - valid: this.getStructureControl('equipmentsAndServices').valid, - name: 'Autres services proposés', - }; - this.pagesValidation[PageTypeEnum.structureDescription] = { - valid: this.getStructureControl('description').valid, - name: 'Présentation de la structure', - }; - this.pagesValidation[PageTypeEnum.structureCovidInfo] = { - valid: this.getStructureControl('lockdownActivity').valid, - name: 'Informations spécifiques à la période COVID', - }; - if (this.isEditMode) { - this.pagesValidation[PageTypeEnum.cgu] = { - valid: this.getStructureControl('dataShareConsentDate').valid, - name: 'Partage de données sur data.grandlyon.com', - }; - } else { - this.pagesValidation[PageTypeEnum.cgu] = { valid: this.userAcceptSavedDate }; - } - this.updatePageValid(); - } - } - - /** - * Update valid page or return page validity of the given index - * @param {number} [index] - Page index - */ - private updatePageValid(index?: number): boolean { - if (index) { - return this.pagesValidation[index].valid; - } - this.isPageValid = this.pagesValidation[this.currentPage].valid; - return this.isPageValid; - } - - /** - * Page algo for claim structure case - */ - public nextPageClaim(): void { - if (this.currentPage === this.nbPagesForm - 1) { - const user = new User(this.accountForm.value); - // Create user and claim structure - this.authService.register(user).subscribe(() => { - if (this.userAcceptNewsletter) { - this.newsletterService.newsletterSubscribe(user.email).subscribe(() => {}); - } - // If joinMode, send join request, if not send claim request; - if (this.isJoinMode) { - this.structureService.joinStructure(this.claimStructure._id, user.email).subscribe(() => { - this.progressStatus = 100; - }); - } else { - this.structureService.claimStructureWithAccount(this.claimStructure._id, user.email).subscribe(() => { - this.progressStatus = 100; - }); - } - }); - } - - if (this.currentPage === PageTypeEnum.summary) { - this.currentPage = PageTypeEnum.accountInfo; - this.updatePageValid(); - } else if (this.currentPage === PageTypeEnum.accountInfo) { - this.currentPage = PageTypeEnum.accountCredentials; - this.updatePageValid(); - } else if (this.currentPage === PageTypeEnum.accountCredentials) { - this.currentPage = PageTypeEnum.cgu; - this.updatePageValid(); - } else if (this.currentPage === PageTypeEnum.cgu) { - this.currentPage = this.nbPagesForm; - } - - this.progressStatus += 25; - } - /** - * Page algo for create account case - */ - public nextPageAccount(): void { - if (this.currentPage === this.nbPagesForm - 1) { - const user = new User(this.accountForm.value); - // Create user with structure - user.structuresLink = this.linkedStructureId; - this.authService.register(user).subscribe(() => { - this.progressStatus = 100; - }); - } - - if (this.currentPage === PageTypeEnum.accountInfo) { - this.currentPage = PageTypeEnum.accountCredentials; - this.updatePageValid(); - } else if (this.currentPage === PageTypeEnum.accountCredentials) { - this.currentPage = PageTypeEnum.cgu; - this.updatePageValid(); - } else if (this.currentPage === PageTypeEnum.cgu) { - this.currentPage = this.nbPagesForm; - } - - this.progressStatus += 25; - } - - /** - * Page algo for claim structure case - */ - public previousPageClaim(): void { - if (this.currentPage === PageTypeEnum.accountInfo) { - this.currentPage = PageTypeEnum.summary; - this.updatePageValid(); - } else if (this.currentPage === PageTypeEnum.accountCredentials) { - this.currentPage = PageTypeEnum.accountInfo; - this.updatePageValid(); - } else if (this.currentPage === PageTypeEnum.cgu) { - this.currentPage = PageTypeEnum.accountCredentials; - this.updatePageValid(); - } - - this.progressStatus -= 25; - } - - /** - * Page algo for claim structure case - */ - public previousPageAccount(): void { - if (this.currentPage === PageTypeEnum.accountCredentials) { - this.currentPage = PageTypeEnum.accountInfo; - this.updatePageValid(); - } else if (this.currentPage === PageTypeEnum.cgu) { - this.currentPage = PageTypeEnum.accountCredentials; - this.updatePageValid(); - } - - this.progressStatus -= 25; - } - - public nextPage(): void { - if (this.isClaimMode) { - this.nextPageClaim(); - } else if (this.isAccountMode) { - this.nextPageAccount(); - } else { - // Check if user already connected to skip accountForm pages. - if (this.currentPage === PageTypeEnum.info && this.profile) { - this.currentPage += 2; // Skip accountInfo pages from AccountForm - this.progressStatus += 2 * (100 / this.nbPagesForm); - } - // Check if "other" isn't check to hide "other description" page - if ( - this.currentPage === PageTypeEnum.structureAccompaniment && - !this.isInArray('autres', 'proceduresAccompaniment') - ) { - this.currentPage++; // page structureOtherAccompaniment skip and go to page structureWorkshop - this.progressStatus += 100 / this.nbPagesForm; - } - - if (this.currentPage === PageTypeEnum.structureWorkshop) { - if ( - !this.structureForm.get('baseSkills').value.length && - !this.structureForm.get('accessRight').value.length && - !this.structureForm.get('parentingHelp').value.length && - !this.structureForm.get('socialAndProfessional').value.length && - !this.structureForm.get('digitalCultureSecurity').value.length - ) { - this.getStructureControl('freeWorkShop').reset(); - this.currentPage++; - this.progressStatus += 100 / this.nbPagesForm; - } - } - // Check if going to the last page to submit form and send email verification. - if (this.currentPage === this.nbPagesForm - 1) { - this.validateForm(); - } else { - this.currentPage++; - this.progressStatus += 100 / this.nbPagesForm; - document.getElementsByClassName('content')[0].scrollTo(0, 0); - this.updatePageValid(); - } - } - } - public previousPage(): void { - if (this.isClaimMode) { - this.previousPageClaim(); - } else if (this.isAccountMode) { - this.previousPageAccount(); - } else { - // Check if user already connected to skip accountForm pages. - if (this.currentPage === PageTypeEnum.structureNameAndAddress && this.profile) { - this.currentPage -= 2; // Skip 2 pages from AccountForm - this.progressStatus -= 2 * (100 / this.nbPagesForm); - } - - // Check if "other" isn't check to hide "other description" page - if ( - this.currentPage === PageTypeEnum.structureRemoteAccompaniment && - !this.isInArray('autres', 'proceduresAccompaniment') - ) { - this.currentPage--; // page 14 skip and go to page 13 - this.progressStatus -= 100 / this.nbPagesForm; - } - if (this.currentPage === PageTypeEnum.structureWifi) { - if ( - !this.structureForm.get('baseSkills').value.length && - !this.structureForm.get('accessRight').value.length && - !this.structureForm.get('parentingHelp').value.length && - !this.structureForm.get('socialAndProfessional').value.length && - !this.structureForm.get('digitalCultureSecurity').value.length - ) { - this.currentPage--; - this.progressStatus -= 100 / this.nbPagesForm; - } - } - this.currentPage--; - this.progressStatus -= 100 / this.nbPagesForm; - this.updatePageValid(); - } - } - public showPassword(): void { - this.isShowPassword = !this.isShowPassword; - } - public showConfirmPassword(): void { - this.isShowConfirmPassword = !this.isShowConfirmPassword; - } - - public setAddressStructure(address?: Address): void { - if (address) { - this.getAddressControl('numero').setValue(address.numero); - this.getAddressControl('street').setValue(address.street); - this.getAddressControl('commune').setValue(address.commune); - } else { - this.structureForm.get('address').reset(); - } - this.setValidationsForm(); - } - public setTypeStructure(type?: string): void { - this.getStructureControl('structureType').setValue(type); - this.setValidationsForm(); - } - public updateHours(form: FormGroup): void { - this.hoursForm = form; - this.setValidationsForm(); - } - public setHoursError(): void { - this.hoursForm.setErrors({ formError: true }); - this.setValidationsForm(); - } - public onRadioBtnChange(controlName: string, bool: boolean): void { - this.getStructureControl(controlName).setValue(bool); - this.setValidationsForm(); - } - public toggleWebSite(): void { - this.showWebsite = !this.showWebsite; - if (!this.showWebsite) { - this.getStructureControl('website').reset(); - } - this.setValidationsForm(); - } - public toggleSocialNetwork(): void { - this.showSocialNetwork = !this.showSocialNetwork; - if (!this.showSocialNetwork) { - this.getStructureControl('facebook').reset(); - this.getStructureControl('twitter').reset(); - this.getStructureControl('instagram').reset(); - } - this.setValidationsForm(); - } - public updateChoice(choice: string, controlName: string): void { - this.onCheckChange(!this.isInArray(choice, controlName), controlName, choice); - } - public togglePublicsAccompaniment(): void { - this.showPublicsAccompaniment = !this.showPublicsAccompaniment; - if (!this.showPublicsAccompaniment) { - this.getStructureControl('publicsAccompaniment').reset(); - } - this.setValidationsForm(); - } - public toggleProceduresAccompaniment(): void { - this.showProceduresAccompaniment = !this.showProceduresAccompaniment; - if (!this.showProceduresAccompaniment && !this.isEditMode) { - this.getStructureControl('proceduresAccompaniment').reset(); - } - this.setValidationsForm(); - } - public toggleTrainingCategories(categ: { category: Category; openned: boolean }): void { - this.trainingCategories.forEach((c: { category: Category; openned: boolean }) => { - if (categ === c) { - c.openned = !c.openned; - } - }); - } - - public toggleEquipmentsServices(equipment: { module: Module; openned: boolean }): void { - this.onCheckChange(!equipment.openned, 'equipmentsAndServices', equipment.module.id); - this.equipmentsAndServices.forEach((e: { module: Module; openned: boolean }) => { - if (equipment === e) { - e.openned = !e.openned; - if (!equipment.openned) { - switch (e.module.id) { - case Equipment.computer: { - this.getStructureControl('nbComputers').setValue(0); - break; - } - case Equipment.printer: { - this.getStructureControl('nbPrinters').setValue(0); - break; - } - case Equipment.tablet: { - this.getStructureControl('nbTablets').setValue(0); - break; - } - case Equipment.bornes: { - this.getStructureControl('nbNumericTerminal').setValue(0); - break; - } - case Equipment.scanner: { - this.getStructureControl('nbScanners').setValue(0); - break; - } - } - this.setValidationsForm(); - } - } - }); - } - public acceptDataBeSaved(isAccepted: boolean): void { - this.userAcceptSavedDate = isAccepted; - this.setValidationsForm(); - } - - public acceptOpenData(isAccepted: boolean): void { - let now = new Date().toString(); - this.getStructureControl('dataShareConsentDate').setValue(now); - this.setValidationsForm(); - } - - public acceptReceiveNewsletter(isAccepted: boolean): void { - this.userAcceptNewsletter = isAccepted; - } - - private changeValueHandler(equipment: string, value = 0): void { - let field = ''; - if (equipment === 'ordinateurs') field = 'nbComputers'; - if (equipment === 'tablettes') field = 'nbTablets'; - if (equipment === 'scanners') field = 'nbScanners'; - if (equipment === 'bornesNumeriques') field = 'nbNumericTerminal'; - if (equipment === 'imprimantes') field = 'nbPrinters'; - - if (value === -1 && this.structureForm.value[field] === 0) return; - this.getStructureControl(field).setValue(this.structureForm.value[field] + value); - } - - public validateForm(): void { - if (this.getStructureControl('freeWorkShop').value === null) { - this.getStructureControl('freeWorkShop').setValue(false); - } - let structure: Structure = this.structureForm.value; - structure.hours = this.hoursForm.value; - // Remove equipments if value is 0 - structure.equipmentsAndServices = structure.equipmentsAndServices.filter((equipments) => { - if (equipments === 'ordinateurs' && structure.nbComputers === 0) return false; - if (equipments === 'tablettes' && structure.nbTablets === 0) return false; - if (equipments === 'scanners' && structure.nbScanners === 0) return false; - if (equipments === 'bornesNumeriques' && structure.nbNumericTerminal === 0) return false; - if (equipments === 'imprimantes' && structure.nbPrinters === 0) return false; - return true; - }); - let user: User; - // If edit mode, update setbystep - if (this.isEditMode) { - this.structureService.editStructure(structure).subscribe((s: Structure) => { - this.editForm = this.createStructureForm(s); - }); - } else { - if (this.structureForm.valid && this.hoursForm.valid) { - // For creation mode, check structure validity - if (this.profile) { - user = this.profile; - structure.accountVerified = true; - this.createStructure(structure, user); - } else { - if (this.accountForm.valid) { - user = new User(this.accountForm.value); - this.authService - .register(user) - .pipe(first()) - .subscribe(() => { - this.createStructure(structure, user); - }); - if (this.userAcceptNewsletter) { - this.newsletterService.newsletterSubscribe(user.email).subscribe(() => {}); - } - } - } - } - } - } - - private createStructure(structure: Structure, user: User): void { - this.structureService.createStructure(structure, user).subscribe((newStructure) => { - this.currentPage++; - this.progressStatus += 100 / this.nbPagesForm; - this.createdStructure = newStructure; - }); - } - public toggleMenu(): void { - this.showMenu = !this.showMenu; - } - - public closeMenu(): void { - this.showMenu = false; - } - - public canExit(): Promise<boolean> { - // Avoid confirmation when user submit form and leave. - if (this.currentPage === this.nbPagesForm || this.currentPage < 3 || this.isEditMode) { - return new Promise((resolve) => resolve(true)); - } else { - return new Promise((resolve) => this.showModal(resolve)); - } - } - - private showModal(resolve: Function): void { - this.showConfirmationModal = true; - this.resolve = resolve; - } - public hasRedirectionAccepted(hasAccept: boolean): void { - this.resolve(hasAccept); - this.showConfirmationModal = false; - } - - // Function for editMode only - - public goToSpecificPage(numPage: number, isSave: boolean): void { - if (isSave) { - this.validateForm(); - } else { - const structure = new Structure(this.editForm.value); - this.structureForm = this.createStructureForm(structure); - this.showCollapse(structure); - } - this.currentPage = numPage; - this.updatePageValid(); - } - - public closeEditMode(): void { - this.router.navigateByUrl('acteurs', { state: { data: this.createdStructure } }); - } - - public verifyUserExist(inputEmail): void { - if (this.accountForm.get('email').valid) { - this.profileService.isEmailAlreadyUsed(inputEmail).subscribe((isExist) => { - if (isExist) { - this.accountForm.get('email').setErrors({ alreadyExist: true }); - this.setValidationsForm(); - } - }); - } - } - - public displayAddStructure(): boolean { - return this.currentPage === this.pageTypeEnum.summary && !this.isEditMode && !this.isClaimMode; - } - - public displayClaimStructure(): boolean { - return this.currentPage === this.pageTypeEnum.summary && !this.isEditMode && this.isClaimMode; - } - - public structureDeleted(): void { - this.router.navigateByUrl('acteurs'); - } - - public shouldDisplayPage(index: number): boolean { - // handle OtherAccompaniment - if (index == this.pageTypeEnum.structureOtherAccompaniment) { - if (this.structureForm.value.proceduresAccompaniment.includes('autres')) return true; - else return false; - } - return true; - } - - public checkIfPasswordHasSpecialChar(password: string): boolean { - if (password.match(CustomRegExp.SPECHAR)) return true; - return false; - } - - public checkIfPasswordHasDigit(password: string): boolean { - if (password.match(CustomRegExp.DIGIT)) return true; - return false; - } - - public checkIfPasswordHasUpperCase(password: string): boolean { - if (password.match(CustomRegExp.UPPERCASE)) return true; - return false; - } - - public checkIfPasswordHasLowerCase(password: string): boolean { - if (password.match(CustomRegExp.LOWERCASE)) return true; - return false; - } -} diff --git a/src/app/form/structure-form/pageType.enum.ts b/src/app/form/structure-form/pageType.enum.ts deleted file mode 100644 index 7ce4cd632..000000000 --- a/src/app/form/structure-form/pageType.enum.ts +++ /dev/null @@ -1,26 +0,0 @@ -export enum PageTypeEnum { - summary, - info, - accountInfo, - accountCredentials, - structureNameAndAddress, - structurePhone, - structureType, - structureAccessModality, - structureHours, - structurePmr, - structureWebAndSocialNetwork, - structurePublicTarget, - structureAccompaniment, - structureOtherAccompaniment, - structureRemoteAccompaniment, - structureWorkshop, - structureWorkshopPrice, - structureWifi, - structureEquipments, - structureLabels, - structureOtherServices, - structureDescription, - structureCovidInfo, - cgu, -} -- GitLab From 37c1030ab4d3f5d70035463fc6f94c1479b34f7c Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Tue, 24 May 2022 11:23:32 +0200 Subject: [PATCH 2/3] fix orientation style --- .gitlab-ci.yml | 2 - .../orientation-form.component.scss | 219 ++++++++++++++++-- .../orientation-form.component.ts | 2 +- 3 files changed, 206 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 03d39d736..1cf373278 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -128,7 +128,6 @@ sonarqube: -Dsonar.host.url=${SONAR_URL} -Dsonar.projectKey=${SONAR_PROJECT_KEY} -Dsonar.login=${SONAR_TOKEN} - -Dsonar.cpd.exclusions=tests/**,src/**/*.spec.ts*,src/app/form/structure-form/form.component.ts,src/app/form/structure-form/form.component.html -Dsonar.qualitygate.wait=true sonarqube-mr: @@ -153,5 +152,4 @@ sonarqube-mr: -Dsonar.host.url=${SONAR_URL} -Dsonar.projectKey=${SONAR_PROJECT_KEY} -Dsonar.login=${SONAR_MR_TOKEN} - -Dsonar.cpd.exclusions=tests/**,src/**/*.spec.ts*,src/app/form/structure-form/form.component.ts,src/app/form/structure-form/form.component.html -Dsonar.qualitygate.wait=true diff --git a/src/app/form/orientation-form/orientation-form.component.scss b/src/app/form/orientation-form/orientation-form.component.scss index 89ad7e410..03d833c99 100644 --- a/src/app/form/orientation-form/orientation-form.component.scss +++ b/src/app/form/orientation-form/orientation-form.component.scss @@ -5,15 +5,214 @@ @import '../../../assets/scss/typography'; @import '../../../assets/scss/buttons'; -.body-wrap { - height: 400px; +h3 { + margin: 0; } -.titleCateg { +h4 { + margin-bottom: 16px; +} + +.form { + background: $grey-7; + width: 100vw; + height: calc(var(--vh, 1vh) * 100 - #{$header-height}); + top: #{$header-height}; + z-index: $structure-details-z-index; + @media #{$tablet} { + height: calc(var(--vh, 1vh) * 100 - #{$header-height}); + position: fixed; //Hide default header app. + } +} + +.content { + padding: 0 16px; + display: block; + overflow-y: auto; + height: auto; + h3 { + @include lato-bold-26; + + @media #{$tablet} { + @include lato-bold-22; + } + } + .page { + max-width: 980px; + box-sizing: border-box; + margin: auto; + min-height: 450px; + max-height: 75vh; + overflow-y: auto; + color: $grey-1; + background: $white; + border-radius: 8px; + border: 1px solid $grey-6; + padding: 32px 24px 32px 48px; + + .title { + margin-bottom: 16px; + } + .welcomingTerms, + .procedureContainer, + .otherServices, + .textareaBlock { + max-width: 600px; + } + } + p { + color: $grey-1; + @include lato-regular-14; + margin: 7px 0 0 0; + } + .textareaBlock { + @media #{$tablet} { + max-width: 90%; + } + p { + text-align: right; + @include lato-regular-14; + color: $grey-3; + font-style: italic; + } + } +} +.form-group { + &.facebook, + &.twitter, + &.instagram, + &.linkedin, + &.website, + div { + height: 44px; + } +} + +img { + max-height: 340px; +} + +// collapse +.collapse { + border: 1px solid $grey-5; + border-radius: 4px; + margin-bottom: 13px; + max-width: 600px; + @media #{$small-phone} { + width: 95% !important; + } + @media #{$tablet} { + width: 296px; + } + &.notCollapsed { + margin-bottom: 8px; + background: $grey-8; + .logo { + .hide { + display: none; + } + .show { + display: block; + } + } + } + .form-group { + margin: 0; + color: $grey-2; + @include lato-regular-14; + &.website, + &.facebook, + &.twitter, + &.instagram, + &.linkedin { + svg { + height: 22px; + width: 22px; + padding: 6px; + } + &:focus-within { + input { + border-color: $grey-3; + fill: $primary-color; + } + } + } + app-svg-icon { + padding-top: 12px; + margin-right: 0 !important; + } + } + .titleCollapse { + width: 100%; + @include lato-bold-16; + color: $grey-2; + p { + color: $grey-2; + @include lato-bold-16; + } + } + .collapseHeader { + height: 65px; + padding: 0 15px 0 12px; + cursor: pointer; + } + .logo { + height: 24px; + width: 24px; + svg { + width: 100%; + height: 100%; + fill: $grey-1; + } + } + .logo, + .titleCollapse { + .hide { + display: block; + } + .show { + display: none; + } + } +} + +.tags { + padding: 8px; + button { + background: $grey-8; + border-radius: 20px; + margin: 4px; + max-width: 100%; + height: 40px; + padding: 0 13px; + @include lato-bold-14; + outline: none; + border: none; + cursor: pointer; + &.selectedChoice { + background: $green-1 !important; + color: $white; + } + } + svg { + width: 20px; + height: 10px; + margin-right: 4px; + stroke: $grey-8; + } +} +.textBtn { + overflow: hidden; + text-overflow: ellipsis; + -webkit-line-clamp: 2; + display: -webkit-box; + -webkit-box-orient: vertical; width: 100%; - @include lato-bold-16; - padding: 1.5em; - color: $grey-2; + margin-right: 12px; +} + +.section { + padding-bottom: 2rem; } .titleInfo { @@ -25,10 +224,6 @@ .validateIcon { height: 38px !important; } - .markerIcon { - height: 38px !important; - cursor: pointer; - } } .nbStructure-panel { @@ -56,10 +251,6 @@ margin: 0 0.5em; } -.form-override { - height: unset !important; -} - .form-footer { padding: 17px 0; width: 100%; diff --git a/src/app/form/orientation-form/orientation-form.component.ts b/src/app/form/orientation-form/orientation-form.component.ts index f7f6ee119..d65a19e12 100644 --- a/src/app/form/orientation-form/orientation-form.component.ts +++ b/src/app/form/orientation-form/orientation-form.component.ts @@ -19,7 +19,7 @@ import { PageTypeEnum } from './pageType.enum'; @Component({ selector: 'app-orientation-form', templateUrl: './orientation-form.component.html', - styleUrls: ['./orientation-form.component.scss', '../structure-form/form.component.scss'], + styleUrls: ['./orientation-form.component.scss'], }) export class OrientationFormComponent implements OnInit { public displayMapMarkerId: string; -- GitLab From a34a2da476eda6b0b39d0f943d8cddd43dd16ba4 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Tue, 24 May 2022 11:33:14 +0200 Subject: [PATCH 3/3] remove json server --- api/Dockerfile | 15 ------- api/package.json | 11 ----- api/server.js | 111 ----------------------------------------------- package.json | 4 +- 4 files changed, 1 insertion(+), 140 deletions(-) delete mode 100644 api/Dockerfile delete mode 100644 api/package.json delete mode 100644 api/server.js diff --git a/api/Dockerfile b/api/Dockerfile deleted file mode 100644 index 8866e160e..000000000 --- a/api/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -# Based on Node.js -FROM node:12.16 - -WORKDIR /app - -# Copy the package.json file first in order to cache the modules -COPY . . - -# Install npm dependencies -RUN npm install - -# expose port 3000 -EXPOSE 3000 - -CMD ["npm", "start"] diff --git a/api/package.json b/api/package.json deleted file mode 100644 index 997401923..000000000 --- a/api/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "pamn-mock-api", - "version": "0.1.0", - "scripts": { - "start": "node server.js" - }, - "private": true, - "dependencies": { - "json-server": "^0.16.2" - } -} diff --git a/api/server.js b/api/server.js deleted file mode 100644 index 89878e701..000000000 --- a/api/server.js +++ /dev/null @@ -1,111 +0,0 @@ -const jsonServer = require('json-server'); -const server = jsonServer.create(); -const router = jsonServer.router('db.json'); -const routes = { - '/api/*': '/$1', -}; -const middlewares = [jsonServer.defaults(), jsonServer.rewriter(routes)]; - -// Set default middlewares (logger, static, cors and no-cache) -server.use(middlewares); - -// Add custom routes before JSON Server router -server.get('/structures/count', (req, res) => { - let structureCountTab = []; - // Compétences de base - structureCountTab.push({ id: '260', count: 12 }); - structureCountTab.push({ id: '259', count: 10 }); - structureCountTab.push({ id: '261', count: 10 }); - structureCountTab.push({ id: '249', count: 9 }); - structureCountTab.push({ id: '222', count: 9 }); - structureCountTab.push({ id: '212', count: 8 }); - structureCountTab.push({ id: '186', count: 7 }); - structureCountTab.push({ id: '183', count: 6 }); - // Accès aux droits - structureCountTab.push({ id: '176', count: 6 }); - structureCountTab.push({ id: '175', count: 1 }); - structureCountTab.push({ id: '174', count: 2 }); - structureCountTab.push({ id: '173', count: 2 }); - structureCountTab.push({ id: '172', count: 2 }); - structureCountTab.push({ id: '171', count: 4 }); - structureCountTab.push({ id: '167', count: 3 }); - structureCountTab.push({ id: '165', count: 2 }); - // Insertion sociale et professionnelle - structureCountTab.push({ id: '254', count: 5 }); - structureCountTab.push({ id: '240', count: 4 }); - structureCountTab.push({ id: '194', count: 7 }); - structureCountTab.push({ id: '193', count: 7 }); - structureCountTab.push({ id: '192', count: 5 }); - structureCountTab.push({ id: '191', count: 7 }); - structureCountTab.push({ id: '262', count: 5 }); - structureCountTab.push({ id: '263', count: 3 }); - structureCountTab.push({ id: '3', count: 3 }); - // Aide à la parentalité - structureCountTab.push({ id: '257', count: 4 }); - structureCountTab.push({ id: '238', count: 1 }); - structureCountTab.push({ id: '178', count: 4 }); - structureCountTab.push({ id: '166', count: 2 }); - // Culture et sécurité numérique - structureCountTab.push({ id: '264', count: 5 }); - structureCountTab.push({ id: '255', count: 7 }); - structureCountTab.push({ id: '265', count: 2 }); - structureCountTab.push({ id: '232', count: 4 }); - structureCountTab.push({ id: '225', count: 5 }); - structureCountTab.push({ id: '221', count: 3 }); - structureCountTab.push({ id: '218', count: 2 }); - structureCountTab.push({ id: '209', count: 3 }); - structureCountTab.push({ id: '208', count: 4 }); - structureCountTab.push({ id: '206', count: 5 }); - structureCountTab.push({ id: '195', count: 5 }); - structureCountTab.push({ id: '164', count: 4 }); - structureCountTab.push({ id: '163', count: 2 }); - structureCountTab.push({ id: '162', count: 3 }); - // Accompagnement des démarches - structureCountTab.push({ id: 'Accompagnant CAF', count: 7 }); - structureCountTab.push({ id: 'Pôle Emploi', count: 9 }); - structureCountTab.push({ id: 'CPAM', count: 7 }); - structureCountTab.push({ id: 'Impôts', count: 6 }); - structureCountTab.push({ id: 'Logement', count: 5 }); - structureCountTab.push({ id: 'CARSAT', count: 5 }); - structureCountTab.push({ id: 'Autres', count: 2 }); - // Publics acceptés - structureCountTab.push({ id: 'Tout public', count: 7 }); - structureCountTab.push({ id: 'Moins de 16 ans', count: 4 }); - structureCountTab.push({ id: 'Jeunes (16-25 ans)', count: 6 }); - structureCountTab.push({ id: 'Adultes', count: 9 }); - structureCountTab.push({ id: 'Séniors (+ de 65 ans)', count: 1 }); - // Labels et qualifications - structureCountTab.push({ id: 'Aidants Connect', count: 0 }); - structureCountTab.push({ id: 'Espace public numérique (EPN)', count: 2 }); - structureCountTab.push({ id: 'Fabrique de territoire', count: 3 }); - structureCountTab.push({ id: 'Maison France Service', count: 0 }); - structureCountTab.push({ id: 'Pass numérique', count: 4 }); - // Modalités d'accès - structureCountTab.push({ id: 'Uniquement sur RDV', count: 13 }); - structureCountTab.push({ id: 'Accès libre', count: 6 }); - structureCountTab.push({ id: 'Téléphone / Visio', count: 6 }); - // Accompagnement des publics - structureCountTab.push({ id: "Personnes en situation d'illetrisme", count: 0 }); - structureCountTab.push({ id: 'Langue étrangère (anglais)', count: 0 }); - structureCountTab.push({ id: 'Langues étrangères (autres)', count: 0 }); - structureCountTab.push({ id: 'Surdité', count: 0 }); - structureCountTab.push({ id: 'Déficience visuelle', count: 0 }); - structureCountTab.push({ id: 'Handicap moteur', count: 0 }); - // Équipements et services proposés - structureCountTab.push({ id: 'Wifi en accès libre', count: 6 }); - structureCountTab.push({ id: 'Ordinateurs', count: 5 }); - structureCountTab.push({ id: 'Tablettes', count: 1 }); - structureCountTab.push({ id: 'Bornes numériques', count: 1 }); - structureCountTab.push({ id: 'Imprimantes', count: 5 }); - structureCountTab.push({ id: 'Prêt / don de matériels', count: 0 }); - structureCountTab.push({ id: 'Reconditionnements de matériel', count: 0 }); - structureCountTab.push({ id: 'Accès à des revues ou livres informatiques et numériques', count: 0 }); - - return res.status(200).jsonp(structureCountTab); -}); - -// Use default router -server.use(router); -server.listen(3000, () => { - console.log('JSON Server is running'); -}); diff --git a/package.json b/package.json index decbde6f7..93e6f82a0 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,7 @@ "lint": "ng lint", "e2e": "ng e2e", "release": "standard-version", - "translate": "ng xi18n --ivy --output-path src/locale --out-file messages.en.xlf", - "api": "json-server api/db.json --routes api/routes.json --no-cors=true" + "translate": "ng xi18n --ivy --output-path src/locale --out-file messages.en.xlf" }, "private": true, "dependencies": { @@ -33,7 +32,6 @@ "@ngx-translate/core": "^13.0.0", "ag-grid-angular": "^26.2.0", "ag-grid-community": "^26.2.1", - "json-server": "^0.17.0", "jwt-decode": "^3.1.2", "leaflet": "^1.7.1", "leaflet.locatecontrol": "^0.72.0", -- GitLab