@ -201,10 +201,11 @@
< / div >
< / div >
< div class = "container mt-5" >
< div class = "container mt-5" >
< div id = "loader" style = "display: none; text-align: center;" >
< div id = "loader" style = "display: none; text-align: center;" >
< img src = "images/Thin broken ring.gif" alt = "Loading..." / >
< img src = "/ images/Thin broken ring.gif" alt = "Loading..." / >
< / div >
< / div >
< form onsubmit = "return validateForm();" id = "myForm" >
<!-- <form onsubmit="return validateForm();" id="myForm"> -->
< form id = "myForm" >
<!-- Dropdowns for selecting category and subcategory -->
<!-- Dropdowns for selecting category and subcategory -->
@ -220,17 +221,17 @@
< div class = "col-lg-6 col-md-12 mb-3" >
< div class = "col-lg-6 col-md-12 mb-3" >
< label for = "category" > Choose Category< span class = "req" > *< / span > < / label >
< label for = "category" > Choose Category< span class = "req" > *< / span > < / label >
< select class = "form-control" id = "category" onchange = "handleCategoryChange()" >
< select class = "form-control" id = "category" onchange = "handleCategoryChange()" >
< option value = "-1" > Select< / option >
<!-- <option value=" - 1">Select</option >
< option value = "Individual" > Individual< / option >
< option value = "Individual" > Individual< / option >
< option value = "Corporate" > Corporate< / option >
< option value = "Corporate" > Corporate< / option >
< option value = "NGO" > NGO/Other Associations< / option >
< option value = "NGO" > NGO/Other Associations< / option > -->
< / select >
< / select >
< span class = "text-danger" id = "categoryError" > < / span >
< span class = "text-danger" id = "categoryError" > < / span >
< / div >
< / div >
< div class = "col-lg-6 col-md-12 mb-3" >
< div class = "col-lg-6 col-md-12 mb-3" >
< label for = "subcategory" > Choose Sub Category< span class = "req" > *< / span > < / label >
< label for = "subcategory" > Choose Sub Category< span class = "req" > *< / span > < / label >
< select class = "form-control" id = "subcategory" >
< select class = "form-control" id = "subcategory" >
<!-- <option value=" - 1">Select</option> -->
< / select >
< / select >
< span class = "text-danger" id = "subcategoryError" > < / span >
< span class = "text-danger" id = "subcategoryError" > < / span >
< / div >
< / div >
@ -880,7 +881,9 @@
< / div >
< / div >
< center >
< center >
< button type = "submit" class = "btn btn-primary" id = "submitBtn" > Submit< / button >
<!-- <button type="submit" class="btn btn - primary" id="submitBtn">Submit</button> -->
< button type = "button" class = "btn btn-primary" id = "submitBtn" onclick = "validateForm()" > Submit< / button >
< / center >
< / center >
< / div >
< / div >
< / div >
< / div >
@ -895,16 +898,18 @@
onsubmit="return verifyOtp();">
onsubmit="return verifyOtp();">
< div class = "modal-header" >
< div class = "modal-header" >
< h6 class = "modal-title m-0" id = "exampleModalDefaultLabel" > OTP Login< / h6 >
< h6 class = "modal-title m-0" id = "exampleModalDefaultLabel" > OTP Login< / h6 >
< button type = "button" class = "close" data-bs- dismiss = "modal" aria-label = "Close"
< button type = "button" class = "close" data-dismiss = "modal" aria-label = "Close"
style="color:black;border: white;background-color: white;">
style="color:black;border: white;background-color: white;">
< span aria-hidden = "true" > × < / span >
< span aria-hidden = "true" > × < / span >
< / button >
< / button >
< / div >
< / div >
<!-- End modal - header -->
<!-- End modal - header -->
< div class = "modal-body" >
< div class = "modal-body" >
< div class = "row " >
< div class = "row " >
< div class = "mb-3" style = "text-align: center;" >
< div class = "mb-3" style = "text-align: center;" >
< img src = "/volunteer/images /otp.png" width = "50%" alt = "Mobileotp" >
< img src = "https://gccservices.in/gcc/files/c_d /otp.png" width = "50%" alt = "Mobileotp" >
< / div >
< / div >
< / div >
< / div >
<!-- End row -->
<!-- End row -->
@ -942,8 +947,8 @@
< / div >
< / div >
<!-- End modal - body -->
<!-- End modal - body -->
< div class = "modal-footer" >
< div class = "modal-footer" >
< button type = "button" class = "btn btn-secondary" data-bs- dismiss = "modal" > Close< / button >
< button type = "submit" class = "btn btn-primary btn-sm " id = "but" > Verify OTP< / button >
< button type = "button" class = "btn btn-secondary" data-dismiss = "modal" > Close< / button >
< button type = "submit" class = "btn btn-primary" id = "but" > Verify OTP< / button >
< / div >
< / div >
<!-- End modal - footer -->
<!-- End modal - footer -->
< / form >
< / form >
@ -961,7 +966,7 @@
document.querySelector('.individual-form').style.display = 'none';
document.querySelector('.individual-form').style.display = 'none';
document.querySelector('.corporate-form').style.display = 'none';
document.querySelector('.corporate-form').style.display = 'none';
document.querySelector('.ngo-form').style.display = 'none';
document.querySelector('.ngo-form').style.display = 'none';
function handleCategoryChange() {
/* function handleCategoryChange() {
// Get selected category
// Get selected category
var category = document.getElementById("category").value;
var category = document.getElementById("category").value;
@ -994,7 +999,58 @@
document.querySelector('.ngo-form').style.display = 'block';
document.querySelector('.ngo-form').style.display = 'block';
subcategory.innerHTML += `< option value = "N/A" > N/A< / option > `;
subcategory.innerHTML += `< option value = "N/A" > N/A< / option > `;
}
}
} */
$(document).ready(function () {
$.ajax({
url: "/volunteer/api/registration/getAllCategory",
type: "GET",
success: function (categories) {
let categoryDropdown = $('#category');
categoryDropdown.append(`< option value = "-1" > Select< / option > `);
categories.forEach(function (cat) {
categoryDropdown.append(`< option value = "${cat.id}" > ${cat.category}< / option > `);
});
}
});
});
function handleCategoryChange() {
var categoryId = $('#category').val();
// Hide all forms
$('.individual-form, .corporate-form, .ngo-form').hide();
// Clear and reset subcategory dropdown
let subcategory = $('#subcategory');
subcategory.empty().append('< option value = "-1" > Select< / option > ');
// Determine form visibility based on selected category name
let selectedText = $('#category option:selected').text();
if (selectedText === "Individual") {
$('.individual-form').show();
} else if (selectedText === "Corporate") {
$('.corporate-form').show();
} else if (selectedText === "NGO/Other Associations") {
$('.ngo-form').show();
}
// Fetch subcategories
if (categoryId !== "-1") {
$.ajax({
url: "/volunteer/api/registration/getSubCategoryById",
type: "GET",
data: { category_id: categoryId },
success: function (subcategories) {
subcategories.forEach(function (sub) {
subcategory.append(`< option value = "${sub.id}" > ${sub.sub_category}< / option > `);
});
}
}
});
}
}
function uncheckAnyArea() {
function uncheckAnyArea() {
}
}
@ -1010,8 +1066,11 @@
let emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
let emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
let mobilePattern = /^[0-9]{10}$/;
let mobilePattern = /^[0-9]{10}$/;
let pincodePattern = /^[0-9]{6}$/;
let pincodePattern = /^[0-9]{6}$/;
function validateForm() {
function validateForm() {
var isValid = true;
var isValid = true;
$('.text-danger').text('');
$('.text-danger').text('');
var i = 0;
var i = 0;
@ -1020,13 +1079,23 @@
i++;
i++;
};
};
});
});
var category = document.getElementById("category").value;
if (category == undefined || category === "-1") {
var category = document.getElementById("category");
var selectedTextcategory = category.options[category.selectedIndex].text;
//console.log("selectedTextcategory=="+selectedTextcategory);
if (selectedTextcategory === "Select") {
$("#categoryError").text("Please Select Category");
$("#categoryError").text("Please Select Category");
isValid = false;
isValid = false;
}
}
if (category === "Individual") {
var subcategory = document.getElementById("subcategory").value;
var subcategory = document.getElementById("subcategory");
var selectedTextsubcategory = subcategory.options[subcategory.selectedIndex].text;
//console.log("selectedTextsubcategory=="+selectedTextsubcategory);
if (selectedTextsubcategory === "Select") {
$("#subcategoryError").text("Please Select SubCategory !");
isValid = false;
}
if (selectedTextcategory === "Individual") {
var name = document.getElementById("name").value = document.getElementById("name").value.trim();
var name = document.getElementById("name").value = document.getElementById("name").value.trim();
var email = document.getElementById("email").value = document.getElementById("email").value.trim();
var email = document.getElementById("email").value = document.getElementById("email").value.trim();
let genderSelected = document.querySelector('input[name="gender"]:checked');
let genderSelected = document.querySelector('input[name="gender"]:checked');
@ -1044,10 +1113,9 @@
var dob = document.getElementById("dob").value = document.getElementById("dob").value.trim();
var dob = document.getElementById("dob").value = document.getElementById("dob").value.trim();
var aadhar = document.getElementById("aadhar").value = document.getElementById("aadhar").value.trim();
var aadhar = document.getElementById("aadhar").value = document.getElementById("aadhar").value.trim();
var bloodgroup = document.getElementById("bloodgroup").value;
var bloodgroup = document.getElementById("bloodgroup").value;
if (subcategory == -1) {
$("#subcategoryError").text("Please Select SubCategory !");
isValid = false;
}
if (name == undefined || name == "") {
if (name == undefined || name == "") {
$("#nameError").text("Please Enter Name !");
$("#nameError").text("Please Enter Name !");
isValid = false;
isValid = false;
@ -1064,9 +1132,9 @@
// Check if verifiedOTP is disabled only during form submission
// Check if verifiedOTP is disabled only during form submission
if ($('#verifiedOTP').prop('disabled')) {
if ($('#verifiedOTP').prop('disabled')) {
Swal.fire({
Swal.fire({
title: "Error !",
title: "Warning !",
text: "OTP not Verified",
text: "OTP not Verified",
icon: "error ",
icon: "warning ",
confirmButtonText: "OK"
confirmButtonText: "OK"
});
});
isValid = false; // Set isValid to false if verifiedOTP is disabled
isValid = false; // Set isValid to false if verifiedOTP is disabled
@ -1126,14 +1194,12 @@
if (isValid) {
if (isValid) {
$("#submitBtn").prop("disabled", true);
$("#submitBtn").prop("disabled", true);
//document.getElementById("submitBtn").disabled = true;
saveTheIndividualForm();
saveTheIndividualForm();
return false;
}
}
return false;
return false;
}
}
else if (category === "Corporate") {
else if (selectedText category === "Corporate") {
var cmpName = document.getElementById("cmpName").value = document.getElementById("cmpName").value.trim();
var cmpName = document.getElementById("cmpName").value = document.getElementById("cmpName").value.trim();
var cmpEmail = document.getElementById("cmpEmail").value = document.getElementById("cmpEmail").value.trim();
var cmpEmail = document.getElementById("cmpEmail").value = document.getElementById("cmpEmail").value.trim();
var cmpLandline = document.getElementById("cmpLandline").value = document.getElementById("cmpLandline").value.trim();
var cmpLandline = document.getElementById("cmpLandline").value = document.getElementById("cmpLandline").value.trim();
@ -1182,20 +1248,18 @@
alert("Please select Preferred Area details !");
alert("Please select Preferred Area details !");
isValid = false;
isValid = false;
}
}
if (isValid) {
/* if (isValid) {
saveCorporateDetails();
saveCorporateDetails();
}
} */
if (isValid) {
if (isValid) {
// Disable the submit button
$("#submitBtn").prop("disabled", true);
$("#submitBtn").prop("disabled", true);
//$("#submitBtn").prop("disabled", true);
saveCorporateDetails();
saveCorporateDetails();
return false;
}
}
return false;
return false;
}
}
else if (category === "NGO") {
else if (selectedText category === "NGO/Other Associations ") {
var cmpName = document.getElementById("ngoOrgName").value = document.getElementById("ngoOrgName").value.trim();
var cmpName = document.getElementById("ngoOrgName").value = document.getElementById("ngoOrgName").value.trim();
var ngoOrgEmail = document.getElementById("ngoOrgEmail").value = document.getElementById("ngoOrgEmail").value.trim();
var ngoOrgEmail = document.getElementById("ngoOrgEmail").value = document.getElementById("ngoOrgEmail").value.trim();
var cmpLandline = document.getElementById("oLandline").value = document.getElementById("oLandline").value.trim();
var cmpLandline = document.getElementById("oLandline").value = document.getElementById("oLandline").value.trim();
@ -1208,8 +1272,8 @@
var cmpPVolSelect = document.querySelector('input[name="oPvolY"]:checked');
var cmpPVolSelect = document.querySelector('input[name="oPvolY"]:checked');
var oPoE = document.getElementById("oPoE").value = document.getElementById("oPoE").value.trim();
var oPoE = document.getElementById("oPoE").value = document.getElementById("oPoE").value.trim();
if (cmpName == undefined || cmpName == "" ) {
$("#ngoOrgNameError").text("Please Enter Organis ation Name");
if (cmpName == ""|| cmpName == undefined ) {
$("#ngoOrgNameError").text("Please Enter Organiz ation Name");
isValid = false;
isValid = false;
}
}
if (cmpAddress == undefined || cmpAddress == "") {
if (cmpAddress == undefined || cmpAddress == "") {
@ -1245,21 +1309,16 @@
isValid = false;
isValid = false;
}
}
if (isValid) {
if (isValid) {
$("#submitBtn").prop("disabled", true);
saveNGODetails();
saveNGODetails();
return false;
}
}
return false;
return false;
}
}
if (isValid) {
// Disable the submit button
//$("#submitBtn").prop("disabled", true);
$("#submitBtn").prop("disabled", true);
saveNGODetails();
return isValid; // Prevent default form submit in all cases
}
}
return false;
}
function saveTheIndividualForm() {
function saveTheIndividualForm() {
@ -1270,8 +1329,8 @@
// Create JSON object with form data
// Create JSON object with form data
var volunteerData = {
var volunteerData = {
category: $("#category").val (),
subCategory: $("#subcategory").val (),
category: $("#category option:selected").text (),
subCategory: $("#subcategory option:selected").text (),
name: $("#name").val(),
name: $("#name").val(),
email: $("#email").val(),
email: $("#email").val(),
dob: $("#dob").val(),
dob: $("#dob").val(),
@ -1327,8 +1386,8 @@
preferredAreas.push($(this).val());
preferredAreas.push($(this).val());
});
});
var copInfo = {
var copInfo = {
category: $("#category").val (),
subCategory: $("#subcategory").val (),
category: $("#category option:selected").text (),
subCategory: $("#subcategory option:selected").text (),
compName: $("#cmpName").val(),
compName: $("#cmpName").val(),
compEmail: $("#cmpEmail").val(),
compEmail: $("#cmpEmail").val(),
landline: $("#cmpLandline").val(),
landline: $("#cmpLandline").val(),
@ -1377,18 +1436,18 @@
preferredAreas.push($(this).val());
preferredAreas.push($(this).val());
});
});
var ngoInfo = {
var ngoInfo = {
category: $("#category").val (),
subCategory: $("#subcategory").val (),
category: $("#category option:selected").text (),
subCategory: $("#subcategory option:selected").text (),
orgName: $("#ngoOrgName").val(),
orgName: $("#ngoOrgName").val(),
orgEmail: $("#ngoOrgEmail").val(),
orgEmail: $("#ngoOrgEmail").val(),
landline: $("#oLandline").val(),
mobileNo: $("#oMobile").val(),
/* landline: $("#oLandline").val(),
mobileNo: $("#oMobile").val(), */
district: $("#oDistrict").val(),
district: $("#oDistrict").val(),
address: $("#oAddress").val(),
address: $("#oAddress").val(),
pinCode: $("#oPincode").val(),
pinCode: $("#oPincode").val(),
no_of_vol: $("#oNvol").val(),
no_of_vol: $("#oNvol").val(),
contactPerson: $("#oPoc").val(),
contactPerson: $("#oPoc").val(),
contactPerMobile : $("#oPom").val(),
mobileNo : $("#oPom").val(),
cntPerEmail: $("#oPoE").val(),
cntPerEmail: $("#oPoE").val(),
cntPerDesign: $("#oPod").val(),
cntPerDesign: $("#oPod").val(),
previous_volunteered: $("input[name='oPvolY']:checked").val(),
previous_volunteered: $("input[name='oPvolY']:checked").val(),
@ -1421,6 +1480,7 @@
}
}
function successPopup(id) {
function successPopup(id) {
$("#submitBtn").prop("disabled", true);
$("#submitBtn").prop("disabled", true);
@ -1607,6 +1667,10 @@
}
}
}
}
< / script >
< / script >
< / body >
< / body >