From 6ae8eb26184bab3378d5e2261e70b2bf933d06da Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Wed, 5 May 2021 15:19:03 +0200
Subject: [PATCH 1/2] fix: add some plural handling on strucutre details

---
 .../structure-details.component.html          |  8 ++++---
 .../structure-details.component.ts            | 24 +++++++++++++++----
 2 files changed, 24 insertions(+), 8 deletions(-)

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 ec2c3ff77..b4cd59c9a 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
@@ -208,7 +208,7 @@
             >
               <p class="no-margin">{{ getAccessLabel(acces) }}</p>
             </div>
-            <p *ngIf="structure.pmrAccess" class="no-margin">Accessibles aux personnes à mobilité réduite</p>
+            <p *ngIf="structure.pmrAccess" class="no-margin">Accessible aux personnes à mobilité réduite</p>
           </div>
           <div *ngFor="let public of structure.publics" fxLayout="row" fxLayoutAlign="none flex-end" fxLayoutGap="8px">
             <p class="no-margin">{{ getPublicLabel(public) }}</p>
@@ -265,10 +265,12 @@
       <h2>Ateliers</h2>
     </div>
     <div *ngIf="structure.freeWorkShop">
-      <span class="bold-info">L'accès à ces ateliers est gratuit</span>
+      <span *ngIf="multipleWorkshop()" class="bold-info">L'accès à ces ateliers est gratuit</span>
+      <span *ngIf="!multipleWorkshop()" class="bold-info">L'accès à cet atelier est gratuit</span>
     </div>
     <div *ngIf="!structure.freeWorkShop">
-      <span class="bold-info">L'accès à ces ateliers est payant</span>
+      <span *ngIf="multipleWorkshop()" class="bold-info">L'accès à ces ateliers est payant</span>
+      <span *ngIf="!multipleWorkshop()" class="bold-info">L'accès à cet atelier est payant</span>
     </div>
     <div class="wrapper">
       <div *ngIf="isBaseSkills()">
diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts
index bf25061ad..abacf3837 100644
--- a/src/app/structure-list/components/structure-details/structure-details.component.ts
+++ b/src/app/structure-list/components/structure-details/structure-details.component.ts
@@ -115,15 +115,15 @@ export class StructureDetailsComponent implements OnInit {
       case Equipment.wifi:
         return 'Wifi en accès libre';
       case Equipment.bornes:
-        return 'Bornes numériques';
+        return this.structure.nbNumericTerminal > 1 ? 'Bornes numériques' : 'Borne numérique';
       case Equipment.printer:
-        return 'Imprimantes';
+        return this.structure.nbPrinters > 1 ? 'Imprimantes' : 'Imprimante';
       case Equipment.tablet:
-        return 'Tablettes';
+        return this.structure.nbTablets > 1 ? 'Tablettes' : 'Tablette';
       case Equipment.computer:
-        return 'Ordinateurs à disposition';
+        return this.structure.nbComputers > 1 ? 'Ordinateurs à disposition' : 'Ordinateur à disposition';
       case Equipment.scanner:
-        return 'Scanners';
+        return this.structure.nbScanners > 1 ? 'Scanners' : 'Scanner';
       default:
         return null;
     }
@@ -313,4 +313,18 @@ export class StructureDetailsComponent implements OnInit {
       this.structureService.sendMailOnStructureError(this.structure._id, modalValue.content).subscribe(() => {});
     }
   }
+
+  public multipleWorkshop(): boolean {
+    if (
+      this.structure.baseSkills.length +
+        this.structure.accessRight.length +
+        this.structure.parentingHelp.length +
+        this.structure.socialAndProfessional.length +
+        this.structure.digitalCultureSecurity.length >
+      1
+    ) {
+      return true;
+    }
+    return false;
+  }
 }
-- 
GitLab


From 6ddce6e5d4a38f3c1e8cc46f72256b7240857f62 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Thu, 6 May 2021 14:28:48 +0200
Subject: [PATCH 2/2] fix: handle plural on structure equipement, workshop,
 accompaniment

---
 .../structure-details.component.html          |  9 ++++---
 .../structure-details.component.ts            | 24 +++++++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)

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 b4cd59c9a..2763a5fef 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
@@ -239,7 +239,8 @@
   >
     <div fxLayout="row" fxLayoutAlign="none flex-end" fxLayoutGap="8px">
       <app-svg-icon [type]="'ico'" [icon]="'demarches'" [iconClass]="'icon-32'"></app-svg-icon>
-      <h2>Démarches en ligne</h2>
+      <h2 *ngIf="multipleAccompaniment()">Démarches en ligne</h2>
+      <h2 *ngIf="!multipleAccompaniment()">Démarche en ligne</h2>
     </div>
     <div fxLayout="column">
       <div fxLayout="row wrap" fxLayoutGap="24px">
@@ -262,7 +263,8 @@
   >
     <div fxLayout="row" fxLayoutAlign="none flex-end" fxLayoutGap="8px">
       <app-svg-icon [type]="'ico'" [icon]="'services'" [iconClass]="'icon-32'"></app-svg-icon>
-      <h2>Ateliers</h2>
+      <h2 *ngIf="multipleWorkshop()">Ateliers</h2>
+      <h2 *ngIf="!multipleWorkshop()">Atelier</h2>
     </div>
     <div *ngIf="structure.freeWorkShop">
       <span *ngIf="multipleWorkshop()" class="bold-info">L'accès à ces ateliers est gratuit</span>
@@ -304,7 +306,8 @@
   >
     <div fxLayout="row" fxLayoutAlign="none flex-end" fxLayoutGap="8px">
       <app-svg-icon [type]="'ico'" [icon]="'equipement'" [iconClass]="'icon-32'"></app-svg-icon>
-      <h2>Équipements</h2>
+      <h2 *ngIf="multipleEquipement()">Équipements</h2>
+      <h2 *ngIf="!multipleEquipement()">Équipement</h2>
     </div>
     <div fxLayout="column">
       <p *ngFor="let equipement of filterOnlyEquipments(structure.equipmentsAndServices)" class="no-margin-bottom">
diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts
index abacf3837..39ecebdb8 100644
--- a/src/app/structure-list/components/structure-details/structure-details.component.ts
+++ b/src/app/structure-list/components/structure-details/structure-details.component.ts
@@ -327,4 +327,28 @@ export class StructureDetailsComponent implements OnInit {
     }
     return false;
   }
+
+  public multipleEquipement(): boolean {
+    if (
+      this.structure.nbComputers +
+        this.structure.nbNumericTerminal +
+        this.structure.nbPrinters +
+        this.structure.nbScanners +
+        this.structure.nbTablets >
+      1
+    ) {
+      return true;
+    }
+    return false;
+  }
+
+  public multipleAccompaniment(): boolean {
+    if (
+      (this.structure.otherDescription && this.structure.proceduresAccompaniment.length > 0) ||
+      this.structure.proceduresAccompaniment.length > 1
+    ) {
+      return true;
+    }
+    return false;
+  }
 }
-- 
GitLab