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';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
id: { type: Number, default: null },
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -51,6 +47,10 @@ const actions = {
|
|||
cb: checkToBook,
|
||||
action: toBook,
|
||||
},
|
||||
unbook: {
|
||||
title: 'Are you sure you want to unbook this invoice?',
|
||||
action: toUnbook,
|
||||
},
|
||||
delete: {
|
||||
title: 'Are you sure you want to delete this invoice?',
|
||||
action: deleteInvoice,
|
||||
|
@ -235,6 +235,19 @@ async function toBook() {
|
|||
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() {
|
||||
await axios.delete(`InvoiceIns/${entityId.value}`);
|
||||
quasar.notify({
|
||||
|
@ -253,8 +266,6 @@ async function cloneInvoice() {
|
|||
router.push({ path: `/invoice-in/${data.id}/summary` });
|
||||
}
|
||||
|
||||
const requiredFieldRule = (val) => val || t('globals.requiredField');
|
||||
|
||||
const isAdministrative = () => hasAny(['administrative']);
|
||||
|
||||
const isAgricultural = () =>
|
||||
|
@ -346,6 +357,16 @@ const createInvoiceInCorrection = async () => {
|
|||
>
|
||||
<QItemSection>{{ t('To book') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="entity.isBooked && isAdministrative()"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="triggerMenu('unbook')"
|
||||
>
|
||||
<QItemSection>
|
||||
{{ t('To unbook') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isAdministrative()"
|
||||
v-ripple
|
||||
|
@ -491,7 +512,7 @@ const createInvoiceInCorrection = async () => {
|
|||
:options="siiTypeInvoiceOuts"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
:rules="[requiredFieldRule]"
|
||||
:required="true"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
|
@ -501,7 +522,7 @@ const createInvoiceInCorrection = async () => {
|
|||
:options="cplusRectificationTypes"
|
||||
option-value="id"
|
||||
option-label="description"
|
||||
:rules="[requiredFieldRule]"
|
||||
:required="true"
|
||||
/>
|
||||
<VnSelectFilter
|
||||
:label="`${useCapitalize(t('globals.reason'))}*`"
|
||||
|
@ -509,7 +530,7 @@ const createInvoiceInCorrection = async () => {
|
|||
:options="invoiceCorrectionTypes"
|
||||
option-value="id"
|
||||
option-label="description"
|
||||
:rules="[requiredFieldRule]"
|
||||
:required="true"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -549,9 +570,14 @@ const createInvoiceInCorrection = async () => {
|
|||
}
|
||||
</style>
|
||||
<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:
|
||||
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 unbook this invoice?: Estas seguro de querer desasentar esta factura?
|
||||
Delete invoice: Eliminar factura
|
||||
Are you sure you want to delete this invoice?: Estas seguro de querer eliminar esta factura?
|
||||
Invoice deleted: Factura eliminada
|
||||
|
@ -565,4 +591,6 @@ es:
|
|||
Rectificative invoice: Factura rectificativa
|
||||
Original invoice: Factura origen
|
||||
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>
|
||||
|
|
Loading…
Reference in New Issue