feat: refs #7984 add currency in userPanel
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
552d05098c
commit
65bbd0768c
|
@ -47,6 +47,8 @@ const darkMode = computed({
|
|||
},
|
||||
});
|
||||
|
||||
const foreignCurrency = ref();
|
||||
|
||||
const user = state.getUser();
|
||||
const warehousesData = ref();
|
||||
const companiesData = ref();
|
||||
|
@ -58,6 +60,8 @@ onMounted(async () => {
|
|||
});
|
||||
|
||||
function updatePreferences() {
|
||||
foreignCurrency.value = user.value.foreignCurrency;
|
||||
|
||||
if (user.value.darkMode !== null) {
|
||||
darkMode.value = user.value.darkMode;
|
||||
}
|
||||
|
@ -116,6 +120,11 @@ async function saveUserData(param, value) {
|
|||
}
|
||||
}
|
||||
|
||||
async function saveCurrency(value) {
|
||||
user.value.foreignCurrency = value;
|
||||
useState().setUser(user.value);
|
||||
}
|
||||
|
||||
const onDataSaved = () => {
|
||||
notify('globals.dataSaved', 'positive');
|
||||
};
|
||||
|
@ -169,6 +178,14 @@ const onDataError = () => {
|
|||
color="primary"
|
||||
unchecked-icon="light_mode"
|
||||
/>
|
||||
<QToggle
|
||||
v-model="foreignCurrency"
|
||||
:label="t(`globals.foreignCurrency`)"
|
||||
@update:model-value="saveCurrency"
|
||||
color="primary"
|
||||
unchecked-icon="euro_symbol"
|
||||
checked-icon="currency_exchange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<QSeparator vertical inset class="q-mx-lg" />
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import { toCurrency } from 'src/filters';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
const $props = defineProps({
|
||||
model: {
|
||||
|
@ -28,6 +29,9 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
|
||||
const foreignFieldComputed = ref();
|
||||
const arrayData = $props.arrayDataModel && useArrayData($props.arrayDataModel);
|
||||
const foreignValue = ref();
|
||||
|
@ -61,8 +65,8 @@ function getLabel() {
|
|||
|
||||
<template>
|
||||
<span :title="toCurrencyLabel" v-if="currency && localValue">
|
||||
<span v-if="foreignValue">{{ toCurrencyLabel }} /</span>
|
||||
{{ toCurrency(localValue) }}
|
||||
<span v-if="foreignValue && user.foreignCurrency">{{ toCurrencyLabel }}</span>
|
||||
<span v-else>{{ toCurrency(localValue) }}</span>
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
<!-- <span v-else>-</span> -->
|
||||
</template>
|
||||
|
|
|
@ -60,7 +60,7 @@ export function useSession() {
|
|||
const { data: isValidToken } = await axios.get('VnUsers/validateToken');
|
||||
if (isValidToken)
|
||||
destroyTokenPromises = Object.entries(tokens).map(([key, url]) =>
|
||||
destroyToken(url, storage, key)
|
||||
destroyToken(url, storage, key),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
@ -75,6 +75,7 @@ export function useSession() {
|
|||
nickname: '',
|
||||
lang: '',
|
||||
darkMode: null,
|
||||
foreignCurrency: true,
|
||||
});
|
||||
|
||||
stopRenewer();
|
||||
|
|
|
@ -10,6 +10,7 @@ const user = ref({
|
|||
darkMode: null,
|
||||
companyFk: null,
|
||||
warehouseFk: null,
|
||||
foreignCurrency: true,
|
||||
});
|
||||
if (sessionStorage.getItem('user'))
|
||||
user.value = JSON.parse(sessionStorage.getItem('user'));
|
||||
|
|
|
@ -2,6 +2,7 @@ globals:
|
|||
lang:
|
||||
es: Spanish
|
||||
en: English
|
||||
foreignCurrency: Foreign currency
|
||||
quantity: Quantity
|
||||
language: Language
|
||||
entity: Entity
|
||||
|
|
|
@ -2,6 +2,7 @@ globals:
|
|||
lang:
|
||||
es: Español
|
||||
en: Inglés
|
||||
foreignCurrency: Moneda extranjera
|
||||
language: Idioma
|
||||
quantity: Cantidad
|
||||
entity: Entidad
|
||||
|
|
Loading…
Reference in New Issue