🎨 fix 4 client dashboard

This commit is contained in:
Hugo Lextrait 2023-05-11 16:10:51 +02:00
parent f20517117e
commit 3c92a0e9ab
7 changed files with 31 additions and 14 deletions

View File

@ -12,7 +12,9 @@ import Customers from "@Front/Api/LeCoffreApi/SuperAdmin/Customers/Customers";
import Customer, { Document } from "le-coffre-resources/dist/Customer"; import Customer, { Document } from "le-coffre-resources/dist/Customer";
import { document } from "./../../../Components/Layouts/DesignSystem/dummyData"; import { document } from "./../../../Components/Layouts/DesignSystem/dummyData";
type IProps = {}; type IProps = {
targetedCustormer: string; // MOCK
};
type IState = { type IState = {
isAddDocumentModalVisible: boolean; isAddDocumentModalVisible: boolean;
documents: Document[]; documents: Document[];
@ -20,7 +22,6 @@ type IState = {
}; };
export default class ClientDashboard extends Base<IProps, IState> { export default class ClientDashboard extends Base<IProps, IState> {
private currentClient: number = 14;
public constructor(props: IProps) { public constructor(props: IProps) {
super(props); super(props);
this.state = { this.state = {
@ -106,8 +107,8 @@ export default class ClientDashboard extends Base<IProps, IState> {
public override async componentDidMount() { public override async componentDidMount() {
// TODO Get documents of the current customer according to userStore // TODO Get documents of the current customer according to userStore
// REMOVE this mock // REMOVE this mock
const mockedCustomers = await Customers.getInstance().get({}); const mockedCustomers = await Customers.getInstance().get({ where: { contact: { email: this.props.targetedCustormer } } });
const mockedCustomer = mockedCustomers[this.currentClient]!; const mockedCustomer: Customer = mockedCustomers[0]!;
const query: IGetDocumentsparams = { const query: IGetDocumentsparams = {
where: { depositor: { uid: mockedCustomer.uid } }, where: { depositor: { uid: mockedCustomer.uid } },

View File

@ -1,4 +1,3 @@
import LeftArrowIcon from "@Assets/Icons/left-arrow.svg"; import LeftArrowIcon from "@Assets/Icons/left-arrow.svg";
import RightArrowIcon from "@Assets/Icons/right-arrow.svg"; import RightArrowIcon from "@Assets/Icons/right-arrow.svg";
import Documents from "@Front/Api/LeCoffreApi/SuperAdmin/Documents/Documents"; import Documents from "@Front/Api/LeCoffreApi/SuperAdmin/Documents/Documents";
@ -22,7 +21,6 @@ import classes from "./classes.module.scss";
import OcrResult from "./OcrResult"; import OcrResult from "./OcrResult";
import Files from "@Front/Api/LeCoffreApi/SuperAdmin/Files/Files"; import Files from "@Front/Api/LeCoffreApi/SuperAdmin/Files/Files";
type IProps = {}; type IProps = {};
type IPropsClass = { type IPropsClass = {
documentUid: string; documentUid: string;
@ -76,7 +74,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
{this.state.document && this.state.document.files && this.state.selectedFile && ( {this.state.document && this.state.document.files && this.state.selectedFile && (
<div className={classes["root"]}> <div className={classes["root"]}>
<Typography typo={ITypo.H1} color={ITypoColor.BLACK} className={classes["title"]}> <Typography typo={ITypo.H1} color={ITypoColor.BLACK} className={classes["title"]}>
App 23 rue Torus Toulon {this.state.document.document_type?.name}
</Typography> </Typography>
<Typography typo={ITypo.H3} color={ITypoColor.BLACK} className={classes["subtitle"]}> <Typography typo={ITypo.H3} color={ITypoColor.BLACK} className={classes["subtitle"]}>
{this.state.document.document_type?.name} {this.state.document.document_type?.name}
@ -91,7 +89,10 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
</div> </div>
)} )}
<div className={classes["file-container"]}> <div className={classes["file-container"]}>
<FilePreview href={Files.getInstance().getUploadLink(this.state.selectedFile?.uid as string)} key={this.state.selectedFile.uid} /> <FilePreview
href={Files.getInstance().getUploadLink(this.state.selectedFile?.uid as string)}
key={this.state.selectedFile.uid}
/>
</div> </div>
{this.state.document.files.length > 1 && ( {this.state.document.files.length > 1 && (
<div <div
@ -272,7 +273,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
try { try {
await Documents.getInstance().put(this.props.documentUid, { await Documents.getInstance().put(this.props.documentUid, {
document_status: EDocumentStatus.REFUSED, document_status: EDocumentStatus.REFUSED,
refused_reason: this.state.refuseText refused_reason: this.state.refuseText,
}); });
this.props.router.push( this.props.router.push(

View File

@ -1,5 +1,5 @@
import ClientDashboard from "@Front/Components/Layouts/ClientDashboard"; import ClientDashboard from "@Front/Components/Layouts/ClientDashboard";
export default function Route() { export default function Route() {
return <ClientDashboard />; return <ClientDashboard targetedCustormer="kevin.hautefaye@gmail.com" />;
} }

View File

@ -0,0 +1,5 @@
import ClientDashboard from "@Front/Components/Layouts/ClientDashboard";
export default function Route() {
return <ClientDashboard targetedCustormer="manon.simon@gmail.com" />;
}

View File

@ -0,0 +1,5 @@
import ClientDashboard from "@Front/Components/Layouts/ClientDashboard";
export default function Route() {
return <ClientDashboard targetedCustormer="vincent.brognard@gmail.com" />;
}

View File

@ -0,0 +1,5 @@
import ClientDashboard from "@Front/Components/Layouts/ClientDashboard";
export default function Route() {
return <ClientDashboard targetedCustormer="maxime.lalo@gmail.com" />;
}

View File

@ -1,5 +1,5 @@
import ClientDashboard from "@Front/Components/Layouts/ClientDashboard"; import ClientDashboard from "@Front/Components/Layouts/ClientDashboard";
export default function Route() { export default function Route() {
return <ClientDashboard />; return <ClientDashboard targetedCustormer="kevin.hautefaye@gmail.com" />;
} }