Fix some issues
This commit is contained in:
parent
d4fdf3ac6d
commit
82c9921372
@ -98,6 +98,9 @@ export default class CollaboratorService extends AbstractService {
|
|||||||
!items.map((item: any) => item.processData.uid).includes(publicValues['uid'])
|
!items.map((item: any) => item.processData.uid).includes(publicValues['uid'])
|
||||||
).then(async (processes: any[]) => {
|
).then(async (processes: any[]) => {
|
||||||
if (processes.length === 0) {
|
if (processes.length === 0) {
|
||||||
|
if (waitForAll) {
|
||||||
|
callback([...items]);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,25 +150,32 @@ export default class CollaboratorService extends AbstractService {
|
|||||||
public static getCollaboratorsBy(whereClause: { [path: string]: any }): Promise<any[]> {
|
public static getCollaboratorsBy(whereClause: { [path: string]: any }): Promise<any[]> {
|
||||||
return new Promise<any[]>((resolve: (collaborators: any[]) => void) => {
|
return new Promise<any[]>((resolve: (collaborators: any[]) => void) => {
|
||||||
this.getCollaborators((processes: any[]) => {
|
this.getCollaborators((processes: any[]) => {
|
||||||
resolve(processes.length > 0 ? processes.map((process: any) => process.processData).filter((collaborator: any) => {
|
if (processes.length === 0) {
|
||||||
for (const path in whereClause) {
|
resolve([]);
|
||||||
const paths: string[] = path.split('.');
|
} else {
|
||||||
|
resolve(processes.filter((process: any) => {
|
||||||
|
const collaborator: any = process.processData;
|
||||||
|
|
||||||
let value: any = collaborator;
|
for (const path in whereClause) {
|
||||||
for (let i = 0; i < paths.length; i++) {
|
const paths: string[] = path.split('.');
|
||||||
const currentPath = paths[i];
|
|
||||||
if (!currentPath || value === undefined || value === null) {
|
let value: any = collaborator;
|
||||||
break;
|
for (let i = 0; i < paths.length; i++) {
|
||||||
|
const currentPath = paths[i];
|
||||||
|
if (!currentPath || value === undefined || value === null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
value = value[currentPath];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value !== whereClause[path]) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
value = value[currentPath];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value !== whereClause[path]) {
|
return true;
|
||||||
return false;
|
}));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}) : []);
|
|
||||||
}, true);
|
}, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -173,25 +183,32 @@ export default class CollaboratorService extends AbstractService {
|
|||||||
public static getCollaboratorBy(whereClause: { [path: string]: any }): Promise<any | null> {
|
public static getCollaboratorBy(whereClause: { [path: string]: any }): Promise<any | null> {
|
||||||
return new Promise<any | null>((resolve: (collaborator: any | null) => void) => {
|
return new Promise<any | null>((resolve: (collaborator: any | null) => void) => {
|
||||||
this.getCollaborators((processes: any[]) => {
|
this.getCollaborators((processes: any[]) => {
|
||||||
resolve(processes.length > 0 ? processes.map((process: any) => process.processData).find((collaborator: any) => {
|
if (processes.length === 0) {
|
||||||
for (const path in whereClause) {
|
resolve(null);
|
||||||
const paths: string[] = path.split('.');
|
} else {
|
||||||
|
resolve(processes.find((process: any) => {
|
||||||
|
const collaborator: any = process.processData;
|
||||||
|
|
||||||
let value: any = collaborator;
|
for (const path in whereClause) {
|
||||||
for (let i = 0; i < paths.length; i++) {
|
const paths: string[] = path.split('.');
|
||||||
const currentPath = paths[i];
|
|
||||||
if (!currentPath || value === undefined || value === null) {
|
let value: any = collaborator;
|
||||||
break;
|
for (let i = 0; i < paths.length; i++) {
|
||||||
|
const currentPath = paths[i];
|
||||||
|
if (!currentPath || value === undefined || value === null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
value = value[currentPath];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value !== whereClause[path]) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
value = value[currentPath];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value !== whereClause[path]) {
|
return true;
|
||||||
return false;
|
}));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}) : null);
|
|
||||||
}, true);
|
}, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,9 @@ export default class DeedTypeService extends AbstractService {
|
|||||||
!items.map((item: any) => item.processData.uid).includes(publicValues['uid'])
|
!items.map((item: any) => item.processData.uid).includes(publicValues['uid'])
|
||||||
).then(async (processes: any[]) => {
|
).then(async (processes: any[]) => {
|
||||||
if (processes.length === 0) {
|
if (processes.length === 0) {
|
||||||
|
if (waitForAll) {
|
||||||
|
callback([...items]);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +107,9 @@ export default class FolderService extends AbstractService {
|
|||||||
!items.map((item: any) => item.processData.uid).includes(publicValues['uid'])
|
!items.map((item: any) => item.processData.uid).includes(publicValues['uid'])
|
||||||
).then(async (processes: any[]) => {
|
).then(async (processes: any[]) => {
|
||||||
if (processes.length === 0) {
|
if (processes.length === 0) {
|
||||||
|
if (waitForAll) {
|
||||||
|
callback([...items]);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,25 +159,32 @@ export default class FolderService extends AbstractService {
|
|||||||
public static getFoldersBy(whereClause: { [path: string]: any }): Promise<any[]> {
|
public static getFoldersBy(whereClause: { [path: string]: any }): Promise<any[]> {
|
||||||
return new Promise<any[]>((resolve: (folders: any[]) => void) => {
|
return new Promise<any[]>((resolve: (folders: any[]) => void) => {
|
||||||
this.getFolders((processes: any[]) => {
|
this.getFolders((processes: any[]) => {
|
||||||
resolve(processes.length > 0 ? processes.map((process: any) => process.processData).filter((folder: any) => {
|
if (processes.length === 0) {
|
||||||
for (const path in whereClause) {
|
resolve([]);
|
||||||
const paths: string[] = path.split('.');
|
} else {
|
||||||
|
resolve(processes.filter((process: any) => {
|
||||||
|
const folder: any = process.processData;
|
||||||
|
|
||||||
let value: any = folder;
|
for (const path in whereClause) {
|
||||||
for (let i = 0; i < paths.length; i++) {
|
const paths: string[] = path.split('.');
|
||||||
const currentPath = paths[i];
|
|
||||||
if (!currentPath || value === undefined || value === null) {
|
let value: any = folder;
|
||||||
break;
|
for (let i = 0; i < paths.length; i++) {
|
||||||
|
const currentPath = paths[i];
|
||||||
|
if (!currentPath || value === undefined || value === null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
value = value[currentPath];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value !== whereClause[path]) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
value = value[currentPath];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value !== whereClause[path]) {
|
return true;
|
||||||
return false;
|
}));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}) : []);
|
|
||||||
}, true);
|
}, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import classes from "./classes.module.scss";
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import Customer from "le-coffre-resources/dist/Customer";
|
import Customer from "le-coffre-resources/dist/Customer";
|
||||||
import { DocumentNotary } from "le-coffre-resources/dist/Notary";
|
import { DocumentNotary } from "le-coffre-resources/dist/Notary";
|
||||||
|
import { EDocumentNotaryStatus } from "le-coffre-resources/dist/Notary/DocumentNotary";
|
||||||
|
|
||||||
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService";
|
||||||
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
|
import DocumentService from "src/common/Api/LeCoffreApi/sdk/DocumentService";
|
||||||
@ -133,10 +134,24 @@ export default function ReceivedDocuments() {
|
|||||||
});
|
});
|
||||||
}, [folderUid, customer]);
|
}, [folderUid, customer]);
|
||||||
|
|
||||||
const onDownload = useCallback((doc: any) => {
|
const onDownload = useCallback(async (doc: any) => {
|
||||||
const file = doc.files?.[0];
|
const file = doc.files?.[0];
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
|
||||||
|
if (doc.document_status !== EDocumentNotaryStatus.DOWNLOADED) {
|
||||||
|
await new Promise<void>((resolve: () => void) => {
|
||||||
|
LoaderService.getInstance().show();
|
||||||
|
DocumentService.getDocumentByUid(doc.uid).then((process: any) => {
|
||||||
|
if (process) {
|
||||||
|
DocumentService.updateDocument(process, { document_status: EDocumentNotaryStatus.DOWNLOADED }).then(() => {
|
||||||
|
LoaderService.getInstance().hide();
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return new Promise<void>((resolve: () => void) => {
|
return new Promise<void>((resolve: () => void) => {
|
||||||
const blob = new Blob([file.file_blob.data], { type: file.file_blob.type });
|
const blob = new Blob([file.file_blob.data], { type: file.file_blob.type });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
@ -158,9 +173,23 @@ export default function ReceivedDocuments() {
|
|||||||
const zip = new JSZip();
|
const zip = new JSZip();
|
||||||
const folder = zip.folder("documents") || zip;
|
const folder = zip.folder("documents") || zip;
|
||||||
|
|
||||||
documentsNotary.map((doc: any) => {
|
documentsNotary.map(async (doc: any) => {
|
||||||
const file = doc.files?.[0];
|
const file = doc.files?.[0];
|
||||||
if (file) {
|
if (file) {
|
||||||
|
if (doc.document_status !== EDocumentNotaryStatus.DOWNLOADED) {
|
||||||
|
await new Promise<void>((resolve: () => void) => {
|
||||||
|
LoaderService.getInstance().show();
|
||||||
|
DocumentService.getDocumentByUid(doc.uid).then((process: any) => {
|
||||||
|
if (process) {
|
||||||
|
DocumentService.updateDocument(process, { document_status: EDocumentNotaryStatus.DOWNLOADED }).then(() => {
|
||||||
|
LoaderService.getInstance().hide();
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const blob = new Blob([file.file_blob.data], { type: file.file_blob.type });
|
const blob = new Blob([file.file_blob.data], { type: file.file_blob.type });
|
||||||
folder.file(file.file_name ?? "file", blob);
|
folder.file(file.file_name ?? "file", blob);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ export default function DeedTypesInformations(props: IProps) {
|
|||||||
LoaderService.getInstance().show();
|
LoaderService.getInstance().show();
|
||||||
DeedTypeService.getDeedTypeByUid(deedTypeUid as string).then((process: any) => {
|
DeedTypeService.getDeedTypeByUid(deedTypeUid as string).then((process: any) => {
|
||||||
if (process) {
|
if (process) {
|
||||||
DeedTypeService.updateDeedType(process, { archived_at: new Date().toISOString() }).then(() => {
|
DeedTypeService.updateDeedType(process, { isDeleted: 'true', archived_at: new Date().toISOString() }).then(() => {
|
||||||
router.push(Module.getInstance().get().modules.pages.DeedTypes.props.path);
|
router.push(Module.getInstance().get().modules.pages.DeedTypes.props.path);
|
||||||
LoaderService.getInstance().hide();
|
LoaderService.getInstance().hide();
|
||||||
});
|
});
|
||||||
|
@ -10,8 +10,8 @@ export default function AnchoringAlertInfo(props: IProps) {
|
|||||||
const { onAnchor } = props;
|
const { onAnchor } = props;
|
||||||
return (
|
return (
|
||||||
<Alert
|
<Alert
|
||||||
title="Validation et Certification du Dossier"
|
title="Dossier complet"
|
||||||
description="Votre dossier est désormais complet à 100%. Vous pouvez maintenant procéder à la validation et à l'ancrage des documents dans la blockchain. Cette étape garantit la sécurité et l'authenticité de vos documents."
|
description="Vous pouvez maintenant archiver le dossier."
|
||||||
firstButton={{
|
firstButton={{
|
||||||
children: "Archiver",
|
children: "Archiver",
|
||||||
styletype: EButtonstyletype.CONTAINED,
|
styletype: EButtonstyletype.CONTAINED,
|
||||||
|
@ -276,9 +276,9 @@ export default function LoginCallBack() {
|
|||||||
|
|
||||||
const getCollaborator = async (collaboratorData: any) => {
|
const getCollaborator = async (collaboratorData: any) => {
|
||||||
return await new Promise<any>(async (resolve: (role: any) => void) => {
|
return await new Promise<any>(async (resolve: (role: any) => void) => {
|
||||||
const collaboratorFound: any | null = await CollaboratorService.getCollaboratorBy({ idNot: idNotUser.idNot });
|
const processFound: any | null = await CollaboratorService.getCollaboratorBy({ idNot: idNotUser.idNot });
|
||||||
if (collaboratorFound) {
|
if (processFound) {
|
||||||
resolve(collaboratorFound);
|
resolve(processFound.processData);
|
||||||
} else {
|
} else {
|
||||||
const validatorId: string = '884cb36a346a79af8697559f16940141f068bdf1656f88fa0df0e9ecd7311fb8:0';
|
const validatorId: string = '884cb36a346a79af8697559f16940141f068bdf1656f88fa0df0e9ecd7311fb8:0';
|
||||||
CollaboratorService.createCollaborator(collaboratorData, validatorId).then((process: any) => {
|
CollaboratorService.createCollaborator(collaboratorData, validatorId).then((process: any) => {
|
||||||
|
@ -32,7 +32,8 @@ export default function OfficeInformations(props: IProps) {
|
|||||||
if (!office) return;
|
if (!office) return;
|
||||||
setOfficeSelected(office);
|
setOfficeSelected(office);
|
||||||
|
|
||||||
const users: any[] = await CollaboratorService.getCollaboratorsBy({ 'office.uid': office.uid });
|
const users: any[] = (await CollaboratorService.getCollaboratorsBy({ 'office.uid': office.uid }))
|
||||||
|
.map((process: any) => process.processData);
|
||||||
|
|
||||||
const adminUsers = users.filter((user) => {
|
const adminUsers = users.filter((user) => {
|
||||||
if (user.office_role && user.office_role.name === "admin") {
|
if (user.office_role && user.office_role.name === "admin") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user