|
|
|
@ -551,6 +551,25 @@ |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="form-row mb-4"> |
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
<label for="docs"> |
|
|
|
Document<span class="req">*</span> |
|
|
|
</label> |
|
|
|
|
|
|
|
<select class="form-control" id="docs"> |
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
<span class="text-danger" id="docsError"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- Dynamic fields --> |
|
|
|
<div class="form-row" id="documentFields"></div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
<!-- Individual Form --> |
|
|
|
|
|
|
|
@ -643,7 +662,7 @@ |
|
|
|
<div class="form-row mb-4"> |
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
<label for="cmpPoc">Name<span class="req">*</span></label> |
|
|
|
<input type="text" class="form-control" id="cmpPoc"> |
|
|
|
<input type="text" class="form-control" id="cmpPoc" placeholder="Enter Person Name..."> |
|
|
|
<span class="text-danger" id="cmpPocError"></span> |
|
|
|
</div> |
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
@ -663,7 +682,7 @@ |
|
|
|
|
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
<label for="cmdPom">Phone No<span class="req">*</span></label> |
|
|
|
<input type="number" class="form-control" id="cmdPom" placeholder="Enter Mobile No..."> |
|
|
|
<input type="text" class="form-control" id="cmdPom" placeholder="Enter Mobile No..."> |
|
|
|
<span class="text-danger" id="cmdPomError"></span> |
|
|
|
</div> |
|
|
|
|
|
|
|
@ -708,7 +727,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
<label for="ngoOrgEmail">Company Email ID</label> |
|
|
|
<label for="ngoOrgEmail">Organization Email ID</label> |
|
|
|
<input type="text" class="form-control" id="ngoOrgEmail" placeholder="Enter Email ID"> |
|
|
|
|
|
|
|
</div> |
|
|
|
@ -781,7 +800,7 @@ |
|
|
|
<div class="form-row mb-4"> |
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
<label for="oPoc">Name<span class="req">*</span></label> |
|
|
|
<input type="text" class="form-control" id="oPoc" placeholder="Person Name"> |
|
|
|
<input type="text" class="form-control" id="oPoc" placeholder="Enter Person Name"> |
|
|
|
<span class="text-danger" id="oPocError"></span> |
|
|
|
</div> |
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
@ -800,7 +819,7 @@ |
|
|
|
|
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
<label for="oPom">Phone No<span class="req">*</span></label> |
|
|
|
<input type="number" class="form-control" id="oPom" placeholder="Enter Phone No..."> |
|
|
|
<input type="text" class="form-control" id="oPom" placeholder="Enter Phone No..."> |
|
|
|
<span class="text-danger" id="oPomError"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@ -830,6 +849,40 @@ |
|
|
|
|
|
|
|
<!-- NGO Form --> |
|
|
|
|
|
|
|
<div class="form-row"> |
|
|
|
|
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
<label for="expertise">Area of Expertise<span class="req">*</span></label> |
|
|
|
<select class="form-control" id="expertise"> |
|
|
|
</select> |
|
|
|
<span class="text-danger" id="expertiseError"></span> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- Dynamic Other Expertise field --> |
|
|
|
<div class="col-lg-12 col-md-12 mb-3" id="otherExpertiseContainer" style="display:none;"> |
|
|
|
<label for="otherExpertise"> |
|
|
|
Mention Other Expertise<span class="req">*</span> |
|
|
|
</label> |
|
|
|
|
|
|
|
<input type="text" |
|
|
|
class="form-control" |
|
|
|
id="other_expertise" |
|
|
|
placeholder="Enter Other Expertise..." |
|
|
|
autocomplete="off"> |
|
|
|
|
|
|
|
<span class="text-danger" id="otherExpertiseError"></span> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
<label for="ephno">Emergency Phone No<span class="req">*</span></label> |
|
|
|
<input type="text" class="form-control" id="ephno" placeholder="Enter Emergency Phone No..." maxlength="10" inputmode="numeric" autocomplete="off" required="required"> |
|
|
|
<span class="text-danger" id="ephnoError"></span> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- Preferred area of work checkboxes --> |
|
|
|
<h5>Preferred area of work<span class="req">*</span></h5> |
|
|
|
@ -1096,7 +1149,71 @@ |
|
|
|
} |
|
|
|
} */ |
|
|
|
|
|
|
|
$("#name").on("input", function () { |
|
|
|
this.value = this.value.replace(/[^a-zA-Z.\s]/g, ''); |
|
|
|
}); |
|
|
|
$("#cmpPoc").on("input", function () { |
|
|
|
this.value = this.value.replace(/[^a-zA-Z.\s]/g, ''); |
|
|
|
}); |
|
|
|
|
|
|
|
$("#oPoc").on("input", function () { |
|
|
|
this.value = this.value.replace(/[^a-zA-Z.\s]/g, ''); |
|
|
|
}); |
|
|
|
|
|
|
|
$("#dob").on("keydown paste drop", function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
}); |
|
|
|
|
|
|
|
$("#pincode").on("input", function () { |
|
|
|
this.value = this.value.replace(/\D/g, '').slice(0, 6); |
|
|
|
}); |
|
|
|
|
|
|
|
$("#ephno").on("input", function () { |
|
|
|
this.value = this.value.replace(/\D/g, '').slice(0, 10); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#mobile").on("input", function () { |
|
|
|
this.value = this.value.replace(/\D/g, '').slice(0, 10); |
|
|
|
}); |
|
|
|
|
|
|
|
$("#cmdPom").on("input", function () { |
|
|
|
this.value = this.value.replace(/\D/g, '').slice(0, 10); |
|
|
|
}); |
|
|
|
|
|
|
|
$("#oPom").on("input", function () { |
|
|
|
this.value = this.value.replace(/\D/g, '').slice(0, 10); |
|
|
|
}); |
|
|
|
|
|
|
|
$("#expertise").on("change", function () { |
|
|
|
|
|
|
|
var selectedOption = $(this).find("option:selected"); |
|
|
|
|
|
|
|
var selectedId = selectedOption.val(); |
|
|
|
var expertiseArea = selectedOption.attr("data-category") || ""; |
|
|
|
|
|
|
|
// Check ID = 7 OR expertise contains "Others" |
|
|
|
var isOtherExpertise = |
|
|
|
selectedId === "7" || |
|
|
|
expertiseArea.toLowerCase().includes("others"); |
|
|
|
|
|
|
|
if (isOtherExpertise) { |
|
|
|
|
|
|
|
$("#otherExpertiseContainer").show(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$("#otherExpertiseContainer").hide(); |
|
|
|
|
|
|
|
// Clear previous value and error |
|
|
|
$("#other_expertise").val(""); |
|
|
|
$("#otherExpertiseError").text(""); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
$(document).ready(function () { |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
url: "/volunteer/api/registration/getAllCategory", |
|
|
|
type: "GET", |
|
|
|
@ -1114,6 +1231,79 @@ |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
url: "/volunteer/api/registration/getAllExpertise", |
|
|
|
type: "GET", |
|
|
|
success: function (expertise) { |
|
|
|
let expertiseDropdown = $('#expertise'); |
|
|
|
expertiseDropdown.empty(); |
|
|
|
expertiseDropdown.append(`<option value="">Select</option>`); |
|
|
|
expertise.forEach(function (exp) { |
|
|
|
|
|
|
|
$('<option>', { |
|
|
|
value: exp.id, |
|
|
|
text: exp.expertise_area |
|
|
|
}).attr('data-category', exp.expertise_area) |
|
|
|
.appendTo(expertiseDropdown); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
$("#docs").on("change", function () { |
|
|
|
|
|
|
|
var selectedOption = $(this).find("option:selected"); |
|
|
|
|
|
|
|
var labelName = selectedOption.attr("data-category") || ""; |
|
|
|
|
|
|
|
var option = $(this).val(); |
|
|
|
var documentFields = $("#documentFields"); |
|
|
|
|
|
|
|
documentFields.empty(); |
|
|
|
$("#docsError").text(""); |
|
|
|
|
|
|
|
if (option === "-1" || option === "") { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var optionName = labelName; |
|
|
|
|
|
|
|
var html = ` |
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
<label for="doc_number"> |
|
|
|
${optionName} Number<span class="req">*</span> |
|
|
|
</label> |
|
|
|
|
|
|
|
<input type="text" |
|
|
|
class="form-control" |
|
|
|
id="doc_number" |
|
|
|
name="doc_number" |
|
|
|
placeholder="Enter ${optionName} Number..." |
|
|
|
autocomplete="off"> |
|
|
|
|
|
|
|
<span class="text-danger" id="docNumberError"></span> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="col-lg-12 col-md-12 mb-3"> |
|
|
|
<label for="doc_url"> |
|
|
|
${optionName} image (less than 20 MB - jpg/jpeg/pdf)<span class="req">*</span> |
|
|
|
</label> |
|
|
|
|
|
|
|
<input type="file" |
|
|
|
class="form-control" |
|
|
|
id="doc_url" |
|
|
|
name="doc_url" |
|
|
|
accept=".pdf,.jpg,.jpeg"> |
|
|
|
|
|
|
|
<span class="text-danger" id="docFileError"></span> |
|
|
|
</div> |
|
|
|
`; |
|
|
|
|
|
|
|
documentFields.html(html); |
|
|
|
}); |
|
|
|
|
|
|
|
function handleCategoryChange() { |
|
|
|
@ -1138,6 +1328,27 @@ |
|
|
|
$('.ngo-form').show(); |
|
|
|
} */ |
|
|
|
if (selectedText === "1") { |
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
url: "/volunteer/api/registration/getAllVolunteerDocs", |
|
|
|
type: "GET", |
|
|
|
success: function (docsvalues) { |
|
|
|
let docsDropdown = $('#docs'); |
|
|
|
docsDropdown.empty(); |
|
|
|
docsDropdown.append(`<option value="">Select</option>`); |
|
|
|
docsvalues.forEach(function (docs) { |
|
|
|
|
|
|
|
$('<option>', { |
|
|
|
value: docs.id, |
|
|
|
text: docs.name |
|
|
|
}).attr('data-category', docs.name) |
|
|
|
.appendTo(docsDropdown); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('.individual-form').show(); |
|
|
|
} else if (selectedText === "2") { |
|
|
|
$('.corporate-form').show(); |
|
|
|
@ -1215,6 +1426,65 @@ |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
var ephno = $.trim($("#ephno").val()); |
|
|
|
//console.log("ephno===="+ephno); |
|
|
|
|
|
|
|
if (ephno === "") { |
|
|
|
|
|
|
|
$("#ephnoError").text("Please Enter Emergency Phone No"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} else if (!/^\d{10}$/.test(ephno)) { |
|
|
|
|
|
|
|
$("#ephnoError").text("Phone Number must contain exactly 10 digits"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} else if (!/^[6-9]/.test(ephno)) { |
|
|
|
|
|
|
|
$("#ephnoError").text("Phone Number should start with 6, 7, 8 or 9"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
}else if (/^(\d)\1{9}$/.test(ephno)) { |
|
|
|
|
|
|
|
$("#ephnoError").text("Phone Number cannot contain the same digit repeatedly"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} else if ( |
|
|
|
ephno === "1234567890" || |
|
|
|
ephno === "0123456789" || |
|
|
|
ephno === "9876543210" || |
|
|
|
ephno === "0987654321" |
|
|
|
) { |
|
|
|
|
|
|
|
$("#ephnoError").text("Please enter a valid Phone No"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
var selectedEOption = $("#expertise option:selected"); |
|
|
|
|
|
|
|
var expertisevalue = $.trim(selectedEOption.val()); |
|
|
|
var expertiseArea = $.trim(selectedEOption.attr("data-category") || ""); |
|
|
|
|
|
|
|
if (expertisevalue === "" || expertisevalue === "-1") { |
|
|
|
|
|
|
|
$("#expertiseError").text("Please Select Area of Expertise"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} else if ( |
|
|
|
expertisevalue === "7" || |
|
|
|
expertiseArea.toLowerCase().includes("others") |
|
|
|
) { |
|
|
|
|
|
|
|
var otherExpertise = $.trim($("#other_expertise").val()); |
|
|
|
|
|
|
|
if (otherExpertise === "") { |
|
|
|
|
|
|
|
$("#otherExpertiseError").text("Please Mention Other Expertise"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (selectedTextcategory === "1") { |
|
|
|
|
|
|
|
var name = document.getElementById("name").value = document.getElementById("name").value.trim(); |
|
|
|
@ -1246,6 +1516,12 @@ |
|
|
|
$("#dobError").text("Please enter a Date of birth"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if(email!=""){ |
|
|
|
if (!emailPattern.test(email)) { |
|
|
|
$("#emailError").text("Please enter a valid Email ID"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!genderSelected) { |
|
|
|
$("#genderError").text("Please Select Gender !"); |
|
|
|
isValid = false; |
|
|
|
@ -1264,6 +1540,31 @@ |
|
|
|
$("#mobileError").text("Please enter a valid 10-digit mobile number"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if (!/^\d{10}$/.test(mobile)) { |
|
|
|
|
|
|
|
$("#mobileError").text("Mobile Number must contain exactly 10 digits"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} if (!/^[6-9]/.test(mobile)) { |
|
|
|
|
|
|
|
$("#mobileError").text("Mobile Number should start with 6, 7, 8 or 9"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} if (/^(\d)\1{9}$/.test(mobile)) { |
|
|
|
|
|
|
|
$("#mobileError").text("Mobile Number cannot contain the same digit repeatedly"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} if ( |
|
|
|
mobile === "1234567890" || |
|
|
|
mobile === "0123456789" || |
|
|
|
mobile === "9876543210" || |
|
|
|
mobile === "0987654321" |
|
|
|
) { |
|
|
|
|
|
|
|
$("#mobileError").text("Please enter a valid Mobile Number"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if (address == undefined || address == "") { |
|
|
|
$("#addressError").text("Please Enter address !"); |
|
|
|
isValid = false; |
|
|
|
@ -1298,6 +1599,101 @@ |
|
|
|
isValid = false; |
|
|
|
}*/ |
|
|
|
|
|
|
|
var docs = $.trim($("#docs").val()); |
|
|
|
|
|
|
|
if (docs === "" || docs === "-1") { |
|
|
|
|
|
|
|
$("#docsError").text("Please Select Document"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// Get selected document name |
|
|
|
var selectedOption = $("#docs option:selected"); |
|
|
|
var documentName = $.trim(selectedOption.attr("data-category") || ""); |
|
|
|
|
|
|
|
// ----------------------------- |
|
|
|
// Document Number Validation |
|
|
|
// ----------------------------- |
|
|
|
var docNumber = $.trim($("#doc_number").val()); |
|
|
|
|
|
|
|
if (docNumber === "") { |
|
|
|
|
|
|
|
$("#docNumberError").text("Please Enter " + documentName + " Number"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} if (docs === "1") { |
|
|
|
|
|
|
|
// Aadhar = exactly 12 numeric digits |
|
|
|
if (!/^\d{12}$/.test(docNumber)) { |
|
|
|
|
|
|
|
$("#docNumberError").text( |
|
|
|
"Aadhar Number must contain exactly 12 digits" |
|
|
|
); |
|
|
|
|
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// Other documents = alphanumeric, max 10 characters |
|
|
|
if (!/^[a-zA-Z0-9]{10}$/.test(docNumber)) { |
|
|
|
|
|
|
|
$("#docNumberError").text( |
|
|
|
documentName + " Number must contain 10 characters only (alphabets and numbers)" |
|
|
|
); |
|
|
|
|
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------- |
|
|
|
// Document File Validation |
|
|
|
// ----------------------------- |
|
|
|
var docFileInput = $("#doc_url")[0]; |
|
|
|
|
|
|
|
if (!docFileInput || docFileInput.files.length === 0) { |
|
|
|
|
|
|
|
$("#docFileError").text( |
|
|
|
"Please Upload " + documentName + " image" |
|
|
|
); |
|
|
|
|
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
var docFile = docFileInput.files[0]; |
|
|
|
|
|
|
|
// Maximum 20 MB |
|
|
|
var maxSize = 20 * 1024 * 1024; |
|
|
|
|
|
|
|
if (docFile.size >= maxSize) { |
|
|
|
|
|
|
|
$("#docFileError").text( |
|
|
|
"File size must be less than 20 MB" |
|
|
|
); |
|
|
|
|
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
// File type |
|
|
|
var allowedTypes = [ |
|
|
|
"image/jpeg", |
|
|
|
"application/pdf" |
|
|
|
]; |
|
|
|
|
|
|
|
if (!allowedTypes.includes(docFile.type)) { |
|
|
|
|
|
|
|
$("#docFileError").text( |
|
|
|
"Only JPG, JPEG or PDF files are allowed" |
|
|
|
); |
|
|
|
|
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!preVolSelected) { |
|
|
|
$("#prevolError").text("Please Select Previous Volunteer details !"); |
|
|
|
@ -1307,6 +1703,9 @@ |
|
|
|
$("#ngoAnyError").text("Please Enter Company/NGO details !"); |
|
|
|
isValid = false; |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (i == 0) { |
|
|
|
$("#anyAreaError").text("Please select Preferred Area details !"); |
|
|
|
isValid = false; |
|
|
|
@ -1318,6 +1717,37 @@ |
|
|
|
saveTheIndividualForm(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
else{ |
|
|
|
var firstError = $(".text-danger") |
|
|
|
.filter(function () { |
|
|
|
return $.trim($(this).text()) !== ""; |
|
|
|
}) |
|
|
|
.first(); |
|
|
|
if (firstError.length) { |
|
|
|
|
|
|
|
var target = firstError |
|
|
|
.closest(".mb-3") |
|
|
|
.find("input, select, textarea") |
|
|
|
.first(); |
|
|
|
|
|
|
|
if (target.length) { |
|
|
|
|
|
|
|
$("html, body").animate({ |
|
|
|
scrollTop: target.offset().top - 120 |
|
|
|
}, 600); |
|
|
|
|
|
|
|
// Focus the field |
|
|
|
target.focus(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
// Fallback to error message |
|
|
|
$("html, body").animate({ |
|
|
|
scrollTop: firstError.offset().top - 120 |
|
|
|
}, 600); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
else if (selectedTextcategory === "2") { |
|
|
|
@ -1332,11 +1762,18 @@ |
|
|
|
var cmdPom = document.getElementById("cmdPom").value = document.getElementById("cmdPom").value.trim(); |
|
|
|
var cmpPVolSelect = document.querySelector('input[name="cmpPVol"]:checked'); |
|
|
|
var cmdPoE = document.getElementById("cmdPoE").value = document.getElementById("cmdPoE").value.trim(); |
|
|
|
var cmdPod = $("#cmdPod").val().trim(); |
|
|
|
|
|
|
|
if (cmpName == undefined || cmpName == "") { |
|
|
|
$("#cmpNameError").text("Please Enter Company Name"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if(cmpEmail!=""){ |
|
|
|
if (!emailPattern.test(cmpEmail)) { |
|
|
|
$("#cmpEmailError").text("Please enter a valid Email ID"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (cmpAddress == undefined || cmpAddress == "") { |
|
|
|
$("#cmpAddressError").text("Please Enter Company Address"); |
|
|
|
isValid = false; |
|
|
|
@ -1348,23 +1785,73 @@ |
|
|
|
if (cmpNov == undefined || cmpNov == "") { |
|
|
|
$("#cmpNovError").text("Please Enter No of Volunteer"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if (!/^[1-9]\d*$/.test(cmpNov)) { |
|
|
|
|
|
|
|
$("#cmpNovError").text("Please Enter a valid number of volunteers"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} |
|
|
|
if (cmpPoc == undefined || cmpPoc == "") { |
|
|
|
$("#cmpPocError").text("Please Enter Point of Conduct Name"); |
|
|
|
$("#cmpPocError").text("Please Enter Point of Contact Name"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if (cmdPod == "") { |
|
|
|
$("#cmdPodError").text("Please Enter Point of Contact Designation"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if (cmdPoE === "" || !emailPattern.test(cmdPoE)) { |
|
|
|
$("#cmdPoEError").text("Please enter Point of Conduct a valid Email ID"); |
|
|
|
$("#cmdPoEError").text("Please enter Point of Contact a valid Email ID"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if (cmdPom == undefined || cmdPom == "" || !mobilePattern.test(cmdPom)) { |
|
|
|
$("#cmdPomError").text("Please enter Point of Conduct Valid Mobile No"); |
|
|
|
$("#cmdPomError").text("Please enter Point of Contact Valid Mobile No"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (!/^\d{10}$/.test(cmdPom)) { |
|
|
|
|
|
|
|
$("#cmdPomError").text("Mobile Number must contain exactly 10 digits"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} if (!/^[6-9]/.test(cmdPom)) { |
|
|
|
|
|
|
|
$("#cmdPomError").text("Mobile Number should start with 6, 7, 8 or 9"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} if (/^(\d)\1{9}$/.test(cmdPom)) { |
|
|
|
|
|
|
|
$("#cmdPomError").text("Mobile Number cannot contain the same digit repeatedly"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} if ( |
|
|
|
cmdPom === "1234567890" || |
|
|
|
cmdPom === "0123456789" || |
|
|
|
cmdPom === "9876543210" || |
|
|
|
cmdPom === "0987654321" |
|
|
|
) { |
|
|
|
|
|
|
|
$("#cmdPomError").text("Please enter a valid Mobile Number"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (!cmpPVolSelect) { |
|
|
|
$("#anyAreaError").text("Please Select previous volunteers details"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
var c1mobile = $.trim($("#cmdPom").val()); |
|
|
|
|
|
|
|
if(c1mobile !== "" && ephno !== "" && c1mobile === ephno){ |
|
|
|
Swal.fire({ |
|
|
|
title: "Warning!", |
|
|
|
text: "POC Phone Number and Emergency phone number cannot be same", |
|
|
|
icon: "warning", |
|
|
|
confirmButtonText: "OK" |
|
|
|
}); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (i == 0) { |
|
|
|
alert("Please select Preferred Area details !"); |
|
|
|
isValid = false; |
|
|
|
@ -1377,6 +1864,37 @@ |
|
|
|
saveCorporateDetails(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
else{ |
|
|
|
var firstError = $(".text-danger") |
|
|
|
.filter(function () { |
|
|
|
return $.trim($(this).text()) !== ""; |
|
|
|
}) |
|
|
|
.first(); |
|
|
|
if (firstError.length) { |
|
|
|
|
|
|
|
var target = firstError |
|
|
|
.closest(".mb-3") |
|
|
|
.find("input, select, textarea") |
|
|
|
.first(); |
|
|
|
|
|
|
|
if (target.length) { |
|
|
|
|
|
|
|
$("html, body").animate({ |
|
|
|
scrollTop: target.offset().top - 120 |
|
|
|
}, 600); |
|
|
|
|
|
|
|
// Focus the field |
|
|
|
target.focus(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
// Fallback to error message |
|
|
|
$("html, body").animate({ |
|
|
|
scrollTop: firstError.offset().top - 120 |
|
|
|
}, 600); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1392,11 +1910,18 @@ |
|
|
|
var cmdPom = document.getElementById("oPom").value = document.getElementById("oPom").value.trim(); |
|
|
|
var cmpPVolSelect = document.querySelector('input[name="oPvolY"]:checked'); |
|
|
|
var oPoE = document.getElementById("oPoE").value = document.getElementById("oPoE").value.trim(); |
|
|
|
var oPod = $("#oPod").val().trim(); |
|
|
|
|
|
|
|
if (cmpName == ""|| cmpName == undefined ) { |
|
|
|
$("#ngoOrgNameError").text("Please Enter Organization Name"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if(ngoOrgEmail!=""){ |
|
|
|
if (!emailPattern.test(ngoOrgEmail)) { |
|
|
|
$("#ngoOrgEmailError").text("Please enter a valid Email ID"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (cmpAddress == undefined || cmpAddress == "") { |
|
|
|
$("#oAddressError").text("Please Enter Organisation Address"); |
|
|
|
isValid = false; |
|
|
|
@ -1409,10 +1934,20 @@ |
|
|
|
$("#oNvolError").text("Please Enter No of Volunteer"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if (!/^[1-9]\d*$/.test(cmpNov)) { |
|
|
|
|
|
|
|
$("#oNvolError").text("Please Enter a valid number of volunteers"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} |
|
|
|
if (cmpPoc == undefined || cmpPoc == "") { |
|
|
|
$("#oPocError").text("Please Enter Point of Conduct Name"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if (oPod == "") { |
|
|
|
$("#oPodError").text("Please Enter Point of Conduct Designation"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
if (oPoE === "" || !emailPattern.test(oPoE)) { |
|
|
|
$("#oPoeError").text("Please enter Point of Conduct valid Email ID"); |
|
|
|
isValid = false; |
|
|
|
@ -1421,10 +1956,50 @@ |
|
|
|
$("#oPomError").text("Please Enter Point of Conduct Mobile No"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (!/^\d{10}$/.test(cmdPom)) { |
|
|
|
|
|
|
|
$("#oPomError").text("Mobile Number must contain exactly 10 digits"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} if (!/^[6-9]/.test(cmdPom)) { |
|
|
|
|
|
|
|
$("#oPomError").text("Mobile Number should start with 6, 7, 8 or 9"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} if (/^(\d)\1{9}$/.test(cmdPom)) { |
|
|
|
|
|
|
|
$("#oPomError").text("Mobile Number cannot contain the same digit repeatedly"); |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
} if ( |
|
|
|
cmdPom === "1234567890" || |
|
|
|
cmdPom === "0123456789" || |
|
|
|
cmdPom === "9876543210" || |
|
|
|
cmdPom === "0987654321" |
|
|
|
) { |
|
|
|
|
|
|
|
$("#oPomError").text("Please enter a valid Mobile Number"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (!cmpPVolSelect) { |
|
|
|
$("#oPvolYError").text("Please Select previous volunteers details"); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
var c2mobile = $.trim($("#oPom").val()); |
|
|
|
|
|
|
|
if(c2mobile !== "" && ephno !== "" && c2mobile === ephno){ |
|
|
|
Swal.fire({ |
|
|
|
title: "Warning!", |
|
|
|
text: "POC Phone Number and Emergency phone number cannot be same", |
|
|
|
icon: "warning", |
|
|
|
confirmButtonText: "OK" |
|
|
|
}); |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (i == 0) { |
|
|
|
alert("Please select Preferred Area details !"); |
|
|
|
isValid = false; |
|
|
|
@ -1434,6 +2009,37 @@ |
|
|
|
saveNGODetails(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
else{ |
|
|
|
var firstError = $(".text-danger") |
|
|
|
.filter(function () { |
|
|
|
return $.trim($(this).text()) !== ""; |
|
|
|
}) |
|
|
|
.first(); |
|
|
|
if (firstError.length) { |
|
|
|
|
|
|
|
var target = firstError |
|
|
|
.closest(".mb-3") |
|
|
|
.find("input, select, textarea") |
|
|
|
.first(); |
|
|
|
|
|
|
|
if (target.length) { |
|
|
|
|
|
|
|
$("html, body").animate({ |
|
|
|
scrollTop: target.offset().top - 120 |
|
|
|
}, 600); |
|
|
|
|
|
|
|
// Focus the field |
|
|
|
target.focus(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
// Fallback to error message |
|
|
|
$("html, body").animate({ |
|
|
|
scrollTop: firstError.offset().top - 120 |
|
|
|
}, 600); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1473,16 +2079,44 @@ |
|
|
|
referBy: $("#ref").val(), |
|
|
|
//aadhar: $("#aadhar").val(), |
|
|
|
//bloodgroup: $("#bloodgroup").val(), |
|
|
|
preferredAreas: preferredAreas |
|
|
|
preferredAreas: preferredAreas, |
|
|
|
expertise_area:$("#expertise").val(), |
|
|
|
other_expertise:$("#other_expertise").val(), |
|
|
|
ephno:$("#ephno").val(), |
|
|
|
doc_type:$.trim($("#docs").val()), |
|
|
|
doc_number:$.trim($("#doc_number").val()), |
|
|
|
}; |
|
|
|
|
|
|
|
// Create FormData |
|
|
|
var formData = new FormData(); |
|
|
|
|
|
|
|
// Add JSON data as Blob |
|
|
|
formData.append( |
|
|
|
"volunteer", |
|
|
|
new Blob( |
|
|
|
[JSON.stringify(volunteerData)], |
|
|
|
{ type: "application/json" } |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
// Add file |
|
|
|
var docFile = $("#doc_url")[0].files[0]; |
|
|
|
|
|
|
|
if (docFile) { |
|
|
|
formData.append("doc_url", docFile); |
|
|
|
} |
|
|
|
|
|
|
|
$('#loader').show(); |
|
|
|
|
|
|
|
// Send AJAX POST request |
|
|
|
$.ajax({ |
|
|
|
type: "POST", |
|
|
|
url: "/volunteer/api/register", |
|
|
|
contentType: "application/json", |
|
|
|
data: JSON.stringify(volunteerData), |
|
|
|
data: formData, |
|
|
|
|
|
|
|
// IMPORTANT |
|
|
|
processData: false, |
|
|
|
contentType: false, |
|
|
|
beforeSend: function() { |
|
|
|
$("#pageLoader").show(); |
|
|
|
}, |
|
|
|
@ -1490,15 +2124,41 @@ |
|
|
|
$('#loader').hide(); |
|
|
|
successPopup(response); |
|
|
|
}, |
|
|
|
error: function (error) { |
|
|
|
alert("Error saving data!"); |
|
|
|
console.log(error); |
|
|
|
error: function (xhr) { |
|
|
|
|
|
|
|
$('#loader').hide(); |
|
|
|
|
|
|
|
console.log("Error status:", xhr.status); |
|
|
|
console.log("Error response:", xhr.responseText); |
|
|
|
|
|
|
|
if (xhr.status === 409) { |
|
|
|
|
|
|
|
var response = xhr.responseJSON; |
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
title: "Warning!", |
|
|
|
text: response && response.message |
|
|
|
? response.message |
|
|
|
: "This mobile number is already registered", |
|
|
|
icon: "warning", |
|
|
|
confirmButtonText: "OK" |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
title: "Error!", |
|
|
|
text: "Unable to save registration. Please try again.", |
|
|
|
icon: "error", |
|
|
|
confirmButtonText: "OK" |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// Allow user to submit again |
|
|
|
$("#submitBtn").prop("disabled", false); |
|
|
|
}, |
|
|
|
complete: function () { |
|
|
|
// Re-enable the submit button after completion (either success or error) |
|
|
|
$("#submitBtn").prop("disabled", true); |
|
|
|
$("#pageLoader").hide(); |
|
|
|
} |
|
|
|
}); |
|
|
|
@ -1527,7 +2187,10 @@ |
|
|
|
cntPerDesign: $("#cmdPod").val(), |
|
|
|
previous_volunteered: $("input[name='cmpPVol']:checked").val(), |
|
|
|
referBy: $("#ref").val(), |
|
|
|
preferredAreas: preferredAreas |
|
|
|
preferredAreas: preferredAreas, |
|
|
|
expertise_area:$("#expertise").val(), |
|
|
|
other_expertise:$("#other_expertise").val(), |
|
|
|
ephno:$("#ephno").val(), |
|
|
|
} |
|
|
|
$('#loader').show(); |
|
|
|
$.ajax({ |
|
|
|
@ -1542,14 +2205,41 @@ |
|
|
|
$('#loader').hide(); |
|
|
|
successPopup(response); |
|
|
|
}, |
|
|
|
error: function (error) { |
|
|
|
alert("Error saving data!"); |
|
|
|
console.log(error); |
|
|
|
error: function (xhr) { |
|
|
|
|
|
|
|
$('#loader').hide(); |
|
|
|
|
|
|
|
console.log("Error status:", xhr.status); |
|
|
|
console.log("Error response:", xhr.responseText); |
|
|
|
|
|
|
|
if (xhr.status === 409) { |
|
|
|
|
|
|
|
var response = xhr.responseJSON; |
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
title: "Warning!", |
|
|
|
text: response && response.message |
|
|
|
? response.message |
|
|
|
: "This mobile number is already registered", |
|
|
|
icon: "warning", |
|
|
|
confirmButtonText: "OK" |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
title: "Error!", |
|
|
|
text: "Unable to save registration. Please try again.", |
|
|
|
icon: "error", |
|
|
|
confirmButtonText: "OK" |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// Allow user to submit again |
|
|
|
$("#submitBtn").prop("disabled", false); |
|
|
|
}, |
|
|
|
complete: function () { |
|
|
|
// Re-enable the submit button after completion (either success or error) |
|
|
|
$("#submitBtn").prop("disabled", true); |
|
|
|
$("#pageLoader").hide(); |
|
|
|
}, |
|
|
|
|
|
|
|
@ -1581,7 +2271,10 @@ |
|
|
|
cntPerDesign: $("#oPod").val(), |
|
|
|
previous_volunteered: $("input[name='oPvolY']:checked").val(), |
|
|
|
referBy: $("#ref").val(), |
|
|
|
preferredAreas: preferredAreas |
|
|
|
preferredAreas: preferredAreas, |
|
|
|
expertise_area:$("#expertise").val(), |
|
|
|
other_expertise:$("#other_expertise").val(), |
|
|
|
ephno:$("#ephno").val(), |
|
|
|
} |
|
|
|
$('#loader').show(); |
|
|
|
|
|
|
|
@ -1597,14 +2290,41 @@ |
|
|
|
$('#loader').hide(); |
|
|
|
successPopup(response); |
|
|
|
}, |
|
|
|
error: function (error) { |
|
|
|
alert("Error saving data!"); |
|
|
|
console.log(error); |
|
|
|
error: function (xhr) { |
|
|
|
|
|
|
|
$('#loader').hide(); |
|
|
|
|
|
|
|
console.log("Error status:", xhr.status); |
|
|
|
console.log("Error response:", xhr.responseText); |
|
|
|
|
|
|
|
if (xhr.status === 409) { |
|
|
|
|
|
|
|
var response = xhr.responseJSON; |
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
title: "Warning!", |
|
|
|
text: response && response.message |
|
|
|
? response.message |
|
|
|
: "This mobile number is already registered", |
|
|
|
icon: "warning", |
|
|
|
confirmButtonText: "OK" |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
title: "Error!", |
|
|
|
text: "Unable to save registration. Please try again.", |
|
|
|
icon: "error", |
|
|
|
confirmButtonText: "OK" |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// Allow user to submit again |
|
|
|
$("#submitBtn").prop("disabled", false); |
|
|
|
}, |
|
|
|
complete: function () { |
|
|
|
// Re-enable the submit button after completion (either success or error) |
|
|
|
$("#submitBtn").prop("disabled", true); |
|
|
|
$("#pageLoader").hide(); |
|
|
|
}, |
|
|
|
}); |
|
|
|
|