✨ 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,
|
||||
documents: {
|
||||
include: {
|
||||
depositor: true,
|
||||
document_type: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
if (!folder) return;
|
||||
@ -155,19 +161,19 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
||||
}
|
||||
|
||||
private async getAvailableDocuments(folder: OfficeFolder): Promise<IOption[]> {
|
||||
const documentTypes = await Deeds.getInstance().getByUid(folder.deed!.uid!, {
|
||||
q: {
|
||||
deed_has_document_types: {
|
||||
include: {
|
||||
document_type: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
const userDocumentTypesUids = folder.documents!.filter((document) => document.depositor!.uid! === this.props.customerUid!).map((document) => {
|
||||
return document.document_type!.uid!;
|
||||
});
|
||||
const documentTypes = folder.deed!.deed_has_document_types!.filter((documentType) => {
|
||||
if(userDocumentTypesUids.includes(documentType.document_type!.uid!)) return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!documentTypes) return [];
|
||||
|
||||
const documentTypesOptions: IOption[] = documentTypes.deed_has_document_types!.map((documentType) => {
|
||||
const documentTypesOptions: IOption[] = documentTypes.filter((documentType) => {
|
||||
return true;
|
||||
}).map((documentType) => {
|
||||
return {
|
||||
label: documentType.document_type!.name!,
|
||||
value: documentType.document_type!.uid!,
|
||||
|
Loading…
x
Reference in New Issue
Block a user