mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-16 20:22:15 +01:00
add frontend format support for currencies, add currencies endpoint
This commit is contained in:
committed by
Constantin Graf
parent
c1d43bcc67
commit
f69bc28316
@@ -3,7 +3,7 @@ import MainContainer from '@/packages/ui/src/MainContainer.vue';
|
||||
import AppLayout from '@/Layouts/AppLayout.vue';
|
||||
import { FolderIcon, PlusIcon } from '@heroicons/vue/16/solid';
|
||||
import SecondaryButton from '@/packages/ui/src/Buttons/SecondaryButton.vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { computed, onMounted, ref, inject, type ComputedRef } from 'vue';
|
||||
import { useProjectsStore } from '@/utils/useProjects';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import {
|
||||
@@ -33,9 +33,12 @@ import ProjectEditModal from '@/Components/Common/Project/ProjectEditModal.vue';
|
||||
import { Badge } from '@/packages/ui/src';
|
||||
import { formatCents } from '../packages/ui/src/utils/money';
|
||||
import { getOrganizationCurrencyString } from '../utils/money';
|
||||
import type { Organization } from '@/packages/api/src';
|
||||
|
||||
const { projects } = storeToRefs(useProjectsStore());
|
||||
|
||||
const organization = inject<ComputedRef<Organization>>('organization');
|
||||
|
||||
const project = computed(() => {
|
||||
return (
|
||||
projects.value.find(
|
||||
@@ -112,7 +115,10 @@ const shownTasks = computed(() => {
|
||||
{{
|
||||
formatCents(
|
||||
project?.billable_rate ?? 0,
|
||||
getOrganizationCurrencyString()
|
||||
getOrganizationCurrencyString(),
|
||||
organization?.currency_format,
|
||||
organization?.currency_symbol,
|
||||
organization?.number_format
|
||||
)
|
||||
}}
|
||||
/ h
|
||||
@@ -145,15 +151,11 @@ const shownTasks = computed(() => {
|
||||
<div
|
||||
class="w-full items-center flex justify-between">
|
||||
<div class="pl-6">
|
||||
<TabBar
|
||||
v-model="activeTab"
|
||||
>
|
||||
<TabBarItem
|
||||
value="active"
|
||||
<TabBar v-model="activeTab">
|
||||
<TabBarItem value="active"
|
||||
>Active
|
||||
</TabBarItem>
|
||||
<TabBarItem
|
||||
value="done"
|
||||
<TabBarItem value="done"
|
||||
>Done
|
||||
</TabBarItem>
|
||||
</TabBar>
|
||||
@@ -185,11 +187,11 @@ const shownTasks = computed(() => {
|
||||
Add Member
|
||||
</SecondaryButton>
|
||||
<ProjectMemberCreateModal
|
||||
v-model:show="
|
||||
createProjectMember
|
||||
"
|
||||
v-model:show="createProjectMember"
|
||||
:project-id="projectId"
|
||||
:existing-members="projectMembers"></ProjectMemberCreateModal>
|
||||
:existing-members="
|
||||
projectMembers
|
||||
"></ProjectMemberCreateModal>
|
||||
</template>
|
||||
</CardTitle>
|
||||
<Card>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { formatHumanReadableDuration } from '@/packages/ui/src/utils/time';
|
||||
import ReportingRow from '@/Components/Common/Reporting/ReportingRow.vue';
|
||||
import ReportingPieChart from '@/Components/Common/Reporting/ReportingPieChart.vue';
|
||||
import { formatCents } from '@/packages/ui/src/utils/money';
|
||||
import type { CurrencyFormat } from '@/packages/ui/src/utils/money';
|
||||
import { computed, onMounted, provide, ref } from 'vue';
|
||||
import { useQuery } from '@tanstack/vue-query';
|
||||
import { api } from '@/packages/api/src';
|
||||
@@ -55,11 +56,21 @@ const reportNumberFormat = computed(() => {
|
||||
return sharedReportResponseData.value?.number_format;
|
||||
});
|
||||
|
||||
const reportCurrencyFormat = computed(() => {
|
||||
return (sharedReportResponseData.value?.currency_format ?? 'symbol-before') as CurrencyFormat;
|
||||
});
|
||||
|
||||
const reportCurrencySymbol = computed(() => {
|
||||
return sharedReportResponseData.value?.currency_symbol;
|
||||
});
|
||||
|
||||
provide(
|
||||
'organization',
|
||||
computed(() => ({
|
||||
'number_format': reportNumberFormat.value,
|
||||
'interval_format': reportIntervalFormat.value,
|
||||
'currency_format': reportCurrencyFormat.value,
|
||||
'currency_symbol': reportCurrencySymbol.value,
|
||||
}))
|
||||
);
|
||||
|
||||
@@ -217,10 +228,8 @@ onMounted(async () => {
|
||||
v-for="entry in tableData"
|
||||
:key="entry.description ?? 'none'"
|
||||
:currency="reportCurrency"
|
||||
:entry="entry"
|
||||
:type="
|
||||
aggregatedTableTimeEntries.grouped_type
|
||||
"></ReportingRow>
|
||||
:currency-format="reportCurrencyFormat"
|
||||
:entry="entry"></ReportingRow>
|
||||
<div
|
||||
class="contents [&>*]:transition text-text-tertiary [&>*]:h-[50px]">
|
||||
<div class="flex items-center pl-6 font-medium">
|
||||
@@ -241,7 +250,9 @@ onMounted(async () => {
|
||||
{{
|
||||
formatCents(
|
||||
aggregatedTableTimeEntries.cost,
|
||||
reportCurrency
|
||||
reportCurrency,
|
||||
reportCurrencyFormat,
|
||||
reportCurrencySymbol,
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
|
||||
@@ -15,11 +15,11 @@ import {
|
||||
} from '@/Components/ui/select';
|
||||
import { useMutation, useQueryClient } from '@tanstack/vue-query';
|
||||
import type {
|
||||
CurrencyFormat,
|
||||
DateFormat,
|
||||
TimeFormat,
|
||||
IntervalFormat,
|
||||
} from '@/packages/ui/src/utils/time';
|
||||
import type { CurrencyFormat } from '@/packages/ui/src/utils/money';
|
||||
import type { NumberFormat } from '@/packages/ui/src/utils/number';
|
||||
|
||||
interface FormValues {
|
||||
|
||||
Reference in New Issue
Block a user