diff --git a/package-lock.json b/package-lock.json index 4046481..da1e5eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "luxon": "^3.5.0", "pinia": "^3.0.1", "pusher-js": "^8.4.0", + "qrcode": "^1.5.4", "tailwindcss": "^4.0", "toastr": "^2.1.4", "uuid": "^11.1.0", @@ -1450,11 +1451,19 @@ "node": ">=0.4.0" } }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -1659,6 +1668,15 @@ "tslib": "^2.0.3" } }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001718", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001718.tgz", @@ -1739,11 +1757,21 @@ "node": ">= 10.0" } }, + "node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -1756,7 +1784,6 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, "license": "MIT" }, "node_modules/colorette": { @@ -1903,6 +1930,15 @@ } } }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -1921,6 +1957,12 @@ "node": ">=8" } }, + "node_modules/dijkstrajs": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", + "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==", + "license": "MIT" + }, "node_modules/dom-serializer": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", @@ -2061,6 +2103,12 @@ "dev": true, "license": "ISC" }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, "node_modules/engine.io-client": { "version": "6.6.3", "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.3.tgz", @@ -2313,6 +2361,19 @@ "node": ">=8" } }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/follow-redirects": { "version": "1.15.9", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", @@ -2400,6 +2461,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, "node_modules/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -2585,6 +2655,15 @@ "node": ">=0.10.0" } }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -2925,6 +3004,18 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/lower-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", @@ -3152,6 +3243,42 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/pako": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", @@ -3180,6 +3307,15 @@ "tslib": "^2.0.3" } }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/pathe": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/pathe/-/pathe-0.2.0.tgz", @@ -3239,6 +3375,15 @@ } } }, + "node_modules/pngjs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", + "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/postcss": { "version": "8.5.3", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", @@ -3289,6 +3434,23 @@ "tweetnacl": "^1.0.3" } }, + "node_modules/qrcode": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz", + "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==", + "license": "MIT", + "dependencies": { + "dijkstrajs": "^1.0.1", + "pngjs": "^5.0.0", + "yargs": "^15.3.1" + }, + "bin": { + "qrcode": "bin/qrcode" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/qs": { "version": "6.9.7", "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.7.tgz", @@ -3349,6 +3511,21 @@ "node": ">= 0.10" } }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "license": "ISC" + }, "node_modules/reusify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", @@ -3445,6 +3622,12 @@ "integrity": "sha512-lwsAIzOPlH8/7IIjjz3K0zYBk7aBVVcvjMwt3M4fLxpjMYyy7i3I97SLHebgn4YBjirkzfp3RvRDWSKsh/+WFw==", "license": "MIT" }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "license": "ISC" + }, "node_modules/socket.io-client": { "version": "4.8.1", "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.1.tgz", @@ -3524,6 +3707,32 @@ "node": ">=0.1.14" } }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/superjson": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.2.tgz", @@ -3943,6 +4152,26 @@ "npm": ">=3.10.0" } }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", + "license": "ISC" + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ws": { "version": "8.17.1", "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", @@ -3974,6 +4203,12 @@ "node": ">=0.4.0" } }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "license": "ISC" + }, "node_modules/yallist": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", @@ -3983,6 +4218,41 @@ "node": ">=18" } }, + "node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "license": "MIT", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/ziggy-js": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/ziggy-js/-/ziggy-js-2.5.3.tgz", diff --git a/package.json b/package.json index d27f6a2..4666136 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "luxon": "^3.5.0", "pinia": "^3.0.1", "pusher-js": "^8.4.0", + "qrcode": "^1.5.4", "tailwindcss": "^4.0", "toastr": "^2.1.4", "uuid": "^11.1.0", diff --git a/src/lang/es.js b/src/lang/es.js index 07c1578..797a491 100644 --- a/src/lang/es.js +++ b/src/lang/es.js @@ -458,7 +458,8 @@ export default { cashRegister: 'Caja', point: 'Punto de Venta', sales: 'Ventas', - clients: 'Clientes' + clients: 'Clientes', + billingRequests: 'Solicitudes de Facturación' }, cashRegister: { title: 'Caja Registradora', diff --git a/src/layouts/AppLayout.vue b/src/layouts/AppLayout.vue index 3b522b0..eee004e 100644 --- a/src/layouts/AppLayout.vue +++ b/src/layouts/AppLayout.vue @@ -42,6 +42,7 @@ onMounted(() => { to="pos.category.index" /> { name="pos.clients" to="pos.clients.index" /> +
+import { ref, computed } from 'vue'; +import { formatCurrency, formatDate } from '@/utils/formatters'; + +import Modal from '@Holos/Modal.vue'; +import GoogleIcon from '@Shared/GoogleIcon.vue'; + +/** Props */ +const props = defineProps({ + request: { + type: Object, + required: true + } +}); + +/** Emits */ +const emit = defineEmits(['close', 'refresh']); + +/** Estado */ +const processing = ref(false); + +/** Computed */ +const hasSales = computed(() => props.request.sales && props.request.sales.length > 0); +const latestSale = computed(() => hasSales.value ? props.request.sales[0] : null); + +/** Métodos */ +const closeModal = () => { + emit('close'); +}; + + + + diff --git a/src/pages/POS/Clients/BillingRequests.vue b/src/pages/POS/Clients/BillingRequests.vue new file mode 100644 index 0000000..c5c2c97 --- /dev/null +++ b/src/pages/POS/Clients/BillingRequests.vue @@ -0,0 +1,160 @@ + + + + + diff --git a/src/pages/POS/Factura/Index.vue b/src/pages/POS/Factura/Index.vue new file mode 100644 index 0000000..c2d9c0a --- /dev/null +++ b/src/pages/POS/Factura/Index.vue @@ -0,0 +1,319 @@ + + + diff --git a/src/pages/POS/Factura/Module.js b/src/pages/POS/Factura/Module.js new file mode 100644 index 0000000..8f52795 --- /dev/null +++ b/src/pages/POS/Factura/Module.js @@ -0,0 +1,16 @@ +import { hasPermission } from '@Plugins/RolePermission.js'; + +// Ruta API +const apiTo = (name, params = {}) => route(`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}`) + +export { + can, + viewTo, + apiTo +} diff --git a/src/pages/POS/Inventory/Index.vue b/src/pages/POS/Inventory/Index.vue index db57517..be47741 100644 --- a/src/pages/POS/Inventory/Index.vue +++ b/src/pages/POS/Inventory/Index.vue @@ -2,6 +2,7 @@ import { onMounted, ref } from 'vue'; import { useSearcher, apiURL } from '@Services/Api'; import { formatCurrency } from '@/utils/formatters'; +import { can } from './Module.js'; import SearcherHead from '@Holos/Searcher.vue'; import Table from '@Holos/Table.vue'; @@ -112,6 +113,7 @@ onMounted(() => { @search="(x) => searcher.search(x)" > - - - - - - - - - - - -
{
+ + + + + + + + + + + + diff --git a/src/pages/POS/Inventory/Module.js b/src/pages/POS/Inventory/Module.js new file mode 100644 index 0000000..641d1c6 --- /dev/null +++ b/src/pages/POS/Inventory/Module.js @@ -0,0 +1,16 @@ +import { hasPermission } from '@Plugins/RolePermission.js'; + +// Ruta API +const apiTo = (name, params = {}) => route(`inventario.${name}`, params) + +// Ruta visual +const viewTo = ({ name = '', params = {}, query = {} }) => ({ name: `pos.inventory.${name}`, params, query }) + +// Determina si un usuario puede hacer algo en base a los permisos +const can = (permission) => hasPermission(`inventario.${permission}`) + +export { + can, + viewTo, + apiTo +} diff --git a/src/pages/POS/Sales/Index.vue b/src/pages/POS/Sales/Index.vue index 3e064a4..be012fd 100644 --- a/src/pages/POS/Sales/Index.vue +++ b/src/pages/POS/Sales/Index.vue @@ -142,7 +142,7 @@ onMounted(() => { > - #{{ String(model.id).padStart(6, '0') }} + #{{ model.invoice_number }} diff --git a/src/router/Index.js b/src/router/Index.js index d996309..e7b08d2 100644 --- a/src/router/Index.js +++ b/src/router/Index.js @@ -39,6 +39,7 @@ const router = createRouter({ { path: 'inventory', name: 'pos.inventory.index', + beforeEnter: (to, from, next) => can(next, 'inventario.index'), component: () => import('@Pages/POS/Inventory/Index.vue') }, { @@ -75,6 +76,11 @@ const router = createRouter({ path: 'clients', name: 'pos.clients.index', component: () => import('@Pages/POS/Clients/Index.vue') + }, + { + path: 'billing-requests', + name: 'pos.billingRequests.index', + component: () => import('@Pages/POS/Clients/BillingRequests.vue') } ] }, @@ -185,6 +191,11 @@ const router = createRouter({ } ] }, + { + path: '/facturacion/:invoiceNumber', + name: 'facturacion.index', + component: () => import('@Pages/POS/Factura/Index.vue') + }, { path: '/auth', component: () => import('@Holos/Layout/Auth.vue'), diff --git a/src/services/ticketService.js b/src/services/ticketService.js index 6bc7c0a..80f2c56 100644 --- a/src/services/ticketService.js +++ b/src/services/ticketService.js @@ -1,4 +1,5 @@ import jsPDF from 'jspdf'; +import QRCode from 'qrcode'; import { formatMoney, PAYMENT_METHODS } from '@/utils/formatters'; /** @@ -86,7 +87,7 @@ const ticketService = { doc.setTextColor(...darkGrayColor); // Folio - const folio = saleData.invoice_number || `INV-${String(saleData.id || '').padStart(12, '0')}`; + const folio = saleData.invoice_number || `INV-${String(saleData.id || '').padStart(7, '0')}`; doc.text(`Folio: ${folio}`, leftMargin, yPosition); yPosition += 4; @@ -274,6 +275,53 @@ const ticketService = { doc.text(`Impreso: ${currentDate}`, centerX, yPosition, { align: 'center' }); yPosition += 3; doc.text(`ID de venta: ${saleData.id || 'N/A'}`, centerX, yPosition, { align: 'center' }); + yPosition += 8; + + // ===== QR ===== + const invoiceNumber = saleData.invoice_number || saleData.id; + const facturacionUrl = `${window.location.origin}/#/facturacion/${invoiceNumber}`; + + try { + // Generar QR como data URL + const qrDataUrl = await QRCode.toDataURL(facturacionUrl, { + width: 150, + margin: 1, + color: { + dark: '#000000', + light: '#ffffff' + } + }); + + // Línea separadora antes del QR + doc.setDrawColor(...darkGrayColor); + doc.setLineWidth(0.2); + doc.line(leftMargin, yPosition, rightMargin, yPosition); + yPosition += 5; + + // Texto invitación a facturar + doc.setFontSize(8); + doc.setFont('helvetica', 'bold'); + doc.setTextColor(...blackColor); + doc.text('¿Necesitas factura?', centerX, yPosition, { align: 'center' }); + yPosition += 4; + + doc.setFontSize(7); + doc.setFont('helvetica', 'normal'); + doc.setTextColor(...darkGrayColor); + doc.text('Escanea el código QR para', centerX, yPosition, { align: 'center' }); + yPosition += 3; + doc.text('enviar tus datos de facturación', centerX, yPosition, { align: 'center' }); + yPosition += 5; + + // Agregar imagen QR centrada + const qrSize = 25; + const qrX = centerX - (qrSize / 2); + doc.addImage(qrDataUrl, 'PNG', qrX, yPosition, qrSize, qrSize); + yPosition += qrSize + 3; + + } catch (error) { + console.error('Error generando QR:', error); + } // Guardar o retornar el PDF if (autoDownload) {