fix: refs #6899 fix openReport call

This commit is contained in:
Jon Elias 2024-07-05 10:16:52 +02:00
parent d4f70355a7
commit 9aa283a612
2 changed files with 11 additions and 9 deletions

View File

@ -134,7 +134,6 @@ const refundInvoice = async (withWarehouse) => {
}; };
const showTransferInvoiceForm = async () => { const showTransferInvoiceForm = async () => {
$props.menuRef.hide();
quasar.dialog({ quasar.dialog({
component: TransferInvoiceForm, component: TransferInvoiceForm,
componentProps: { componentProps: {

View File

@ -6,6 +6,7 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { usePrintService } from 'composables/usePrintService';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import InvoiceOutSummary from './Card/InvoiceOutSummary.vue'; import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
@ -25,6 +26,8 @@ const ticketsOptions = ref([]);
const customerOptions = ref([]); const customerOptions = ref([]);
const selectedRows = ref([]); const selectedRows = ref([]);
const hasSelectedCards = computed(() => selectedRows.value.length > 0); const hasSelectedCards = computed(() => selectedRows.value.length > 0);
const MODEL = 'InvoiceOuts';
const { openReport } = usePrintService();
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -43,7 +46,7 @@ const columns = computed(() => [
isTitle: true, isTitle: true,
component: 'select', component: 'select',
attrs: { attrs: {
url: 'InvoiceOuts', url: MODEL,
optionLabel: 'ref', optionLabel: 'ref',
optionValue: 'id', optionValue: 'id',
}, },
@ -141,7 +144,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
function openPdf(id) { function openPdf(id) {
try { try {
const url = `api/InvoiceOuts/${id}/download?access_token=${tokenMultimedia}`; const url = `api/${MODEL}/${id}/download?access_token=${tokenMultimedia}`;
window.open(url, '_blank'); window.open(url, '_blank');
} catch (err) { } catch (err) {
console.error('Error opening PDF', err); console.error('Error opening PDF', err);
@ -162,13 +165,13 @@ function downloadPdf() {
); );
const invoiceOutIds = invoiceOutIdsArray.join(','); const invoiceOutIds = invoiceOutIdsArray.join(',');
const params = new URLSearchParams({ const params = {
access_token: tokenMultimedia,
ids: invoiceOutIds, ids: invoiceOutIds,
}); };
const url = `api/InvoiceOuts/downloadZip?${params}`; openReport(`${MODEL}/downloadZip`, params);
window.open(url, '_blank'); // const url = `api/${MODEL}/downloadZip?${params}`;
// window.open(url, '_blank');
} }
} catch (err) { } catch (err) {
console.error('Error opening PDF'); console.error('Error opening PDF');
@ -199,7 +202,7 @@ watchEffect(selectedRows);
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="invoiceOut" data-key="invoiceOut"
url="InvoiceOuts/filter" :url="`${MODEL}/filter`"
:create="{ :create="{
urlCreate: 'InvoiceOuts/createManualInvoice', urlCreate: 'InvoiceOuts/createManualInvoice',
title: t('Create Manual Invoice'), title: t('Create Manual Invoice'),