Add templates

This commit is contained in:
el Mau 2023-01-06 21:42:46 -06:00
parent 8872af8c50
commit 1d270aa478
3 changed files with 85 additions and 77 deletions

View File

@ -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)

View File

@ -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){

View File

@ -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},