✨ Hiding delete documents when no right to
This commit is contained in:
parent
7ed6d7e1f4
commit
6f5134a7b6
@ -15,5 +15,6 @@ export enum AppRuleNames {
|
||||
officeFolders = "folders",
|
||||
officeRoles = "office-roles",
|
||||
deedTypes = "deed-types",
|
||||
offices = "offices"
|
||||
offices = "offices",
|
||||
documents = "documents",
|
||||
}
|
||||
|
@ -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<IPropsClass, IState> {
|
||||
} 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<IPropsClass, IState> {
|
||||
case EDocumentStatus.DEPOSITED:
|
||||
return <WarningBadge />;
|
||||
default:
|
||||
return <Image src={TrashIcon} alt="trash icon" className={classes["trash"]} onClick={this.onOpenDeletionModal} />;
|
||||
return (
|
||||
<Rules
|
||||
mode={RulesMode.NECESSARY}
|
||||
rules={[
|
||||
{
|
||||
action: AppRuleActions.delete,
|
||||
name: AppRuleNames.documents,
|
||||
},
|
||||
]}>
|
||||
<Image src={TrashIcon} alt="trash icon" className={classes["trash"]} onClick={this.onOpenDeletionModal} />
|
||||
</Rules>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user