fix: removed old filters & sort by logic from all list view

This commit is contained in:
Shariq Ansari 2023-12-31 22:24:02 +05:30
parent 8660312684
commit b590985b56
5 changed files with 16 additions and 144 deletions

View File

@ -43,22 +43,17 @@ import {
} from '@/utils'
import { usersStore } from '@/stores/users'
import { contactsStore } from '@/stores/contacts'
import { useOrderBy } from '@/composables/orderby'
import { useFilter } from '@/composables/filter'
import { useDebounceFn } from '@vueuse/core'
import { createResource, Breadcrumbs, FeatherIcon } from 'frappe-ui'
import { computed, watch } from 'vue'
import { createResource, Breadcrumbs } from 'frappe-ui'
import { computed } from 'vue'
const { getUser } = usersStore()
const { getContact } = contactsStore()
const { get: getOrderBy } = useOrderBy()
const { getArgs, storage } = useFilter()
const breadcrumbs = [{ label: 'Call Logs', route: { name: 'Call Logs' } }]
function getParams() {
const filters = getArgs() || {}
const order_by = getOrderBy() || 'creation desc'
const filters = {}
const order_by = 'creation desc'
return {
doctype: 'CRM Call Log',
@ -73,26 +68,6 @@ const callLogs = createResource({
auto: true,
})
watch(
() => getOrderBy(),
(value, old_value) => {
if (!value && !old_value) return
callLogs.params = getParams()
callLogs.reload()
},
{ immediate: true }
)
watch(
storage,
useDebounceFn((value, old_value) => {
if (JSON.stringify([...value]) === JSON.stringify([...old_value])) return
callLogs.params = getParams()
callLogs.reload()
}, 300),
{ deep: true }
)
const rows = computed(() => {
if (!callLogs.data?.data) return []
return callLogs.data.data.map((callLog) => {

View File

@ -62,16 +62,11 @@ import Filter from '@/components/Filter.vue'
import ViewSettings from '@/components/ViewSettings.vue'
import { FeatherIcon, Breadcrumbs, Dropdown, createResource } from 'frappe-ui'
import { organizationsStore } from '@/stores/organizations.js'
import { useOrderBy } from '@/composables/orderby'
import { useFilter } from '@/composables/filter'
import { dateFormat, dateTooltipFormat, timeAgo } from '@/utils'
import { useDebounceFn } from '@vueuse/core'
import { ref, computed, watch } from 'vue'
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router'
const { getOrganization } = organizationsStore()
const { get: getOrderBy } = useOrderBy()
const { getArgs, storage } = useFilter()
const route = useRoute()
const showContactModal = ref(false)
@ -101,8 +96,8 @@ const currentView = ref({
})
function getParams() {
const filters = getArgs() || {}
const order_by = getOrderBy() || 'modified desc'
const filters = {}
const order_by = 'modified desc'
return {
doctype: 'Contact',
@ -117,26 +112,6 @@ const contacts = createResource({
auto: true,
})
watch(
() => getOrderBy(),
(value, old_value) => {
if (!value && !old_value) return
contacts.params = getParams()
contacts.reload()
},
{ immediate: true }
)
watch(
storage,
useDebounceFn((value, old_value) => {
if (JSON.stringify([...value]) === JSON.stringify([...old_value])) return
contacts.params = getParams()
contacts.reload()
}, 300),
{ deep: true }
)
const rows = computed(() => {
if (!contacts.data?.data) return []
return contacts.data.data.map((contact) => {

View File

@ -79,9 +79,6 @@ import ViewSettings from '@/components/ViewSettings.vue'
import { usersStore } from '@/stores/users'
import { organizationsStore } from '@/stores/organizations'
import { statusesStore } from '@/stores/statuses'
import { useOrderBy } from '@/composables/orderby'
import { useFilter } from '@/composables/filter'
import { useDebounceFn } from '@vueuse/core'
import {
dateFormat,
dateTooltipFormat,
@ -98,15 +95,13 @@ import {
Breadcrumbs,
} from 'frappe-ui'
import { useRouter } from 'vue-router'
import { ref, computed, reactive, watch } from 'vue'
import { ref, computed, reactive } from 'vue'
const breadcrumbs = [{ label: 'Deals', route: { name: 'Deals' } }]
const { getUser } = usersStore()
const { getOrganization } = organizationsStore()
const { getDealStatus } = statusesStore()
const { get: getOrderBy } = useOrderBy()
const { getArgs, storage } = useFilter()
const currentView = ref({
label: 'List',
@ -114,8 +109,8 @@ const currentView = ref({
})
function getParams() {
const filters = getArgs() || {}
const order_by = getOrderBy() || 'modified desc'
const filters = {}
const order_by = 'modified desc'
return {
doctype: 'CRM Deal',
@ -130,26 +125,6 @@ const deals = createResource({
auto: true,
})
watch(
() => getOrderBy(),
(value, old_value) => {
if (!value && !old_value) return
deals.params = getParams()
deals.reload()
},
{ immediate: true }
)
watch(
storage,
useDebounceFn((value, old_value) => {
if (JSON.stringify([...value]) === JSON.stringify([...old_value])) return
deals.params = getParams()
deals.reload()
}, 300),
{ deep: true }
)
const rows = computed(() => {
if (!deals.data?.data) return []
return deals.data.data.map((deal) => {

View File

@ -78,9 +78,6 @@ import ViewSettings from '@/components/ViewSettings.vue'
import { usersStore } from '@/stores/users'
import { organizationsStore } from '@/stores/organizations'
import { statusesStore } from '@/stores/statuses'
import { useOrderBy } from '@/composables/orderby'
import { useFilter } from '@/composables/filter'
import { useDebounceFn } from '@vueuse/core'
import { dateFormat, dateTooltipFormat, timeAgo, formatTime } from '@/utils'
import {
FeatherIcon,
@ -91,15 +88,13 @@ import {
Breadcrumbs,
} from 'frappe-ui'
import { useRouter } from 'vue-router'
import { ref, computed, reactive, watch } from 'vue'
import { ref, computed, reactive } from 'vue'
const breadcrumbs = [{ label: 'Leads', route: { name: 'Leads' } }]
const { getUser } = usersStore()
const { getOrganization } = organizationsStore()
const { getLeadStatus } = statusesStore()
const { get: getOrderBy } = useOrderBy()
const { getArgs, storage } = useFilter()
const currentView = ref({
label: 'List',
@ -107,12 +102,9 @@ const currentView = ref({
})
function getParams() {
const filters = {
converted: 0,
...(getArgs() || {}),
}
const filters = { converted: 0 }
const order_by = getOrderBy() || 'modified desc'
const order_by = 'modified desc'
return {
doctype: 'CRM Lead',
@ -127,26 +119,6 @@ const leads = createResource({
auto: true,
})
watch(
() => getOrderBy(),
(value, old_value) => {
if (!value && !old_value) return
leads.params = getParams()
leads.reload()
},
{ immediate: true }
)
watch(
storage,
useDebounceFn((value, old_value) => {
if (JSON.stringify([...value]) === JSON.stringify([...old_value])) return
leads.params = getParams()
leads.reload()
}, 300),
{ deep: true }
)
const rows = computed(() => {
if (!leads.data?.data) return []
return leads.data.data.map((lead) => {

View File

@ -63,9 +63,6 @@ import OrganizationsListView from '@/components/ListViews/OrganizationsListView.
import SortBy from '@/components/SortBy.vue'
import Filter from '@/components/Filter.vue'
import ViewSettings from '@/components/ViewSettings.vue'
import { useOrderBy } from '@/composables/orderby'
import { useFilter } from '@/composables/filter'
import { useDebounceFn } from '@vueuse/core'
import { FeatherIcon, Breadcrumbs, Dropdown, createResource } from 'frappe-ui'
import {
dateFormat,
@ -73,12 +70,10 @@ import {
timeAgo,
formatNumberIntoCurrency,
} from '@/utils'
import { ref, computed, watch } from 'vue'
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const { get: getOrderBy } = useOrderBy()
const { getArgs, storage } = useFilter()
const showOrganizationModal = ref(false)
@ -107,8 +102,8 @@ const currentView = ref({
})
function getParams() {
const filters = getArgs() || {}
const order_by = getOrderBy() || 'modified desc'
const filters = {}
const order_by = 'modified desc'
return {
doctype: 'CRM Organization',
@ -123,26 +118,6 @@ const organizations = createResource({
auto: true,
})
watch(
() => getOrderBy(),
(value, old_value) => {
if (!value && !old_value) return
organizations.params = getParams()
organizations.reload()
},
{ immediate: true }
)
watch(
storage,
useDebounceFn((value, old_value) => {
if (JSON.stringify([...value]) === JSON.stringify([...old_value])) return
organizations.params = getParams()
organizations.reload()
}, 300),
{ deep: true }
)
const rows = computed(() => {
if (!organizations.data?.data) return []
return organizations.data.data.map((organization) => {