mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-25 12:00:29 +00:00
feat: user defined currencies (#700)
* basic currency service for loading at runtime
* api endpoint for currencies
* sort slice before return
* remove currency validation
* validate using currency service
* implement selecting dynamic currency options
* bump go version
* fix type definition
* specify explicit type
* change go versions
* proper types for assetId
* log/return currency error
* make case insensative
* use ToUpper instead
* feat: adding new currencies (#715)
* fix: task swag (#710)
Co-authored-by: Quoing <pavel.cadersky@mavenir.com>
* [feat] Adding new currencies
---------
Co-authored-by: quoing <quoing@users.noreply.github.com>
Co-authored-by: Quoing <pavel.cadersky@mavenir.com>
Co-authored-by: Bradley <41597815+userbradley@users.noreply.github.com>
* remove ts file and consoldate new values into json
* move flag to options namespace
* add env config for currencies
* basic documentaion
* remove in sync test
---------
Co-authored-by: quoing <quoing@users.noreply.github.com>
Co-authored-by: Quoing <pavel.cadersky@mavenir.com>
Co-authored-by: Bradley <41597815+userbradley@users.noreply.github.com>
Former-commit-id: c4b923847a
This commit is contained in:
parent
ce923a5b4c
commit
2b79788fbe
39 changed files with 1226 additions and 328 deletions
|
@ -1,8 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import { Detail } from "~~/components/global/DetailsSection/types";
|
||||
import { themes } from "~~/lib/data/themes";
|
||||
import { currencies, Currency } from "~~/lib/data/currency";
|
||||
import { NotifierCreate, NotifierOut } from "~~/lib/api/types/data-contracts";
|
||||
import { CurrenciesCurrency, NotifierCreate, NotifierOut } from "~~/lib/api/types/data-contracts";
|
||||
|
||||
definePageMeta({
|
||||
middleware: ["auth"],
|
||||
|
@ -15,9 +14,23 @@
|
|||
const confirm = useConfirm();
|
||||
const notify = useNotifier();
|
||||
|
||||
// Currency Selection
|
||||
const currency = ref<Currency>(currencies[0]);
|
||||
const currencies = computedAsync(async () => {
|
||||
const resp = await api.group.currencies();
|
||||
if (resp.error) {
|
||||
notify.error("Failed to get currencies");
|
||||
return [];
|
||||
}
|
||||
|
||||
return resp.data;
|
||||
});
|
||||
|
||||
// Currency Selection
|
||||
const currency = ref<CurrenciesCurrency>({
|
||||
code: "USD",
|
||||
name: "United States Dollar",
|
||||
local: "en-US",
|
||||
symbol: "$",
|
||||
});
|
||||
watch(currency, () => {
|
||||
if (group.value) {
|
||||
group.value.currency = currency.value.code;
|
||||
|
@ -45,7 +58,7 @@
|
|||
}
|
||||
|
||||
// @ts-expect-error - typescript is stupid, it should know group.value is not null
|
||||
const found = currencies.find(c => c.code === group.value.currency);
|
||||
const found = currencies.value.find(c => c.code === group.value.currency);
|
||||
if (found) {
|
||||
currency.value = found;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue