From 9d19e5db6849ab80e5afad3740c4e46a1c21d45d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Pailharey?= <rpailharey@grandlyon.com>
Date: Tue, 4 Apr 2023 11:25:35 +0200
Subject: [PATCH] feat: renamed publicOthers into genre

---
 src/app/form/form-view/form-view.component.ts          |  2 +-
 .../structure-form/structure-form.component.html       |  2 +-
 .../structure-form/structure-form.component.ts         |  6 +++---
 .../structure-public-target.component.html             | 10 +++++-----
 .../structure-public-target.component.ts               |  2 +-
 .../online-demarch/onlineDemarch-form.component.html   |  2 +-
 .../orientation-form-view.component.ts                 |  6 +++---
 src/app/models/personalOffer.model.ts                  |  2 +-
 src/app/models/structure.model.ts                      |  2 +-
 .../structure-edition-summary.component.html           |  8 +++-----
 src/app/shared/enum/category.enum.ts                   |  2 +-
 .../structure-details/structure-details.component.html |  4 ++--
 .../structure-list-search.component.ts                 |  2 +-
 src/app/structure-list/enum/public.enum.ts             |  2 +-
 src/app/utils/formUtils.ts                             |  2 +-
 src/app/utils/orientationUtils.ts                      |  2 +-
 16 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts
index e15f1a4c9..720f12a74 100644
--- a/src/app/form/form-view/form-view.component.ts
+++ b/src/app/form/form-view/form-view.component.ts
@@ -452,7 +452,7 @@ export class FormViewComponent implements OnInit, AfterViewInit {
           categories: {
             languageAndIlliteracy: this.structureForm.get('categories').get('languageAndIlliteracy').value,
             handicaps: this.structureForm.get('categories').get('handicaps').value,
-            publicOthers: this.structureForm.get('categories').get('publicOthers').value,
+            genre: this.structureForm.get('categories').get('genre').value,
           },
         };
       case structureFormStep.structureDigitalHelpingAccompaniment:
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 4c7c99c90..9bb4424a8 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
@@ -114,7 +114,7 @@
       [isEditMode]="isEditMode"
       [structureForm]="structureForm"
       [handicaps]="handicaps"
