diff --git a/package-lock.json b/package-lock.json index 0b5a1fd9..8fd2491a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -461,9 +461,9 @@ } }, "node_modules/@floating-ui/utils": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.4.tgz", - "integrity": "sha512-qprfWkn82Iw821mcKofJ5Pk9wgioHicxcQMxx+5zt5GSKoqdWvgG5AxVmpmUUjzTLPVSH5auBrhI93Deayn/DA==" + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.6.tgz", + "integrity": "sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A==" }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.11", @@ -965,9 +965,9 @@ } }, "node_modules/@rushstack/eslint-patch": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.0.tgz", - "integrity": "sha512-EF3948ckf3f5uPgYbQ6GhyA56Dmv8yg0+ir+BroRjwdxyZJsekhZzawOecC2rOTPCz173t7ZcR1HHZu0dZgOCw==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.1.tgz", + "integrity": "sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==" }, "node_modules/@swc/helpers": { "version": "0.4.14", @@ -993,9 +993,9 @@ "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" }, "node_modules/@types/prop-types": { - "version": "15.7.7", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.7.tgz", - "integrity": "sha512-FbtmBWCcSa2J4zL781Zf1p5YUBXQomPEcep9QZCfRfQgTxz3pJWiDFLebohZ9fFntX5ibzOkSsrJ0TEew8cAog==" + "version": "15.7.8", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.8.tgz", + "integrity": "sha512-kMpQpfZKSCBqltAJwskgePRaYRFukDkm1oItcAbC3gNELR20XIBcN9VRgg4+m8DKsTfkWeA4m4Imp4DDuWy7FQ==" }, "node_modules/@types/react": { "version": "18.0.28", @@ -1507,9 +1507,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001541", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001541.tgz", - "integrity": "sha512-bLOsqxDgTqUBkzxbNlSBt8annkDpQB9NdzdTbO2ooJ+eC/IQcvDspDc058g84ejCelF7vHUx57KIOjEecOHXaw==", + "version": "1.0.30001542", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001542.tgz", + "integrity": "sha512-UrtAXVcj1mvPBFQ4sKd38daP8dEcXXr5sQe6QNNinaPd0iA/cxg9/l3VrSdL73jgw5sKyuQ6jNgiKO12W3SsVA==", "funding": [ { "type": "opencollective", @@ -4067,9 +4067,9 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, "node_modules/react-select": { - "version": "5.7.5", - "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.7.5.tgz", - "integrity": "sha512-jgYZa2xgKP0DVn5GZk7tZwbRx7kaVz1VqU41S8z1KWmshRDhlrpKS0w80aS1RaK5bVIXpttgSou7XCjWw1ncKA==", + "version": "5.7.7", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.7.7.tgz", + "integrity": "sha512-HhashZZJDRlfF/AKj0a0Lnfs3sRdw/46VJIRd8IbB9/Ovr74+ZIwkAdSBjSPXsFMG+u72c5xShqwLSKIJllzqw==", "dependencies": { "@babel/runtime": "^7.12.0", "@emotion/cache": "^11.4.0", diff --git a/package.json b/package.json index 53e1bb64..bb886725 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "eslint-config-next": "13.2.4", "form-data": "^4.0.0", "jwt-decode": "^3.1.2", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.85", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.88", "next": "13.2.4", "prettier": "^2.8.7", "react": "18.2.0", 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/Api/LeCoffreApi/SuperAdmin/LiveVotes/LiveVotes.ts b/src/front/Api/LeCoffreApi/SuperAdmin/LiveVotes/LiveVotes.ts index 394e1b93..8a40af7b 100644 --- a/src/front/Api/LeCoffreApi/SuperAdmin/LiveVotes/LiveVotes.ts +++ b/src/front/Api/LeCoffreApi/SuperAdmin/LiveVotes/LiveVotes.ts @@ -1,4 +1,4 @@ -import { Appointment } from "le-coffre-resources/dist/SuperAdmin"; +import { Appointment, Vote } from "le-coffre-resources/dist/SuperAdmin"; import BaseSuperAdmin from "../BaseSuperAdmin"; @@ -18,6 +18,9 @@ export type LiveVote = { appointment: Appointment; }; +export type IDeleteVotesParams = { + uid: Vote["uid"]; +}; export default class LiveVotes extends BaseSuperAdmin { private static instance: LiveVotes; private readonly baseURl = this.namespaceUrl.concat("/live-votes"); @@ -46,4 +49,17 @@ export default class LiveVotes extends BaseSuperAdmin { return Promise.reject(err); } } + + /** + * @description : Delete a vote + */ + public async delete(body: IDeleteVotesParams): Promise { + const url = new URL(`${this.baseURl}/${body.uid}`); + try { + return await this.deleteRequest(url, body); + } catch (err) { + this.onError(err); + return Promise.reject(err); + } + } } diff --git a/src/front/Api/LeCoffreApi/SuperAdmin/Votes/Votes.ts b/src/front/Api/LeCoffreApi/SuperAdmin/Votes/Votes.ts deleted file mode 100644 index 34907702..00000000 --- a/src/front/Api/LeCoffreApi/SuperAdmin/Votes/Votes.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Vote } from "le-coffre-resources/dist/SuperAdmin"; - -import BaseSuperAdmin from "../BaseSuperAdmin"; - -// TODO Type get query params -> Where + inclue + orderby -export interface IGetVotessparams { - where?: {}; - include?: {}; - select?: {}; -} - -export type IDeleteVotesParams = { - uid: Vote["uid"]; -}; - -export default class Votes extends BaseSuperAdmin { - private static instance: Votes; - private readonly baseURl = this.namespaceUrl.concat("/votes"); - - private constructor() { - super(); - } - - public static getInstance() { - if (!this.instance) { - return new this(); - } else { - return this.instance; - } - } - - /** - * @description : Create a Votes - */ - public async delete(body: IDeleteVotesParams): Promise { - const url = new URL(this.baseURl + "/" + body.uid); - try { - return await this.deleteRequest(url, body); - } catch (err) { - this.onError(err); - return Promise.reject(err); - } - } -} diff --git a/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx b/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx index 7b9c165c..7d84c26b 100644 --- a/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx +++ b/src/front/Components/DesignSystem/DepositOtherDocument/index.tsx @@ -71,7 +71,7 @@ export default class DepositOtherDocument extends React.Component {}} + onClose={this.props.onClose!} onAccept={this.onAccept} closeBtn header={"Ajouter un document"} 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 + + ); } } diff --git a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx index f122a976..4afac6fa 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx @@ -37,6 +37,7 @@ type IState = { hasValidateAnchoring: boolean; isVerifDeleteModalVisible: boolean; isAnchored: boolean | null; + isPreventArchiveModalOpen: boolean; }; class FolderInformationClass extends BasePage { public constructor(props: IPropsClass) { @@ -49,6 +50,7 @@ class FolderInformationClass extends BasePage { hasValidateAnchoring: false, isVerifDeleteModalVisible: false, isAnchored: null, + isPreventArchiveModalOpen: false, }; this.onSelectedFolder = this.onSelectedFolder.bind(this); this.openArchivedModal = this.openArchivedModal.bind(this); @@ -63,6 +65,7 @@ class FolderInformationClass extends BasePage { this.openVerifDeleteFolder = this.openVerifDeleteFolder.bind(this); this.closeVerifDeleteFolder = this.closeVerifDeleteFolder.bind(this); this.verifyAnchorStatus = this.verifyAnchorStatus.bind(this); + this.closePreventArchiveModal = this.closePreventArchiveModal.bind(this); } // TODO: Message if the user has not created any folder yet @@ -174,6 +177,22 @@ class FolderInformationClass extends BasePage { )} + +
+ + Pour valider un dossier, toutes les pièces envoyées par vos clients doivent être validées (vert). Si certains + documents sont en attente (orange), alors, veuillez les valider ou les refuser et veillez à ce qu'aucun document + ne soit encore en demandé au client (gris) + +
+
{ ); } + private closePreventArchiveModal() { + this.setState({ + isPreventArchiveModalOpen: false, + }); + } + private async verifyAnchorStatus() { if (!this.state.selectedFolder || !this.state.selectedFolder.uid) return; try { @@ -352,7 +377,11 @@ class FolderInformationClass extends BasePage { } private openArchivedModal(): void { - this.setState({ isArchivedModalOpen: true }); + if (this.everyDocumentValidated() && this.state.isAnchored) { + this.setState({ isArchivedModalOpen: true }); + } else { + this.setState({ isPreventArchiveModalOpen: true }); + } } private closeArchivedModal(): void { diff --git a/src/front/Components/Layouts/Users/UserInformations/index.tsx b/src/front/Components/Layouts/Users/UserInformations/index.tsx index 88ce1957..9962f139 100644 --- a/src/front/Components/Layouts/Users/UserInformations/index.tsx +++ b/src/front/Components/Layouts/Users/UserInformations/index.tsx @@ -3,7 +3,6 @@ import WarningIcon from "@Assets/images/warning.png"; import Roles from "@Front/Api/LeCoffreApi/Admin/Roles/Roles"; import LiveVotes from "@Front/Api/LeCoffreApi/SuperAdmin/LiveVotes/LiveVotes"; import Users from "@Front/Api/LeCoffreApi/SuperAdmin/Users/Users"; -import Votes from "@Front/Api/LeCoffreApi/SuperAdmin/Votes/Votes"; import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import SelectField, { IOption } from "@Front/Components/DesignSystem/Form/SelectField"; import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; @@ -224,7 +223,7 @@ export default function UserInformations(props: IProps) { const user = JwtService.getInstance().decodeJwt(); const vote = currentAppointment.votes?.find((vote) => vote.voter?.uid === user?.userId); if (!vote) return; - await Votes.getInstance().delete({ uid: vote.uid }); + await LiveVotes.getInstance().delete({ uid: vote.uid }); await getUser(); }, [currentAppointment, getUser]);