forked from verdnatura/salix-front
feat: refs #6942 to unbook
This commit is contained in:
parent
87d458e196
commit
5551781bac
|
@ -20,11 +20,7 @@ import { useCapitalize } from 'src/composables/useCapitalize';
|
||||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: { type: Number, default: null },
|
||||||
type: Number,
|
|
||||||
required: false,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -51,6 +47,10 @@ const actions = {
|
||||||
cb: checkToBook,
|
cb: checkToBook,
|
||||||
action: toBook,
|
action: toBook,
|
||||||
},
|
},
|
||||||
|
unbook: {
|
||||||
|
title: 'Are you sure you want to unbook this invoice?',
|
||||||
|
action: toUnbook,
|
||||||
|
},
|
||||||
delete: {
|
delete: {
|
||||||
title: 'Are you sure you want to delete this invoice?',
|
title: 'Are you sure you want to delete this invoice?',
|
||||||
action: deleteInvoice,
|
action: deleteInvoice,
|
||||||
|
@ -235,6 +235,19 @@ async function toBook() {
|
||||||
setTimeout(() => location.reload(), 500);
|
setTimeout(() => location.reload(), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function toUnbook() {
|
||||||
|
const { data } = await axios.post(`InvoiceIns/${entityId.value}/toUnbook`);
|
||||||
|
const { isLinked, bookEntry, accountingEntries } = data;
|
||||||
|
|
||||||
|
const type = isLinked ? 'warning' : 'positive';
|
||||||
|
const message = isLinked
|
||||||
|
? t('isLinked', { bookEntry, accountingEntries })
|
||||||
|
: t('isNotLinked', { bookEntry });
|
||||||
|
|
||||||
|
quasar.notify({ type, message });
|
||||||
|
if (isLinked) await cardDescriptorRef.value.getData();
|
||||||
|
}
|
||||||
|
|
||||||
async function deleteInvoice() {
|
async function deleteInvoice() {
|
||||||
await axios.delete(`InvoiceIns/${entityId.value}`);
|
await axios.delete(`InvoiceIns/${entityId.value}`);
|
||||||
quasar.notify({
|
quasar.notify({
|
||||||
|
@ -253,8 +266,6 @@ async function cloneInvoice() {
|
||||||
router.push({ path: `/invoice-in/${data.id}/summary` });
|
router.push({ path: `/invoice-in/${data.id}/summary` });
|
||||||
}
|
}
|
||||||
|
|
||||||
const requiredFieldRule = (val) => val || t('globals.requiredField');
|
|
||||||
|
|
||||||
const isAdministrative = () => hasAny(['administrative']);
|
const isAdministrative = () => hasAny(['administrative']);
|
||||||
|
|
||||||
const isAgricultural = () =>
|
const isAgricultural = () =>
|
||||||
|
@ -346,6 +357,16 @@ const createInvoiceInCorrection = async () => {
|
||||||
>
|
>
|
||||||
<QItemSection>{{ t('To book') }}</QItemSection>
|
<QItemSection>{{ t('To book') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem
|
||||||
|
v-if="entity.isBooked && isAdministrative()"
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="triggerMenu('unbook')"
|
||||||
|
>
|
||||||
|
<QItemSection>
|
||||||
|
{{ t('To unbook') }}
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QItem
|
<QItem
|
||||||
v-if="isAdministrative()"
|
v-if="isAdministrative()"
|
||||||
v-ripple
|
v-ripple
|
||||||
|
@ -491,7 +512,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
:options="siiTypeInvoiceOuts"
|
:options="siiTypeInvoiceOuts"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
:rules="[requiredFieldRule]"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
|
@ -501,7 +522,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
:options="cplusRectificationTypes"
|
:options="cplusRectificationTypes"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="description"
|
option-label="description"
|
||||||
:rules="[requiredFieldRule]"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
<VnSelectFilter
|
<VnSelectFilter
|
||||||
:label="`${useCapitalize(t('globals.reason'))}*`"
|
:label="`${useCapitalize(t('globals.reason'))}*`"
|
||||||
|
@ -509,7 +530,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
:options="invoiceCorrectionTypes"
|
:options="invoiceCorrectionTypes"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="description"
|
option-label="description"
|
||||||
:rules="[requiredFieldRule]"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -549,9 +570,14 @@ const createInvoiceInCorrection = async () => {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
en:
|
||||||
|
isNotLinked: The entry {bookEntry} has been deleted with {accountingEntries} entries
|
||||||
|
isLinked: The entry {bookEntry} has been linked to Sage. Please contact administration for further information
|
||||||
es:
|
es:
|
||||||
To book: Contabilizar
|
To book: Contabilizar
|
||||||
|
To unbook: Descontabilizar
|
||||||
Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura?
|
Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura?
|
||||||
|
Are you sure you want to unbook this invoice?: Estas seguro de querer desasentar esta factura?
|
||||||
Delete invoice: Eliminar factura
|
Delete invoice: Eliminar factura
|
||||||
Are you sure you want to delete this invoice?: Estas seguro de querer eliminar esta factura?
|
Are you sure you want to delete this invoice?: Estas seguro de querer eliminar esta factura?
|
||||||
Invoice deleted: Factura eliminada
|
Invoice deleted: Factura eliminada
|
||||||
|
@ -565,4 +591,6 @@ es:
|
||||||
Rectificative invoice: Factura rectificativa
|
Rectificative invoice: Factura rectificativa
|
||||||
Original invoice: Factura origen
|
Original invoice: Factura origen
|
||||||
Entry: entrada
|
Entry: entrada
|
||||||
|
isNotLinked: Se ha eliminado el asiento nº {bookEntry} con {accountingEntries} apuntes
|
||||||
|
isLinked: El asiento {bookEntry} fue enlazado a Sage, por favor contacta con administración
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
Loading…
Reference in New Issue