fix: added icon for email/phone and formatted number to currency value in list view

This commit is contained in:
Shariq Ansari 2023-09-01 11:42:50 +05:30
parent 67480656a3
commit 142a583255
5 changed files with 33 additions and 7 deletions

View File

@ -13,7 +13,13 @@
</Tooltip> </Tooltip>
</template> </template>
<script setup> <script setup>
import { dateFormat, timeAgo, dateTooltipFormat, htmlToText } from '@/utils' import {
dateFormat,
timeAgo,
dateTooltipFormat,
htmlToText,
formatNumberIntoCurrency,
} from '@/utils'
import { Tooltip } from 'frappe-ui' import { Tooltip } from 'frappe-ui'
import { computed } from 'vue' import { computed } from 'vue'
@ -47,6 +53,9 @@ const label = computed(() => {
if (props.type === 'html') { if (props.type === 'html') {
return htmlToText(props.value?.toString()) return htmlToText(props.value?.toString())
} }
if (props.type === 'currency') {
return formatNumberIntoCurrency(props.value)
}
return props.value?.toString() return props.value?.toString()
}) })
</script> </script>

View File

@ -75,6 +75,12 @@
class="h-3 w-3" class="h-3 w-3"
/> />
</div> </div>
<div v-else-if="column.type === 'email'">
<FeatherIcon name="mail" class="h-3 w-3" />
</div>
<div v-else-if="column.type === 'phone'">
<FeatherIcon name="phone" class="h-3 w-3" />
</div>
</template> </template>
<div v-if="column.type === 'badge'"> <div v-if="column.type === 'badge'">
<Badge <Badge

View File

@ -147,7 +147,7 @@ const columns = [
{ {
label: 'Amount', label: 'Amount',
key: 'annual_revenue', key: 'annual_revenue',
type: 'data', type: 'currency',
size: 'w-24', size: 'w-24',
}, },
{ {
@ -166,7 +166,7 @@ const columns = [
label: 'Mobile no', label: 'Mobile no',
key: 'mobile_no', key: 'mobile_no',
type: 'phone', type: 'phone',
size: 'w-32', size: 'w-36',
}, },
{ {
label: 'Lead owner', label: 'Lead owner',

View File

@ -153,25 +153,25 @@ const columns = [
label: 'Organization', label: 'Organization',
key: 'organization_name', key: 'organization_name',
type: 'logo', type: 'logo',
size: 'w-40', size: 'w-36',
}, },
{ {
label: 'Status', label: 'Status',
key: 'status', key: 'status',
type: 'indicator', type: 'indicator',
size: 'w-36', size: 'w-32',
}, },
{ {
label: 'Email', label: 'Email',
key: 'email', key: 'email',
type: 'email', type: 'email',
size: 'w-40', size: 'w-44',
}, },
{ {
label: 'Mobile no', label: 'Mobile no',
key: 'mobile_no', key: 'mobile_no',
type: 'phone', type: 'phone',
size: 'w-32', size: 'w-36',
}, },
{ {
label: 'Lead owner', label: 'Lead owner',

View File

@ -122,3 +122,14 @@ export function secondsToDuration(seconds) {
} }
return `${hours}h ${minutes}m ${_seconds}s` return `${hours}h ${minutes}m ${_seconds}s`
} }
export function formatNumberIntoCurrency(value) {
if (value) {
return value.toLocaleString('en-IN', {
maximumFractionDigits: 2,
style: 'currency',
currency: 'INR',
})
}
return ''
}