diff --git a/src/front/Api/LeCoffreApi/SuperAdmin/DocumentTypes/DocumentTypes.ts b/src/front/Api/LeCoffreApi/SuperAdmin/DocumentTypes/DocumentTypes.ts index 7904e6e5..1e8a09af 100644 --- a/src/front/Api/LeCoffreApi/SuperAdmin/DocumentTypes/DocumentTypes.ts +++ b/src/front/Api/LeCoffreApi/SuperAdmin/DocumentTypes/DocumentTypes.ts @@ -10,16 +10,15 @@ export interface IGetDocumentTypesparams { // TODO Type getbyuid query params -export type IPutDocumentTypesParams = { -}; +export type IPutDocumentTypesParams = {}; export interface IPostDocumentTypesParams { - name: string; - public_description: string; - private_description: string; - office: { - uid: string; - }; + name: string; + public_description: string; + private_description: string; + office: { + uid: string; + }; } export default class DocumentTypes extends BaseSuperAdmin { @@ -40,7 +39,8 @@ export default class DocumentTypes extends BaseSuperAdmin { public async get(q: IGetDocumentTypesparams): Promise { const url = new URL(this.baseURl); - Object.entries(q).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value))); + const query = { q }; + if (q) Object.entries(query).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value))); try { return await this.getRequest(url); } catch (err) { diff --git a/src/front/Components/DesignSystem/DepositDocument/index.tsx b/src/front/Components/DesignSystem/DepositDocument/index.tsx index fae00235..236c10e7 100644 --- a/src/front/Components/DesignSystem/DepositDocument/index.tsx +++ b/src/front/Components/DesignSystem/DepositDocument/index.tsx @@ -144,7 +144,6 @@ export default class DepositDocument extends React.Component { - ; ); } diff --git a/src/front/Components/Layouts/ClientDashboard/index.tsx b/src/front/Components/Layouts/ClientDashboard/index.tsx index 6fe77df4..0b6fdea4 100644 --- a/src/front/Components/Layouts/ClientDashboard/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/index.tsx @@ -6,24 +6,27 @@ import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; import Base from "@Front/Components/Layouts/Base"; import DefaultTemplate from "@Front/Components/LayoutTemplates/DefaultTemplate"; import React from "react"; -import { documentDeposited } from "../DesignSystem/dummyData"; import classes from "./classes.module.scss"; import Documents, { IGetDocumentsparams } from "@Front/Api/LeCoffreApi/SuperAdmin/Documents/Documents"; -import { Document } from "le-coffre-resources/dist/Customer"; -import Users from "@Front/Api/LeCoffreApi/SuperAdmin/Users/Users"; +import Customer, { Document } from "le-coffre-resources/dist/Customer"; +import Customers from "@Front/Api/LeCoffreApi/SuperAdmin/Customers/Customers"; +import { document } from "./../../../Components/Layouts/DesignSystem/dummyData"; type IProps = {}; type IState = { isAddDocumentModalVisible: boolean; documents: Document[]; + mockedCustomer: Customer | null; }; export default class ClientDashboard extends Base { + private currentClient: number = 0; public constructor(props: IProps) { super(props); this.state = { isAddDocumentModalVisible: false, documents: [], + mockedCustomer: null, }; this.onCloseModalAddDocument = this.onCloseModalAddDocument.bind(this); this.onOpenModalAddDocument = this.onOpenModalAddDocument.bind(this); @@ -37,11 +40,7 @@ export default class ClientDashboard extends Base {
{this.state.documents?.map((document) => ( - + ))}
Documents supplémentaires (facultatif) @@ -69,7 +68,7 @@ export default class ClientDashboard extends Base { Glissez / Déposez votre document dans la zone prévue à cet effet ou cliquez sur la zone puis sélectionnez le document correspondant. - +
@@ -83,7 +82,7 @@ export default class ClientDashboard extends Base {
{/* TODO Get name from userStore */} - Bonjour John Doe + Bonjour {this.state.mockedCustomer?.contact?.first_name.concat(" ", this.state.mockedCustomer?.contact?.last_name)} @@ -105,9 +104,11 @@ export default class ClientDashboard extends Base { public override async componentDidMount() { // TODO Get documents of the current customer according to userStore // REMOVE this mock - const mockUsers = (await Users.getInstance().get({}))[2]; + const mockedCustomers = await Customers.getInstance().get({}); + const mockedCustomer = mockedCustomers[this.currentClient]!; + const query: IGetDocumentsparams = { - where: { depositor: mockUsers?.uid }, + where: { depositor: { uid: mockedCustomer.uid } }, include: { files: true, document_history: true, @@ -115,7 +116,7 @@ export default class ClientDashboard extends Base { }, }; const documents: Document[] = await Documents.getInstance().get(query); - this.setState({ documents }); + this.setState({ documents, mockedCustomer }); } private onCloseModalAddDocument() { diff --git a/src/front/Components/Layouts/DesignSystem/dummyData.ts b/src/front/Components/Layouts/DesignSystem/dummyData.ts index 552a023f..57157d5b 100644 --- a/src/front/Components/Layouts/DesignSystem/dummyData.ts +++ b/src/front/Components/Layouts/DesignSystem/dummyData.ts @@ -78,7 +78,7 @@ export const contact2: Contact = { }; export const docType: DocumentType = { - name: "Acte de naissance", + name: "Votre document", uid: "fezezfazegezrgrezg", created_at: new Date(), updated_at: new Date(), @@ -146,7 +146,7 @@ export const fileMock: File = { file_name: "file_1", file_path: "https://minteed-stg-euwest3-s3.s3.eu-west-3.amazonaws.com/Qmf_Yb_Eh_X9st_F_Srq_Ve_Bj_Yb_Aj56xv_AV_Nj6_Wjypo_B4r5ubce_U_ae3303e7ab.pdf", - iv: "1" + iv: "1", }; export const fileMock2: File = { @@ -157,7 +157,7 @@ export const fileMock2: File = { file_name: "file_2", file_path: "https://minteed-prod-euwest3-s3.s3.eu-west-3.amazonaws.com/Qm_Wq_En1_DCA_8yt_RX_Qx_QFA_9_Fm_ZKZH_Qqb_VH_1_Q_Mnv_G_Jtt1_FS_Xp_2a35a36e19", - iv: "2" + iv: "2", }; export const identityFile: File = { @@ -167,7 +167,7 @@ export const identityFile: File = { document: document, file_name: "file_3", file_path: "https://minteed-stg-euwest3-s3.s3.eu-west-3.amazonaws.com/cni_fake_c7259d4923.png", - iv: "3" + iv: "3", }; export const documentIdentity: Document = {