Commit Graph

405 Commits

Author SHA1 Message Date
0bd5ee8ee8 fix(permissions): honor module permissions for cashier/counter in sidebar and page guard
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-03 08:10:22 +00:00
e270e848d7 fix(config): use cfg-tab-btn style for permissions tabs
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-03 08:05:27 +00:00
6e85497e42 feat(permissions): granular module permissions + workshop permissions matrix
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-03 07:55:17 +00:00
4718a09f15 fix(inventory): use category_id in bulk import and resolve category names
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-02 23:19:33 +00:00
1ff4d80277 fix(pos): print tickets via iframe with measured height and configurable paper width
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-02 23:11:55 +00:00
31b533f9f9 fix(inventory): support cp1252/latin-1 CSV encodings in bulk import
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-02 22:49:39 +00:00
982315bdaf feat(permissions): add dashboard.view permission for cashier/counter/workshop
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-02 22:37:28 +00:00
1b51fe65b5 fix(pos): hide Sistema button for non-admin roles and allow login/logout in page guard
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-02 22:27:50 +00:00
302d54eb0a fix(config): re-sync employee permissions on role change; add sync script
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-02 19:37:19 +00:00
53ec0cc3e5 fix(inventory): read refreshed token dynamically in inventory.js
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-02 19:27:22 +00:00
944b9b51b3 fix(customers): allow cashiers to view customers and use refreshed token
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-02 14:49:47 +00:00
670db75fcd fix(workshop): show autorizada for workshop/mechanic and hide delivery statuses
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-02 14:45:25 +00:00
c226b1cf77 fix(workshop): restrict workshop/mechanic views to only 'autorizada' status
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-07-02 14:38:29 +00:00
f42910f4f6 feat: cashier/counter reports, service-order & remission flows, Rached migration utils
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Add "Mis cortes de caja" report for cashiers/counters with sales detail.
- Cash register history scoped to own cuts for non-admin roles; new /register/<id>/sales endpoint.
- Remove dashboard from cashier menu; add Reports to cashier/counter.
- Service orders: assign mechanic, budget field, invoice flag, counter/cashier can add items/remissions, convert to remission.
- Remission notes module (UI, CSS, courier, counter remissions).
- Customer hard-delete and vehicle/customer linkage in workshop.
- POS: always show search results, compact payment grid, credit validation, tier pricing (5%/10%), ticket with customer/folio.
- Inventory: CSV template with sku_secondary, alias import.
- Rached migration scripts and DB migrations.
- Version-bump cached JS/CSS query strings.

Excludes local Rached session tokens/captures (rached_*.json / rached_*.txt).
2026-07-02 12:51:56 +00:00
483498cfcc fix: define global toast utility in app-init
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Added window.toast() in app-init.js so workshop/customers/inventory pages can use it.

- Bumped app-init.js cache version on all templates.
2026-06-30 20:13:32 +00:00
7dc34f68ab feat(workshop): make brand/model required, plate optional, remove VIN
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- create_vehicle endpoints now require make and model; plate is optional; VIN is no longer stored.

- Updated new-vehicle modal: removed VIN field, plate is optional, brand/model marked required.
2026-06-30 20:08:56 +00:00
73553a3771 feat(customers): hard-delete customers
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
DELETE /customers/<id> now removes the row.

- Deletes layaways and dependent items/payments.

- Nullifies customer_id in sales, service_orders, fleet_vehicles, plate_vehicles, quotations, returns, warranties, bnpl_transactions, customer_payments.

- Cascade-delete CRM tables are handled by FK constraints.
2026-06-30 20:04:11 +00:00
073c97406b feat(customers): show vehicles and delete customer
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- get_customer now returns fleet_vehicles assigned to the customer.

- Added DELETE /pos/api/customers/<id> soft-delete (is_active=false) with customers.delete permission.

- Added Vehicles section in customer detail panel.

- Added Eliminar button in quick actions (owner/admin/customers.delete).
2026-06-30 19:58:45 +00:00
66b8fe3d69 feat(workshop): vehicles must be assigned to a customer
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Added customer_id column to fleet_vehicles with FK to customers.

