From b8ff864c458384ec648090d4d058844791fd83fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Bitard?= <bitard.michael@gmail.com>
Date: Mon, 19 Aug 2024 11:25:57 +0200
Subject: [PATCH] feat(instruction) : rendre le document 'justificatif de
 paiement' optionnel dans les octrois et prolongations d'ARM (#1428)

---
 .../titre-etape-updation-validate.test.ts     |  1 -
 .../common/src/permissions/etape-form.test.ts |  4 +--
 .../documents.ts                              |  2 +-
 ...ition.stories_snapshots_AffichageAide.html |  8 -----
 ....stories_snapshots_DemandeArmComplete.html | 31 ++++++++++---------
 ...dition.stories_snapshots_Modification.html |  8 -----
 ...ts-edit.stories_snapshots_ArmMecanise.html |  8 -----
 ...uments-edit.stories_snapshots_Complet.html | 28 ++++++++---------
 ...ocuments-edit.stories_snapshots_Empty.html |  8 -----
 ...edit.stories_snapshots_EnConstruction.html |  8 -----
 ...cuments-edit.stories_snapshots_Rempli.html |  8 -----
 ...e-edit-form.stories_snapshots_Default.html |  8 -----
 12 files changed, 33 insertions(+), 89 deletions(-)

diff --git a/packages/api/src/business/validations/titre-etape-updation-validate.test.ts b/packages/api/src/business/validations/titre-etape-updation-validate.test.ts
index 710c44093..b40c5d2e4 100644
--- a/packages/api/src/business/validations/titre-etape-updation-validate.test.ts
+++ b/packages/api/src/business/validations/titre-etape-updation-validate.test.ts
@@ -153,7 +153,6 @@ describe('valide l’étape avant de l’enregistrer', () => {
         "le document "Documents cartographiques" (car) est obligatoire",
         "le document "Dossier de demande" (dom) est obligatoire",
         "le document "Formulaire de demande" (for) est obligatoire",
-        "le document "Justificatif de paiement" (jpa) est obligatoire",
         "Il y a des documents d'entreprise obligatoires, mais il n'y a pas de titulaire",
       ]
     `)
diff --git a/packages/common/src/permissions/etape-form.test.ts b/packages/common/src/permissions/etape-form.test.ts
index f755b18ab..690af134e 100644
--- a/packages/common/src/permissions/etape-form.test.ts
+++ b/packages/common/src/permissions/etape-form.test.ts
@@ -533,7 +533,7 @@ test('getDocumentsTypes', () => {
         "description": undefined,
         "id": "jpa",
         "nom": "Justificatif de paiement",
-        "optionnel": false,
+        "optionnel": true,
       },
       {
         "id": "lem",
@@ -634,7 +634,7 @@ test('getDocumentsTypes', () => {
         "description": undefined,
         "id": "jpa",
         "nom": "Justificatif de paiement",
-        "optionnel": false,
+        "optionnel": true,
       },
       {
         "id": "lem",
diff --git a/packages/common/src/static/titresTypes_demarchesTypes_etapesTypes/documents.ts b/packages/common/src/static/titresTypes_demarchesTypes_etapesTypes/documents.ts
index 87cedbcee..68de2f3f3 100644
--- a/packages/common/src/static/titresTypes_demarchesTypes_etapesTypes/documents.ts
+++ b/packages/common/src/static/titresTypes_demarchesTypes_etapesTypes/documents.ts
@@ -373,7 +373,7 @@ const TDEDocumentsTypes = {
         [DOCUMENTS_TYPES_IDS.dossierLoiSurLEau]: { optionnel: true },
         [DOCUMENTS_TYPES_IDS.dossierDeDemande]: { optionnel: false },
         [DOCUMENTS_TYPES_IDS.formulaireDeDemande]: { optionnel: false },
-        [DOCUMENTS_TYPES_IDS.justificatifDePaiement]: { optionnel: false },
+        [DOCUMENTS_TYPES_IDS.justificatifDePaiement]: { optionnel: true },
         [DOCUMENTS_TYPES_IDS.documentsCartographiques]: { optionnel: false },
       },
     },
diff --git a/packages/ui/src/components/etape-edition.stories_snapshots_AffichageAide.html b/packages/ui/src/components/etape-edition.stories_snapshots_AffichageAide.html
index fff546484..a9ab0e5b7 100644
--- a/packages/ui/src/components/etape-edition.stories_snapshots_AffichageAide.html
+++ b/packages/ui/src/components/etape-edition.stories_snapshots_AffichageAide.html
@@ -174,14 +174,6 @@
                       <!---->
                     </button></td>
                 </tr>
-                <tr>
-                  <td class="fr-label--disabled">Justificatif de paiement</td>
-                  <td>-</td>
-                  <td>-</td>
-                  <td style="display: flex; justify-content: end;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-add-line" title="Ajouter un document Justificatif de paiement" aria-label="Ajouter un document Justificatif de paiement" type="button">
-                      <!---->
-                    </button></td>
-                </tr>
               </tbody>
             </table>
           </div>
diff --git a/packages/ui/src/components/etape-edition.stories_snapshots_DemandeArmComplete.html b/packages/ui/src/components/etape-edition.stories_snapshots_DemandeArmComplete.html
index 5cecafb6e..3abe6d8c4 100644
--- a/packages/ui/src/components/etape-edition.stories_snapshots_DemandeArmComplete.html
+++ b/packages/ui/src/components/etape-edition.stories_snapshots_DemandeArmComplete.html
@@ -345,20 +345,6 @@
                       </button></div>
                   </td>
                 </tr>
-                <tr>
-                  <td>Justificatif de paiement</td>
-                  <td style="white-space: pre-line;">
-                    <!---->
-                  </td>
-                  <td>Public</td>
-                  <td>
-                    <div style="display: flex; justify-content: end; align-items: center;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-edit-line" title="Modifier le document de Justificatif de paiement" aria-label="Modifier le document de Justificatif de paiement" type="button">
-                        <!---->
-                      </button><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-delete-bin-line fr-ml-1w" title="Supprimer le document de Justificatif de paiement" aria-label="Supprimer le document de Justificatif de paiement" type="button">
-                        <!---->
-                      </button></div>
-                  </td>
-                </tr>
               </tbody>
             </table>
           </div>
@@ -374,7 +360,22 @@
                     <th scope="col" style="display: flex; justify-content: end;">Action</th>
                   </tr>
                 </thead>
-                <tbody></tbody>
+                <tbody>
+                  <tr>
+                    <td>Justificatif de paiement</td>
+                    <td style="white-space: pre-line;">
+                      <!---->
+                    </td>
+                    <td>Public</td>
+                    <td>
+                      <div style="display: flex; justify-content: end; align-items: center;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-edit-line" title="Modifier le document de Justificatif de paiement" aria-label="Modifier le document de Justificatif de paiement" type="button">
+                          <!---->
+                        </button><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-delete-bin-line fr-ml-1w" title="Supprimer le document de Justificatif de paiement" aria-label="Supprimer le document de Justificatif de paiement" type="button">
+                          <!---->
+                        </button></div>
+                    </td>
+                  </tr>
+                </tbody>
               </table>
             </div><button class="fr-btn fr-btn--secondary fr-btn--md fr-icon-add-line fr-btn--icon-right fr-mt-1w" title="Ajouter un document complémentaire" aria-label="Ajouter un document complémentaire" type="button" style="align-self: end;">Ajouter</button>
           </div>
diff --git a/packages/ui/src/components/etape-edition.stories_snapshots_Modification.html b/packages/ui/src/components/etape-edition.stories_snapshots_Modification.html
index 75af596e2..9295c4247 100644
--- a/packages/ui/src/components/etape-edition.stories_snapshots_Modification.html
+++ b/packages/ui/src/components/etape-edition.stories_snapshots_Modification.html
@@ -174,14 +174,6 @@
                       <!---->
                     </button></td>
                 </tr>
-                <tr>
-                  <td class="fr-label--disabled">Justificatif de paiement</td>
-                  <td>-</td>
-                  <td>-</td>
-                  <td style="display: flex; justify-content: end;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-add-line" title="Ajouter un document Justificatif de paiement" aria-label="Ajouter un document Justificatif de paiement" type="button">
-                      <!---->
-                    </button></td>
-                </tr>
               </tbody>
             </table>
           </div>
diff --git a/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_ArmMecanise.html b/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_ArmMecanise.html
index d7c9bb4fc..086c04e6a 100644
--- a/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_ArmMecanise.html
+++ b/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_ArmMecanise.html
@@ -64,14 +64,6 @@
             <!---->
           </button></td>
       </tr>
-      <tr>
-        <td class="fr-label--disabled">Justificatif de paiement</td>
-        <td>-</td>
-        <td>-</td>
-        <td style="display: flex; justify-content: end;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-add-line" title="Ajouter un document Justificatif de paiement" aria-label="Ajouter un document Justificatif de paiement" type="button">
-            <!---->
-          </button></td>
-      </tr>
     </tbody>
   </table>
 </div>
diff --git a/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Complet.html b/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Complet.html
index c196ca8d9..38bb4ec59 100644
--- a/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Complet.html
+++ b/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Complet.html
@@ -50,20 +50,6 @@
             </button></div>
         </td>
       </tr>
-      <tr>
-        <td>Justificatif de paiement</td>
-        <td style="white-space: pre-line;">
-          <!---->
-        </td>
-        <td>Visible par les administrations</td>
-        <td>
-          <div style="display: flex; justify-content: end; align-items: center;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-edit-line" title="Modifier le document de Justificatif de paiement" aria-label="Modifier le document de Justificatif de paiement" type="button">
-              <!---->
-            </button><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-delete-bin-line fr-ml-1w" title="Supprimer le document de Justificatif de paiement" aria-label="Supprimer le document de Justificatif de paiement" type="button">
-              <!---->
-            </button></div>
-        </td>
-      </tr>
     </tbody>
   </table>
 </div>
@@ -92,6 +78,20 @@
               </button></div>
           </td>
         </tr>
+        <tr>
+          <td>Justificatif de paiement</td>
+          <td style="white-space: pre-line;">
+            <!---->
+          </td>
+          <td>Visible par les administrations</td>
+          <td>
+            <div style="display: flex; justify-content: end; align-items: center;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-edit-line" title="Modifier le document de Justificatif de paiement" aria-label="Modifier le document de Justificatif de paiement" type="button">
+                <!---->
+              </button><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-delete-bin-line fr-ml-1w" title="Supprimer le document de Justificatif de paiement" aria-label="Supprimer le document de Justificatif de paiement" type="button">
+                <!---->
+              </button></div>
+          </td>
+        </tr>
       </tbody>
     </table>
   </div><button class="fr-btn fr-btn--secondary fr-btn--md fr-icon-add-line fr-btn--icon-right fr-mt-1w" title="Ajouter un document complémentaire" aria-label="Ajouter un document complémentaire" type="button" style="align-self: end;">Ajouter</button>
diff --git a/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Empty.html b/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Empty.html
index e033a9359..8984f7b62 100644
--- a/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Empty.html
+++ b/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Empty.html
@@ -34,14 +34,6 @@
             <!---->
           </button></td>
       </tr>
-      <tr>
-        <td class="fr-label--disabled">Justificatif de paiement</td>
-        <td>-</td>
-        <td>-</td>
-        <td style="display: flex; justify-content: end;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-add-line" title="Ajouter un document Justificatif de paiement" aria-label="Ajouter un document Justificatif de paiement" type="button">
-            <!---->
-          </button></td>
-      </tr>
     </tbody>
   </table>
 </div>
diff --git a/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_EnConstruction.html b/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_EnConstruction.html
index d7c9bb4fc..086c04e6a 100644
--- a/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_EnConstruction.html
+++ b/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_EnConstruction.html
@@ -64,14 +64,6 @@
             <!---->
           </button></td>
       </tr>
-      <tr>
-        <td class="fr-label--disabled">Justificatif de paiement</td>
-        <td>-</td>
-        <td>-</td>
-        <td style="display: flex; justify-content: end;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-add-line" title="Ajouter un document Justificatif de paiement" aria-label="Ajouter un document Justificatif de paiement" type="button">
-            <!---->
-          </button></td>
-      </tr>
     </tbody>
   </table>
 </div>
diff --git a/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Rempli.html b/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Rempli.html
index 4aafe79b3..c8bba2f5a 100644
--- a/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Rempli.html
+++ b/packages/ui/src/components/etape/etape-documents-edit.stories_snapshots_Rempli.html
@@ -38,14 +38,6 @@
             <!---->
           </button></td>
       </tr>
-      <tr>
-        <td class="fr-label--disabled">Justificatif de paiement</td>
-        <td>-</td>
-        <td>-</td>
-        <td style="display: flex; justify-content: end;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-add-line" title="Ajouter un document Justificatif de paiement" aria-label="Ajouter un document Justificatif de paiement" type="button">
-            <!---->
-          </button></td>
-      </tr>
     </tbody>
   </table>
 </div>
diff --git a/packages/ui/src/components/etape/etape-edit-form.stories_snapshots_Default.html b/packages/ui/src/components/etape/etape-edit-form.stories_snapshots_Default.html
index d60e6f2cf..d873175d8 100644
--- a/packages/ui/src/components/etape/etape-edit-form.stories_snapshots_Default.html
+++ b/packages/ui/src/components/etape/etape-edit-form.stories_snapshots_Default.html
@@ -225,14 +225,6 @@
                     <!---->
                   </button></td>
               </tr>
-              <tr>
-                <td class="fr-label--disabled">Justificatif de paiement</td>
-                <td>-</td>
-                <td>-</td>
-                <td style="display: flex; justify-content: end;"><button class="fr-btn fr-btn--secondary fr-btn--sm fr-icon-add-line" title="Ajouter un document Justificatif de paiement" aria-label="Ajouter un document Justificatif de paiement" type="button">
-                    <!---->
-                  </button></td>
-              </tr>
             </tbody>
           </table>
         </div>
-- 
GitLab