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

319 lines
9.8 KiB
JavaScript

var menu_data = [
{id: 'app_home', icon: 'dashboard', value: 'Inicio'},
{id: 'app_emisor', icon: 'user-circle', value: 'Emisor'},
{id: 'app_folios', icon: 'sort-numeric-asc', value: 'Folios'},
]
var sidebar = {
view: 'sidebar',
data: menu_data,
ready: function(){
this.select('app_home');
this.open(this.getParentId('app_home'));
},
on:{
onAfterSelect: function(id){
$$('multi_admin').setValue(id)
}
}
}
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,
label: 'C.P.: ', required: true, attributes: {maxlength: 5},
invalidMessage: 'El C.P. es requerido'},
{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',
name: 'lst_emisor_regimen', width: 600, height: 125, required: true,
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'},
{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'},
{view: 'button', id: 'cmd_niveles', label: 'Niveles Escolares',
type: 'form', align: 'center', autowidth: true, disabled: true},
{}, {}]},
{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',
label: 'Fecha de Autorización: ', disabled: true, format: '%d-%M-%Y',
placeholder: 'Fecha de autorización en el SAT'}, {}]},
{cols: [{view: 'datepicker', id: 'ong_fecha_dof', name: 'ong_fecha_dof',
label: 'Fecha de DOF: ', disabled: true, format: '%d-%M-%Y',
placeholder: 'Fecha de publicación en el DOF'}, {}]},
]
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: [{},
{view: 'uploader', id: 'up_cert', autosend: false, link: 'lst_cert',
value: 'Seleccionar certificado', upload: '/values/files'}, {}]},
{cols: [{},
{view: 'list', id: 'lst_cert', name: 'certificado',
type: 'uploader', autoheight:true, borderless: true}, {}]},
{cols: [{},
{view: 'text', id: 'txt_contra', name: 'contra',
label: 'Contraseña KEY', labelPosition: 'top',
labelAlign: 'center', type: 'password', required: true}, {}]},
{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},
{id: 'default', header: 'Predeterminado', fillspace: 1}
]
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,
required: true, label: 'Inicio: ', step: 5, min: 1},
{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
]
var controls_folios = [
{
view: 'tabview',
id: 'tab_folios',
tabbar: {options: ['Folios']},
animate: true,
cells: [
{id: 'Folios', rows: emisor_folios},
{},
]
}
]
var form_folios = {
type: 'space',
cols: [{
view: 'form',
id: 'form_folios',
complexData: true,
elements: controls_folios,
elementsConfig: {
labelWidth: 100,
labelAlign: 'right'
},
autoheight: true,
rules: {
serie: function(value){return value.trim() != ''},
}
}]
}
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,
{},
]
}
var multi_admin = {
id: 'multi_admin',
animate: true,
cells:[
{
id: 'app_admin_home',
view: 'template',
template: 'HOME'
},
app_emisor,
app_folios,
]
}
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,
},
};
var ui_admin = {
rows: [
{view: 'toolbar', padding: 3, elements: [
{view: 'button', type: 'icon', icon: 'bars',
width: 37, align: 'left', css: 'app_button', click: function(){
$$('$sidebar1').toggle()
}
},
{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:[
sidebar,
multi_admin,
]
}
]
};