Compare commits
4 Commits
6175727f1b
...
c422fef776
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c422fef776 | ||
3899cf1a53 | |||
![]() |
8aa82f3a9c | ||
![]() |
6e86e65845 |
@ -438,10 +438,11 @@ export default function DocumentTables(props: IProps) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const progress = useMemo(() => {
|
const progress = useMemo(() => {
|
||||||
const total = askedDocuments.length + toValidateDocuments.length + validatedDocuments.length + refusedDocuments.length;
|
// Exclude refused documents from total - only count documents that are still in progress
|
||||||
|
const total = askedDocuments.length + toValidateDocuments.length + validatedDocuments.length;
|
||||||
if (total === 0) return 0;
|
if (total === 0) return 0;
|
||||||
return (validatedDocuments.length / total) * 100;
|
return (validatedDocuments.length / total) * 100;
|
||||||
}, [askedDocuments.length, refusedDocuments.length, toValidateDocuments.length, validatedDocuments.length]);
|
}, [askedDocuments.length, toValidateDocuments.length, validatedDocuments.length]);
|
||||||
|
|
||||||
if (documents.length === 0 && documentsNotary.length === 0) return <NoDocument />;
|
if (documents.length === 0 && documentsNotary.length === 0) return <NoDocument />;
|
||||||
|
|
||||||
|
@ -48,9 +48,11 @@ export default function FolderInformation(props: IProps) {
|
|||||||
let total = 0;
|
let total = 0;
|
||||||
let validatedDocuments = 0;
|
let validatedDocuments = 0;
|
||||||
folder?.customers?.forEach((customer: any) => {
|
folder?.customers?.forEach((customer: any) => {
|
||||||
const documents = customer.documents.filter((document: any) => document.depositor);
|
const documents = customer.documents;
|
||||||
total += documents?.length ?? 0;
|
// Only count documents that are not refused (still in progress)
|
||||||
validatedDocuments += documents?.filter((document: any) => document.document_status === EDocumentStatus.VALIDATED).length ?? 0;
|
const activeDocuments = documents?.filter((document: any) => document.document_status !== EDocumentStatus.REFUSED) ?? [];
|
||||||
|
total += activeDocuments.length;
|
||||||
|
validatedDocuments += activeDocuments.filter((document: any) => document.document_status === EDocumentStatus.VALIDATED).length;
|
||||||
});
|
});
|
||||||
if (total === 0) return 0;
|
if (total === 0) return 0;
|
||||||
const percentage = (validatedDocuments / total) * 100;
|
const percentage = (validatedDocuments / total) * 100;
|
||||||
|
@ -89,7 +89,7 @@ export default function StepEmail(props: IProps) {
|
|||||||
<div className={classes["content"]}>
|
<div className={classes["content"]}>
|
||||||
<div className={classes["section"]}>
|
<div className={classes["section"]}>
|
||||||
<Typography typo={ETypo.TITLE_H6} color={ETypoColor.TEXT_ACCENT} className={classes["section-title"]}>
|
<Typography typo={ETypo.TITLE_H6} color={ETypoColor.TEXT_ACCENT} className={classes["section-title"]}>
|
||||||
Pour les notaires et les colaborateurs :
|
Pour les notaires et les collaborateurs :
|
||||||
</Typography>
|
</Typography>
|
||||||
<Button onClick={redirectUserOnConnection} rightIcon={<Image alt="id-not-logo" src={idNoteLogo} />}>
|
<Button onClick={redirectUserOnConnection} rightIcon={<Image alt="id-not-logo" src={idNoteLogo} />}>
|
||||||
S'identifier avec ID.not
|
S'identifier avec ID.not
|
||||||
|
@ -21,6 +21,7 @@ import UserStore from "@Front/Stores/UserStore";
|
|||||||
|
|
||||||
import AuthModal from "src/sdk/AuthModal";
|
import AuthModal from "src/sdk/AuthModal";
|
||||||
import CustomerService from "src/common/Api/LeCoffreApi/sdk/CustomerService";
|
import CustomerService from "src/common/Api/LeCoffreApi/sdk/CustomerService";
|
||||||
|
import MessageBus from "src/sdk/MessageBus";
|
||||||
|
|
||||||
export enum LoginStep {
|
export enum LoginStep {
|
||||||
EMAIL,
|
EMAIL,
|
||||||
@ -41,6 +42,7 @@ export default function Login() {
|
|||||||
const [totpCode, setTotpCode] = useState<string>("");
|
const [totpCode, setTotpCode] = useState<string>("");
|
||||||
const [email, setEmail] = useState<string>("");
|
const [email, setEmail] = useState<string>("");
|
||||||
const [partialPhoneNumber, setPartialPhoneNumber] = useState<string>("");
|
const [partialPhoneNumber, setPartialPhoneNumber] = useState<string>("");
|
||||||
|
const [sessionId, setSessionId] = useState<string>("");
|
||||||
const [validationErrors, setValidationErrors] = useState<ValidationError[]>([]);
|
const [validationErrors, setValidationErrors] = useState<ValidationError[]>([]);
|
||||||
const [isAuthModalOpen, setIsAuthModalOpen] = useState(false);
|
const [isAuthModalOpen, setIsAuthModalOpen] = useState(false);
|
||||||
|
|
||||||
@ -92,10 +94,13 @@ export default function Login() {
|
|||||||
// If the code is valid setting it in state
|
// If the code is valid setting it in state
|
||||||
if (res.validCode) {
|
if (res.validCode) {
|
||||||
setTotpCode(values["totpCode"]);
|
setTotpCode(values["totpCode"]);
|
||||||
|
setSessionId(res.sessionId); // Store the session ID
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if ('1234' === values["totpCode"]) {
|
if ('1234' === values["totpCode"]) {
|
||||||
setTotpCode(values["totpCode"]);
|
setTotpCode(values["totpCode"]);
|
||||||
|
// For testing, set a mock session ID
|
||||||
|
setSessionId("mock-session-id-123");
|
||||||
}
|
}
|
||||||
|
|
||||||
setValidationErrors([]);
|
setValidationErrors([]);
|
||||||
@ -265,17 +270,38 @@ export default function Login() {
|
|||||||
{isAuthModalOpen && <AuthModal
|
{isAuthModalOpen && <AuthModal
|
||||||
isOpen={isAuthModalOpen}
|
isOpen={isAuthModalOpen}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
CustomerService.getCustomers().then((processes: any[]) => {
|
// After 4nk authentication is complete, get the process for the pairing ID
|
||||||
if (processes.length > 0) {
|
MessageBus.getInstance().initMessageListener();
|
||||||
const customers: any[] = processes.map((process: any) => process.processData);
|
MessageBus.getInstance().isReady().then(async () => {
|
||||||
const customer: any = customers.find((customer: any) => customer.contact.email === email);
|
try {
|
||||||
if (customer) {
|
// Get the pairing ID
|
||||||
UserStore.instance.connect(customer);
|
const pairingId = await MessageBus.getInstance().getPairingId();
|
||||||
|
console.log('[Login] Got pairing ID:', pairingId);
|
||||||
|
|
||||||
|
// Get all processes
|
||||||
|
const processes = await MessageBus.getInstance().getProcesses();
|
||||||
|
console.log('[Login] Got processes:', Object.keys(processes));
|
||||||
|
|
||||||
|
const targetProcess = processes[pairingId];
|
||||||
|
|
||||||
|
if (targetProcess) {
|
||||||
|
console.log('[Login] Found target process:', targetProcess);
|
||||||
|
// Connect the user with the process data
|
||||||
|
UserStore.instance.connect(targetProcess);
|
||||||
router.push(Module.getInstance().get().modules.pages.Folder.pages.Select.props.path);
|
router.push(Module.getInstance().get().modules.pages.Folder.pages.Select.props.path);
|
||||||
|
} else {
|
||||||
|
console.error('[Login] No process found for pairing ID:', pairingId);
|
||||||
|
// Handle the case where no process is found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageBus.getInstance().destroyMessageListener();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[Login] Error getting process:', error);
|
||||||
|
MessageBus.getInstance().destroyMessageListener();
|
||||||
}
|
}
|
||||||
setIsAuthModalOpen(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setIsAuthModalOpen(false);
|
||||||
}}
|
}}
|
||||||
/>}
|
/>}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user