Skip to content

Commit

Permalink
fix: added icon for email/phone and formatted number to currency valu…
Browse files Browse the repository at this point in the history
…e in list view
  • Loading branch information
shariquerik committed Sep 1, 2023
1 parent 6748065 commit 142a583
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
11 changes: 10 additions & 1 deletion frontend/src/components/ListRowItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
</Tooltip>
</template>
<script setup>
import { dateFormat, timeAgo, dateTooltipFormat, htmlToText } from '@/utils'
import {
dateFormat,
timeAgo,
dateTooltipFormat,
htmlToText,
formatNumberIntoCurrency,
} from '@/utils'
import { Tooltip } from 'frappe-ui'
import { computed } from 'vue'
Expand Down Expand Up @@ -47,6 +53,9 @@ const label = computed(() => {
if (props.type === 'html') {
return htmlToText(props.value?.toString())
}
if (props.type === 'currency') {
return formatNumberIntoCurrency(props.value)
}
return props.value?.toString()
})
</script>
6 changes: 6 additions & 0 deletions frontend/src/components/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
class="h-3 w-3"
/>
</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>
<div v-if="column.type === 'badge'">
<Badge
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/Deals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const columns = [
{
label: 'Amount',
key: 'annual_revenue',
type: 'data',
type: 'currency',
size: 'w-24',
},
{
Expand All @@ -166,7 +166,7 @@ const columns = [
label: 'Mobile no',
key: 'mobile_no',
type: 'phone',
size: 'w-32',
size: 'w-36',
},
{
label: 'Lead owner',
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/Leads.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,25 +153,25 @@ const columns = [
label: 'Organization',
key: 'organization_name',
type: 'logo',
size: 'w-40',
size: 'w-36',
},
{
label: 'Status',
key: 'status',
type: 'indicator',
size: 'w-36',
size: 'w-32',
},
{
label: 'Email',
key: 'email',
type: 'email',
size: 'w-40',
size: 'w-44',
},
{
label: 'Mobile no',
key: 'mobile_no',
type: 'phone',
size: 'w-32',
size: 'w-36',
},
{
label: 'Lead owner',
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,14 @@ export function secondsToDuration(seconds) {
}
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 ''
}

0 comments on commit 142a583

Please sign in to comment.