From 51d533cdf5fbbf107e5b004576ea24ee329815bd Mon Sep 17 00:00:00 2001 From: saeid_01 Date: Tue, 8 Oct 2019 11:34:45 +0330 Subject: [PATCH] filter --- public/mix-manifest.json | 6 ++-- resources/js/Global/mixins/commingSoon.js | 4 +-- .../Global/utils/common/CreateFilterObject.js | 31 +++++++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 resources/js/Global/utils/common/CreateFilterObject.js diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 4a624ab..2ecf4fb 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,6 +1,6 @@ { "/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=77424533bf54f95aa524", - "/js/vue/Home/app.js": "/js/vue/Home/app.js?id=86d48e06c5b13724f430", - "/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=ef74880b09765a4cb21b", - "/js/vue/User/app.js": "/js/vue/User/app.js?id=e9283a676a9e344b0a5e" + "/js/vue/Home/app.js": "/js/vue/Home/app.js?id=e358b4b5c55ea487c673", + "/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=fa665e31799839141fe6", + "/js/vue/User/app.js": "/js/vue/User/app.js?id=a5bb957404874e203544" } diff --git a/resources/js/Global/mixins/commingSoon.js b/resources/js/Global/mixins/commingSoon.js index a57d6d0..43097ce 100644 --- a/resources/js/Global/mixins/commingSoon.js +++ b/resources/js/Global/mixins/commingSoon.js @@ -7,9 +7,9 @@ var CommingSoonArray = [ "crm-setting", - "crm-client-filter", + // "crm-client-filter", "crm-statistics", - "user-list-filter", + // "user-list-filter", ]; const commingSoon = { methods: { diff --git a/resources/js/Global/utils/common/CreateFilterObject.js b/resources/js/Global/utils/common/CreateFilterObject.js new file mode 100644 index 0000000..27a3133 --- /dev/null +++ b/resources/js/Global/utils/common/CreateFilterObject.js @@ -0,0 +1,31 @@ +const createFilterObject = filters => { + let filterObject = {}; + for (const key in filters) { + if (filters.hasOwnProperty(key)) { + if (filters[key]["type"]) { + let filterValue = window[filters[key]["type"]](filters[key]); + if (filterValue) { + filterObject[key] = filterValue; + } + } + } + } + return filterObject; +}; +window['between'] = function (filter) { + var value = null; + if (filter.val1 || filter.val2) { + value = `<${filter.val1},${filter.val2}>`; + } + return value; +} + +window['like'] = function(filter) { + var value = null; + if (filter.val) { + value = `%${filter.val}%`; + } + return value; +} + +export default createFilterObject;