fix: replaced call logs listview with frappeui listview component
This commit is contained in:
parent
9d64d52309
commit
ec6f2210ce
@ -17,30 +17,86 @@
|
|||||||
<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="['caller', 'receiver'].includes(column.key)">
|
||||||
|
<Avatar
|
||||||
|
v-if="item.label"
|
||||||
|
class="flex items-center"
|
||||||
|
:image="item.image"
|
||||||
|
:label="item.label"
|
||||||
|
size="sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="['type', 'duration'].includes(column.key)">
|
||||||
|
<FeatherIcon :name="item.icon" class="h-3 w-3" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div v-if="column.key === 'creation'" class="truncate text-base">
|
||||||
|
{{ item.timeAgo }}
|
||||||
|
</div>
|
||||||
|
<div v-else-if="column.key === 'status'" class="truncate text-base">
|
||||||
|
<Badge
|
||||||
|
:variant="'subtle'"
|
||||||
|
:theme="item.color"
|
||||||
|
size="md"
|
||||||
|
:label="item.label"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</ListRowItem>
|
||||||
|
</ListRow>
|
||||||
|
</ListRows>
|
||||||
|
<ListSelectBanner />
|
||||||
|
</ListView>
|
||||||
</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 SortIcon from '@/components/Icons/SortIcon.vue'
|
import SortIcon from '@/components/Icons/SortIcon.vue'
|
||||||
import FilterIcon from '@/components/Icons/FilterIcon.vue'
|
import FilterIcon from '@/components/Icons/FilterIcon.vue'
|
||||||
import { secondsToDuration } from '@/utils'
|
import {
|
||||||
|
secondsToDuration,
|
||||||
|
dateFormat,
|
||||||
|
dateTooltipFormat,
|
||||||
|
timeAgo,
|
||||||
|
} from '@/utils'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { contactsStore } from '@/stores/contacts'
|
import { contactsStore } from '@/stores/contacts'
|
||||||
import { Button, createListResource, Breadcrumbs } from 'frappe-ui'
|
import {
|
||||||
|
Avatar,
|
||||||
|
Badge,
|
||||||
|
createListResource,
|
||||||
|
Breadcrumbs,
|
||||||
|
ListView,
|
||||||
|
ListHeader,
|
||||||
|
ListRows,
|
||||||
|
ListRow,
|
||||||
|
ListRowItem,
|
||||||
|
ListSelectBanner,
|
||||||
|
FeatherIcon,
|
||||||
|
} from 'frappe-ui'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
const { getContact } = contactsStore()
|
const { getContact } = contactsStore()
|
||||||
|
|
||||||
const list = {
|
const breadcrumbs = [{ label: 'Call Logs', route: { name: 'Call Logs' } }]
|
||||||
title: 'Call Logs',
|
|
||||||
plural_label: 'Call Logs',
|
|
||||||
singular_label: 'Call Log',
|
|
||||||
}
|
|
||||||
|
|
||||||
const breadcrumbs = [{ label: list.title, route: { name: 'Call Logs' } }]
|
|
||||||
|
|
||||||
const callLogs = createListResource({
|
const callLogs = createListResource({
|
||||||
type: 'list',
|
type: 'list',
|
||||||
@ -69,50 +125,42 @@ const columns = [
|
|||||||
{
|
{
|
||||||
label: 'From',
|
label: 'From',
|
||||||
key: 'caller',
|
key: 'caller',
|
||||||
type: 'avatar',
|
width: '9rem',
|
||||||
size: 'w-32',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'To',
|
label: 'To',
|
||||||
key: 'receiver',
|
key: 'receiver',
|
||||||
type: 'avatar',
|
width: '9rem',
|
||||||
size: 'w-32',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
key: 'type',
|
key: 'type',
|
||||||
type: 'icon',
|
width: '9rem',
|
||||||
size: 'w-32',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Status',
|
label: 'Status',
|
||||||
key: 'status',
|
key: 'status',
|
||||||
type: 'badge',
|
width: '9rem',
|
||||||
size: 'w-32',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Duration',
|
label: 'Duration',
|
||||||
key: 'duration',
|
key: 'duration',
|
||||||
type: 'icon',
|
width: '6rem',
|
||||||
size: 'w-20',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'From (number)',
|
label: 'From (number)',
|
||||||
key: 'from',
|
key: 'from',
|
||||||
type: 'data',
|
width: '9rem',
|
||||||
size: 'w-32',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'To (number)',
|
label: 'To (number)',
|
||||||
key: 'to',
|
key: 'to',
|
||||||
type: 'data',
|
width: '9rem',
|
||||||
size: 'w-32',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Created on',
|
label: 'Created on',
|
||||||
key: 'creation',
|
key: 'creation',
|
||||||
type: 'pretty_date',
|
width: '8rem',
|
||||||
size: 'w-28',
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -159,7 +207,11 @@ const rows = computed(() => {
|
|||||||
label: callLog.status,
|
label: callLog.status,
|
||||||
color: callLog.status === 'Completed' ? 'green' : 'gray',
|
color: callLog.status === 'Completed' ? 'green' : 'gray',
|
||||||
},
|
},
|
||||||
creation: callLog.creation,
|
creation: {
|
||||||
|
label: dateFormat(callLog.creation, dateTooltipFormat),
|
||||||
|
timeAgo: timeAgo(callLog.creation),
|
||||||
|
},
|
||||||
|
route: { name: 'Call Log', params: { callLogId: callLog.name } },
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user