✨ Showing only documents that are not asked
This commit is contained in:
parent
d8e4209a50
commit
4687b4bfe1
@ -142,6 +142,12 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
office: true,
|
office: true,
|
||||||
|
documents: {
|
||||||
|
include: {
|
||||||
|
depositor: true,
|
||||||
|
document_type: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!folder) return;
|
if (!folder) return;
|
||||||
@ -155,19 +161,19 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async getAvailableDocuments(folder: OfficeFolder): Promise<IOption[]> {
|
private async getAvailableDocuments(folder: OfficeFolder): Promise<IOption[]> {
|
||||||
const documentTypes = await Deeds.getInstance().getByUid(folder.deed!.uid!, {
|
const userDocumentTypesUids = folder.documents!.filter((document) => document.depositor!.uid! === this.props.customerUid!).map((document) => {
|
||||||
q: {
|
return document.document_type!.uid!;
|
||||||
deed_has_document_types: {
|
});
|
||||||
include: {
|
const documentTypes = folder.deed!.deed_has_document_types!.filter((documentType) => {
|
||||||
document_type: true,
|
if(userDocumentTypesUids.includes(documentType.document_type!.uid!)) return false;
|
||||||
},
|
return true;
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!documentTypes) return [];
|
if (!documentTypes) return [];
|
||||||
|
|
||||||
const documentTypesOptions: IOption[] = documentTypes.deed_has_document_types!.map((documentType) => {
|
const documentTypesOptions: IOption[] = documentTypes.filter((documentType) => {
|
||||||
|
return true;
|
||||||
|
}).map((documentType) => {
|
||||||
return {
|
return {
|
||||||
label: documentType.document_type!.name!,
|
label: documentType.document_type!.name!,
|
||||||
value: documentType.document_type!.uid!,
|
value: documentType.document_type!.uid!,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user