- Enforced customer_id on create_vehicle endpoints (workshop and fleet).

- New vehicle modal now requires a selected customer and stores customer_id.

- Migration v4.13 applied to all tenants.
2026-06-30 19:53:00 +00:00
1af66cb302 fix(workshop): ensure new-customer/new-vehicle modals open on top
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Raised z-index of newCustomerModal and newVehicleModal so they appear above the order modal.

- Added '+ Nuevo' customer button in the edit-order modal as well.
2026-06-30 19:49:42 +00:00
5c700e98c3 feat(workshop): add new customer from new order modal
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Added POST /pos/api/service-orders/customers endpoint for workshop.edit users.

- Added 'Nuevo cliente' modal reachable from the new service order form.

- After creation the customer is automatically selected in the order.
2026-06-30 19:45:41 +00:00
603046cb09 feat(inventory): edit items in inventory grid
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Added 'Editar' button in inventory rows.

- Reused create modal as create/edit with pre-filled data.

- Added fields: unit, max_stock, tax_rate, description, is_active.

- Added /inventory/categories/all endpoint for flat category selector.

- Price/cost inputs are disabled for users without config.edit_prices.
2026-06-30 19:43:03 +00:00
b6679c6d9c feat(workshop): add vehicle from new order modal too
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
The '+ Nuevo' vehicle button is now available in both the edit and new service order modals.
2026-06-30 19:36:05 +00:00
52cb01eb4e feat(workshop): add vehicle from service order
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Added POST /pos/api/service-orders/vehicles endpoint for workshop.edit users.

- Added 'Nuevo vehiculo' modal in edit order with plate, VIN, make, model, year, color and owner.

- After creation the vehicle is automatically selected in the order.
2026-06-30 19:33:07 +00:00
ff600ed7df feat(workshop): remove quality_check and add edit order modal
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Removed 'Control de calidad' from service order pipeline (VALID_TRANSITIONS, status labels, Kanban columns).

- Added editable fields for customer, vehicle, branch, mechanic, priority, mileage, fuel level, estimated completion/cost and reception notes.

- Added customer/vehicle autocomplete in the edit order modal.
2026-06-30 19:30:51 +00:00
b539c92daf feat(i18n): force Spanish as the only language across all tenants
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- i18n.js now locks currentLang to 'es' and overwrites pos_lang in localStorage.

- Disabled setLang language switching.

- Removed ES/EN toggle from sidebar.

- Bumped i18n.js and sidebar.js cache version on all templates.
2026-06-30 18:13:43 +00:00
37b7f94f54 fix(config): saveAll crash when saving modules
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
saveModules() used event.target, which is undefined when called from saveAll.

Replaced with direct checkbox lookups and null checks.
2026-06-30 18:04:22 +00:00
7852838b21 feat(config): hard-delete branches for admins
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
DELETE /branches/<id> now removes the row, nullifies FK references, and deletes branch-specific stock/count records.

Main branch remains protected.
2026-06-30 18:00:26 +00:00
7e3205b03a feat(config): allow admin/owner to delete branches
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Added DELETE /pos/api/config/branches/<id> that soft-deletes the branch (is_active=false).

- Restricted to owner/admin; main branch cannot be deleted.

- Added 'Eliminar' button in the branches grid for admin/owner.
2026-06-30 17:57:29 +00:00
e9cfb2e756 feat(workshop): allow admin/owner to delete service orders
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Soft-delete service orders via is_deleted flag.

- Added DELETE /pos/api/service-orders/<id> restricted to owner/admin.

- Updated list, detail, summary, status and assignment queries to exclude deleted orders.

- Added 'Eliminar orden' button in the detail modal for administrators.
2026-06-30 17:51:09 +00:00
2863cf8e9f feat(workshop): restrict status flow, add mechanic notes, inventory part picker
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Service orders can no longer move backwards through the workshop pipeline.

- Added editable Reception / Diagnosis / Repair / Delivery notes in the detail modal.

