1
0
forked from test/crm

fix: lead/deal listview

This commit is contained in:
Shariq Ansari 2023-11-06 16:15:34 +05:30
parent 458cf78ac2
commit 71c0d81582
2 changed files with 17 additions and 15 deletions

View File

@ -37,7 +37,7 @@
<Dialog <Dialog
v-model="showNewDialog" v-model="showNewDialog"
:options="{ :options="{
width: '3xl', size: '3xl',
title: 'New Deal', title: 'New Deal',
actions: [{ label: 'Save', variant: 'solid' }], actions: [{ label: 'Save', variant: 'solid' }],
}" }"
@ -60,6 +60,7 @@ import NewDeal from '@/components/NewDeal.vue'
import SortBy from '@/components/SortBy.vue' import SortBy from '@/components/SortBy.vue'
import Filter from '@/components/Filter.vue' import Filter from '@/components/Filter.vue'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { organizationsStore } from '@/stores/organizations'
import { useOrderBy } from '@/composables/orderby' import { useOrderBy } from '@/composables/orderby'
import { useFilter } from '@/composables/filter' import { useFilter } from '@/composables/filter'
import { useDebounceFn } from '@vueuse/core' import { useDebounceFn } from '@vueuse/core'
@ -85,6 +86,7 @@ import { ref, computed, reactive, watch } from 'vue'
const breadcrumbs = [{ label: 'Deals', route: { name: 'Deals' } }] const breadcrumbs = [{ label: 'Deals', route: { name: 'Deals' } }]
const { getUser } = usersStore() const { getUser } = usersStore()
const { getOrganization } = organizationsStore()
const { get: getOrderBy } = useOrderBy() const { get: getOrderBy } = useOrderBy()
const { getArgs, storage } = useFilter() const { getArgs, storage } = useFilter()
@ -105,8 +107,7 @@ const leads = createListResource({
doctype: 'CRM Lead', doctype: 'CRM Lead',
fields: [ fields: [
'name', 'name',
'organization_name', 'organization',
'organization_logo',
'annual_revenue', 'annual_revenue',
'deal_status', 'deal_status',
'email', 'email',
@ -143,7 +144,7 @@ watch(
const columns = [ const columns = [
{ {
label: 'Organization', label: 'Organization',
key: 'organization_name', key: 'organization',
width: '11rem', width: '11rem',
}, },
{ {
@ -183,9 +184,9 @@ const rows = computed(() => {
return leads.data.map((lead) => { return leads.data.map((lead) => {
return { return {
name: lead.name, name: lead.name,
organization_name: { organization: {
label: lead.organization_name, label: lead.organization,
logo: lead.organization_logo, logo: getOrganization(lead.organization)?.organization_logo,
}, },
annual_revenue: formatNumberIntoCurrency(lead.annual_revenue), annual_revenue: formatNumberIntoCurrency(lead.annual_revenue),
deal_status: { deal_status: {
@ -256,7 +257,7 @@ let newDeal = reactive({
first_name: '', first_name: '',
last_name: '', last_name: '',
lead_name: '', lead_name: '',
organization_name: '', organization: '',
deal_status: 'Qualification', deal_status: 'Qualification',
email: '', email: '',
mobile_no: '', mobile_no: '',

View File

@ -59,6 +59,7 @@ import NewLead from '@/components/NewLead.vue'
import SortBy from '@/components/SortBy.vue' import SortBy from '@/components/SortBy.vue'
import Filter from '@/components/Filter.vue' import Filter from '@/components/Filter.vue'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { organizationsStore } from '@/stores/organizations'
import { useOrderBy } from '@/composables/orderby' import { useOrderBy } from '@/composables/orderby'
import { useFilter } from '@/composables/filter' import { useFilter } from '@/composables/filter'
import { useDebounceFn } from '@vueuse/core' import { useDebounceFn } from '@vueuse/core'
@ -78,6 +79,7 @@ import { ref, computed, reactive, watch } from 'vue'
const breadcrumbs = [{ label: 'Leads', route: { name: 'Leads' } }] const breadcrumbs = [{ label: 'Leads', route: { name: 'Leads' } }]
const { getUser } = usersStore() const { getUser } = usersStore()
const { getOrganization } = organizationsStore()
const { get: getOrderBy } = useOrderBy() const { get: getOrderBy } = useOrderBy()
const { getArgs, storage } = useFilter() const { getArgs, storage } = useFilter()
@ -105,8 +107,7 @@ const leads = createListResource({
'first_name', 'first_name',
'lead_name', 'lead_name',
'image', 'image',
'organization_name', 'organization',
'organization_logo',
'status', 'status',
'email', 'email',
'mobile_no', 'mobile_no',
@ -147,7 +148,7 @@ const columns = [
}, },
{ {
label: 'Organization', label: 'Organization',
key: 'organization_name', key: 'organization',
width: '10rem', width: '10rem',
}, },
{ {
@ -187,9 +188,9 @@ const rows = computed(() => {
image: lead.image, image: lead.image,
image_label: lead.first_name, image_label: lead.first_name,
}, },
organization_name: { organization: {
label: lead.organization_name, label: lead.organization,
logo: lead.organization_logo, logo: getOrganization(lead.organization)?.organization_logo,
}, },
status: { status: {
label: lead.status, label: lead.status,
@ -259,7 +260,7 @@ let newLead = reactive({
first_name: '', first_name: '',
last_name: '', last_name: '',
lead_name: '', lead_name: '',
organization_name: '', organization: '',
status: 'Open', status: 'Open',
email: '', email: '',
mobile_no: '', mobile_no: '',