0
0
Fork 0

Merge branch 'dev' into 6943_fix_customerSummaryTable

This commit is contained in:
Javier Segarra 2024-08-27 20:47:09 +02:00
commit 1b5658726e
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 VnSearchbar from 'components/ui/VnSearchbar.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import RightMenu from 'components/common/RightMenu.vue'; import RightMenu from 'components/common/RightMenu.vue';
const props = defineProps({ const props = defineProps({
dataKey: { type: String, required: true }, dataKey: { type: String, required: true },
baseUrl: { type: String, default: undefined }, baseUrl: { type: String, default: undefined },
@ -74,7 +73,7 @@ if (props.baseUrl) {
<QPage> <QPage>
<VnSubToolbar /> <VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]"> <div :class="[useCardSize(), $attrs.class]">
<RouterView /> <RouterView :key="route.fullPath" />
</div> </div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

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

View File

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

View File

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