restore archive
This commit is contained in:
parent
2bd9ee51a7
commit
b54b5a7b7e
@ -83,4 +83,8 @@
|
|||||||
stroke: var(--alerts-badge-contrast-neutral);
|
stroke: var(--alerts-badge-contrast-neutral);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.fullwidth {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ type IProps = {
|
|||||||
firstButton?: IButtonProps;
|
firstButton?: IButtonProps;
|
||||||
secondButton?: IButtonProps;
|
secondButton?: IButtonProps;
|
||||||
closeButton?: boolean;
|
closeButton?: boolean;
|
||||||
|
fullWidth?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum EAlertVariant {
|
export enum EAlertVariant {
|
||||||
@ -36,12 +37,12 @@ const variantButtonMap: Record<EAlertVariant, EButtonVariant> = {
|
|||||||
|
|
||||||
export default function Alert(props: IProps) {
|
export default function Alert(props: IProps) {
|
||||||
const { isOpen, close } = useOpenable({ defaultOpen: true });
|
const { isOpen, close } = useOpenable({ defaultOpen: true });
|
||||||
const { variant = EAlertVariant.INFO, title, description, firstButton, secondButton, closeButton, icon } = props;
|
const { variant = EAlertVariant.INFO, title, description, firstButton, secondButton, closeButton, icon, fullWidth } = props;
|
||||||
|
|
||||||
if (!isOpen) return null;
|
if (!isOpen) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(classes["root"], classes[variant])}>
|
<div className={classNames(classes["root"], classes[variant], fullWidth && classes["fullwidth"])}>
|
||||||
<span className={classes["icon"]}>{icon ?? <InformationCircleIcon />}</span>
|
<span className={classes["icon"]}>{icon ?? <InformationCircleIcon />}</span>
|
||||||
<div className={classes["content"]}>
|
<div className={classes["content"]}>
|
||||||
<div className={classes["text-container"]}>
|
<div className={classes["text-container"]}>
|
||||||
|
@ -19,6 +19,7 @@ export default function AnchoringAlertInfo(props: IProps) {
|
|||||||
onClick: onAnchor,
|
onClick: onAnchor,
|
||||||
}}
|
}}
|
||||||
variant={EAlertVariant.INFO}
|
variant={EAlertVariant.INFO}
|
||||||
|
fullWidth
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ export default function AnchoringAlertSuccess(props: IProps) {
|
|||||||
}
|
}
|
||||||
variant={EAlertVariant.SUCCESS}
|
variant={EAlertVariant.SUCCESS}
|
||||||
icon={<CheckIcon />}
|
icon={<CheckIcon />}
|
||||||
|
fullWidth
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
import Folders from "@Front/Api/LeCoffreApi/Notary/Folders/Folders";
|
||||||
|
import Alert, { EAlertVariant } from "@Front/Components/DesignSystem/Alert";
|
||||||
|
import { EButtonstyletype } from "@Front/Components/DesignSystem/Button";
|
||||||
|
import Module from "@Front/Config/Module";
|
||||||
|
import { ArchiveBoxArrowDownIcon, ArchiveBoxIcon, ArrowDownOnSquareIcon } from "@heroicons/react/24/outline";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import { useCallback } from "react";
|
||||||
|
|
||||||
|
type IProps = {
|
||||||
|
onDownloadAnchoringProof: () => void;
|
||||||
|
folderUid: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function ArchiveAlertWarning(props: IProps) {
|
||||||
|
const { onDownloadAnchoringProof, folderUid } = props;
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const restoreArchive = useCallback(() => {
|
||||||
|
Folders.getInstance()
|
||||||
|
.restore(folderUid)
|
||||||
|
.then(() => router.push(Module.getInstance().get().modules.pages.Folder.props.path))
|
||||||
|
.catch((e) => {
|
||||||
|
console.warn(e);
|
||||||
|
});
|
||||||
|
}, [folderUid, router]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Alert
|
||||||
|
title="Dossier archivé"
|
||||||
|
description="Ce dossier a été archivé et ne peut plus être modifié. Vous pouvez télécharger la preuve d'ancrage pour vos archives ou restaurer le dossier si nécessaire."
|
||||||
|
firstButton={{
|
||||||
|
children: "Télécharger la preuve d’ancrage",
|
||||||
|
styletype: EButtonstyletype.CONTAINED,
|
||||||
|
rightIcon: <ArrowDownOnSquareIcon />,
|
||||||
|
onClick: onDownloadAnchoringProof,
|
||||||
|
}}
|
||||||
|
secondButton={{
|
||||||
|
children: "Restaurer le dossier",
|
||||||
|
onClick: restoreArchive,
|
||||||
|
rightIcon: <ArchiveBoxArrowDownIcon />,
|
||||||
|
}}
|
||||||
|
variant={EAlertVariant.WARNING}
|
||||||
|
icon={<ArchiveBoxIcon />}
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
@ -18,7 +18,6 @@ export default function ArchiveModal(props: IProps) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const archive = useCallback(() => {
|
const archive = useCallback(() => {
|
||||||
if (!folderUid) return;
|
|
||||||
const description = (document.querySelector("textarea[name='archived_description']") as HTMLTextAreaElement).value ?? "";
|
const description = (document.querySelector("textarea[name='archived_description']") as HTMLTextAreaElement).value ?? "";
|
||||||
|
|
||||||
Folders.getInstance()
|
Folders.getInstance()
|
||||||
|
@ -2,6 +2,7 @@ import Folders from "@Front/Api/LeCoffreApi/Notary/Folders/Folders";
|
|||||||
import OfficeFolderAnchors from "@Front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors";
|
import OfficeFolderAnchors from "@Front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors";
|
||||||
import Loader from "@Front/Components/DesignSystem/Loader";
|
import Loader from "@Front/Components/DesignSystem/Loader";
|
||||||
import DefaultNotaryDashboard from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
import DefaultNotaryDashboard from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
||||||
|
import useOpenable from "@Front/Hooks/useOpenable";
|
||||||
import { OfficeFolder } from "le-coffre-resources/dist/Notary";
|
import { OfficeFolder } from "le-coffre-resources/dist/Notary";
|
||||||
import { EDocumentStatus } from "le-coffre-resources/dist/Notary/Document";
|
import { EDocumentStatus } from "le-coffre-resources/dist/Notary/Document";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
@ -9,15 +10,15 @@ import { useCallback, useEffect, useMemo, useState } from "react";
|
|||||||
|
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import ClientView from "./ClientView";
|
import ClientView from "./ClientView";
|
||||||
import InformationSection from "./InformationSection";
|
|
||||||
import NoClientView from "./NoClientView";
|
|
||||||
import AnchoringAlertInfo from "./elements/AnchoringAlertInfo";
|
import AnchoringAlertInfo from "./elements/AnchoringAlertInfo";
|
||||||
import AnchoringModal from "./elements/AnchoringModal";
|
|
||||||
import useOpenable from "@Front/Hooks/useOpenable";
|
|
||||||
import AnchoringAlertSuccess from "./elements/AnchoringAlertSuccess";
|
import AnchoringAlertSuccess from "./elements/AnchoringAlertSuccess";
|
||||||
|
import AnchoringModal from "./elements/AnchoringModal";
|
||||||
|
import ArchiveAlertWarning from "./elements/ArchiveAlertWarning";
|
||||||
|
import ArchiveModal from "./elements/ArchiveModal";
|
||||||
import DownloadAnchoringProofModal from "./elements/DownloadAnchoringProofModal";
|
import DownloadAnchoringProofModal from "./elements/DownloadAnchoringProofModal";
|
||||||
import RequireAnchoringModal from "./elements/RequireAnchoringModal";
|
import RequireAnchoringModal from "./elements/RequireAnchoringModal";
|
||||||
import ArchiveModal from "./elements/ArchiveModal";
|
import InformationSection from "./InformationSection";
|
||||||
|
import NoClientView from "./NoClientView";
|
||||||
|
|
||||||
export enum AnchorStatus {
|
export enum AnchorStatus {
|
||||||
"VERIFIED_ON_CHAIN" = "VERIFIED_ON_CHAIN",
|
"VERIFIED_ON_CHAIN" = "VERIFIED_ON_CHAIN",
|
||||||
@ -138,13 +139,16 @@ export default function FolderInformation(props: IProps) {
|
|||||||
{progress === 100 && anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
{progress === 100 && anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
||||||
<AnchoringAlertInfo onAnchor={anchoringModal.open} />
|
<AnchoringAlertInfo onAnchor={anchoringModal.open} />
|
||||||
)}
|
)}
|
||||||
{anchorStatus === AnchorStatus.VERIFIED_ON_CHAIN && (
|
{!isArchived && anchorStatus === AnchorStatus.VERIFIED_ON_CHAIN && (
|
||||||
<AnchoringAlertSuccess
|
<AnchoringAlertSuccess
|
||||||
onDownloadAnchoringProof={downloadAnchoringProofModal.open}
|
onDownloadAnchoringProof={downloadAnchoringProofModal.open}
|
||||||
onArchive={archiveModal.open}
|
onArchive={archiveModal.open}
|
||||||
isArchived={isArchived}
|
isArchived={isArchived}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{isArchived && folderUid && (
|
||||||
|
<ArchiveAlertWarning folderUid={folderUid} onDownloadAnchoringProof={downloadAnchoringProofModal.open} />
|
||||||
|
)}
|
||||||
{folder && !doesFolderHaveClient && <NoClientView folder={folder} anchorStatus={anchorStatus} />}
|
{folder && !doesFolderHaveClient && <NoClientView folder={folder} anchorStatus={anchorStatus} />}
|
||||||
{folder && doesFolderHaveClient && <ClientView folder={folder} anchorStatus={anchorStatus} />}
|
{folder && doesFolderHaveClient && <ClientView folder={folder} anchorStatus={anchorStatus} />}
|
||||||
{folderUid && anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
{folderUid && anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user