diff --git a/src/layouts/AppLayout.vue b/src/layouts/AppLayout.vue index aee2388..1f80dd0 100644 --- a/src/layouts/AppLayout.vue +++ b/src/layouts/AppLayout.vue @@ -73,6 +73,7 @@ onMounted(() => { to="pos.client-tiers.index" /> route(`factura.${name}`, params) +const apiTo = (name, params = {}) => route(`Solicitudes de factura.${name}`, params) // Ruta visual const viewTo = ({ name = '', params = {}, query = {} }) => ({ name: `pos.factura.${name}`, params, query }) // Determina si un usuario puede hacer algo en base a los permisos -const can = (permission) => hasPermission(`factura.${permission}`) +const can = (permission) => hasPermission(`invoice-requests.${permission}`) export { can, diff --git a/src/pages/POS/Inventory/Index.vue b/src/pages/POS/Inventory/Index.vue index c5bafad..e30f890 100644 --- a/src/pages/POS/Inventory/Index.vue +++ b/src/pages/POS/Inventory/Index.vue @@ -4,6 +4,7 @@ import { useRouter } from 'vue-router'; import { useSearcher, apiURL } from '@Services/Api'; import { formatCurrency } from '@/utils/formatters'; import { can } from './Module.js'; +import reportService from '@Services/reportService'; const router = useRouter(); @@ -23,6 +24,7 @@ const showDeleteModal = ref(false); const showImportModal = ref(false); const editingProduct = ref(null); const deletingProduct = ref(null); +const isExporting = ref(false); /** Métodos */ const searcher = useSearcher({ @@ -106,6 +108,28 @@ const confirmDelete = async (id) => { } }; +const exportReport = async () => { + try { + isExporting.value = true; + + // Puedes agregar filtros aquí si lo necesitas + const filters = { + // category_id: 5, // Opcional: filtrar por categoría específica + // with_serials_only: true, // Opcional: solo productos con seguimiento de seriales + // low_stock_threshold: 10 // Opcional: solo productos con stock bajo o igual al umbral + }; + + await reportService.exportInventoryToExcel(filters); + + Notify.success('Reporte exportado exitosamente'); + } catch (error) { + console.error('Error al exportar:', error); + Notify.error('Error al exportar el reporte'); + } finally { + isExporting.value = false; + } +}; + /** Ciclos */ onMounted(() => { searcher.search(); @@ -119,6 +143,15 @@ onMounted(() => { placeholder="Buscar por nombre o SKU..." @search="(x) => searcher.search(x)" > +