✨ responsive folder client view
This commit is contained in:
parent
79f965e502
commit
334313e71d
@ -16,6 +16,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";
|
|||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import DeleteAskedDocumentModal from "./DeleteAskedDocumentModal";
|
import DeleteAskedDocumentModal from "./DeleteAskedDocumentModal";
|
||||||
import DeleteSentDocumentModal from "./DeleteSentDocumentModal";
|
import DeleteSentDocumentModal from "./DeleteSentDocumentModal";
|
||||||
|
import { useMediaQuery } from "@mui/material";
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
documents: Document[];
|
documents: Document[];
|
||||||
@ -34,6 +35,8 @@ export default function DocumentTables(props: IProps) {
|
|||||||
const [documents, setDocuments] = useState<Document[]>(documentsProps);
|
const [documents, setDocuments] = useState<Document[]>(documentsProps);
|
||||||
const [documentUid, setDocumentUid] = useState<string | null>(null);
|
const [documentUid, setDocumentUid] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const isMobile = useMediaQuery("(max-width:524px)");
|
||||||
|
|
||||||
const deleteAskedDocumentModal = useOpenable();
|
const deleteAskedDocumentModal = useOpenable();
|
||||||
const deleteSentDocumentModal = useOpenable();
|
const deleteSentDocumentModal = useOpenable();
|
||||||
|
|
||||||
@ -232,11 +235,11 @@ export default function DocumentTables(props: IProps) {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<CircleProgress percentage={progress} />
|
<CircleProgress percentage={progress} />
|
||||||
</div>
|
</div>
|
||||||
{askedDocuments.length > 0 && <Table header={getHeader("Demandé le")} rows={askedDocuments} />}
|
{askedDocuments.length > 0 && <Table header={getHeader("Demandé le", isMobile)} rows={askedDocuments} />}
|
||||||
{toValidateDocuments.length > 0 && <Table header={getHeader("Déposé le")} rows={toValidateDocuments} />}
|
{toValidateDocuments.length > 0 && <Table header={getHeader("Déposé le", isMobile)} rows={toValidateDocuments} />}
|
||||||
{validatedDocuments.length > 0 && <Table header={getHeader("Validé le")} rows={validatedDocuments} />}
|
{validatedDocuments.length > 0 && <Table header={getHeader("Validé le", isMobile)} rows={validatedDocuments} />}
|
||||||
{refusedDocuments.length > 0 && <Table header={getHeader("Demandé le")} rows={refusedDocuments} />}
|
{refusedDocuments.length > 0 && <Table header={getHeader("Demandé le", isMobile)} rows={refusedDocuments} />}
|
||||||
{sentDocuments.length > 0 && <Table header={getHeader("Envoyé le")} rows={sentDocuments} />}
|
{sentDocuments.length > 0 && <Table header={getHeader("Envoyé le", isMobile)} rows={sentDocuments} />}
|
||||||
{documentUid && (
|
{documentUid && (
|
||||||
<>
|
<>
|
||||||
<DeleteAskedDocumentModal
|
<DeleteAskedDocumentModal
|
||||||
@ -257,7 +260,23 @@ export default function DocumentTables(props: IProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHeader(dateColumnTitle: string): IHead[] {
|
function getHeader(dateColumnTitle: string, isMobile: boolean): IHead[] {
|
||||||
|
if (isMobile) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
key: "document_type",
|
||||||
|
title: "Type de document",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "document_status",
|
||||||
|
title: "Statut",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "actions",
|
||||||
|
title: "Action",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
key: "document_type",
|
key: "document_type",
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
@import "@Themes/constants.scss";
|
@import "@Themes/constants.scss";
|
||||||
|
|
||||||
|
$mobile-breakpoint: 664px;
|
||||||
|
|
||||||
.root {
|
.root {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -20,11 +22,30 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--spacing-lg, 24px);
|
gap: var(--spacing-lg, 24px);
|
||||||
|
|
||||||
.client-box {
|
@media screen and (max-width: $screen-s) {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.client-box-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
gap: var(--spacing-lg, 24px);
|
gap: var(--spacing-lg, 24px);
|
||||||
|
|
||||||
|
.button-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--spacing-lg, 24px);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: $screen-s) {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: $mobile-breakpoint) {
|
||||||
|
flex-direction: column;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
|
import Folders from "@Front/Api/LeCoffreApi/Notary/Folders/Folders";
|
||||||
|
import Button, { EButtonSize, EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
||||||
import Tabs from "@Front/Components/Elements/Tabs";
|
import Tabs from "@Front/Components/Elements/Tabs";
|
||||||
|
import Module from "@Front/Config/Module";
|
||||||
|
import { DocumentIcon, UserPlusIcon } from "@heroicons/react/24/outline";
|
||||||
import Customer from "le-coffre-resources/dist/Customer";
|
import Customer from "le-coffre-resources/dist/Customer";
|
||||||
|
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
|
||||||
import { OfficeFolder } from "le-coffre-resources/dist/Notary";
|
import { OfficeFolder } from "le-coffre-resources/dist/Notary";
|
||||||
|
import Link from "next/link";
|
||||||
import { useCallback, useMemo, useState } from "react";
|
import { useCallback, useMemo, useState } from "react";
|
||||||
|
|
||||||
import { AnchorStatus } from "..";
|
import { AnchorStatus } from "..";
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import ClientBox from "./ClientBox";
|
import ClientBox from "./ClientBox";
|
||||||
import Button, { EButtonSize, EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
|
||||||
import { DocumentIcon, UserPlusIcon } from "@heroicons/react/24/outline";
|
|
||||||
import Module from "@Front/Config/Module";
|
|
||||||
import Link from "next/link";
|
|
||||||
import NoDocument from "./NoDocument";
|
|
||||||
import DocumentTables from "./DocumentTables";
|
import DocumentTables from "./DocumentTables";
|
||||||
import Folders from "@Front/Api/LeCoffreApi/Notary/Folders/Folders";
|
|
||||||
import { EDocumentStatus } from "le-coffre-resources/dist/Customer/Document";
|
|
||||||
import EmailReminder from "./EmailReminder";
|
import EmailReminder from "./EmailReminder";
|
||||||
|
import NoDocument from "./NoDocument";
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
folder: OfficeFolder;
|
folder: OfficeFolder;
|
||||||
@ -96,7 +95,7 @@ export default function ClientView(props: IProps) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={classes["content"]}>
|
<div className={classes["content"]}>
|
||||||
<div className={classes["client-box"]}>
|
<div className={classes["client-box-container"]}>
|
||||||
<ClientBox
|
<ClientBox
|
||||||
customer={customer}
|
customer={customer}
|
||||||
anchorStatus={anchorStatus}
|
anchorStatus={anchorStatus}
|
||||||
@ -104,19 +103,22 @@ export default function ClientView(props: IProps) {
|
|||||||
onDelete={handleClientDelete}
|
onDelete={handleClientDelete}
|
||||||
customerNote={folder.notes!.find((value) => value.customer?.uid === customer.uid) ?? null}
|
customerNote={folder.notes!.find((value) => value.customer?.uid === customer.uid) ?? null}
|
||||||
/>
|
/>
|
||||||
{anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
<div className={classes["button-container"]}>
|
||||||
<Link
|
{anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
||||||
href={Module.getInstance()
|
<Link
|
||||||
.get()
|
href={Module.getInstance()
|
||||||
.modules.pages.Folder.pages.AskDocument.props.path.replace("[folderUid]", folder.uid ?? "")
|
.get()
|
||||||
.replace("[customerUid]", customer.uid ?? "")}>
|
.modules.pages.Folder.pages.AskDocument.props.path.replace("[folderUid]", folder.uid ?? "")
|
||||||
<Button rightIcon={<DocumentIcon />} variant={EButtonVariant.PRIMARY} fullwidth>
|
.replace("[customerUid]", customer.uid ?? "")}>
|
||||||
Demander un document
|
<Button rightIcon={<DocumentIcon />} variant={EButtonVariant.PRIMARY} fullwidth>
|
||||||
</Button>
|
Demander un document
|
||||||
</Link>
|
</Button>
|
||||||
)}
|
</Link>
|
||||||
<EmailReminder customer={customer} />
|
)}
|
||||||
|
<EmailReminder customer={customer} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{doesCustomerHaveDocument ? (
|
{doesCustomerHaveDocument ? (
|
||||||
<DocumentTables documents={customer.documents ?? []} folderUid={folder?.uid ?? ""} />
|
<DocumentTables documents={customer.documents ?? []} folderUid={folder?.uid ?? ""} />
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user