diff --git a/next.config.js b/next.config.js index 4a45c7f6..91addf51 100644 --- a/next.config.js +++ b/next.config.js @@ -4,14 +4,14 @@ const nextConfig = { reactStrictMode: false, publicRuntimeConfig: { // Will be available on both server and client - BACK_API_PROTOCOL: process.env.NEXT_PUBLIC_BACK_API_PROTOCOL, - BACK_API_HOST: process.env.NEXT_PUBLIC_BACK_API_HOST, - BACK_API_ROOT_URL: process.env.NEXT_PUBLIC_BACK_API_ROOT_URL, - BACK_API_VERSION: process.env.NEXT_PUBLIC_BACK_API_VERSION, - FRONT_APP_HOST: process.env.NEXT_PUBLIC_FRONT_APP_HOST, - FRONT_APP_PORT: process.env.NEXT_PUBLIC_FRONT_APP_PORT, - IDNOT_AUTHORIZE_ENDPOINT: process.env.NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT, - IDNOT_CLIENT_ID: process.env.NEXT_PUBLIC_IDNOT_CLIENT_ID, + NEXT_PUBLIC_BACK_API_PROTOCOL: process.env.NEXT_PUBLIC_BACK_API_PROTOCOL, + NEXT_PUBLIC_BACK_API_HOST: process.env.NEXT_PUBLIC_BACK_API_HOST, + NEXT_PUBLIC_BACK_API_ROOT_URL: process.env.NEXT_PUBLIC_BACK_API_ROOT_URL, + NEXT_PUBLIC_BACK_API_VERSION: process.env.NEXT_PUBLIC_BACK_API_VERSION, + NEXT_PUBLIC_FRONT_APP_HOST: process.env.NEXT_PUBLIC_FRONT_APP_HOST, + NEXT_PUBLIC_FRONT_APP_PORT: process.env.NEXT_PUBLIC_FRONT_APP_PORT, + NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT: process.env.NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT, + NEXT_PUBLIC_IDNOT_CLIENT_ID: process.env.NEXT_PUBLIC_IDNOT_CLIENT_ID, }, }; diff --git a/package.json b/package.json index 9ebaabbc..715455ab 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next build && next dev", + "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint", diff --git a/src/front/Assets/images/404-background-image.jpeg b/src/front/Assets/images/404-background-image.jpeg new file mode 100644 index 00000000..bc4c9fe6 Binary files /dev/null and b/src/front/Assets/images/404-background-image.jpeg differ diff --git a/src/front/Components/DesignSystem/DepositDocument/index.tsx b/src/front/Components/DesignSystem/DepositDocument/index.tsx index 2a85bbfa..aac4c284 100644 --- a/src/front/Components/DesignSystem/DepositDocument/index.tsx +++ b/src/front/Components/DesignSystem/DepositDocument/index.tsx @@ -69,6 +69,7 @@ export default class DepositDocument extends React.Component { } public override render(): JSX.Element { + console.log("Loading :", this.state.loading); return (
{ } private async onDragDrop(event: React.DragEvent) { + this.setState({ + loading: true, + }); event.preventDefault(); this.setState({ isDragOver: false, }); const file = event.dataTransfer.files[0]; if (file) this.addFile(file); + else this.setState({ loading: false }); } private async addFile(file: File) { @@ -294,9 +299,7 @@ export default class DepositDocument extends React.Component { formData.append("file", file, file.name); const query = JSON.stringify({ document: { uid: this.props.document.uid } }); formData.append("q", query); - this.setState({ - loading: true, - }); + const newFile = await Files.getInstance().post(formData); const files = this.state.currentFiles ? [...this.state.currentFiles, newFile] : [newFile]; @@ -334,11 +337,18 @@ export default class DepositDocument extends React.Component { private async onFileChange() { if (!this.inputRef.current) return; + this.setState({ + loading: true, + }); const files = this.inputRef.current.files; - if (!files) return; + if (!files) { + this.setState({ loading: false }); + return; + } const file = files[0]; if (file) this.addFile(file); + else this.setState({ loading: false }); } private addDocument() { diff --git a/src/front/Components/DesignSystem/FilePreview/classes.module.scss b/src/front/Components/DesignSystem/FilePreview/classes.module.scss index b359b71f..b240b483 100644 --- a/src/front/Components/DesignSystem/FilePreview/classes.module.scss +++ b/src/front/Components/DesignSystem/FilePreview/classes.module.scss @@ -1,9 +1,12 @@ .root { height: inherit; min-height: inherit; + position: relative; + .file-container { height: inherit; min-height: inherit; + .image { width: 100%; height: inherit; @@ -17,4 +20,15 @@ height: inherit; } } -} + + .loader { + width: 48px; + height: 48px; + z-index: -1; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } + +} \ No newline at end of file diff --git a/src/front/Components/DesignSystem/FilePreview/index.tsx b/src/front/Components/DesignSystem/FilePreview/index.tsx index abc4f51b..d7e6f794 100644 --- a/src/front/Components/DesignSystem/FilePreview/index.tsx +++ b/src/front/Components/DesignSystem/FilePreview/index.tsx @@ -2,6 +2,7 @@ import React from "react"; import Typography, { ITypo, ITypoColor } from "../Typography"; import classes from "./classes.module.scss"; +import Loader from "../Loader"; type IProps = { href: string; @@ -12,20 +13,24 @@ type IState = {}; export default class FilePreview extends React.Component { override render() { let type = this.props.href.split(".").pop(); - if(this.props.fileName) type = this.props.fileName.split(".").pop(); + if (this.props.fileName) type = this.props.fileName.split(".").pop(); return (
+
+ +
+ {!type && ( Erreur lors du chargement du fichier )}
- {type?.toLowerCase() === "pdf" && ( - - )} - {type?.toLowerCase() !== "pdf" && File preview} -
+ {type?.toLowerCase() === "pdf" && ( + + )} + {type?.toLowerCase() !== "pdf" && File preview} +
); } diff --git a/src/front/Components/Elements/InputField/classes.module.scss b/src/front/Components/Elements/InputField/classes.module.scss deleted file mode 100644 index 923bc81b..00000000 --- a/src/front/Components/Elements/InputField/classes.module.scss +++ /dev/null @@ -1,122 +0,0 @@ -@import "@Themes/constants.scss"; -@import "@Themes/animation.scss"; - -.root { - padding: 15px 0; - width: 100%; - height: 100%; - will-change: transform, opacity; - animation: fadeInFromLeft 500ms; - - > h1 { - margin-top: 0; - } - - button { - margin-top: 10px; - } - - .component { - width: 100%; - display: block; - position: relative; - height: 40px; - padding: 12px 16px 12px 40px; - border-width: 1px; - border-style: solid; - border-color: $borderColor; - border-radius: 4px; - transition: border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out; - will-change: border-color, box-shadow; - background-color: $backgroundColor; - - &:hover { - border-color: $primaryColor; - } - - &:focus { - box-shadow: 0 0 0 2px $primaryColor; - border-color: $primaryColor; - } - - &.error { - border-color: $downColor; - - &:focus { - box-shadow: 0 0 0 2px rgba(237, 29, 37, 0.1); - } - } - - &.success { - border-color: $upColor; - - &:focus { - box-shadow: 0 0 0 2px rgba(0, 201, 167, 0.1); - } - } - } - - @keyframes zoomIn { - from { - transform: scale(0.2); - opacity: 0; - } - - to { - transform: scale(1); - opacity: 1; - } - } - - .status { - display: block; - position: absolute; - top: 50%; - right: 10px; - z-index: 1; - width: 20px; - height: 20px; - margin-top: -10px; - font-size: 14px; - line-height: 20px; - text-align: center; - visibility: visible; - pointer-events: none; - will-change: transform, opacity; - - &.error { - animation: zoomIn 0.3s cubic-bezier(0.12, 0.4, 0.29, 1.46); - } - - &.success { - animation: zoomIn 0.3s cubic-bezier(0.12, 0.4, 0.29, 1.46); - } - } - - .icon { - display: block; - position: absolute; - top: 50%; - left: 10px; - z-index: 1; - width: 20px; - height: 20px; - margin-top: -10px; - font-size: 14px; - line-height: 20px; - text-align: center; - visibility: visible; - pointer-events: none; - } -} - -.errorMsg { - color: $downColor; - margin: -15px 0 15px 0; - line-height: 24px; - will-change: transform, opacity; - animation: slideDown 0.3s cubic-bezier(0.12, 0.4, 0.29, 1.46); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} diff --git a/src/front/Components/Elements/InputField/index.tsx b/src/front/Components/Elements/InputField/index.tsx deleted file mode 100644 index 39f443af..00000000 --- a/src/front/Components/Elements/InputField/index.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import React, { RefObject } from "react"; -import classes from "./classes.module.scss"; -import classNames from "classnames"; -import Image from "next/image"; -import ErrorIcon from "@Assets/Icons/input-error.svg"; -import SuccessIcon from "@Assets/Icons/input-success.svg"; - -type IProps = { - inputRef?: RefObject; - icon?: string; - placeholder?: string; - name?: string; - value?: string; - onChange: any; - onBlur?: any; - inputStatus: "success" | "error" | "neutral"; - errorMsg?: string; - type: string; -}; - -export default class InputField extends React.Component { - public constructor(props: IProps) { - super(props); - } - public override render(): JSX.Element { - return ( - <> -
- {this.props.icon && {this.props.icon}} - -
- {this.props.inputStatus === "success" && success icon} - {this.props.inputStatus === "error" && error icon} -
-
- {this.props.errorMsg &&
{this.props.errorMsg}
} - - ); - } -} diff --git a/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/index.tsx b/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/index.tsx index e76a0821..033d8643 100644 --- a/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultDoubleSidePage/index.tsx @@ -40,7 +40,7 @@ export default class DefaultDoubleSidePage extends React.Component - {"right + {"right
)} diff --git a/src/front/Components/Layouts/Folder/AskDocuments/index.tsx b/src/front/Components/Layouts/Folder/AskDocuments/index.tsx index 6131e875..efd7ad66 100644 --- a/src/front/Components/Layouts/Folder/AskDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/AskDocuments/index.tsx @@ -275,7 +275,7 @@ class AskDocumentsClass extends BasePage { ) { try { const documentAsked: [] = values["document_types"] as []; - await documentAsked.forEach(async (document) => { + for(let i = 0; i < documentAsked.length; i++){ await Documents.getInstance().post({ folder: { uid: this.props.folderUid, @@ -284,11 +284,11 @@ class AskDocumentsClass extends BasePage { uid: this.props.customerUid, }, document_type: { - uid: document, + uid: documentAsked[i], }, }); - }); - + } + this.props.router.push( Module.getInstance() .get() diff --git a/src/front/Components/Layouts/Folder/CreateFolder/background-image.jpeg b/src/front/Components/Layouts/Folder/CreateFolder/background-image.jpeg deleted file mode 100644 index 5e9b36e1..00000000 Binary files a/src/front/Components/Layouts/Folder/CreateFolder/background-image.jpeg and /dev/null differ diff --git a/src/front/Components/Layouts/Folder/CreateFolder/index.tsx b/src/front/Components/Layouts/Folder/CreateFolder/index.tsx index 353784fc..9403e299 100644 --- a/src/front/Components/Layouts/Folder/CreateFolder/index.tsx +++ b/src/front/Components/Layouts/Folder/CreateFolder/index.tsx @@ -18,7 +18,7 @@ import Users from "@Front/Api/LeCoffreApi/SuperAdmin/Users/Users"; import User from "le-coffre-resources/dist/Notary"; import Folders, { IPostFoldersParams } from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders"; import { NextRouter, useRouter } from "next/router"; -import BackgroundImage from "./background-image.jpeg"; +import backgroundImage from "@Assets/images/404-background-image.jpeg"; type IFormValues = { folder_number: string; @@ -73,7 +73,7 @@ class CreateFolderClass extends BasePage { public override render(): JSX.Element { return ( - +
diff --git a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx index 1ac9c26d..d45df44f 100644 --- a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx @@ -187,7 +187,9 @@ class ViewDocumentsClass extends BasePage { override async componentDidMount() { try { const document = await Documents.getInstance().getByUid(this.props.documentUid, { - files: true, + files: { + where: { archived_at: null }, + }, document_type: true, folder: true, }); diff --git a/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx b/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx index 36d8aafc..41c653f3 100644 --- a/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx @@ -1,17 +1,17 @@ import ChevronIcon from "@Assets/Icons/chevron.svg"; +import Folders, { IPutFoldersParams } from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders"; import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import FolderBoxInformation, { EFolderBoxInformationType } from "@Front/Components/DesignSystem/FolderBoxInformation"; import QuantityProgressBar from "@Front/Components/DesignSystem/QuantityProgressBar"; import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; +import Module from "@Front/Config/Module"; +import { OfficeFolder } from "le-coffre-resources/dist/Customer"; import { NextRouter, useRouter } from "next/router"; import BasePage from "../../Base"; import classes from "./classes.module.scss"; import ClientSection from "./ClientSection"; -import { OfficeFolder } from "le-coffre-resources/dist/Customer"; -import Folders, { IPutFoldersParams } from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders"; -import Module from "@Front/Config/Module"; type IProps = {}; @@ -93,7 +93,7 @@ class FolderInformationClass extends BasePage { Informations du dossier
- Vous n'avez aucun dossier archivé + Aucun dossier sélectionné
diff --git a/src/front/Components/Layouts/FolderArchived/index.tsx b/src/front/Components/Layouts/FolderArchived/index.tsx index 68c3b4a1..7b71e800 100644 --- a/src/front/Components/Layouts/FolderArchived/index.tsx +++ b/src/front/Components/Layouts/FolderArchived/index.tsx @@ -8,7 +8,7 @@ type IState = { selectedFolder: IDashBoardFolder | null; isArchivedModalOpen: boolean; }; -export default class Folder extends BasePage { +export default class FolderArchived extends BasePage { public constructor(props: IProps) { super(props); this.state = { @@ -31,7 +31,7 @@ export default class Folder extends BasePage { Informations du dossier
- Vous n'avez aucun dossier archivé + Aucun dossier sélectionné
diff --git a/src/front/Components/Layouts/PageNotFound/index.tsx b/src/front/Components/Layouts/PageNotFound/index.tsx index bdbd778f..6c6022dd 100644 --- a/src/front/Components/Layouts/PageNotFound/index.tsx +++ b/src/front/Components/Layouts/PageNotFound/index.tsx @@ -6,7 +6,8 @@ import BasePage from "../Base"; import classes from "./classes.module.scss"; import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage"; -import backgroundImage from "../Folder/CreateFolder/background-image.jpeg"; +import backgroundImage from "@Assets/images/404-background-image.jpeg"; + export default class PageNotFound extends BasePage { public override render(): JSX.Element { return ( diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index aea120fc..40cfb752 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -39,15 +39,15 @@ const MyApp = (({ const getLayout = Component.getLayout ?? ((page) => ); const instance = FrontendVariables.getInstance(); - instance.BACK_API_PROTOCOL = backApiProtocol; - instance.BACK_API_HOST = backApiHost; - instance.BACK_API_ROOT_URL = backApiRootUrl; - instance.BACK_API_VERSION = backApiVersion; - instance.FRONT_APP_HOST = frontAppHost; - instance.IDNOT_AUTHORIZE_ENDPOINT = idNotAuthorizeEndpoint; - instance.IDNOT_CLIENT_ID = idNotClientId; - instance.FC_AUTHORIZE_ENDPOINT= fcAuthorizeEndpoint; - instance.FC_CLIENT_ID = fcClientId + instance.BACK_API_PROTOCOL = backApiProtocol ?? "https://"; + instance.BACK_API_HOST = backApiHost ?? "api.stg.lecoffre.smart-chain.fr"; + instance.BACK_API_ROOT_URL = backApiRootUrl ?? "/api"; + instance.BACK_API_VERSION = backApiVersion ?? "/v1"; + instance.FRONT_APP_HOST = frontAppHost ?? "app.stg.lecoffre.smart-chain.fr"; + instance.IDNOT_AUTHORIZE_ENDPOINT = idNotAuthorizeEndpoint ?? "https://qual-connexion.idnot.fr/IdPOAuth2/authorize/idnot_idp_v1"; + instance.IDNOT_CLIENT_ID = idNotClientId ?? "4501646203F3EF67"; + instance.FC_AUTHORIZE_ENDPOINT= fcAuthorizeEndpoint ?? "https://fcp.integ01.dev-franceconnect.fr/api/v1/authorize"; + instance.FC_CLIENT_ID = fcClientId ?? "211286433e39cce01db448d80181bdfd005554b19cd51b3fe7943f6b3b86ab6e"; return getLayout(); }) as AppType;