Merge Dev in Staging
This commit is contained in:
commit
f03de33e74
@ -24,7 +24,7 @@
|
||||
"eslint-config-next": "13.2.4",
|
||||
"form-data": "^4.0.0",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.89",
|
||||
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.90",
|
||||
"next": "13.2.4",
|
||||
"prettier": "^2.8.7",
|
||||
"react": "18.2.0",
|
||||
|
@ -27,7 +27,6 @@ export default class User extends BaseApiService {
|
||||
}
|
||||
|
||||
public async verifyJwt(jwt: string) {
|
||||
console.log(this.baseURl);
|
||||
const url = new URL(`${this.baseURl}/verify-token/${jwt}`);
|
||||
try {
|
||||
return await this.postRequest(url);
|
||||
|
@ -16,7 +16,6 @@ export default class Auth extends BaseApiService {
|
||||
public async logOutWithIdNot() {
|
||||
const variables = FrontendVariables.getInstance();
|
||||
const url = new URL(`${variables.IDNOT_BASE_URL}/user/auth/logout?post_logout_redirect_uri=${variables.FRONT_APP_HOST}`);
|
||||
console.log(url.toString())
|
||||
try {
|
||||
return await fetch(url);
|
||||
} catch (err) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { type OfficeFolder } from "le-coffre-resources/dist/Notary";
|
||||
|
||||
import BaseNotary from "../BaseNotary";
|
||||
import EFolderStatus from "le-coffre-resources/dist/Customer/EFolderStatus";
|
||||
|
||||
// TODO Type get query params -> Where + inclue + orderby
|
||||
export interface IGetFoldersParams {
|
||||
@ -97,20 +96,32 @@ export default class Folders extends BaseNotary {
|
||||
}
|
||||
}
|
||||
|
||||
public async archive(uid: string, body: Partial<OfficeFolder>): Promise<OfficeFolder> {
|
||||
body.status = EFolderStatus.ARCHIVED;
|
||||
public async archive(uid: string, archived_description: string): Promise<OfficeFolder> {
|
||||
try {
|
||||
return await this.put(uid, body);
|
||||
const url = new URL(this.baseURl.concat(`/${uid}/archive`));
|
||||
try {
|
||||
return await this.putRequest(url, {
|
||||
archived_description,
|
||||
});
|
||||
} catch (err) {
|
||||
this.onError(err);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
} catch (err) {
|
||||
this.onError(err);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
}
|
||||
|
||||
public async restore(uid: string, body: Partial<OfficeFolder>): Promise<OfficeFolder> {
|
||||
body.status = EFolderStatus.LIVE;
|
||||
public async restore(uid: string): Promise<OfficeFolder> {
|
||||
try {
|
||||
return await this.put(uid, body);
|
||||
const url = new URL(this.baseURl.concat(`/${uid}/restore`));
|
||||
try {
|
||||
return await this.putRequest(url);
|
||||
} catch (err) {
|
||||
this.onError(err);
|
||||
return Promise.reject(err);
|
||||
}
|
||||
} catch (err) {
|
||||
this.onError(err);
|
||||
return Promise.reject(err);
|
||||
|
@ -121,7 +121,6 @@ export default class DepositOtherDocument extends React.Component<IProps, IState
|
||||
{this.state.currentFiles && this.state.currentFiles.length > 0 && (
|
||||
<div className={classes["documents-container"]}>
|
||||
{this.state.currentFiles.map((file) => {
|
||||
console.log(file);
|
||||
|
||||
const fileObj = file.file;
|
||||
|
||||
@ -237,9 +236,6 @@ export default class DepositOtherDocument extends React.Component<IProps, IState
|
||||
this.setState({
|
||||
currentFiles: tmpArray,
|
||||
});
|
||||
|
||||
console.log(this.state.currentFiles);
|
||||
|
||||
// const formData = new FormData();
|
||||
// formData.append("file", file, file.name);
|
||||
// const query = JSON.stringify({ document: { uid: this.props.document.uid } });
|
||||
@ -272,7 +268,6 @@ export default class DepositOtherDocument extends React.Component<IProps, IState
|
||||
private async removeFile(e: any) {
|
||||
const image = e.target as HTMLElement;
|
||||
const indexToRemove = image.getAttribute("data-file");
|
||||
console.log(indexToRemove);
|
||||
|
||||
if (!indexToRemove) return;
|
||||
const file = this.state.currentFiles!.find((file) => file.index === parseInt(indexToRemove));
|
||||
|
@ -8,11 +8,13 @@ import React from "react";
|
||||
|
||||
import Typography, { ITypo } from "../Typography";
|
||||
import classes from "./classes.module.scss";
|
||||
import { AnchorStatus } from "@Front/Components/Layouts/Folder/FolderInformation";
|
||||
|
||||
type IProps = {
|
||||
folder: OfficeFolder;
|
||||
type: EFolderBoxInformationType;
|
||||
isArchived?: boolean;
|
||||
anchorStatus: AnchorStatus;
|
||||
};
|
||||
|
||||
export enum EFolderBoxInformationType {
|
||||
@ -34,7 +36,7 @@ export default function FolderBoxInformation(props: IProps) {
|
||||
return (
|
||||
<div className={classNames(classes["root"], type !== EFolderBoxInformationType.INFORMATIONS && classes["single-information"])}>
|
||||
<div className={classes["content"]}>{renderContentByType(props.folder, type)}</div>
|
||||
{!isArchived && (
|
||||
{!isArchived && props.anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
||||
<Link href={path} className={classes["edit-icon-container"]}>
|
||||
<Image src={PenICon} alt="edit informations" />
|
||||
</Link>
|
||||
|
@ -16,6 +16,7 @@ import QuantityProgressBar from "../QuantityProgressBar";
|
||||
import classes from "./classes.module.scss";
|
||||
import DocumentList from "./DocumentList";
|
||||
import UserFolderHeader from "./UserFolderHeader";
|
||||
import { AnchorStatus } from "@Front/Components/Layouts/Folder/FolderInformation";
|
||||
|
||||
type IProps = {
|
||||
customer: Customer;
|
||||
@ -24,6 +25,7 @@ type IProps = {
|
||||
isArchived?: boolean;
|
||||
isOpened: boolean;
|
||||
onChange: (id: string) => void;
|
||||
anchorStatus: AnchorStatus;
|
||||
};
|
||||
type IState = {
|
||||
isOpenDeletionModal: boolean;
|
||||
@ -89,6 +91,7 @@ export default class UserFolder extends React.Component<IProps, IState> {
|
||||
currentNumber={this.calculateDocumentsPercentageProgress()}
|
||||
/>
|
||||
<div className={classes["content"]}>
|
||||
{this.props.anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
||||
<DocumentList
|
||||
documents={documentsAsked}
|
||||
title="Documents demandés"
|
||||
@ -96,18 +99,27 @@ export default class UserFolder extends React.Component<IProps, IState> {
|
||||
folderUid={this.props.folder.uid!}
|
||||
className={classes["documents-asked"]}
|
||||
/>
|
||||
)}
|
||||
|
||||
<DocumentList
|
||||
documents={otherDocuments}
|
||||
title="Documents à valider / validés"
|
||||
title={
|
||||
this.props.anchorStatus !== AnchorStatus.NOT_ANCHORED
|
||||
? "Documents validés"
|
||||
: "Documents à valider / validés"
|
||||
}
|
||||
subtitle={
|
||||
otherDocuments && otherDocuments?.length > 0
|
||||
? "Vous avez des documents à valider."
|
||||
? this.props.anchorStatus !== AnchorStatus.NOT_ANCHORED
|
||||
? ""
|
||||
: "Vous avez des documents à valider."
|
||||
: "Vous n'avez aucun document à valider"
|
||||
}
|
||||
openDeletionModal={this.openDeletionModal}
|
||||
folderUid={this.props.folder.uid!}
|
||||
/>
|
||||
{!this.props.isArchived && (
|
||||
|
||||
{!this.props.isArchived && this.props.anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
||||
<div className={classes["button-container"]}>
|
||||
<Link href={redirectPath}>
|
||||
<Button variant={EButtonVariant.LINE} icon={PlusIcon}>
|
||||
|
@ -8,9 +8,11 @@ import Link from "next/link";
|
||||
import React from "react";
|
||||
|
||||
import classes from "./classes.module.scss";
|
||||
import { AnchorStatus } from "..";
|
||||
|
||||
type IProps = {
|
||||
folder: OfficeFolder;
|
||||
anchorStatus: AnchorStatus;
|
||||
};
|
||||
type IState = {
|
||||
openedCustomer: string;
|
||||
@ -35,11 +37,13 @@ export default class ClientSection extends React.Component<IProps, IState> {
|
||||
{this.doesFolderHaveCustomer() ? (
|
||||
<>
|
||||
<div className={classes["client"]}>{this.renderCustomerFolders()}</div>
|
||||
{this.props.anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
||||
<Link href={navigatePath}>
|
||||
<Button variant={EButtonVariant.LINE} icon={PlusIcon}>
|
||||
Ajouter un client
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<div className={classes["no-client"]}>
|
||||
@ -48,11 +52,13 @@ export default class ClientSection extends React.Component<IProps, IState> {
|
||||
Aucun client n'est associé au dossier.
|
||||
</Typography>
|
||||
</div>
|
||||
{this.props.anchorStatus === AnchorStatus.NOT_ANCHORED && (
|
||||
<Link href={navigatePath}>
|
||||
<Button variant={EButtonVariant.LINE} icon={PlusIcon}>
|
||||
Ajouter un client
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@ -69,6 +75,7 @@ export default class ClientSection extends React.Component<IProps, IState> {
|
||||
key={customer.uid}
|
||||
isOpened={this.state.openedCustomer === customer.uid}
|
||||
onChange={this.changeUserFolder}
|
||||
anchorStatus={this.props.anchorStatus}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
@ -23,7 +23,7 @@ import ClientSection from "./ClientSection";
|
||||
import CheckBox from "@Front/Components/DesignSystem/CheckBox";
|
||||
import Loader from "@Front/Components/DesignSystem/Loader";
|
||||
|
||||
enum AnchorStatus {
|
||||
export enum AnchorStatus {
|
||||
"VERIFIED_ON_CHAIN" = "VERIFIED_ON_CHAIN",
|
||||
"ANCHORING" = "ANCHORING",
|
||||
"NOT_ANCHORED" = "NOT_ANCHORED",
|
||||
@ -97,11 +97,13 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
</Link>
|
||||
</div>
|
||||
<FolderBoxInformation
|
||||
anchorStatus={this.props.isAnchored}
|
||||
folder={this.props.selectedFolder}
|
||||
type={EFolderBoxInformationType.INFORMATIONS}
|
||||
/>
|
||||
<div className={classes["second-box"]}>
|
||||
<FolderBoxInformation
|
||||
anchorStatus={this.props.isAnchored}
|
||||
folder={this.props.selectedFolder}
|
||||
type={EFolderBoxInformationType.DESCRIPTION}
|
||||
/>
|
||||
@ -113,10 +115,14 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
currentNumber={this.getCompletionNumber()}
|
||||
/>
|
||||
</div>
|
||||
{this.doesFolderHaveCustomer() && <ClientSection folder={this.props.selectedFolder} />}
|
||||
{this.doesFolderHaveCustomer() && (
|
||||
<ClientSection folder={this.props.selectedFolder} anchorStatus={this.props.isAnchored} />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{!this.doesFolderHaveCustomer() && <ClientSection folder={this.props.selectedFolder} />}
|
||||
{!this.doesFolderHaveCustomer() && (
|
||||
<ClientSection folder={this.props.selectedFolder} anchorStatus={this.props.isAnchored} />
|
||||
)}
|
||||
|
||||
<div className={classes["button-container"]}>
|
||||
<Button variant={EButtonVariant.GHOST} onClick={this.openArchivedModal}>
|
||||
@ -389,9 +395,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
|
||||
private async onArchivedModalAccepted() {
|
||||
if (!this.props.selectedFolder) return;
|
||||
const ressourceFolder = OfficeFolder.hydrate<OfficeFolder>(this.props.selectedFolder);
|
||||
ressourceFolder.archived_description = this.state.inputArchivedDescripton;
|
||||
await Folders.getInstance().archive(this.props.selectedFolder.uid ?? "", ressourceFolder);
|
||||
await Folders.getInstance().archive(this.props.selectedFolder.uid ?? "", this.state.inputArchivedDescripton);
|
||||
this.closeArchivedModal();
|
||||
this.props.router.push(Module.getInstance().get().modules.pages.Folder.props.path);
|
||||
}
|
||||
|
@ -3,9 +3,11 @@ import classes from "./classes.module.scss";
|
||||
import { OfficeFolder } from "le-coffre-resources/dist/Notary";
|
||||
import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography";
|
||||
import UserFolder from "@Front/Components/DesignSystem/UserFolder";
|
||||
import { AnchorStatus } from "@Front/Components/Layouts/Folder/FolderInformation";
|
||||
|
||||
type IProps = {
|
||||
folder: OfficeFolder;
|
||||
anchorStatus: AnchorStatus;
|
||||
};
|
||||
type IState = {
|
||||
openedCustomer: string;
|
||||
@ -49,6 +51,7 @@ export default class ClientSection extends React.Component<IProps, IState> {
|
||||
key={customer.uid}
|
||||
isOpened={this.state.openedCustomer === customer.uid}
|
||||
onChange={this.changeUserFolder}
|
||||
anchorStatus={this.props.anchorStatus}
|
||||
isArchived
|
||||
/>
|
||||
);
|
||||
|
@ -87,3 +87,15 @@
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.loader-container {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
.loader {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
@ -13,12 +13,18 @@ import BasePage from "../../Base";
|
||||
import classes from "./classes.module.scss";
|
||||
import ClientSection from "./ClientSection";
|
||||
import Link from "next/link";
|
||||
import { AnchorStatus } from "../../Folder/FolderInformation";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import OfficeFolderAnchors from "@Front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors";
|
||||
import Loader from "@Front/Components/DesignSystem/Loader";
|
||||
|
||||
type IProps = {};
|
||||
|
||||
type IPropsClass = IProps & {
|
||||
router: NextRouter;
|
||||
selectedFolderUid: string;
|
||||
isLoading: boolean;
|
||||
isAnchored: AnchorStatus;
|
||||
};
|
||||
|
||||
type IState = {
|
||||
@ -46,6 +52,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
.modules.pages.Folder.pages.EditCollaborators.props.path.replace("[folderUid]", this.props.selectedFolderUid);
|
||||
return (
|
||||
<DefaultNotaryDashboard title={"Dossier"} onSelectedFolder={this.onSelectedFolder} isArchived={true}>
|
||||
{!this.props.isLoading && (
|
||||
<div className={classes["root"]}>
|
||||
{this.state.selectedFolder ? (
|
||||
<div className={classes["folder-informations"]}>
|
||||
@ -61,12 +68,14 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
</Link>
|
||||
</div>
|
||||
<FolderBoxInformation
|
||||
anchorStatus={this.props.isAnchored}
|
||||
folder={this.state.selectedFolder}
|
||||
isArchived
|
||||
type={EFolderBoxInformationType.INFORMATIONS}
|
||||
/>
|
||||
<div className={classes["second-box"]}>
|
||||
<FolderBoxInformation
|
||||
anchorStatus={this.props.isAnchored}
|
||||
folder={this.state.selectedFolder}
|
||||
isArchived
|
||||
type={EFolderBoxInformationType.DESCRIPTION}
|
||||
@ -74,6 +83,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
</div>
|
||||
<div className={classes["second-box"]}>
|
||||
<FolderBoxInformation
|
||||
anchorStatus={this.props.isAnchored}
|
||||
folder={this.state.selectedFolder}
|
||||
isArchived
|
||||
type={EFolderBoxInformationType.ARCHIVED_DESCRIPTION}
|
||||
@ -83,10 +93,10 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
<div className={classes["progress-bar"]}>
|
||||
<QuantityProgressBar title="Complétion du dossier" total={100} currentNumber={0} />
|
||||
</div>
|
||||
{this.doesFolderHaveCustomer() && <ClientSection folder={this.state.selectedFolder} />}
|
||||
{this.doesFolderHaveCustomer() && <ClientSection folder={this.state.selectedFolder} anchorStatus={this.props.isAnchored} />}
|
||||
</div>
|
||||
|
||||
{!this.doesFolderHaveCustomer() && <ClientSection folder={this.state.selectedFolder} />}
|
||||
{!this.doesFolderHaveCustomer() && <ClientSection folder={this.state.selectedFolder} anchorStatus={this.props.isAnchored} />}
|
||||
|
||||
<div className={classes["button-container"]}>
|
||||
<Button variant={EButtonVariant.GHOST} onClick={this.restoreFolder}>
|
||||
@ -105,6 +115,14 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{this.props.isLoading && (
|
||||
<div className={classes["loader-container"]}>
|
||||
<div className={classes["loader"]}>
|
||||
<Loader />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</DefaultNotaryDashboard>
|
||||
);
|
||||
}
|
||||
@ -123,9 +141,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
|
||||
private async restoreFolder() {
|
||||
if (!this.state.selectedFolder) return;
|
||||
const ressourceFolder = OfficeFolder.hydrate<OfficeFolder>(this.state.selectedFolder);
|
||||
ressourceFolder.archived_description = null;
|
||||
await Folders.getInstance().restore(this.state.selectedFolder.uid ?? "", ressourceFolder);
|
||||
await Folders.getInstance().restore(this.state.selectedFolder.uid ?? "");
|
||||
this.props.router.push(
|
||||
Module.getInstance()
|
||||
.get()
|
||||
@ -156,7 +172,69 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
|
||||
export default function FolderInformation(props: IProps) {
|
||||
const router = useRouter();
|
||||
const [isAnchored, setIsAnchored] = useState<AnchorStatus>(AnchorStatus.NOT_ANCHORED);
|
||||
const [isLoading, setIsLoading] = useState<boolean>(true);
|
||||
const [selectedFolder, setSelectedFolder] = useState<OfficeFolder | null>(null);
|
||||
|
||||
let { folderUid } = router.query;
|
||||
folderUid = folderUid as string;
|
||||
return <FolderInformationClass {...props} selectedFolderUid={folderUid} router={router} />;
|
||||
|
||||
const getAnchoringStatus = useCallback(async () => {
|
||||
if(!folderUid) return;
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const anchorStatus = await OfficeFolderAnchors.getInstance().getByUid(folderUid as string);
|
||||
setIsAnchored(anchorStatus.status === "VERIFIED_ON_CHAIN" ? AnchorStatus.VERIFIED_ON_CHAIN : AnchorStatus.ANCHORING);
|
||||
} catch (e) {
|
||||
setIsAnchored(AnchorStatus.NOT_ANCHORED);
|
||||
}
|
||||
setIsLoading(false);
|
||||
}, [folderUid]);
|
||||
|
||||
const getFolder = useCallback(async () => {
|
||||
if (!folderUid) return;
|
||||
setIsLoading(true);
|
||||
const query = {
|
||||
q: {
|
||||
deed: { include: { deed_type: true } },
|
||||
office: true,
|
||||
customers: {
|
||||
include: {
|
||||
contact: true,
|
||||
documents: {
|
||||
include: {
|
||||
folder: true,
|
||||
document_type: true,
|
||||
files: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
documents: {
|
||||
include: {
|
||||
depositor: {
|
||||
include: {
|
||||
contact: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
folder_anchor: true,
|
||||
},
|
||||
};
|
||||
const folder = await Folders.getInstance().getByUid(folderUid as string, query);
|
||||
if (folder) {
|
||||
setSelectedFolder(folder);
|
||||
getAnchoringStatus();
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
}, [folderUid, getAnchoringStatus]);
|
||||
|
||||
useEffect(() => {
|
||||
setIsLoading(true);
|
||||
getFolder();
|
||||
}, [getFolder]);
|
||||
|
||||
return <FolderInformationClass {...props} selectedFolderUid={folderUid} router={router} isLoading={isLoading} isAnchored={isAnchored} />;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ export default function LoginCallBack() {
|
||||
if (!code) return;
|
||||
try {
|
||||
const token = await Auth.getInstance().getIdnotJwt(code as string);
|
||||
if (!token) return router.push(Module.getInstance().get().modules.pages.Login.props.path);
|
||||
await UserStore.instance.connect(token.accessToken, token.refreshToken);
|
||||
return router.push(Module.getInstance().get().modules.pages.Folder.props.path);
|
||||
} catch (e) {
|
||||
|
@ -165,7 +165,7 @@ export default function UserInformations(props: IProps) {
|
||||
let vote = Vote.hydrate<Vote>({
|
||||
appointment: Appointment.hydrate<Appointment>({
|
||||
uid: currentAppointment?.uid ?? undefined,
|
||||
targeted_user: User.hydrate<User>({
|
||||
user: User.hydrate<User>({
|
||||
uid: userSelected.uid,
|
||||
}),
|
||||
choice: superAdminModalType === "add" ? EVote.NOMINATE : EVote.DISMISS,
|
||||
|
Loading…
x
Reference in New Issue
Block a user