From d06a5b83611fff0141e4373ab9916acc41809f3b Mon Sep 17 00:00:00 2001 From: Mauricio Baeza Date: Sun, 26 Nov 2017 23:40:14 -0600 Subject: [PATCH] Mostrar nombre de empresa --- source/app/models/db.py | 3 +++ source/app/models/main.py | 16 ++++++++++++++++ source/static/js/controller/main.js | 4 ++++ source/static/js/ui/main.js | 2 +- source/static/js/ui/partners.js | 2 +- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/source/app/models/db.py b/source/app/models/db.py index c1c7eb0..90d1f4d 100644 --- a/source/app/models/db.py +++ b/source/app/models/db.py @@ -14,6 +14,9 @@ class StorageEngine(object): def get_values(self, table, values=None): return getattr(self, '_get_{}'.format(table))(values) + def _get_main(self, values): + return main.config_main() + def _get_configtimbrar(self, values): return main.config_timbrar() diff --git a/source/app/models/main.py b/source/app/models/main.py index afb6941..fb6720c 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -102,6 +102,22 @@ def validar_timbrar(): return {'ok': True, 'msg': msg} +def config_main(): + try: + obj = Emisor.select()[0] + except IndexError: + obj = None + + data = { + 'empresa': 'Empresa Libre', + } + if not obj is None: + titulo = 'Empresa Libre - {}' + data['empresa'] = titulo.format(obj.nombre) + + return data + + def config_timbrar(): try: obj = Emisor.select()[0] diff --git a/source/static/js/controller/main.js b/source/static/js/controller/main.js index d74004a..6fbef20 100644 --- a/source/static/js/controller/main.js +++ b/source/static/js/controller/main.js @@ -6,6 +6,10 @@ function configuracion_inicial(){ var values = data.json() $$('cmd_ir_al_admin').show(values) }) + webix.ajax().get('/values/main', function(text, data){ + var values = data.json() + $$('lbl_title_main').setValue(values.empresa) + }) } diff --git a/source/static/js/ui/main.js b/source/static/js/ui/main.js index 5034328..d004c18 100644 --- a/source/static/js/ui/main.js +++ b/source/static/js/ui/main.js @@ -63,7 +63,7 @@ var ui_main = { $$('$sidebar1').toggle() } }, - {view: 'label', label: 'Empresa Libre'}, + {view: 'label', id: 'lbl_title_main', label: 'Empresa Libre'}, {}, menu_user, {view: 'button', type: 'icon', width: 45, css: 'app_button', diff --git a/source/static/js/ui/partners.js b/source/static/js/ui/partners.js index 3c399c3..4b763fe 100644 --- a/source/static/js/ui/partners.js +++ b/source/static/js/ui/partners.js @@ -14,7 +14,7 @@ var grid_partners_cols = [ {id: 'index', header:'#', css: 'right', footer: {content: 'rowCount', colspan: 2, css: 'right'}}, {id: 'id', header: 'Clave', sort: 'int', css: 'right'}, - {id: 'rfc', header: ['RFC', {content: 'textFilter'}], + {id: 'rfc', header: ['RFC', {content: 'textFilter'}], adjust: 'data', sort: 'string', footer: {text: 'Clientes y Proveedores', colspan: 2}}, {id: 'nombre', header: ['Razón Social', {content: 'textFilter'}], fillspace:true, sort: 'string'},