From cca836bb6a82977b6793fc0bfa6b9cb7019ef64e Mon Sep 17 00:00:00 2001 From: Mauricio Baeza Date: Sat, 29 Feb 2020 23:51:14 -0600 Subject: [PATCH] Add UI for fiscal leyends --- CHANGELOG.md | 5 ++ VERSION | 2 +- requirements.txt | 1 - source/app/models/main.py | 1 + source/app/settings.py | 2 +- source/static/js/controller/admin.js | 80 ++++++++++++++++++++++++---- source/static/js/ui/admin.js | 79 +++++++++++++++++++++++++++ 7 files changed, 157 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d7f3db..1aa530f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ +v 1.37.0 [01-mar-2020] +---------------------- + - Mejora: Soporte para complemento Leyendas Fiscales + + v 1.36.0 [25-feb-2020] ---------------------- - Mejora: Permitir ver a usuarios todos los documentos diff --git a/VERSION b/VERSION index 39fc130..bf50e91 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.0 +1.37.0 diff --git a/requirements.txt b/requirements.txt index 6b2a201..d33642b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,6 @@ falcon-multipart Beaker Mako peewee==2.10.2 -Click logbook bcrypt python-dateutil diff --git a/source/app/models/main.py b/source/app/models/main.py index f9e1a77..fbfd1ac 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -432,6 +432,7 @@ class Configuracion(BaseModel): 'chk_config_divisas', 'chk_cfg_pays_data_bank', 'chk_usar_nomina', + 'chk_config_leyendas_fiscales', ) data = (Configuracion .select() diff --git a/source/app/settings.py b/source/app/settings.py index edcf327..b1f5bc7 100644 --- a/source/app/settings.py +++ b/source/app/settings.py @@ -47,7 +47,7 @@ except ImportError: DEBUG = DEBUG -VERSION = '1.36.0' +VERSION = '1.37.0' EMAIL_SUPPORT = ('soporte@empresalibre.mx',) TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION) diff --git a/source/static/js/controller/admin.js b/source/static/js/controller/admin.js index 83721b4..7d21936 100644 --- a/source/static/js/controller/admin.js +++ b/source/static/js/controller/admin.js @@ -92,6 +92,24 @@ var controllers = { $$('chk_llevar_inventario').attachEvent('onItemClick', chk_config_item_click) $$('chk_use_packing').attachEvent('onItemClick', chk_config_item_click) + //~ Complements + $$('chk_usar_nomina').attachEvent('onItemClick', chk_config_item_click) + $$('txt_config_nomina_serie').attachEvent('onKeyPress', txt_config_nomina_serie_press) + $$('txt_config_nomina_folio').attachEvent('onKeyPress', txt_config_nomina_folio_press) + + $$('chk_config_pagos').attachEvent('onItemClick', chk_config_item_click) + $$('chk_cfg_pays_data_bank').attachEvent('onItemClick', chk_config_item_click) + $$('txt_config_cfdipay_serie').attachEvent('onKeyPress', txt_config_cfdipay_serie_press) + $$('txt_config_cfdipay_folio').attachEvent('onKeyPress', txt_config_cfdipay_folio_press) + + $$('chk_config_divisas').attachEvent('onItemClick', chk_config_item_click) + $$('chk_config_ine').attachEvent('onItemClick', chk_config_item_click) + $$('chk_config_edu').attachEvent('onItemClick', chk_config_item_click) + + $$('chk_config_leyendas_fiscales').attachEvent('onItemClick', chk_config_item_click) + $$('cmd_admin_leyendas_fiscales').attachEvent('onItemClick', cmd_admin_leyendas_fiscales_click) + + //~ Others $$('chk_config_ocultar_metodo_pago').attachEvent('onItemClick', chk_config_item_click) $$('chk_config_ocultar_condiciones_pago').attachEvent('onItemClick', chk_config_item_click) $$('chk_config_send_zip').attachEvent('onItemClick', chk_config_item_click) @@ -105,11 +123,7 @@ var controllers = { $$('chk_config_decimales_precios').attachEvent('onItemClick', chk_config_item_click) $$('chk_config_user_show_doc').attachEvent('onItemClick', chk_config_item_click) $$('chk_config_anticipo').attachEvent('onItemClick', chk_config_item_click) - $$('chk_config_ine').attachEvent('onItemClick', chk_config_item_click) - $$('chk_config_edu').attachEvent('onItemClick', chk_config_item_click) - $$('chk_config_pagos').attachEvent('onItemClick', chk_config_item_click) - $$('chk_config_divisas').attachEvent('onItemClick', chk_config_item_click) - $$('chk_cfg_pays_data_bank').attachEvent('onItemClick', chk_config_item_click) + $$('chk_usar_punto_de_venta').attachEvent('onItemClick', chk_config_item_click) $$('chk_ticket_pdf_show').attachEvent('onItemClick', chk_config_item_click) $$('chk_ticket_direct_print').attachEvent('onItemClick', chk_config_item_click) @@ -117,11 +131,6 @@ var controllers = { $$('chk_ticket_total_up').attachEvent('onItemClick', chk_config_item_click) $$('chk_ticket_user_show_doc').attachEvent('onItemClick', chk_config_item_click) $$('txt_ticket_printer').attachEvent('onKeyPress', txt_ticket_printer_key_press) - $$('txt_config_nomina_serie').attachEvent('onKeyPress', txt_config_nomina_serie_press) - $$('txt_config_nomina_folio').attachEvent('onKeyPress', txt_config_nomina_folio_press) - $$('txt_config_cfdipay_serie').attachEvent('onKeyPress', txt_config_cfdipay_serie_press) - $$('txt_config_cfdipay_folio').attachEvent('onKeyPress', txt_config_cfdipay_folio_press) - $$('chk_usar_nomina').attachEvent('onItemClick', chk_config_item_click) $$('lst_pac').attachEvent('onChange', lst_pac_on_change) $$('cmd_subir_bdfl').attachEvent('onItemClick', cmd_subir_bdfl_click) @@ -471,6 +480,9 @@ function get_config_values(opt){ set_value(key, values[key]) }else{ $$(key).setValue(values[key]) + if(key=='chk_config_leyendas_fiscales'){ + admin_config_other_options(key) + } } }) } @@ -1816,6 +1828,8 @@ function chk_config_item_click(id, e){ } }) + admin_config_other_options(id) + } @@ -2570,3 +2584,49 @@ function lst_pac_on_change(nv, ov){ }) } } + + +function admin_config_other_options(id){ + if(id=='chk_config_leyendas_fiscales'){ + var value = Boolean($$(id).getValue()) + if(value){ + $$('cmd_admin_leyendas_fiscales').enable() + }else{ + $$('cmd_admin_leyendas_fiscales').disable() + } + } +} + + +function cmd_admin_leyendas_fiscales_click(){ + admin_ui_leyendas_fiscales.init() + $$('win_leyendas_fiscales').show() + get_leyendas_fiscales() +} + + +function add_admin_leyenda_fiscal_click(){ + msg_ok('Add') +} + + +function grid_admin_leyendas_fiscales_click(id){ + if(id.column != 'delete'){ + return + } + + msg = '¿Estás seguro de eliminar esta Leyenda Fiscal' + webix.confirm({ + title: 'Eliminar', + ok: 'Si', + cancel: 'No', + type: 'confirm-error', + text: msg, + callback:function(result){ + if(result){ + delete_leyenda_fiscal(id.row) + } + } + }) + +} diff --git a/source/static/js/ui/admin.js b/source/static/js/ui/admin.js index 8ffe3eb..84cc8e6 100644 --- a/source/static/js/ui/admin.js +++ b/source/static/js/ui/admin.js @@ -784,6 +784,15 @@ var options_admin_complements = [ {view: 'checkbox', id: 'chk_config_edu', labelWidth: 0, labelRight: 'Usar el complemento EDU'}, {maxWidth: 15}]}, + {maxHeight: 20}, + {template: 'Complemento Leyendas Fiscales', type: 'section'}, + {cols: [{maxWidth: 15}, + {view: 'checkbox', id: 'chk_config_leyendas_fiscales', labelWidth: 0, + labelRight: 'Usar el complemento Leyendas Fiscales'}, + {view: 'button', id: 'cmd_admin_leyendas_fiscales', label: 'Leyendas Fiscales', + type: 'form', align: 'center', autowidth: true, disabled: true}, + {}, {maxWidth: 15} + ]}, ] @@ -1415,3 +1424,73 @@ var body_win_emisor_logo = [ + +var grid_cols_admin_leyendas_fiscales = [ + {id: 'id', header: 'ID', hidden: true}, + {id: 'delete', header: '', width: 30, css: 'delete'}, + {id: 'leyenda', header: 'Leyenda', fillspace: 1}, + {id: 'norma', header: 'Norma', fillspace: 1}, + {id: 'disposicion', header: 'Disposición Fiscal', fillspace: 1}, + //~ {id: 'active', header: 'Activa', template: '{common.checkbox()}', + //~ editor: 'checkbox'}, +] + + +var grid_admin_leyendas_fiscales = { + view: 'datatable', + id: 'grid_admin_leyendas_fiscales', + select: 'cell', + adjust: true, + autoheight: true, + headermenu: true, + columns: grid_cols_admin_leyendas_fiscales, + on:{ + 'data->onStoreUpdated':function(){ + this.data.each(function(obj, i){ + obj.delete = '-' + }) + } + }, +} + + +var form_controls_admin_leyendas_fiscales = [ + {cols: [ + {view: 'text', id: 'txt_leyenda_fiscal', label: 'Leyenda', width: 200, + labelPosition: 'top', name: 'txt_leyenda_fiscal', required: true}, + {view: "text", id: 'txt_norma_fiscal', label: 'Norma', width: 200, + name: 'txt_leyenda_fiscal', labelPosition: 'top'}, + {view: "text", id: 'txt_disposicion_fiscal', label: 'Disposición', + name: 'txt_disposicion_fiscal', labelPosition: 'top', width: 200} + ]}, + {cols: [{}, + {view: 'button', type: 'icon', icon: 'plus', label: 'Agregar', autowidth: true, + click: function(){add_admin_leyenda_fiscal_click()} + }, {}]}, + grid_admin_leyendas_fiscales, + {}, + {cols:[{}, + {view: 'button', value: 'Cerrar', click: "$$('win_leyendas_fiscales').close()"}, + {}]} +] + + +var admin_ui_leyendas_fiscales = { + init: function(){ + webix.ui({ + view: 'window', + id: 'win_leyendas_fiscales', + head: 'Leyendas Fiscales', + width: 800, + modal: true, + position: 'center', + body: { + view: 'form', id: 'form_admin_leyendas_fiscales', + elements: form_controls_admin_leyendas_fiscales + } + }) + + $$('grid_admin_leyendas_fiscales').attachEvent('onItemClick', grid_admin_leyendas_fiscales_click) + + }, +}