From 48be520b2016baaac24c0ba661f928b0f09b6f0d Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Sat, 30 Jul 2022 16:06:14 +0530 Subject: [PATCH] incr: add filter prop on Field --- schemas/app/PurchaseInvoice.json | 3 ++- schemas/app/SalesInvoice.json | 3 ++- schemas/types.ts | 1 + src/components/FilterDropdown.vue | 9 +++++---- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/schemas/app/PurchaseInvoice.json b/schemas/app/PurchaseInvoice.json index a0ebd871..739579c1 100644 --- a/schemas/app/PurchaseInvoice.json +++ b/schemas/app/PurchaseInvoice.json @@ -91,7 +91,8 @@ "fieldname": "outstandingAmount", "label": "Outstanding Amount", "fieldtype": "Currency", - "readOnly": true + "readOnly": true, + "filter": true }, { "fieldname": "setDiscountAmount", diff --git a/schemas/app/SalesInvoice.json b/schemas/app/SalesInvoice.json index dae80d9a..042a9c0a 100644 --- a/schemas/app/SalesInvoice.json +++ b/schemas/app/SalesInvoice.json @@ -90,7 +90,8 @@ "fieldname": "outstandingAmount", "label": "Outstanding Amount", "fieldtype": "Currency", - "readOnly": true + "readOnly": true, + "filter": true }, { "fieldname": "setDiscountAmount", diff --git a/schemas/types.ts b/schemas/types.ts index b029f833..3d852814 100644 --- a/schemas/types.ts +++ b/schemas/types.ts @@ -33,6 +33,7 @@ export interface BaseField { groupBy?: string; // UI Facing used in dropdowns fields meta?: boolean; // Field is a meta field, i.e. only for the db, not UI inline?: boolean; // UI Facing config, whether to display doc inline. + filter?: boolean; // UI Facing config, whether to be used to filter the List. computed?: boolean; // Computed values are not stored in the database. } diff --git a/src/components/FilterDropdown.vue b/src/components/FilterDropdown.vue index 2adfe93d..5ea3af28 100644 --- a/src/components/FilterDropdown.vue +++ b/src/components/FilterDropdown.vue @@ -214,10 +214,11 @@ export default { ]; return fyo.schemaMap[this.schemaName].fields.filter( (f) => - !f.computed && - !excludedFieldsTypes.includes(f.fieldtype) && - !f.meta && - !f.readOnly + f.filter || + (!f.computed && + !excludedFieldsTypes.includes(f.fieldtype) && + !f.meta && + !f.readOnly) ); }, fieldOptions() {