Merge branch 'dev' into feature/WeeklyTickets
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
0715e86530
|
@ -2,7 +2,8 @@
|
||||||
import { ref, reactive } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
@ -18,33 +19,68 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const quasar = useQuasar();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
const checked = ref(true);
|
||||||
const transferInvoiceParams = reactive({
|
const transferInvoiceParams = reactive({
|
||||||
id: $props.invoiceOutData?.id,
|
id: $props.invoiceOutData?.id,
|
||||||
refFk: $props.invoiceOutData?.ref,
|
refFk: $props.invoiceOutData?.ref,
|
||||||
});
|
});
|
||||||
const closeButton = ref(null);
|
|
||||||
const clientsOptions = ref([]);
|
|
||||||
const rectificativeTypeOptions = ref([]);
|
const rectificativeTypeOptions = ref([]);
|
||||||
const siiTypeInvoiceOutsOptions = ref([]);
|
const siiTypeInvoiceOutsOptions = ref([]);
|
||||||
const invoiceCorrectionTypesOptions = ref([]);
|
const invoiceCorrectionTypesOptions = ref([]);
|
||||||
|
|
||||||
const closeForm = () => {
|
const selectedClient = (client) => {
|
||||||
if (closeButton.value) closeButton.value.click();
|
transferInvoiceParams.selectedClientData = client;
|
||||||
};
|
};
|
||||||
|
|
||||||
const transferInvoice = async () => {
|
const makeInvoice = async () => {
|
||||||
|
const hasToInvoiceByAddress =
|
||||||
|
transferInvoiceParams.selectedClientData.hasToInvoiceByAddress;
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
id: transferInvoiceParams.id,
|
||||||
|
cplusRectificationTypeFk: transferInvoiceParams.cplusRectificationTypeFk,
|
||||||
|
invoiceCorrectionTypeFk: transferInvoiceParams.invoiceCorrectionTypeFk,
|
||||||
|
newClientFk: transferInvoiceParams.newClientFk,
|
||||||
|
refFk: transferInvoiceParams.refFk,
|
||||||
|
siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk,
|
||||||
|
makeInvoice: checked.value,
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await axios.post(
|
if (checked.value && hasToInvoiceByAddress) {
|
||||||
'InvoiceOuts/transferInvoice',
|
const response = await new Promise((resolve) => {
|
||||||
transferInvoiceParams
|
quasar
|
||||||
);
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('Bill destination client'),
|
||||||
|
message: t('transferInvoiceInfo'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(() => {
|
||||||
|
resolve(true);
|
||||||
|
})
|
||||||
|
.onCancel(() => {
|
||||||
|
resolve(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (!response) {
|
||||||
|
console.log('entra cuando no checkbox');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('params: ', params);
|
||||||
|
const { data } = await axios.post('InvoiceOuts/transferInvoice', params);
|
||||||
|
console.log('data: ', data);
|
||||||
notify(t('Transferred invoice'), 'positive');
|
notify(t('Transferred invoice'), 'positive');
|
||||||
closeForm();
|
const id = data?.[0];
|
||||||
router.push('InvoiceOutSummary', { id: data.id });
|
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error transfering invoice', err);
|
console.error('Error transfering invoice', err);
|
||||||
}
|
}
|
||||||
|
@ -52,22 +88,30 @@ const transferInvoice = async () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
url="Clients"
|
|
||||||
@on-fetch="(data) => (clientsOptions = data)"
|
|
||||||
:filter="{ fields: ['id', 'name'], order: 'id', limit: 30 }"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
url="CplusRectificationTypes"
|
url="CplusRectificationTypes"
|
||||||
:filter="{ order: 'description' }"
|
:filter="{ order: 'description' }"
|
||||||
@on-fetch="(data) => (rectificativeTypeOptions = data)"
|
@on-fetch="
|
||||||
|
(data) => (
|
||||||
|
(rectificativeTypeOptions = data),
|
||||||
|
(transferInvoiceParams.cplusRectificationTypeFk = data.filter(
|
||||||
|
(type) => type.description == 'I – Por diferencias'
|
||||||
|
)[0].id)
|
||||||
|
)
|
||||||
|
"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="SiiTypeInvoiceOuts"
|
url="SiiTypeInvoiceOuts"
|
||||||
:filter="{ where: { code: { like: 'R%' } } }"
|
:filter="{ where: { code: { like: 'R%' } } }"
|
||||||
@on-fetch="(data) => (siiTypeInvoiceOutsOptions = data)"
|
@on-fetch="
|
||||||
|
(data) => (
|
||||||
|
(siiTypeInvoiceOutsOptions = data),
|
||||||
|
(transferInvoiceParams.siiTypeInvoiceOutFk = data.filter(
|
||||||
|
(type) => type.code == 'R4'
|
||||||
|
)[0].id)
|
||||||
|
)
|
||||||
|
"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -76,7 +120,7 @@ const transferInvoice = async () => {
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FormPopup
|
<FormPopup
|
||||||
@on-submit="transferInvoice()"
|
@on-submit="makeInvoice()"
|
||||||
:title="t('Transfer invoice')"
|
:title="t('Transfer invoice')"
|
||||||
:custom-submit-button-label="t('Transfer client')"
|
:custom-submit-button-label="t('Transfer client')"
|
||||||
:default-cancel-button="false"
|
:default-cancel-button="false"
|
||||||
|
@ -91,13 +135,18 @@ const transferInvoice = async () => {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="transferInvoiceParams.newClientFk"
|
v-model="transferInvoiceParams.newClientFk"
|
||||||
:required="true"
|
:required="true"
|
||||||
|
url="Clients"
|
||||||
|
:fields="['id', 'name', 'hasToInvoiceByAddress']"
|
||||||
|
auto-load
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem
|
||||||
|
v-bind="scope.itemProps"
|
||||||
|
@click="selectedClient(scope.opt)"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>
|
<QItemLabel>
|
||||||
#{{ scope.opt?.id }} -
|
#{{ scope.opt?.id }} - {{ scope.opt?.name }}
|
||||||
{{ scope.opt?.name }}
|
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -144,11 +193,23 @@ const transferInvoice = async () => {
|
||||||
:required="true"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<div>
|
||||||
|
<QCheckbox :label="t('Bill destination client')" v-model="checked" />
|
||||||
|
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
||||||
|
<QTooltip>{{ t('transferInvoiceInfo') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormPopup>
|
</FormPopup>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
en:
|
||||||
|
checkInfo: New tickets from the destination customer will be generated in the consignee by default.
|
||||||
|
transferInvoiceInfo: Destination customer is marked to bill in the consignee
|
||||||
|
confirmTransferInvoice: The destination customer has selected to bill in the consignee, do you want to continue?
|
||||||
es:
|
es:
|
||||||
Transfer invoice: Transferir factura
|
Transfer invoice: Transferir factura
|
||||||
Transfer client: Transferir cliente
|
Transfer client: Transferir cliente
|
||||||
|
@ -157,4 +218,7 @@ es:
|
||||||
Class: Clase
|
Class: Clase
|
||||||
Type: Tipo
|
Type: Tipo
|
||||||
Transferred invoice: Factura transferida
|
Transferred invoice: Factura transferida
|
||||||
|
Bill destination client: Facturar cliente destino
|
||||||
|
transferInvoiceInfo: Los nuevos tickets del cliente destino, serán generados en el consignatario por defecto.
|
||||||
|
confirmTransferInvoice: El cliente destino tiene marcado facturar por consignatario, desea continuar?
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
Loading…
Reference in New Issue