From 6a05d5f5181599eae19829cfcaa32a532398c195 Mon Sep 17 00:00:00 2001
From: Marlene Simondant <msimondant@grandlyon.com>
Date: Mon, 17 Mar 2025 09:40:53 +0100
Subject: [PATCH] details

---
 .../orientation-details.component.html        | 56 ++++++++++++++++---
 .../orientation-details.component.scss        |  3 +
 .../orientation-details.component.ts          | 13 ++++-
 3 files changed, 62 insertions(+), 10 deletions(-)

diff --git a/src/app/profile/dashboard/orientation-details/orientation-details.component.html b/src/app/profile/dashboard/orientation-details/orientation-details.component.html
index 83acd9d93..0a403fdae 100644
--- a/src/app/profile/dashboard/orientation-details/orientation-details.component.html
+++ b/src/app/profile/dashboard/orientation-details/orientation-details.component.html
@@ -15,17 +15,43 @@
           Il y a {{ this.orientationService.daysAgo(orientation.createdAt) }} jour(s)
         </div>
       </div>
-      <app-button class="hide-on-mobile" [label]="'Clôturer'" [variant]="'primaryBlack'" (action)="showModal()" />
-      <!--app-button class="hide-on-mobile" [label]="'Modifier'" [variant]="'secondary'" /-->
+      <!--app-button class="hide-on-mobile" [label]="'Clôturer'" [variant]="'primaryBlack'" (action)="showModal()" /-->
+      <app-button
+        *ngIf="!isEditMode"
+        class="hide-on-mobile"
+        [label]="'Modifier'"
+        [variant]="'secondary'"
+        (action)="editOrientation()"
+      />
+      <app-button
+        *ngIf="isEditMode"
+        class="hide-on-mobile"
+        [label]="'Enregistrer'"
+        [variant]="'primary'"
+        (action)="editOrientation()"
+      />
     </div>
 
     <!-- Treatment info -->
     <section>
       <span class="secondary-header">
         <h2>Traitement</h2>
-        <app-button class="hide-on-desktop" [label]="'Clôturer'" [variant]="'primaryBlack'" (action)="showModal()" />
-        <!--app-button class="hide-on-desktop" [label]="'Modifier'" [variant]="'secondary'" /--></span
-      >
+        <!--app-button class="hide-on-desktop" [label]="'Clôturer'" [variant]="'primaryBlack'" (action)="showModal()" /-->
+        <app-button
+          *ngIf="!isEditMode"
+          class="hide-on-desktop"
+          [label]="'Modifier'"
+          [variant]="'secondary'"
+          (action)="editOrientation()"
+        />
+        <app-button
+          *ngIf="isEditMode"
+          class="hide-on-desktop"
+          [label]="'Modifier'"
+          [variant]="'primary'"
+          (action)="editOrientation()"
+        />
+      </span>
       <div class="content">
         <div class="inline">
           <app-svg-icon [iconClass]="'icon-20'" [folder]="'tags'" [icon]="'flag'" />
@@ -96,7 +122,9 @@
               class="hide-on-mobile"
               [ariaLabel]="'Structure choisie : ' + orientation.structureChoice[0]?.structureName"
               [label]="orientation.structureChoice[0]?.structureName"
-              [iconName]="'structureCategory_private'"
+              [iconName]="
+                this.orientationService.getStructureTypeIcon(orientation.structureChoice[0]?.structureType?.category)
+              "
               [type]="'entity light'"
             />
           </p>
@@ -116,7 +144,17 @@
         </div>
         <div class="inline">
           <app-svg-icon [iconClass]="'icon-20'" [folder]="'tags'" [icon]="'commentBlue'" />
-          <p><span class="category-name">Commentaire :</span>TODO</p>
+          <p class="inline">
+            <span class="category-name" id="processingCommentLabel">Commentaire :</span>
+            <ng-container *ngIf="!isEditMode">{{ orientation.processingComment || 'Non renseigné' }}</ng-container>
+            <app-textarea
+              *ngIf="isEditMode"
+              id="processingComment"
+              aria-labelledby="processingCommentLabel"
+              [value]="orientation.processingComment"
+              (valueChange)="setProcessingComment($event)"
+            />
+          </p>
         </div>
       </div>
     </section>
@@ -191,7 +229,9 @@
               *ngIf="orientation.structureOrientator"
               [ariaLabel]="'Structure choisie : ' + orientation.structureOrientator.structureName"
               [label]="orientation.structureOrientator.structureName"
-              [iconName]="'structureCategory_private'"
+              [iconName]="
+                this.orientationService.getStructureTypeIcon(orientation.structureOrientator.structureType?.category)
+              "
               [type]="'entity light'"
             />
           </p>
diff --git a/src/app/profile/dashboard/orientation-details/orientation-details.component.scss b/src/app/profile/dashboard/orientation-details/orientation-details.component.scss
index ef78c70d6..ae8710240 100644
--- a/src/app/profile/dashboard/orientation-details/orientation-details.component.scss
+++ b/src/app/profile/dashboard/orientation-details/orientation-details.component.scss
@@ -95,6 +95,9 @@
               flex-direction: column;
               align-items: flex-start;
             }
+            app-textarea {
+              width: 400px;
+            }
           }
         }
 
diff --git a/src/app/profile/dashboard/orientation-details/orientation-details.component.ts b/src/app/profile/dashboard/orientation-details/orientation-details.component.ts
index d0e4ccc41..3081e80ef 100644
--- a/src/app/profile/dashboard/orientation-details/orientation-details.component.ts
+++ b/src/app/profile/dashboard/orientation-details/orientation-details.component.ts
@@ -21,6 +21,7 @@ export class OrientationDetailsComponent implements OnInit {
   public orientation;
   public isModalOpenned = false;
   public userProfile: User;
+  public isEditMode = false;
 
   ngOnInit(): void {
     this.route.params.subscribe((urlParams) => {
@@ -59,8 +60,16 @@ export class OrientationDetailsComponent implements OnInit {
   }
 
   public setOrientationStatus(status): void {
-    // set status
-    console.log(status);
+    // TODO : patch status
+  }
+
+  public editOrientation(): void {
+    // TODO : edit orientation
+    this.isEditMode = !this.isEditMode;
+  }
+
+  public setProcessingComment(comment): void {
+    // TODO : patch comment
   }
 
   private patchOrientation(updatedFields): void {
-- 
GitLab