(function ($) {
$.fn.has_scrollbar = function () {
var divnode = this.get(0);
if (divnode.scrollHeight > divnode.clientHeight)
return true;
}
})(jQuery);
var isValid = true;
var regex = /[!@#$%\*{}[\]<>?/|\,;]/;
var pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i;
var formFlag = true;
var addressFlag = true;
var nMonth = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var titleArr = [];
var seDateArr = [];
var closedLocation = false;
function addressPhoneFormat() {
return addressFlag;
}
function ISEmailExists(Email, callback) {
$("#loadingWithBG").show();
$.ajax({
url: '/ISEmailExists',
type: "POST",
async: "false",
data: { Email: Email },
success: function (data) {
$("#loadingWithBG").hide();
callback(data);
return data;
},
error: function (e) {
$("#loadingWithBG").hide();
return false;
}
});
}
function CustomerRegister() {
$("#loadingWithBG").show();
//var CropedImage = $("#imgCropped").val();
var State = $("#UserState option:selected").text();
//var formData = new FormData($('#CustomerRegister')[0]);
//formData.append("imgCropped", CropedImage);
//formData.append("State", State);
//formData.append("StateId", $("#UserState option:selected").val());
var detailmodel = {
StreetAddress1: $('#StreetAddress1').val(),
StreetAddress2: $('#StreetAddress2').val(),
Zip_City: $('#Reg_City').val(),
ZipCode: $('#zip_code').val(),
LongitudeString: $('#CustomerDetail_LongitudeString').val(),
LatitudeString: $('#CustomerDetail_LatitudeString').val()
}
var code = $('#RegPhoneCode').val();
var model = {
FirstName: $('#fname').val(),
LastName: $('#lname').val(),
Email: $('#email').val(),
Password: $('#password').val(),
ConfirmPassword: $('#password').val(),
PhoneRequired: true,
Phone: $('#PhoneNumber').val(),
StateId: $("#UserState option:selected").val(),
CountryId: $('#Country').val(),
GoogleAddress: $('#GoogleAddress_reg').val(),
CustomerDetail: detailmodel,
PhoneCode: $('#RegPhoneCode').val(),
fromSSReg:"1"
}
$.ajax({
url: '/Customer/Register',
data: { model: model, fromPosOrtho: 1 },
type: 'POST',
async: true,
success: function (result) {
$("#loadingWithBG").hide();
if (result.Status) {
if (result.CustomerId > 0) {
if ($.cookie("AskLoginValidationCookies" + result.CustomerId) == undefined || parseInt($.cookie("AskLoginValidationCookies" + result.CustomerId)) == "0") {
$.cookie("AskLoginValidationCookies" + result.CustomerId, "1", { path: '/', expires: 180 });
}
}
//reload after successful registration
window.location.reload();
}
else {
$('.Messgae').removeClass('hide').html(result.Message);
$('.jsGetStarted').removeClass('hide');
}
//$('#successMsg').removeClass('hide');
//setTimeout(function () {
// $('#RegModal').modal('hide');
//}, 2000);
},
error: function (jqXHR, textStatus, errorThrown) {
$("#loadingWithBG").hide();
$('#errorMsg').removeClass('hide');
$('.jsGetStarted').removeClass('hide');
}
});
}
//function phoneInp() {
// debugger;
// /* Phone field script start */
// var telInput = $(".phone");
// telInput.intlTelInput({
// showCountryDialCode: true,
// nationalMode: true,
// preferredCountries: ['us', 'ca', 'mx', 'gb'],
// //autoPlaceholder: false,
// formatOnInit: true,
// //initialCountry: "auto",
// geoIpLookup: function (callback) {
// $.get('https://ipinfo.io', function () { }, "jsonp").always(function (resp) {
// var countryCode = (resp && resp.country) ? resp.country : "";
// callback(countryCode);
// });
// },
// //customPlaceholder: false,
// utilsScript: "/Content/smilestream/js/intlTelInput_utils.js",
// separateDialCode: true
// });
// var reset = function () {
// var errorField = telInput.closest('.form-group').find('.error');
// telInput.removeClass("terror");
// telInput.closest('.intl-tel-input').find('.fa-remove').remove();
// telInput.next('.errormsg').remove();
// errorField.hide().html('');
// telInput.closest('.form-group').removeClass('ferr');
// };
// // on blur: validate
// telInput.blur(function () {
// var errorField = $(telInput).closest('.form-group').find('.error');
// reset();
// if ($.trim(telInput.val()) && $.trim(telInput.val()) != '+' + telInput.intlTelInput("getSelectedCountryData").dialCode) {
// if (telInput.intlTelInput("isValidNumber")) {
// telInput.closest('.intl-tel-input').find('.fa-check, .fa-remove, .errormsg').remove();
// errorField.hide().html('');
// telInput.closest('.form-group').removeClass('ferr');
// $('').insertBefore(telInput);
// if (isFunctionDefined('addressPhoneFormat')) {
// telInput.val(telInput.intlTelInput("getNumber", null, intlTelInputUtils.numberFormat.INTERNATIONAL));
// }
// else {
// telInput.val(telInput.intlTelInput("getNumber", null, intlTelInputUtils.numberFormat.INTERNATIONAL));
// }
// } else {
// telInput.closest('.intl-tel-input').find('.fa-check, .fa-remove, .errormsg').remove();
// $('').insertBefore(telInput);
// if (telInput.hasClass('phone')) {
// //$('
The phone number is not valid
').insertAfter(telInput);
// errorField.show().html('phone number is not valid');
// telInput.closest('.form-group').addClass('ferr');
// formFlag = false;
// }
// else if (telInput.hasClass('fax')) {
// //$('The fax number is not valid
').insertAfter(telInput);
// }
// $(this).addClass("terror");
// }
// }
// });
// // on keyup / change flag: reset
// telInput.on("keyup change", reset);
// /* Phone field script end */
//}
function phoneFunction(){
setTimeout(function(){
if(isFunctionDefined('Phone')){
$('#PhoneNumber').Phone();
}
else{
phoneFunction();
}
},500);
}
$(document).ready(function () {
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
isMobile = true;
}
else {
isMobile = false;
}
//phoneInp();
phoneFunction();
$(document).on('click', '.accordClick', function () {
var _this = $(this);
$(_this).closest('.accordChild').find('.accordChild').slideUp('slow');
$(_this).parents('.accordChild').find('a').removeClass('active');
if($(_this).next('.accordChild').is(':visible')){
$(_this).next('.accordChild').slideUp('slow');
$(_this).parents('li').find('a').removeClass('active');
$(_this).parents('li').children('a').addClass('active');
$(_this).removeClass('active');
}
else{
$(_this).next('.accordChild').slideDown('slow');
$(_this).parents('li').children('a').addClass('active');
}
});
$(document).on('click', '[name="scheduleNavRadio"]', function(){
var checkVal = $(this).val();
if(checkVal == 'jsAccordianDiv'){
$('#jsAccordianDiv').removeClass('hide');
$('#jsListDiv').addClass('hide');
$('.jsListVHide').removeClass('hide');
$('#adminMemberSwitchButtonDivId').removeClass('hide');
if ($('#pac-input1').length == 0) {
BindLoadAvailableCourses(undefined, undefined, undefined, undefined, undefined, undefined, checkVal);
}
}
else{
$('#jsListDiv').removeClass('hide');
$('#jsAccordianDiv').addClass('hide');
$('.jsListVHide').addClass('hide');
$('#adminMemberSwitchButtonDivId').addClass('hide');
if ($('#pac-input1').length == 0) {
BindLoadAvailableCourses(undefined, undefined, undefined, undefined, undefined, undefined, checkVal);
}
else if(!closedLocation) {
closedLocation = true;
if (IsAuthenticated=="False") {
initialize();
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(successFunction, errorFunction);
}
else {
alert('Geolocation is not supported by your browser.');
}
}
}
}
});
if (window.location.href.indexOf("localhost") == -1) {
$('.forlocalOnly').remove();
}
else {
var myVar = setInterval(myTimer, 1000);
function myTimer() {
if ($('.forlocalOnly').length > 0) {
$('.forlocalOnly').removeClass('hide');
clearInterval(myVar);
}
}
}
$(document).on('blur', '#RegModal .ValidateControl', function () {
formFlag = true;
validcheck(this);
});
$(document).on('keypress change', '#GoogleAddressDetails input,.jsAddressDetail select', function () {
isManuallyGoogleAddressChangedByUser = true;
});
$(document).on('click', '.jsGetStarted', function () {
$('.Messgae').addClass('hide').html("");
$(this).addClass('hide');
var eleThis = $(this).closest('.login-wrap').find('.ValidateControl');
$(eleThis).each(function () {
formFlag = validcheck(this);
});
var _this = $(this);
if ($('#RegCustomerValidationId').val() > 0) {
$('#RegCustomerValidationId').closest('.form-group').find('p.error').hide();
$('#RegCustomerValidationId').parent('.form-group').removeClass('ferr');
} else {
$('#RegCustomerValidationId').closest('.form-group').find('p.error').text('Please verify phone number').show();
$('#RegCustomerValidationId').closest('.form-group').addClass('ferr');
formFlag = false;
}
if ($('#RegOTP1').val() != "" && $('#RegOTP2').val() != "") {
$('#RegOTP1').closest('.form-group').find('p.error').hide();
$('#RegOTP1').closest('.form-group').removeClass('ferr');
} else if ($('#RegOTP1').val().length < 3 || $('#RegOTP2').val().length < 3) {
$('#RegOTP1').closest('.form-group').find('p.error').text('Please enter valid verification code').show();
$('#RegOTP1').closest('.form-group').addClass('ferr');
$(_this).removeClass('hide');
// return false;
formFlag = false;
}
else {
$('#RegOTP1').closest('.form-group').find('p.error').text('Enter Verification Code').show();
$('#RegOTP1').closest('.form-group').addClass('ferr');
formFlag = false;
}
var RegCustomerValidationId = $('#RegCustomerValidationId').val();
var RegVerificationCode = $('#RegOTP1').val() + "-" + $('#RegOTP2').val();
if (!$('#GoogleAddress_reg').IsValidAddressForRegister({
Address1: '#StreetAddress1',
City: '#Reg_City',
Country: '#Country',
State: '#UserState',
Zip: '#zip_code',
ErrorMessage: ''
})) {
isValid = false;
$('#GoogleAddressDetails').removeClass('hide');
}
if (!$('#chkTermsAndCondition').prop('checked')) {
formFlag = false;
var errorField = $(_this).closest('.form-wizard').find('#chkTermsAndCondition').closest('.form-group').find('.error');
$(errorField).closest('.form-group').addClass('ferr');
$(errorField).html('Please, accept Terms and Conditions').removeClass('hide');
}
else {
var errorField = $(_this).closest('.form-wizard').find('#chkTermsAndCondition').closest('.form-group').find('.error');
$(errorField).closest('.form-group').removeClass('ferr');
$(errorField).html('').addClass('hide');
}
if (formFlag) {
$.ajax({
url: '/Home/GetCustomerLoginValidationDetail/',
type: 'POST',
datatype: 'json',
data: { CustomerLoginValidationId: RegCustomerValidationId, LoginOTP: RegVerificationCode },
success: function (data) {
if (data.Status) {
if (isManuallyGoogleAddressChangedByUser) {
var address = $('#StreetAddress1').val() + ', ' + ($.trim($('#StreetAddress2').val()) == '' ? '' : $('#StreetAddress2').val() + ', ');
address += $('#Reg_City').val() + ', ' + $('#UserState').find('option:selected').text() + ' ' + $('#zip_code').val() + ', '
+ $('#Country').find('option:selected').text();
geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
$("#CustomerDetail_LatitudeString").val(results[0].geometry.location.lat());
$("#CustomerDetail_LongitudeString").val(results[0].geometry.location.lng());
} else {
$("#CustomerDetail_LatitudeString").val(0);
$("#CustomerDetail_LongitudeString").val(0);
}
CustomerRegister();
});
} else {
CustomerRegister();
}
}
else {
if (data.CodeExpired) {
$('#RegOTP1').closest('.form-group').find('p.error').text('Verification code expired').show();
$('#RegOTP1').closest('.form-group').addClass('ferr');
formFlag = false;
} else {
$('#RegOTP1').closest('.form-group').find('p.error').text('Verification code does not match').show();
$('#RegOTP1').closest('.form-group').addClass('ferr');
$(_this).removeClass('hide');
formFlag = false;
}
}
}
});
}
else {
formFlag = true;
$(this).removeClass('hide');
}
});
$('#chkTermsAndCondition').click(function () {
var errorField = $(this).closest('.form-group').find('.error');
if ($(this).is(':checked')) {
$(errorField).closest('.form-group').removeClass('ferr');
$(errorField).html('').addClass('hide');
} else {
$(errorField).closest('.form-group').addClass('ferr');
$(errorField).html('Please, accept Terms and Conditions').removeClass('hide');
}
})
$(document).on('change', '.clsCountry', function () {
//var stateCtrl = $('.clsState');
$("#loadingWithBG").show();
var _this = this;
//var id = $(this).val();
var _this = $(this);
var ddlStates = $(_this).closest('.fbox').find(".clsState");
if ($.trim($(_this).val()) == '' || $(_this).val() == '0') {
$(ddlStates).empty();
$(ddlStates).html('');
$(ddlStates).val(0).removeClass('fieldEmpty').next('.error').hide();
$(_this).closest('.cstaccordion').find('.phone').intlTelInput("setCountry", 'us');
$("#loadingWithBG").hide();
return false;
}
$.ajax({
url: "/SessionLess/GetCountryTwoLetterIsoCode",
type: 'post',
dataType: 'json',
//async: "false",
data: { CountryId: $(_this).val() },
success: function (data) {
//setCountryCode($(_this).closest('.login-wrap').find('.phone'), data);
var PhoneCode = $(_this).closest('.fbox').find(".phone").attr('data-countrycode');
if (typeof PhoneCode != 'undefined' && PhoneCode != null && PhoneCode != "") {
data = PhoneCode.toUpperCase();
}
setCountryCode($(_this).closest('.fbox').find('.phone'), data);
$.ajax({
url: "/SessionLess/getStateList/",
type: 'post',
// dataType: 'json',
async: "false",
data: { CountryId: $(_this).val() },
success: function (data) {
$(ddlStates).empty();
$(ddlStates).html(data);
$("#loadingWithBG").hide();
if (typeof ($("#hdnSatteID").val()) != "undefined" && $("#hdnSatteID").val() != null && $("#hdnSatteID").val() != "") {
$(".clsState option:contains(" + $("#hdnSatteID").val() + ")").attr('selected', 'selected');
}
if ($(_this).attr('data-statename') != undefined) {
$(ddlStates).val($(ddlStates).find('option').filter(function () {
return $(this).html() == $(_this).attr('data-statename') || $(_this).attr('data-statename').indexOf($(this).html()) >= 0;
}).val());
//$(_this).removeAttr('data-statename');
}
if ($('#UserState option').length > 1 && ($(ddlStates).val() == null || $(ddlStates).val() == '0')) {
$(ddlStates).val(0);
} else {
$('#UserState_code_err').hide().html('');
$('#UserState_code_err').parent('.form-group').removeClass('ferr');
}
},
error: function (xhr, status, error) {
$("#loadingWithBG").hide();
//alert(xhr.responseText);
}
});
}
});
});
$('.clsCountry').trigger('change');
$("#UserState").on('change', function () {
if ($(this).val() == "0" || $(this).val() == "") {
$('#UserState_code_err').show().html('State is required');
$('#UserState_code_err').parent('.form-group').addClass('ferr');
}
else {
$('#UserState_code_err').hide();
$('#UserState_code_err').parent('.form-group').removeClass('ferr');
}
});
$('#loginModal').on('hidden.bs.modal', function () {
$('#loginemail').val('');
$('#loginpassword').val('');
$('#email_err').hide().html('');
$('#email_err').parent('.form-group').removeClass('ferr');
$('#password_err').hide().html('');
$('#password_err').parent('.form-group').removeClass('ferr');
})
$('#RegModal').on('hidden.bs.modal', function () {
$('#CustomerRegister').trigger("reset");
$('.error').html('');
$('.form-group').removeClass('ferr');
$('#GoogleAddressDetails').addClass('hide');
})
scrollHelper2();
$(document).off('click', '#LoginPartialBtn');
$(document).on('click', '#LoginPartialBtn', function () {
var _this = this;
if (validation()) {
var LoginEmail = $('#loginemail').val();
var LoginPassword = $('#loginpassword').val();
$.ajax({
url: '/Home/CustomerLoginValidation/',
type: 'POST',
datatype: 'json',
data: { LoginEmail: LoginEmail, LoginPassword: LoginPassword },
success: function (data) {
if (data.Status) {
if (data.CustomerLoginValidation != null && data.CustomerLoginValidation != undefined) {
if (data.CustomerLoginValidation.TextValidaitonFlag && $.cookie("AskLoginValidationCookies" + data.CustomerLoginValidation.CustomerId) != undefined && parseInt($.cookie("AskLoginValidationCookies" + data.CustomerLoginValidation.CustomerId)) == "1") {
LoginPartial(_this);
}
else {
$('#LoginPhoneId').Phone();
if (data.CustomerLoginValidation.PhoneCode != null && data.CustomerLoginValidation.PhoneCode != "") {
$('#LoginPhoneId').intlTelInput("setCountry", data.CustomerLoginValidation.PhoneCode);
}
$('#ModalCustomerLoginValidation.modal').appendTo($('body'));
$('#ModalCustomerLoginValidation').modal('show');
$('#LoginPhoneId').focus();
if (data.CustomerLoginValidation.ShowFirstTimeNotice) {
$('#ModalCustomerLoginValidation .LoginFirstTimeNotice').removeClass('hide');
}
// $('div.modal-backdrop').remove();
}
$('#HiddenCustomerId').val(data.CustomerLoginValidation.CustomerId);
}
}
else {
if (data.IsWrongPassword || data.IsLocked) {
$(_this).closest('form').find('#password_err').show().html(data.Message);
$(_this).closest('form').find('#password_err').parent('.form-group').addClass('ferr');
}
else {
$(_this).closest('form').find('#email_err').show().html(data.Message);
$(_this).closest('form').find('#email_err').parent('.form-group').addClass('ferr');
}
}
}
});
}
});
var requiredErrorMessage = 'Phone is required';
$(document).off('blur', '#LoginPhoneId');
$(document).on('blur', '#LoginPhoneId', function () {
if ($(this).val() != "") {
$(this).closest('.form-group').find('.fgError').addClass('hide');
} else {
$(this).closest('.form-group').find('.fgError').text($.parseHTML(requiredErrorMessage)[0].data).removeClass('hide');
}
});
$(document).off('keypress', '#LoginPhoneId');
$(document).on('keypress', '#LoginPhoneId', function (e) {
if (e.which == 13) {
if ($('#SendLoginOTP').is(':visible')) {
$('#LoginPhoneId').trigger('blur');
$('#SendLoginOTP').trigger('click');
}
}
});
$(document).off('click', '#SendLoginOTP,#ReSendLoginOTP');
$(document).on('click', '#SendLoginOTP,#ReSendLoginOTP', function () {
var LoginPhoneCode = $("#LoginPhoneId").intlTelInput("getSelectedCountryData").dialCode;
var PhoneISOCode = $("#LoginPhoneId").intlTelInput("getSelectedCountryData").iso2;
var LoginPhoneNumber = $('#LoginPhoneId').val();
var CustomerId = $('#HiddenCustomerId').val();
$('#SendLoginOTP').closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv').addClass('hide');
$('#EnterVerificationCode').addClass('hide');
if ($.trim($('#LoginPhoneId').val()) == "" || $('#LoginPhoneId').next('.errormsg').length > 0) {
if ($.trim($('#LoginPhoneId').val()) == "") {
$('#LoginPhoneId').closest('.form-group').find('.fgError').text($.parseHTML(requiredErrorMessage)[0].data).removeClass('hide');
} else {
$('#LoginPhoneId').closest('.form-group').find('.fgError').addClass('hide');
}
return false;
} else {
$('#LoginPhoneId').closest('.form-group').find('.fgError').addClass('hide');
}
$(this).attr('disabled', 'disabled');
$('#ReSendLoginOTP').attr('disabled', 'disabled');
var _this = $(this);
$("#loadingWithBG").show();
$.ajax({
url: '/Home/IsMatchedPhoneNumber/',
type: 'POST',
datatype: 'json',
data: { PhoneNumber: LoginPhoneNumber, CustomerId: CustomerId },
success: function (data) {
if (data.Status) {
SendLoginOTP(LoginPhoneCode, LoginPhoneNumber, PhoneISOCode, CustomerId,false);
$("#loadingWithBG").hide();
}
else {
$("#loadingWithBG").hide();
$.confirm({
text: "Are you sure you want to change your cell phone number to +" + LoginPhoneCode +" "+ LoginPhoneNumber + "?",
title: "Confirm Phone",
confirm: function (button) {
SendLoginOTP(LoginPhoneCode, LoginPhoneNumber, PhoneISOCode, CustomerId,true);
},
cancel: function (button) {
SendLoginOTP(LoginPhoneCode, LoginPhoneNumber, PhoneISOCode, CustomerId, false);
},
confirmButton: "Yes",
cancelButton: "No",
confirmButtonClass: "btn-theme",
cancelButtonClass: "btn-default",
dialogClass: "modal-dialog modal-sm jsConfirmDialog"
});
$('.jsConfirmDialog .close').remove();
$('.jsConfirmDialog').closest('.modal').on('hidden.bs.modal', function () {
$('#SendLoginOTP').removeAttr('disabled');
});
}
}
});
});
$(document).off('click', '#EditPhoneNumber');
$(document).on('click', '#EditPhoneNumber', function () {
$('#ModalCustomerLoginValidation').find('.LoginPhoneDiv').removeClass('hide');
$('#ModalCustomerLoginValidation').find('.OTPSectionDiv').addClass('hide');
$('#ReSendLoginOTP').addClass('hide');
$('#SendLoginOTP').attr('disabled', 'disabled');
$('#EnterVerificationCode').removeClass('hide');
setTimeout(function () {
$('#SendLoginOTP').removeAttr('disabled');
}, 60000);
$('#ModalCustomerLoginValidation').find('.sendOTP').removeClass('hide');
});
$(document).off('keyup', '#LoginOTP1 , #LoginOTP2');
$(document).on('keyup', '#LoginOTP1, #LoginOTP2', function (e) {
if (e.which == 13 && $('#SubmitLoginOTP').is(':visible')) {
$('#SubmitLoginOTP').trigger('click');
}
if ($('#LoginOTP1').val().length >= 3) {
$('#LoginOTP2').focus();
}
if ($('#LoginOTP1').val().length == 3 && $('#LoginOTP2').val().length == 3) {
$(this).closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv .OTPinput').addClass('hide');
}
});
$(document).off('blur', '#LoginOTP1 , #LoginOTP2');
$(document).on('blur', '#LoginOTP1 , #LoginOTP2', function () {
if ($(this).val() == "") {
$(this).closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv .OTPinput').text('Please enter verification code').removeClass('hide');
return false;
}
else {
$(this).closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv .OTPinput').addClass('hide');
}
if ($(this).val().length < 3) {
$(this).closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv .OTPinput').text('Please enter valid verification code').removeClass('hide');
return false;
}
else {
$(this).closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv .OTPinput').addClass('hide');
}
});
$(document).off('click', '#SubmitLoginOTP');
$(document).on('click', '#SubmitLoginOTP', function () {
var _this = this;
var CustomerLoginValidationId = $('#CustomerLoginValidationId').val();
var LoginOTP = $('#LoginOTP1').val() + "-" + $('#LoginOTP2').val();
if ($('#LoginOTP1').val() == "" || $('#LoginOTP2').val() == "") {
$(this).closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv .OTPinput').text('Please enter verification code').removeClass('hide');
return false;
} else if ($('#LoginOTP1').val().length < 3 || $('#LoginOTP2').val().length < 3) {
$(this).closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv .OTPinput').text('Please enter valid verification code').removeClass('hide');
return false;
}
else {
$(this).closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv .OTPinput').addClass('hide');
}
$.ajax({
url: '/Home/GetCustomerLoginValidationDetail/',
type: 'POST',
datatype: 'json',
data: { CustomerLoginValidationId: CustomerLoginValidationId, LoginOTP: LoginOTP },
success: function (data) {
if (data.Status) {
LoginPartial(_this);
}
else {
if (data.IsLocked) {
window.location.reload();
} else if (data.CodeExpired) {
$('#SubmitLoginOTP').closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv .OTPinput').text('Verification code expired').removeClass('hide');
return false;
}
else {
$('#SubmitLoginOTP').closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv .OTPinput').text('Verification code does not match').removeClass('hide');
return false;
}
}
}
});
});
$(document).off('click', '#EnterVerificationCode');
$(document).on('click', '#EnterVerificationCode', function () {
$('#EnterVerificationCode').addClass('hide');
$('#ReSendLoginOTP').removeClass('hide');
$('#SendLoginOTP').addClass('hide');
$('#ModalCustomerLoginValidation').find('.LoginPhoneDiv').addClass('hide');
$('#SendLoginOTP').closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv').removeClass('hide');
});
//start Reg OTP
$(document).off('blur', '#PhoneNumber');
$(document).on('blur', '#PhoneNumber', function () {
if ($(this).val() != "") {
$(this).closest('.form-group').find('p.error').hide();
$(this).closest('.form-group').removeClass('ferr');
} else {
$(this).closest('.form-group').find('p.error').show().html(' Phone number is required');
$(this).closest('.form-group').addClass('ferr');
}
});
$(document).off('keyup', '#PhoneNumber');
$(document).on('keyup', '#PhoneNumber', function () {
if ($(this).val() != "") {
$(this).closest('.form-group').find('p.error').hide();
$(this).closest('.form-group').removeClass('ferr');
} else {
$(this).closest('.form-group').find('p.error').text('Enter Phone number').show();
$(this).closest('.form-group').addClass('ferr');
formFlag = false;
}
});
$(document).off('click', '#VerifyRegPhoneNumber');
$(document).on('click', '#VerifyRegPhoneNumber', function () {
var RegPhoneCode = $("#PhoneNumber").intlTelInput("getSelectedCountryData").dialCode;
var RegPhoneISOCode = $("#PhoneNumber").intlTelInput("getSelectedCountryData").iso2;
var RegPhoneNumber = $('#PhoneNumber').val();
var RegCustomerEmail = $('#email').val();
if ($.trim($('#PhoneNumber').val()) == "" || $('#PhoneNumber').next('.errormsg').length > 0) {
if ($.trim($('#PhoneNumber').val()) == "") {
$('#PhoneNumber').closest('.form-group').find('p.error').text('Enter Phone number').show();
$('#PhoneNumber').closest('.form-group').addClass('ferr');
} else {
$('#PhoneNumber').closest('.form-group').find('p.error').hide();
$('#PhoneNumber').closest('.form-group').removeClass('ferr');
}
return false;
} else {
$('#PhoneNumber').closest('.form-group').find('p.error').hide();
$('#PhoneNumber').closest('.form-group').removeClass('ferr');
}
var _this = $(this);
$(_this).attr('disabled', 'disabled');
$("#loadingWithBG").show();
$.ajax({
url: '/Home/SendRegistrationOTP/',
type: 'POST',
datatype: 'json',
data: { PhoneCode: RegPhoneCode, PhoneNumber: RegPhoneNumber, PhoneISOCode: RegPhoneISOCode, CustomerEmail: RegCustomerEmail },
success: function (data) {
$("#loadingWithBG").hide();
setTimeout(function () {
$(_this).removeAttr('disabled');
}, 60000);
if (data.Status) {
$('#RegCustomerValidationId').val(data.CustomerLoginValidationId);
$('#RegPhoneCode').val(RegPhoneISOCode);
$('.RegVerificationCodeDiv').removeClass('hide');
$('#RegOTP1').focus();
}
else {
$.confirm({
text: "Something went wrong. Please try after sometime",
title: "Error",
confirm: function (button) {
window.location.reload;
},
cancel: function (button) {
},
confirmButton: "Ok",
cancelButton: "Cancel",
confirmButtonClass: "btn-theme",
cancelButtonClass: "hide",
dialogClass: "modal-dialog modal-sm"
});
}
}
});
});
$(document).off('keyup', '#RegOTP1 , #RegOTP2');
$(document).on('keyup', '#RegOTP1 , #RegOTP2', function () {
if ($('#RegOTP1').val().length >= 3) {
$('#RegOTP2').focus();
}
if ($('#RegOTP1').val().length == 3 && $('#RegOTP2').val().length == 3) {
$('#RegOTP1').closest('.form-group').find('p.error').hide();
$('#RegOTP1').closest('.form-group').removeClass('ferr');
}
});
$(document).off('blur', '#RegOTP1 , #RegOTP2');
$(document).on('blur', '#RegOTP1 , #RegOTP2', function () {
if ($(this).val() == "") {
$('#RegOTP1').closest('.form-group').find('p.error').text('Please enter verification code').show();
$('#RegOTP1').closest('.form-group').addClass('ferr');
return false;
}
else {
$('#RegOTP1').closest('.form-group').find('p.error').hide();
$('#RegOTP1').closest('.form-group').removeClass('ferr');
}
if ($(this).val().length < 3) {
$('#RegOTP1').closest('.form-group').find('p.error').text('Please enter valid verification code').show();
$('#RegOTP1').closest('.form-group').addClass('ferr');
return false;
}
else {
$('#RegOTP1').closest('.form-group').find('p.error').hide();
$('#RegOTP1').closest('.form-group').removeClass('ferr');
}
});
//End reg OTP
$(document).off('keypress', ".allowint");
$(document).on('keypress', ".allowint", function (e) {
//console.log(e.which);
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
return false;
}
});
});
$(window).resize(function () {
scrollHelper();
});
function scrollHelper() {
if (isMobile) {
$('#dtAvailableCourses').closest('.flex-stack').find('.flexHeader').removeAttr('style');
}
else {
if ($('.flexNice').is(':visible')) {
if ($('.flexNice:visible').has_scrollbar()) {
$('#dtAvailableCourses').closest('.flex-stack').find('.flexHeader').css({ 'padding-right': '17px' });
}
else {
$('#dtAvailableCourses').closest('.flex-stack').find('.flexHeader').removeAttr('style');
}
}
}
}
function scrollHelper2() {
setTimeout(function () {
if ($('.flexNice').is(':visible')) {
scrollHelper();
}
else {
scrollHelper2();
}
}, 100);
}
function validcheck(eleThis) {
var fieldName = $(eleThis).attr('data-name');
var fieldSpecial = $(eleThis).attr('data-special');
var fieldPattern = $(eleThis).attr('data-pattern');
var fieldLength = $(eleThis).attr('data-length');
var fieldSelect = $(eleThis).attr('data-select');
var errorField = $(eleThis).closest('.form-group').find('.error');
if ($.trim($(eleThis).val()) == '') {
$(errorField).show().html(fieldName + ' is required');
$(eleThis).closest('.form-group').addClass('ferr');
formFlag = false;
}
else if (fieldSpecial != undefined) {
if (regex.test($(eleThis).val()) == true) {
$(errorField).show().html('Special character does not allow');
$(eleThis).closest('.form-group').addClass('ferr');
formFlag = false;
}
}
else if (fieldPattern != undefined) {
if (!pattern.test($(eleThis).val())) {
$(errorField).show().html('Valid email is required');
$(eleThis).closest('.form-group').addClass('ferr');
formFlag = false;
}
ISEmailExists($(eleThis).val(), function (result) {
if (result) {
$(errorField).show().html('Email is already registered');
$(eleThis).closest('.form-group').addClass('ferr');
formFlag = false;
}
});
}
else if (fieldLength != undefined) {
if (($.trim($(eleThis).val()).length < 8)) {
$(errorField).show().html('For security reasons please enter at least 8 characters.');
$(eleThis).closest('.form-group').addClass('ferr');
formFlag = false;
}
else if (!(new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}$").test($(eleThis).val().trim()))) {
$(errorField).show().html('Must contain at least 1 upper letter, 1 lower letter and 1 number');
$(eleThis).closest('.form-group').addClass('ferr');
formFlag = false;
}
}
else if (fieldSelect != undefined) {
if ($.trim($(eleThis).val()) == '0') {
$(errorField).show().html(fieldName + ' is required');
$(eleThis).closest('.form-group').addClass('ferr');
formFlag = false;
}
}
else {
$(errorField).hide();
$(eleThis).closest('.form-group').removeClass('ferr');
}
if (formFlag) {
$(errorField).hide();
$(eleThis).closest('.form-group').removeClass('ferr');
}
return formFlag;
}
function LoginPartial(eleThis) {
//debugger;
//$('#password_err').hide().html('');
//$('#password_err').parent('.form-group').removeClass('ferr');
//var flag= validation();
//if (flag) {
var LoginModel = {
'Email': $('#loginemail').val(),
'Password': $('#loginpassword').val()
}
var CustomerId = $('#HiddenCustomerId').val();
$.ajax({
url: "/Account/Login/",
type: 'POST',
data: { model: LoginModel, fromPosOrtho: 1 },
success: function (response) {
if (response.Status) {
$('#email_err').hide().html('');
$('#email_err').parent('.form-group').removeClass('ferr');
if (CustomerId > 0) {
if ($.cookie("AskLoginValidationCookies" + CustomerId) == undefined || parseInt($.cookie("AskLoginValidationCookies" + CustomerId)) == "0") {
$.cookie("AskLoginValidationCookies" + CustomerId, "1", { path: '/', expires: 180 });
}
}
if (IsAdmin) {
$.confirm({
text: "Admin can not purchase.",
title: "Notification",
confirm: function (button) {
window.location.reload();
},
cancel: function (button) {
// nothing to do
},
confirmButton: "Ok",
cancelButton: "No",
post: true,
confirmButtonClass: "btn-theme",
cancelButtonClass: "hide",
dialogClass: "modal-dialog modal-sm" // Bootstrap classes for large modal
});
}
else {
window.location.reload();
}
}
else {
if ($('#ModalCustomerLoginValidation').is(':visible')) {
$('#ModalCustomerLoginValidation').modal('hide');
}
if (response.Authenticationskiped) {
$.removeCookie("AskLoginValidationCookies" + response.CustomerId, { path: '/' });
}
$(eleThis).closest('form').find('#password_err').show().html(response.data);
$(eleThis).closest('form').find('#password_err').parent('.form-group').addClass('ferr');
}
}
});
//}
}
function validation() {
var pattern = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/
var flag = true;
if ($.trim($('#loginemail').val()) == '') {
$('#loginemail').closest('.form-group').find('#email_err').show().html('Email is required');
$('#loginemail').closest('.form-group').find('#email_err').parent('.form-group').addClass('ferr');
flag = false;
}
else {
$('#loginemail').closest('.form-group').find('#email_err').hide().html('');
$('#loginemail').closest('.form-group').find('#email_err').parent('.form-group').removeClass('ferr');
}
if (!pattern.test($('#loginemail').val())) {
$('#loginemail').closest('.form-group').find('#email_err').show().html('Valid Email is required');
$('#loginemail').closest('.form-group').find('#email_err').parent('.form-group').addClass('ferr');
flag = false;
}
else {
$('#loginemail').closest('.form-group').find('#email_err').hide().html('');
$('#loginemail').closest('.form-group').find('#email_err').parent('.form-group').removeClass('ferr');
}
if ($.trim($('#loginpassword').val()) == '') {
$('#loginpassword').closest('.form-group').find('#password_err').show().html('Password is required');
$('#loginpassword').closest('.form-group').find('#password_err').parent('.form-group').addClass('ferr');
flag = false;
}
else {
$('#loginpassword').closest('.form-group').find('#password_err').hide().html('');
$('#loginpassword').closest('.form-group').find('#password_err').parent('.form-group').removeClass('ferr');
}
if (flag) {
return true;
} else {
return false;
}
}
function setCountryCode(ele, countryCode) {
if ($(ele).attr('data-countrycode') != undefined
&& $(ele).closest('.intl-tel-input').find('[data-dial-code="' + $(ele).attr('data-countrycode') + '"]').length > 0
&& $(ele).closest('.intl-tel-input').find('[data-dial-code="' + $(ele).attr('data-countrycode') + '"]').length == 1) {
$(ele).intlTelInput("setCountry", $(ele).closest('.intl-tel-input').find('[data-dial-code="' + $(ele).attr('data-countrycode') + '"]').attr('data-country-code'));
$(ele).removeAttr('data-countrycode');
} else {
$(ele).intlTelInput("setCountry", countryCode);
}
}
function SendLoginOTP(LoginPhoneCode, LoginPhoneNumber, PhoneISOCode, CustomerId, NeedToChangePhone) {
$.ajax({
url: '/Home/SendLoginOTP/',
type: 'POST',
datatype: 'json',
data: { PhoneCode: LoginPhoneCode, PhoneNumber: LoginPhoneNumber, PhoneISOCode: PhoneISOCode, CustomerId: CustomerId, NeedToChangePhone: NeedToChangePhone },
success: function (data) {
$('#ModalCustomerLoginValidation').find('.LoginPhoneDiv').addClass('hide');
$('#ModalCustomerLoginValidation').find('.sendOTP').addClass('hide');
$('#SendLoginOTP').removeAttr('disabled');
$('.OTPReSendNote').closest('.form-group').removeClass('hide');
$('#ReSendLoginOTP').removeClass('hide');
setTimeout(function () {
$('#ReSendLoginOTP').removeAttr('disabled');
}, 60000);
$("#loadingWithBG").hide();
if (data.Status) {
$('#SendLoginOTP').addClass('hide');
$('#EditPhoneNumber').removeClass('hide');
if ($('#ReSendLoginOTP').attr('id') == 'ReSendLoginOTP') {
//setTimeout(function () {
$('#SendLoginOTP').closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv').removeClass('hide');
//}, 2000);
} else {
$('#SendLoginOTP').closest('#ModalCustomerLoginValidation').find('.OTPSectionDiv').removeClass('hide');
}
$('#CustomerLoginValidationId').val(data.CustomerLoginValidationId);
$('#LoginOTP1').focus();
}
else {
$.confirm({
text: "Something went wrong. Please try after sometime",
title: "Error",
confirm: function (button) {
window.location.reload;
},
cancel: function (button) {
},
confirmButton: "Ok",
cancelButton: "Cancel",
confirmButtonClass: "btn-theme",
cancelButtonClass: "hide",
dialogClass: "modal-dialog modal-sm"
});
}
}
});
}
// Date Format and Time in Tip helper Functions
function ConvertUTCTimeToLocalTime(UTCDateString, IsDisplayYear) {
var offsetms = ((new Date()).getTimezoneOffset() * 60 * 1000);
var convertdLocalTime = new Date(UTCDateString);
var newDate = new Date(convertdLocalTime.valueOf() - offsetms);
var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var date_format = '12'; /* FORMAT CAN BE 12 hour (12) OR 24 hour (24)*/
var d = newDate;
var hours = d.getHours();
var minutes = d.getMinutes();
var suffix = '';
if (hours > 11) {
suffix += "PM";
} else {
suffix += "AM";
}
if (hours > 12) {
hours -= 12;
} else if (hours === 0) {
hours = 12;
}
hours = ((hours < 10) ? "0" + hours : hours);
if (minutes < 10) {
minutes = "0" + minutes;
}
if (IsDisplayYear) {
return monthNames[newDate.getMonth()] + " " + newDate.getDate() + ", " + newDate.getFullYear() + " " + hours + ":" + minutes + ' ' + suffix;
}
else {
return monthNames[newDate.getMonth()] + " " + newDate.getDate() + ", " + hours + ":" + minutes + ' ' + suffix;
}
}
function convertLocalDateToUTCDate(date) {
date = new Date(date);
//Local time converted to UTC
var localOffset = date.getTimezoneOffset() * 60000;
var localTime = date.getTime();
date = localTime + localOffset;
date = new Date(date);
return date;
}
function CheckSoonDate(UTCDateString) {
//var offsetms = ((new Date()).getTimezoneOffset() * 60 * 1000);
//var convertdLocalTime = new Date(UTCDateString);
////var convertdLocalTime = new Date(new Date(UTCDateString).getMinutes() + parseInt((new Date()).getTimezoneOffset()));
//var newDate = new Date(convertdLocalTime.valueOf() - offsetms);
//var nowDate = new Date();
//nowDate.setDate(nowDate.getDate() + 1);
//if (newDate <= nowDate || newDate <= new Date()) {
// return true;
//} else {
// return false;
//}
//var convertdLocalTime = new Date(new Date(UTCDateString).setMinutes(parseInt((new Date()).getTimezoneOffset())));
//if (new Date() <= convertdLocalTime && ((convertdLocalTime.getDate() - new Date().getDate()) == 1 || (convertdLocalTime.getDate() - new Date().getDate()) == 0)) {
// return true;
//}
//else {
// return false;
//}
var UTCDateString = new Date(UTCDateString);
var localOffset = UTCDateString.getTimezoneOffset() * 60000;
var localTime = UTCDateString.getTime();
UTCDateString = localTime - localOffset;
UTCDateString = new Date(UTCDateString);
if (new Date() <= UTCDateString && ((UTCDateString.getDate() - new Date().getDate()) == 1 || (UTCDateString.getDate() - new Date().getDate()) == 0)) {
return true;
}
else {
return false;
}
}
function formatAMPM(date) {
var hours = date.getHours();
var minutes = date.getMinutes();
var ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
//hours = hours < 10 ? '0' + hours : hours;
minutes = minutes < 10 ? '0' + minutes : minutes;
if (minutes > 0) {
var strTime = hours + ':' + minutes + ' ' + ampm;
}
else {
var strTime = hours + ' ' + ampm;
}
return strTime;
}
function formatSDate(date) {
var nMNo = date.getMonth();
var nMShortNM = nMonth[nMNo];
var nMFYear = date.getFullYear();
var nMDate = date.getDate();
//nMDate = nMDate < 10 ? '0' + nMDate : nMDate;
var strDate = nMShortNM + ' ' + nMDate + ', ' + nMFYear;
return strDate;
}
function jsDTip() {
$('.jsDTip').tooltip({
// tooltipClass: "bBG_tooltip",
position: { my: "left+30 top+20", at: "left top", collision: "flipfit" },
track: true,
content: function () {
return $(this).prop('title');
}
});
$('.jsDTip').tooltip().off("focusin focusout");
}
function setTipStrFormat(ele, eleArr, elesingleDateOnly, elestartEndLength) {
for (var i = 0; i < eleArr.length; i++) {
var titStr = "";
if (eleArr.length > 1) {
if (eleArr[0] == eleArr[1]) {
titStr = eleArr[0];
}
else {
titStr = eleArr[0] + ' - ' + eleArr[1];
}
titleArr = [];
}
else if ((typeof elesingleDateOnly !== typeof undefined && elesingleDateOnly !== false) || elestartEndLength == 1) {
titStr = eleArr[0];
titleArr = [];
}
else {
titStr = eleArr[0];
}
$(ele).closest('.jsConvertdateParent').attr('title', titStr);
};
}
function setDateStrFormat(ele, eleArr, elesingleDateOnly, elestartEndLength) {
for (var i = 0; i < eleArr.length; i++) {
if (eleArr.length > 1) {
// Month settings
var month_start_no = new Date(eleArr[0]).getMonth();
var month_start_ShName = nMonth[month_start_no];
var month_end_no = new Date(eleArr[1]).getMonth();
var month_end_ShName = nMonth[month_end_no];
// Date digit settings
var start_date = new Date(eleArr[0]).getDate();
var end_date = new Date(eleArr[1]).getDate();
// Year digit settings
var start_year = new Date(eleArr[0]).getFullYear();
var end_year = new Date(eleArr[1]).getFullYear();
if($(ele).hasClass('hlinkC')){
var eleParent = $(ele).closest('.jshlinkCParent');
}
else{
var eleParent = $(ele).closest('.jsConvertdateParent');
}
if (month_start_ShName == month_end_ShName && start_date == end_date && start_year == end_year) {
var commonDate = eleArr[0];
$(eleParent).children(':not(:first-child)').addClass('hide');
$(eleParent).children(':first-child').text(commonDate);
}
else if (month_start_ShName != month_end_ShName && start_date == end_date && start_year == end_year) {
var commonDate = month_start_ShName +' ' + start_date + ' - ' + month_end_ShName + ' ' + start_date + ', ' + start_year;
$(eleParent).children(':not(:first-child)').addClass('hide');
$(eleParent).children(':first-child').text(commonDate);
}
else if (month_start_ShName != month_end_ShName && start_date != end_date && start_year == end_year) {
var commonDate = month_start_ShName + ' ' + start_date + ' - ' + month_end_ShName + ' ' + end_date + ', ' + start_year;
$(eleParent).children(':not(:first-child)').addClass('hide');
$(eleParent).children(':first-child').text(commonDate);
}
else if (month_start_ShName != month_end_ShName && start_date == end_date && start_year != end_year) {
$(ele).text(eleArr[1]);
}
else if (month_start_ShName == month_end_ShName && start_date == end_date && start_year != end_year) {
var commonDate = month_start_ShName + ' ' + start_date + ', ' + start_year + ' - ' + end_year;
$(eleParent).children(':not(:first-child)').addClass('hide');
$(eleParent).children(':first-child').text(commonDate);
}
else if (month_start_ShName == month_end_ShName && start_date != end_date && start_year == end_year) {
var commonDate = month_start_ShName + ' ' + start_date + ' - ' + end_date + ', ' + start_year ;
$(eleParent).children(':not(:first-child)').addClass('hide');
$(eleParent).children(':first-child').text(commonDate);
}
else if (month_start_ShName != month_end_ShName && start_date != end_date && start_year != end_year) {
$(ele).text(eleArr[1]);
}
seDateArr = [];
}
else if ((typeof elesingleDateOnly !== typeof undefined && elesingleDateOnly !== false) || elestartEndLength == 1) {
$(ele).text(eleArr[0]);
seDateArr = [];
}
else {
$(ele).text(eleArr[0]);
}
};
}
function jsDateFormatAndTip() {
$('.jsConvertChild').each(function () {
var _this = $(this);
var date = $(this).attr('data-fdate');
var singleDateOnly = $(this).attr('data-check');
if (date != null && date.length > 0) {
if ($(this).closest('.jsConvertdateParent').hasClass('convertUTC')) {
var localDate = ConvertUTCTimeToLocalTime(date, true);
}
else {
var localDate = date;
}
var startEndLength = $(_this).closest('.jsConvertdateParent').children('.jsConvertChild').length;
// For Time Tip Settings
var titleStr = formatAMPM(new Date(localDate));
titleArr.push(titleStr);
$(_this).closest('.jsConvertdateParent').addClass('jsDTip');
setTipStrFormat(_this, titleArr, singleDateOnly, startEndLength)
// For Date Settings
var seDateStr = formatSDate(new Date(localDate));
seDateArr.push(seDateStr);
$(_this).text();
setDateStrFormat(_this, seDateArr, singleDateOnly, startEndLength)
jsDTip()
}
});
}