From 1f997f2c6536d36cda8df7f0cf09d24b9d50e2d7 Mon Sep 17 00:00:00 2001 From: Guilhem CARRON <gcarron@grandlyon.com> Date: Wed, 16 Nov 2022 14:09:30 +0000 Subject: [PATCH] feat: Add solidarity material in onboarding + carto + edit --- .../form/footer-form/footer-form.component.ts | 1 - src/app/form/form-view/form-view.component.ts | 12 +++--- src/app/form/form-view/form-view.module.ts | 5 +-- .../structure-equipments.component.html | 2 +- .../structure-equipments.component.ts | 2 +- .../structure-form.component.html | 12 +++--- .../structure-form.component.ts | 18 ++++---- .../structure-other-services.component.html | 42 ------------------- ...structure-other-services.component.spec.ts | 25 ----------- .../structure-other-services.component.ts | 35 ---------------- ...ructure-solidarity-material.component.html | 30 +++++++++++++ ...ructure-solidarity-material.component.scss | 3 ++ ...ture-solidarity-material.component.spec.ts | 23 ++++++++++ ...structure-solidarity-material.component.ts | 35 ++++++++++++++++ .../structure-form/structureFormStep.enum.ts | 2 +- src/app/models/structure.model.ts | 2 +- .../structure-edition-summary.component.html | 25 ++++------- .../structure-edition-summary.component.ts | 22 +++------- src/app/shared/enum/category.enum.ts | 1 - .../structure-details.component.html | 15 ------- .../structure-list-search.component.ts | 5 +-- src/app/utils/formUtils.ts | 10 +---- src/app/utils/utils.ts | 28 +++---------- 23 files changed, 141 insertions(+), 214 deletions(-) delete mode 100644 src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.html delete mode 100644 src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.spec.ts delete mode 100644 src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts create mode 100644 src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.html create mode 100644 src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.scss create mode 100644 src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.spec.ts create mode 100644 src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.ts diff --git a/src/app/form/footer-form/footer-form.component.ts b/src/app/form/footer-form/footer-form.component.ts index 647983d32..deb0bf577 100644 --- a/src/app/form/footer-form/footer-form.component.ts +++ b/src/app/form/footer-form/footer-form.component.ts @@ -2,7 +2,6 @@ import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from import { UntypedFormGroup } from '@angular/forms'; import { Router } from '@angular/router'; import { User } from '../../models/user.model'; -import { ProfileService } from '../../profile/services/profile.service'; import { AuthService } from '../../services/auth.service'; import { NewsletterService } from '../../services/newsletter.service'; import { ButtonType } from '../../shared/components/button/buttonType.enum'; diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts index 206b57ad2..2b9d848b7 100644 --- a/src/app/form/form-view/form-view.component.ts +++ b/src/app/form/form-view/form-view.component.ts @@ -469,12 +469,6 @@ export class FormViewComponent implements OnInit, AfterViewInit { return { freeWorkShop: this.structureForm.get('freeWorkShop').value, }; - case structureFormStep.structureOtherServices: - return { - categories: { - equipmentsServices: this.structureForm.get('categories').get('equipmentsAndServices').value, - }, - }; case structureFormStep.structureWifi: return { categories: { @@ -493,6 +487,12 @@ export class FormViewComponent implements OnInit, AfterViewInit { labelsQualifications: this.structureForm.get('categories').get('labelsQualifications').value, }, }; + case structureFormStep.structureSolidarityMaterial: + return { + categories: { + solidarityMaterial: this.structureForm.get('categories').get('solidarityMaterial').value, + }, + }; case structureFormStep.structureDescription: return { description: this.structureForm.get('description').value, diff --git a/src/app/form/form-view/form-view.module.ts b/src/app/form/form-view/form-view.module.ts index a7dd1f135..71ce09b81 100644 --- a/src/app/form/form-view/form-view.module.ts +++ b/src/app/form/form-view/form-view.module.ts @@ -31,7 +31,6 @@ import { StructureFormComponent } from './structure-form/structure-form.componen import { StructureHoursComponent } from './structure-form/structure-hours/structure-hours.component'; import { StructureLabelsComponent } from './structure-form/structure-labels/structure-labels.component'; import { StructureNameAndAddressComponent } from './structure-form/structure-name-and-address/structure-name-and-address.component'; -import { StructureOtherServicesComponent } from './structure-form/structure-other-services/structure-other-services.component'; import { structureDigitalHelpingAccompanimentOtherComponent } from './structure-form/structure-public-target-other/structure-public-target-other.component'; import { StructurePublicTargetComponent } from './structure-form/structure-public-target/structure-public-target.component'; import { StructureTrainingPriceComponent } from './structure-form/structure-training-price/structure-training-price.component'; @@ -39,6 +38,7 @@ import { StructureTrainingTypeComponent } from './structure-form/structure-train import { StructureTypeComponent } from './structure-form/structure-type/structure-type.component'; import { StructureWebAndSocialNetworkComponent } from './structure-form/structure-web-and-social-network/structure-web-and-social-network.component'; import { StructureWifiComponent } from './structure-form/structure-wifi/structure-wifi.component'; +import { StructureSolidarityMaterialComponent } from './structure-form/structure-solidarity-material/structure-solidarity-material.component'; @NgModule({ declarations: [ @@ -53,7 +53,6 @@ import { StructureWifiComponent } from './structure-form/structure-wifi/structur ProfileEmployerSelectionComponent, ProfileJobSelectionComponent, ProfileStructureChoiceComponent, - PersonalOfferOtherStructureChoiceComponent, StructureNameAndAddressComponent, StructureContactComponent, StructureAccompanimentChoiceComponent, @@ -69,7 +68,6 @@ import { StructureWifiComponent } from './structure-form/structure-wifi/structur StructureWifiComponent, StructureEquipmentsComponent, StructureLabelsComponent, - StructureOtherServicesComponent, StructureDescriptionComponent, StructureCovidInfoComponent, StructureConsentComponent, @@ -79,6 +77,7 @@ import { StructureWifiComponent } from './structure-form/structure-wifi/structur StructureTypeComponent, AccountNewsletterComponent, StructureTrainingTypeComponent, + StructureSolidarityMaterialComponent, ], imports: [CommonModule, FormViewRoutingModule, SharedModule], providers: [PersonalOfferGuard], diff --git a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.html b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.html index 0460957c2..996be7ec0 100644 --- a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.html +++ b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.html @@ -12,7 +12,7 @@ <p>Facultatif</p> </div> </div> - <ng-container *ngFor="let equipment of equipmentsAndServices"> + <ng-container *ngFor="let equipment of selfServiceMaterial"> <div class="controller equipments" *ngIf="['computer', 'printer', 'scanner'].includes(equipment.module.id)"> <div fxLayout="column"> <div class="controllerHeader" fxLayout="row" fxLayoutAlign="space-between center"> diff --git a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts index b616dd970..8c803479e 100644 --- a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts +++ b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts @@ -10,7 +10,7 @@ import { CategoriesToggle } from 'src/app/models/categoriesToggle.model'; export class StructureEquipmentsComponent implements OnInit { @Input() structureForm: UntypedFormGroup; @Input() isEditMode: boolean; - @Input() equipmentsAndServices: CategoriesToggle[]; + @Input() selfServiceMaterial: CategoriesToggle[]; @Output() validateForm = new EventEmitter<any>(); private vowels = ['a', 'e', 'i', 'o', 'u', 'y']; diff --git a/src/app/form/form-view/structure-form/structure-form.component.html b/src/app/form/form-view/structure-form/structure-form.component.html index 601f83e1b..aba2c1cf6 100644 --- a/src/app/form/form-view/structure-form/structure-form.component.html +++ b/src/app/form/form-view/structure-form/structure-form.component.html @@ -157,7 +157,7 @@ <div *ngIf="currentStep == structureFormStep.structureEquipments"> <app-structure-equipments [structureForm]="structureForm" - [equipmentsAndServices]="equipments" + [selfServiceMaterial]="equipments" (validateForm)="setValidationsForm($event)" [isEditMode]="isEditMode" (inArray)="isInArray($event)" @@ -172,14 +172,14 @@ (validateForm)="setValidationsForm($event)" ></app-structure-labels> </div> - <div *ngIf="currentStep == structureFormStep.structureOtherServices"> - <app-structure-other-services + <div *ngIf="currentStep == structureFormStep.structureSolidarityMaterial"> + <app-structure-solidarity-material [structureForm]="structureForm" - [equipmentsAndServices]="equipmentsServices" + [solidarityMaterial]="solidarityMaterial" [isEditMode]="isEditMode" (validateForm)="setValidationsForm($event)" - (checkChange)="onCheckChange($event)" - ></app-structure-other-services> + (updateChoice)="updateChoice($event)" + ></app-structure-solidarity-material> </div> <div *ngIf="currentStep == structureFormStep.structureDigitalHelpingAccompaniment"> <app-structure-digital-helping-accompaniment diff --git a/src/app/form/form-view/structure-form/structure-form.component.ts b/src/app/form/form-view/structure-form/structure-form.component.ts index 13ea981b7..3079d5194 100644 --- a/src/app/form/form-view/structure-form/structure-form.component.ts +++ b/src/app/form/form-view/structure-form/structure-form.component.ts @@ -44,7 +44,6 @@ export class StructureFormComponent implements OnChanges, OnInit { public userAcceptSavedDate = false; // Form var - public equipmentsServices: { module: Module; openned: boolean }[] = []; public equipments: { module: Module; openned: boolean }[] = []; public trainingCategories: CategoriesToggle[] = []; public accessModality: Category; @@ -54,6 +53,7 @@ export class StructureFormComponent implements OnChanges, OnInit { public publicOthers: Category; public handicaps: Category; public languageAndIlliteracy: Category; + public solidarityMaterial: Category; constructor( private searchService: SearchService, @@ -70,7 +70,7 @@ export class StructureFormComponent implements OnChanges, OnInit { this.currentStep === structureFormStep.structureTrainingType || this.currentStep === structureFormStep.structureEquipments || this.currentStep === structureFormStep.structureLabels || - this.currentStep === structureFormStep.structureOtherServices || + this.currentStep === structureFormStep.structureSolidarityMaterial || this.currentStep === structureFormStep.structureDescription || this.currentStep === structureFormStep.structureCovidInfo || this.currentStep === structureFormStep.mailSentInfo || @@ -220,8 +220,8 @@ export class StructureFormComponent implements OnChanges, OnInit { this.pagesValidation[structureFormStep.structureLabels] = { valid: true, }; - this.pagesValidation[structureFormStep.structureOtherServices] = { - valid: this.structureForm.get('categories').get('equipmentsAndServices').valid, + this.pagesValidation[structureFormStep.structureSolidarityMaterial] = { + valid: true, }; this.pagesValidation[structureFormStep.structureDescription] = { valid: true, @@ -260,12 +260,6 @@ export class StructureFormComponent implements OnChanges, OnInit { }); break; } - case CategoryEnum.equipmentsServices: { - categ.modules.forEach((c) => { - this.equipmentsServices.push({ module: c, openned: false }); - }); - break; - } case CategoryEnum.labelsQualifications: { this.labelsQualifications = categ; break; @@ -282,6 +276,10 @@ export class StructureFormComponent implements OnChanges, OnInit { this.publicOthers = categ; break; } + case CategoryEnum.solidarityMaterial: { + this.solidarityMaterial = categ; + break; + } case CategoryEnum.handicaps: { this.handicaps = categ; break; diff --git a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.html b/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.html deleted file mode 100644 index cc6253864..000000000 --- a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.html +++ /dev/null @@ -1,42 +0,0 @@ -<form [formGroup]="structureForm" (keyup.enter)="(!isEditMode ? '' : null)"> - <div class="title" [ngClass]="{ editTitle: isEditMode }"> - <app-svg-icon - (click)="goBack()" - *ngIf="isEditMode" - [iconClass]="'backArrow'" - [type]="'ico'" - [icon]="'arrowBack'" - ></app-svg-icon> - <div class="titleContent"> - <h3>Quels sont les autres services proposés par la structure ?</h3> - <p>Facultatif</p> - </div> - </div> - <div *ngIf="equipmentsAndServices" fxLayout="column wrap" fxLayoutAlign="flex-start" class="otherServices"> - <!-- Display checkbox conditionning next screen --> - <!-- TODO: Us for display this screen --> - <app-checkbox-form - [isChecked]="isInArray('equipmentsAndServices', 'solidarityMaterial')" - [text]="'Vente de matériel numérique à tarif solidaire'" - [iconSvg]="'venteMaterielPrixSolidaire'" - > - </app-checkbox-form> - <!-- Regular database info --> - <ng-container *ngFor="let service of equipmentsAndServices"> - <app-checkbox-form - *ngIf=" - [ - 'donDeMateriels', - 'reconditionnementsDeMateriel', - 'accesLivresInformatiques', - ].includes(service.module.id) - " - [isChecked]="isInArray('equipmentsAndServices', service.module.id)" - [text]="service.module.name" - [iconSvg]="service.module.id" - (checkEvent)="onCheckChange($event, 'categories.equipmentsAndServices', service.module.id)" - > - </app-checkbox-form> - </ng-container> - </div> -</form> diff --git a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.spec.ts b/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.spec.ts deleted file mode 100644 index c2509b87a..000000000 --- a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { StructureOtherServicesComponent } from './structure-other-services.component'; - -describe('StructureOtherServicesComponent', () => { - let component: StructureOtherServicesComponent; - let fixture: ComponentFixture<StructureOtherServicesComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ StructureOtherServicesComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(StructureOtherServicesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts b/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts deleted file mode 100644 index 7229c2d8f..000000000 --- a/src/app/form/form-view/structure-form/structure-other-services/structure-other-services.component.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; -import { formUtils } from 'src/app/utils/formUtils'; -import { Category } from '../../../../structure-list/models/category.model'; - -@Component({ - selector: 'app-structure-other-services', - templateUrl: './structure-other-services.component.html', -}) -export class StructureOtherServicesComponent implements OnInit { - @Input() structureForm: UntypedFormGroup; - @Input() isEditMode: boolean; - @Input() equipmentsAndServices: Category; - @Output() validateForm = new EventEmitter<any>(); - @Output() checkChange = new EventEmitter<any>(); - public formUtils = new formUtils(); - - async ngOnInit(): Promise<void> { - this.validateForm.emit(); - } - - public isInArray(formControlName: string, term: string): boolean { - return this.formUtils.isInCategoryArray(term, formControlName, this.structureForm); - } - public onCheckChange(event: boolean, formControlName: string, modality: string) { - this.checkChange.emit({ - event, - formControlName, - value: modality, - }); - } - public goBack(): void { - history.back(); - } -} diff --git a/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.html b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.html new file mode 100644 index 000000000..e6aaf5e9c --- /dev/null +++ b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.html @@ -0,0 +1,30 @@ +<form + [formGroup]="structureForm" + *ngIf="structureForm && solidarityMaterial" + (keyup.enter)="isPageValid && !isEditMode ? nextPage() : null" +> + <div class="title" [ngClass]="{ editTitle: isEditMode }"> + <app-svg-icon + (click)="goBack()" + *ngIf="isEditMode" + [iconClass]="'backArrow'" + [type]="'ico'" + [icon]="'arrowBack'" + ></app-svg-icon> + <div class="titleContent"> + <h3>Quel matériel numérique vendez-vous à tarif solidaire ?</h3> + <p>Facultatif</p> + </div> + </div> + <div class="btn-grid"> + <span *ngFor="let material of solidarityMaterial.modules"> + <app-button + [ngClass]="{ selectedChoice: true }" + [extraClass]="isInArray(material.id) ? 'selected' : ''" + [style]="buttonTypeEnum.CheckButton" + [text]="material.name" + (action)="updateChoiceSolidarityMaterial(material.id)" + ></app-button> + </span> + </div> +</form> diff --git a/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.scss b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.scss new file mode 100644 index 000000000..f53b48a3f --- /dev/null +++ b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.scss @@ -0,0 +1,3 @@ +.btn-grid { + max-width: 550px; +} diff --git a/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.spec.ts b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.spec.ts new file mode 100644 index 000000000..83cc8defc --- /dev/null +++ b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StructureSolidarityMaterialComponent } from './structure-solidarity-material.component'; + +describe('StructureSolidarityMaterialComponent', () => { + let component: StructureSolidarityMaterialComponent; + let fixture: ComponentFixture<StructureSolidarityMaterialComponent>; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ StructureSolidarityMaterialComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(StructureSolidarityMaterialComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.ts b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.ts new file mode 100644 index 000000000..c7500331b --- /dev/null +++ b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.ts @@ -0,0 +1,35 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { UntypedFormGroup } from '@angular/forms'; +import { ButtonType } from '../../../../shared/components/button/buttonType.enum'; +import { Category } from '../../../../structure-list/models/category.model'; + +@Component({ + selector: 'app-structure-solidarity-material', + templateUrl: './structure-solidarity-material.component.html', + styleUrls: ['./structure-solidarity-material.component.scss'], +}) +export class StructureSolidarityMaterialComponent implements OnInit { + @Input() structureForm: UntypedFormGroup; + @Input() solidarityMaterial: Category; + @Input() isEditMode: boolean; + @Output() updateChoice = new EventEmitter<any>(); + @Output() validateForm = new EventEmitter<any>(); + + public buttonTypeEnum = ButtonType; + + ngOnInit(): void { + this.validateForm.emit(); + } + + public updateChoiceSolidarityMaterial(choice: string) { + this.updateChoice.emit({ formControlName: 'categories.solidarityMaterial', choice }); + } + + public isInArray(choice: string): boolean { + return this.structureForm.get('categories').get('solidarityMaterial')?.value.includes(choice); + } + + public goBack(): void { + history.back(); + } +} diff --git a/src/app/form/form-view/structure-form/structureFormStep.enum.ts b/src/app/form/form-view/structure-form/structureFormStep.enum.ts index bf9b11ab7..84e846544 100644 --- a/src/app/form/form-view/structure-form/structureFormStep.enum.ts +++ b/src/app/form/form-view/structure-form/structureFormStep.enum.ts @@ -19,7 +19,7 @@ export enum structureFormStep { structureWifi, structureEquipments, structureLabels, - structureOtherServices, + structureSolidarityMaterial, structureDescription, structureCovidInfo, structureConsent, diff --git a/src/app/models/structure.model.ts b/src/app/models/structure.model.ts index 77850a04d..b61459a80 100644 --- a/src/app/models/structure.model.ts +++ b/src/app/models/structure.model.ts @@ -74,7 +74,7 @@ export class Structure { onlineProcedures: obj?.categories?.onlineProcedures || [], publicOthers: obj?.categories?.publicOthers || [], selfServiceMaterial: obj?.categories?.selfServiceMaterial || [], - equipmentsServices: obj?.categories?.equipmentsServices || [], + solidarityMaterial: obj?.categories?.solidarityMaterial || [], }, }); } diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html index b6a7be0e4..0217e060a 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html @@ -557,37 +557,30 @@ </div> </div> </div> - - <div class="section otherServices"> + <div class="section solidarityMaterial"> <div class="sectionHeader"> - <p>Autres services proposés</p> + <p>Vente de matériel à prix solidaire</p> <app-button class="hide-on-mobile" [text]="'Modifier'" [style]="buttonTypeEnum.Secondary" [extraClass]="'editButton'" - (action)="goToEdit(structureFormStep.structureOtherServices)" + (action)="goToEdit(structureFormStep.structureSolidarityMaterial)" ></app-button> <app-button class="hide-on-desktop" [iconBtn]="'edit'" [style]="buttonTypeEnum.SecondaryOnlyIcon" - (action)="goToEdit(structureFormStep.structureOtherServices)" + (action)="goToEdit(structureFormStep.structureSolidarityMaterial)" ></app-button> </div> <div class="content"> - <app-no-information - *ngIf=" - structure.categoriesDisplay.equipmentsServices && - structure.categoriesDisplay.equipmentsServices.length === 0 - " - ></app-no-information> - <div *ngFor="let equipement of structure.categoriesDisplay.equipmentsServices" class="list"> - <p>{{ equipement }}</p> + <app-no-information *ngIf="structure.categoriesDisplay.solidarityMaterial.length === 0"></app-no-information> + <div *ngFor="let material of structure.categoriesDisplay.solidarityMaterial" class="list"> + <p>{{ material }}</p> </div> </div> </div> - <div class="section covid"> <div class="sectionHeader"> <p>Informations spécifiques à la période COVID</p> @@ -659,7 +652,7 @@ <div class="footer"> <ng-container *ngIf="isUpdateStructure"> <p class="warning" *ngIf="!isFormValid()"> - Vous pourrez valider après avoir renseigner l’intégralité des champs obligatoires. + Vous pourrez valider après avoir renseigné l’intégralité des champs obligatoires. </p> <div class="buttons"> <app-button [text]="'Retour'" [iconBtn]="'close'" (click)="goBack()"></app-button> @@ -668,7 +661,7 @@ [iconBtn]="'check'" [style]="buttonTypeEnum.Primary" [disabled]="!isFormValid()" - (click)="updateStructure()" + (click)="updateStructureUpdateDate()" ></app-button> </div> </ng-container> diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts index c589a4333..3342c3efa 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts @@ -6,7 +6,6 @@ import { DateTime } from 'luxon'; import { structureFormStep } from '../../form/form-view/structure-form/structureFormStep.enum'; import { Owner } from '../../models/owner.model'; import { Structure } from '../../models/structure.model'; -import { StructureWithOwners } from '../../models/structureWithOwners.model'; import { NotificationService } from '../../services/notification.service'; import { StructureService } from '../../services/structure.service'; import { ButtonType } from '../../shared/components/button/buttonType.enum'; @@ -15,7 +14,6 @@ import { FreeWorkshop } from '../../shared/enum/freeWorkshop.enum'; import { AccessModality } from '../../structure-list/enum/access-modality.enum'; import { Equipment } from '../../structure-list/enum/equipment.enum'; import { Category } from '../../structure-list/models/category.model'; -import { SearchService } from '../../structure-list/services/search.service'; import { formUtils, IStructureSummary } from '../../utils/formUtils'; import { Utils } from '../../utils/utils'; @@ -52,7 +50,6 @@ export class StructureEditionSummaryComponent implements OnInit { constructor( private notificationService: NotificationService, private route: ActivatedRoute, - private searchService: SearchService, private structureService: StructureService, private utils: Utils, public router: Router @@ -95,7 +92,7 @@ export class StructureEditionSummaryComponent implements OnInit { return true; } - public updateStructure(): void { + public updateStructureUpdateDate(): void { this.structureService.editStructure({}, this.structure._id).subscribe(() => { this.notificationService.showSuccess('La structure a bien été mise à jour.', ''); this.isUpdateStructure = false; @@ -169,23 +166,16 @@ export class StructureEditionSummaryComponent implements OnInit { return this.utils.getWorkshopPricingLabel(freeWorkshop); } - public hasWifi(equipmentsAndServices: string[]) { - return this.utils.hasWifi(equipmentsAndServices); + public hasWifi(selfServiceMaterial: string[]) { + return this.utils.hasWifi(selfServiceMaterial); } public hasEquipments(structure: Structure): boolean { - return this.utils.hasEquipments( - structure.categories.selfServiceMaterial, - structure.nbComputers, - structure.nbPrinters, - structure.nbScanners - ); + return this.utils.hasEquipments(structure.nbComputers, structure.nbPrinters, structure.nbScanners); } - - public filterOnlyEquipments(equipmentsAndServices: string[]): string[] { - return this.utils.filterOnlyEquipments(equipmentsAndServices); + public filterOnlyEquipments(selfServiceMaterial: string[]): string[] { + return this.utils.filterOnlyEquipments(selfServiceMaterial); } - public getEquipmentsLabelAndValue(equipment: Equipment, number: number): string { return this.utils.getEquipmentsLabelAndValue(equipment, number); } diff --git a/src/app/shared/enum/category.enum.ts b/src/app/shared/enum/category.enum.ts index 189435d39..2efdafe76 100644 --- a/src/app/shared/enum/category.enum.ts +++ b/src/app/shared/enum/category.enum.ts @@ -1,7 +1,6 @@ export enum CategoryEnum { selfServiceMaterial = 'selfServiceMaterial', solidarityMaterial = 'solidarityMaterial', - equipmentsServices = 'equipmentsServices', onlineProcedures = 'onlineProcedures', baseSkills = 'baseSkills', advancedSkills = 'advancedSkills', diff --git a/src/app/structure-list/components/structure-details/structure-details.component.html b/src/app/structure-list/components/structure-details/structure-details.component.html index 9d718a764..bce3970c1 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.html +++ b/src/app/structure-list/components/structure-details/structure-details.component.html @@ -456,21 +456,6 @@ </div> </div> - <!-- Autres services --> - <div - *ngIf="structure.categories.equipmentsServices && structure.categories.equipmentsServices.length" - fxLayout="column" - class="structure-details-block" - fxLayoutAlign="baseline baseline" - > - <h2>Autres services</h2> - <div fxLayout="column"> - <p *ngFor="let equipement of structure.categoriesDisplay.equipmentsServices" class="no-margin-bottom"> - <span>{{ equipement }}</span> - </p> - </div> - </div> - <!-- Transport --> <div *ngIf="tclStopPoints.length" diff --git a/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts b/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts index 1750263bb..6843de542 100644 --- a/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts +++ b/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts @@ -144,10 +144,7 @@ export class StructureListSearchComponent implements OnInit { module.name === 'publicOthers' ).length; this.numberEquipmentChecked = checkedModules.filter( - (module) => - module.name === 'solidarityMaterial' || - module.name === 'selfServiceMaterial' || - module.name === 'equipmentsServices' + (module) => module.name === 'solidarityMaterial' || module.name === 'selfServiceMaterial' ).length; this.numberMoreFiltersChecked = checkedModules.filter( (module) => module.name === 'labelsQualifications' || module.name === 'accessModality' diff --git a/src/app/utils/formUtils.ts b/src/app/utils/formUtils.ts index 40e915ce0..f139e3bb1 100644 --- a/src/app/utils/formUtils.ts +++ b/src/app/utils/formUtils.ts @@ -37,14 +37,9 @@ export class formUtils { }, { step: structureFormStep.structureTrainingType, name: 'Ateliers au numérique proposés', inputs: null }, { step: structureFormStep.structureTrainingPrice, name: 'Gratuité des ateliers', inputs: ['freeWorkShop'] }, - { step: structureFormStep.structureWifi, name: 'Wifi', inputs: ['equipmentsAndServices'] }, + { step: structureFormStep.structureWifi, name: 'Wifi', inputs: ['selfServiceMaterial'] }, { step: structureFormStep.structureEquipments, name: 'Equipements mis à disposition', inputs: null }, { step: structureFormStep.structureLabels, name: 'Labélisations proposées', inputs: null }, - { - step: structureFormStep.structureOtherServices, - name: 'Autres services proposés', - inputs: ['equipmentsAndServices'], - }, { step: structureFormStep.structureDescription, name: 'Présentation de la structure', inputs: null }, { step: structureFormStep.structureCovidInfo, name: 'Informations spécifiques à la période COVID', inputs: null }, { @@ -127,10 +122,9 @@ export class formUtils { languageAndIlliteracy: this.loadArrayForCheckbox(structure.categories.languageAndIlliteracy, false), selfServiceMaterial: this.loadArrayForCheckbox(structure.categories.selfServiceMaterial, false), publicOthers: this.loadArrayForCheckbox(structure.categories.publicOthers, false), - equipmentsAndServices: this.loadArrayForCheckbox(structure.categories.equipmentsServices, false), baseSkills: new UntypedFormControl(structure.categories.baseSkills), advancedSkills: new UntypedFormControl(structure.categories.advancedSkills), - // solidarityMaterial: this.loadArrayForCheckbox(structure.categories.solidarityMaterial, false), + solidarityMaterial: this.loadArrayForCheckbox(structure.categories.solidarityMaterial, false), }), //TODO: remettre ou migrer les données de accompagnements à distance remoteAccompaniment: new UntypedFormControl(false), diff --git a/src/app/utils/utils.ts b/src/app/utils/utils.ts index 28bba0848..e991c79d5 100644 --- a/src/app/utils/utils.ts +++ b/src/app/utils/utils.ts @@ -88,24 +88,19 @@ export class Utils { return FreeWorkshop[freeWorkshop]; } - public hasWifi(equipmentsAndServices: string[]) { - return equipmentsAndServices.includes('wifiEnAccesLibre'); + public hasWifi(selfServiceMaterial: string[]) { + return selfServiceMaterial.includes('wifiEnAccesLibre'); } /** * Verify that a structure has equipments and checks that their value is > 0 */ - public hasEquipments( - equipmentsServices: string[], - nbComputers: number, - nbPrinters: number, - nbScanners: number - ): boolean { - return equipmentsServices.length && nbComputers + nbPrinters + nbScanners > 0; + public hasEquipments(nbComputers: number, nbPrinters: number, nbScanners: number): boolean { + return nbComputers + nbPrinters + nbScanners > 0; } - public filterOnlyEquipments(equipmentsAndServices: string[]): string[] { - return equipmentsAndServices.filter((equipment) => ['ordinateurs', 'imprimantes', 'scanners'].includes(equipment)); + public filterOnlyEquipments(selfServiceMaterial: string[]): string[] { + return selfServiceMaterial.filter((equipment) => ['ordinateurs', 'imprimantes', 'scanners'].includes(equipment)); } public getEquipmentsLabelAndValue(equipment: Equipment, number: number): string { @@ -123,17 +118,6 @@ export class Utils { } } - public filterOtherServices(equipmentsAndServices: string[]): string[] { - return equipmentsAndServices.filter((equipment) => - [ - 'reconditionnementsDeMateriel', - 'accesLivresInformatiques', - 'venteMaterielPrixSolidaire', - 'donDeMateriels', - ].includes(equipment) - ); - } - public getOtherServicesLabel(otherService: OtherServices) { return OtherServices[otherService]; } -- GitLab