- Added inventory-aware autocomplete when attaching parts to a service order.
2026-06-30 17:43:19 +00:00
bd5f733d6f feat(config): hard-delete employees instead of soft-deactivating
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
Updates DELETE /employees/<id> to nullify FK references, remove dependent rows (permissions/sessions), and delete the employee record. Owners remain protected.
2026-06-30 17:33:41 +00:00
8b378c3476 feat(config): agrega opcion para eliminar empleados
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Backend: nuevo endpoint DELETE /employees/<id> que desactiva (soft-delete).
  No permite eliminar cuentas de dueno.
- Frontend: boton Eliminar en la tabla de empleados con confirmacion.
- Exponer deleteEmployee en el modulo Config.

Tests: 35 passed
2026-06-30 17:28:48 +00:00
76dfa2adff fix(login): elimina fallback legacy y exige employee_id + PIN correcto
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- auth_bp.py: ahora login requiere employee_id. Si el PIN no coincide con
  el empleado seleccionado, devuelve 401. Ya no escanea todos los empleados
  ni permite entrar como otro usuario con el mismo PIN.

Esto evita que al elegir un usuario se entre como mecanico solo porque
comparten PIN.
2026-06-30 17:23:39 +00:00
1ca056ad0f fix(login): deshabilita auto-redirect y redirige segun rol tras login
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- login.html ya no redirige automaticamente si hay token; esto permite
  cambiar de usuario en dispositivos compartidos.
- Limpia token/empleado expirados.
- Tras login exitoso, redirige a /pos/workshop para taller/mecanico y a
  /pos/catalog para los demas roles.

Esto facilita probar el login con distintos usuarios en La Casita.
2026-06-30 17:17:56 +00:00
8ce6c398d4 fix(login): mueve login a /pos/login2 para evitar cache viejo
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- /pos/login redirige a /pos/login2 (no-store).
- /pos/login2 sirve la plantilla actualizada que envia employee_id.
- nginx redirige / a /pos/login2.

Esto evita que navegadores/PWA con cache antigua sigan usando la version
que no enviaba el empleado seleccionado.
2026-06-30 17:15:42 +00:00
50f2c21da7 fix(login): fuerza recarga de login redirigiendo a URL versionada
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- /pos/login ahora redirige a /pos/login?v=34 para evitar que el navegador
  use una copia antigua de la pagina de login.
- nginx redirige / a /pos/login?v=34.

Esto asegura que todos los clientes obtengan el login que envia employee_id.
2026-06-30 17:13:06 +00:00
06b1de84dc fix(app): importa make_response para headers de login
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-06-30 17:08:40 +00:00
2af305d184 fix(login): evita cache del login y fuerza validacion por empleado
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- app.py: login.html ahora se sirve con Cache-Control no-store.
- auth_bp.py: login valida PIN contra el employee_id enviado por el frontend.
- login.html: envia employee_id y setea cookie pos_role al iniciar sesion.

Se requiere limpiar cache del navegador en la pagina de login para que
 aplique el nuevo formulario.
2026-06-30 17:08:05 +00:00
93eebe0662 fix(login): el login ahora respeta el empleado seleccionado
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- auth_bp.py: login acepta employee_id y verifica el PIN solo de ese empleado.
  Fallback legacy se mantiene para clientes antiguos.
- login.html: guarda el id del empleado seleccionado y lo envia en la peticion.
- Se agrega cookie pos_role en el login inline del HTML.

Esto corrige el problema donde seleccionar cualquier usuario accedia siempre
al mismo empleado (el primero con el mismo PIN).

Tests: 35 passed
2026-06-30 17:02:40 +00:00
a37e60eb2a fix(auth): restringe workshop/mecanico solo por servidor y cookie
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Elimina el script inline que redirigia a todos los usuarios.
- auth_bp.py: la respuesta de login ahora setea cookie pos_role.
- app.py: before_request redirige a /pos/workshop solo cuando la cookie
  indica rol workshop/mechanic (no depende de JS cacheado).
- login.js/login.min.js/app-init.js: sincronizan/limpian la cookie pos_role
  junto con el token en login y logout.

Tests: 35 passed
2026-06-30 16:57:11 +00:00
688ea8c70c fix(auth): redirige a taller y limpia SW para usuarios workshop/mechanic
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Agrega script inline en todas las plantillas (excepto login/workshop) que lee
  el rol del JWT y redirige a /pos/workshop si es workshop/mechanic.
