diff --git a/source/app/models/main.py b/source/app/models/main.py index 8faaeb7..8738b18 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -180,12 +180,21 @@ class Configuracion(BaseModel): elif keys['fields'] == 'configotros': fields = ( 'chk_config_anticipo', + 'chk_config_cuenta_predial', 'chk_config_ine', ) data = (Configuracion .select() .where(Configuracion.clave.in_(fields)) ) + elif keys['fields'] == 'productos': + fields = ( + 'chk_config_cuenta_predial', + ) + data = (Configuracion + .select() + .where(Configuracion.clave.in_(fields)) + ) values = {r.clave: r.valor for r in data} return values @@ -1770,6 +1779,7 @@ class Productos(BaseModel): Productos.descripcion, Productos.unidad, Productos.valor_unitario, + Productos.cuenta_predial, ) .where(Productos.id==id).dicts()[0] ) diff --git a/source/static/js/controller/admin.js b/source/static/js/controller/admin.js index 4c87b0b..27a9f75 100644 --- a/source/static/js/controller/admin.js +++ b/source/static/js/controller/admin.js @@ -51,6 +51,7 @@ var controllers = { $$('txt_plantilla_donataria').attachEvent('onItemClick', txt_plantilla_donataria_click) $$('chk_config_anticipo').attachEvent('onItemClick', chk_config_item_click) $$('chk_config_ine').attachEvent('onItemClick', chk_config_item_click) + $$('chk_config_cuenta_predial').attachEvent('onItemClick', chk_config_item_click) $$('cmd_subir_bdfl').attachEvent('onItemClick', cmd_subir_bdfl_click) $$('up_bdfl').attachEvent('onUploadComplete', up_bdfl_upload_complete) diff --git a/source/static/js/controller/products.js b/source/static/js/controller/products.js index 52074c9..0db84e9 100644 --- a/source/static/js/controller/products.js +++ b/source/static/js/controller/products.js @@ -1,5 +1,20 @@ +function configurar_productos(){ + webix.ajax().get('/config', {'fields': 'productos'}, { + error: function(text, data, xhr) { + msg = 'Error al consultar' + msg_error(msg) + }, + success: function(text, data, xhr) { + var values = data.json() + //~ showvar(values) + show('cuenta_predial', values.chk_config_cuenta_predial) + } + }) +} + + function get_categorias(){ webix.ajax().sync().get('/values/categorias', function(text, data){ var values = data.json() @@ -9,6 +24,7 @@ function get_categorias(){ function cmd_new_product_click(id, e, node){ + configurar_productos() $$('form_product').setValues({ id: 0, es_activo_producto: true}) add_config({'key': 'id_product', 'value': ''}) @@ -22,6 +38,7 @@ function cmd_new_product_click(id, e, node){ function cmd_edit_product_click(id, e, node){ + configurar_productos() var grid = $$('grid_products') var row = grid.getSelectedItem() if(row == undefined){ diff --git a/source/static/js/ui/admin.js b/source/static/js/ui/admin.js index bab05c9..27a267e 100644 --- a/source/static/js/ui/admin.js +++ b/source/static/js/ui/admin.js @@ -43,7 +43,7 @@ var admin_ui_windows = { $$('form_editar_usuario').bind($$('grid_usuarios')) - } + }, } @@ -488,10 +488,19 @@ var options_templates = [ var options_admin_otros = [ {maxHeight: 15}, + {template: 'Ayudas varias', type: 'section'}, {cols: [{maxWidth: 15}, {view: 'checkbox', id: 'chk_config_anticipo', labelWidth: 0, labelRight: 'Ayuda para generar anticipos'}, {}]}, + {maxHeight: 20}, + {template: 'Productos y Servicios', type: 'section'}, + {cols: [{maxWidth: 15}, + {view: 'checkbox', id: 'chk_config_cuenta_predial', labelWidth: 0, + labelRight: 'Mostrar cuenta predial'}, + {}]}, + {maxHeight: 20}, + {template: 'Complementos', type: 'section'}, {cols: [{maxWidth: 15}, {view: 'checkbox', id: 'chk_config_ine', labelWidth: 0, labelRight: 'Mostrar el complemento INE al facturar'}, @@ -504,14 +513,13 @@ var tab_options = { view: 'tabview', id: 'tab_options', multiview: true, - tabbar: {options: [ - 'Plantillas', - 'Otros']}, + //~ tabbar: {options: [ + //~ 'Plantillas', + //~ 'Otros']}, animate: true, cells: [ {id: 'Plantillas', rows: options_templates}, {id: 'Otros', rows: options_admin_otros}, - {}, ], } @@ -835,7 +843,7 @@ var grid_usuarios = { obj.delete = '-' }) } - } + }, }