From 969d350c33c6ca680597dcb7d52fb90d9e19dcad Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Thu, 3 Nov 2022 14:33:17 +0100 Subject: [PATCH 1/4] feat: Add solidarity material in onboarding + carto + edit --- .../form/footer-form/footer-form.component.ts | 2 - src/app/form/form-view/form-view.component.ts | 6 +++ src/app/form/form-view/form-view.module.ts | 2 + .../structure-form.component.html | 9 +++++ .../structure-form.component.ts | 8 ++++ ...ructure-solidarity-material.component.html | 29 ++++++++++++++ ...ructure-solidarity-material.component.scss | 3 ++ ...ture-solidarity-material.component.spec.ts | 23 +++++++++++ ...structure-solidarity-material.component.ts | 39 +++++++++++++++++++ .../structure-form/structureFormStep.enum.ts | 1 + src/app/models/structure.model.ts | 1 + .../structure-edition-summary.component.html | 25 +++++++++++- .../structure-edition-summary.component.ts | 12 ++---- src/app/utils/formUtils.ts | 2 +- 14 files changed, 148 insertions(+), 14 deletions(-) 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 45f2ba576..207d1c1ed 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'; @@ -46,7 +45,6 @@ export class FooterFormComponent implements OnChanges { private authService: AuthService, public utils: Utils, private router: Router, - private profileService: ProfileService, private newsletterService: NewsletterService ) {} public goToNextPage(): void { diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts index 68e2abb9b..23a6c22fb 100644 --- a/src/app/form/form-view/form-view.component.ts +++ b/src/app/form/form-view/form-view.component.ts @@ -487,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 b157825f4..8ea64e849 100644 --- a/src/app/form/form-view/form-view.module.ts +++ b/src/app/form/form-view/form-view.module.ts @@ -41,6 +41,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: [ @@ -83,6 +84,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-form.component.html b/src/app/form/form-view/structure-form/structure-form.component.html index 601f83e1b..4fe24ebf9 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 @@ -181,6 +181,15 @@ (checkChange)="onCheckChange($event)" ></app-structure-other-services> </div> + <div *ngIf="currentStep == structureFormStep.structureSolidarityMaterial"> + <app-structure-solidarity-material + [structureForm]="structureForm" + [solidarityMaterial]="solidarityMaterial" + [isEditMode]="isEditMode" + (validateForm)="setValidationsForm($event)" + (updateChoice)="updateChoice($event)" + ></app-structure-solidarity-material> + </div> <div *ngIf="currentStep == structureFormStep.structureDigitalHelpingAccompaniment"> <app-structure-digital-helping-accompaniment [isEditMode]="isEditMode" diff --git a/src/app/form/form-view/structure-form/structure-form.component.ts b/src/app/form/form-view/structure-form/structure-form.component.ts index 13ea981b7..6798462e7 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 @@ -54,6 +54,7 @@ export class StructureFormComponent implements OnChanges, OnInit { public publicOthers: Category; public handicaps: Category; public languageAndIlliteracy: Category; + public solidarityMaterial: Category; constructor( private searchService: SearchService, @@ -223,6 +224,9 @@ export class StructureFormComponent implements OnChanges, OnInit { this.pagesValidation[structureFormStep.structureOtherServices] = { valid: this.structureForm.get('categories').get('equipmentsAndServices').valid, }; + this.pagesValidation[structureFormStep.structureSolidarityMaterial] = { + valid: this.structureForm.get('categories').get('solidarityMaterial').valid, + }; this.pagesValidation[structureFormStep.structureDescription] = { valid: true, }; @@ -282,6 +286,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-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..9e1823d0a --- /dev/null +++ b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.html @@ -0,0 +1,29 @@ +<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> + </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..853ec4010 --- /dev/null +++ b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.ts @@ -0,0 +1,39 @@ +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) { + if ( + this.structureForm.get('categories').get('solidarityMaterial') && + this.structureForm.get('categories').get('solidarityMaterial').value.includes(choice) + ) + return true; + return false; + } + 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..501d68811 100644 --- a/src/app/form/form-view/structure-form/structureFormStep.enum.ts +++ b/src/app/form/form-view/structure-form/structureFormStep.enum.ts @@ -20,6 +20,7 @@ export enum structureFormStep { structureEquipments, structureLabels, structureOtherServices, + structureSolidarityMaterial, structureDescription, structureCovidInfo, structureConsent, diff --git a/src/app/models/structure.model.ts b/src/app/models/structure.model.ts index 2913e4112..bd11f063c 100644 --- a/src/app/models/structure.model.ts +++ b/src/app/models/structure.model.ts @@ -75,6 +75,7 @@ export class Structure { 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 007aec27d..b8a9370be 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 @@ -492,6 +492,27 @@ </div> </div> + <div class="section solidarityMaterial"> + <div class="sectionHeader"> + <p>Vente de matériel à prix solidaire</p> + <app-button + [type]="'button'" + [text]="'Modifier'" + [style]="buttonTypeEnum.Secondary" + [extraClass]="'editButton'" + (action)="goToEdit(structureFormStep.structureSolidarityMaterial)" + ></app-button> + </div> + <div class="content"> + <app-missing-information + *ngIf="structure.categories.solidarityMaterial && structure.categoriesDisplay.solidarityMaterial.length === 0" + ></app-missing-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> @@ -529,7 +550,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> @@ -538,7 +559,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 22dc57c7e..4b7d566c0 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 @@ -13,7 +13,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'; @@ -49,7 +48,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 @@ -88,7 +86,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; @@ -132,9 +130,7 @@ export class StructureEditionSummaryComponent implements OnInit { } public containsDigitalHelp(): boolean { - return ( - this.structure.categoriesDisplay.onlineProcedures?.length > 0 - ); + return this.structure.categoriesDisplay.onlineProcedures?.length > 0; } public getDigitalHelpLabel(digitalHelp: Demarches): string { @@ -145,9 +141,7 @@ export class StructureEditionSummaryComponent implements OnInit { return this.structure.categories.baseSkills?.length > 0; } public isAdvancedSkills(): boolean { - return ( - this.structure.categories.advancedSkills?.length > 0 - ); + return this.structure.categories.advancedSkills?.length > 0; } public containsDigitalLearning(): boolean { diff --git a/src/app/utils/formUtils.ts b/src/app/utils/formUtils.ts index 40e915ce0..80233a48a 100644 --- a/src/app/utils/formUtils.ts +++ b/src/app/utils/formUtils.ts @@ -130,7 +130,7 @@ export class formUtils { 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, true), }), //TODO: remettre ou migrer les données de accompagnements à distance remoteAccompaniment: new UntypedFormControl(false), -- GitLab From 82032ed9307f4e8e0ed419a12a4a7588e972bdbc Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Tue, 8 Nov 2022 11:00:38 +0100 Subject: [PATCH 2/4] feat: Remove equipmentsServices from referential --- src/app/form/form-view/form-view.component.ts | 6 --- src/app/form/form-view/form-view.module.ts | 2 - .../structure-equipments.component.html | 2 +- .../structure-equipments.component.ts | 2 +- .../structure-form.component.html | 11 +---- .../structure-form.component.ts | 14 +------ .../structure-other-services.component.html | 42 ------------------- ...structure-other-services.component.spec.ts | 25 ----------- .../structure-other-services.component.ts | 35 ---------------- .../structure-form/structureFormStep.enum.ts | 1 - .../structure-print-header.component.ts | 3 -- src/app/models/structure.model.ts | 1 - .../structure-edition-summary.component.html | 30 +------------ .../structure-edition-summary.component.ts | 17 +++----- 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 +++---------- 19 files changed, 20 insertions(+), 230 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 diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts index 23a6c22fb..251aa38b6 100644 --- a/src/app/form/form-view/form-view.component.ts +++ b/src/app/form/form-view/form-view.component.ts @@ -463,12 +463,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: { diff --git a/src/app/form/form-view/form-view.module.ts b/src/app/form/form-view/form-view.module.ts index 8ea64e849..1957ae538 100644 --- a/src/app/form/form-view/form-view.module.ts +++ b/src/app/form/form-view/form-view.module.ts @@ -32,7 +32,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 { StructurePmrComponent } from './structure-form/structure-pmr/structure-pmr.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'; @@ -74,7 +73,6 @@ import { StructureSolidarityMaterialComponent } from './structure-form/structure StructureWifiComponent, StructureEquipmentsComponent, StructureLabelsComponent, - StructureOtherServicesComponent, StructureDescriptionComponent, StructureCovidInfoComponent, StructureConsentComponent, 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 4fe24ebf9..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,15 +172,6 @@ (validateForm)="setValidationsForm($event)" ></app-structure-labels> </div> - <div *ngIf="currentStep == structureFormStep.structureOtherServices"> - <app-structure-other-services - [structureForm]="structureForm" - [equipmentsAndServices]="equipmentsServices" - [isEditMode]="isEditMode" - (validateForm)="setValidationsForm($event)" - (checkChange)="onCheckChange($event)" - ></app-structure-other-services> - </div> <div *ngIf="currentStep == structureFormStep.structureSolidarityMaterial"> <app-structure-solidarity-material [structureForm]="structureForm" 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 6798462e7..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; @@ -71,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 || @@ -221,11 +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: this.structureForm.get('categories').get('solidarityMaterial').valid, + valid: true, }; this.pagesValidation[structureFormStep.structureDescription] = { valid: true, @@ -264,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; 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/structureFormStep.enum.ts b/src/app/form/form-view/structure-form/structureFormStep.enum.ts index 501d68811..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,6 @@ export enum structureFormStep { structureWifi, structureEquipments, structureLabels, - structureOtherServices, structureSolidarityMaterial, structureDescription, structureCovidInfo, diff --git a/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.ts b/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.ts index bb8508542..a5669a341 100644 --- a/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.ts +++ b/src/app/form/orientation-form/component/structure-print-header/structure-print-header.component.ts @@ -43,9 +43,6 @@ export class StructurePrintHeaderComponent implements OnInit { case 'publicsAccompaniment': this.specificNeeds.push(elem); break; - case 'equipmentsAndServices': - this.equipments.push(elem); - break; case 'accessRight': this.formations.push(elem); break; diff --git a/src/app/models/structure.model.ts b/src/app/models/structure.model.ts index bd11f063c..a85ec1f01 100644 --- a/src/app/models/structure.model.ts +++ b/src/app/models/structure.model.ts @@ -74,7 +74,6 @@ 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 b8a9370be..07f3555d3 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 @@ -467,31 +467,6 @@ </div> </div> </div> - - <div class="section otherServices"> - <div class="sectionHeader"> - <p>Autres services proposés</p> - <app-button - [type]="'button'" - [text]="'Modifier'" - [style]="buttonTypeEnum.Secondary" - [extraClass]="'editButton'" - (action)="goToEdit(structureFormStep.structureOtherServices)" - ></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> - </div> - </div> - </div> - <div class="section solidarityMaterial"> <div class="sectionHeader"> <p>Vente de matériel à prix solidaire</p> @@ -504,10 +479,7 @@ ></app-button> </div> <div class="content"> - <app-missing-information - *ngIf="structure.categories.solidarityMaterial && structure.categoriesDisplay.solidarityMaterial.length === 0" - ></app-missing-information> - + <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> 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 4b7d566c0..241d18cf3 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 @@ -160,23 +160,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 48df73b80..a38b1a2ed 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 @@ -138,10 +138,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 80233a48a..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, true), + 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 aba1a6043..d407a3ca5 100644 --- a/src/app/utils/utils.ts +++ b/src/app/utils/utils.ts @@ -84,24 +84,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 { @@ -119,17 +114,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 From 9312b43cb84a1be4d952011b5b0d40c773649a72 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Tue, 15 Nov 2022 14:36:20 +0100 Subject: [PATCH 3/4] fix review --- .../structure-solidarity-material.component.html | 1 + .../structure-solidarity-material.component.ts | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) 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 index 9e1823d0a..e6aaf5e9c 100644 --- 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 @@ -13,6 +13,7 @@ ></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"> 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 index 853ec4010..c7500331b 100644 --- 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 @@ -25,14 +25,10 @@ export class StructureSolidarityMaterialComponent implements OnInit { this.updateChoice.emit({ formControlName: 'categories.solidarityMaterial', choice }); } - public isInArray(choice: string) { - if ( - this.structureForm.get('categories').get('solidarityMaterial') && - this.structureForm.get('categories').get('solidarityMaterial').value.includes(choice) - ) - return true; - return false; + public isInArray(choice: string): boolean { + return this.structureForm.get('categories').get('solidarityMaterial')?.value.includes(choice); } + public goBack(): void { history.back(); } -- GitLab From 27eddd31c6f7896fc3bf2c30f6a0448f77ad3984 Mon Sep 17 00:00:00 2001 From: gcarron <gcarron@grandlyon.com> Date: Wed, 16 Nov 2022 14:52:39 +0100 Subject: [PATCH 4/4] remove structure with owners --- .../structure-edition-summary.component.html | 2 +- .../structure-edition-summary.component.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html index 501477de4..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 @@ -571,7 +571,7 @@ class="hide-on-desktop" [iconBtn]="'edit'" [style]="buttonTypeEnum.SecondaryOnlyIcon" - (action)="goToEdit(structureFormStep.structureOtherServices)" + (action)="goToEdit(structureFormStep.structureSolidarityMaterial)" ></app-button> </div> <div class="content"> 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 649f5b9de..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'; -- GitLab