🐛 Warning icon on client only if something pending
This commit is contained in:
parent
ae79ed86ca
commit
32bdcbcc92
@ -7,6 +7,7 @@ import PenIcon from "@Assets/Icons/pen.svg";
|
||||
import WarningBadge from "../../WarningBadge";
|
||||
import Link from "next/link";
|
||||
import Module from "@Front/Config/Module";
|
||||
import { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
||||
|
||||
type IProps = {
|
||||
contact: {
|
||||
@ -17,7 +18,7 @@ type IProps = {
|
||||
cell_phone_number: Contact["cell_phone_number"];
|
||||
email: Contact["email"];
|
||||
};
|
||||
selectedFolderUid: string;
|
||||
folder: IDashBoardFolder;
|
||||
isArchived?: boolean;
|
||||
};
|
||||
type IState = {};
|
||||
@ -29,7 +30,7 @@ export default class UserFolderHeader extends React.Component<IProps, IState> {
|
||||
public override render(): JSX.Element {
|
||||
const redirectPath = Module.getInstance()
|
||||
.get()
|
||||
.modules.pages.Folder.pages.EditClient.props.path.replace("[folderUid]", this.props.selectedFolderUid)
|
||||
.modules.pages.Folder.pages.EditClient.props.path.replace("[folderUid]", this.props.folder.uid)
|
||||
.replace("[clientUid]", this.props.contact.uid);
|
||||
return (
|
||||
<div className={classes["root"]}>
|
||||
@ -59,7 +60,7 @@ export default class UserFolderHeader extends React.Component<IProps, IState> {
|
||||
</div>
|
||||
{!this.props.isArchived && (
|
||||
<div className={classes["icons"]}>
|
||||
<WarningBadge />
|
||||
{this.hasPendingFiles() && <WarningBadge />}
|
||||
<Link href={redirectPath}>
|
||||
<Image src={PenIcon} alt="edit" className={classes["edit-icon"]} onClick={this.onEditClick} />
|
||||
</Link>
|
||||
@ -69,6 +70,14 @@ 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.contact.uid) ?? [];
|
||||
const notAskedDocuments = documents.filter((document) => document.document_status === "PENDING") ?? [];
|
||||
console.log(this.props.contact.uid);
|
||||
console.log(notAskedDocuments.length);
|
||||
return notAskedDocuments.length > 0;
|
||||
}
|
||||
|
||||
private formatPhoneNumber(phoneNumber: string): string {
|
||||
if (!phoneNumber) return "";
|
||||
const output = phoneNumber.split("").map((char, index) => {
|
||||
|
@ -68,7 +68,7 @@ export default class UserFolder extends React.Component<IProps, IState> {
|
||||
<div className={classes["header"]} onClick={this.toggleOpen}>
|
||||
<UserFolderHeader
|
||||
contact={this.props.customer.contact}
|
||||
selectedFolderUid={this.props.folder.uid}
|
||||
folder={this.props.folder}
|
||||
isArchived={this.props.isArchived}
|
||||
/>
|
||||
<Image
|
||||
|
@ -39,7 +39,7 @@ export const deed: Deed = {
|
||||
};
|
||||
|
||||
export const contact: Contact = {
|
||||
uid: "g('yeh(grgrezg",
|
||||
uid: "contact_1_uid",
|
||||
first_name: "John",
|
||||
last_name: "Doe",
|
||||
email: "johnDoe@gmail.com",
|
||||
@ -52,7 +52,7 @@ export const contact: Contact = {
|
||||
};
|
||||
|
||||
export const contact2: Contact = {
|
||||
uid: "g('yeh(grgrezg",
|
||||
uid: "contact_2_uid",
|
||||
first_name: "Customer2",
|
||||
last_name: "Doe",
|
||||
email: "johnDoe@gmail.com",
|
||||
@ -91,6 +91,15 @@ export const customer: Customer = {
|
||||
updated_at: new Date(),
|
||||
status: ECustomerStatus.VALIDATED,
|
||||
};
|
||||
|
||||
export const customer2_mock: Customer = {
|
||||
uid: "yregrgetergrt",
|
||||
contact: contact2,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
status: ECustomerStatus.VALIDATED,
|
||||
};
|
||||
|
||||
export const folder: OfficeFolder = {
|
||||
uid: "mkovrijvrezviev",
|
||||
folder_number: "12331",
|
||||
@ -108,7 +117,7 @@ export const folder: OfficeFolder = {
|
||||
|
||||
export const document: Document = {
|
||||
uid: "fzeafergreztyzgrf",
|
||||
depositor: customer,
|
||||
depositor: customer2_mock,
|
||||
document_status: "ASKED",
|
||||
folder: folder,
|
||||
document_type: docType,
|
||||
@ -144,7 +153,7 @@ export const identityFile: File = {
|
||||
|
||||
export const documentIdentity: Document = {
|
||||
uid: "ethrthbkjtrbporjbh",
|
||||
depositor: customer,
|
||||
depositor: customer2_mock,
|
||||
document_status: "PENDING",
|
||||
folder: folder,
|
||||
document_type: identityDocType,
|
||||
@ -155,7 +164,7 @@ export const documentIdentity: Document = {
|
||||
|
||||
export const documentPending: Document = {
|
||||
uid: "fzefeazdagrtetrury",
|
||||
depositor: customer,
|
||||
depositor: customer2_mock,
|
||||
document_status: "PENDING",
|
||||
folder: folder,
|
||||
document_type: docType,
|
||||
@ -166,7 +175,7 @@ export const documentPending: Document = {
|
||||
|
||||
export const documentDeposited: Document = {
|
||||
uid: "uè§u§htfgrthytrgr",
|
||||
depositor: customer,
|
||||
depositor: customer2_mock,
|
||||
document_status: "VALIDATED",
|
||||
folder: folder,
|
||||
document_type: docType,
|
||||
|
Loading…
x
Reference in New Issue
Block a user