Skip to content

Commit ca1cbde

Browse files
committed
Fix currency code error then more than 3 symbols used, account's amount editing error highlight, license year update
1 parent e1464bf commit ca1cbde

File tree

17 files changed

+47
-71
lines changed

17 files changed

+47
-71
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 FinWave App
3+
Copyright (c) 2025 FinWave App
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

components/accounts/entry.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import HideButton from "~/components/buttons/hideButton.vue";
3737
import EditButton from "~/components/buttons/editButton.vue";
3838
import DeleteButton from "~/components/buttons/deleteButton.vue";
3939
import WalletButton from "~/components/buttons/walletButton.vue";
40+
import {useCurrencyFormatter} from "~/composables/useCurrencyFormatter";
4041
4142
const emit = defineEmits(['edit-modal', 'accumulation-modal']);
4243
@@ -55,13 +56,7 @@ const { $currenciesApi, $accountsApi, $toastsManager } = useNuxtApp();
5556
const currency = $currenciesApi.getCurrencies().value.find(c => c.currencyId === props.account.currencyId)
5657
5758
const formatAmount = (delta) => {
58-
const formatter = Intl.NumberFormat(locale.value, {
59-
style: 'currency',
60-
currency: currency.code,
61-
minimumFractionDigits: 2,
62-
maximumFractionDigits: currency.decimals
63-
});
64-
return formatter.format(delta).replace(currency.code + " ", currency.symbol).replace(" " + currency.code, " " + currency.symbol);
59+
return useCurrencyFormatter(delta, currency, locale.value);
6560
}
6661
6762
const hide = () => {

components/accounts/summary.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,16 @@
1616
</template>
1717

1818
<script setup>
19+
import {useCurrencyFormatter} from "~/composables/useCurrencyFormatter";
20+
1921
const {$accountsApi, $currenciesApi} = useNuxtApp();
2022
const { t, locale } = useI18n();
2123
2224
const accounts = $accountsApi.getAccounts();
2325
const currencyMap = $currenciesApi.getCurrenciesMap();
2426
2527
const formatAmount = (delta, currency) => {
26-
const formatter = Intl.NumberFormat(locale.value, {
27-
style: 'currency',
28-
currency: currency.code,
29-
minimumFractionDigits: 2,
30-
maximumFractionDigits: currency.decimals
31-
});
32-
return formatter.format(delta).replace(currency.code + " ", currency.symbol).replace(" " + currency.code, " " + currency.symbol);
28+
return useCurrencyFormatter(delta, currency, locale.value);
3329
}
3430
3531
const map = computed(() => {

components/analytics/categoriesAnalytics.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
</template>
3030

3131
<script setup>
32+
import {useCurrencyFormatter} from "~/composables/useCurrencyFormatter";
33+
3234
const { t, locale } = useI18n();
3335
3436
const props = defineProps({
@@ -79,11 +81,8 @@ const budgetsMap = $categoriesBudgetApi.getBudgetsMap();
7981
8082
const formatAmount = (delta, currencyId) => {
8183
const currency = currenciesMap.value.get(currencyId);
82-
const formatter = Intl.NumberFormat(locale.value, {
83-
minimumFractionDigits: 0,
84-
maximumFractionDigits: currency.decimals
85-
});
86-
return formatter.format(delta);
84+
85+
return useCurrencyFormatter(delta, currency, locale.value);
8786
}
8887
8988
const fetchData = async () => {

components/analytics/pie.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import ApexChart from "vue3-apexcharts";
4545
import {TransactionsFilter} from "~/libs/api/transactions/TransactionsFilter";
4646
import Datepicker from "@vuepic/vue-datepicker";
4747
import {useColor} from "~/composables/useColor";
48+
import {useCurrencyFormatter} from "~/composables/useCurrencyFormatter";
4849
4950
const props = defineProps({
5051
sign: {
@@ -145,14 +146,7 @@ $transactionsApi.registerUpdateListener(() => {
145146
const formatAmount = (delta) => {
146147
const currencyObject = currenciesMap.value.get(currency.value);
147148
148-
const formatter = Intl.NumberFormat(locale.value, {
149-
style: 'currency',
150-
currency: currencyObject.code,
151-
minimumFractionDigits: 2,
152-
maximumFractionDigits: currencyObject.decimals
153-
});
154-
155-
return formatter.format(delta).replace(currencyObject.code + " ", currencyObject.symbol).replace(" " + currencyObject.code, " " + currencyObject.symbol);
149+
return useCurrencyFormatter(delta, currencyObject, locale.value);
156150
}
157151
158152
const formatter = (value) => {

components/analytics/totalByPeriod.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
import ApexChart from "vue3-apexcharts";
1313
import {TransactionsFilter} from "~/libs/api/transactions/TransactionsFilter";
14+
import {useCurrencyFormatter} from "~/composables/useCurrencyFormatter";
1415
1516
const { $analyticsApi, $transactionsApi, $transactionsCategoriesApi, $currenciesApi, $serverConfigs } = useNuxtApp();
1617
const { t, locale } = useI18n();
@@ -58,14 +59,7 @@ const chartOptions = ref({
5859
});
5960
6061
const formatAmount = (delta) => {
61-
const formatter = Intl.NumberFormat(locale.value, {
62-
style: 'currency',
63-
currency: currency.value.code,
64-
minimumFractionDigits: 2,
65-
maximumFractionDigits: currency.value.decimals
66-
});
67-
68-
return formatter.format(delta).replace(currency.value.code + " ", currency.value.symbol).replace(" " + currency.value.code, " " + currency.value.symbol);
62+
return useCurrencyFormatter(delta, currency.value, locale.value);
6963
}
7064
7165
const fetchData = async () => {

components/fw-footer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</svg>
2020
<div class="flex flex-col gap-1 flex-wrap">
2121
<p class="opacity-60 font-bold text-sm">
22-
Copyright © 2024 <a href="https://finwave.app" target="_blank" class="underline">FinWave Project</a>. All rights reserved
22+
Copyright © 2025 <a href="https://finwave.app" target="_blank" class="underline">FinWave Project</a>. All rights reserved
2323
</p>
2424
<p class="opacity-60 font-bold text-sm">
2525
This project is licensed under the <a href="/license.txt" target="_blank" class="underline">MIT License</a>.

components/misc/categoriesBudgetSummary.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666

6767
<script setup>
6868
69+
import {useCurrencyFormatter} from "~/composables/useCurrencyFormatter";
70+
6971
const { t, locale } = useI18n();
7072
const { $transactionsCategoriesApi, $categoriesBudgetApi, $currenciesApi } = useNuxtApp();
7173
@@ -79,13 +81,8 @@ const expectExpanses = ref([]);
7981
8082
const formatDelta = (delta, currencyId) => {
8183
const currency = currenciesMap.value.get(currencyId);
82-
const formatter = Intl.NumberFormat(locale.value, {
83-
style: 'currency',
84-
currency: currency.code,
85-
minimumFractionDigits: 2,
86-
maximumFractionDigits: currency.decimals
87-
});
88-
return formatter.format(delta).replace(currency.code + " ", currency.symbol).replace(" " + currency.code, " " + currency.symbol);
84+
85+
return useCurrencyFormatter(delta, currency, locale.value);
8986
}
9087
9188
const capitalizeFirstLetter = (string) => {

components/modal/account/edit.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<div v-else-if="tab === 1" class="w-full flex flex-col gap-2">
4747
<select-transaction-category class="w-full"
4848
v-model.number="category"
49+
:class="{'input-error' : highlightErrors && !category }"
4950
:searchable="true"
5051
:can-be-without-parent="false"
5152
:categories-tree="categoriesTree"
@@ -60,6 +61,7 @@
6061

6162
<input type="number"
6263
class="input input-bordered join-item w-full"
64+
:class="{'input-error' : highlightErrors && newAmount === props.account.amount }"
6365
:placeholder="$t('modals.editAccount.placeholders.amount')"
6466
v-model="newAmount"
6567
>
@@ -111,6 +113,7 @@ const description = ref();
111113
const folder = ref();
112114
113115
const newAmount = ref(0);
116+
const highlightErrors = ref(false);
114117
const allValid = computed(() => props.account && category.value && newAmount.value !== props.account.amount)
115118
116119
const nameSyncStatus = ref(1);
@@ -204,8 +207,11 @@ const syncFolder = () => {
204207
}
205208
206209
const applyNewAmount = () => {
207-
if (!allValid.value)
210+
if (!allValid.value) {
211+
highlightErrors.value = true;
208212
return
213+
}
214+
highlightErrors.value = false;
209215
210216
close();
211217

components/transactions/table/tableEntry.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@
119119
</template>
120120

121121
<script setup>
122+
import {useCurrencyFormatter} from "~/composables/useCurrencyFormatter";
123+
122124
const props = defineProps({
123125
transaction: {
124126
required: true
@@ -139,13 +141,7 @@ const exchangeRateMode = ref(false);
139141
140142
const formatDelta = (delta, currencyId) => {
141143
const currency = currenciesMap.value.get(currencyId);
142-
const formatter = Intl.NumberFormat(locale.value, {
143-
style: 'currency',
144-
currency: currency.code,
145-
minimumFractionDigits: 2,
146-
maximumFractionDigits: currency.decimals
147-
});
148-
return formatter.format(delta).replace(currency.code + " ", currency.symbol).replace(" " + currency.code, " " + currency.symbol);
144+
return useCurrencyFormatter(delta, currency, locale.value);
149145
}
150146
151147
const formatExchangeRate = (transaction, mode) => {

0 commit comments

Comments
 (0)