diff --git a/source/static/js/controller/main.js b/source/static/js/controller/main.js index 45b4cbf..2965a10 100644 --- a/source/static/js/controller/main.js +++ b/source/static/js/controller/main.js @@ -98,6 +98,7 @@ var controllers = { webix.extend($$('grid_invoices'), webix.ProgressBar) bancos_controllers.init() + tickets_controllers.init() } } diff --git a/source/static/js/controller/tickets.js b/source/static/js/controller/tickets.js new file mode 100644 index 0000000..5c3faf5 --- /dev/null +++ b/source/static/js/controller/tickets.js @@ -0,0 +1,26 @@ +var query = [] +var msg = '' + + +var tickets_controllers = { + init: function(){ + $$('cmd_nuevo_ticket').attachEvent('onItemClick', cmd_nuevo_ticket_click) + $$('cmd_generar_ticket').attachEvent('onItemClick', cmd_generar_ticket_click) + $$('cmd_cerrar_ticket').attachEvent('onItemClick', cmd_cerrar_ticket_click) + } +} + + +function cmd_nuevo_ticket_click(){ + $$('multi_tickets').setValue('tickets_new') +} + + +function cmd_generar_ticket_click(){ + showvar('ok') +} + + +function cmd_cerrar_ticket_click(){ + $$('multi_tickets').setValue('tickets_home') +} \ No newline at end of file diff --git a/source/static/js/ui/tickets.js b/source/static/js/ui/tickets.js index 7a3f534..a0d728a 100644 --- a/source/static/js/ui/tickets.js +++ b/source/static/js/ui/tickets.js @@ -1,7 +1,5 @@ - - var toolbar_tickets = [ {view: 'button', id: 'cmd_nuevo_ticket', label: 'Nuevo', type: 'iconButton', autowidth: true, icon: 'plus'}, @@ -69,13 +67,113 @@ var rows_tickets_home = [ ] +var tbody_buscar_producto = {rows: [ + {cols: [ + {view: 'search', id: 'tsearch_product_key', name: 'tsearch_product_key', + label: 'por Clave', labelPosition:'top', maxWidth: 250, + placeholder: 'Presiona ENTER para buscar'}, + {view: 'search', id: 'tsearch_product_name', name: 'search_product_name', + label: 'por Descripción', labelPosition:'top', suggest: [], + placeholder: 'Captura al menos tres letras'}, + ]}, +]} + + + +var grid_tdetails_cols = [ + {id: "id", header:"ID", hidden: true}, + {id: 'delete', header: '', width: 30, css: 'delete'}, + {id: "clave", header:{text: 'Clave', css: 'center'}, width: 100}, + {id: "clave_sat", hidden: true}, + {id: "descripcion", header:{text: 'Descripción', css: 'center'}, + fillspace: true, editor: 'text'}, + {id: "unidad", header:{text: 'Unidad', css: 'center'}, width: 100}, + {id: 'cantidad', header: {text: 'Cantidad', css: 'center'}, width: 100, + format: webix.i18n.numberFormat, css: 'right', editor: 'text'}, + {id: "valor_unitario", header:{text: 'Valor Unitario', css: 'center'}, + width: 100, format: webix.i18n.priceFormat, css: 'right', editor: 'text'}, + {id: 'descuento', header:{text: 'Descuento', css: 'center'}, hidden: true, + width: 80, format: webix.i18n.priceFormat, css: 'right', editor: 'text'}, + {id: 'precio_final', hidden: true, header: 'precio_final', width: 80, + format: webix.i18n.priceFormat, css: 'right'}, + {id: "importe", header:{text: 'Importe', css: 'center'}, width: 150, + format: webix.i18n.priceFormat, css: 'right'}, +] + + +var grid_tdetails = { + view: 'datatable', + id: 'grid_tdetails', + select: 'row', + adjust: true, + autoheight: true, + editable: true, + columns: grid_tdetails_cols, + data: [], +} + + +var controls_generate_ticket = [ + {minHeight: 10, maxHeight: 10}, + {cols: [{rows: [ + {view: 'fieldset', label: 'Buscar Producto', body: tbody_buscar_producto}, + ]}, + {maxWidth: 10}, + {maxWidth: 300, rows: [ + {view: 'fieldset', label: 'Información', body: {}}, + ]}, + ]}, + {view: 'label', label: 'Detalle', height: 30, align: 'left'}, + grid_tdetails, + {minHeight: 20, maxHeight: 20}, + {margin: 20, cols: [{}, + {view: 'button', id: 'cmd_generar_ticket', label: 'Generar', + icon: 'ticket', type: 'iconButton', autowidth: true, align: 'center'}, + {}] + }, + {rows: [ + {template: '', type: 'section'}, + {margin: 10, cols: [{}, + {view: 'button', id: 'cmd_cerrar_ticket', label: 'Cerrar', + type: 'danger', autowidth: true, align: 'center'} + ] + }, + ]} +] + + +var controls_new_ticket = [ + { + view: 'tabview', + id: 'tv_new_ticket', + animate: true, + cells: [ + {id: 'Generar', rows: controls_generate_ticket}, + ] + }, +] + + +var form_new_ticket = { + type: 'space', + responsive: true, + cols: [{ + view: 'form', + id: 'form_new_ticket', + complexData: true, + scroll: true, + elements: controls_new_ticket, + }] +} + + var multi_tickets = { id: 'multi_tickets', view: 'multiview', animate: true, cells:[ {id: 'tickets_home', rows: rows_tickets_home}, - {id: 'tickets_new', rows:[]} + {id: 'tickets_new', rows:[form_new_ticket]} ], } @@ -83,7 +181,8 @@ var multi_tickets = { var app_tickets = { id: 'app_tickets', rows:[ - {view: 'template', id: 'th_ticckets', type: 'header', template: 'Punto de venta'}, + {view: 'template', id: 'th_ticckets', type: 'header', + template: 'Punto de venta - Tickets'}, multi_tickets ], } diff --git a/source/templates/main.html b/source/templates/main.html index 2e3ee63..d5395ca 100644 --- a/source/templates/main.html +++ b/source/templates/main.html @@ -15,6 +15,7 @@ +