From 1d270aa4784a05a22178de1742cf0d9e5ba1b2bc Mon Sep 17 00:00:00 2001 From: el Mau Date: Fri, 6 Jan 2023 21:42:46 -0600 Subject: [PATCH] Add templates --- source/app/controllers/util.py | 6 +- source/static/js/controller/admin.js | 136 ++++++++++++++------------- source/static/js/ui/admin.js | 20 ++-- 3 files changed, 85 insertions(+), 77 deletions(-) diff --git a/source/app/controllers/util.py b/source/app/controllers/util.py index 2cbda51..407158d 100644 --- a/source/app/controllers/util.py +++ b/source/app/controllers/util.py @@ -2295,7 +2295,11 @@ def upload_file(rfc, opt, file_obj): versions = ('_3.2.ods', '_3.3.ods', '_3.3_cn_1.2.ods', '_3.3_ccp_2.0.ods', - '_4.0.ods', '_4.0_cn_1.2.ods', '_4.0_cp_2.0.ods') + '_4.0.ods', + '_4.0_cn_1.2.ods', + '_4.0_cp_2.0.ods', + '_4.0_ccp_2.0.ods', + '_4.0_cd_1.1.ods') if opt in versions: return save_template(rfc, opt, file_obj) diff --git a/source/static/js/controller/admin.js b/source/static/js/controller/admin.js index 4604a7d..38db792 100644 --- a/source/static/js/controller/admin.js +++ b/source/static/js/controller/admin.js @@ -80,9 +80,9 @@ var controllers = { $$('txt_plantilla_factura_json').attachEvent('onItemClick', txt_plantilla_factura_json_click) $$('txt_plantilla_factura_css').attachEvent('onItemClick', txt_plantilla_factura_css_click) $$('txt_plantilla_ticket').attachEvent('onItemClick', txt_plantilla_ticket_click) - $$('txt_plantilla_donataria').attachEvent('onItemClick', txt_plantilla_donataria_click) + //~ $$('txt_plantilla_donataria').attachEvent('onItemClick', txt_plantilla_donataria_click) //~ $$('txt_plantilla_nomina1233').attachEvent('onItemClick', txt_plantilla_nomina1233_click) - $$('txt_plantilla_pagos10').attachEvent('onItemClick', txt_plantilla_pagos10_click) + //~ $$('txt_plantilla_pagos10').attachEvent('onItemClick', txt_plantilla_pagos10_click) $$('make_pdf_from').attachEvent('onChange', opt_make_pdf_from_on_change) $$('cmd_template_upload').attachEvent('onItemClick', cmd_template_upload_click) @@ -501,7 +501,9 @@ function set_config_templates(){ success: function(text, data, xhr) { var values = data.json() Object.keys(values).forEach(function(key){ - show(key, values[key]) + if(key!='txt_plantilla_donataria'){ + show(key, values[key]) + } }) } }) @@ -1179,42 +1181,42 @@ function txt_plantilla_factura_json_click(e){ } -function txt_plantilla_donataria_click(e){ +//~ function txt_plantilla_donataria_click(e){ - var body_elements = [ - {cols: [{width: 100}, {view: 'uploader', id: 'up_template', autosend: true, link: 'lst_files', - value: 'Seleccionar archivo', upload: '/files/txt_plantilla_donataria', - width: 200}, {width: 100}]}, - {view: 'list', id: 'lst_files', type: 'uploader', autoheight:true, - borderless: true}, - {}, - {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true, - click:("$$('win_template').close();")}, {}]} - ] + //~ var body_elements = [ + //~ {cols: [{width: 100}, {view: 'uploader', id: 'up_template', autosend: true, link: 'lst_files', + //~ value: 'Seleccionar archivo', upload: '/files/txt_plantilla_donataria', + //~ width: 200}, {width: 100}]}, + //~ {view: 'list', id: 'lst_files', type: 'uploader', autoheight:true, + //~ borderless: true}, + //~ {}, + //~ {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true, + //~ click:("$$('win_template').close();")}, {}]} + //~ ] - var w = webix.ui({ - view: 'window', - id: 'win_template', - modal: true, - position: 'center', - head: 'Subir Plantilla Donataria', - body: { - view: 'form', - elements: body_elements, - } - }) + //~ var w = webix.ui({ + //~ view: 'window', + //~ id: 'win_template', + //~ modal: true, + //~ position: 'center', + //~ head: 'Subir Plantilla Donataria', + //~ body: { + //~ view: 'form', + //~ elements: body_elements, + //~ } + //~ }) - w.show() + //~ w.show() - $$('up_template').attachEvent('onUploadComplete', function(response){ - if(response.ok){ - $$('txt_plantilla_donataria').setValue(response.name) - msg_ok('Plantilla cargada correctamente') - }else{ - msg_error(response.name) - } - }) -} + //~ $$('up_template').attachEvent('onUploadComplete', function(response){ + //~ if(response.ok){ + //~ $$('txt_plantilla_donataria').setValue(response.name) + //~ msg_ok('Plantilla cargada correctamente') + //~ }else{ + //~ msg_error(response.name) + //~ } + //~ }) +//~ } function txt_plantilla_nomina1233_click(e){ @@ -1255,42 +1257,42 @@ function txt_plantilla_nomina1233_click(e){ } -function txt_plantilla_pagos10_click(e){ +//~ function txt_plantilla_pagos10_click(e){ - var body_elements = [ - {cols: [{width: 100}, {view: 'uploader', id: 'up_template', - autosend: true, link: 'lst_files', value: 'Seleccionar archivo', - upload: '/files/txt_plantilla_pagos10', width: 200}, {width: 100}]}, - {view: 'list', id: 'lst_files', type: 'uploader', autoheight:true, - borderless: true}, - {}, - {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true, - click:("$$('win_template').close();")}, {}]} - ] + //~ var body_elements = [ + //~ {cols: [{width: 100}, {view: 'uploader', id: 'up_template', + //~ autosend: true, link: 'lst_files', value: 'Seleccionar archivo', + //~ upload: '/files/txt_plantilla_pagos10', width: 200}, {width: 100}]}, + //~ {view: 'list', id: 'lst_files', type: 'uploader', autoheight:true, + //~ borderless: true}, + //~ {}, + //~ {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true, + //~ click:("$$('win_template').close();")}, {}]} + //~ ] - var w = webix.ui({ - view: 'window', - id: 'win_template', - modal: true, - position: 'center', - head: 'Subir Plantilla Factura de Pago', - body: { - view: 'form', - elements: body_elements, - } - }) + //~ var w = webix.ui({ + //~ view: 'window', + //~ id: 'win_template', + //~ modal: true, + //~ position: 'center', + //~ head: 'Subir Plantilla Factura de Pago', + //~ body: { + //~ view: 'form', + //~ elements: body_elements, + //~ } + //~ }) - w.show() + //~ w.show() - $$('up_template').attachEvent('onUploadComplete', function(response){ - if(response.ok){ - $$('txt_plantilla_pagos10').setValue(response.name) - msg_ok('Plantilla cargada correctamente') - }else{ - msg_error(response.name) - } - }) -} + //~ $$('up_template').attachEvent('onUploadComplete', function(response){ + //~ if(response.ok){ + //~ $$('txt_plantilla_pagos10').setValue(response.name) + //~ msg_ok('Plantilla cargada correctamente') + //~ }else{ + //~ msg_error(response.name) + //~ } + //~ }) +//~ } function tab_options_change(nv, ov){ diff --git a/source/static/js/ui/admin.js b/source/static/js/ui/admin.js index 8a8525f..acd55a4 100644 --- a/source/static/js/ui/admin.js +++ b/source/static/js/ui/admin.js @@ -596,10 +596,13 @@ var type_make_pdf = [ ] +//~ Templates var opt_templates_cfdi = [ {id: '_4.0.ods', value: 'CFDI v4.0'}, {id: '_4.0_cn_1.2.ods', value: 'CFDI v4.0 - Nómina v1.2'}, {id: '_4.0_cp_2.0.ods', value: 'CFDI v4.0 - Pagos v2.0'}, + {id: '_4.0_ccp_2.0.ods', value: 'CFDI v4.0 - Carta Porte v2.0'}, + {id: '_4.0_cd_1.1.ods', value: 'CFDI v4.0 - Donativos v1.1'}, {id: '_3.3.ods', value: 'CFDI v3.3'}, {id: '_3.3_cn_1.2.ods', value: 'CFDI v3.3 - Nómina v1.2'}, {id: '_3.3_ccp_2.0.ods', value: 'CFDI v3.3 - Carta Porte v2.0'}, @@ -631,20 +634,19 @@ var options_templates = [ label: 'Plantilla Factura v3.3 (JSON): ', labelPosition: 'top', icon: 'file'}, {maxWidth: 25}, {}, {maxWidth: 20} ]}, - - {maxHeight: 20}, - {cols: [{maxWidth: 20}, - {view: 'search', id: 'txt_plantilla_pagos10', name: 'plantilla_pagos10', - label: 'Plantilla Factura de Pagos v1.0 - Cfdi 3.3 (ODS): ', - labelPosition: 'top', icon: 'file'}, {maxWidth: 40}, {}]}, {maxHeight: 20}, + //~ {cols: [{maxWidth: 20}, + //~ {view: 'search', id: 'txt_plantilla_pagos10', name: 'plantilla_pagos10', + //~ label: 'Plantilla Factura de Pagos v1.0 - Cfdi 3.3 (ODS): ', + //~ labelPosition: 'top', icon: 'file'}, {maxWidth: 40}, {}]}, + //~ {maxHeight: 20}, {cols: [{maxWidth: 20}, {view: 'search', id: 'txt_plantilla_ticket', name: 'plantilla_ticket', label: 'Plantilla para Tickets (ODS): ', labelPosition: 'top', icon: 'file'}, - {view: 'search', id: 'txt_plantilla_donataria', name: 'plantilla_donataria', - label: 'Plantilla Donataria (solo ONGs): ', labelPosition: 'top', - icon: 'file'}, + //~ {view: 'search', id: 'txt_plantilla_donataria', name: 'plantilla_donataria', + //~ label: 'Plantilla Donataria (solo ONGs): ', labelPosition: 'top', + //~ icon: 'file'}, {}]}, {maxHeight: 20}, {cols: [{maxWidth: 20},