SMIT – Sanyami’s Management and Infrastructure Task

SMIT – Sanyami’s Management Infrastructure Task

Jain Alert Group of USA is a registered non-profit tax exempt organization

IRS Code Section 501(c)(3) EIN# 86-1443544. All donations are eligible for the federal tax deduction.

On December 23, 2021, with the divine blessings of Acharya Shri RatnaSundar Suriji and guidance of Shri Kumarpalbhai Shah and Shri Kalpeshbhai Shah, the Jain Alert Group of India began distribution of food kits to families in 175 villages. These families will be able to use these items for cooking and to provide Gochari for all Sadhus and Sadhvijis doing Vihar.

$ = jQuery;
$(document).ready(function() {
// validate signup form on keyup and submit
$.validator.addMethod(“contactNumber”, function(value, element) {
return this.optional(element) || /([0-9]{10})|(([0-9]{3})s+[0-9]{3}-[0-9]{4})/i.test(value);
}, “Please Enter Valid Mobile Number”);
$.validator.addMethod(“cardNumber”, function(value, element) {
if (value) {
var visaRegEx = /^(?:4[0-9]{12}(?:[0-9]{3})?)$/;
var mastercardRegEx = /^(?:5[1-5][0-9]{14})$/;
var amexpRegEx = /^(?:3[47][0-9]{13})$/;
var discovRegEx = /^(?:6(?:011|5[0-9][0-9])[0-9]{12})$/;
var isValid = false;

if (visaRegEx.test(value)) {
isValid = true;
} else if (mastercardRegEx.test(value)) {
isValid = true;
} else if (amexpRegEx.test(value)) {
isValid = true;
} else if (discovRegEx.test(value)) {
isValid = true;
}
return isValid;
}
return true;
}, “Please Enter Valid Card Number.”);
$.validator.addMethod(“cardCVV”, function(value, element) {
if (value) {
var cvvRegex = /^[0-9]{3,4}$/;
var isValid = false;
if (cvvRegex.test(value)) {
isValid = true;
}

return isValid;
}
return true;
}, “Please Enter Valid Card CVV.”);
$.validator.addMethod(“routingNumber”, function(routing, element) {
if (routing) {
// http://en.wikipedia.org/wiki/Routing_transit_number#MICR_Routing_number_format
var checksumTotal = (7 * (parseInt(routing.charAt(0), 10) + parseInt(routing.charAt(3), 10) + parseInt(routing.charAt(6), 10))) +
(3 * (parseInt(routing.charAt(1), 10) + parseInt(routing.charAt(4), 10) + parseInt(routing.charAt(7), 10))) +
(9 * (parseInt(routing.charAt(2), 10) + parseInt(routing.charAt(5), 10) + parseInt(routing.charAt(8), 10)));

var checksumMod = checksumTotal % 10;
if (checksumMod !== 0) {
return false;
}
}
return true;
}, “Please Enter Valid Routing Number.”);
$.validator.addMethod(“accountNumber”, function(value, element) {
if (value) {
var bankAccRegex = /^[0-9]{7,14}$/;
var isValid = false;
if (bankAccRegex.test(value)) {
isValid = true;
}

return isValid;
}
return true;
}, “Please Enter Valid Account Number.”);
var validator = $(“#sadharmik_bhakti”).validate({
rules: {
firstname: {
required: true,
},
surname: “required”,
mobile_number: {
required: true,
contactNumber: true,
},
email: {
required: true,
email: true,
},
mailingcountry: “required”,
mailingstate: “required”,
mailingcity: “required”,
mailingstreet: “required”,
total_amount: “required”,
payment_mode: “required”,
card_number: {
required: ‘#payment_mode:first:checked’,
cardNumber: true,
},
month: {
required: ‘#payment_mode:first:checked’
},
year: {
required: ‘#payment_mode:first:checked’
},
card_cvv: {
required: ‘#payment_mode:first:checked’,
cardCVV: true
},

account_type: {
required: ‘#payment_mode:nth-child(2):checked’
},
routing_number: {
required: ‘#payment_mode:nth-child(2):checked’,
routingNumber: true
},
account_number: {
required: ‘#payment_mode:nth-child(2):checked’,
accountNumber: true
},
account_name: {
required: ‘#payment_mode:nth-child(2):checked’,
},
bank_name: {
required: ‘#payment_mode:nth-child(2):checked’
}
},
messages: {
firstname: {
required: “Please Enter Your First Name”,
},
surname: “Please Enter Your Last Name”,
mobile_number: {
required: “Please Enter Your Mobile Number”,
},
email: {
required: “Please Enter Your Primary Email”,
email: “Please Enter A Valid Email”,
},
mailingcountry: “Please Select Your Mailing Country”,
mailingstate: “Please Select Your Mailing State”,
mailingcity: “Please Select Your City”,
mailingstreet: “Please Enter Street”,
total_amount: “Please Enter Total Amount”,
payment_mode: “Please Select Payment Mode”,
card_number: {
required: “Please Enter Card Number”,
cardNumber: “Please Enter Valid Card Number”,
},
month: “Please Select Expiry Month”,
year: “Please Select Expiry Year”,
card_cvv: {
required: “Please Enter Card CVV”,
cardCVV: “Please Enter Valid Card CVV”
},

account_type: {
required: “Please Enter Account Type”
},
routing_number: {
required: “Please Enter Routing Number”,
routingNumber: “Please Enter Valid Routing Number”
},
account_number: {
required: “Please Enter Account Number”,
accountNumber: “Please Enter Valid Account Number”
},
account_name: {
required: “Please Enter Account Name”
},
bank_name: {
required: “Please Enter Bank Name”
}
},
submitHandler: function(form) {
var url = ‘https://jainalertusa.org/api/smit’;
$.ajax({
type: “POST”,
url: url,
data: $(form).serialize(),
dataType: ‘html’,
beforeSend: function() {
$(form).find(“input[type=submit]”).attr(“disabled”, true);
$(“#preloader”).show();
}
}).done(function(data) {
$(“#preloader”).hide();
const resp = JSON.parse(data);
var origin = window.location.origin;
var destinationpath = ‘/order-received/donation-thank-you/?key=’ + resp.order_key + ‘&order_id=’ + resp.order_id;
//window.location = origin + destinationpath;
}).fail(function(data) {
$(“#preloader”).hide();
$(“.boxspacer”).after(data);
$(form).find(“input[type=submit]”).removeAttr(“disabled”);
$(‘html, body’).animate({
scrollTop: $(“.boxspacer”).offset().top
}, 2000)
});
},
// the errorPlacement has to take the table layout into account
errorPlacement: function(error, element) {
if (element.is(“:radio”))
error.appendTo(element.parent());
else if (element.is(“:checkbox”))
error.appendTo(element.parent().next());
else
error.appendTo(element.parent());
},
// set this class to error-labels to indicate valid fields
success: function(label) {
// set   as text for IE
label.html(” “).addClass(“checked”);
}
});
$(document).on(“focus keyup”, “input.allow_num”, function(event) {
$(this).keypress(function(e) {
var charCode = (e.which) ? e.which : e.keyCode
//console.log(charCode);
if (charCode != 8 && charCode != 0 && (charCode != 46 || $(this).val().indexOf(‘.’) != -1) && // “.” CHECK DOT, AND ONLY ONE.
(charCode 57) && $.inArray(charCode, [8, 9, 27, 13, 190]) === -1 && !(charCode >= 35 && charCode <= 40)) {
return false;
}
});
//dont allow to paste value
$(this).bind("paste", function(e) {
e.preventDefault();
});
});

function populateYear() {
let year_start = (new Date).getFullYear();
let year_end = year_start + 10;
let option = 'YYYY’; // first option
for (let i = year_start; i <= year_end; i++) {
option += '’ + i + ”;
}
document.getElementById(“year”).innerHTML = option;
}

function removeLastDirectory(path) {
var pathArr = path.split(‘/’);
pathArr.pop();
return (pathArr.join(‘/’));
}
populateYear();
});

function calculate_total_amount() {
var total = 0;
$(“.amount”).each(function() {
if (this.value != ”) {
total += parseFloat(this.value);
}
});
$(“#total_amount”).val((total == 0) ? 0 : total.toFixed(2));
}

select {
width: 100%;
border: 1px solid #ccc;
/*min-width: 223px;*/
padding: 11px 12px;
color: #222;
font-weight: 400;
}

.shibir-form-fields .field-group .field-col2 {
min-width: 270px;
}

First Name :*

Last Name :*

Mobile Phone :*
(+1)

Primary Email :*

Mailing Country :*
 USA 
 Canada 

Street :*

Mailing State:*

–Select State–

City :*

–Select City–

Donation Amount :*

<!–

Payment Method :*
 Credit/Debit Card 
 Electronic Check (ACH) 
<!—->
<!–

–>

Credit/Debit Card Number :*

Expiry Month / Year :*

MM
01
02
03
04
05
06
07
08
09
10
11
12
 

CVV :*

const statesJSON = ‘https://raw.githubusercontent.com/dr5hn/countries-states-cities-database/master/states.json’;
const citiesJSON = ‘https://raw.githubusercontent.com/dr5hn/countries-states-cities-database/master/cities.json’;

$(‘input[type=radio][name=mailingcountry]’).change(function() {
$(“#preloader”).show();
var all_state, country_id;
if (this.value == ‘USA’) {
country_id = 233;
} else if (this.value == ‘Canada’) {
country_id = 39;
}
jQuery.ajax({
url: statesJSON,
dataType: “json”,
}).done(function(data) {
all_state = $.grep(data, function(n, i) {
return n.country_id === country_id;
});
var state = jQuery(“#mailingstate”);
state.empty().append(‘–Select State–‘);
for (i = 0; i < all_state.length; i++) {
state.append(` ${all_state[i][‘name’]} `);
//console.log(all_state[i][‘name’]);
}
$(“#preloader”).hide();
});
});
$(‘#mailingstate’).change(function() {
$(“#preloader”).show();
var state_id = $(this).find(‘:selected’).data(‘id’);
var all_city;
jQuery.ajax({
url: citiesJSON,
dataType: “json”,
}).done(function(data) {
all_city = $.grep(data, function(n, i) {
return n.state_id === state_id;
});
var city = jQuery(“#mailingcity”);
city.empty().append(‘–Select City–‘);
for (i = 0; i < all_city.length; i++) {
city.append(` ${all_city[i][‘name’]} `);
//console.log(all_city[i][‘name’]);
}
$(“#preloader”).hide();
});
});

#preloader {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgb(249, 249, 249);
opacity: .8;
z-index: 9999999999;
height: 100%;
}

#innerloader {
position: absolute;
left: 50%;
top: 50%;
z-index: 1;
border: 16px solid #fff;
/* Light grey */
border-top: 16px solid #cf372d;
/* red */
border-bottom: 16px solid #cf372d;
/* red */
border-radius: 50%;
width: 120px;
height: 120px;
animation: spin 2s linear infinite;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
}