fix: replaced deals listview with frappeui listview component
This commit is contained in:
parent
caf303e69a
commit
9d64d52309
@ -33,11 +33,61 @@
|
|||||||
<Button icon="more-horizontal" />
|
<Button icon="more-horizontal" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ListView :list="list" :columns="columns" :rows="rows" row-key="name" />
|
<ListView
|
||||||
|
v-if="rows"
|
||||||
|
class="mt-0"
|
||||||
|
:columns="columns"
|
||||||
|
:rows="rows"
|
||||||
|
row-key="name"
|
||||||
|
>
|
||||||
|
<ListHeader />
|
||||||
|
<ListRows>
|
||||||
|
<ListRow
|
||||||
|
v-for="(row, i) in rows"
|
||||||
|
:key="row.name"
|
||||||
|
v-slot="{ column, item }"
|
||||||
|
:row="row"
|
||||||
|
:idx="i"
|
||||||
|
>
|
||||||
|
<ListRowItem :item="item">
|
||||||
|
<template #prefix>
|
||||||
|
<div v-if="column.key === 'deal_status'">
|
||||||
|
<IndicatorIcon :class="item.color" />
|
||||||
|
</div>
|
||||||
|
<div v-else-if="column.key === 'organization_name'">
|
||||||
|
<Avatar
|
||||||
|
v-if="item.label"
|
||||||
|
class="flex items-center"
|
||||||
|
:image="item.logo"
|
||||||
|
:label="item.label"
|
||||||
|
size="sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="column.key === 'lead_owner'">
|
||||||
|
<Avatar
|
||||||
|
v-if="item.full_name"
|
||||||
|
class="flex items-center"
|
||||||
|
:image="item.user_image"
|
||||||
|
:label="item.full_name"
|
||||||
|
size="sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="column.key === 'mobile_no'">
|
||||||
|
<PhoneIcon class="h-4 w-4" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div v-if="column.key === 'modified'" class="truncate text-base">
|
||||||
|
{{ item.timeAgo }}
|
||||||
|
</div>
|
||||||
|
</ListRowItem>
|
||||||
|
</ListRow>
|
||||||
|
</ListRows>
|
||||||
|
<ListSelectBanner />
|
||||||
|
</ListView>
|
||||||
<Dialog
|
<Dialog
|
||||||
v-model="showNewDialog"
|
v-model="showNewDialog"
|
||||||
:options="{
|
:options="{
|
||||||
size: '3xl',
|
width: '3xl',
|
||||||
title: 'New Deal',
|
title: 'New Deal',
|
||||||
actions: [{ label: 'Save', variant: 'solid' }],
|
actions: [{ label: 'Save', variant: 'solid' }],
|
||||||
}"
|
}"
|
||||||
@ -54,17 +104,25 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import ListView from '@/components/ListView.vue'
|
|
||||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||||
import NewDeal from '@/components/NewDeal.vue'
|
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 IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
||||||
|
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
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'
|
||||||
import { dealStatuses } from '@/utils'
|
|
||||||
import {
|
import {
|
||||||
|
dealStatuses,
|
||||||
|
dateFormat,
|
||||||
|
dateTooltipFormat,
|
||||||
|
timeAgo,
|
||||||
|
formatNumberIntoCurrency,
|
||||||
|
} from '@/utils'
|
||||||
|
import {
|
||||||
|
Avatar,
|
||||||
FeatherIcon,
|
FeatherIcon,
|
||||||
Dialog,
|
Dialog,
|
||||||
Button,
|
Button,
|
||||||
@ -72,17 +130,17 @@ import {
|
|||||||
createListResource,
|
createListResource,
|
||||||
createResource,
|
createResource,
|
||||||
Breadcrumbs,
|
Breadcrumbs,
|
||||||
|
ListView,
|
||||||
|
ListHeader,
|
||||||
|
ListRows,
|
||||||
|
ListRow,
|
||||||
|
ListRowItem,
|
||||||
|
ListSelectBanner,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { ref, computed, reactive, watch } from 'vue'
|
import { ref, computed, reactive, watch } from 'vue'
|
||||||
|
|
||||||
const list = {
|
const breadcrumbs = [{ label: 'Deals', route: { name: 'Deals' } }]
|
||||||
title: 'Deals',
|
|
||||||
plural_label: 'Deals',
|
|
||||||
singular_label: 'Deal',
|
|
||||||
}
|
|
||||||
|
|
||||||
const breadcrumbs = [{ label: list.title, route: { name: 'Deals' } }]
|
|
||||||
|
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
const { get: getOrderBy } = useOrderBy()
|
const { get: getOrderBy } = useOrderBy()
|
||||||
@ -144,44 +202,37 @@ const columns = [
|
|||||||
{
|
{
|
||||||
label: 'Organization',
|
label: 'Organization',
|
||||||
key: 'organization_name',
|
key: 'organization_name',
|
||||||
type: 'logo',
|
width: '11rem',
|
||||||
size: 'w-40',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Amount',
|
label: 'Amount',
|
||||||
key: 'annual_revenue',
|
key: 'annual_revenue',
|
||||||
type: 'currency',
|
width: '9rem',
|
||||||
size: 'w-32',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Status',
|
label: 'Status',
|
||||||
key: 'deal_status',
|
key: 'deal_status',
|
||||||
type: 'indicator',
|
width: '10rem',
|
||||||
size: 'w-36',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Email',
|
label: 'Email',
|
||||||
key: 'email',
|
key: 'email',
|
||||||
type: 'email',
|
width: '12rem',
|
||||||
size: 'w-44',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Mobile no',
|
label: 'Mobile no',
|
||||||
key: 'mobile_no',
|
key: 'mobile_no',
|
||||||
type: 'phone',
|
width: '11rem',
|
||||||
size: 'w-40',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Lead owner',
|
label: 'Lead owner',
|
||||||
key: 'lead_owner',
|
key: 'lead_owner',
|
||||||
type: 'avatar',
|
width: '10rem',
|
||||||
size: 'w-36',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Last modified',
|
label: 'Last modified',
|
||||||
key: 'modified',
|
key: 'modified',
|
||||||
type: 'pretty_date',
|
width: '8rem',
|
||||||
size: 'w-28',
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -193,15 +244,22 @@ const rows = computed(() => {
|
|||||||
label: lead.organization_name,
|
label: lead.organization_name,
|
||||||
logo: lead.organization_logo,
|
logo: lead.organization_logo,
|
||||||
},
|
},
|
||||||
annual_revenue: lead.annual_revenue,
|
annual_revenue: formatNumberIntoCurrency(lead.annual_revenue),
|
||||||
deal_status: {
|
deal_status: {
|
||||||
label: lead.deal_status,
|
label: lead.deal_status,
|
||||||
color: dealStatuses[lead.deal_status]?.color,
|
color: dealStatuses[lead.deal_status]?.color,
|
||||||
},
|
},
|
||||||
email: lead.email,
|
email: lead.email,
|
||||||
mobile_no: lead.mobile_no,
|
mobile_no: lead.mobile_no,
|
||||||
lead_owner: lead.lead_owner && getUser(lead.lead_owner),
|
lead_owner: {
|
||||||
modified: lead.modified,
|
label: lead.lead_owner && getUser(lead.lead_owner).full_name,
|
||||||
|
...(lead.lead_owner && getUser(lead.lead_owner)),
|
||||||
|
},
|
||||||
|
modified: {
|
||||||
|
label: dateFormat(lead.modified, dateTooltipFormat),
|
||||||
|
timeAgo: timeAgo(lead.modified),
|
||||||
|
},
|
||||||
|
route: { name: 'Deal', params: { dealId: lead.name } },
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user