Vistas sección pedidos #77

Merged
jsegarra merged 14 commits from wbuezas/hedera-web-mindshore:feature/Pedidos into 4922-vueMigration 2024-08-16 06:52:22 +00:00
3 changed files with 44 additions and 11 deletions
Showing only changes of commit f2c8b90324 - Show all commits

View File

@ -27,7 +27,9 @@ const props = defineProps({
:rows-per-page-options="props.rowsPerPageOptions"
table-header-class="vntable-header-default"
>
<slot />
<template v-for="(_, slotName) in $slots" v-slot:[slotName]="slotProps">
<slot :name="slotName" v-bind="slotProps" />
</template>
</QTable>
</template>

View File

@ -0,0 +1,38 @@
import { userStore as useUserStore } from 'stores/user';
import axios from 'axios';
import { useQuasar } from 'quasar';
export function usePrintService() {
const quasar = useQuasar();
const userStore = useUserStore();
const token = userStore.token;
function sendEmail(path, params) {
return axios.post(path, params).then(() =>
quasar.notify({
message: 'Notification sent',
type: 'positive',
icon: 'check'
})
);
}
function openReport(path, params) {
params = Object.assign(
{
access_token: token
},
params
);
const query = new URLSearchParams(params).toString();
window.open(`api/${path}?${query}`);
}
return {
sendEmail,
openReport
};
}

View File

@ -6,11 +6,11 @@ import VnTable from 'src/components/ui/VnTable.vue';
import { currency } from 'src/lib/filters.js';
import { date as qdate } from 'quasar';
import { userStore as useUserStore } from 'stores/user';
import { usePrintService } from 'src/composables/usePrintService';
const { t } = useI18n();
const jApi = inject('jApi');
const userStore = useUserStore();
const { openReport } = usePrintService();
const currentYear = ref(Date.vnNew().getFullYear());
const years = ref([]);
@ -38,13 +38,6 @@ const columns = computed(() => [
}
]);
const getInvoiceUrl = id => {
const params = new URLSearchParams({
access_token: userStore.token
});
return `/api/InvoiceOuts/${id}/download?${params}`;
};
const fetchInvoices = async () => {
const params = {
from: new Date(currentYear.value, 0),
jsegarra marked this conversation as resolved
Review

Si esto devuelve un PDF, podriamos aprovechar para user usePrintservice(Lilium)

Si esto devuelve un PDF, podriamos aprovechar para user usePrintservice(Lilium)
Review

Agregado.

Commit: f2c8b90324

Agregado. Commit: https://gitea.verdnatura.es/verdnatura/hedera-web/commit/f2c8b90324b0f051734e7752cd73a3a36c531015
@ -96,10 +89,10 @@ onMounted(async () => {
<QBtn
v-if="row.hasPdf"
icon="download"
:href="getInvoiceUrl(row.id)"
target="_blank"
flat
round
@click="openReport(`InvoiceOuts/${row.id}/download`)"
>
<QTooltip>
{{ t('downloadInvoicePdf') }}