2017-06-27 15:43:02 -05:00
|
|
|
|
|
|
|
|
2017-06-27 17:07:22 -05:00
|
|
|
webix.ui.datafilter.rowCount = webix.extend({
|
|
|
|
refresh:function(master, node, value){
|
|
|
|
node.firstChild.innerHTML = master.count();
|
|
|
|
}
|
|
|
|
}, webix.ui.datafilter.summColumn)
|
|
|
|
|
|
|
|
|
2017-06-27 15:43:02 -05:00
|
|
|
function validate_rfc(value){
|
|
|
|
rfc = value.trim().toUpperCase();
|
|
|
|
if ( rfc == ""){
|
|
|
|
webix.message({ type:"error", text:"El RFC no puede estar vacío" });
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2017-10-02 00:12:22 -05:00
|
|
|
var tipo_persona = $$('tipo_persona').getValue()
|
|
|
|
var length = 13
|
|
|
|
var start = 4
|
|
|
|
if(tipo_persona==2){
|
|
|
|
length = 12
|
|
|
|
start = 2
|
|
|
|
}
|
|
|
|
if (rfc.length != length){
|
2017-06-27 15:43:02 -05:00
|
|
|
webix.message({ type:"error", text:"Longitud incorrecta del RFC" });
|
|
|
|
return false
|
|
|
|
}
|
2017-10-02 00:12:22 -05:00
|
|
|
if (tipo_persona < 3 && (rfc == RFC_PUBLICO || rfc == RFC_EXTRANJERO)){
|
|
|
|
webix.message({ type:"error", text:"RFC incorrecto" });
|
|
|
|
return false
|
2017-06-27 15:43:02 -05:00
|
|
|
}
|
2017-10-02 00:12:22 -05:00
|
|
|
|
2017-06-27 15:43:02 -05:00
|
|
|
var part = rfc.slice(0, start);
|
|
|
|
var re = new RegExp('[a-z&Ñ]{' + start + '}', 'i');
|
|
|
|
if (!part.match(re)){
|
|
|
|
webix.message({ type:"error", text: "El RFC tiene caractéres inválidos al inicio" });
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
part = rfc.slice(-3);
|
|
|
|
re = new RegExp('[a-z0-9]{3}', 'i');
|
|
|
|
if (!part.match(re)){
|
|
|
|
webix.message({ type:"error", text: "El RFC tiene caractéres inválidos al final" });
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
part = rfc.slice(-9, -3);
|
|
|
|
re = new RegExp('[0-9]{6}', 'i');
|
|
|
|
if (!part.match(re)){
|
|
|
|
webix.message({ type:"error", text: "Fecha inválida" });
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
var month = parseInt(part.slice(-4, -2))
|
|
|
|
if (month == 0 || month > 12 ){
|
|
|
|
webix.message({ type:"error", text: "Fecha inválida" });
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
var day = parseInt(part.slice(-2))
|
|
|
|
if (day == 0 || day > 31 ){
|
|
|
|
webix.message({ type:"error", text: "Fecha inválida" });
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
2017-10-02 22:21:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function validate_email(email){
|
|
|
|
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
|
|
return re.test(email)
|
|
|
|
}
|