mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-17 18:24:10 +00:00
Show common currencies first in dropdowns and default to USD in install wizard
Currency dropdowns now display the most-traded currencies (USD, EUR, GBP, JPY, CAD, AUD, CHF, CNY, INR, BRL) at the top, followed by the rest alphabetically. The install wizard defaults to USD instead of EUR and formats currency names as "USD - US Dollar" for consistency with the rest of the app.
This commit is contained in:
@@ -137,7 +137,7 @@ import { clearInstallWizardAuth } from '../install-auth'
|
||||
import { useInstallationFeedback } from '../use-installation-feedback'
|
||||
|
||||
interface PreferencesData {
|
||||
currency: number
|
||||
currency: number | null
|
||||
language: string
|
||||
carbon_date_format: string
|
||||
time_zone: string
|
||||
@@ -157,6 +157,7 @@ interface DateFormatOption {
|
||||
interface CurrencyOption {
|
||||
id: number
|
||||
name: string
|
||||
code: string
|
||||
}
|
||||
|
||||
interface LanguageOption {
|
||||
@@ -179,7 +180,7 @@ const timeZones = ref<KeyValueOption[]>([])
|
||||
const fiscalYears = ref<KeyValueOption[]>([])
|
||||
|
||||
const currentPreferences = reactive<PreferencesData>({
|
||||
currency: 3,
|
||||
currency: null,
|
||||
language: 'en',
|
||||
carbon_date_format: 'd M Y',
|
||||
time_zone: 'UTC',
|
||||
@@ -223,7 +224,19 @@ onMounted(async () => {
|
||||
installClient.get(`${API.CONFIG}?key=fiscal_years`),
|
||||
installClient.get(`${API.CONFIG}?key=languages`),
|
||||
])
|
||||
currencies.value = currRes.data.data ?? currRes.data
|
||||
const rawCurrencies: CurrencyOption[] = currRes.data.data ?? currRes.data
|
||||
currencies.value = rawCurrencies.map((c) => ({
|
||||
...c,
|
||||
name: `${c.code} - ${c.name}`,
|
||||
}))
|
||||
|
||||
if (!currentPreferences.currency) {
|
||||
const usd = currencies.value.find((c) => c.code === 'USD')
|
||||
if (usd) {
|
||||
currentPreferences.currency = usd.id
|
||||
}
|
||||
}
|
||||
|
||||
dateFormats.value = dateRes.data.data ?? dateRes.data
|
||||
timeZones.value = tzRes.data.data ?? tzRes.data
|
||||
fiscalYears.value = fyRes.data.data ?? fyRes.data ?? []
|
||||
|
||||
Reference in New Issue
Block a user