diff --git a/.ssh/id_rsa.pub b/.ssh/id_rsa.pub deleted file mode 100644 index e1327d66..00000000 --- a/.ssh/id_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOfOFPvQNw5XguFuX1YNvED8ulP+tIA/5xw7LHcA0gRj3hwILCAEAjuDs+d13zCsnEb0yd+laT3PU9iRIKa28Tynu+sTjGDyfx8MX/HjJtbEzyd6jLn87uTvw/6lzg2y5ZDEa6PEqrPIv0KEhuq6HuU8qAA0nBpsTIAUTK3XR8qm3I6J9Rs1JyBjvIP5UeICApvoLmgHuz6mKdvoQ8qKDWamsL4pSc4Hr7HlQ8ITNhnyS8XMgQInU/I2TzT/I4Dxx5IeFUQ5KOfJJNgK1d+PByLSWUrn+eRXki8m1hjMiwGIehVAriFW1C309SEHxLHjQKUPXHSv4kH7zqjO+p3kY5gwp/lvsBRSnihj8s1lADsJlMqjnSLeIQ+sY2CNkmXXI8ABkzhuJKTGTl+8pzGGhIHzeU7e7lpSn3gLn4p217kIppHNAr6dZH9UaYbgnwVonwr5cLbatRPFyI1NfXKDyZtSYlGQxLQUt9KDrNvVTZzaTt3YwM/YCsRIADAagKosM= gisele-smartchain@MacBook-Pro-6.local diff --git a/package-lock.json b/package-lock.json index e5d9c2d3..6bff1c1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,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.115", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.119", "next": "13.2.4", "prettier": "^2.8.7", "react": "18.2.0", @@ -1569,9 +1569,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001587", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", - "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", + "version": "1.0.30001588", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001588.tgz", + "integrity": "sha512-+hVY9jE44uKLkH0SrUTqxjxqNTOWHsbnQDIKjwkZ3lNTzUUVdBLBGXtj/q5Mp5u98r3droaZAewQuEDzjQdZlQ==", "funding": [ { "type": "opencollective", @@ -3458,7 +3458,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#cc49eea2e6692637edda2335970deaa4221a9201", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#de8a3be3ddad5e2b583f52f9830e7a10b0fc2e4c", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", @@ -4625,9 +4625,9 @@ } }, "node_modules/streamx": { - "version": "2.15.8", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.8.tgz", - "integrity": "sha512-6pwMeMY/SuISiRsuS8TeIrAzyFbG5gGPHFQsYjUr/pbBadaL1PCWmzKw+CHZSwainfvcF6Si6cVLq4XTEwswFQ==", + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.16.0.tgz", + "integrity": "sha512-a7Fi0PoUeusrUcMS4+HxivnZqYsw2MFEP841TIyLxTcEIucHcJsk+0ARcq3tGq1xDn+xK7sKHetvfMzI1/CzMA==", "dependencies": { "fast-fifo": "^1.1.0", "queue-tick": "^1.0.1" @@ -4938,15 +4938,16 @@ } }, "node_modules/typed-array-byte-offset": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", - "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.1.tgz", + "integrity": "sha512-tcqKMrTRXjqvHN9S3553NPCaGL0VPgFI92lXszmrE8DMhiDPLBYLlvo8Uu4WZAAX/aGqp/T1sbA4ph8EWjDF9Q==", "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", + "available-typed-arrays": "^1.0.6", + "call-bind": "^1.0.7", "for-each": "^0.3.3", + "gopd": "^1.0.1", "has-proto": "^1.0.1", - "is-typed-array": "^1.1.10" + "is-typed-array": "^1.1.13" }, "engines": { "node": ">= 0.4" diff --git a/package.json b/package.json index b259e258..f95223f1 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.115", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.119", "next": "13.2.4", "prettier": "^2.8.7", "react": "18.2.0", diff --git a/src/front/Components/DesignSystem/FolderArchivedListContainer/classes.module.scss b/src/front/Components/DesignSystem/FolderArchivedListContainer/classes.module.scss new file mode 100644 index 00000000..98e9d101 --- /dev/null +++ b/src/front/Components/DesignSystem/FolderArchivedListContainer/classes.module.scss @@ -0,0 +1,23 @@ +@import "@Themes/constants.scss"; + +.root { + width: calc(100vh - 83px); + display: flex; + flex-direction: column; + justify-content: space-between; + + .header { + flex: 1; + } + + .searchbar { + padding: 40px 24px 24px 24px; + } + + .folderlist-container { + max-height: calc(100vh - 215px); + height: calc(100vh - 215px); + overflow: auto; + border-right: 1px solid var(--grey-medium); + } +} diff --git a/src/front/Components/DesignSystem/FolderArchivedListContainer/index.tsx b/src/front/Components/DesignSystem/FolderArchivedListContainer/index.tsx new file mode 100644 index 00000000..19797c52 --- /dev/null +++ b/src/front/Components/DesignSystem/FolderArchivedListContainer/index.tsx @@ -0,0 +1,150 @@ +import Module from "@Front/Config/Module"; +import { OfficeFolder } from "le-coffre-resources/dist/Notary"; +import { EDocumentStatus } from "le-coffre-resources/dist/Notary/Document"; +import Link from "next/link"; +import { NextRouter, useRouter } from "next/router"; +import React from "react"; + +import BlockList, { IBlock } from "../BlockList"; +import Button from "../Button"; +import SearchBar from "../SearchBar"; +import classes from "./classes.module.scss"; +import Rules, { RulesMode } from "@Front/Components/Elements/Rules"; +import { AppRuleActions, AppRuleNames } from "@Front/Api/Entities/rule"; + +type IProps = { + folders: OfficeFolder[]; + isArchived: boolean; + onSelectedFolder?: (folder: OfficeFolder) => void; + onCloseLeftSide?: () => void; +}; + +type IPropsClass = IProps & { + router: NextRouter; + selectedFolder: string; +}; + +type IState = { + filteredFolders: OfficeFolder[]; + blocks: IBlock[]; +}; + +class FolderArchivedListContainerClass extends React.Component { + private redirectPath: string = this.props.isArchived + ? Module.getInstance().get().modules.pages.Folder.pages.FolderArchived.pages.FolderInformation.props.path + : Module.getInstance().get().modules.pages.Folder.pages.FolderInformation.props.path; + public constructor(props: IPropsClass) { + super(props); + this.state = { + filteredFolders: this.props.folders, + blocks: this.getBlocks(this.props.folders), + }; + this.filterFolders = this.filterFolders.bind(this); + this.onSelectedFolder = this.onSelectedFolder.bind(this); + } + + public override render(): JSX.Element { + const navigatePath = Module.getInstance().get().modules.pages.Folder.pages.CreateFolder.props.path; + return ( +
+
+
+ +
+
+ +
+
+ {!this.props.isArchived && ( +
+ + + + + +
+ )} +
+ ); + } + + public override componentDidUpdate(prevProps: Readonly, prevState: Readonly, snapshot?: any): void { + if (prevProps.selectedFolder !== this.props.selectedFolder) { + this.setState({ filteredFolders: this.props.folders, blocks: this.getBlocks(this.props.folders) }); + } + } + private getBlocks(folders: OfficeFolder[]): IBlock[] { + const pendingFolders = folders + .filter((folder) => { + const pendingDocuments = (folder.documents ?? []).filter( + (document) => document.document_status === EDocumentStatus.DEPOSITED, + ); + return pendingDocuments.length >= 1; + }) + .sort((folder1, folder2) => { + return folder1.created_at! > folder2.created_at! ? -1 : 1; + }); + + const otherFolders = folders + .filter((folder) => { + const pendingDocuments = (folder.documents ?? []).filter( + (document) => document.document_status === EDocumentStatus.DEPOSITED, + ); + return pendingDocuments.length === 0; + }) + .sort((folder1, folder2) => { + return folder1.created_at! > folder2.created_at! ? -1 : 1; + }); + + return [...pendingFolders, ...otherFolders].map((folder) => { + return { + id: folder.uid!, + name: folder.folder_number! + " - " + folder.name!, + selected: this.props.selectedFolder === folder.uid, + hasFlag: folder.documents?.some((document) => document.document_status === EDocumentStatus.DEPOSITED), + }; + }); + } + + private onSelectedFolder(block: IBlock) { + const folder = this.props.folders.find((folder) => folder.uid === block.id); + if (!folder) return; + this.props.onSelectedFolder && this.props.onSelectedFolder(folder); + const path = this.redirectPath.replace("[folderUid]", folder.uid ?? ""); + this.props.router.push(path); + } + + private filterFolders(value: string): void { + const filteredFolders: OfficeFolder[] = this.props.folders.filter((folder) => { + const name = folder.name.toLowerCase(); + const number = folder.folder_number.toLowerCase(); + value = value.toLowerCase(); + if (folder.customers) { + const customerNames = folder.customers + .map((customer) => { + return `${customer.contact?.first_name.toLowerCase()} ${customer.contact?.last_name.toLowerCase()}`; + }) + .join(", "); + + return name.includes(value) || number.includes(value) || customerNames.includes(value); + } + + return name.includes(value) || number.includes(value); + }); + + this.setState({ filteredFolders, blocks: this.getBlocks(filteredFolders) }); + } +} + +export default function FolderListContainer(props: IProps) { + const router = useRouter(); + const { folderUid } = router.query; + return ; +} diff --git a/src/front/Components/LayoutTemplates/DefaultDeedTypeDashboard/DeedTypeListContainer/classes.module.scss b/src/front/Components/LayoutTemplates/DefaultDeedTypeDashboard/DeedTypeListContainer/classes.module.scss index e2840502..0bd02d2a 100644 --- a/src/front/Components/LayoutTemplates/DefaultDeedTypeDashboard/DeedTypeListContainer/classes.module.scss +++ b/src/front/Components/LayoutTemplates/DefaultDeedTypeDashboard/DeedTypeListContainer/classes.module.scss @@ -17,8 +17,8 @@ } .folderlist-container { - max-height: calc(100vh - 215px); - height: calc(100vh - 215px); + max-height: calc(100vh - 290px); + height: calc(100vh - 290px); overflow: auto; border-right: 1px solid var(--grey-medium); } diff --git a/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/DocumentTypeListContainer/classes.module.scss b/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/DocumentTypeListContainer/classes.module.scss index a172d64d..b8bae18e 100644 --- a/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/DocumentTypeListContainer/classes.module.scss +++ b/src/front/Components/LayoutTemplates/DefaultDocumentTypesDashboard/DocumentTypeListContainer/classes.module.scss @@ -15,8 +15,8 @@ } .folderlist-container { - max-height: calc(100vh - 215px); - height: calc(100vh - 215px); + max-height: calc(100vh - 290px); + height: calc(100vh - 290px); overflow: auto; border-right: 1px solid var(--grey-medium); } diff --git a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx index 37148adb..4fd445e3 100644 --- a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx @@ -2,6 +2,7 @@ import ChevronIcon from "@Assets/Icons/chevron.svg"; import Folders, { IGetFoldersParams } from "@Front/Api/LeCoffreApi/Notary/Folders/Folders"; import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import FolderListContainer from "@Front/Components/DesignSystem/FolderListContainer"; +import FolderArchivedListContainer from "@Front/Components/DesignSystem/FolderArchivedListContainer"; import Header from "@Front/Components/DesignSystem/Header"; import Version from "@Front/Components/DesignSystem/Version"; import BackArrow from "@Front/Components/Elements/BackArrow"; @@ -54,12 +55,20 @@ export default class DefaultNotaryDashboard extends React.Component {this.state.isLeftSideOpen &&
}
- {this.state.folders && ( + {this.props.isArchived && this.state.folders && ( + + )} + {!this.props.isArchived && this.state.folders && ( )}
diff --git a/src/front/Components/Layouts/DeedTypes/DeedTypesEdit/index.tsx b/src/front/Components/Layouts/DeedTypes/DeedTypesEdit/index.tsx index ab21dabd..97df2dc7 100644 --- a/src/front/Components/Layouts/DeedTypes/DeedTypesEdit/index.tsx +++ b/src/front/Components/Layouts/DeedTypes/DeedTypesEdit/index.tsx @@ -14,7 +14,6 @@ import { ValidationError } from "class-validator"; import classes from "./classes.module.scss"; - export default function DeedTypesEdit() { const router = useRouter(); let { deedTypeUid } = router.query; @@ -53,7 +52,7 @@ export default function DeedTypesEdit() { try { await deedType.validateOrReject?.({ groups: ["updateDeedType"], forbidUnknownValues: true }); } catch (validationErrors: Array | any) { - if(!Array.isArray(validationErrors)) return; + if (!Array.isArray(validationErrors)) return; setValidationError(validationErrors as ValidationError[]); return; } @@ -72,7 +71,7 @@ export default function DeedTypesEdit() { .modules.pages.DeedTypes.pages.DeedTypesInformations.props.path.replace("[uid]", deedTypeUid as string), ); } catch (validationErrors) { - if(!Array.isArray(validationErrors)) return; + if (!Array.isArray(validationErrors)) return; setValidationError(validationErrors as ValidationError[]); return; } @@ -107,8 +106,18 @@ export default function DeedTypesEdit() { Modifier les informations de l'acte
- error.property === 'name')}/> - error.property === 'description')} /> + error.property === "name")} + /> + error.property === "description")} + />