1
0
forked from test/crm

fix: show sla details on lead list view

This commit is contained in:
Shariq Ansari 2023-12-11 12:35:35 +05:30
parent 08c766c4cd
commit ab92d96221
3 changed files with 49 additions and 2 deletions

View File

@ -215,6 +215,9 @@ class CRMLead(Document):
"mobile_no", "mobile_no",
"lead_owner", "lead_owner",
"first_name", "first_name",
"sla_status",
"first_response_time",
"first_responded_on",
"modified", "modified",
"image", "image",
] ]

View File

@ -53,9 +53,31 @@
<PhoneIcon class="h-4 w-4" /> <PhoneIcon class="h-4 w-4" />
</div> </div>
</template> </template>
<div v-if="['modified', 'creation'].includes(column.key)" class="truncate text-base"> <div
v-if="
[
'modified',
'creation',
'first_response_time',
'first_responded_on',
].includes(column.key)
"
class="truncate text-base"
>
{{ item.timeAgo }} {{ item.timeAgo }}
</div> </div>
<div
v-else-if="column.key === 'sla_status'"
class="truncate text-base"
>
<Badge
v-if="item.label"
:variant="'subtle'"
:theme="item.color"
size="md"
:label="item.label"
/>
</div>
<div v-else-if="column.type === 'Check'"> <div v-else-if="column.type === 'Check'">
<FormControl <FormControl
type="checkbox" type="checkbox"
@ -83,6 +105,7 @@ import {
ListSelectBanner, ListSelectBanner,
ListRowItem, ListRowItem,
FormControl, FormControl,
Badge,
} from 'frappe-ui' } from 'frappe-ui'
const props = defineProps({ const props = defineProps({

View File

@ -65,7 +65,7 @@ import { statusesStore } from '@/stores/statuses'
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 { dateFormat, dateTooltipFormat, timeAgo } from '@/utils' import { dateFormat, dateTooltipFormat, timeAgo, formatTime } from '@/utils'
import { import {
FeatherIcon, FeatherIcon,
Dialog, Dialog,
@ -154,6 +154,16 @@ const rows = computed(() => {
label: lead.status, label: lead.status,
color: getLeadStatus(lead.status)?.iconColorClass, color: getLeadStatus(lead.status)?.iconColorClass,
} }
} else if (row == 'sla_status') {
_rows[row] = {
label: lead.sla_status,
color:
lead.sla_status === 'Failed'
? 'red'
: lead.sla_status === 'Fulfilled'
? 'green'
: 'gray',
}
} else if (row == 'lead_owner') { } else if (row == 'lead_owner') {
_rows[row] = { _rows[row] = {
label: lead.lead_owner && getUser(lead.lead_owner).full_name, label: lead.lead_owner && getUser(lead.lead_owner).full_name,
@ -164,6 +174,17 @@ const rows = computed(() => {
label: dateFormat(lead[row], dateTooltipFormat), label: dateFormat(lead[row], dateTooltipFormat),
timeAgo: timeAgo(lead[row]), timeAgo: timeAgo(lead[row]),
} }
} else if (['first_response_time', 'first_responded_on'].includes(row)) {
_rows[row] = {
label: lead.first_responded_on
? dateFormat(lead.first_responded_on, dateTooltipFormat)
: '',
timeAgo: lead[row]
? row == 'first_responded_on'
? timeAgo(lead[row])
: formatTime(lead[row])
: '',
}
} }
}) })
return _rows return _rows