empresa-libre/source/static/js/ui/admin.js

615 lines
18 KiB
JavaScript
Raw Normal View History

2017-09-21 23:24:18 -05:00
var menu_data = [
{id: 'app_home', icon: 'dashboard', value: 'Inicio'},
{id: 'app_emisor', icon: 'user-circle', value: 'Emisor'},
2017-10-07 00:16:58 -05:00
{id: 'app_folios', icon: 'sort-numeric-asc', value: 'Folios'},
2017-10-16 00:02:51 -05:00
{id: 'app_correo', icon: 'envelope-o', value: 'Correo'},
2017-11-03 20:05:19 -06:00
{id: 'app_sat', icon: 'table', value: 'Catalogos SAT'},
{id: 'app_options', icon: 'cog', value: 'Opciones'},
2017-09-21 23:24:18 -05:00
]
2017-11-03 20:05:19 -06:00
var sidebar_admin = {
2017-09-21 23:24:18 -05:00
view: 'sidebar',
2017-11-03 20:05:19 -06:00
id: 'sidebar_admin',
2017-09-21 23:24:18 -05:00
data: menu_data,
ready: function(){
this.select('app_home');
this.open(this.getParentId('app_home'));
},
on:{
onAfterSelect: function(id){
2017-10-07 23:52:11 -05:00
$$('multi_admin').setValue(id)
2017-09-21 23:24:18 -05:00
}
}
2017-10-07 00:16:58 -05:00
}
var emisor_datos_fiscales = [
{template: 'Datos SAT', type: 'section'},
{cols: [{view: 'text', id: 'emisor_rfc', name: 'emisor_rfc', label: 'RFC: ',
width: 300, required: true, invalidMessage: 'RFC inválido',
readonly: true, attributes: {maxlength: 13}}, {}]},
{view: 'text', id: 'emisor_nombre', name: 'emisor_nombre',
label: 'Razón Social: ', required: true,
invalidMessage: 'La Razón Social es requerida'},
{cols: [
{view: 'search', id: 'emisor_cp', name: 'emisor_cp', width: 300,
2017-10-07 23:52:11 -05:00
label: 'C.P.: ', required: true, attributes: {maxlength: 5},
invalidMessage: 'El C.P. es requerido'},
2017-10-07 00:16:58 -05:00
{view: 'text', id: 'emisor_cp2', name: 'emisor_cp2', width: 300,
label: 'C.P. de Expedición: ', attributes: {maxlength: 5}},
{}]},
{cols: [
{view: 'label', label: 'Regimenes Fiscales *', required: true}, {}]},
{cols: [{view: 'list', id: 'lst_emisor_regimen', select: 'multiselect',
2017-10-07 23:52:11 -05:00
name: 'lst_emisor_regimen', width: 600, height: 125, required: true,
2017-10-07 00:16:58 -05:00
data: []}, {}]},
{template: 'Dirección Fiscal', type: 'section'},
{view: 'text', id: 'emisor_calle', name: 'emisor_calle', label: 'Calle: '},
{cols: [{view: 'text', id: 'emisor_no_exterior', name: 'emisor_no_exterior',
width: 300, label: 'No Exterior: '},{}]},
{cols: [{view: 'text', id: 'emisor_no_interior', name: 'emisor_no_interior',
width: 300, label: 'No Interior: '},{}]},
{view: 'text', id: 'emisor_colonia', name: 'emisor_colonia',
label: 'Colonia: '},
{view: 'text', id: 'emisor_municipio', name: 'emisor_municipio',
label: 'Municipio: '},
{view: 'text', id: 'emisor_estado', name: 'emisor_estado',
label: 'Estado: '},
{view: 'text', id: 'emisor_pais', name: 'emisor_pais', label: 'País: ',
value: 'México', readonly: true},
{template: '', type: 'section', minHeight: 25},
]
var emisor_otros_datos= [
{template: 'Generales', type: 'section'},
2017-10-25 22:26:18 -05:00
{view: 'search', id: 'emisor_logo', icon: 'file-image-o',
name: 'emisor_logo', label: 'Logotipo: '},
2017-10-07 00:16:58 -05:00
{view: 'text', id: 'emisor_nombre_comercial',
name: 'emisor_nombre_comercial', label: 'Nombre comercial: '},
{view: 'text', id: 'emisor_telefono', name: 'emisor_telefono',
label: 'Teléfonos: '},
{view: 'text', id: 'emisor_correo', name: 'emisor_correo',
label: 'Correos: '},
{view: 'text', id: 'emisor_web', name: 'emisor_web',
label: 'Página Web: '},
{template: 'Escuela', type: 'section'},
{cols: [{view: 'checkbox', id: 'chk_escuela', name: 'es_escuela',
label: 'Es Escuela'},
2017-10-07 23:52:11 -05:00
{view: 'button', id: 'cmd_niveles', label: 'Niveles Escolares',
type: 'form', align: 'center', autowidth: true, disabled: true},
{}, {}]},
2017-10-07 00:16:58 -05:00
{template: 'ONG', type: 'section'},
{view: 'checkbox', id: 'chk_ong', name: 'es_ong', label: 'Es ONG'},
{cols: [{view: 'text', id: 'ong_autorizacion', name: 'ong_autorizacion',
label: 'Autorización: ', disabled: true,
placeholder: 'Número de autorización del SAT'}, {}]},
{cols: [{view: 'datepicker', id: 'ong_fecha', name: 'ong_fecha',
2017-10-07 23:52:11 -05:00
label: 'Fecha de Autorización: ', disabled: true, format: '%d-%M-%Y',
2017-10-07 00:16:58 -05:00
placeholder: 'Fecha de autorización en el SAT'}, {}]},
{cols: [{view: 'datepicker', id: 'ong_fecha_dof', name: 'ong_fecha_dof',
2017-10-07 23:52:11 -05:00
label: 'Fecha de DOF: ', disabled: true, format: '%d-%M-%Y',
2017-10-07 00:16:58 -05:00
placeholder: 'Fecha de publicación en el DOF'}, {}]},
2017-10-18 23:06:07 -05:00
{template: 'Timbrado y Soporte', type: 'section'},
2017-10-25 22:26:18 -05:00
{view: 'text', id: 'correo_timbrado',
name: 'correo_timbrado', label: 'Usuario para Timbrado: '},
2017-10-18 23:06:07 -05:00
{view: 'text', id: 'token_timbrado',
name: 'token_timbrado', label: 'Token de Timbrado: '},
{view: 'text', id: 'token_soporte',
name: 'token_soporte', label: 'Token de Soporte: '},
2017-10-07 00:16:58 -05:00
]
var emisor_certificado = [
{template: 'Certificado actual', type: 'section'},
{view: 'form', id: 'form_cert', rows: [
{cols: [{view: 'text', id: 'cert_rfc', name: 'cert_rfc',
label: 'RFC: ', readonly: true, placeholder: 'Ninguno'}, {}]},
{cols: [{view: 'text', id: 'cert_serie', name: 'cert_serie',
label: 'Serie: ', readonly: true, placeholder: 'Ninguno'}, {}]},
{cols: [{view: 'text', id: 'cert_desde', name: 'cert_desde',
label: 'Vigente desde: ', readonly: true}, {}]},
{cols: [{view: 'text', id: 'cert_hasta', name: 'cert_hasta',
label: 'Vigente hasta: ', readonly: true}, {}]},
]},
{template: 'Cargar Certificado', type: 'section'},
{view: 'form', id: 'form_upload', rows: [
{cols: [{},
2017-10-08 22:01:19 -05:00
{view: 'uploader', id: 'up_cert', autosend: false, link: 'lst_cert',
value: 'Seleccionar certificado', upload: '/values/files'}, {}]},
2017-10-07 00:16:58 -05:00
{cols: [{},
2017-10-08 22:01:19 -05:00
{view: 'list', id: 'lst_cert', name: 'certificado',
type: 'uploader', autoheight:true, borderless: true}, {}]},
2017-10-07 00:16:58 -05:00
{cols: [{},
2017-10-08 22:01:19 -05:00
{view: 'text', id: 'txt_contra', name: 'contra',
label: 'Contraseña KEY', labelPosition: 'top',
labelAlign: 'center', type: 'password', required: true}, {}]},
2017-10-07 00:16:58 -05:00
{cols: [{}, {view: 'button', id: 'cmd_subir_certificado',
label: 'Subir certificado'}, {}]},
]},
]
var controls_emisor = [
{
view: 'tabview',
id: 'tab_emisor',
tabbar: {options: [
'Datos Fiscales',
'Otros Datos',
'Certificado']},
animate: true,
cells: [
{id: 'Datos Fiscales', rows: emisor_datos_fiscales},
{id: 'Otros Datos', rows: emisor_otros_datos},
{id: 'Certificado', rows: emisor_certificado},
{},
]
}
]
var form_emisor = {
type: 'space',
cols: [{
view: 'form',
id: 'form_emisor',
complexData: true,
elements: controls_emisor,
elementsConfig: {
labelWidth: 150,
labelAlign: 'right'
},
autoheight: true,
rules: {
emisor_nombre: function(value){return value.trim() != ''},
}
}]
}
var options_usarcon = [
{id: 'S', value: 'Todos'},
{id: 'I', value: 'Ingreso'},
{id: 'E', value: 'Egreso'},
{id: 'T', value: 'Traslado'},
]
var grid_folios_cols = [
{id: 'delete', header: '', width: 30, css: 'delete'},
{id: 'serie', header: 'Serie', fillspace: 1},
{id: 'inicio', header: 'Inicio', fillspace: 1},
{id: 'usarcon', header: 'Usar Con', fillspace: 1},
2017-10-09 23:34:16 -05:00
{id: 'pre', header: 'Predeterminado', fillspace: 1}
2017-10-07 00:16:58 -05:00
]
var grid_folios = {
view: 'datatable',
id: 'grid_folios',
select: 'row',
adjust: true,
headermenu: true,
columns: grid_folios_cols
}
var emisor_folios = [
{template: 'Nueva serie', type: 'section'},
{cols: [
{view: 'text', id: 'folio_serie', name: 'folio_serie', label: 'Serie: ',
required: true, attributes: {maxlength: 15}},
{view: 'counter', id: 'folio_inicio', name: 'folio_inicio', value: 1,
2017-10-09 23:34:16 -05:00
required: true, label: 'Inicio: ', step: 1, min: 1},
2017-10-07 00:16:58 -05:00
{view: 'richselect', id: 'folio_usarcon', name: 'folio_usarcon',
label: 'Usar Con: ', value: 'S', required: true,
options: options_usarcon},
]},
{maxHeight: 20},
{cols: [{},
{view: 'button', id: 'cmd_agregar_serie', label: 'Agregar Serie',
autowidth: true, type: 'form'},
{}]},
{template: 'Series guardadas', type: 'section'},
grid_folios
]
2017-10-16 00:02:51 -05:00
var emisor_correo = [
{template: 'Servidor de Salida', type: 'section'},
{cols: [
{view: 'text', id: 'correo_servidor', name: 'correo_servidor',
label: 'Servidor SMTP: '},
{}]},
{cols: [
{view: 'counter', id: 'correo_puerto', name: 'correo_puerto',
label: 'Puerto: ', value: 26, step: 1},
{}]},
{cols: [
{view: 'checkbox', id: 'correo_ssl', name: 'correo_ssl',
label: 'Usar TLS/SSL: '},
{}]},
{cols: [
{view: 'text', id: 'correo_usuario', name: 'correo_usuario',
label: 'Usuario: '},
{}]},
{cols: [
{view: 'text', id: 'correo_contra', name: 'correo_contra',
label: 'Contraseña: ', type: 'password'},
{}]},
{cols: [
{view: 'text', id: 'correo_copia', name: 'correo_copia',
label: 'Con copia a: '}
]},
{cols: [
{view: 'text', id: 'correo_asunto', name: 'correo_asunto',
label: 'Asunto del correo: '}
]},
{cols: [
{view: 'textarea', id: 'correo_mensaje', name: 'correo_mensaje',
label: 'Mensaje del correo: ', height: 200}
]},
{cols: [
{view: 'checkbox', id: 'correo_directo', name: 'correo_directo',
label: 'Enviar directamente: '},
{}]},
{minHeight: 25},
{cols: [{},
{view: 'button', id: 'cmd_probar_correo', label: 'Probar Configuración',
autowidth: true, type: 'form'},
{maxWidth: 100},
{view: 'button', id: 'cmd_guardar_correo', label: 'Guardar Configuración',
autowidth: true, type: 'form'},
{}]}
]
2017-10-07 00:16:58 -05:00
var controls_folios = [
{
view: 'tabview',
id: 'tab_folios',
tabbar: {options: ['Folios']},
animate: true,
cells: [
{id: 'Folios', rows: emisor_folios},
{},
]
}
]
2017-10-16 00:02:51 -05:00
var controls_correo = [
{
view: 'tabview',
id: 'tab_correo',
tabbar: {options: ['Correo Electrónico']},
animate: true,
cells: [
{id: 'Correo Electrónico', rows: emisor_correo},
{},
]
}
]
2017-10-07 00:16:58 -05:00
var form_folios = {
type: 'space',
cols: [{
view: 'form',
id: 'form_folios',
complexData: true,
elements: controls_folios,
elementsConfig: {
labelWidth: 100,
labelAlign: 'right'
},
autoheight: true,
rules: {
2017-10-09 23:34:16 -05:00
folio_serie: function(value){return value.trim() != ''},
folio_inicio: function(value){return value > 0},
2017-10-07 00:16:58 -05:00
}
}]
}
2017-10-16 00:02:51 -05:00
var form_correo = {
type: 'space',
cols: [{
view: 'form',
id: 'form_correo',
complexData: true,
elements: controls_correo,
elementsConfig: {
labelWidth: 150,
labelAlign: 'right'
},
autoheight: true
}]
}
2017-11-03 20:05:19 -06:00
var options_templates = [
{maxHeight: 15},
{cols: [{maxWidth: 15},
{view: 'search', id: 'txt_plantilla_factura_32', name: 'plantilla_factura_32',
label: 'Plantilla Factura v3.2 (ODT): ', labelPosition: 'top',
icon: 'file'}, {}]},
{maxHeight: 20},
{cols: [{maxWidth: 15},
{view: 'search', id: 'txt_plantilla_factura_33', labelPosition: 'top',
label: 'Plantilla Factura v3.3 (ODT): ', icon: 'file'}, {}]},
{maxHeight: 20},
{cols: [{maxWidth: 15},
{view: 'search', id: 'txt_plantilla_factura_33j', name: 'plantilla_factura_33j',
label: 'Plantilla Factura v3.3 (JSON): ', labelPosition: 'top',
icon: 'file'}, {}]},
{}]
var tab_options = {
view: 'tabview',
id: 'tab_options',
multiview: true,
tabbar: {options: [
'Plantillas',
'Otros']},
animate: true,
cells: [
{id: 'Plantillas', rows: options_templates},
{id: 'Otros', rows: [{}]},
{},
]
}
2017-11-03 22:23:15 -06:00
var grid_admin_taxes_cols = [
{id: 'id', header: 'ID', hidden: true},
{id: 'name', header: 'Nombre'},
{id: 'tipo', header: 'Tipo'},
{id: 'tasa', header: 'Tasa'},
{id: 'activo', header: 'Activo', template: '{common.checkbox()}',
editor: 'checkbox'},
{id: 'default', header: 'Predeterminado', template: '{common.radio()}',
adjust: 'header'},
]
2017-11-06 22:59:39 -06:00
var grid_admin_monedas_cols = [
{id: 'id', header: 'ID', hidden: true},
{id: 'key', header: 'Clave'},
{id: 'name', header: 'Nombre', adjust: 'data'},
{id: 'activo', header: 'Activa', template: '{common.checkbox()}',
editor: 'checkbox'},
{id: 'default', header: 'Predeterminada', template: '{common.radio()}',
adjust: 'header'},
]
2017-11-11 20:21:00 -06:00
var grid_admin_bancos_cols = [
{id: 'id', header: 'ID', hidden: true},
{id: 'key', header: 'Clave', footer: {content: 'rowCount', css: 'right'}},
{id: 'name', header: 'Nombre', adjust: 'data', footer: 'Bancos'},
{id: 'activo', header: 'Activo', template: '{common.checkbox()}',
editor: 'checkbox'},
]
2017-11-03 22:23:15 -06:00
var grid_admin_taxes = {
view: 'datatable',
id: 'grid_admin_taxes',
select: 'cell',
multiselect: true,
adjust: true,
autoheight: true,
autowidth: true,
headermenu: true,
2017-11-06 22:59:39 -06:00
columns: grid_admin_taxes_cols
2017-11-03 22:23:15 -06:00
}
2017-11-06 22:59:39 -06:00
var grid_admin_monedas = {
view: 'datatable',
id: 'grid_admin_monedas',
select: 'cell',
multiselect: true,
adjust: true,
autoheight: true,
autowidth: true,
headermenu: true,
columns: grid_admin_monedas_cols
}
2017-11-03 22:23:15 -06:00
2017-11-06 22:59:39 -06:00
2017-11-11 20:21:00 -06:00
var grid_admin_bancos = {
view: 'datatable',
id: 'grid_admin_bancos',
select: 'cell',
multiselect: true,
adjust: true,
autowidth: true,
headermenu: true,
footer: true,
columns: grid_admin_bancos_cols
}
2017-11-06 22:59:39 -06:00
var msg_tax = 'Activa los impuestos que uses. El predeterminado se muestra primero'
2017-11-03 22:23:15 -06:00
var sat_impuestos = [
{maxHeight: 20},
{cols: [{maxWidth: 15}, {view: 'label', label: msg_tax}, {}]},
{maxHeight: 20},
{cols: [{maxWidth: 15}, grid_admin_taxes, {}]},
{}]
2017-11-11 20:21:00 -06:00
2017-11-06 22:59:39 -06:00
var msg_moneda = 'Activa las monedas que uses. La predeterminada se muestra primero'
var sat_monedas = [
{maxHeight: 20},
{cols: [{maxWidth: 15}, {view: 'label', label: msg_moneda}, {}]},
{maxHeight: 20},
{cols: [{maxWidth: 15}, grid_admin_monedas, {}]},
{}]
2017-11-03 22:23:15 -06:00
2017-11-11 20:21:00 -06:00
var msg_bancos = 'Activa los bancos que uses.'
var sat_bancos = [
{maxHeight: 20},
{cols: [{maxWidth: 15}, {view: 'label', label: msg_bancos}, {}]},
{maxHeight: 20},
2017-11-11 20:23:06 -06:00
{cols: [{maxWidth: 15}, grid_admin_bancos, {}]},
{maxHeight: 20},
2017-11-11 20:21:00 -06:00
]
2017-11-03 22:23:15 -06:00
var tab_sat = {
view: 'tabview',
id: 'tab_sat',
multiview: true,
tabbar: {options: [
'Impuestos',
2017-11-06 22:59:39 -06:00
'Monedas',
2017-11-11 20:21:00 -06:00
'Bancos',
'Unidades'
]},
2017-11-03 22:23:15 -06:00
animate: true,
cells: [
{id: 'Impuestos', rows: sat_impuestos},
2017-11-06 22:59:39 -06:00
{id: 'Monedas', rows: sat_monedas},
2017-11-11 20:21:00 -06:00
{id: 'Bancos', rows: sat_bancos},
2017-11-03 22:23:15 -06:00
{id: 'Unidades', rows: [{}]},
]
}
2017-10-07 00:16:58 -05:00
var app_emisor = {
id: 'app_emisor',
rows:[
{view: 'template', id: 'th_emisor', type: 'header',
template: 'Emisor'},
form_emisor,
{maxHeight: 20},
{margin: 10, cols: [{},
{view: 'button', id: 'cmd_save_emisor', label: 'Guardar' ,
type: 'form', autowidth: true, align: 'center'},
{}]
},
{},
]
}
var app_folios = {
id: 'app_folios',
rows:[
{view: 'template', id: 'th_folios', type: 'header',
template: 'Folios'},
form_folios,
{},
]
}
2017-09-21 23:24:18 -05:00
2017-10-16 00:02:51 -05:00
var app_correo = {
id: 'app_correo',
rows:[
{view: 'template', id: 'th_correo', type: 'header',
template: 'Configuración de correo'},
form_correo,
{},
]
}
2017-11-03 20:05:19 -06:00
var app_sat = {
id: 'app_sat',
rows:[
{view: 'template', id: 'th_sat', type: 'header',
template: 'Catálogos del SAT'},
2017-11-03 22:23:15 -06:00
tab_sat,
2017-11-03 20:05:19 -06:00
]
}
var app_options = {
id: 'app_options',
rows:[
{view: 'template', id: 'th_options', type: 'header',
template: 'Opciones'},
tab_options,
]
}
2017-10-07 23:52:11 -05:00
var multi_admin = {
id: 'multi_admin',
2017-09-21 23:24:18 -05:00
animate: true,
cells:[
{
2017-10-07 23:52:11 -05:00
id: 'app_admin_home',
2017-09-21 23:24:18 -05:00
view: 'template',
2017-11-03 20:05:19 -06:00
template: 'Admin Inicio'
2017-10-07 00:16:58 -05:00
},
app_emisor,
app_folios,
2017-10-16 00:02:51 -05:00
app_correo,
2017-11-03 20:05:19 -06:00
app_sat,
app_options,
2017-09-21 23:24:18 -05:00
]
2017-10-07 00:16:58 -05:00
}
2017-09-21 23:24:18 -05:00
var menu_user = {
view: 'menu',
id: 'menu_user',
width: 150,
autowidth: true,
data: [
{id: '0', value: 'User...', submenu:[{id:1, value:'Cerrar Sesión'}]},
],
type: {
subsign: true,
2017-11-06 22:59:39 -06:00
}
2017-11-03 14:09:34 -06:00
}
2017-09-21 23:24:18 -05:00
var ui_admin = {
rows: [
{view: 'toolbar', padding: 3, elements: [
{view: 'button', type: 'icon', icon: 'bars',
width: 37, align: 'left', css: 'app_button', click: function(){
2017-11-03 20:05:19 -06:00
//~ $$('$sidebar1').toggle()
$$('sidebar_admin').toggle()
2017-09-21 23:24:18 -05:00
}
},
{view: 'label', label: 'Empresa Libre - Configuración'},
{},
{view: 'button', type: 'icon', width: 40, css: 'app_button',
icon: 'home', click: 'cmd_home_click'},
menu_user
]},
{
cols:[
2017-11-03 20:05:19 -06:00
sidebar_admin,
2017-10-07 23:52:11 -05:00
multi_admin,
2017-09-21 23:24:18 -05:00
]
}
]
};
2017-11-03 14:09:34 -06:00
var body_win_emisor_logo = [
{view: 'uploader', id: 'up_emisor_logo', autosend: true, link: 'lst_logo',
value: 'Seleccionar logotipo', upload: '/files/emisorlogo', width: 200,
accept: "image/png, image/gif, image/jpeg"},
{view: 'list', id: 'lst_logo', name: 'logo',
type: 'uploader', autoheight:true, borderless: true},
{},
{cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
click:("$$('win_emisor_logo').close();")}, {}]}
]
2017-11-03 22:23:15 -06:00