feat: show formatted currency fields in all list views
This commit is contained in:
parent
fb2303edf1
commit
9b8662de14
@ -211,13 +211,9 @@ import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
||||
import DealsListView from '@/components/ListViews/DealsListView.vue'
|
||||
import SidePanelModal from '@/components/Modals/SidePanelModal.vue'
|
||||
import AddressModal from '@/components/Modals/AddressModal.vue'
|
||||
import {
|
||||
formatDate,
|
||||
timeAgo,
|
||||
formatNumberIntoCurrency,
|
||||
createToast,
|
||||
} from '@/utils'
|
||||
import { formatDate, timeAgo, createToast } from '@/utils'
|
||||
import { getView } from '@/utils/view'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { globalStore } from '@/stores/global.js'
|
||||
import { usersStore } from '@/stores/users.js'
|
||||
import { organizationsStore } from '@/stores/organizations.js'
|
||||
@ -601,6 +597,8 @@ async function updateField(fieldname, value) {
|
||||
contact.reload()
|
||||
}
|
||||
|
||||
const { getFormattedCurrency } = getMeta('CRM Deal')
|
||||
|
||||
const columns = computed(() => dealColumns)
|
||||
|
||||
function getDealRowObject(deal) {
|
||||
@ -610,10 +608,7 @@ function getDealRowObject(deal) {
|
||||
label: deal.organization,
|
||||
logo: getOrganization(deal.organization)?.organization_logo,
|
||||
},
|
||||
annual_revenue: formatNumberIntoCurrency(
|
||||
deal.annual_revenue,
|
||||
deal.currency,
|
||||
),
|
||||
annual_revenue: getFormattedCurrency('annual_revenue', deal),
|
||||
status: {
|
||||
label: deal.status,
|
||||
color: getDealStatus(deal.status)?.iconColorClass,
|
||||
|
||||
@ -70,10 +70,12 @@ import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||
import ContactModal from '@/components/Modals/ContactModal.vue'
|
||||
import ContactsListView from '@/components/ListViews/ContactsListView.vue'
|
||||
import ViewControls from '@/components/ViewControls.vue'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { organizationsStore } from '@/stores/organizations.js'
|
||||
import { formatDate, timeAgo } from '@/utils'
|
||||
import { ref, computed } from 'vue'
|
||||
|
||||
const { getFormattedCurrency } = getMeta('Contact')
|
||||
const { getOrganization } = organizationsStore()
|
||||
|
||||
const showContactModal = ref(false)
|
||||
@ -110,6 +112,10 @@ const rows = computed(() => {
|
||||
_rows[row] = formatDate(contact[row], '', true, fieldType == 'Datetime')
|
||||
}
|
||||
|
||||
if (fieldType && fieldType == 'Currency') {
|
||||
_rows[row] = getFormattedCurrency(row, contact)
|
||||
}
|
||||
|
||||
if (row == 'full_name') {
|
||||
_rows[row] = {
|
||||
label: contact.full_name,
|
||||
|
||||
@ -281,22 +281,18 @@ import NoteModal from '@/components/Modals/NoteModal.vue'
|
||||
import TaskModal from '@/components/Modals/TaskModal.vue'
|
||||
import QuickEntryModal from '@/components/Modals/QuickEntryModal.vue'
|
||||
import ViewControls from '@/components/ViewControls.vue'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { globalStore } from '@/stores/global'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { organizationsStore } from '@/stores/organizations'
|
||||
import { statusesStore } from '@/stores/statuses'
|
||||
import { callEnabled } from '@/composables/settings'
|
||||
import {
|
||||
formatDate,
|
||||
timeAgo,
|
||||
website,
|
||||
formatNumberIntoCurrency,
|
||||
formatTime,
|
||||
} from '@/utils'
|
||||
import { formatDate, timeAgo, website, formatTime } from '@/utils'
|
||||
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 { makeCall } = globalStore()
|
||||
const { getUser } = usersStore()
|
||||
const { getOrganization } = organizationsStore()
|
||||
@ -402,6 +398,10 @@ function parseRows(rows, columns = []) {
|
||||
_rows[row] = formatDate(deal[row], '', true, fieldType == 'Datetime')
|
||||
}
|
||||
|
||||
if (fieldType && fieldType == 'Currency') {
|
||||
_rows[row] = getFormattedCurrency(row, deal)
|
||||
}
|
||||
|
||||
if (row == 'organization') {
|
||||
_rows[row] = {
|
||||
label: deal.organization,
|
||||
@ -409,11 +409,6 @@ function parseRows(rows, columns = []) {
|
||||
}
|
||||
} else if (row === 'website') {
|
||||
_rows[row] = website(deal.website)
|
||||
} else if (row == 'annual_revenue') {
|
||||
_rows[row] = formatNumberIntoCurrency(
|
||||
deal.annual_revenue,
|
||||
deal.currency,
|
||||
)
|
||||
} else if (row == 'status') {
|
||||
_rows[row] = {
|
||||
label: deal.status,
|
||||
|
||||
@ -75,9 +75,12 @@ import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||
import ViewControls from '@/components/ViewControls.vue'
|
||||
import EmailTemplatesListView from '@/components/ListViews/EmailTemplatesListView.vue'
|
||||
import EmailTemplateModal from '@/components/Modals/EmailTemplateModal.vue'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { formatDate, timeAgo } from '@/utils'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
const { getFormattedCurrency } = getMeta('Email Template')
|
||||
|
||||
const emailTemplatesListView = ref(null)
|
||||
|
||||
// emailTemplates data is loaded in the ViewControls component
|
||||
@ -115,6 +118,10 @@ const rows = computed(() => {
|
||||
)
|
||||
}
|
||||
|
||||
if (fieldType && fieldType == 'Currency') {
|
||||
_rows[row] = getFormattedCurrency(row, emailTemplate)
|
||||
}
|
||||
|
||||
if (['modified', 'creation'].includes(row)) {
|
||||
_rows[row] = {
|
||||
label: formatDate(emailTemplate[row]),
|
||||
|
||||
@ -303,6 +303,7 @@ import NoteModal from '@/components/Modals/NoteModal.vue'
|
||||
import TaskModal from '@/components/Modals/TaskModal.vue'
|
||||
import QuickEntryModal from '@/components/Modals/QuickEntryModal.vue'
|
||||
import ViewControls from '@/components/ViewControls.vue'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { globalStore } from '@/stores/global'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { statusesStore } from '@/stores/statuses'
|
||||
@ -312,6 +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 { makeCall } = globalStore()
|
||||
const { getUser } = usersStore()
|
||||
const { getLeadStatus } = statusesStore()
|
||||
@ -416,6 +418,10 @@ function parseRows(rows, columns = []) {
|
||||
_rows[row] = formatDate(lead[row], '', true, fieldType == 'Datetime')
|
||||
}
|
||||
|
||||
if (fieldType && fieldType == 'Currency') {
|
||||
_rows[row] = getFormattedCurrency(row, lead)
|
||||
}
|
||||
|
||||
if (row == 'lead_name') {
|
||||
_rows[row] = {
|
||||
label: lead.lead_name,
|
||||
|
||||
@ -186,13 +186,9 @@ import CameraIcon from '@/components/Icons/CameraIcon.vue'
|
||||
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
||||
import DealsListView from '@/components/ListViews/DealsListView.vue'
|
||||
import AddressModal from '@/components/Modals/AddressModal.vue'
|
||||
import {
|
||||
formatDate,
|
||||
timeAgo,
|
||||
formatNumberIntoCurrency,
|
||||
createToast,
|
||||
} from '@/utils'
|
||||
import { formatDate, timeAgo, createToast } from '@/utils'
|
||||
import { getView } from '@/utils/view'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { globalStore } from '@/stores/global.js'
|
||||
import { usersStore } from '@/stores/users.js'
|
||||
import { organizationsStore } from '@/stores/organizations.js'
|
||||
@ -581,6 +577,8 @@ async function updateField(fieldname, value) {
|
||||
contact.reload()
|
||||
}
|
||||
|
||||
const { getFormattedCurrency } = getMeta('CRM Deal')
|
||||
|
||||
const columns = computed(() => dealColumns)
|
||||
|
||||
function getDealRowObject(deal) {
|
||||
@ -590,10 +588,7 @@ function getDealRowObject(deal) {
|
||||
label: deal.organization,
|
||||
logo: getOrganization(deal.organization)?.organization_logo,
|
||||
},
|
||||
annual_revenue: formatNumberIntoCurrency(
|
||||
deal.annual_revenue,
|
||||
deal.currency,
|
||||
),
|
||||
annual_revenue: getFormattedCurrency('annual_revenue', deal),
|
||||
status: {
|
||||
label: deal.status,
|
||||
color: getDealStatus(deal.status)?.iconColorClass,
|
||||
|
||||
@ -176,16 +176,12 @@ import DetailsIcon from '@/components/Icons/DetailsIcon.vue'
|
||||
import CameraIcon from '@/components/Icons/CameraIcon.vue'
|
||||
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
||||
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { globalStore } from '@/stores/global'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { statusesStore } from '@/stores/statuses'
|
||||
import { getView } from '@/utils/view'
|
||||
import {
|
||||
formatDate,
|
||||
timeAgo,
|
||||
formatNumberIntoCurrency,
|
||||
createToast,
|
||||
} from '@/utils'
|
||||
import { formatDate, timeAgo, createToast } from '@/utils'
|
||||
import {
|
||||
Breadcrumbs,
|
||||
Avatar,
|
||||
@ -441,6 +437,8 @@ const rows = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
const { getFormattedCurrency } = getMeta('CRM Deal')
|
||||
|
||||
const columns = computed(() => {
|
||||
return tabIndex.value === 0 ? dealColumns : contactColumns
|
||||
})
|
||||
@ -450,12 +448,9 @@ function getDealRowObject(deal) {
|
||||
name: deal.name,
|
||||
organization: {
|
||||
label: deal.organization,
|
||||
logo: props.organization?.organization_logo,
|
||||
logo: organization.doc?.organization_logo,
|
||||
},
|
||||
annual_revenue: formatNumberIntoCurrency(
|
||||
deal.annual_revenue,
|
||||
deal.currency,
|
||||
),
|
||||
annual_revenue: getFormattedCurrency('annual_revenue', deal),
|
||||
status: {
|
||||
label: deal.status,
|
||||
color: getDealStatus(deal.status)?.iconColorClass,
|
||||
|
||||
@ -211,16 +211,12 @@ import EditIcon from '@/components/Icons/EditIcon.vue'
|
||||
import CameraIcon from '@/components/Icons/CameraIcon.vue'
|
||||
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
||||
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { globalStore } from '@/stores/global'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { statusesStore } from '@/stores/statuses'
|
||||
import { getView } from '@/utils/view'
|
||||
import {
|
||||
formatDate,
|
||||
timeAgo,
|
||||
formatNumberIntoCurrency,
|
||||
createToast,
|
||||
} from '@/utils'
|
||||
import { formatDate, timeAgo, createToast } from '@/utils'
|
||||
import {
|
||||
Tooltip,
|
||||
Breadcrumbs,
|
||||
@ -476,6 +472,8 @@ const rows = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
const { getFormattedCurrency } = getMeta('CRM Deal')
|
||||
|
||||
const columns = computed(() => {
|
||||
return tabIndex.value === 0 ? dealColumns : contactColumns
|
||||
})
|
||||
@ -485,12 +483,9 @@ function getDealRowObject(deal) {
|
||||
name: deal.name,
|
||||
organization: {
|
||||
label: deal.organization,
|
||||
logo: props.organization?.organization_logo,
|
||||
logo: organization.doc?.organization_logo,
|
||||
},
|
||||
annual_revenue: formatNumberIntoCurrency(
|
||||
deal.annual_revenue,
|
||||
deal.currency,
|
||||
),
|
||||
annual_revenue: getFormattedCurrency('annual_revenue', deal),
|
||||
status: {
|
||||
label: deal.status,
|
||||
color: getDealStatus(deal.status)?.iconColorClass,
|
||||
|
||||
@ -69,9 +69,12 @@ import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||
import OrganizationsListView from '@/components/ListViews/OrganizationsListView.vue'
|
||||
import ViewControls from '@/components/ViewControls.vue'
|
||||
import { formatDate, timeAgo, website, formatNumberIntoCurrency } from '@/utils'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { formatDate, timeAgo, website } from '@/utils'
|
||||
import { ref, computed } from 'vue'
|
||||
|
||||
const { getFormattedCurrency } = getMeta('CRM Organization')
|
||||
|
||||
const organizationsListView = ref(null)
|
||||
const showOrganizationModal = ref(false)
|
||||
|
||||
@ -110,6 +113,10 @@ const rows = computed(() => {
|
||||
)
|
||||
}
|
||||
|
||||
if (fieldType && fieldType == 'Currency') {
|
||||
_rows[row] = getFormattedCurrency(row, organization)
|
||||
}
|
||||
|
||||
if (row === 'organization_name') {
|
||||
_rows[row] = {
|
||||
label: organization.organization_name,
|
||||
@ -117,11 +124,6 @@ const rows = computed(() => {
|
||||
}
|
||||
} else if (row === 'website') {
|
||||
_rows[row] = website(organization.website)
|
||||
} else if (row === 'annual_revenue') {
|
||||
_rows[row] = formatNumberIntoCurrency(
|
||||
organization.annual_revenue,
|
||||
organization.currency,
|
||||
)
|
||||
} else if (['modified', 'creation'].includes(row)) {
|
||||
_rows[row] = {
|
||||
label: formatDate(organization[row]),
|
||||
|
||||
@ -204,12 +204,14 @@ import ViewControls from '@/components/ViewControls.vue'
|
||||
import TasksListView from '@/components/ListViews/TasksListView.vue'
|
||||
import KanbanView from '@/components/Kanban/KanbanView.vue'
|
||||
import TaskModal from '@/components/Modals/TaskModal.vue'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { formatDate, timeAgo } from '@/utils'
|
||||
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 { getUser } = usersStore()
|
||||
|
||||
const router = useRouter()
|
||||
@ -271,6 +273,10 @@ function parseRows(rows, columns = []) {
|
||||
_rows[row] = formatDate(task[row], '', true, fieldType == 'Datetime')
|
||||
}
|
||||
|
||||
if (fieldType && fieldType == 'Currency') {
|
||||
_rows[row] = getFormattedCurrency(row, task)
|
||||
}
|
||||
|
||||
if (['modified', 'creation'].includes(row)) {
|
||||
_rows[row] = {
|
||||
label: formatDate(task[row]),
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { secondsToDuration, formatDate, timeAgo } from '@/utils'
|
||||
import { getMeta } from '@/stores/meta'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { contactsStore } from '@/stores/contacts'
|
||||
|
||||
const { getFormattedCurrency } = getMeta('CRM Call Log')
|
||||
const { getUser } = usersStore()
|
||||
const { getContact, getLeadContact } = contactsStore()
|
||||
|
||||
@ -58,6 +60,10 @@ export function getCallLogDetail(row, log, columns = []) {
|
||||
return formatDate(log[row], '', true, fieldType == 'Datetime')
|
||||
}
|
||||
|
||||
if (fieldType && fieldType == 'Currency') {
|
||||
return getFormattedCurrency(row, log)
|
||||
}
|
||||
|
||||
return log[row]
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user