🐛 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> {
const url = new URL(this.baseURl);
console.log(body);
try {
return await this.postRequest<Customer>(url, body);
} catch (err) {

View File

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

View File

@ -9,6 +9,7 @@ import React from "react";
import Typography, { ITypo } from "../../Typography";
import WarningBadge from "../../WarningBadge";
import classes from "./classes.module.scss";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = {
document: {
@ -64,7 +65,7 @@ class DocumentNotaryClass extends React.Component<IPropsClass, IState> {
}
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}`);
}
@ -76,7 +77,7 @@ class DocumentNotaryClass extends React.Component<IPropsClass, IState> {
<Image src={ValidIcon} alt="valid icon" />
</div>
);
case "PENDING":
case EDocumentStatus.DEPOSITED:
return <WarningBadge />;
default:
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 WarningBadge from "../WarningBadge";
import classes from "./classes.module.scss";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = {
folder: IDashBoardFolder;
@ -39,7 +40,7 @@ export default class FolderContainer extends React.Component<IProps, IState> {
private countPendingDocuments(): number {
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 {

View File

@ -6,6 +6,7 @@ import React from "react";
import FolderContainer from "../FolderContainer";
import classes from "./classes.module.scss";
import Module from "@Front/Config/Module";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = {
folders: IDashBoardFolder[];
@ -28,7 +29,7 @@ class FolderListClass extends React.Component<IPropsClass, IState> {
return (
<div className={classes["root"]}>
{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;
}).map((folder) => {
return (

View File

@ -9,6 +9,7 @@ import React from "react";
import Typography, { ITypo } from "../../Typography";
import WarningBadge from "../../WarningBadge";
import classes from "./classes.module.scss";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = {
customer: Customer;
@ -68,7 +69,7 @@ export default class UserFolderHeader extends React.Component<IProps, IState> {
private hasPendingFiles() {
const documents =
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;
}
@ -82,6 +83,5 @@ export default class UserFolderHeader extends React.Component<IProps, IState> {
}
private onEditClick(): void {
// console.log("edit");
}
}

View File

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

View File

@ -119,6 +119,15 @@ export default class DefaultNotaryDashboard extends React.Component<IProps, ISta
deed: { include: { deed_type: true } },
office: 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 { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
import { EFolderStatus } from "le-coffre-resources/dist/Customer/OfficeFolder";
import {
Address,
@ -166,7 +167,7 @@ export const identityFile: File = {
export const documentIdentity: Document = {
uid: "ethrthbkjtrbporjbh",
depositor: customer2_mock,
document_status: "PENDING",
document_status: EDocumentStatus.DEPOSITED,
folder: folder,
document_type: identityDocType,
updated_at: new Date(),
@ -177,7 +178,7 @@ export const documentIdentity: Document = {
export const documentPending: Document = {
uid: "fzefeazdagrtetrury",
depositor: customer2_mock,
document_status: "PENDING",
document_status: EDocumentStatus.DEPOSITED,
folder: folder,
document_type: docType,
updated_at: new Date(),

View File

@ -221,7 +221,7 @@ export default class DesignSystem extends BasePage<IProps, IState> {
</div>
</div>
<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"]}>
<DocumentNotary document={documentPending} />
</div>

View File

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

View File

@ -1,7 +1,7 @@
import PlusIcon from "@Assets/Icons/plus.svg";
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
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 Confirm from "@Front/Components/DesignSystem/Modal/Confirm";
import { IOption } from "@Front/Components/DesignSystem/Select";
@ -171,9 +171,7 @@ export default class AskDocuments extends BasePage<IProps, IState> {
e: React.FormEvent<HTMLFormElement> | null,
values: {
[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 } },
office: 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);

View File

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

View File

@ -19,6 +19,7 @@ import React from "react";
import BasePage from "../../Base";
import classes from "./classes.module.scss";
import OcrResult from "./OcrResult";
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
type IProps = {};
@ -104,7 +105,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
)}
<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}>
Refuser