fix: refs #6942 selectable expense
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-03-04 08:25:43 +01:00
parent 4abb230180
commit e10e06bcd4
3 changed files with 239 additions and 251 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { h, onMounted } from 'vue'; import { onMounted } from 'vue';
import axios from 'axios'; import axios from 'axios';
const $props = defineProps({ const $props = defineProps({
@ -24,7 +24,7 @@ const $props = defineProps({
default: '', default: '',
}, },
limit: { limit: {
type: String, type: [String, Number],
default: '', default: '',
}, },
params: { params: {
@ -60,3 +60,6 @@ async function fetch(fetchFilter = {}) {
} }
} }
</script> </script>
<template>
<template></template>
</template>

View File

@ -151,7 +151,7 @@ watch(modelValue, (newValue) => {
@on-fetch="(data) => setOptions(data)" @on-fetch="(data) => setOptions(data)"
:where="where || { [optionValue]: value }" :where="where || { [optionValue]: value }"
:limit="limit" :limit="limit"
:order-by="orderBy" :sort-by="sortBy"
:fields="fields" :fields="fields"
/> />
<QSelect <QSelect

View File

@ -3,14 +3,13 @@ import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import axios from 'axios';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { downloadFile } from 'src/composables/downloadFile'; import { downloadFile } from 'src/composables/downloadFile';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import axios from 'axios';
const quasar = useQuasar(); const quasar = useQuasar();
const route = useRoute(); const route = useRoute();
@ -22,6 +21,7 @@ const arrayData = useArrayData('InvoiceIn');
const invoiceIn = computed(() => arrayData.store.data); const invoiceIn = computed(() => arrayData.store.data);
const userConfig = ref(null); const userConfig = ref(null);
const expenses = ref([]);
const currencies = ref([]); const currencies = ref([]);
const currenciesRef = ref(); const currenciesRef = ref();
const companies = ref([]); const companies = ref([]);
@ -174,6 +174,7 @@ async function upsert() {
@on-fetch="(data) => (userConfig = data)" @on-fetch="(data) => (userConfig = data)"
auto-load auto-load
/> />
<FetchData url="Expenses" auto-load @on-fetch="(data) => (expenses = data)" />
<FormModel <FormModel
v-if="invoiceIn" v-if="invoiceIn"
:url="`InvoiceIns/${route.params.id}`" :url="`InvoiceIns/${route.params.id}`"
@ -181,254 +182,238 @@ async function upsert() {
:auto-load="true" :auto-load="true"
> >
<template #form="{ data }"> <template #form="{ data }">
<div class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <VnSelectFilter
<VnSelectFilter :label="t('supplierFk')"
:label="t('supplierFk')" v-model="data.supplierFk"
v-model="data.supplierFk" option-value="id"
option-value="id" option-label="nickname"
option-label="nickname" url="Suppliers"
url="Suppliers" :fields="['id', 'nickname']"
:fields="['id', 'nickname']" sort-by="nickname"
sort-by="nickname" :is-clearable="false"
:is-clearable="false" >
> <template #option="scope">
<template #option="scope"> <QItem v-bind="scope.itemProps">
<QItem v-bind="scope.itemProps"> <QItemSection>
<QItemSection> <QItemLabel>{{
<QItemLabel>{{ `${scope.opt.id} - ${scope.opt.nickname}`
`${scope.opt.id} - ${scope.opt.nickname}` }}</QItemLabel>
}}</QItemLabel> </QItemSection>
</QItemSection> </QItem>
</QItem> </template>
</template> </VnSelectFilter>
</VnSelectFilter> <QInput
</div> clearable
<div class="col"> clear-icon="close"
<QInput :label="t('Supplier ref')"
clearable v-model="data.supplierRef"
clear-icon="close" />
:label="t('Supplier ref')" </VnRow>
v-model="data.supplierRef" <VnRow>
/> <QInput
</div> :label="t('Expedition date')"
</div> v-model="data.issued"
<div class="row q-gutter-md q-mb-md"> :mask="dateMask"
<div class="col"> >
<QInput <template #append>
:label="t('Expedition date')" <QIcon name="event" class="cursor-pointer" :fill-mask="fillMask">
v-model="data.issued" <QPopupProxy
:mask="dateMask" cover
> transition-show="scale"
<template #append> transition-hide="scale"
<QIcon
name="event"
class="cursor-pointer"
:fill-mask="fillMask"
> >
<QPopupProxy <QDate v-model="data.issued">
cover <div class="row items-center justify-end">
transition-show="scale" <QBtn
transition-hide="scale" v-close-popup
> label="Close"
<QDate v-model="data.issued"> color="primary"
<div class="row items-center justify-end"> flat
<QBtn />
v-close-popup </div>
label="Close" </QDate>
color="primary" </QPopupProxy>
flat </QIcon>
/> </template>
</div> </QInput>
</QDate> <QInput
</QPopupProxy> :label="t('Operation date')"
</QIcon> v-model="data.operated"
</template> :mask="dateMask"
</QInput> :fill-mask="fillMask"
</div> autofocus
<div class="col"> >
<QInput <template #append>
:label="t('Operation date')" <QIcon name="event" class="cursor-pointer">
v-model="data.operated" <QPopupProxy
:mask="dateMask" cover
:fill-mask="fillMask" transition-show="scale"
autofocus transition-hide="scale"
>
<template #append>
<QIcon name="event" class="cursor-pointer">
<QPopupProxy
cover
transition-show="scale"
transition-hide="scale"
>
<QDate v-model="data.operated" :mask="dateMask">
<div class="row items-center justify-end">
<QBtn
v-close-popup
label="Close"
color="primary"
flat
/>
</div>
</QDate>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</div>
</div>
<div class="row q-gutter-md q-mb-md">
<div class="col">
<QInput
:label="t('Undeductible VAT')"
v-model="data.deductibleExpenseFk"
clearable
clear-icon="close"
/>
</div>
<div class="col">
<QInput
:label="t('Document')"
v-model="data.dmsFk"
clearable
clear-icon="close"
@update:model-value="checkFileExists(data.dmsFk)"
>
<template #prepend>
<QBtn
v-if="data.dmsFk"
:class="{
'no-pointer-events': editDownloadDisabled,
}"
:disable="editDownloadDisabled"
icon="cloud_download"
:title="t('Download file')"
padding="xs"
round
@click="downloadFile(data.dmsFk)"
/>
</template>
<template #append>
<QBtn
:class="{
'no-pointer-events': editDownloadDisabled,
}"
:disable="editDownloadDisabled"
v-if="data.dmsFk"
icon="edit"
round
padding="xs"
@click="setEditDms(data.dmsFk)"
> >
<QTooltip>{{ t('Edit document') }}</QTooltip> <QDate v-model="data.operated" :mask="dateMask">
</QBtn> <div class="row items-center justify-end">
<QBtn <QBtn
v-else v-close-popup
icon="add_circle" label="Close"
round color="primary"
padding="xs" flat
@click="setCreateDms()" />
</div>
</QDate>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</VnRow>
<VnRow>
<VnSelectFilter
:label="t('Undeductible VAT')"
v-model="data.deductibleExpenseFk"
:options="expenses"
option-value="id"
option-label="id"
:filter-options="['id', 'name']"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
{{ `${scope.opt.id}: ${scope.opt.name}` }}
</QItem>
</template>
</VnSelectFilter>
<QInput
:label="t('Document')"
v-model="data.dmsFk"
clearable
clear-icon="close"
@update:model-value="checkFileExists(data.dmsFk)"
>
<template #prepend>
<QBtn
v-if="data.dmsFk"
:class="{
'no-pointer-events': editDownloadDisabled,
}"
:disable="editDownloadDisabled"
icon="cloud_download"
:title="t('Download file')"
padding="xs"
round
@click="downloadFile(data.dmsFk)"
/>
</template>
<template #append>
<QBtn
:class="{
'no-pointer-events': editDownloadDisabled,
}"
:disable="editDownloadDisabled"
v-if="data.dmsFk"
icon="edit"
round
padding="xs"
@click="setEditDms(data.dmsFk)"
>
<QTooltip>{{ t('Edit document') }}</QTooltip>
</QBtn>
<QBtn
v-else
icon="add_circle"
round
padding="xs"
@click="setCreateDms()"
>
<QTooltip>{{ t('Create document') }}</QTooltip>
</QBtn>
</template>
</QInput>
</VnRow>
<VnRow>
<QInput
:label="t('Entry date')"
v-model="data.bookEntried"
clearable
clear-icon="close"
:mask="dateMask"
:fill-mask="fillMask"
>
<template #append>
<QIcon name="event" class="cursor-pointer">
<QPopupProxy
cover
transition-show="scale"
transition-hide="scale"
> >
<QTooltip>{{ t('Create document') }}</QTooltip> <QDate v-model="data.bookEntried" :mask="dateMask">
</QBtn> <div class="row items-center justify-end">
</template> <QBtn
</QInput> v-close-popup
</div> label="Close"
</div> color="primary"
<div class="row q-gutter-md q-mb-md"> flat
<div class="col"> />
<QInput </div>
:label="t('Entry date')" </QDate>
v-model="data.bookEntried" </QPopupProxy>
clearable </QIcon>
clear-icon="close" </template>
:mask="dateMask" </QInput>
:fill-mask="fillMask"
> <QInput
<template #append> :label="t('Accounted date')"
<QIcon name="event" class="cursor-pointer"> v-model="data.booked"
<QPopupProxy clearable
cover clear-icon="close"
transition-show="scale" :mask="dateMask"
transition-hide="scale" :fill-mask="fillMask"
> >
<QDate v-model="data.bookEntried" :mask="dateMask"> <template #append>
<div class="row items-center justify-end"> <QIcon name="event" class="cursor-pointer">
<QBtn <QPopupProxy
v-close-popup cover
label="Close" transition-show="scale"
color="primary" transition-hide="scale"
flat >
/> <QDate v-model="data.booked" :mask="maskDate">
</div> <div class="row items-center justify-end">
</QDate> <QBtn
</QPopupProxy> v-close-popup
</QIcon> label="Close"
</template> color="primary"
</QInput> flat
</div> />
<div class="col"> </div>
<QInput </QDate>
:label="t('Accounted date')" </QPopupProxy>
v-model="data.booked" </QIcon>
clearable </template>
clear-icon="close" </QInput>
:mask="dateMask" </VnRow>
:fill-mask="fillMask" <VnRow>
> <VnSelectFilter
<template #append> :label="t('Currency')"
<QIcon name="event" class="cursor-pointer"> v-model="data.currencyFk"
<QPopupProxy :options="currencies"
cover option-value="id"
transition-show="scale" option-label="code"
transition-hide="scale" />
>
<QDate v-model="data.booked" :mask="maskDate"> <VnSelectFilter
<div class="row items-center justify-end"> v-if="companiesRef"
<QBtn :label="t('Company')"
v-close-popup v-model="data.companyFk"
label="Close" :options="companies"
color="primary" option-value="id"
flat option-label="code"
/> />
</div> </VnRow>
</QDate> <VnRow>
</QPopupProxy> <QCheckbox
</QIcon> :label="t('invoiceIn.summary.booked')"
</template> v-model="data.isBooked"
</QInput> />
</div> </VnRow>
</div>
<div class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Currency')"
v-model="data.currencyFk"
:options="currencies"
option-value="id"
option-label="code"
/>
</div>
<div class="col">
<VnSelectFilter
v-if="companiesRef"
:label="t('Company')"
v-model="data.companyFk"
:options="companies"
option-value="id"
option-label="code"
/>
</div>
</div>
<div class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox
:label="t('invoiceIn.summary.booked')"
v-model="data.isBooked"
/>
</div>
<div class="col"></div>
</div>
</template> </template>
</FormModel> </FormModel>
<QDialog ref="editDmsRef"> <QDialog ref="editDmsRef">