diff --git a/frontend/src/components/Icons/ExportIcon.vue b/frontend/src/components/Icons/ExportIcon.vue new file mode 100644 index 00000000..a6f62ef2 --- /dev/null +++ b/frontend/src/components/Icons/ExportIcon.vue @@ -0,0 +1,16 @@ + diff --git a/frontend/src/components/Icons/QuickFilterIcon.vue b/frontend/src/components/Icons/QuickFilterIcon.vue new file mode 100644 index 00000000..3776a36a --- /dev/null +++ b/frontend/src/components/Icons/QuickFilterIcon.vue @@ -0,0 +1,20 @@ + diff --git a/frontend/src/components/ViewControls.vue b/frontend/src/components/ViewControls.vue index ee38ccc0..4715f0f6 100644 --- a/frontend/src/components/ViewControls.vue +++ b/frontend/src/components/ViewControls.vue @@ -58,6 +58,62 @@ +
+
+ + + + + +
+
+ +
+
- h(FeatherIcon, { name: 'download', class: 'h-4 w-4' }), + icon: () => h(ExportIcon, { class: 'h-4 w-4' }), onClick: () => (showExportDialog = true), }, + { + label: __('Customize quick filters'), + icon: () => h(QuickFilterIcon, { class: 'h-4 w-4' }), + onClick: () => (customizeQuickFilter = true), + }, ], }, ]" @@ -218,7 +278,10 @@ import DuplicateIcon from '@/components/Icons/DuplicateIcon.vue' import CheckIcon from '@/components/Icons/CheckIcon.vue' import PinIcon from '@/components/Icons/PinIcon.vue' import UnpinIcon from '@/components/Icons/UnpinIcon.vue' +import ExportIcon from '@/components/Icons/ExportIcon.vue' +import QuickFilterIcon from '@/components/Icons/QuickFilterIcon.vue' import ViewModal from '@/components/Modals/ViewModal.vue' +import Autocomplete from '@/components/frappe-ui/Autocomplete.vue' import SortBy from '@/components/SortBy.vue' import Filter from '@/components/Filter.vue' import GroupBy from '@/components/GroupBy.vue' @@ -229,8 +292,10 @@ import { getSettings } from '@/stores/settings' import { globalStore } from '@/stores/global' import { viewsStore } from '@/stores/views' import { usersStore } from '@/stores/users' -import { isEmoji } from '@/utils' +import { getMeta } from '@/stores/meta' +import { isEmoji, createToast } from '@/utils' import { + Tooltip, createResource, Dropdown, call, @@ -594,11 +659,28 @@ const viewsDropdownOptions = computed(() => { return _views }) +const { getFields } = getMeta(props.doctype) + +const customizeQuickFilter = ref(false) + +const newQuickFilters = ref([]) + +function addQuickFilter(f) { + // +} + +function removeQuickFilter(f) { + // +} + +function saveQuickFilters() { + // +} + +const quickFilterOptions = [] + const quickFilterList = computed(() => { - let filters = [{ fieldname: 'name', fieldtype: 'Data', label: __('ID') }] - if (quickFilters.data) { - filters.push(...quickFilters.data) - } + let filters = quickFilters.data || [] filters.forEach((filter) => { filter['value'] = filter.fieldtype == 'Check' ? false : '' @@ -630,6 +712,13 @@ const quickFilters = createResource({ params: { doctype: props.doctype }, cache: ['Quick Filters', props.doctype], auto: true, + onSuccess(filters) { + newQuickFilters.value = filters.map((f) => ({ + label: f.label, + fieldname: f.fieldname, + fieldtype: f.fieldtype, + })) + }, }) function applyQuickFilter(filter, value) {