Client note showing

This commit is contained in:
Maxime Lalo 2024-07-23 11:57:28 +02:00
parent 26d217b6ae
commit c0025e6116
2 changed files with 11 additions and 3 deletions

View File

@ -11,16 +11,18 @@ import DeleteCustomerModal from "./DeleteCustomerModal";
import Link from "next/link";
import Module from "@Front/Config/Module";
import { useCallback } from "react";
import { Note } from "le-coffre-resources/dist/Customer";
type IProps = {
customer: ICustomer;
anchorStatus: AnchorStatus;
folderUid: string | undefined;
customerNote: Note | null;
onDelete: (customerUid: string) => void;
};
export default function ClientBox(props: IProps) {
const { customer, anchorStatus, folderUid } = props;
const { customer, anchorStatus, folderUid, customerNote } = props;
const { isOpen, open, close } = useOpenable();
@ -68,7 +70,7 @@ export default function ClientBox(props: IProps) {
Note client
</Typography>
<Typography typo={ETypo.TEXT_LG_REGULAR} color={ETypoColor.COLOR_NEUTRAL_950}>
{customer.notes?.[0]?.content ?? "_"}
{customerNote?.content ?? "-"}
</Typography>
</div>

View File

@ -85,7 +85,13 @@ export default function ClientView(props: IProps) {
</div>
<div className={classes["content"]}>
<div className={classes["client-box"]}>
<ClientBox customer={customer} anchorStatus={anchorStatus} folderUid={folder.uid} onDelete={handleClientDelete} />
<ClientBox
customer={customer}
anchorStatus={anchorStatus}
folderUid={folder.uid}
onDelete={handleClientDelete}
customerNote={folder.notes!.find((value) => value.customer?.uid === customer.uid) ?? null}
/>
{anchorStatus === AnchorStatus.NOT_ANCHORED && (
<Link
href={Module.getInstance()