mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-16 12:12:15 +01:00
fix cent formatting and reporting pie chart labels
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import TextInput from '@/Components/TextInput.vue';
|
import TextInput from '@/Components/TextInput.vue';
|
||||||
import {
|
import {
|
||||||
formatMoney,
|
formatCents,
|
||||||
getOrganizationCurrencyString,
|
getOrganizationCurrencyString,
|
||||||
getOrganizationCurrencySymbol,
|
getOrganizationCurrencySymbol,
|
||||||
} from '../../utils/money';
|
} from '../../utils/money';
|
||||||
@@ -43,11 +43,8 @@ function updateRate(value: string) {
|
|||||||
model.value = parseInt(cleanUpDecimalValue(value)) * 100;
|
model.value = parseInt(cleanUpDecimalValue(value)) * 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function formatCents(modelValue: number) {
|
function formatValue(modelValue: number) {
|
||||||
const formattedValue = formatMoney(
|
const formattedValue = formatCents(modelValue);
|
||||||
modelValue / 100,
|
|
||||||
getOrganizationCurrencyString()
|
|
||||||
);
|
|
||||||
return formattedValue.replace(getOrganizationCurrencySymbol(), '').trim();
|
return formattedValue.replace(getOrganizationCurrencySymbol(), '').trim();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -57,7 +54,7 @@ function formatCents(modelValue: number) {
|
|||||||
<TextInput
|
<TextInput
|
||||||
:id="name"
|
:id="name"
|
||||||
ref="projectMemberRateInput"
|
ref="projectMemberRateInput"
|
||||||
:modelValue="formatCents(model)"
|
:modelValue="formatValue(model)"
|
||||||
@blur="updateRate($event.target.value)"
|
@blur="updateRate($event.target.value)"
|
||||||
type="text"
|
type="text"
|
||||||
:name="name"
|
:name="name"
|
||||||
|
|||||||
@@ -100,8 +100,7 @@ const option = ref({
|
|||||||
trigger: 'item',
|
trigger: 'item',
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
orient: 'vertical',
|
top: 'bottom',
|
||||||
bottom: 'bottom',
|
|
||||||
},
|
},
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
series: [
|
series: [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { formatHumanReadableDuration } from '@/utils/time';
|
import { formatHumanReadableDuration } from '@/utils/time';
|
||||||
import { formatMoney } from '@/utils/money';
|
import { formatCents } from '@/utils/money';
|
||||||
import GroupedItemsCountButton from '@/Components/Common/GroupedItemsCountButton.vue';
|
import GroupedItemsCountButton from '@/Components/Common/GroupedItemsCountButton.vue';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge';
|
||||||
@@ -54,7 +54,7 @@ const expanded = ref(false);
|
|||||||
{{ formatHumanReadableDuration(entry.seconds) }}
|
{{ formatHumanReadableDuration(entry.seconds) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="justify-end pr-6 flex items-center">
|
<div class="justify-end pr-6 flex items-center">
|
||||||
{{ formatMoney(entry.cost) }}
|
{{ formatCents(entry.cost) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import TaskMultiselectDropdown from '@/Components/Common/Task/TaskMultiselectDro
|
|||||||
import SelectDropdown from '@/Components/Common/SelectDropdown.vue';
|
import SelectDropdown from '@/Components/Common/SelectDropdown.vue';
|
||||||
import ReportingGroupBySelect from '@/Components/Common/Reporting/ReportingGroupBySelect.vue';
|
import ReportingGroupBySelect from '@/Components/Common/Reporting/ReportingGroupBySelect.vue';
|
||||||
import ReportingRow from '@/Components/Common/Reporting/ReportingRow.vue';
|
import ReportingRow from '@/Components/Common/Reporting/ReportingRow.vue';
|
||||||
import { formatMoney } from '@/utils/money';
|
import { formatCents } from '@/utils/money';
|
||||||
import ReportingPieChart from '@/Components/Common/Reporting/ReportingPieChart.vue';
|
import ReportingPieChart from '@/Components/Common/Reporting/ReportingPieChart.vue';
|
||||||
|
|
||||||
const startDate = ref<string | null>(
|
const startDate = ref<string | null>(
|
||||||
@@ -284,7 +284,7 @@ onMounted(() => {
|
|||||||
<div
|
<div
|
||||||
class="justify-end pr-6 flex items-center font-medium">
|
class="justify-end pr-6 flex items-center font-medium">
|
||||||
{{
|
{{
|
||||||
formatMoney(
|
formatCents(
|
||||||
aggregatedTableTimeEntries.cost
|
aggregatedTableTimeEntries.cost
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const page = usePage<{
|
|||||||
};
|
};
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
export function formatMoney(
|
function formatMoney(
|
||||||
amount: number,
|
amount: number,
|
||||||
currency: string = getOrganizationCurrencyString()
|
currency: string = getOrganizationCurrencyString()
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user