0
0
Fork 0

Merge pull request '#6772 - Reload data section when change Id' (!192) from 6772_reload_sections into dev

Reviewed-on: verdnatura/salix-front#192
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Javier Segarra 2024-08-27 15:17:44 +00:00
commit ae70256b5e
4 changed files with 22 additions and 29 deletions

View File

@ -8,7 +8,6 @@ import VnSubToolbar from '../ui/VnSubToolbar.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import LeftMenu from 'components/LeftMenu.vue';
import RightMenu from 'components/common/RightMenu.vue';
const props = defineProps({
dataKey: { type: String, required: true },
baseUrl: { type: String, default: undefined },
@ -74,7 +73,7 @@ if (props.baseUrl) {
<QPage>
<VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]">
<RouterView />
<RouterView :key="route.fullPath" />
</div>
</QPage>
</QPageContainer>

View File

@ -18,6 +18,7 @@ const { notify } = useNotify();
const { t } = useI18n();
const arrayData = useArrayData();
const invoiceIn = computed(() => arrayData.store.data);
const currency = computed(() => invoiceIn.value?.currency?.code);
const rowsSelected = ref([]);
const banks = ref([]);
@ -139,9 +140,9 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QTd>
<VnInputNumber
:class="{
'no-pointer-events': !isNotEuro(invoiceIn.currency.code),
'no-pointer-events': !isNotEuro(currency),
}"
:disable="!isNotEuro(invoiceIn.currency.code)"
:disable="!isNotEuro(currency)"
v-model="row.foreignValue"
clearable
clear-icon="close"
@ -154,9 +155,7 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QTd />
<QTd />
<QTd>
{{
toCurrency(getTotalAmount(rows), invoiceIn.currency.code)
}}
{{ toCurrency(getTotalAmount(rows), currency) }}
</QTd>
<QTd />
</QTr>
@ -208,11 +207,9 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
:label="t('Foreign value')"
class="full-width"
:class="{
'no-pointer-events': !isNotEuro(
invoiceIn.currency.code
),
'no-pointer-events': !isNotEuro(currency),
}"
:disable="!isNotEuro(invoiceIn.currency.code)"
:disable="!isNotEuro(currency)"
v-model="props.row.foreignValue"
clearable
clear-icon="close"

View File

@ -242,11 +242,12 @@ const formatOpt = (row, { model, options }, prop) => {
</template>
<template #body-cell-taxablebase="{ row }">
<QTd>
{{ currency }}
<VnInputNumber
:class="{
'no-pointer-events': isNotEuro(invoiceIn.currency.code),
'no-pointer-events': isNotEuro(currency),
}"
:disable="isNotEuro(invoiceIn.currency.code)"
:disable="isNotEuro(currency)"
label=""
clear-icon="close"
v-model="row.taxableBase"
@ -312,9 +313,9 @@ const formatOpt = (row, { model, options }, prop) => {
<QTd>
<VnInputNumber
:class="{
'no-pointer-events': !isNotEuro(invoiceIn.currency.code),
'no-pointer-events': !isNotEuro(currency),
}"
:disable="!isNotEuro(invoiceIn.currency.code)"
:disable="!isNotEuro(currency)"
v-model="row.foreignValue"
/>
</QTd>
@ -361,12 +362,10 @@ const formatOpt = (row, { model, options }, prop) => {
<VnInputNumber
:label="t('Taxable base')"
:class="{
'no-pointer-events': isNotEuro(
invoiceIn.currency.code
),
'no-pointer-events': isNotEuro(currency),
}"
class="full-width"
:disable="isNotEuro(invoiceIn.currency.code)"
:disable="isNotEuro(currency)"
clear-icon="close"
v-model="props.row.taxableBase"
clearable
@ -427,11 +426,9 @@ const formatOpt = (row, { model, options }, prop) => {
:label="t('Foreign value')"
class="full-width"
:class="{
'no-pointer-events': !isNotEuro(
invoiceIn.currency.code
),
'no-pointer-events': !isNotEuro(currency),
}"
:disable="!isNotEuro(invoiceIn.currency.code)"
:disable="!isNotEuro(currency)"
v-model="props.row.foreignValue"
/>
</QItem>

View File

@ -1,6 +1,6 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import { computed, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
@ -11,8 +11,8 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const shelvingId = route.params?.id || null;
const isNew = Boolean(!shelvingId);
const entityId = computed(() => route.params.id ?? null);
const isNew = Boolean(!entityId.value);
const defaultInitialData = {
parkingFk: null,
priority: null,
@ -67,7 +67,7 @@ const onSave = (shelving, newShelving) => {
};
</script>
<template>
<VnSubToolbar />
<VnSubToolbar v-if="isNew" />
<FetchData
url="Parkings"
:filter="parkingFilter"
@ -75,13 +75,13 @@ const onSave = (shelving, newShelving) => {
auto-load
/>
<FormModel
:url="isNew ? null : `Shelvings/${shelvingId}`"
:url="isNew ? null : `Shelvings/${entityId}`"
:url-create="isNew ? 'Shelvings' : null"
:observe-form-changes="!isNew"
:filter="shelvingFilter"
model="shelving"
:auto-load="!isNew"
:form-initial-data="defaultInitialData"
:form-initial-data="isNew ? defaultInitialData : null"
@on-data-saved="onSave"
>
<template #form="{ data, validate, filter }">