-      [publicOthers]="publicOthers"
+      [genre]="genre"
       [languageAndIlliteracy]="languageAndIlliteracy"
       [isMandatoryFields]="false"
       (validateForm)="setValidationsForm()"
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 f7f8ed8de..cbb6c7daa 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
@@ -51,7 +51,7 @@ export class StructureFormComponent implements OnChanges, OnInit {
   public labelsQualifications: Category;
   public onlineProcedures: Category;
   public age: Category;
-  public publicOthers: Category;
+  public genre: Category;
   public handicaps: Category;
   public languageAndIlliteracy: Category;
   public solidarityMaterial: Category;
@@ -274,8 +274,8 @@ export class StructureFormComponent implements OnChanges, OnInit {
           this.languageAndIlliteracy = categ;
           break;
         }
-        case CategoryEnum.publicOthers: {
-          this.publicOthers = categ;
+        case CategoryEnum.genre: {
+          this.genre = categ;
           break;
         }
         case CategoryEnum.solidarityMaterial: {
diff --git a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.html b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.html
index 725cb30b3..f7ba4ce7c 100644
--- a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.html
+++ b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.html
@@ -56,18 +56,18 @@
         />
       </div>
     </div>
-    <div *ngIf="publicOthers">
+    <div *ngIf="genre">
       <div class="title">
-        <h4>Autre</h4>
+        <h4>Genre</h4>
       </div>
       <div class="btn-grid">
         <app-button
-          *ngFor="let choice of publicOthers.modules"
+          *ngFor="let choice of genre.modules"
           [ngClass]="{ selectedChoice: true }"
-          [extraClass]="isInArray(choice.id, 'publicOthers') ? 'selected' : ''"
+          [extraClass]="isInArray(choice.id, 'genre') ? 'selected' : ''"
           [style]="buttonTypeEnum.CheckButton"
           [text]="choice.name"
-          (action)="updateChoicePublic(choice.id, 'publicOthers')"
+          (action)="updateChoicePublic(choice.id, 'genre')"
         />
       </div>
     </div>
diff --git a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts
index f1fbd1c6f..2c7871bf3 100644
--- a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts
+++ b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts
@@ -12,7 +12,7 @@ export class StructurePublicTargetComponent implements OnInit, OnChanges {
   @Input() age: Category;
   @Input() languageAndIlliteracy: Category;
   @Input() handicaps: Category;
-  @Input() publicOthers: Category;
+  @Input() genre: Category;
   @Input() isEditMode: boolean;
   @Input() isMandatoryFields = true;
   @Output() updateChoice = new EventEmitter<any>();
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
index e59029fa4..4259b8ace 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
@@ -32,7 +32,7 @@
     [structureForm]="form"
     [languageAndIlliteracy]="categories.languageAndIlliteracy"
     [handicaps]="categories.handicaps"
-    [publicOthers]="categories.publicOthers"
+    [genre]="categories.genre"
     [age]="categories.age"
     [isMandatoryFields]="currentStep === onlineDemarchesMeetingSteps.publicTypeMandatory"
     (validateForm)="checkValidation()"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index 72e5a0ce9..c377ca210 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -84,7 +84,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       theme: '',
       modules: [],
     },
-    publicOthers: {
+    genre: {
       id: '',
       name: '',
       theme: '',
@@ -270,8 +270,8 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
           this.categories.languageAndIlliteracy = categ;
           break;
         }
-        case CategoryEnum.publicOthers: {
-          this.categories.publicOthers = categ;
+        case CategoryEnum.genre: {
+          this.categories.genre = categ;
           break;
         }
         case CategoryEnum.handicaps: {
diff --git a/src/app/models/personalOffer.model.ts b/src/app/models/personalOffer.model.ts
index 3d830779c..e456b40dc 100644
--- a/src/app/models/personalOffer.model.ts
+++ b/src/app/models/personalOffer.model.ts
@@ -14,7 +14,7 @@ export class PersonalOffer {
         labelsQualifications: obj?.categories?.labelsQualifications || [],
         languageAndIlliteracy: obj?.categories?.languageAndIlliteracy || [],
         onlineProcedures: obj?.categories?.onlineProcedures || [],
-        publicOthers: obj?.categories?.publicOthers || [],
+        genre: obj?.categories?.genre || [],
       },
     });
   }
diff --git a/src/app/models/structure.model.ts b/src/app/models/structure.model.ts
index 4d0e65207..6f0ccefc2 100644
--- a/src/app/models/structure.model.ts
+++ b/src/app/models/structure.model.ts
@@ -73,7 +73,7 @@ export class Structure {
         labelsQualifications: obj?.categories?.labelsQualifications || [],
         languageAndIlliteracy: obj?.categories?.languageAndIlliteracy || [],
         onlineProcedures: obj?.categories?.onlineProcedures || [],
-        publicOthers: obj?.categories?.publicOthers || [],
+        genre: obj?.categories?.genre || [],
         selfServiceMaterial: obj?.categories?.selfServiceMaterial || [],
         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 081a360c3..7898b2331 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
@@ -355,12 +355,10 @@
       <div class="content">
         <ng-container
           *ngIf="
-            isFieldValid('publicOthers', 'categories') &&
-            structure.categoriesDisplay &&
-            structure.categoriesDisplay.publicOthers
+            isFieldValid('genre', 'categories') && structure.categoriesDisplay && structure.categoriesDisplay.genre
           "
         >
-          <div *ngFor="let public of structure.categoriesDisplay.publicOthers" class="list">
+          <div *ngFor="let public of structure.categoriesDisplay.genre" class="list">
             <p>{{ public }}</p>
           </div>
         </ng-container>
@@ -369,7 +367,7 @@
         <ng-container
           *ngIf="
             structure.categoriesDisplay.languageAndIlliteracy.length === 0 &&
-            structure.categoriesDisplay.publicOthers.length === 0 &&
+            structure.categoriesDisplay.genre.length === 0 &&
             structure.categoriesDisplay.handicaps.length === 0
           "
         >
diff --git a/src/app/shared/enum/category.enum.ts b/src/app/shared/enum/category.enum.ts
index 2efdafe76..e6f7a57ce 100644
--- a/src/app/shared/enum/category.enum.ts
+++ b/src/app/shared/enum/category.enum.ts
@@ -9,5 +9,5 @@ export enum CategoryEnum {
   age = 'age',
   languageAndIlliteracy = 'languageAndIlliteracy',
   handicaps = 'handicaps',
-  publicOthers = 'publicOthers',
+  genre = 'genre',
 }
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 1c3d8e369..119853219 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
@@ -279,11 +279,11 @@
             </p>
           </div>
           <div
-            *ngIf="structure.categoriesDisplay.publicOthers && structure.categoriesDisplay.publicOthers.length"
+            *ngIf="structure.categoriesDisplay.genre && structure.categoriesDisplay.genre.length"
             fxLayout="column"
             fxLayoutGap="8px"
           >
-            <p *ngFor="let label of structure.categoriesDisplay.publicOthers.sort()" class="no-margin-bottom">
+            <p *ngFor="let label of structure.categoriesDisplay.genre.sort()" class="no-margin-bottom">
               {{ label }}
             </p>
           </div>
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 e5aa63ebc..61b960f3e 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
@@ -154,7 +154,7 @@ export class StructureListSearchComponent implements OnInit {
         module.name === 'age' ||
         module.name === 'languageAndIlliteracy' ||
         module.name === 'handicaps' ||
-        module.name === 'publicOthers'
+        module.name === 'genre'
     ).length;
     this.numberEquipmentChecked = checkedModules.filter(
       (module) => module.name === 'solidarityMaterial' || module.name === 'selfServiceMaterial'
diff --git a/src/app/structure-list/enum/public.enum.ts b/src/app/structure-list/enum/public.enum.ts
index 6ee5e79fd..f99b7d044 100644
--- a/src/app/structure-list/enum/public.enum.ts
+++ b/src/app/structure-list/enum/public.enum.ts
@@ -2,5 +2,5 @@ export enum PublicCategorie {
   age = 'age',
   handicaps = 'handicaps',
   languageAndIlliteracy = 'languageAndIlliteracy',
-  other = 'publicOthers',
+  other = 'genre',
 }
diff --git a/src/app/utils/formUtils.ts b/src/app/utils/formUtils.ts
index 0061edd0c..700bfca13 100644
--- a/src/app/utils/formUtils.ts
+++ b/src/app/utils/formUtils.ts
@@ -123,7 +123,7 @@ export class formUtils {
         age: this.loadArrayForCheckbox(structure.categories?.age, true),
         languageAndIlliteracy: this.loadArrayForCheckbox(structure.categories?.languageAndIlliteracy, false),
         selfServiceMaterial: this.loadArrayForCheckbox(structure.categories?.selfServiceMaterial, false),
-        publicOthers: this.loadArrayForCheckbox(structure.categories?.publicOthers, false),
+        genre: this.loadArrayForCheckbox(structure.categories?.genre, false),
         baseSkills: new UntypedFormControl(structure.categories?.baseSkills),
         advancedSkills: new UntypedFormControl(structure.categories?.advancedSkills),
         solidarityMaterial: this.loadArrayForCheckbox(structure.categories?.solidarityMaterial, false),
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index 96dac5eda..881ee4c6f 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -118,7 +118,7 @@ export class OrientationUtils {
         {
           age: new UntypedFormArray([], Validators.required),
           languageAndIlliteracy: new UntypedFormArray([]),
-          publicOthers: new UntypedFormArray([]),
+          genre: new UntypedFormArray([]),
           handicaps: new UntypedFormArray([]),
         },
         Validators.required
-- 
GitLab