diff --git a/addons/beyond_pos_theme/__manifest__.py b/addons/beyond_pos_theme/__manifest__.py index b39f3de..86ab0f8 100644 --- a/addons/beyond_pos_theme/__manifest__.py +++ b/addons/beyond_pos_theme/__manifest__.py @@ -38,6 +38,11 @@ El veredicto del spike está en docs/adr/ADR-001-spike-pos.md. # y todo el rediseño lee sus variables. 'beyond_pos_theme/static/src/scss/beyond_caja_tokens.scss', 'beyond_pos_theme/static/src/scss/beyond_pos.scss', + 'beyond_pos_theme/static/src/scss/beyond_venta.scss', + # venta.js define ayudantes que empleados_linea y descuento + # importan: va antes que ellos en el bundle. + 'beyond_pos_theme/static/src/venta/venta.js', + 'beyond_pos_theme/static/src/venta/venta.xml', 'beyond_pos_theme/static/src/product_card/product_card.js', 'beyond_pos_theme/static/src/xml/product_card.xml', 'beyond_pos_theme/static/src/empleados_linea/empleados_linea.js', diff --git a/addons/beyond_pos_theme/static/src/api_pos/contrato.js b/addons/beyond_pos_theme/static/src/api_pos/contrato.js index cb7c297..07bb7ca 100644 --- a/addons/beyond_pos_theme/static/src/api_pos/contrato.js +++ b/addons/beyond_pos_theme/static/src/api_pos/contrato.js @@ -23,12 +23,15 @@ // Campos de los modelos del POS. Se leen y se escriben directamente. export const CAMPOS = { - 'pos.order': ['lines', 'tip_amount', 'is_tipped'], + 'pos.order': ['lines', 'tip_amount', 'is_tipped', 'partner_id'], 'pos.order.line': [ 'price_unit', 'qty', 'discount', 'uuid', 'product_id', 'price_type', 'full_product_name', 'refunded_orderline_id', ], 'pos.config': ['iface_tipproduct', 'tip_product_id'], + // La tarjeta del catálogo (rediseño 2-sep-2026): el chip de categoría y + // la nota «por servicio / por pieza» salen de estos dos. + 'product.template': ['type', 'pos_categ_ids'], 'res.users': ['beyond_puede_descontar'], }; @@ -75,6 +78,24 @@ export const METODOS = { // que estorbe. 'update': 'escribir campos de una línea de venta (quién atendió)', + // ── El rediseño de la caja (2-sep-2026) ───────────────────────────── + // La pantalla de venta dejó de dibujar la barra de control del core y + // sus piezas viven en el ticket: cada botón llama a lo MISMO que + // llamaba el core desde su plantilla, declarado aquí para que un + // renombre salga en la suite y no en el mostrador. + 'selectPartner': 'elegir el cliente de la orden (cabecera del ticket)', + 'pay': 'pasar a la pantalla de cobro (botón Cobrar)', + 'onDeleteOrder': 'eliminar la orden en curso (pie del ticket)', + 'navigate': 'fijar la ruta antes de encender el escáner del catálogo', + 'isEmpty': 'si la orden está vacía, para apagar Cobrar y Descuento', + 'clickLine': 'seleccionar un renglón del ticket al tocarlo', + 'setSelectedCategory': 'la pastilla «Todos» del catálogo (0 = ninguna)', + // El formateador de moneda del entorno del POS. Es display, no cuenta: + // los importes se calculan de los CAMPOS y esto solo los viste con el + // mismo «$ 1,090.00» que pinta el core al lado — dos formatos de moneda + // en la misma pantalla se leen como dos sistemas. + 'formatCurrency': 'vestir un importe como lo viste el core', + // `numpad_mx.js` — el teclado numérico del POS. Es un servicio entero // suyo, no un dato: sin él no hay dónde teclear. Es la dependencia más // profunda que tenemos y la que menos alternativa tiene. diff --git a/addons/beyond_pos_theme/static/src/descuento/descuento.js b/addons/beyond_pos_theme/static/src/descuento/descuento.js index 6b97e37..381cad5 100644 --- a/addons/beyond_pos_theme/static/src/descuento/descuento.js +++ b/addons/beyond_pos_theme/static/src/descuento/descuento.js @@ -2,10 +2,9 @@ import { Component, useState } from "@odoo/owl"; import { Dialog } from "@web/core/dialog/dialog"; -import { ControlButtons } from "@point_of_sale/app/screens/product_screen/control_buttons/control_buttons"; +import { ProductScreen } from "@point_of_sale/app/screens/product_screen/product_screen"; import { makeAwaitable } from "@point_of_sale/app/utils/make_awaitable_dialog"; import { patch } from "@web/core/utils/patch"; -import { useService } from "@web/core/utils/hooks"; import { _t } from "@web/core/l10n/translation"; import { valorSinDescuento } from "../api_pos/contrato"; @@ -161,13 +160,10 @@ export class BeyondDescuento extends Component { } } -patch(ControlButtons.prototype, { - setup() { - super.setup(...arguments); - this.beyondDialog = useService("dialog"); - this.beyondNotificacion = useService("notification"); - }, - +/* Anclado en ProductScreen desde el rediseño (2-sep-2026): la barra de + * control del core ya no se dibuja y «Descuento» vive en el pie del + * ticket. La pantalla ya trae dialog y notification. */ +patch(ProductScreen.prototype, { /** * El botón solo se dibuja a quien puede, pero la comprobación real está * en el servidor: `pos.order` rechaza un descuento sin autoridad y anota @@ -195,11 +191,11 @@ patch(ControlButtons.prototype, { valor: valorSinDescuento(l), })); if (!lineas.length) { - this.beyondNotificacion.add( + this.notification.add( _t("No hay nada sobre lo que descontar todavía.")); return; } - const reparto = await makeAwaitable(this.beyondDialog, BeyondDescuento, + const reparto = await makeAwaitable(this.dialog, BeyondDescuento, { lineas }); if (!reparto) { return; diff --git a/addons/beyond_pos_theme/static/src/descuento/descuento.xml b/addons/beyond_pos_theme/static/src/descuento/descuento.xml index 7272c5b..271ae80 100644 --- a/addons/beyond_pos_theme/static/src/descuento/descuento.xml +++ b/addons/beyond_pos_theme/static/src/descuento/descuento.xml @@ -1,27 +1,10 @@ - - - - - - - + diff --git a/addons/beyond_pos_theme/static/src/empleados_linea/empleados_linea.js b/addons/beyond_pos_theme/static/src/empleados_linea/empleados_linea.js index ff6faf1..de5582f 100644 --- a/addons/beyond_pos_theme/static/src/empleados_linea/empleados_linea.js +++ b/addons/beyond_pos_theme/static/src/empleados_linea/empleados_linea.js @@ -5,7 +5,9 @@ import { Dialog } from "@web/core/dialog/dialog"; import { _t } from "@web/core/l10n/translation"; import { patch } from "@web/core/utils/patch"; import { makeAwaitable } from "@point_of_sale/app/utils/make_awaitable_dialog"; -import { ControlButtons } from "@point_of_sale/app/screens/product_screen/control_buttons/control_buttons"; +import { ProductScreen } from "@point_of_sale/app/screens/product_screen/product_screen"; + +import { inicialesDe } from "../venta/venta"; /** * C-024: diálogo de atribución múltiple. El POS solo carga empleados de la @@ -53,7 +55,30 @@ export class EmpleadosLineaDialog extends Component { * escribe en TODAS de una vez, así que el reparto en partes iguales opera * sobre el total de la orden. */ -patch(ControlButtons.prototype, { +/* Anclado en ProductScreen desde el rediseño (2-sep-2026): la barra de + * control del core ya no se dibuja y «Atendió» vive en la cabecera del + * ticket. La pantalla trae los mismos servicios (dialog, notification). */ +patch(ProductScreen.prototype, { + /** Lo que enseña el avatar: iniciales, o cuántos si son varios. */ + get beyondIniAtendio() { + const quienes = this.beyondEmpleadosDeLaOrden; + if (!quienes.length) { + return "+"; + } + return quienes.length > 1 ? String(quienes.length) : inicialesDe(quienes[0].name); + }, + + get beyondNombreAtendio() { + const quienes = this.beyondEmpleadosDeLaOrden; + if (!quienes.length) { + return _t("Agregar colaborador"); + } + if (quienes.length === 1) { + return quienes[0].name; + } + return `${quienes[0].name} +${quienes.length - 1}`; + }, + get beyondLineasAtribuibles() { const propina = this.pos.config.tip_product_id?.id; return (this.currentOrder?.lines || []).filter( @@ -65,10 +90,6 @@ patch(ControlButtons.prototype, { // basta mirar la primera porque se escriben todas juntas. return this.beyondLineasAtribuibles[0]?.beyond_empleado_ids || []; }, - get beyondEtiquetaEmpleados() { - const cuantos = this.beyondEmpleadosDeLaOrden.length; - return cuantos ? _t("Atendió (%s)", cuantos) : _t("Atendió"); - }, async clickBeyondEmpleados() { const lineas = this.beyondLineasAtribuibles; if (!lineas.length) { diff --git a/addons/beyond_pos_theme/static/src/empleados_linea/empleados_linea.xml b/addons/beyond_pos_theme/static/src/empleados_linea/empleados_linea.xml index b99e6a7..b5d3e94 100644 --- a/addons/beyond_pos_theme/static/src/empleados_linea/empleados_linea.xml +++ b/addons/beyond_pos_theme/static/src/empleados_linea/empleados_linea.xml @@ -19,20 +19,9 @@ - - - - - - - + + diff --git a/addons/beyond_pos_theme/static/src/product_card/product_card.js b/addons/beyond_pos_theme/static/src/product_card/product_card.js index 9117fc9..bf62a14 100644 --- a/addons/beyond_pos_theme/static/src/product_card/product_card.js +++ b/addons/beyond_pos_theme/static/src/product_card/product_card.js @@ -15,6 +15,24 @@ import { ProductCard } from "@point_of_sale/app/components/product_card/product_ * pricelist of their own changes it — and the register's default otherwise. */ patch(ProductCard.prototype, { + /** «Servicios» o «Productos», para el chip y la nota del renglón. */ + get beyondEsServicio() { + return this.props.product?.type === "service"; + }, + + /** El chip: la categoría del POS si la hay; si no, la familia. */ + get beyondEtiquetaCategoria() { + const categoria = this.props.product?.pos_categ_ids?.[0]?.name; + if (categoria) { + return categoria; + } + return this.beyondEsServicio ? "Servicios" : "Productos"; + }, + + get beyondNotaVenta() { + return this.beyondEsServicio ? "por servicio" : "por pieza"; + }, + get beyondPrice() { const template = this.props.product; if (!template) { diff --git a/addons/beyond_pos_theme/static/src/scss/beyond_pos.scss b/addons/beyond_pos_theme/static/src/scss/beyond_pos.scss index cac8139..2ff3641 100644 --- a/addons/beyond_pos_theme/static/src/scss/beyond_pos.scss +++ b/addons/beyond_pos_theme/static/src/scss/beyond_pos.scss @@ -40,66 +40,9 @@ } } -// --------------------------------------------------------------------------- -// Retícula de productos: tarjetas grandes (la lista de categorías comparte -// la clase product-list, por eso el :not) -// --------------------------------------------------------------------------- -.pos .product-list:not(.category-list) { - grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); - gap: 0.75rem; -} - -// --------------------------------------------------------------------------- -// Tarjeta de producto: imagen protagonista cuadrada, nombre legible, -// esquinas suaves y sombra de tarjeta (look app, no ERP) -// --------------------------------------------------------------------------- -.pos .product { - overflow: hidden; - border: 0; - border-radius: 1rem !important; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.06); - background: #fff; - - &:hover { - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); - } - - .product-img { - // Bootstrap ratio: 100% = cuadrada; la imagen domina la tarjeta - --bs-aspect-ratio: 100%; - } - - .product-name { - font-size: 1rem; - font-weight: 600; - line-height: 1.25; - color: var(--beyond-ink); - } -} - -// Precio visible en la tarjeta (añadido vía herencia de la plantilla -// point_of_sale.ProductCard, ver static/src/xml/product_card.xml) -.pos .beyond-price { - top: 0.5rem; - inset-inline-end: 0.5rem; - padding: 0.3rem 0.7rem; - border-radius: 2rem; - background: rgba(255, 255, 255, 0.94); - color: var(--beyond-ink); - font-size: 0.9rem; - font-weight: 700; - box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); - pointer-events: none; -} - -// --------------------------------------------------------------------------- -// Categorías: botones táctiles altos y tipografía firme -// --------------------------------------------------------------------------- -.pos .category-button { - min-height: 3rem; - font-weight: 600; - border-radius: 0.75rem !important; -} +// (La retícula de tarjetas, la tarjeta con foto y las categorías del +// spike se fueron con el rediseño 2-sep-2026: viven en beyond_venta.scss +// como lista de renglones.) // --------------------------------------------------------------------------- // C-024: opciones del diálogo "¿Quién atendió?" — táctiles y con estado claro @@ -191,32 +134,6 @@ .beyond_propina .btn-lg { min-height: 4rem; } -// ── La barra de la venta y los mandos del renglón (01-sep-2026) ───────── -// Cuatro botones centrados: Cliente · Atendió · Descuento · ⋮. El core la -// reparte con justify-content-between, que con pocos botones los avienta a -// las esquinas. -.pos .control-buttons { - justify-content: center !important; -} - -// Los mandos del renglón sustituyen al teclado de cantidades: aparecen solo -// en el renglón SELECCIONADO — en todos a la vez serían ruido, y tocar el -// renglón ya es el gesto de «este» — con dedos en mente (≥48px, brief §3). -.pos .beyond_linea_controles { - display: none; - gap: .5rem; - padding: .25rem 0 .25rem .5rem; - - .btn { - min-width: 48px; - min-height: 44px; - } - .beyond_quitar_linea { - margin-left: .75rem; - color: var(--bs-danger); - } -} - -.pos .orderline.selected .beyond_linea_controles { - display: flex; -} +// (La barra de control y los mandos del renglón del 01-sep-2026 se +// fueron con el rediseño: el pie del ticket es de beyond_venta.scss y el +// renglón trae sus mandos de fábrica.) diff --git a/addons/beyond_pos_theme/static/src/scss/beyond_venta.scss b/addons/beyond_pos_theme/static/src/scss/beyond_venta.scss new file mode 100644 index 0000000..cdb86bc --- /dev/null +++ b/addons/beyond_pos_theme/static/src/scss/beyond_venta.scss @@ -0,0 +1,601 @@ +// ============================================================================= +// Beyond — Pantalla de venta (rediseño 2-sep-2026, punto 2). +// +// El ticket a la izquierda como panel blanco con sombra; el catálogo a la +// derecha como lista de renglones. Todo el valor viene de los tokens. +// ============================================================================= + +.pos .product-screen { + + // ── El panel del ticket ───────────────────────────────────────────── + .leftpane { + width: 428px; + flex-basis: 428px !important; // el core reparte con flex-basis propio + background: $caja-tarjeta; + border-right: 1px solid rgba(96, 171, 106, 0.22); + box-shadow: $caja-sombra-panel; + padding-bottom: 0 !important; + } + + .beyond_ticket_cabecera { + flex: none; + box-sizing: border-box; + display: flex; + align-items: center; + gap: 10px; + padding: 12px 18px; + border-bottom: 1px solid $caja-linea; + } + + .beyond_divisor_v { + flex: none; + width: 1px; + height: 30px; + background: $caja-linea; + } + + .beyond_persona { + all: unset; + cursor: pointer; + box-sizing: border-box; + flex: 1; + min-width: 0; + display: flex; + align-items: center; + gap: 10px; + padding: 8px 10px; + border-radius: $caja-radio-control; + transition: background 140ms ease; + + &:hover { background: $caja-fondo; } + } + + .beyond_persona_avatar { + flex: none; + box-sizing: border-box; + width: 30px; + height: 30px; + border-radius: 10px; + background: $caja-suave; + color: $caja-tinta-media; + display: flex; + align-items: center; + justify-content: center; + font-size: 12px; + font-weight: 800; + + &.beyond_avatar_verde { + background: $caja-verde-tinte; + color: $caja-verde-tinta; + } + + // Sin nadie elegido: el hueco punteado que invita a llenarlo. + &.beyond_vacia { + background: transparent; + border: 1.5px dashed $caja-deshabilitado; + color: $caja-tinta-apagada; + } + } + + .beyond_persona_datos { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + gap: 1px; + text-align: left; + } + + .beyond_persona_nombre { + font-size: 14px; + font-weight: 800; + color: $caja-tinta; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + + &.beyond_apagado { color: $caja-tinta-apagada; } + } + + // ── Los renglones ─────────────────────────────────────────────────── + .beyond_renglon { + box-sizing: border-box; + display: flex; + align-items: center; + gap: 12px; + padding: 13px 18px; + border-bottom: 1px solid $caja-fondo; + cursor: default; + transition: background 140ms ease; + + &:hover { background: #FAF9F6; } + } + + .beyond_cantidad_pill { + flex: none; + display: flex; + align-items: center; + gap: 2px; + padding: 3px; + border-radius: $caja-radio-pill; + background: $caja-suave; + + > .beyond_num { + min-width: 22px; + text-align: center; + font-size: 14.5px; + font-weight: 800; + } + } + + .beyond_paso { + all: unset; + cursor: pointer; + box-sizing: border-box; + width: 28px; + height: 28px; + border-radius: $caja-radio-pill; + display: flex; + align-items: center; + justify-content: center; + color: $caja-tinta-suave; + font-size: 11px; + transition: background 140ms ease; + + &:hover { background: $caja-tarjeta; } + &.beyond_paso_mas { color: $caja-verde-tinta; } + } + + .beyond_cantidad_sola { + flex: none; + min-width: 34px; + height: 30px; + box-sizing: border-box; + padding: 0 8px; + border-radius: 10px; + background: $caja-rojo-chip; + color: $caja-rojo-tinta; + font-size: 14px; + font-weight: 800; + display: flex; + align-items: center; + justify-content: center; + } + + .beyond_renglon_datos { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + gap: 2px; + } + + .beyond_renglon_nombre { + font-size: 15px; + font-weight: 800; + letter-spacing: -0.01em; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .beyond_renglon_meta { + font-size: 12px; + font-weight: 700; + color: $caja-tinta-apagada; + } + + .beyond_renglon_importe { + flex: none; + font-size: 15px; + font-weight: 800; + } + + .beyond_quitar { + all: unset; + cursor: pointer; + box-sizing: border-box; + flex: none; + width: 30px; + height: 30px; + border-radius: 10px; + display: flex; + align-items: center; + justify-content: center; + color: $caja-deshabilitado; + transition: background 140ms ease, color 140ms ease; + + &:hover { background: $caja-rojo-tinte; color: $caja-rojo; } + } + + .beyond_resta { color: $caja-rojo; font-weight: 800; } + + // ── Los totales ───────────────────────────────────────────────────── + .beyond_totales { + border-top: 1px solid $caja-linea; + border-bottom: 0 !important; + padding: 14px 18px 4px !important; + gap: 7px !important; + } + + .beyond_total_fila { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 12px; + font-size: 13.5px; + font-weight: 700; + color: $caja-tinta-media; + + > .beyond_num { color: $caja-tinta-suave; font-weight: 700; font-size: 14px; } + .beyond_nulo { color: $caja-deshabilitado; } + .beyond_resta { color: $caja-rojo; font-weight: 800; } + } + + .beyond_total_grande { + padding-top: 8px; + border-top: 1.5px solid $caja-linea; + font-size: 15px; + font-weight: 800; + color: $caja-tinta; + + > .total { + font-size: 30px; + font-weight: 800; + letter-spacing: -0.03em; + line-height: 1.05; + color: $caja-tinta; + } + } + + // ── El pie ────────────────────────────────────────────────────────── + .beyond_ticket_pie { + display: flex; + flex-direction: column; + gap: 12px; + padding: 14px 18px 16px; + border-top: 1px solid $caja-linea; + } + + .beyond_pie_botones { + display: flex; + align-items: center; + gap: 8px; + + > * { flex: 1; } + } + + .beyond_cobrar { + all: unset; + cursor: pointer; + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: space-between; + gap: 14px; + min-height: $caja-toque-comodo; + padding: 0 24px; + border-radius: $caja-radio-tarjeta; + background: $caja-verde; + color: #FFFFFF; + font-size: 17px; + font-weight: 800; + letter-spacing: -0.01em; + transition: background 140ms ease; + + > .beyond_num { font-size: 19px; } + + &:hover { background: $caja-verde-hover; } + &:disabled, &[disabled] { + background: $caja-suave-hover; + color: $caja-tinta-apagada; + cursor: not-allowed; + } + } + + // ── El catálogo ───────────────────────────────────────────────────── + .rightpane { background: $caja-fondo !important; } + + // Las categorías, como pastillas en una sola tira. + .category-list { + display: flex !important; + flex-wrap: wrap; + width: max-content; + max-width: calc(100% - 44px); + align-items: center; + gap: 4px !important; + margin: 16px 22px 0; + padding: 4px !important; + border-radius: $caja-radio-pill; + background: $caja-suave-hover; + + .category-button { + box-sizing: border-box; + min-height: 0; + padding: 9px 18px !important; + border: 0 !important; + border-radius: $caja-radio-pill !important; + background: transparent !important; // gana al color de categoría + box-shadow: none !important; + color: $caja-tinta-media !important; + font-size: 13.5px; + font-weight: 800; + white-space: nowrap; + opacity: 1 !important; + + .ratio { display: none; } // pastillas sin miniatura + .line-clamp-3 { width: auto !important; } + + // La elegida: el core no marca una clase estable, pero es la + // ÚNICA sin `opacity-75` (hermana no elegida) ni `border-0` + // (raíz con nada elegido) — leído de category_selector.js, no + // supuesto. Con nada elegido, ninguna se pinta y «Todos» toma + // el verde por su propia clase. + &:not(.opacity-75):not(.border-0):not(.beyond_pastilla_todos) { + background: $caja-verde !important; + color: #FFFFFF !important; + } + } + } + + .beyond_pastilla_todos.beyond_todos_activa { + background: $caja-verde !important; + color: #FFFFFF !important; + } + + .beyond_catalogo_controles { + flex: none; + display: flex; + align-items: center; + gap: 10px; + padding: 10px 22px 12px; + } + + .beyond_buscador { + flex: 1; + min-width: 0; + display: flex; + align-items: center; + gap: 11px; + box-sizing: border-box; + padding: 11px 14px; + border-radius: $caja-radio-campo; + background: $caja-tarjeta; + border: 1.5px solid $caja-borde; + + &:focus-within { border-color: $caja-verde; } + + .fa { color: $caja-tinta-apagada; } + + input { + all: unset; + flex: 1; + min-width: 0; + font-size: 14.5px; + font-weight: 700; + color: $caja-tinta; + } + } + + .beyond_escanear { + all: unset; + cursor: pointer; + box-sizing: border-box; + flex: none; + display: flex; + align-items: center; + gap: 9px; + min-height: $caja-toque; + padding: 0 18px; + border-radius: $caja-radio-campo; + background: $caja-tarjeta; + border: 1.5px solid $caja-borde; + color: $caja-tinta; + font-size: 13.5px; + font-weight: 800; + white-space: nowrap; + transition: background 140ms ease, border-color 140ms ease; + + .fa { color: $caja-verde-tinta; } + + &:hover { background: $caja-verde-tinte; border-color: $caja-verde; } + } + + // La lista de productos: una columna de renglones. + .product-list:not(.category-list) { + grid-template-columns: 1fr; + gap: 6px; + padding: 4px 22px 26px !important; + } + + .product { + // `flex-column` viene en el markup del core como utilitaria de + // Bootstrap (!important): la fila solo se gana igual de fuerte. + // Deuda declarada desde ADR-001, concentrada aquí. + flex-direction: row !important; + align-items: center !important; + gap: 14px; + min-height: $caja-catalogo-renglon-alto; + padding: 13px 16px !important; + background: $caja-tarjeta; + border: 1.5px solid $caja-borde !important; + border-radius: $caja-radio-campo !important; + box-shadow: none; + transition: border-color 140ms ease, background 140ms ease; + + &:hover { + border-color: $caja-verde !important; + background: #FAFCFA; + box-shadow: none; + } + + .product-img { display: none; } // lista sin fotos (encargo) + + .product-content { + flex: 1; + min-width: 0; + display: flex !important; + flex-direction: column; + gap: 1px; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + } + + .product-name { + display: block !important; + text-align: start !important; + justify-content: flex-start !important; + font-size: 16px; + font-weight: 800; + letter-spacing: -0.015em; + color: $caja-tinta; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + // La cantidad la pinta nuestro chip, junto al precio. + .product-cart-qty { display: none; } + } + + .beyond_prod_meta { + display: flex; + align-items: center; + gap: 7px; + } + + .beyond_prod_chip { + flex: none; + padding: 2px 8px; + border-radius: 7px; + font-size: 9.5px; + font-weight: 800; + letter-spacing: 0.09em; + text-transform: uppercase; + + &.beyond_srv { background: $caja-servicio-tinte; color: $caja-servicio-tinta; } + &.beyond_prd { background: $caja-producto-tinte; color: $caja-producto-tinta; } + } + + .beyond_prod_nota { + font-size: 11.5px; + font-weight: 700; + color: $caja-tinta-apagada; + } + + .beyond_prod_qty { + flex: none; + min-width: 26px; + height: 26px; + box-sizing: border-box; + padding: 0 8px; + border-radius: $caja-radio-pill; + background: $caja-verde; + color: #FFFFFF; + font-size: 13px; + font-weight: 800; + display: flex; + align-items: center; + justify-content: center; + } + + // El precio deja de flotar sobre una foto: es una columna del renglón. + .beyond-price { + position: static !important; + flex: none; + min-width: 92px; + text-align: right; + padding: 0; + border-radius: 0; + background: transparent; + box-shadow: none; + font-size: 19px; + font-weight: 800; + letter-spacing: -0.02em; + color: $caja-tinta; + pointer-events: none; + } + + .beyond_prod_mas { + flex: none; + width: 32px; + height: 32px; + border-radius: 11px; + background: $caja-suave; + color: $caja-tinta-media; + display: flex; + align-items: center; + justify-content: center; + font-size: 13px; + transition: background 140ms ease, color 140ms ease; + } + + .product:hover .beyond_prod_mas { + background: $caja-verde; + color: #FFFFFF; + } + + // ── Los vacíos ────────────────────────────────────────────────────── + .beyond_ticket_vacio, + .beyond_catalogo_vacio { + box-sizing: border-box; + padding: 40px 30px; + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; + text-align: center; + } + + .beyond_vacio_titulo { + font-size: 16px; + font-weight: 800; + color: $caja-tinta; + } + + .beyond_vacio_nota { + font-size: 13.5px; + font-weight: 700; + color: $caja-tinta-apagada; + max-width: 280px; + text-wrap: pretty; + } +} + +// El botón llano del pie del ticket (y de quien lo reutilice): gris cálido, +// texto firme, rojo solo al ofrecer borrar. +.pos .beyond_boton_llano { + all: unset; + cursor: pointer; + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: center; + gap: 7px; + min-height: 44px; + padding: 0 12px; + border-radius: 14px; + background: $caja-suave; + color: $caja-tinta; + font-size: 13px; + font-weight: 800; + white-space: nowrap; + transition: background 140ms ease, color 140ms ease; + + .fa { color: $caja-tinta-media; } + + &:hover { background: $caja-suave-hover; } + + &:disabled, &[disabled] { + opacity: 0.5; + cursor: not-allowed; + } + + &.beyond_boton_peligro:hover { + background: $caja-rojo-tinte; + color: $caja-rojo; + + .fa { color: $caja-rojo; } + } +} diff --git a/addons/beyond_pos_theme/static/src/venta/venta.js b/addons/beyond_pos_theme/static/src/venta/venta.js new file mode 100644 index 0000000..cd14f01 --- /dev/null +++ b/addons/beyond_pos_theme/static/src/venta/venta.js @@ -0,0 +1,137 @@ +/* Part of Beyond. Collina Systems proprietary module. */ +import { patch } from "@web/core/utils/patch"; +import { ProductScreen } from "@point_of_sale/app/screens/product_screen/product_screen"; +import { OrderSummary } from "@point_of_sale/app/screens/product_screen/order_summary/order_summary"; +import { OrderDisplay } from "@point_of_sale/app/components/order_display/order_display"; +import { NoteButton } from "@point_of_sale/app/screens/product_screen/control_buttons/orderline_note_button/orderline_note_button"; + +import { valorDeLinea, valorSinDescuento } from "../api_pos/contrato"; + +/** + * La pantalla de venta del rediseño (2-sep-2026): el ticket a la izquierda + * con Cliente y Atendió arriba y el pie con Descuento · Nota · Eliminar y + * el botón Cobrar; el catálogo a la derecha como lista, con su buscador y + * su botón de escanear. + * + * La barra de control del core (ControlButtons) deja de dibujarse: sus + * piezas viven ahora en el ticket. Por eso los mandos de descuento y de + * atribución se anclan aquí (ProductScreen) y no en aquella. + */ + +/** Iniciales para el avatar: «Mr. Worldwide» → «MW». */ +export function inicialesDe(nombre) { + return String(nombre || "") + .split(" ") + .filter(Boolean) + .slice(0, 2) + .map((parte) => parte[0]) + .join("") + .toUpperCase(); +} + +patch(ProductScreen, { + components: { ...ProductScreen.components, NoteButton }, +}); + +patch(ProductScreen.prototype, { + // ── Cabecera del ticket ───────────────────────────────────────────── + + get beyondCliente() { + return this.currentOrder?.partner_id || null; + }, + + get beyondIniCliente() { + const cliente = this.beyondCliente; + return cliente ? inicialesDe(cliente.name) : "+"; + }, + + // ── El pie ────────────────────────────────────────────────────────── + + /** + * Lo que va a cobrar el botón: la suma de las líneas por sus CAMPOS + * (`price_unit`, `qty`, `discount`). Con IVA incluido (ADR-010) eso ES + * el total a pagar — la misma cuenta que hacen la propina y el + * descuento, y que el servidor repite en `_compute_beyond_descuento`. + */ + get beyondTotalCobrar() { + const orden = this.currentOrder; + if (!orden) { + return 0; + } + return orden.lines.reduce((suma, linea) => suma + valorDeLinea(linea), 0); + }, + + // ── El catálogo ───────────────────────────────────────────────────── + + beyondBuscar(ev) { + // La misma palabra que leía el buscador de la barra: la pantalla ya + // reacciona a ella; solo cambió dónde se teclea. + this.pos.searchProductWord = ev.target.value; + }, + + /** + * El escáner, con el mismo camino que seguía el botón de la barra + * (navbar.js): fijar la ruta antes de encender para que el lector caiga + * en esta orden, y limpiar el aviso de la cámara para que reintentar + * sea reintentar (camara_pos.js). + */ + beyondEscanear() { + this.pos.beyondErrorCamara = ""; + if (!this.pos.scanning) { + this.pos.navigate("ProductScreen", { orderUuid: this.pos.getOrder().uuid }); + } + this.pos.mobile_pane = "right"; + this.pos.scanning = !this.pos.scanning; + }, +}); + +patch(OrderSummary.prototype, { + /** El importe del renglón, de los campos y con la moneda de la caja. */ + beyondImporteDe(linea) { + return this.env.utils.formatCurrency(valorDeLinea(linea)); + }, + + beyondPrecioUnitario(linea) { + return this.env.utils.formatCurrency(linea.price_unit || 0); + }, + + /** «−10%», sin decimales fantasma: 10.0 → 10, 12.5 → 12.5. */ + beyondEtiquetaDescuento(linea) { + const valor = Math.round((linea.discount || 0) * 10) / 10; + return `−${valor}%`; + }, +}); + +patch(OrderDisplay.prototype, { + /** Cuántas piezas lleva el ticket, sin contar la propina. */ + get beyondPiezas() { + const propina = this.beyondProductoPropina; + const piezas = this.props.order.lines + .filter((linea) => linea.product_id?.id !== propina) + .reduce((suma, linea) => suma + (linea.qty || 0), 0); + const redondas = Math.round(piezas * 100) / 100; + return `${redondas} ${Math.abs(redondas) === 1 ? "pieza" : "piezas"}`; + }, + + get beyondProductoPropina() { + return this.env.services.pos?.config?.tip_product_id?.id; + }, + + /** El bruto: las líneas sin su descuento, que es sobre lo que se habla. */ + get beyondSubtotal() { + const bruto = this.props.order.lines.reduce( + (suma, linea) => suma + valorSinDescuento(linea), 0); + return this.env.utils.formatCurrency(bruto); + }, + + /** Lo que se dejó de cobrar. Vacío si no hay descuento. */ + get beyondDescuento() { + const lineas = this.props.order.lines; + const rebaja = lineas.reduce( + (suma, linea) => suma + valorSinDescuento(linea) - valorDeLinea(linea), 0); + if (rebaja <= 0.004) { + return ""; + } + return `−${this.env.utils.formatCurrency(rebaja)}`; + }, +}); diff --git a/addons/beyond_pos_theme/static/src/venta/venta.xml b/addons/beyond_pos_theme/static/src/venta/venta.xml new file mode 100644 index 0000000..85a6a2e --- /dev/null +++ b/addons/beyond_pos_theme/static/src/venta/venta.xml @@ -0,0 +1,211 @@ + + + + + + + + + +
+ + + +
+
+ + + +
+
+ + + + +
+ +
+
+ + + +
+
+ + +
+ +
+
+ + + +
+ Nada con «» + Revisa el nombre o escanea el código del producto. +
+
+
+ + + + + +
  • + + + + + + + + + + + + + + c/u · + + + + +
  • +
    + + + + +
    + Ticket vacío + Toca un producto o escanea un código para empezar la venta. +
    +
    +
    +
    + + + + + +
    +
    + Subtotal · + +
    +
    + Impuestos incluidos + +
    +
    + Descuento + +
    +
    + Total + +
    +
    +
    +
    + + + + + + + + +
    diff --git a/addons/beyond_pos_theme/static/src/venta_limpia/venta_limpia.xml b/addons/beyond_pos_theme/static/src/venta_limpia/venta_limpia.xml index 21cf598..f0c8d44 100644 --- a/addons/beyond_pos_theme/static/src/venta_limpia/venta_limpia.xml +++ b/addons/beyond_pos_theme/static/src/venta_limpia/venta_limpia.xml @@ -1,58 +1,15 @@ - + - Fuera el botón de subir/guardar la orden: es flujo de «vender en - varias tandas» que el mostrador de un salón no usa, y era el único - con `ms-auto`, así que quitarlo además deja la barra lista para - centrarse por CSS. - --> - - - - - - - - - - -
    - - - -
    -
    -