🎨 patch other document
This commit is contained in:
parent
41b8ec5bdc
commit
ad2b89367f
@ -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<DocumentType[]> {
|
||||
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<DocumentType[]>(url);
|
||||
} catch (err) {
|
||||
|
@ -144,7 +144,6 @@ export default class DepositDocument extends React.Component<IProps, IState> {
|
||||
<InputField textarea fakeplaceholder={"Description"} defaultValue={this.state.refusedReason} readOnly />
|
||||
</div>
|
||||
</Confirm>
|
||||
;
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -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<IProps, IState> {
|
||||
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<IProps, IState> {
|
||||
<div className={classes["sub-container"]}>
|
||||
<div className={classes["content"]}>
|
||||
{this.state.documents?.map((document) => (
|
||||
<DepositDocument
|
||||
document={document}
|
||||
key={document.uid}
|
||||
defaultFiles={document.files ?? []}
|
||||
/>
|
||||
<DepositDocument document={document} key={document.uid} defaultFiles={document.files ?? []} />
|
||||
))}
|
||||
</div>
|
||||
<Typography typo={ITypo.H2}>Documents supplémentaires (facultatif)</Typography>
|
||||
@ -69,7 +68,7 @@ export default class ClientDashboard extends Base<IProps, IState> {
|
||||
Glissez / Déposez votre document dans la zone prévue à cet effet ou cliquez sur la zone puis sélectionnez le
|
||||
document correspondant.
|
||||
</Typography>
|
||||
<DepositDocument document={documentDeposited} />
|
||||
<DepositDocument document={document} />
|
||||
</div>
|
||||
</Confirm>
|
||||
</div>
|
||||
@ -83,7 +82,7 @@ export default class ClientDashboard extends Base<IProps, IState> {
|
||||
<div className={classes["text-container"]}>
|
||||
{/* TODO Get name from userStore */}
|
||||
<Typography typo={ITypo.H1} className={classes["title"]}>
|
||||
Bonjour John Doe
|
||||
Bonjour {this.state.mockedCustomer?.contact?.first_name.concat(" ", this.state.mockedCustomer?.contact?.last_name)}
|
||||
</Typography>
|
||||
|
||||
<Typography typo={ITypo.H2} className={classes["subtitle"]}>
|
||||
@ -105,9 +104,11 @@ export default class ClientDashboard extends Base<IProps, IState> {
|
||||
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<IProps, IState> {
|
||||
},
|
||||
};
|
||||
const documents: Document[] = await Documents.getInstance().get(query);
|
||||
this.setState({ documents });
|
||||
this.setState({ documents, mockedCustomer });
|
||||
}
|
||||
|
||||
private onCloseModalAddDocument() {
|
||||
|
@ -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 = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user