Agregar plantilla donataria
This commit is contained in:
parent
26dc5d3372
commit
dc1daf2c31
|
@ -1183,6 +1183,15 @@ def upload_file(rfc, opt, file_obj):
|
||||||
tmp = file_obj.filename.split('.')
|
tmp = file_obj.filename.split('.')
|
||||||
name = '{}.{}'.format(rfc.lower(), tmp[-1].lower())
|
name = '{}.{}'.format(rfc.lower(), tmp[-1].lower())
|
||||||
path = _join(PATH_MEDIA, 'logos', name)
|
path = _join(PATH_MEDIA, 'logos', name)
|
||||||
|
elif opt == 'txt_plantilla_factura_32':
|
||||||
|
tmp = file_obj.filename.split('.')
|
||||||
|
ext = tmp[-1].lower()
|
||||||
|
if ext != 'ods':
|
||||||
|
msg = 'Extensión de archivo incorrecta, selecciona un archivo ODS'
|
||||||
|
return {'status': 'server', 'name': msg, 'ok': False}
|
||||||
|
|
||||||
|
name = '{}_3.2.ods'.format(rfc.lower())
|
||||||
|
path = _join(PATH_MEDIA, 'templates', name)
|
||||||
elif opt == 'txt_plantilla_factura_33':
|
elif opt == 'txt_plantilla_factura_33':
|
||||||
tmp = file_obj.filename.split('.')
|
tmp = file_obj.filename.split('.')
|
||||||
ext = tmp[-1].lower()
|
ext = tmp[-1].lower()
|
||||||
|
@ -1192,14 +1201,23 @@ def upload_file(rfc, opt, file_obj):
|
||||||
|
|
||||||
name = '{}_3.3.ods'.format(rfc.lower())
|
name = '{}_3.3.ods'.format(rfc.lower())
|
||||||
path = _join(PATH_MEDIA, 'templates', name)
|
path = _join(PATH_MEDIA, 'templates', name)
|
||||||
elif opt == 'txt_plantilla_factura_32':
|
elif opt == 'txt_plantilla_factura_33j':
|
||||||
|
tmp = file_obj.filename.split('.')
|
||||||
|
ext = tmp[-1].lower()
|
||||||
|
if ext != 'json':
|
||||||
|
msg = 'Extensión de archivo incorrecta, selecciona un archivo JSON'
|
||||||
|
return {'status': 'server', 'name': msg, 'ok': False}
|
||||||
|
|
||||||
|
name = '{}_3.3.json'.format(rfc.lower())
|
||||||
|
path = _join(PATH_MEDIA, 'templates', name)
|
||||||
|
elif opt == 'txt_plantilla_donataria':
|
||||||
tmp = file_obj.filename.split('.')
|
tmp = file_obj.filename.split('.')
|
||||||
ext = tmp[-1].lower()
|
ext = tmp[-1].lower()
|
||||||
if ext != 'ods':
|
if ext != 'ods':
|
||||||
msg = 'Extensión de archivo incorrecta, selecciona un archivo ODS'
|
msg = 'Extensión de archivo incorrecta, selecciona un archivo ODS'
|
||||||
return {'status': 'server', 'name': msg, 'ok': False}
|
return {'status': 'server', 'name': msg, 'ok': False}
|
||||||
|
|
||||||
name = '{}_3.2.ods'.format(rfc.lower())
|
name = '{}_3.3_donataria.ods'.format(rfc.lower())
|
||||||
path = _join(PATH_MEDIA, 'templates', name)
|
path = _join(PATH_MEDIA, 'templates', name)
|
||||||
|
|
||||||
if save_file(path, file_obj.file.read()):
|
if save_file(path, file_obj.file.read()):
|
||||||
|
|
|
@ -39,6 +39,8 @@ var controllers = {
|
||||||
tb_options.attachEvent('onChange', tab_options_change)
|
tb_options.attachEvent('onChange', tab_options_change)
|
||||||
$$('txt_plantilla_factura_32').attachEvent('onItemClick', txt_plantilla_factura_32_click)
|
$$('txt_plantilla_factura_32').attachEvent('onItemClick', txt_plantilla_factura_32_click)
|
||||||
$$('txt_plantilla_factura_33').attachEvent('onItemClick', txt_plantilla_factura_33_click)
|
$$('txt_plantilla_factura_33').attachEvent('onItemClick', txt_plantilla_factura_33_click)
|
||||||
|
$$('txt_plantilla_factura_33j').attachEvent('onItemClick', txt_plantilla_factura_33j_click)
|
||||||
|
$$('txt_plantilla_donataria').attachEvent('onItemClick', txt_plantilla_donataria_click)
|
||||||
$$('chk_config_anticipo').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_ine').attachEvent('onItemClick', chk_config_item_click)
|
||||||
}
|
}
|
||||||
|
@ -292,6 +294,10 @@ function get_config_values(opt){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(opt == 'templates'){
|
||||||
|
show('txt_plantilla_donataria', $$('chk_ong').getValue())
|
||||||
|
}
|
||||||
|
|
||||||
webix.ajax().get('/config', {'fields': opt}, {
|
webix.ajax().get('/config', {'fields': opt}, {
|
||||||
error: function(text, data, xhr) {
|
error: function(text, data, xhr) {
|
||||||
msg = 'Error al consultar'
|
msg = 'Error al consultar'
|
||||||
|
@ -808,6 +814,82 @@ function txt_plantilla_factura_32_click(e){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function txt_plantilla_factura_33j_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_factura_33j',
|
||||||
|
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 3.3 JSON',
|
||||||
|
body: {
|
||||||
|
view: 'form',
|
||||||
|
elements: body_elements,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
w.show()
|
||||||
|
|
||||||
|
$$('up_template').attachEvent('onUploadComplete', function(response){
|
||||||
|
if(response.ok){
|
||||||
|
$$('txt_plantilla_factura_33j').setValue(response.name)
|
||||||
|
msg_sucess('Plantilla cargada correctamente')
|
||||||
|
}else{
|
||||||
|
msg_error(response.name)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 w = webix.ui({
|
||||||
|
view: 'window',
|
||||||
|
id: 'win_template',
|
||||||
|
modal: true,
|
||||||
|
position: 'center',
|
||||||
|
head: 'Subir Plantilla Donataria',
|
||||||
|
body: {
|
||||||
|
view: 'form',
|
||||||
|
elements: body_elements,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
w.show()
|
||||||
|
|
||||||
|
$$('up_template').attachEvent('onUploadComplete', function(response){
|
||||||
|
if(response.ok){
|
||||||
|
$$('txt_plantilla_donataria').setValue(response.name)
|
||||||
|
msg_sucess('Plantilla cargada correctamente')
|
||||||
|
}else{
|
||||||
|
msg_error(response.name)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function tab_options_change(nv, ov){
|
function tab_options_change(nv, ov){
|
||||||
var cv = {
|
var cv = {
|
||||||
Plantillas: 'templates',
|
Plantillas: 'templates',
|
||||||
|
|
|
@ -427,6 +427,11 @@ var options_templates = [
|
||||||
{view: 'search', id: 'txt_plantilla_factura_33j', name: 'plantilla_factura_33j',
|
{view: 'search', id: 'txt_plantilla_factura_33j', name: 'plantilla_factura_33j',
|
||||||
label: 'Plantilla Factura v3.3 (JSON): ', labelPosition: 'top',
|
label: 'Plantilla Factura v3.3 (JSON): ', labelPosition: 'top',
|
||||||
icon: 'file'}, {}]},
|
icon: 'file'}, {}]},
|
||||||
|
{maxHeight: 20},
|
||||||
|
{cols: [{maxWidth: 15},
|
||||||
|
{view: 'search', id: 'txt_plantilla_donataria', name: 'plantilla_donataria',
|
||||||
|
label: 'Plantilla Donataria (solo ONGs): ', labelPosition: 'top',
|
||||||
|
icon: 'file'}, {}]},
|
||||||
{}]
|
{}]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue