From 6f5134a7b6e2460995d896ea79ffa8b5d040772f Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Mon, 2 Oct 2023 11:54:33 +0200 Subject: [PATCH] :sparkles: Hiding delete documents when no right to --- src/front/Api/Entities/rule.ts | 3 ++- .../Document/DocumentNotary/index.tsx | 22 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/front/Api/Entities/rule.ts b/src/front/Api/Entities/rule.ts index 06b21bde..ac4a0282 100644 --- a/src/front/Api/Entities/rule.ts +++ b/src/front/Api/Entities/rule.ts @@ -15,5 +15,6 @@ export enum AppRuleNames { officeFolders = "folders", officeRoles = "office-roles", deedTypes = "deed-types", - offices = "offices" + offices = "offices", + documents = "documents", } diff --git a/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx b/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx index 5e4bfbf3..db81dbb1 100644 --- a/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx +++ b/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx @@ -10,6 +10,8 @@ import Typography, { ITypo } from "../../Typography"; import WarningBadge from "../../WarningBadge"; import classes from "./classes.module.scss"; import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document"; +import Rules, { RulesMode } from "@Front/Components/Elements/Rules"; +import { AppRuleActions, AppRuleNames } from "@Front/Api/Entities/rule"; type IProps = { folderUid: string; @@ -60,8 +62,11 @@ class DocumentNotaryClass extends React.Component { } else { const archivedFilesLength = documentFiles.filter((file) => file.archived_at).length; const documentFileLength = documentFiles.length - archivedFilesLength; - if(this.props.document.document_status === EDocumentStatus.ASKED || this.props.document.document_status === EDocumentStatus.REFUSED){ - return 'Aucun document déposé'; + if ( + this.props.document.document_status === EDocumentStatus.ASKED || + this.props.document.document_status === EDocumentStatus.REFUSED + ) { + return "Aucun document déposé"; } return `${documentFileLength} documents déposés`; @@ -91,7 +96,18 @@ class DocumentNotaryClass extends React.Component { case EDocumentStatus.DEPOSITED: return ; default: - return trash icon; + return ( + + trash icon + + ); } }