$(document).ready(function() {
// ---------------------- impostazioni dell'elenco Corsisti e Parametri
var dataTable = $("#
Warning: Undefined array key "dt_nomegrid" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 9
").DataTable( {
"processing": true,
"serverSide": true,
"oLanguage": {
"sLengthMenu": "Visualizza _MENU_ elementi",
"sInfo": "Vista da _START_ a _END_ di _TOTAL_ elementi",
"sInfoFiltered": "(filtrati da _MAX_ elementi totali)",
"sInfoEmpty": "Vista da 0 a 0 di 0 elementi",
"sZeroRecords": "La ricerca non ha portato alcun risultato.",
"oPaginate": {
"sFirst": "Inizio",
"sPrevious": "Precedente",
"sNext": "Successivo",
"sLast": "Fine"
}
},
"aoColumnDefs": [
{
"aTargets": [ 0 ], // Column to target
"mRender": function ( data, type, full ) {
// 'full' is the row's data object, and 'data' is this column's data
// e.g. 'full[0]' is the comic id, and 'data' is the comic title
return '/web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 31
?azione=modifica&id_record=' + full[0] + '">';
}
}
],
"iDisplayStart":
Warning: Undefined array key "dt_start" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 37
,
"aoSearchCols": [
null,
{ "sSearch": "
Warning: Undefined array key "dt_cerca" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 42
Warning: Trying to access array offset on null in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 42
" },
{ "sSearch": "
Warning: Undefined array key "dt_cerca" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 43
Warning: Trying to access array offset on null in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 43
" },
{ "sSearch": "
Warning: Undefined array key "dt_cerca" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 44
Warning: Trying to access array offset on null in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 44
" },
{ "sSearch": "
Warning: Undefined array key "dt_cerca" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 45
Warning: Trying to access array offset on null in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 45
" },
{ "sSearch": "
Warning: Undefined array key "dt_cerca" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 46
Warning: Trying to access array offset on null in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 46
" },
{ "sSearch": "
Warning: Undefined array key "dt_cerca" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 47
Warning: Trying to access array offset on null in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 47
" }
],
"order": [
Warning: Undefined array key "dt_ordco" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 50
, '
Warning: Undefined array key "dt_orddi" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 50
' ],
"pageLength":
Warning: Undefined array key "dt_lungh" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 52
,
"ajax":{
url :"
Warning: Undefined array key "dt_datasource" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 55
", // json datasource
type: "post", // method , by default get
error: function(){ // error handling
$(".grid-error").html("");
$("#
Warning: Undefined array key "dt_nomegrid" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 59
").append('
Nessun dato trovato |
');
//$("#clienti-grid_processing").css("display","none");
}
}
} );
$("#
Warning: Undefined array key "dt_nomegrid" in /web/htdocs/www.utecinisellobalsamo.it/home/segreteria/lib/js/functionsjs.php on line 67
_filter").css("display","none"); // hiding global search box
$('.search-input-text').on( 'keyup click', function () { // for text boxes
var i =$(this).attr('data-column'); // getting column index
var v =$(this).val(); // getting search input value
dataTable.columns(i).search(v).draw();
} );
} );
function controllaCodFis() {
const MESI = ['A', 'B', 'C', 'D', 'E', 'H', 'L', 'M', 'P', 'R', 'S', 'T'];
const DISPARI = { 0: 1, 1: 0, 2: 5, 3: 7, 4: 9, 5: 13, 6: 15, 7: 17, 8: 19, 9: 21, A: 1, B: 0, C: 5, D: 7, E: 9, F: 13, G: 15, H: 17, I: 19, J: 21, K: 2, L: 4, M: 18, N: 20, O: 11, P: 3, Q: 6, R: 8, S: 12, T: 14, U: 16, V: 10, W: 22, X: 25, Y: 24, Z: 23};
const PARI = { 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, A: 0, B: 1, C: 2, D: 3, E: 4, F: 5, G: 6, H: 7, I: 8, J: 9, K: 10, L: 11, M: 12, N: 13, O: 14, P: 15, Q: 16, R: 17, S: 18, T: 19, U: 20, V: 21, W: 22, X: 23, Y: 24, Z: 25};
const CHECK_CODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var errore = '';
var cf=document.getElementById("codfis").value;
// bypassa controlli
if( cf[0] == '?' ) {
return errore;
}
var cfm = cf.toUpperCase(); // maiuscolo
// controllo formale dei 16 caratteri
if( cfm.length != 16 ) {
errore += "codfis: lunghezza errata ";
}
if( ! /^[A-Z]{6}[0-9LMNPQRSTUV]{2}[ABCDEHLMPRST]{1}[0-9LMNPQRSTUV]{2}[A-Z]{1}[0-9LMNPQRSTUV]{3}[A-Z]{1}$/.test(cfm) ) {
errore += "codfis: caratteri errati ";
}
// estrae la data e il sesso
var aa = cfm.substr(6, 2);
var aaaa = parseInt('19'+aa, 10);
var mese = cfm.substr(8, 1);
var mm = MESI.indexOf(mese);
var giorno = cfm.substr(9, 2);
var gg = parseInt(giorno, 10);
if (giorno > 31) {
gg = giorno - 40;
}
var datanas=new Date(aaaa, mm, gg);
if (datanas.getFullYear()==aaaa &&
datanas.getMonth()==mm &&
datanas.getDate()==gg){
document.getElementById("annonascita").value = aaaa;
document.getElementById("mesenascita").value = mm+1;
document.getElementById("giornonascita").value = gg;
if (giorno > 31) {
document.getElementById("sesso").value = 'F';
}else{
document.getElementById("sesso").value = 'M';
}
} else {
errore += "codfis: Data errata ";
}
// controlla il check digit
var valcf = 0;
var c;
for (let i = 0; i < 15; i = i + 1) {
c = cfm[i];
valcf += i % 2 !== 0 ? PARI[c] : DISPARI[c];
}
valcf = valcf % 26;
if ( cfm[15] != CHECK_CODE.charAt(valcf) ) {
errore += "codfis: Check errato";
}
document.getElementById("codfis").value=cfm;
return errore;
}
function controllaCodFiscale() {
var errore = controllaCodFis();
if (errore != '') {
alert (errore);
}
}
function controllaDatiCorsisti() {
var errore = '';
var match = true;
var x = document.getElementById("email");
if (x.value != "")
{
// var match = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/.test(document.getElementById(id).value); sostituito 12/10/2017
var match = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(x.value);
if (match == true)
{
ckEm = x.value
if ((ckEm.indexOf('@') < 0) || ((ckEm.charAt(ckEm.length-4) != '.') && (ckEm.charAt(ckEm.length-3) != '.')))
match = false;
}
}
if (match == false)
{errore += " Email errata";}
// controlla che i 3 campi inputati siano una data valida
var anno=document.getElementById("annonascita").value;
var mese=document.getElementById("mesenascita").value;
var giorno=document.getElementById("giornonascita").value;
var data=new Date(anno, mese-1, giorno);
if (data.getFullYear()==anno &&
data.getMonth()+1==mese &&
data.getDate()==giorno){
//return true;
} else {
errore += " Data errata";
//return false;
}
var err = controllaCodFis();
if (err != '') {
errore += err;
}
if (errore == '') {
return true;
}else{
alert (errore);
return false;
}
}
// funzioni per autocompletamento nei corsisti di citta
var arr = new Array();
arr[arr.length] = "bresso";
arr[arr.length] = "cinisello balsamo";
arr[arr.length] = "cusano milanino";
arr[arr.length] = "milano";
arr[arr.length] = "monza";
arr[arr.length] = "muggio'";
arr[arr.length] = "sesto san giovanni";
var arr1 = new Array();
arr1[arr1.length] = "20091";
arr1[arr1.length] = "20092";
arr1[arr1.length] = "20095";
arr1[arr1.length] = "20100";
arr1[arr1.length] = "20052";
arr1[arr1.length] = "20053";
arr1[arr1.length] = "20099";
var arr2 = new Array();
arr2[arr2.length] = "MI";
arr2[arr2.length] = "MI";
arr2[arr2.length] = "MI";
arr2[arr2.length] = "MI";
arr2[arr2.length] = "MB";
arr2[arr2.length] = "MB";
arr2[arr2.length] = "MI";
function AutoRiempimento(objCampo){
var stringa = objCampo.value;
if (stringa.length > 0){
var selectionStart=stringa.length;
for (i=0; i= a.getTime()) {
errore += " Date incoerenti";
}
// controlla che l'orario inputato sia valido (nn[,nn]-nn[,nn])
var orario=document.getElementById("oralez").value;
var match = /^([0-9,]{2,5})-([0-9,]{2,5})$/.test(orario);
//alert(orario);
if (match == true) {
var daa = orario.split("-");
var dalle = daa[0];
var alle = daa[1];
if (dalle.indexOf(",") > 0) {
match = /^(0?\d|(1\d|2[0-3])){1,2},([0-5]\d)$/.test(dalle);
}else{
match = /^(0?\d|(1\d|2[0-3])){1,2}$/.test(dalle);
}
if (match == true ) {
if (alle.indexOf(",") > 0) {
match = /^(0?\d|(1\d|2[0-3])){1,2},([0-5]\d)$/.test(alle);
}else{
match = /^(0?\d|(1\d|2[0-3])){1,2}$/.test(alle);
}
}
if (match == true ) {
var oramin = dalle.split(",");
var orada = Number(oramin[0]);
oramin = alle.split(",");
var oraa = Number(oramin[0]);
if (orada > oraa) {
match = false;
}
}
}
if (match == false)
{errore += " Orario errato";}
if (errore == '') {
return true;
}else{
alert (errore);
return false;
}
}