From 5c44f2590a0b7becd406be8ca78dbd7751a6dfbd Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Tue, 21 May 2024 21:01:31 +0200 Subject: [PATCH] fix cent formatting and reporting pie chart labels --- resources/js/Components/Common/BillableRateInput.vue | 11 ++++------- .../Components/Common/Reporting/ReportingPieChart.vue | 3 +-- .../js/Components/Common/Reporting/ReportingRow.vue | 4 ++-- resources/js/Pages/Reporting.vue | 4 ++-- resources/js/utils/money.ts | 2 +- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/resources/js/Components/Common/BillableRateInput.vue b/resources/js/Components/Common/BillableRateInput.vue index f43277da..d297abcf 100644 --- a/resources/js/Components/Common/BillableRateInput.vue +++ b/resources/js/Components/Common/BillableRateInput.vue @@ -1,7 +1,7 @@ @@ -57,7 +54,7 @@ function formatCents(modelValue: number) { import { formatHumanReadableDuration } from '@/utils/time'; -import { formatMoney } from '@/utils/money'; +import { formatCents } from '@/utils/money'; import GroupedItemsCountButton from '@/Components/Common/GroupedItemsCountButton.vue'; import { ref } from 'vue'; import { twMerge } from 'tailwind-merge'; @@ -54,7 +54,7 @@ const expanded = ref(false); {{ formatHumanReadableDuration(entry.seconds) }}
- {{ formatMoney(entry.cost) }} + {{ formatCents(entry.cost) }}
( @@ -284,7 +284,7 @@ onMounted(() => {
{{ - formatMoney( + formatCents( aggregatedTableTimeEntries.cost ) }} diff --git a/resources/js/utils/money.ts b/resources/js/utils/money.ts index 730bea02..a3bc0e7c 100644 --- a/resources/js/utils/money.ts +++ b/resources/js/utils/money.ts @@ -10,7 +10,7 @@ const page = usePage<{ }; }>(); -export function formatMoney( +function formatMoney( amount: number, currency: string = getOrganizationCurrencyString() ) {