- Desregistra el Service Worker antes de redirigir para forzar carga fresca
  de assets y evitar que menus antiguos permanezcan por cache.
- Actualiza labels de rol en auth_bp.py para taller y mecanico.

Tests: 35 passed
2026-06-30 16:46:30 +00:00
4d971dd1a4 chore(cache): bump static assets y service worker a v33
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Fuerza recarga del sidebar.js, app-init.js y workshop.js actualizados
- Soluciona que usuarios workshop/mechanic veian todos los menus por cache anterior
2026-06-30 16:41:54 +00:00
09e5bffe54 feat(migration): limpia permisos de usuarios workshop/mechanic en todos los tenants
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Agrega migracion v4.11_clean_workshop_mechanic_permissions.sql
- Aplica DELETE de permisos no relacionados con taller y reinserta los 3 permisos base
- Ejecutada en todas las bases de datos de tenant activas
2026-06-30 16:39:10 +00:00
c2db68b184 fix(roles): restringe usuarios Taller y Mecanico a solo la seccion de Taller y oculta precios
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- sidebar.js: itemAllowed incluye mechanic junto a workshop -> solo muestra Taller
- app-init.js: redirige a /pos/workshop si el rol es workshop/mechanic
- config_bp.py: remueve customers.view y fleet.view de los permisos por defecto de workshop/mechanic
- workshop.js: hidePrices ahora tambien aplica para mechanic; oculta columnas/inputs de precio
- app-init.js/config.js: agrega etiquetas de rol para workshop y mechanic
- workshop.html: marca columnas de precio con price-col y oculta input catRate

Tests: 35 passed
2026-06-30 16:36:38 +00:00
c58f622486 fix(config): agrega roles Taller y Mecanico en creacion de empleados
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Agrega opciones workshop y mechanic al select de rol en config.html
- Actualiza ROLE_LABELS y ROLE_BADGE en config.js
- Valida roles mechanic y workshop en config_bp.py con permisos por defecto
- Añade clases CSS badge--orange y badge--teal

Tests: 35 passed
2026-06-30 16:31:45 +00:00
c1e481fb79 feat(config): agrega personalización de ticket con logo y opciones
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Nuevos endpoints /pos/api/config/receipt (GET/PUT)
- Sección en config.html para subir logo, datos del negocio y toggles visuales
- pos.js carga la config y renderiza el ticket usando logo, RFC, dirección,
  teléfono, mensajes y opciones de desglose/empleado/pago configurables
- Logo se redimensiona a 300px de ancho y se guarda como base64 JPEG en tenant_config

Tests: 35 passed
2026-06-30 08:35:10 +00:00
70a600cc66 hotfix: corrige 500 en /customers y /historical-sales
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- customers_bp: last_purchase no existe como columna; se calcula via subquery a sales.
- pos_bp: historical_sales no existe en tenants sin importacion; endpoint devuelve lista vacia en lugar de 500.
- Servicio reiniciado y validado.

Tests: 35 passed
2026-06-30 08:20:04 +00:00
2bdeb2973a fix(audit): corrige errores criticos y mayores, mejora UX/accesibilidad y optimiza rendimiento
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
- Arregla @require_auth, permisos, race conditions, locks de caja/stock
- Elimina N+1 en layaway, flotilla, dashboard y global_invoice
- Asegura folios atomicos para CFDI, ordenes de servicio y polizas
- Protege client_secret de MercadoLibre en backend
- Conecta botones/filtros de config, customers, accounting e invoicing
- Mejora accesibilidad (labels/aria-label) y estados de carga/vacio
- Limpia accounting.js obsoleto y consolida accounting.v9.js
- Actualiza cache busting a v32 y Service Worker a v32
- Documenta todo en docs/AUDIT_Y_MEJORAS_2026-06-15.md

Tests: 35 passed
2026-06-29 23:54:58 +00:00
59a4893e84 fix: reporte de Clientes usa /aging-summary agrupado por cliente
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled
2026-06-26 00:36:50 +00:00