diff --git a/frontend/src/components/FieldLayout.vue b/frontend/src/components/FieldLayout.vue index 6fbd07af..0585e42c 100644 --- a/frontend/src/components/FieldLayout.vue +++ b/frontend/src/components/FieldLayout.vue @@ -190,6 +190,14 @@ :placeholder="getPlaceholder(field)" v-model="data[field.name]" /> + !props.tabs[0].no_tabs) diff --git a/frontend/src/components/SidePanelLayout.vue b/frontend/src/components/SidePanelLayout.vue index e919ae46..788f7dd1 100644 --- a/frontend/src/components/SidePanelLayout.vue +++ b/frontend/src/components/SidePanelLayout.vue @@ -168,6 +168,15 @@ @change="(data) => emit('update', field.name, data)" /> + { _rows[row] = getFormattedFloat(row, contact) } + if (fieldType && fieldType == 'Percent') { + _rows[row] = getFormattedPercent(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 a445776f..8afcdfe9 100644 --- a/frontend/src/pages/Deals.vue +++ b/frontend/src/pages/Deals.vue @@ -292,7 +292,8 @@ import { Tooltip, Avatar, Dropdown } from 'frappe-ui' import { useRoute } from 'vue-router' import { ref, reactive, computed, h } from 'vue' -const { getFormattedFloat, getFormattedCurrency } = getMeta('CRM Deal') +const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } = + getMeta('CRM Deal') const { makeCall } = globalStore() const { getUser } = usersStore() const { getOrganization } = organizationsStore() @@ -406,6 +407,10 @@ function parseRows(rows, columns = []) { _rows[row] = getFormattedFloat(row, deal) } + if (fieldType && fieldType == 'Percent') { + _rows[row] = getFormattedPercent(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 b77f7e77..4ab8e0dc 100644 --- a/frontend/src/pages/EmailTemplates.vue +++ b/frontend/src/pages/EmailTemplates.vue @@ -79,7 +79,8 @@ import { getMeta } from '@/stores/meta' import { formatDate, timeAgo } from '@/utils' import { computed, ref } from 'vue' -const { getFormattedFloat, getFormattedCurrency } = getMeta('Email Template') +const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } = + getMeta('Email Template') const emailTemplatesListView = ref(null) @@ -126,6 +127,10 @@ const rows = computed(() => { _rows[row] = getFormattedFloat(row, emailTemplate) } + if (fieldType && fieldType == 'Percent') { + _rows[row] = getFormattedPercent(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 9c8fc455..c6884feb 100644 --- a/frontend/src/pages/Leads.vue +++ b/frontend/src/pages/Leads.vue @@ -313,7 +313,8 @@ import { Avatar, Tooltip, Dropdown } from 'frappe-ui' import { useRoute } from 'vue-router' import { ref, computed, reactive, h } from 'vue' -const { getFormattedFloat, getFormattedCurrency } = getMeta('CRM Lead') +const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } = + getMeta('CRM Lead') const { makeCall } = globalStore() const { getUser } = usersStore() const { getLeadStatus } = statusesStore() @@ -426,6 +427,10 @@ function parseRows(rows, columns = []) { _rows[row] = getFormattedFloat(row, lead) } + if (fieldType && fieldType == 'Percent') { + _rows[row] = getFormattedPercent(row, lead) + } + if (row == 'lead_name') { _rows[row] = { label: lead.lead_name, diff --git a/frontend/src/pages/Organizations.vue b/frontend/src/pages/Organizations.vue index 81ff99fe..4853d096 100644 --- a/frontend/src/pages/Organizations.vue +++ b/frontend/src/pages/Organizations.vue @@ -73,7 +73,8 @@ import { getMeta } from '@/stores/meta' import { formatDate, timeAgo, website } from '@/utils' import { ref, computed } from 'vue' -const { getFormattedFloat, getFormattedCurrency } = getMeta('CRM Organization') +const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } = + getMeta('CRM Organization') const organizationsListView = ref(null) const showOrganizationModal = ref(false) @@ -121,6 +122,10 @@ const rows = computed(() => { _rows[row] = getFormattedFloat(row, organization) } + if (fieldType && fieldType == 'Percent') { + _rows[row] = getFormattedPercent(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 b25e4c1c..69662d9e 100644 --- a/frontend/src/pages/Tasks.vue +++ b/frontend/src/pages/Tasks.vue @@ -211,7 +211,8 @@ import { Tooltip, Avatar, TextEditor, Dropdown, call } from 'frappe-ui' import { computed, ref } from 'vue' import { useRouter } from 'vue-router' -const { getFormattedFloat, getFormattedCurrency } = getMeta('CRM Task') +const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } = + getMeta('CRM Task') const { getUser } = usersStore() const router = useRouter() @@ -281,6 +282,10 @@ function parseRows(rows, columns = []) { _rows[row] = getFormattedFloat(row, task) } + if (fieldType && fieldType == 'Percent') { + _rows[row] = getFormattedPercent(row, task) + } + if (['modified', 'creation'].includes(row)) { _rows[row] = { label: formatDate(task[row]), diff --git a/frontend/src/stores/meta.js b/frontend/src/stores/meta.js index dfcdcb29..af235059 100644 --- a/frontend/src/stores/meta.js +++ b/frontend/src/stores/meta.js @@ -25,6 +25,11 @@ export function getMeta(doctype) { meta.fetch() } + function getFormattedPercent(fieldname, doc) { + let value = getFormattedFloat(fieldname, doc) + return value + '%' + } + function getFormattedFloat(fieldname, doc) { let df = doctypeMeta[doctype]?.fields.find((f) => f.fieldname == fieldname) let precision = df?.precision || null @@ -51,6 +56,7 @@ export function getMeta(doctype) { meta, doctypeMeta, getFormattedFloat, + getFormattedPercent, getFormattedCurrency, } } diff --git a/frontend/src/utils/callLog.js b/frontend/src/utils/callLog.js index a3ef761a..ac10e74d 100644 --- a/frontend/src/utils/callLog.js +++ b/frontend/src/utils/callLog.js @@ -3,7 +3,8 @@ import { getMeta } from '@/stores/meta' import { usersStore } from '@/stores/users' import { contactsStore } from '@/stores/contacts' -const { getFormattedFloat, getFormattedCurrency } = getMeta('CRM Call Log') +const { getFormattedPercent, getFormattedFloat, getFormattedCurrency } = + getMeta('CRM Call Log') const { getUser } = usersStore() const { getContact, getLeadContact } = contactsStore() @@ -68,6 +69,10 @@ export function getCallLogDetail(row, log, columns = []) { return getFormattedFloat(row, log) } + if (fieldType && fieldType == 'Percent') { + return getFormattedPercent(row, log) + } + return log[row] }