first commit

This commit is contained in:
2024-11-11 15:28:20 +01:00
commit 3f5649dbc7
6231 changed files with 999089 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
/* eslint-disable func-names */
/* Validator pesel */
jQuery.validator.addMethod(
"pesel",
function(value, element) {
const reg = /^[0-9]{11}$/;
let sum;
if (reg.test(value) === false) {
return this.optional(element) || false;
}
const dig = `${value}`.split("");
sum =
(1 * parseInt(dig[0], 10) +
3 * parseInt(dig[1], 10) +
7 * parseInt(dig[2], 10) +
9 * parseInt(dig[3], 10) +
1 * parseInt(dig[4], 10) +
3 * parseInt(dig[5], 10) +
7 * parseInt(dig[6], 10) +
9 * parseInt(dig[7], 10) +
1 * parseInt(dig[8], 10) +
3 * parseInt(dig[9], 10)) %
10;
if (sum === 0) {
sum = 10;
}
const day = parseInt(`${dig[4]}${dig[5]}`, 10);
if (day < 1 || day > 31) {
return this.optional(element) || false;
}
sum = 10 - sum;
return this.optional(element) || parseInt(dig[10], 10) === sum;
},
"Proszę wpisać poprawny numer PESEL"
);
/* Pesel validator */
jQuery.validator.addClassRules("js-validation-pesel", {
pesel: true,
});