#7936 improve InvoiceIn #1004
|
@ -1,9 +1,8 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, capitalize } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useCapitalize } from 'src/composables/useCapitalize';
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
@ -31,7 +30,7 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
name: 'type',
|
||||
label: useCapitalize(t('globals.type')),
|
||||
label: capitalize(t('globals.type')),
|
||||
field: (row) => row.cplusRectificationTypeFk,
|
||||
options: cplusRectificationTypes.value,
|
||||
model: 'cplusRectificationTypeFk',
|
||||
|
@ -43,10 +42,10 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
name: 'class',
|
||||
label: useCapitalize(t('globals.class')),
|
||||
field: (row) => row.siiTypeInvoiceOutFk,
|
||||
options: siiTypeInvoiceOuts.value,
|
||||
model: 'siiTypeInvoiceOutFk',
|
||||
label: capitalize(t('globals.class')),
|
||||
field: (row) => row.siiTypeInvoiceInFk,
|
||||
options: siiTypeInvoiceIns.value,
|
||||
model: 'siiTypeInvoiceInFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'code',
|
||||
sortable: true,
|
||||
|
@ -55,7 +54,7 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
name: 'reason',
|
||||
label: useCapitalize(t('globals.reason')),
|
||||
label: capitalize(t('globals.reason')),
|
||||
field: (row) => row.invoiceCorrectionTypeFk,
|
||||
options: invoiceCorrectionTypes.value,
|
||||
model: 'invoiceCorrectionTypeFk',
|
||||
|
@ -67,9 +66,8 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
const cplusRectificationTypes = ref([]);
|
||||
const siiTypeInvoiceOuts = ref([]);
|
||||
const siiTypeInvoiceIns = ref([]);
|
||||
const invoiceCorrectionTypes = ref([]);
|
||||
const rowsSelected = ref([]);
|
||||
|
||||
const requiredFieldRule = (val) => val || t('globals.requiredField');
|
||||
|
||||
|
@ -82,9 +80,9 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
|||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="SiiTypeInvoiceOuts"
|
||||
url="SiiTypeInvoiceIns"
|
||||
:where="{ code: { like: 'R%' } }"
|
||||
@on-fetch="(data) => (siiTypeInvoiceOuts = data)"
|
||||
@on-fetch="(data) => (siiTypeInvoiceIns = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
|
@ -99,17 +97,15 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
|||
url="InvoiceInCorrections"
|
||||
:filter="filter"
|
||||
auto-load
|
||||
v-model:selected="rowsSelected"
|
||||
primary-key="correctingFk"
|
||||
@save-changes="onSave"
|
||||
:default-remove="false"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
v-model:selected="rowsSelected"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="$index"
|
||||
selection="single"
|
||||
:grid="$q.screen.lt.sm"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
>
|
||||
|
@ -121,8 +117,17 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
|||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:readonly="row.invoiceIn.isBooked"
|
||||
/>
|
||||
:disable="row.invoiceIn.isBooked"
|
||||
:filter-options="['description']"
|
||||
>
|
||||
<template #option="{ opt }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ opt.description }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-class="{ row, col }">
|
||||
|
@ -134,8 +139,20 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
|||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:rules="[requiredFieldRule]"
|
||||
:readonly="row.invoiceIn.isBooked"
|
||||
/>
|
||||
:filter-options="['code', 'description']"
|
||||
:disable="row.invoiceIn.isBooked"
|
||||
>
|
||||
<template #option="{ opt }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QItemLabel
|
||||
>{{ opt.code }} -
|
||||
{{ opt.description }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-reason="{ row, col }">
|
||||
|
@ -147,7 +164,7 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
|||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:rules="[requiredFieldRule]"
|
||||
:readonly="row.invoiceIn.isBooked"
|
||||
:disable="row.invoiceIn.isBooked"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
|
@ -155,7 +172,6 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
|||
</template>
|
||||
</CrudModel>
|
||||
</template>
|
||||
<style lang="scss" scoped></style>
|
||||
<i18n>
|
||||
es:
|
||||
Original invoice: Factura origen
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, reactive, computed, onBeforeMount } from 'vue';
|
||||
import { ref, reactive, computed, onBeforeMount, capitalize } from 'vue';
|
||||
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
@ -15,7 +15,6 @@ import FetchData from 'src/components/FetchData.vue';
|
|||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { useCapitalize } from 'src/composables/useCapitalize';
|
||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
import InvoiceInToBook from '../InvoiceInToBook.vue';
|
||||
|
||||
|
@ -37,7 +36,7 @@ const totalAmount = ref();
|
|||
const currentAction = ref();
|
||||
const config = ref();
|
||||
const cplusRectificationTypes = ref([]);
|
||||
const siiTypeInvoiceOuts = ref([]);
|
||||
const siiTypeInvoiceIns = ref([]);
|
||||
const invoiceCorrectionTypes = ref([]);
|
||||
const actions = {
|
||||
unbook: {
|
||||
|
@ -119,7 +118,7 @@ const routes = reactive({
|
|||
const correctionFormData = reactive({
|
||||
invoiceReason: 2,
|
||||
invoiceType: 2,
|
||||
invoiceClass: 6,
|
||||
invoiceClass: 8,
|
||||
});
|
||||
const isNotFilled = computed(() => Object.values(correctionFormData).includes(null));
|
||||
|
||||
|
@ -262,9 +261,9 @@ const createInvoiceInCorrection = async () => {
|
|||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="SiiTypeInvoiceOuts"
|
||||
url="siiTypeInvoiceIns"
|
||||
:where="{ code: { like: 'R%' } }"
|
||||
@on-fetch="(data) => (siiTypeInvoiceOuts = data)"
|
||||
@on-fetch="(data) => (siiTypeInvoiceIns = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
|
@ -438,9 +437,9 @@ const createInvoiceInCorrection = async () => {
|
|||
readonly
|
||||
/>
|
||||
<VnSelect
|
||||
:label="`${useCapitalize(t('globals.class'))}`"
|
||||
:label="`${capitalize(t('globals.class'))}`"
|
||||
v-model="correctionFormData.invoiceClass"
|
||||
:options="siiTypeInvoiceOuts"
|
||||
:options="siiTypeInvoiceIns"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
:required="true"
|
||||
|
@ -448,15 +447,27 @@ const createInvoiceInCorrection = async () => {
|
|||
</QItemSection>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="`${useCapitalize(t('globals.type'))}`"
|
||||
:label="`${capitalize(t('globals.type'))}`"
|
||||
v-model="correctionFormData.invoiceType"
|
||||
:options="cplusRectificationTypes"
|
||||
option-value="id"
|
||||
option-label="description"
|
||||
:required="true"
|
||||
/>
|
||||
>
|
||||
<template #option="{ opt }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QItemLabel
|
||||
>{{ opt.code }} -
|
||||
{{ opt.description }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<div></div>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
:label="`${useCapitalize(t('globals.reason'))}`"
|
||||
:label="`${capitalize(t('globals.reason'))}`"
|
||||
v-model="correctionFormData.invoiceReason"
|
||||
:options="invoiceCorrectionTypes"
|
||||
option-value="id"
|
||||
|
|
Loading…
Reference in New Issue