diff --git a/src/components/TransferInvoiceForm.vue b/src/components/TransferInvoiceForm.vue index f013e80fb..1af23583d 100644 --- a/src/components/TransferInvoiceForm.vue +++ b/src/components/TransferInvoiceForm.vue @@ -2,7 +2,8 @@ import { ref, reactive } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRouter } from 'vue-router'; - +import { useQuasar } from 'quasar'; +import VnConfirm from 'components/ui/VnConfirm.vue'; import VnRow from 'components/ui/VnRow.vue'; import FetchData from 'components/FetchData.vue'; import VnSelect from 'components/common/VnSelect.vue'; @@ -18,33 +19,68 @@ const $props = defineProps({ }, }); +const quasar = useQuasar(); const { t } = useI18n(); const router = useRouter(); const { notify } = useNotify(); - +const checked = ref(true); const transferInvoiceParams = reactive({ id: $props.invoiceOutData?.id, refFk: $props.invoiceOutData?.ref, }); -const closeButton = ref(null); -const clientsOptions = ref([]); + const rectificativeTypeOptions = ref([]); const siiTypeInvoiceOutsOptions = ref([]); const invoiceCorrectionTypesOptions = ref([]); -const closeForm = () => { - if (closeButton.value) closeButton.value.click(); +const selectedClient = (client) => { + 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 { - const { data } = await axios.post( - 'InvoiceOuts/transferInvoice', - transferInvoiceParams - ); + if (checked.value && hasToInvoiceByAddress) { + const response = await new Promise((resolve) => { + 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'); - closeForm(); - router.push('InvoiceOutSummary', { id: data.id }); + const id = data?.[0]; + if (id) router.push({ name: 'InvoiceOutSummary', params: { id } }); } catch (err) { console.error('Error transfering invoice', err); } @@ -52,22 +88,30 @@ const transferInvoice = async () => { +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: Transfer invoice: Transferir factura Transfer client: Transferir cliente @@ -157,4 +218,7 @@ es: Class: Clase Type: Tipo 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? diff --git a/src/components/UserPanel.vue b/src/components/UserPanel.vue index 691d3db8f..9c3b456b1 100644 --- a/src/components/UserPanel.vue +++ b/src/components/UserPanel.vue @@ -11,6 +11,7 @@ import VnSelect from 'src/components/common/VnSelect.vue'; import VnRow from 'components/ui/VnRow.vue'; import FetchData from 'components/FetchData.vue'; import { useClipboard } from 'src/composables/useClipboard'; +import VnImg from 'src/components/ui/VnImg.vue'; const state = useState(); const session = useSession(); @@ -47,7 +48,6 @@ const darkMode = computed({ }); const user = state.getUser(); -const token = session.getTokenMultimedia(); const warehousesData = ref(); const companiesData = ref(); const accountBankData = ref(); @@ -149,10 +149,7 @@ function saveUserData(param, value) {
- +
diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 07e82abed..4cd964012 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -22,6 +22,10 @@ const $props = defineProps({ type: String, default: '', }, + clearable: { + type: Boolean, + default: true, + }, }); const { t } = useI18n(); @@ -88,7 +92,7 @@ const inputRules = [ diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index 3c1a12f24..77ab2692d 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -1,5 +1,6 @@ + + + + +es: + Progress: Progreso + Total progress: Progreso total + Cancelled: Cancelado + diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 04ccca889..52cb68438 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -1,6 +1,5 @@