#4466 invoiceInCorrection #176
|
@ -76,8 +76,13 @@ defineExpose({
|
|||
reset,
|
||||
hasChanges,
|
||||
saveChanges,
|
||||
getFormData,
|
||||
});
|
||||
|
||||
function getFormData() {
|
||||
return formData.value;
|
||||
}
|
||||
|
||||
async function fetch(data) {
|
||||
if (data && Array.isArray(data)) {
|
||||
let $index = 0;
|
||||
|
@ -196,12 +201,13 @@ function getChanges() {
|
|||
const creates = [];
|
||||
|
||||
const pk = $props.primaryKey;
|
||||
|
||||
for (const [i, row] of formData.value.entries()) {
|
||||
console.log(pk, row);
|
||||
if (!row[pk]) {
|
||||
creates.push(row);
|
||||
} else if (originalData.value) {
|
||||
const data = getDifferences(originalData.value[i], row);
|
||||
console.log(data);
|
||||
if (!isEmpty(data)) {
|
||||
updates.push({
|
||||
data,
|
||||
|
@ -211,7 +217,7 @@ function getChanges() {
|
|||
}
|
||||
}
|
||||
const changes = { updates, creates };
|
||||
|
||||
console.log('ddd', changes);
|
||||
for (let prop in changes) {
|
||||
if (changes[prop].length === 0) changes[prop] = undefined;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ function addChildren(module, route, parent) {
|
|||
const matches = findMatches(mainMenus, route);
|
||||
|
||||
for (const child of matches) {
|
||||
navigation.addMenuItem(module, child, parent);
|
||||
if (!child.meta.hidden) navigation.addMenuItem(module, child, parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ const value = computed({
|
|||
name="close"
|
||||
@click.stop="value = null"
|
||||
class="cursor-pointer"
|
||||
size="18px"
|
||||
size="xs"
|
||||
/>
|
||||
</template>
|
||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData">
|
||||
|
|
|
@ -63,6 +63,10 @@ export default {
|
|||
selectRows: 'Select all { numberRows } row(s)',
|
||||
allRows: 'All { numberRows } row(s)',
|
||||
markAll: 'Mark all',
|
||||
requiredField: 'Required field',
|
||||
jorgep marked this conversation as resolved
|
||||
class: 'clase',
|
||||
type: 'type',
|
||||
reason: 'reason',
|
||||
},
|
||||
errors: {
|
||||
statusUnauthorized: 'Access denied',
|
||||
|
@ -493,6 +497,7 @@ export default {
|
|||
vat: 'VAT',
|
||||
dueDay: 'Due day',
|
||||
intrastat: 'Intrastat',
|
||||
corrective: 'Corrective',
|
||||
log: 'Logs',
|
||||
},
|
||||
list: {
|
||||
|
|
|
@ -62,6 +62,10 @@ export default {
|
|||
selectRows: 'Seleccionar las { numberRows } filas(s)',
|
||||
allRows: 'Todo { numberRows } filas(s)',
|
||||
markAll: 'Marcar todo',
|
||||
requiredField: 'Campo obligatorio',
|
||||
class: 'clase',
|
||||
type: 'tipo',
|
||||
reason: 'motivo',
|
||||
},
|
||||
errors: {
|
||||
statusUnauthorized: 'Acceso denegado',
|
||||
|
@ -494,6 +498,7 @@ export default {
|
|||
vat: 'IVA',
|
||||
dueDay: 'Vencimiento',
|
||||
intrastat: 'Intrastat',
|
||||
corrective: 'Rectificativa',
|
||||
log: 'Registros de auditoría',
|
||||
},
|
||||
list: {
|
||||
|
|
|
@ -37,7 +37,7 @@ const inputFileRef = ref();
|
|||
const editDmsRef = ref();
|
||||
const createDmsRef = ref();
|
||||
|
||||
const requiredFieldRule = (val) => val || t('Required field');
|
||||
const requiredFieldRule = (val) => val || t('globals.requiredField');
|
||||
const dateMask = '####-##-##';
|
||||
const fillMask = '_';
|
||||
|
||||
|
@ -697,7 +697,6 @@ async function upsert() {
|
|||
Type: Tipo
|
||||
Description: Descripción
|
||||
Generate identifier for original file: Generar identificador para archivo original
|
||||
Required field: Campo obligatorio
|
||||
File: Fichero
|
||||
Create document: Crear documento
|
||||
Select a file: Seleccione un fichero
|
||||
|
|
|
@ -43,18 +43,16 @@ const arrayData = useArrayData('InvoiceIn', {
|
|||
filter,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await arrayData.fetch({ append: false });
|
||||
watch(
|
||||
() => route.params.id,
|
||||
async (newId, oldId) => {
|
||||
if (newId) {
|
||||
arrayData.store.url = `InvoiceIns/${newId}`;
|
||||
await arrayData.fetch({ append: false });
|
||||
}
|
||||
onMounted(async () => await arrayData.fetch({ append: false }));
|
||||
watch(
|
||||
jsegarra marked this conversation as resolved
jsegarra
commented
Aquí sólo ha cambiado el formateo, no? Aquí sólo ha cambiado el formateo, no?
jorgep
commented
Sí, la funcionalidad es la misma. Sí, la funcionalidad es la misma.
|
||||
() => route.params.id,
|
||||
async (newId, oldId) => {
|
||||
if (newId) {
|
||||
arrayData.store.url = `InvoiceIns/${newId}`;
|
||||
await arrayData.fetch({ append: false });
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useFirstUpper } from 'src/composables/useFirstUpper';
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const invoiceId = route.params.id;
|
||||
const arrayData = useArrayData('InvoiceIn');
|
||||
const invoiceIn = computed(() => arrayData.store.data);
|
||||
const invoiceInCorrectionRef = ref();
|
||||
const filter = {
|
||||
include: { relation: 'invoiceIn' },
|
||||
where: { correctingFk: invoiceId },
|
||||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'origin',
|
||||
label: t('Original invoice'),
|
||||
field: (row) => row.correctedFk,
|
||||
sortable: true,
|
||||
tabIndex: 1,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'type',
|
||||
label: useFirstUpper(t('globals.type')),
|
||||
field: (row) => row.cplusRectificationTypeFk,
|
||||
options: cplusRectificationTypes.value,
|
||||
model: 'cplusRectificationTypeFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
sortable: true,
|
||||
tabIndex: 1,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'class',
|
||||
label: useFirstUpper(t('globals.class')),
|
||||
jorgep marked this conversation as resolved
alexm
commented
Veo mas llamarle type Veo mas llamarle type
jorgep
commented
Ya hay un campo type y en salix este campo se llama clase Ya hay un campo type y en salix este campo se llama clase
|
||||
field: (row) => row.siiTypeInvoiceOutFk,
|
||||
options: siiTypeInvoiceOuts.value,
|
||||
model: 'siiTypeInvoiceOutFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'id',
|
||||
sortable: true,
|
||||
tabIndex: 1,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'reason',
|
||||
label: useFirstUpper(t('globals.reason')),
|
||||
field: (row) => row.invoiceCorrectionTypeFk,
|
||||
options: invoiceCorrectionTypes.value,
|
||||
model: 'invoiceCorrectionTypeFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
sortable: true,
|
||||
tabIndex: 1,
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
const cplusRectificationTypes = ref([]);
|
||||
const siiTypeInvoiceOuts = ref([]);
|
||||
const invoiceCorrectionTypes = ref([]);
|
||||
const rowsSelected = ref([]);
|
||||
|
||||
const requiredFieldRule = (val) => val || t('globals.requiredField');
|
||||
|
||||
const onSave = (data) => data.deletes && router.push(`/invoice-in/${invoiceId}/summary`);
|
||||
</script>
|
||||
jsegarra
commented
Duda, porque se usa data.deletes? Duda, porque se usa data.deletes?
jorgep
commented
está así en el crudModel está así en el crudModel
|
||||
<template>
|
||||
<FetchData
|
||||
url="CplusRectificationTypes"
|
||||
@on-fetch="(data) => (cplusRectificationTypes = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="SiiTypeInvoiceOuts"
|
||||
:where="{ code: { like: 'R%' } }"
|
||||
@on-fetch="(data) => (siiTypeInvoiceOuts = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="InvoiceCorrectionTypes"
|
||||
@on-fetch="(data) => (invoiceCorrectionTypes = data)"
|
||||
auto-load
|
||||
/>
|
||||
<CrudModel
|
||||
ref="invoiceInCorrectionRef"
|
||||
v-if="invoiceIn"
|
||||
data-key="InvoiceInCorrection"
|
||||
url="InvoiceInCorrections"
|
||||
:filter="filter"
|
||||
auto-load
|
||||
v-model:selected="rowsSelected"
|
||||
primary-key="correctingFk"
|
||||
@save-changes="onSave"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
v-model:selected="rowsSelected"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="$index"
|
||||
selection="single"
|
||||
hide-pagination
|
||||
:grid="$q.screen.lt.sm"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
>
|
||||
<template #body-cell-type="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelectFilter
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:readonly="row.invoiceIn.isBooked"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-class="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelectFilter
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:rules="[requiredFieldRule]"
|
||||
:readonly="row.invoiceIn.isBooked"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-reason="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelectFilter
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:rules="[requiredFieldRule]"
|
||||
:readonly="row.invoiceIn.isBooked"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</CrudModel>
|
||||
</template>
|
||||
<style scoped></style>
|
||||
<i18n>
|
||||
es:
|
||||
Original invoice: Factura origen
|
||||
</i18n>
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, reactive, computed, onBeforeMount, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
@ -15,6 +15,8 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
|||
import FetchData from 'src/components/FetchData.vue';
|
||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import { useFirstUpper } from 'src/composables/useFirstUpper';
|
||||
jorgep marked this conversation as resolved
Outdated
jsegarra
commented
Duda, como se que lo hiciste tu hace 4 meses,...crees que podríamos proponer renombrarlo a useCapitalize. Es que el nombre....FirstUpper...first de que ? Duda, como se que lo hiciste tu hace 4 meses,...crees que podríamos proponer renombrarlo a useCapitalize.
Es que el nombre....FirstUpper...first de que ?
Inlcuso te digo que hay una propiedad css que lo hace:
`.class::first-letter {
text-transform: uppercase
}`
jorgep
commented
es el mismo nombre que en salix, pero el nuevo nombre me parece bien que te digan @alexm , @jgallego y @juan . Lo de usar css... Habría que valorar si siempre queremos añadir una clase. lo digo porque tienes que envolver sí o sí en html el texto. es el mismo nombre que en salix, pero el nuevo nombre me parece bien que te digan @alexm , @jgallego y @juan . Lo de usar css... Habría que valorar si siempre queremos añadir una clase. lo digo porque tienes que envolver sí o sí en html el texto.
jorgep
commented
Se ha quedado en cambiarlo a useCapitalize Se ha quedado en cambiarlo a useCapitalize
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -34,11 +36,14 @@ const arrayData = useArrayData('InvoiceIn');
|
|||
|
||||
const invoiceIn = computed(() => arrayData.store.data);
|
||||
const cardDescriptorRef = ref();
|
||||
const correctionDialogRef = ref();
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const totalAmount = ref();
|
||||
const currentAction = ref();
|
||||
const config = ref();
|
||||
|
||||
const cplusRectificationTypes = ref([]);
|
||||
const siiTypeInvoiceOuts = ref([]);
|
||||
const invoiceCorrectionTypes = ref([]);
|
||||
const actions = {
|
||||
book: {
|
||||
title: 'Are you sure you want to book this invoice?',
|
||||
|
@ -59,6 +64,9 @@ const actions = {
|
|||
sendPdf: {
|
||||
cb: sendPdfInvoiceConfirmation,
|
||||
},
|
||||
correct: {
|
||||
cb: () => correctionDialogRef.value.show(),
|
||||
},
|
||||
};
|
||||
const filter = {
|
||||
include: [
|
||||
|
@ -86,8 +94,90 @@ const filter = {
|
|||
},
|
||||
],
|
||||
};
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
const invoiceInCorrection = reactive({
|
||||
correcting: [],
|
||||
corrected: null,
|
||||
});
|
||||
const routes = reactive({
|
||||
getSupplier: (id) => {
|
||||
return { name: 'SupplierCard', params: { id } };
|
||||
},
|
||||
getTickets: (id) => {
|
||||
return {
|
||||
name: 'InvoiceInList',
|
||||
query: {
|
||||
params: JSON.stringify({ supplierFk: id }),
|
||||
},
|
||||
};
|
||||
},
|
||||
getCorrection: (invoiceInCorrection) => {
|
||||
if (invoiceInCorrection.correcting.length > 1) {
|
||||
return;
|
||||
// Se crea una sección aparte?
|
||||
/* return {
|
||||
name: 'InvoiceInList',
|
||||
params: {
|
||||
search: invoiceInCorrection.correcting.join(),
|
||||
},
|
||||
}; */
|
||||
}
|
||||
|
||||
return {
|
||||
name: 'InvoiceInCard',
|
||||
params: {
|
||||
id: invoiceInCorrection.corrected ?? invoiceInCorrection.correcting[0],
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
const correctionFormData = reactive({
|
||||
id: +entityId.value,
|
||||
invoiceReason: 2,
|
||||
invoiceType: 2,
|
||||
invoiceClass: 6,
|
||||
});
|
||||
const isNotFilled = computed(() => Object.values(correctionFormData).includes(null));
|
||||
|
||||
onBeforeMount(async () => await setInvoiceCorrection(entityId.value));
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
async (newId, oldId) => {
|
||||
invoiceInCorrection.correcting.length = 0;
|
||||
invoiceInCorrection.corrected = null;
|
||||
if (newId) await setInvoiceCorrection(entityId.value);
|
||||
}
|
||||
);
|
||||
|
||||
async function setInvoiceCorrection(id) {
|
||||
const [{ data: correctingData }, { data: correctedData }] = await Promise.all([
|
||||
axios.get('InvoiceInCorrections', {
|
||||
params: {
|
||||
filter: {
|
||||
where: {
|
||||
correctingFk: id,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
await axios.get('InvoiceInCorrections', {
|
||||
params: {
|
||||
filter: {
|
||||
where: {
|
||||
correctedFk: id,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
]);
|
||||
|
||||
if (correctingData[0]) invoiceInCorrection.corrected = correctingData[0].correctedFk;
|
||||
|
||||
invoiceInCorrection.correcting = correctedData.map(
|
||||
(corrected) => corrected.correctingFk
|
||||
);
|
||||
}
|
||||
|
||||
async function setData(entity) {
|
||||
data.value = useCardDescription(entity.supplierRef, entity.id);
|
||||
|
@ -104,7 +194,7 @@ function openDialog() {
|
|||
quasar.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: currentAction.value.title,
|
||||
title: t(currentAction.value.title),
|
||||
promise: currentAction.value.action,
|
||||
},
|
||||
});
|
||||
|
@ -163,6 +253,8 @@ async function cloneInvoice() {
|
|||
router.push({ path: `/invoice-in/${data.id}/summary` });
|
||||
}
|
||||
|
||||
const requiredFieldRule = (val) => val || t('globals.requiredField');
|
||||
|
||||
const isAdministrative = () => hasAny(['administrative']);
|
||||
|
||||
const isAgricultural = () =>
|
||||
|
@ -202,6 +294,14 @@ function triggerMenu(type) {
|
|||
if (currentAction.value.cb) currentAction.value.cb();
|
||||
else openDialog(type);
|
||||
}
|
||||
|
||||
const createInvoiceInCorrection = async () => {
|
||||
const { data: correctingId } = await axios.post(
|
||||
'InvoiceIns/corrective',
|
||||
correctionFormData
|
||||
);
|
||||
router.push({ path: `/invoice-in/${correctingId}/summary` });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -211,6 +311,22 @@ function triggerMenu(type) {
|
|||
auto-load
|
||||
@on-fetch="(data) => (config = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="CplusRectificationTypes"
|
||||
@on-fetch="(data) => (cplusRectificationTypes = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="SiiTypeInvoiceOuts"
|
||||
:where="{ code: { like: 'R%' } }"
|
||||
@on-fetch="(data) => (siiTypeInvoiceOuts = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="InvoiceCorrectionTypes"
|
||||
@on-fetch="(data) => (invoiceCorrectionTypes = data)"
|
||||
auto-load
|
||||
/>
|
||||
<!--Refactor para añadir en el arrayData-->
|
||||
<CardDescriptor
|
||||
ref="cardDescriptorRef"
|
||||
|
@ -265,6 +381,22 @@ function triggerMenu(type) {
|
|||
>{{ t('Send agricultural receipt as PDF') }}...</QItemSection
|
||||
>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="!invoiceInCorrection.corrected"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="triggerMenu('correct')"
|
||||
>
|
||||
<QItemSection>{{ t('Create rectificative invoice') }}...</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="entity.dmsFk"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="downloadFile(entity.dmsFk)"
|
||||
>
|
||||
<QItemSection>{{ t('components.smartCard.downloadFile') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="entity.dmsFk"
|
||||
v-ripple
|
||||
|
@ -285,29 +417,122 @@ function triggerMenu(type) {
|
|||
</template>
|
||||
<template #actions="{ entity }">
|
||||
<QCardActions>
|
||||
<!--Sección proveedores no disponible-->
|
||||
<!--Falta crear supplier descriptor-->
|
||||
<!-- <QBtn
|
||||
size="md"
|
||||
icon="person"
|
||||
color="primary"
|
||||
:to="routes.getSupplierRoute(entity.supplierFk)"
|
||||
>
|
||||
<QTooltip>{{ t('invoiceIn.list.supplier') }}</QTooltip>
|
||||
</QBtn> -->
|
||||
<!--Sección entradas no disponible-->
|
||||
<QBtn
|
||||
size="md"
|
||||
icon="vn:ticket"
|
||||
color="primary"
|
||||
:to="{
|
||||
name: 'InvoiceInList',
|
||||
query: {
|
||||
params: JSON.stringify({ supplierFk: entity.supplierFk }),
|
||||
},
|
||||
}"
|
||||
:to="routes.getTickets(entity.supplierFk)"
|
||||
>
|
||||
<QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip>
|
||||
</QBtn>
|
||||
<!--Falta crear los iconos con la flecha-->
|
||||
<QBtn
|
||||
v-if="
|
||||
invoiceInCorrection.corrected ||
|
||||
invoiceInCorrection.correcting.length
|
||||
"
|
||||
size="md"
|
||||
icon="attachment"
|
||||
color="primary"
|
||||
:to="routes.getCorrection(invoiceInCorrection)"
|
||||
>
|
||||
<QTooltip>{{
|
||||
invoiceInCorrection.corrected
|
||||
? t('Original invoice')
|
||||
: t('Rectificative invoice')
|
||||
}}</QTooltip>
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
<QDialog ref="correctionDialogRef">
|
||||
<QCard>
|
||||
<QCardSection>
|
||||
<QItem class="q-px-none">
|
||||
<span class="text-primary text-h6 full-width">
|
||||
{{ t('Create rectificative invoice') }}
|
||||
</span>
|
||||
<QBtn icon="close" flat round dense v-close-popup />
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardSection>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('Original invoice')"
|
||||
v-model="correctionFormData.id"
|
||||
readonly
|
||||
/>
|
||||
<VnSelectFilter
|
||||
:label="`${useFirstUpper(t('globals.class'))}*`"
|
||||
v-model="correctionFormData.invoiceClass"
|
||||
:options="siiTypeInvoiceOuts"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
:rules="[requiredFieldRule]"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="`${useFirstUpper(t('globals.type'))}*`"
|
||||
v-model="correctionFormData.invoiceType"
|
||||
:options="cplusRectificationTypes"
|
||||
option-value="id"
|
||||
option-label="description"
|
||||
:rules="[requiredFieldRule]"
|
||||
/>
|
||||
<VnSelectFilter
|
||||
:label="`${useFirstUpper(t('globals.reason'))}*`"
|
||||
v-model="correctionFormData.invoiceReason"
|
||||
:options="invoiceCorrectionTypes"
|
||||
option-value="id"
|
||||
option-label="description"
|
||||
:rules="[requiredFieldRule]"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardActions class="justify-end q-mr-sm">
|
||||
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
|
||||
<QBtn
|
||||
:label="t('globals.save')"
|
||||
color="primary"
|
||||
v-close-popup
|
||||
@click="createInvoiceInCorrection"
|
||||
:disable="isNotFilled"
|
||||
/>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.q-dialog {
|
||||
.q-card {
|
||||
width: 35em;
|
||||
max-width: 45em;
|
||||
.q-item__section > .q-input {
|
||||
padding-bottom: 1.4em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-xs) {
|
||||
.q-dialog {
|
||||
.q-card__section:nth-child(2) {
|
||||
.q-item,
|
||||
.q-item__section {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -324,4 +549,7 @@ es:
|
|||
Send agricultural receipt as PDF: Enviar recibo agrícola como PDF
|
||||
Are you sure you want to send it?: Estás seguro que quieres enviarlo?
|
||||
Send PDF invoice: Enviar factura a PDF
|
||||
Create rectificative invoice: Crear factura rectificativa
|
||||
Rectificative invoice: Factura rectificativa
|
||||
Original invoice: Factura origen
|
||||
</i18n>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { RouterView } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
|
||||
export default {
|
||||
path: '/invoice-in',
|
||||
|
@ -16,6 +17,7 @@ export default {
|
|||
'InvoiceInVat',
|
||||
'InvoiceInDueDay',
|
||||
'InvoiceInIntrastat',
|
||||
'InvoiceInCorrective',
|
||||
],
|
||||
},
|
||||
children: [
|
||||
|
@ -40,6 +42,24 @@ export default {
|
|||
name: 'InvoiceInCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
|
||||
beforeEnter: async (to, from, next) => {
|
||||
const card = to.matched.find((match) => match.name == 'InvoiceInCard');
|
||||
const corrective = card.children.find(
|
||||
(child) => child.name == 'InvoiceInCorrective'
|
||||
);
|
||||
|
||||
const { data: correctings } = await axios.get('InvoiceInCorrections', {
|
||||
params: {
|
||||
filter: {
|
||||
where: {
|
||||
correctingFk: to.params.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
corrective.meta.hidden = !correctings.length > 0;
|
||||
next();
|
||||
},
|
||||
redirect: { name: 'InvoiceInSummary' },
|
||||
children: [
|
||||
{
|
||||
|
@ -92,6 +112,16 @@ export default {
|
|||
component: () =>
|
||||
import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'),
|
||||
},
|
||||
{
|
||||
name: 'InvoiceInCorrective',
|
||||
path: 'corrective',
|
||||
meta: {
|
||||
title: 'corrective',
|
||||
icon: 'attachment',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/InvoiceIn/Card/InvoiceInCorrective.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
class: 'clase'??
Es una traducción.