feat: show formatted float fields in all listviews

This commit is contained in:
Shariq Ansari 2024-12-25 18:50:34 +05:30
parent 538885cffb
commit 90bf761eb3
11 changed files with 41 additions and 9 deletions

View File

@ -636,6 +636,7 @@ const dealColumns = [
{
label: __('Amount'),
key: 'annual_revenue',
align: 'right',
width: '9rem',
},
{

View File

@ -75,7 +75,7 @@ import { organizationsStore } from '@/stores/organizations.js'
import { formatDate, timeAgo } from '@/utils'
import { ref, computed } from 'vue'
const { getFormattedCurrency } = getMeta('Contact')
const { getFormattedFloat, getFormattedCurrency } = getMeta('Contact')
const { getOrganization } = organizationsStore()
const showContactModal = ref(false)
@ -116,6 +116,10 @@ const rows = computed(() => {
_rows[row] = getFormattedCurrency(row, contact)
}
if (fieldType && fieldType == 'Float') {
_rows[row] = getFormattedFloat(row, contact)
}
if (row == 'full_name') {
_rows[row] = {
label: contact.full_name,

View File

@ -292,7 +292,7 @@ import { Tooltip, Avatar, Dropdown } from 'frappe-ui'
import { useRoute } from 'vue-router'
import { ref, reactive, computed, h } from 'vue'
const { getFormattedCurrency } = getMeta('CRM Deal')
const { getFormattedFloat, getFormattedCurrency } = getMeta('CRM Deal')
const { makeCall } = globalStore()
const { getUser } = usersStore()
const { getOrganization } = organizationsStore()
@ -402,6 +402,10 @@ function parseRows(rows, columns = []) {
_rows[row] = getFormattedCurrency(row, deal)
}
if (fieldType && fieldType == 'Float') {
_rows[row] = getFormattedFloat(row, deal)
}
if (row == 'organization') {
_rows[row] = {
label: deal.organization,

View File

@ -79,7 +79,7 @@ import { getMeta } from '@/stores/meta'
import { formatDate, timeAgo } from '@/utils'
import { computed, ref } from 'vue'
const { getFormattedCurrency } = getMeta('Email Template')
const { getFormattedFloat, getFormattedCurrency } = getMeta('Email Template')
const emailTemplatesListView = ref(null)
@ -122,6 +122,10 @@ const rows = computed(() => {
_rows[row] = getFormattedCurrency(row, emailTemplate)
}
if (fieldType && fieldType == 'Float') {
_rows[row] = getFormattedFloat(row, emailTemplate)
}
if (['modified', 'creation'].includes(row)) {
_rows[row] = {
label: formatDate(emailTemplate[row]),

View File

@ -313,7 +313,7 @@ import { Avatar, Tooltip, Dropdown } from 'frappe-ui'
import { useRoute } from 'vue-router'
import { ref, computed, reactive, h } from 'vue'
const { getFormattedCurrency } = getMeta('CRM Lead')
const { getFormattedFloat, getFormattedCurrency } = getMeta('CRM Lead')
const { makeCall } = globalStore()
const { getUser } = usersStore()
const { getLeadStatus } = statusesStore()
@ -422,6 +422,10 @@ function parseRows(rows, columns = []) {
_rows[row] = getFormattedCurrency(row, lead)
}
if (fieldType && fieldType == 'Float') {
_rows[row] = getFormattedFloat(row, lead)
}
if (row == 'lead_name') {
_rows[row] = {
label: lead.lead_name,

View File

@ -616,6 +616,7 @@ const dealColumns = [
{
label: __('Amount'),
key: 'annual_revenue',
align: 'right',
width: '9rem',
},
{

View File

@ -481,7 +481,7 @@ function getContactRowObject(contact) {
mobile_no: contact.mobile_no,
company_name: {
label: contact.company_name,
logo: props.organization?.organization_logo,
logo: organization.doc?.organization_logo,
},
modified: {
label: formatDate(contact.modified),
@ -499,6 +499,7 @@ const dealColumns = [
{
label: __('Amount'),
key: 'annual_revenue',
align: 'right',
width: '9rem',
},
{

View File

@ -516,7 +516,7 @@ function getContactRowObject(contact) {
mobile_no: contact.mobile_no,
company_name: {
label: contact.company_name,
logo: props.organization?.organization_logo,
logo: organization.doc?.organization_logo,
},
modified: {
label: formatDate(contact.modified),
@ -534,6 +534,7 @@ const dealColumns = [
{
label: __('Amount'),
key: 'annual_revenue',
align: 'right',
width: '9rem',
},
{

View File

@ -73,7 +73,7 @@ import { getMeta } from '@/stores/meta'
import { formatDate, timeAgo, website } from '@/utils'
import { ref, computed } from 'vue'
const { getFormattedCurrency } = getMeta('CRM Organization')
const { getFormattedFloat, getFormattedCurrency } = getMeta('CRM Organization')
const organizationsListView = ref(null)
const showOrganizationModal = ref(false)
@ -117,6 +117,10 @@ const rows = computed(() => {
_rows[row] = getFormattedCurrency(row, organization)
}
if (fieldType && fieldType == 'Float') {
_rows[row] = getFormattedFloat(row, organization)
}
if (row === 'organization_name') {
_rows[row] = {
label: organization.organization_name,

View File

@ -211,7 +211,7 @@ import { Tooltip, Avatar, TextEditor, Dropdown, call } from 'frappe-ui'
import { computed, ref } from 'vue'
import { useRouter } from 'vue-router'
const { getFormattedCurrency } = getMeta('CRM Task')
const { getFormattedFloat, getFormattedCurrency } = getMeta('CRM Task')
const { getUser } = usersStore()
const router = useRouter()
@ -277,6 +277,10 @@ function parseRows(rows, columns = []) {
_rows[row] = getFormattedCurrency(row, task)
}
if (fieldType && fieldType == 'Float') {
_rows[row] = getFormattedFloat(row, task)
}
if (['modified', 'creation'].includes(row)) {
_rows[row] = {
label: formatDate(task[row]),

View File

@ -3,7 +3,7 @@ import { getMeta } from '@/stores/meta'
import { usersStore } from '@/stores/users'
import { contactsStore } from '@/stores/contacts'
const { getFormattedCurrency } = getMeta('CRM Call Log')
const { getFormattedFloat, getFormattedCurrency } = getMeta('CRM Call Log')
const { getUser } = usersStore()
const { getContact, getLeadContact } = contactsStore()
@ -64,6 +64,10 @@ export function getCallLogDetail(row, log, columns = []) {
return getFormattedCurrency(row, log)
}
if (fieldType && fieldType == 'Float') {
return getFormattedFloat(row, log)
}
return log[row]
}