0

Como podria agregar que tambien inserte los valores por teclado, o asignar que una tecla haga la misma funcion que haciendo clic sobre el boton. aca el codigo de la caja completo https://codepen.io/juanm151/pen/yLLbper

y la parte del primer boton

["alt", "7"],
                ["class", "tpv-selected-btn-round tpv-selected-button-exportable"],
                ["src", "./assets/icon/icones_taules_tpv_7.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("7") && u
                }

https://codepen.io/juanm151/pen/VwwbyrM

 function Tg(l) {
            return eL["ɵvid"](0, [(l()(), eL["ɵeld"](0, 0, null, null, 18, "div", [
                ["class", "row text-center"]
            ], null, null, null, null, null)), (l()(), eL["ɵand"](16777216, null, null, 1, null, Ig)), eL["ɵdid"](2, 16384, null, 0, mL.m, [eL.ViewContainerRef, eL.TemplateRef], {
                ngIf: [0, "ngIf"]
            }, null), (l()(), eL["ɵeld"](3, 0, null, null, 3, "div", [
                ["class", "col-12 text-center m-t-10"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](4, 0, null, null, 0, "img", [
                ["alt", "7"],
                ["class", "tpv-selected-btn-round tpv-selected-button-exportable"],
                ["src", "./assets/icon/icones_taules_tpv_7.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("7") && u
                }
                ngStyle: [0, "ngStyle"]
            }, null), (l()(), eL["ɵeld"](34, 0, null, null, 3, "div", [
                ["class", "tpv-selected-screen"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](35, 0, null, null, 2, "div", [
                ["class", "tpv-selected-screen-border"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](36, 0, null, null, 1, "p", [
                ["class", "tpv-selected-screen-font margin-bot-0 limitChars"]
            ], null, null, null, null, null)), (l()(), eL["ɵted"](37, null, [" ", " "])), (l()(), eL["ɵeld"](38, 0, null, null, 11, "div", [
                ["class", "tpv-selected-row"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](39, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"],
                ["title", "Caja"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](40, 0, null, null, 0, "img", [
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_caja_diners.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.cashOutIn() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](41, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"],
                ["title", "Cambiar de\n      caja"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](42, 0, null, null, 0, "img", [
                ["alt", "cajas"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_caja.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.changeCash() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](43, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"],
                ["title", "Calendario"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](44, 0, null, null, 0, "img", [
                ["alt", "reservas"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_reserves.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.openCalendar() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](45, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"],
                ["title", "Take Away"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](46, 0, null, null, 0, "img", [
                ["alt", "tk"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_take_away.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.goToTakeAway() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](47, 0, null, null, 2, "div", [
                ["class", "tpv-selected-row-big vertical-align text-uppercase text-center"],
                ["title", "Mesas"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](48, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-big text-uppercase text-center"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.goToTables() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵted"](-1, null, [" mesas "])), (l()(), eL["ɵeld"](50, 0, null, null, 11, "div", [
                ["class", "tpv-selected-row"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](51, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"],
                ["title", "Añadir"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](52, 0, null, null, 0, "img", [
                ["alt", "otros"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_add.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.addElement() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](53, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](54, 0, null, null, 0, "img", [
                ["alt", "7"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_7.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("7") && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](55, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](56, 0, null, null, 0, "img", [
                ["alt", "8"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_8.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("8") && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](57, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](58, 0, null, null, 0, "img", [
                ["alt", "9"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_9.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("9") && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](59, 0, null, null, 2, "div", [
                ["class", "tpv-selected-row-big vertical-align text-uppercase text-center"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](60, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-big"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.openCreateInvoice() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵted"](-1, null, [" factura "])), (l()(), eL["ɵeld"](62, 0, null, null, 11, "div", [
                ["class", "tpv-selected-row"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](63, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"],
                ["title", "Bar"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](64, 0, null, null, 0, "img", [
                ["alt", "bar"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_bar.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.openBarTicket() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](65, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](66, 0, null, null, 0, "img", [
                ["alt", "4"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_4.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("4") && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](67, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](68, 0, null, null, 0, "img", [
                ["alt", "5"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_5.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("5") && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](69, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](70, 0, null, null, 0, "img", [
                ["alt", "6"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_6.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("6") && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](71, 0, null, null, 2, "div", [
                ["class", "tpv-selected-row-big vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](72, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-big text-uppercase text-center"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.openAddUnits() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵted"](-1, null, [" Unidades "])), (l()(), eL["ɵeld"](74, 0, null, null, 11, "div", [
                ["class", "tpv-selected-row"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](75, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"],
                ["title", "Comensales"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](76, 0, null, null, 0, "img", [
                ["alt", "comensales"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_comensales.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.openPersons() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](77, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](78, 0, null, null, 0, "img", [
                ["alt", "1"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_1.png"]
            ], null, 
   [
    [null, "keyup"]
            ], function(l, n, e) {
                var u = !0;
                if ("keyup" === n) {
                    u = !1 !==(l.component.tpvServices)._keyup(e) && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](79, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](80, 0, null, null, 0, "img", [
                ["alt", "2"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_2.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("2") && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](81, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](82, 0, null, null, 0, "img", [
                ["alt", "3"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_3.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("3") && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](83, 0, null, null, 2, "div", [
                ["class", "tpv-selected-row-big vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](84, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-big text-uppercase text-center btn-danger"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.cancelTicket() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵted"](-1, null, [" Cancelar "])), (l()(), eL["ɵeld"](86, 0, null, null, 11, "div", [
                ["class", "tpv-selected-row"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](87, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"],
                ["title", "Ticket"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.openTickets() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](88, 0, null, null, 0, "img", [
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_ticket.png"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](89, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](90, 0, null, null, 0, "img", [
                ["alt", "ce"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_ce.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.deleteKeyboard() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](91, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](92, 0, null, null, 0, "img", [
                ["alt", "0"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_0.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard("0") && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](93, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](94, 0, null, null, 0, "img", [
                ["alt", "."],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_punto.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.tpvServices.insertKeyboard(".") && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](95, 0, null, null, 2, "div", [
                ["class", "tpv-selected-row-big vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](96, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-big text-uppercase text-center"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.cashFastPay() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵted"](-1, null, [" caja rápida "])), (l()(), eL["ɵeld"](98, 0, null, null, 8, "div", [
                ["class", "tpv-selected-row"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](99, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-border vertical-align"],
                ["title", "Bloquear TPV"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](100, 0, null, null, 0, "img", [
                ["alt", "bloquear"],
                ["class", "tpv-selected-btn-round tpv-selected-button"],
                ["src", "./assets/icon/icones_taules_tpv_block.png"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.blockScreen() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵeld"](101, 0, null, null, 2, "div", [
                ["class", "tpv-selected-row-big vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](102, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-big text-uppercase text-center\n        btn-warning"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.ticketPrint() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵted"](-1, null, [" ticket "])), (l()(), eL["ɵeld"](104, 0, null, null, 2, "div", [
                ["class", "tpv-selected-row-big vertical-align"]
            ], null, null, null, null, null)), (l()(), eL["ɵeld"](105, 0, null, null, 1, "div", [
                ["class", "tpv-selected-button-big text-uppercase text-center\n        btn-success"]
            ], null, [
                [null, "click"]
            ], function(l, n, e) {
                var u = !0;
                if ("click" === n) {
                    u = !1 !== l.component.pay() && u
                }
                return u
            }, null, null)), (l()(), eL["ɵted"](-1, null, [" caja "]))], function(l, n) {
                var e = n.component;
                l(n, 2, 0, e.styleHeight());
                l(n, 13, 0, e.tpvServices.listSelectedTicket("name", e.globals.objectToArray(e.tpvServices.tables_array[e.tpvServices.selected_table_tpv_index].ticket.list)));
                l(n, 33, 0, e.styleHeight())
            }, function(l, n) {
                var e = n.component;
                l(n, 7, 0, e.tpvServices.tables_array[e.tpvServices.selected_table_tpv_index].cash_static);
                l(n, 9, 0, e.tpvServices.tables_array[e.tpvServices.selected_table_tpv_index].name);
                l(n, 11, 0, e.tpvServices.tables_array[e.tpvServices.selected_table_tpv_index].persons);
                l(n, 19, 0, eL["ɵunv"](n, 19, 0, l(n, 20, 0, eL["ɵnov"](n, 0), e.tpvServices.totalTicketSelectedNoTax(e.tpvServices.selected_table_tpv_index, e.globals.RESTAURANT_TAX), e.globals.user_currency, "symbol", "0.2-2", "es")));
                l(n, 23, 0, e.globals.user_tax_name);
                l(n, 25, 0, e.globals.RESTAURANT_TAX);
                l(n, 30, 0, eL["ɵunv"](n, 30, 0, l(n, 31, 0, eL["ɵnov"](n, 0), e.tpvServices.totalTicketSelected(e.tpvServices.selected_table_tpv_index), e.globals.user_currency, "symbol", "0.2-2", "es")));
                l(n, 37, 0, e.tpvServices.keyboard_screen)
            })
        }
  • 1
    Tu código es muy confuso, ¿puedes contextualizar el problema? – Daniel Rodríguez Meza Oct 24 '19 at 21:24
  • El problema es el siguiente: tengo un punto de venta parecido a una calculadora pero solo funciona con click, lo que quisiera es que tambien funcione con el teclado. este es un ejemplo de la funcion del boton. https://codepen.io/juanm151/pen/VwwbyrM // boton 7 – juan manuel Oct 25 '19 at 00:28
  • Es muy difícil o imposible entender que es lo que está haciendo ese código, pero si lo que quieres hacer es que se haga eso que no se entinde que es, con la presion de una tecla, tienes que agregar listeners para _escuchar_ la presion de dichas teclas, mira aqui https://es.stackoverflow.com/questions/82929/eventos-keypress-keydown-keyup.. – Emeeus Oct 25 '19 at 14:58

0 Answers0