🐛 Fixing pending

This commit is contained in:
Maxime Lalo 2023-05-04 17:09:58 +02:00
parent 2bdc8a7e05
commit 7c512c830c
15 changed files with 40 additions and 23 deletions

View File

@ -59,7 +59,6 @@ export default class Customers extends BaseSuperAdmin {
*/ */
public async post(body: any): Promise<Customer> { public async post(body: any): Promise<Customer> {
const url = new URL(this.baseURl); const url = new URL(this.baseURl);
console.log(body);
try { try {
return await this.postRequest<Customer>(url, body); return await this.postRequest<Customer>(url, body);
} catch (err) { } catch (err) {

View File

@ -92,7 +92,6 @@ export default class Folders extends BaseSuperAdmin {
*/ */
public async post(body: any): Promise<OfficeFolder> { public async post(body: any): Promise<OfficeFolder> {
const url = new URL(this.baseURl); const url = new URL(this.baseURl);
console.log(body);
try { try {
return await this.postRequest<OfficeFolder>(url, body); return await this.postRequest<OfficeFolder>(url, body);
} catch (err) { } catch (err) {

View File

@ -9,6 +9,7 @@ import React from "react";
import Typography, { ITypo } from "../../Typography"; import Typography, { ITypo } from "../../Typography";
import WarningBadge from "../../WarningBadge"; import WarningBadge from "../../WarningBadge";
import classes from "./classes.module.scss"; import classes from "./classes.module.scss";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = { type IProps = {
document: { document: {
@ -64,7 +65,7 @@ class DocumentNotaryClass extends React.Component<IPropsClass, IState> {
} }
private onClick() { private onClick() {
if (this.props.document.document_status !== "VALIDATED" && this.props.document.document_status !== "PENDING") return; if (this.props.document.document_status !== EDocumentStatus.VALIDATED && this.props.document.document_status !== EDocumentStatus.DEPOSITED) return;
this.props.router.push(`/folders/${this.props.document.folder?.uid}/documents/${this.props.document.uid}`); this.props.router.push(`/folders/${this.props.document.folder?.uid}/documents/${this.props.document.uid}`);
} }
@ -76,7 +77,7 @@ class DocumentNotaryClass extends React.Component<IPropsClass, IState> {
<Image src={ValidIcon} alt="valid icon" /> <Image src={ValidIcon} alt="valid icon" />
</div> </div>
); );
case "PENDING": case EDocumentStatus.DEPOSITED:
return <WarningBadge />; return <WarningBadge />;
default: default:
return <Image src={TrashIcon} alt="trash icon" className={classes["trash"]} onClick={this.onOpenDeletionModal} />; return <Image src={TrashIcon} alt="trash icon" className={classes["trash"]} onClick={this.onOpenDeletionModal} />;

View File

@ -6,6 +6,7 @@ import React from "react";
import Typography, { ITypo } from "../Typography"; import Typography, { ITypo } from "../Typography";
import WarningBadge from "../WarningBadge"; import WarningBadge from "../WarningBadge";
import classes from "./classes.module.scss"; import classes from "./classes.module.scss";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = { type IProps = {
folder: IDashBoardFolder; folder: IDashBoardFolder;
@ -39,7 +40,7 @@ export default class FolderContainer extends React.Component<IProps, IState> {
private countPendingDocuments(): number { private countPendingDocuments(): number {
if (!this.props.folder.documents) return 0; if (!this.props.folder.documents) return 0;
return this.props.folder.documents?.filter((document) => document.document_status === "PENDING").length ?? 0; return this.props.folder.documents?.filter((document) => document.document_status === EDocumentStatus.DEPOSITED).length ?? 0;
} }
private onSelectedFolder(): void { private onSelectedFolder(): void {

View File

@ -6,6 +6,7 @@ import React from "react";
import FolderContainer from "../FolderContainer"; import FolderContainer from "../FolderContainer";
import classes from "./classes.module.scss"; import classes from "./classes.module.scss";
import Module from "@Front/Config/Module"; import Module from "@Front/Config/Module";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = { type IProps = {
folders: IDashBoardFolder[]; folders: IDashBoardFolder[];
@ -28,7 +29,7 @@ class FolderListClass extends React.Component<IPropsClass, IState> {
return ( return (
<div className={classes["root"]}> <div className={classes["root"]}>
{this.props.folders.sort((folder) => { {this.props.folders.sort((folder) => {
const pendingDocuments = (folder.documents ?? []).filter((document) => document.document_status === "PENDING"); const pendingDocuments = (folder.documents ?? []).filter((document) => document.document_status === EDocumentStatus.DEPOSITED);
return pendingDocuments.length >= 1 ? -1 : 1; return pendingDocuments.length >= 1 ? -1 : 1;
}).map((folder) => { }).map((folder) => {
return ( return (

View File

@ -9,6 +9,7 @@ import React from "react";
import Typography, { ITypo } from "../../Typography"; import Typography, { ITypo } from "../../Typography";
import WarningBadge from "../../WarningBadge"; import WarningBadge from "../../WarningBadge";
import classes from "./classes.module.scss"; import classes from "./classes.module.scss";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = { type IProps = {
customer: Customer; customer: Customer;
@ -68,7 +69,7 @@ export default class UserFolderHeader extends React.Component<IProps, IState> {
private hasPendingFiles() { private hasPendingFiles() {
const documents = const documents =
this.props.folder.documents?.filter((document) => document.depositor?.contact?.uid === this.props.customer.contact?.uid) ?? []; this.props.folder.documents?.filter((document) => document.depositor?.contact?.uid === this.props.customer.contact?.uid) ?? [];
const notAskedDocuments = documents.filter((document) => document.document_status === "PENDING") ?? []; const notAskedDocuments = documents.filter((document) => document.document_status === EDocumentStatus.DEPOSITED) ?? [];
return notAskedDocuments.length > 0; return notAskedDocuments.length > 0;
} }
@ -82,6 +83,5 @@ export default class UserFolderHeader extends React.Component<IProps, IState> {
} }
private onEditClick(): void { private onEditClick(): void {
// console.log("edit");
} }
} }

View File

@ -14,6 +14,7 @@ import QuantityProgressBar from "../QuantityProgressBar";
import classes from "./classes.module.scss"; import classes from "./classes.module.scss";
import DocumentList from "./DocumentList"; import DocumentList from "./DocumentList";
import UserFolderHeader from "./UserFolderHeader"; import UserFolderHeader from "./UserFolderHeader";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = { type IProps = {
customer: Customer; customer: Customer;
@ -150,8 +151,8 @@ export default class UserFolder extends React.Component<IProps, IState> {
// Get all documents Validated, pending // Get all documents Validated, pending
private getValidatedAndPendindDocuments(): Document[] | null { private getValidatedAndPendindDocuments(): Document[] | null {
const pendingDocuments = this.getDocumentsByStatus("PENDING"); const pendingDocuments = this.getDocumentsByStatus(EDocumentStatus.DEPOSITED);
const validatedDocuments = this.getDocumentsByStatus("VALIDATED"); const validatedDocuments = this.getDocumentsByStatus(EDocumentStatus.VALIDATED);
if (!pendingDocuments && !validatedDocuments) return null; if (!pendingDocuments && !validatedDocuments) return null;
pendingDocuments?.push(...validatedDocuments!); pendingDocuments?.push(...validatedDocuments!);
return pendingDocuments; return pendingDocuments;

View File

@ -119,6 +119,15 @@ export default class DefaultNotaryDashboard extends React.Component<IProps, ISta
deed: { include: { deed_type: true } }, deed: { include: { deed_type: true } },
office: true, office: true,
office_folder_has_customers: { include: { customer: { include: { contact: true } } } }, office_folder_has_customers: { include: { customer: { include: { contact: true } } } },
documents: {
include: {
depositor:{
include: {
contact: true
}
}
}
}
}, },
}, },
}; };

View File

@ -1,4 +1,5 @@
import { ECustomerStatus } from "le-coffre-resources/dist/Customer/Customer"; import { ECustomerStatus } from "le-coffre-resources/dist/Customer/Customer";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
import { EFolderStatus } from "le-coffre-resources/dist/Customer/OfficeFolder"; import { EFolderStatus } from "le-coffre-resources/dist/Customer/OfficeFolder";
import { import {
Address, Address,
@ -166,7 +167,7 @@ export const identityFile: File = {
export const documentIdentity: Document = { export const documentIdentity: Document = {
uid: "ethrthbkjtrbporjbh", uid: "ethrthbkjtrbporjbh",
depositor: customer2_mock, depositor: customer2_mock,
document_status: "PENDING", document_status: EDocumentStatus.DEPOSITED,
folder: folder, folder: folder,
document_type: identityDocType, document_type: identityDocType,
updated_at: new Date(), updated_at: new Date(),
@ -177,7 +178,7 @@ export const documentIdentity: Document = {
export const documentPending: Document = { export const documentPending: Document = {
uid: "fzefeazdagrtetrury", uid: "fzefeazdagrtetrury",
depositor: customer2_mock, depositor: customer2_mock,
document_status: "PENDING", document_status: EDocumentStatus.DEPOSITED,
folder: folder, folder: folder,
document_type: docType, document_type: docType,
updated_at: new Date(), updated_at: new Date(),

View File

@ -221,7 +221,7 @@ export default class DesignSystem extends BasePage<IProps, IState> {
</div> </div>
</div> </div>
<div className={classes["sub-section"]}> <div className={classes["sub-section"]}>
<Typography typo={ITypo.P_16}>Documents PENDING</Typography> <Typography typo={ITypo.P_16}>Documents Depoited</Typography>
<div className={classes["folder-conatainer"]}> <div className={classes["folder-conatainer"]}>
<DocumentNotary document={documentPending} /> <DocumentNotary document={documentPending} />
</div> </div>

View File

@ -144,9 +144,6 @@ class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
const customer = { const customer = {
contact: values, contact: values,
}; };
console.log(customer);
console.log("SELECTD >>>", this.props.selectedFolderUid);
const newCustomerCreated: Customer = await Customers.getInstance().post(customer); const newCustomerCreated: Customer = await Customers.getInstance().post(customer);
if (newCustomerCreated) { if (newCustomerCreated) {

View File

@ -1,7 +1,7 @@
import PlusIcon from "@Assets/Icons/plus.svg"; import PlusIcon from "@Assets/Icons/plus.svg";
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
import CheckBox from "@Front/Components/DesignSystem/CheckBox"; import CheckBox from "@Front/Components/DesignSystem/CheckBox";
import Form, { IApiFormErrors } from "@Front/Components/DesignSystem/Form"; import Form from "@Front/Components/DesignSystem/Form";
import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField"; import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField";
import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; import Confirm from "@Front/Components/DesignSystem/Modal/Confirm";
import { IOption } from "@Front/Components/DesignSystem/Select"; import { IOption } from "@Front/Components/DesignSystem/Select";
@ -171,9 +171,7 @@ export default class AskDocuments extends BasePage<IProps, IState> {
e: React.FormEvent<HTMLFormElement> | null, e: React.FormEvent<HTMLFormElement> | null,
values: { values: {
[key: string]: string; [key: string]: string;
}, }
onApiErrors: (apiFormErrors: IApiFormErrors | null) => void,
) { ) {
console.log(values);
} }
} }

View File

@ -171,6 +171,15 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
deed: { include: { deed_type: true } }, deed: { include: { deed_type: true } },
office: true, office: true,
office_folder_has_customers: { include: { customer: { include: { contact: true } } } }, office_folder_has_customers: { include: { customer: { include: { contact: true } } } },
documents: {
include: {
depositor:{
include: {
contact: true
}
}
}
}
}, },
}; };
const folder = await Folders.getInstance().getByUid(this.props.selectedFolderUid, query); const folder = await Folders.getInstance().getByUid(this.props.selectedFolderUid, query);

View File

@ -98,7 +98,7 @@ class UpdateClientClass extends BasePage<IPropsClass, IState> {
defaultValue={this.state.customer?.contact?.email} defaultValue={this.state.customer?.contact?.email}
/> />
<InputField <InputField
name="phone_number" name="cell_phone_number"
fakeplaceholder="Numéro de téléphone" fakeplaceholder="Numéro de téléphone"
isPositiveNumber isPositiveNumber
onChange={this.onChangePhoneNumberInput} onChange={this.onChangePhoneNumberInput}
@ -175,7 +175,7 @@ class UpdateClientClass extends BasePage<IPropsClass, IState> {
first_name: values["first_name"], first_name: values["first_name"],
last_name: values["last_name"], last_name: values["last_name"],
email: values["email"], email: values["email"],
phone_number: values["phone_number"], cell_phone_number: values["cell_phone_number"],
birthdate: values["birthdate"] === "" ? null : values["birthdate"], birthdate: values["birthdate"] === "" ? null : values["birthdate"],
address: address:
values["address"] === "" values["address"] === ""

View File

@ -19,6 +19,7 @@ import React from "react";
import BasePage from "../../Base"; import BasePage from "../../Base";
import classes from "./classes.module.scss"; import classes from "./classes.module.scss";
import OcrResult from "./OcrResult"; import OcrResult from "./OcrResult";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = {}; type IProps = {};
@ -104,7 +105,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
)} )}
<div className={classes["buttons-container"]}> <div className={classes["buttons-container"]}>
{this.props.selectedDocument?.document_status === "PENDING" && ( {this.props.selectedDocument?.document_status === EDocumentStatus.DEPOSITED && (
<> <>
<Button variant={EButtonVariant.GHOST} onClick={this.openRefuseModal}> <Button variant={EButtonVariant.GHOST} onClick={this.openRefuseModal}>
Refuser Refuser