From 655d893fc856b9b8bf4d76786c8882096f6437b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20PAILHAREY?= <rpailharey@grandlyon.com>
Date: Fri, 19 Aug 2022 08:42:26 +0000
Subject: [PATCH] feat: us821 sge retours

---
 src/components/Consents/Consents.tsx         | 15 +++++++--------
 src/components/Consents/consents.module.scss |  4 ++++
 src/services/consent.service.ts              |  4 ++--
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/components/Consents/Consents.tsx b/src/components/Consents/Consents.tsx
index 9d459daa..f8d2fd3a 100644
--- a/src/components/Consents/Consents.tsx
+++ b/src/components/Consents/Consents.tsx
@@ -266,6 +266,7 @@ const Consents: React.FC = () => {
               onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
                 handleSearchChange(e.target.value)
               }
+              disabled={isShowingSelection}
             ></input>
           </div>
         </div>
@@ -304,7 +305,11 @@ const Consents: React.FC = () => {
             <button
               className="btnDelete"
               onClick={isShowingSelection ? continueSelection : resetSelection}
-              disabled={selectedNodes !== null && selectedNodes.length === 0}
+              disabled={
+                !isShowingSelection &&
+                selectedNodes &&
+                selectedNodes.length === 0
+              }
             >
               {isShowingSelection
                 ? 'Continuer ma sélection'
@@ -315,13 +320,7 @@ const Consents: React.FC = () => {
               onClick={
                 !isShowingSelection ? showCurrentSelection : toggleOpenModal
               }
-              disabled={
-                !isShowingSelection &&
-                selectedNodes &&
-                selectedNodes?.length <= 0
-                  ? true
-                  : false
-              }
+              disabled={selectedNodes && selectedNodes.length <= 0}
             >
               {!isShowingSelection ? 'Voir mes sélections' : 'Télécharger'}
               <span>{selectedNodes?.length}</span>
diff --git a/src/components/Consents/consents.module.scss b/src/components/Consents/consents.module.scss
index 34fa8337..b2787aa8 100644
--- a/src/components/Consents/consents.module.scss
+++ b/src/components/Consents/consents.module.scss
@@ -36,6 +36,10 @@
       height: 40px;
       padding: 0 0.5rem;
       width: 500px;
+      &:disabled {
+        opacity: 0.8;
+        cursor: not-allowed;
+      }
     }
   }
 }
diff --git a/src/services/consent.service.ts b/src/services/consent.service.ts
index 8e46ab84..b0674288 100644
--- a/src/services/consent.service.ts
+++ b/src/services/consent.service.ts
@@ -31,7 +31,7 @@ export class ConsentService {
           "Unauthorized : You don't have the rights to do this operation"
         )
       } else {
-        toast.error('Failed to create mail subject')
+        toast.error('Failed to search consents')
       }
       console.error(e)
       return null
@@ -66,7 +66,7 @@ export class ConsentService {
           "Unauthorized : You don't have the rights to do this operation"
         )
       } else {
-        toast.error('Failed to create mail subject')
+        toast.error('Failed to get consents')
       }
       console.error(e)
       return null
-- 
GitLab