From 6e9d2fe28042ec710f17f2a7b5e891c002de79ff Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 3 Feb 2021 17:53:22 +0000 Subject: [PATCH] --- .../components/data-table-filter-control.vue | 34 ++++++++- ayanova/src/components/data-table.vue | 74 ++++++++++--------- 2 files changed, 70 insertions(+), 38 deletions(-) diff --git a/ayanova/src/components/data-table-filter-control.vue b/ayanova/src/components/data-table-filter-control.vue index 1caf93ed..f25fdfad 100644 --- a/ayanova/src/components/data-table-filter-control.vue +++ b/ayanova/src/components/data-table-filter-control.vue @@ -320,9 +320,10 @@ export default { isVisible: false, resolve: null, reject: null, - tableColumnData: {}, + tableColumnData: {}, //from table fieldDefinitions: [], editItem: {}, + activeFilter: null, selectLists: { dateFilterOperators: [], dateFilterTokens: [], @@ -345,11 +346,21 @@ export default { } }), props: { - dataListKey: String + dataListKey: String, + activeFilterId: Number }, methods: { saveAndExit() { //todo: save changes here + //Note: we are working with a specific filter, either the "default" filter which is the one used when no other filter is specified or a specific one + //So here we need to take the current filter, update it and save it + + //todo: populate current filter on open of this control so we have it here to modify and it's near live + // grid doesn't know about filters and has no need to, so this form just needs to know the currently active filter id + //take existing filter + //upsert conditions for this column + //save filter + //let grid do it's thing this.close({ refresh: true }); }, addFilterCondition(editItem) { @@ -453,8 +464,10 @@ export default { return; } }, - open(tableColumnData) { + async open(tableColumnData) { this.tableColumnData = tableColumnData; + + await getActiveFilter(vm); initEditItem(this); this.isVisible = true; return new Promise((resolve, reject) => { @@ -509,6 +522,21 @@ async function populateFieldDefinitions(vm) { } } +//////////////////// +// +async function fetchActiveFilter(vm) { + ///api/v8/data-list-filter/{id} + let res = await window.$gz.api.get( + `/api/v8/data-list-filter/${vm.activeFilterId}` + ); + if (res.error) { + //throw new Error(res.error); + throw new Error(window.$gz.errorHandler.errorToString(res, vm)); + } else { + vm.activeFilter = res.data; + } +} + ////////////////////////////////////////////////////////// // // Ensures UI translated text is available diff --git a/ayanova/src/components/data-table.vue b/ayanova/src/components/data-table.vue index c6ebdff6..82fc9e08 100644 --- a/ayanova/src/components/data-table.vue +++ b/ayanova/src/components/data-table.vue @@ -1,20 +1,24 @@