diff --git a/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue b/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue index eae41d789..e524faa24 100644 --- a/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue +++ b/src/pages/InvoiceOut/Card/InvoiceOutDescriptorMenu.vue @@ -134,7 +134,6 @@ const refundInvoice = async (withWarehouse) => { }; const showTransferInvoiceForm = async () => { - $props.menuRef.hide(); quasar.dialog({ component: TransferInvoiceForm, componentProps: { diff --git a/src/pages/InvoiceOut/InvoiceOutList.vue b/src/pages/InvoiceOut/InvoiceOutList.vue index 037834d09..fc40d95f2 100644 --- a/src/pages/InvoiceOut/InvoiceOutList.vue +++ b/src/pages/InvoiceOut/InvoiceOutList.vue @@ -6,6 +6,7 @@ import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; +import { usePrintService } from 'composables/usePrintService'; import { useSession } from 'src/composables/useSession'; import VnTable from 'components/VnTable/VnTable.vue'; import InvoiceOutSummary from './Card/InvoiceOutSummary.vue'; @@ -25,6 +26,8 @@ const ticketsOptions = ref([]); const customerOptions = ref([]); const selectedRows = ref([]); const hasSelectedCards = computed(() => selectedRows.value.length > 0); +const MODEL = 'InvoiceOuts'; +const { openReport } = usePrintService(); const columns = computed(() => [ { @@ -43,7 +46,7 @@ const columns = computed(() => [ isTitle: true, component: 'select', attrs: { - url: 'InvoiceOuts', + url: MODEL, optionLabel: 'ref', optionValue: 'id', }, @@ -141,7 +144,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); function openPdf(id) { try { - const url = `api/InvoiceOuts/${id}/download?access_token=${tokenMultimedia}`; + const url = `api/${MODEL}/${id}/download?access_token=${tokenMultimedia}`; window.open(url, '_blank'); } catch (err) { console.error('Error opening PDF', err); @@ -162,13 +165,13 @@ function downloadPdf() { ); const invoiceOutIds = invoiceOutIdsArray.join(','); - const params = new URLSearchParams({ - access_token: tokenMultimedia, + const params = { ids: invoiceOutIds, - }); + }; - const url = `api/InvoiceOuts/downloadZip?${params}`; - window.open(url, '_blank'); + openReport(`${MODEL}/downloadZip`, params); + // const url = `api/${MODEL}/downloadZip?${params}`; + // window.open(url, '_blank'); } } catch (err) { console.error('Error opening PDF'); @@ -199,7 +202,7 @@ watchEffect(selectedRows);