From 90bf761eb35357816a79bd8b70a6598b1c052cd0 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 25 Dec 2024 18:50:34 +0530 Subject: [PATCH] feat: show formatted float fields in all listviews --- frontend/src/pages/Contact.vue | 1 + frontend/src/pages/Contacts.vue | 6 +++++- frontend/src/pages/Deals.vue | 6 +++++- frontend/src/pages/EmailTemplates.vue | 6 +++++- frontend/src/pages/Leads.vue | 6 +++++- frontend/src/pages/MobileContact.vue | 1 + frontend/src/pages/MobileOrganization.vue | 3 ++- frontend/src/pages/Organization.vue | 3 ++- frontend/src/pages/Organizations.vue | 6 +++++- frontend/src/pages/Tasks.vue | 6 +++++- frontend/src/utils/callLog.js | 6 +++++- 11 files changed, 41 insertions(+), 9 deletions(-) diff --git a/frontend/src/pages/Contact.vue b/frontend/src/pages/Contact.vue index 2a982136..659f6711 100644 --- a/frontend/src/pages/Contact.vue +++ b/frontend/src/pages/Contact.vue @@ -636,6 +636,7 @@ const dealColumns = [ { label: __('Amount'), key: 'annual_revenue', + align: 'right', width: '9rem', }, { diff --git a/frontend/src/pages/Contacts.vue b/frontend/src/pages/Contacts.vue index 172d2565..7f94e15c 100644 --- a/frontend/src/pages/Contacts.vue +++ b/frontend/src/pages/Contacts.vue @@ -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, diff --git a/frontend/src/pages/Deals.vue b/frontend/src/pages/Deals.vue index 3f6f4e68..a445776f 100644 --- a/frontend/src/pages/Deals.vue +++ b/frontend/src/pages/Deals.vue @@ -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, diff --git a/frontend/src/pages/EmailTemplates.vue b/frontend/src/pages/EmailTemplates.vue index cdbc14ee..b77f7e77 100644 --- a/frontend/src/pages/EmailTemplates.vue +++ b/frontend/src/pages/EmailTemplates.vue @@ -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]), diff --git a/frontend/src/pages/Leads.vue b/frontend/src/pages/Leads.vue index d08d5758..9c8fc455 100644 --- a/frontend/src/pages/Leads.vue +++ b/frontend/src/pages/Leads.vue @@ -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, diff --git a/frontend/src/pages/MobileContact.vue b/frontend/src/pages/MobileContact.vue index 41fb08d1..ca08c833 100644 --- a/frontend/src/pages/MobileContact.vue +++ b/frontend/src/pages/MobileContact.vue @@ -616,6 +616,7 @@ const dealColumns = [ { label: __('Amount'), key: 'annual_revenue', + align: 'right', width: '9rem', }, { diff --git a/frontend/src/pages/MobileOrganization.vue b/frontend/src/pages/MobileOrganization.vue index abf52307..0a06f695 100644 --- a/frontend/src/pages/MobileOrganization.vue +++ b/frontend/src/pages/MobileOrganization.vue @@ -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', }, { diff --git a/frontend/src/pages/Organization.vue b/frontend/src/pages/Organization.vue index 011e8da9..831a5b2a 100644 --- a/frontend/src/pages/Organization.vue +++ b/frontend/src/pages/Organization.vue @@ -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', }, { diff --git a/frontend/src/pages/Organizations.vue b/frontend/src/pages/Organizations.vue index 5db5a8c3..81ff99fe 100644 --- a/frontend/src/pages/Organizations.vue +++ b/frontend/src/pages/Organizations.vue @@ -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, diff --git a/frontend/src/pages/Tasks.vue b/frontend/src/pages/Tasks.vue index 1d892c7a..b25e4c1c 100644 --- a/frontend/src/pages/Tasks.vue +++ b/frontend/src/pages/Tasks.vue @@ -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]), diff --git a/frontend/src/utils/callLog.js b/frontend/src/utils/callLog.js index 35388c20..a3ef761a 100644 --- a/frontend/src/utils/callLog.js +++ b/frontend/src/utils/callLog.js @@ -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] }