function changeCountry(_this, stateCtrl, hStateId) {
if (!IsOffline && ($.trim($(_this).val()) == '' || $(_this).val() == '0')) {
$(stateCtrl).empty();
$(stateCtrl).html('');
$(stateCtrl).val(0).removeClass('fieldEmpty').next('.error').hide();
return false;
}
$("#loadingWithBG").show();
$.ajax({
url: "/SessionLess/getStateList/",
type: 'POST',
async: "false",
data: { CountryId: $(_this).val() },
success: function (data) {
$(stateCtrl).empty();
$(stateCtrl).html(data);
$("#loadingWithBG").hide();
if ($(hStateId).val() != '') {
$(stateCtrl).val($(hStateId).val()).removeClass('fieldEmpty').next('.error').hide();
}
if ($(_this).attr('data-statename') != undefined) {
$(stateCtrl).val($(stateCtrl).find('option').filter(function () {
return $(this).html() == $(_this).attr('data-statename') || $(_this).attr('data-statename').indexOf($(this).html()) >= 0;
}).val()).removeClass('fieldEmpty').next('.error').hide();
}
if ($(stateCtrl).val() == null || $(stateCtrl).val() == '0') {
$(stateCtrl).val(0).addClass('fieldEmpty').next('.error').text($.parseHTML(requiredErrorMessage)[0].data).hide()
}
if ($(stateCtrl).find('option').length == 1) {
$('.jsAddressDetail').removeClass('hide');
}
},
error: function (xhr, status, error) {
$("#loadingWithBG").hide();
}
});
}
function cLineHeight(cEle) {
var fontSize = parseInt($(cEle).css('font-size'));
var num = Math.floor(parseInt(fontSize) * 1.5);
return num;
}
function countLines(cEle) {
var lineHeight = cLineHeight(cEle);
var divHeight = $(cEle).height();
var lines = divHeight / lineHeight;
return lines;
}
function ClearDiscountBox() {
$("#discountcouponcode").val('');
ClearDiscountBoxImpl();
}
function ClearDiscountBoxImpl() {
$('#discountMessage').hide();
$('#discountCurrentCode').hide();
$('#consulting_checkout #discountError').hide();
$('#consulting_checkout_price_discount').hide();
$('#discountCurrentCodeStr').text('');
$('#consulting_checkout_price_discount').text('');
$('#consulting_checkout #discountError').text('');
}
function RemoveDiscountOneClick() {
ClearDiscountBox();
ReestablishConsultingPrice();
if ($('#consulting_checkout #checkout_div_ordertotal').css('display') != 'none') {
var data = new Object();
data.total = OneClickOrderTotal;
data.subtotal = OneClickOrderSubTotal;
data.discount = OneClickOrderDiscount;
data.totalUS = OneClickOrderTotalUS;
UpdateOrderTotal(data);
}
}
function ReestablishConsultingPrice() {
var basePrice = $("#consulting_checkout_price_local_hidden").val();
var basePriceDoller = $("#consulting_checkout_price_hidden").val();
$('.jsUSDPrice').text('$' + parseFloat(basePriceDoller).toFixed(2) + ' USD');
$('#consulting_checkout_price').text(basePrice);
$('#consulting_checkout_price_subtotal').text(basePrice);
}
function ApplyDiscountCouponCode() {
var couponcode = $("#consulting_checkout #discountcouponcode").val();
var basePrice = $("#consulting_checkout_price_hidden").val();
var productId = $("#consulting_checkout_productid_hidden").val();
var sendtoId = $("#consulting_checkout_sendtoid_hidden").val();
ClearDiscountBoxImpl();
ReestablishConsultingPrice();
couponcode = couponcode.trim();
if (couponcode != "") {
$.ajax({
url: "/ShoppingCart/DiscountOneClick/",
type: 'get',
datatype: 'json',
data: { couponcode: couponcode, price: basePrice, productId: productId, consultantId: sendtoId },
async: false,
success: function (data) {
$('#discountMessage').text(data.message);
$('#discountMessage').show();
if (data.applied == true) {
var price = data.price;
var discount = data.discount;
$('#consulting_checkout_price_subtotal').text(price);
$('#discountCurrentCodeStr').text('Entered coupon code - ' + couponcode);
$('#discountCurrentCode').show();
if (data.discount != null && data.discount != "") {
$('#consulting_checkout_price_discount').text("You save: " + discount);
$('#consulting_checkout_price_discount').show();
}
data.discount = data.discountTotal;
UpdateOrderTotal(data);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
ClearDiscountBox();
$('#consulting_checkout #discountError').text('Server connection error. Please, try again.');
$('#consulting_checkout #discountError').show();
}
});
}
}
function UpdateOrderTotal(data) {
if (data.orderTotalForPayPal != null && data.orderTotalForPayPal != "") {
$('#consulting_checkout #orderTotalForPayPal').val(data.orderTotalForPayPal);
}
if (data.currencyForPayPal != null && data.currencyForPayPal != "") {
$('#consulting_checkout #currencyForPayPal').val(data.currencyForPayPal);
}
if (data.totalUS != null && data.totalUS != "") {
$('.jsUSDPrice').text(data.totalUS);
}
else {
$('.jsUSDPrice').text(data.total);
}
var CCEUPlanMentoring = $('#CCEUPlanFooterNote').attr('data-CCEUPlanMentoring');
if (CCEUPlanMentoring != undefined && CCEUPlanMentoring == 1) {
$('#CCEUPlanFooterNote').html('Upgrade charge ' + $('.jsUSDPrice').html() + ', remaining invoiced by Straumann');
$('#CCEUPlanFooterNote').removeClass('hide');
}
if (data.total != null && data.subtotal != null && data.discount != null) {
$('#consulting_checkout #checkout_div_ordertotal').attr('style', 'display:;')
$('#consulting_checkout #checkout_ordertotal').text(data.total);
$('#consulting_checkout #checkout_subtotal').text(data.subtotal);
$('#consulting_checkout #checkout_tr_ordertotaldiscount').attr('style', 'display:;')
$('#consulting_checkout #checkout_ordertotaldiscount').text(data.discount);
if (data.discountUS != null && data.discountUS != "") {
$('#checkout_ordertotaldiscount').attr('data-discountus', data.discountUS);
}
if (data.totalUS != null && data.totalUS != "") {
$('#consulting_checkout #checkout_ordertotalus').text("(" + data.totalUS + ")");
$('#consulting_checkout #checkout_ordertotalus_pp').val(data.totalUS);
$('#consulting_checkout #checkout_tr_localcurrency').attr('style', 'display:;')
}
else {
$('#consulting_checkout #checkout_ordertotalus').text("");
$('#consulting_checkout #checkout_ordertotalus_pp').val(data.total);
}
if (OneClickOrderTotal == null) {
OneClickOrderTotal = data.total;
OneClickOrderTotalUS = data.totalUS;
OneClickOrderDiscount = data.discount;
OneClickOrderSubTotal = data.subtotal;
}
}
else if (data.total != null && data.subtotal != null) {
$('#consulting_checkout #checkout_div_ordertotal').attr('style', 'display:;')
$('#consulting_checkout #checkout_ordertotal').text(data.total);
$('#consulting_checkout #checkout_subtotal').text(data.subtotal);
$('#consulting_checkout #checkout_tr_ordertotaldiscount').attr('style', 'display:none;')
if (data.totalUS != null && data.totalUS != "") {
$('#consulting_checkout #checkout_ordertotalus').text("(" + data.totalUS + ")");
$('#consulting_checkout #checkout_tr_localcurrency').attr('style', 'display:;')
$('#consulting_checkout #checkout_ordertotalus_pp').val(data.totalUS);
}
else {
$('#consulting_checkout #checkout_ordertotalus').text("");
$('#consulting_checkout #checkout_ordertotalus_pp').val(data.total);
}
if (OneClickOrderTotal == null) {
OneClickOrderTotal = data.total;
OneClickOrderTotalUS = data.totalUS;
OneClickOrderDiscount = data.discount;
OneClickOrderSubTotal = data.subtotal;
}
}
else {
$('#consulting_checkout #checkout_div_ordertotal').attr('style', 'display:none;')
$('#consulting_checkout #checkout_ordertotal').text('');
$('#consulting_checkout #checkout_subtotal').text('');
$('#consulting_checkout #checkout_ordertotalus_pp').val('0');
$('#consulting_checkout #checkout_tr_ordertotaldiscount').attr('style', 'display:none;')
$('#consulting_checkout #checkout_ordertotaldiscount').text('');
$('#consulting_checkout #checkout_ordertotalus').text('');
$('#consulting_checkout #checkout_tr_localcurrency').attr('style', 'display:none;')
OneClickOrderTotal = null;
OneClickOrderTotalUS = null;
OneClickOrderDiscount = null;
OneClickOrderSubTotal = null;;
}
paypalHelper();
}
function paypalHelper() {
setTimeout(function () {
if (isFunctionDefined('PreparePayPal')) {
PreparePayPal(false);
PaymentMethodChangeValue("#consulting_checkout ");
}
else {
paypalHelper();
}
}, 1000);
}
function GetLatestPaymentInformation(productid) {
$("#loadingWithBG").show();
$.ajax({
cache: false,
url: "/ShoppingCart/GetLatestPaymentInformation/",
dataType: 'json',
data: { productid: productid },
type: 'post',
success: function (data) {
$("#loadingWithBG").hide();
if (data.success == true) {
var select = $("#CurrentPaymentProfile");
var option = '';
var withCreditCard = false;
select.empty();
if (data.profiles != null)
for (var i = 0; i < data.profiles.length; i++) {
var profile = data.profiles[i];
withCreditCard = true;
if (i == 0)
option += '';
else
option += '';
}
select.append(option);
if (withCreditCard == false) {
ShowPaymentOption();
} else {
$("#consulting_checkout #showPaymentOptions_link").parent().removeClass('active');
$('#consulting_checkout #showPaymentOptions').slideUp('slow');
}
UpdateOrderTotal(data);
}
else {
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$("#loadingWithBG").hide();
$('#consulting_checkout #paymentError').text('Server connection error. Please, try again.');
$('#consulting_checkout #paymentError').show();
}
});
}
function ConsultingCheckoutSubmit() {
if (ConsultingCheckoutSubmitIsInProcess)
return;
HidePaymentError();
isFormValid = IsFormValid();
if (!isFormValid)
return;
ConsultingCheckoutSubmitIsInProcess = true;
$("#loadingWithBG").show();
if (!$('#consulting_checkout_form #discountCurrentCode').is(':visible')) {
$("#consulting_checkout_form #discountcouponcode").val('');
}
var paymentMethodCC = $('#consulting_checkout_form #paymentmethod_credit_card');
if (paymentMethodCC.length != 0 && paymentMethodCC.is(':checked') == true) {
var payment_method = $("#consulting_checkout_form #payment_method_impl").val();
if (payment_method == "CyberSourseAPI") {
paymentMethodCC.val("Payments.CyberSourceAPI");
}
else {
paymentMethodCC.val("Payments.AuthorizeNet");
}
}
var form = $("#consulting_checkout_form");
var formdata = $(form).serialize();
$.ajax({
cache: false,
url: "/ShoppingCart/ConsultingCheckoutSubmit/",
data: $(form).serialize(),
type: 'post',
success: function (data) {
$("#loadingWithBG").hide();
ConsultingCheckoutSubmitIsInProcess = false;
if (data.success == true) {
$('#consulting_checkout').modal('hide');
//$('#consulting_orderplaced_href').attr("href", "/orderdetails/" + data.orderId);
//$('#consulting_orderplaced_span').html("Order number" + data.orderId + "");
//$('#consulting_orderplaced').modal('show');
if (data.ConsultingReceiverId > 0) {
$('#OrderPlacedNotificationLi').attr('data-id', data.ConsultingReceiverId);
$('#OrderPlacedNotificationLi').attr('data-customerName', data.ConsultantName);
$('#OrderPlacedNotificationLi').attr('data-RootPatientId', data.RootPatientId);
$('#OrderPlacedNotificationLi').find('.DirectMessageToConversation').trigger('click');
$.removeCookie('GetMessageAandNetworkNotificationdata', { path: '/' });
$.removeCookie('LastNotificationsTimeStamp', { path: '/' });
GetNotifications();
} else {
$('#consulting_orderplaced_href').attr("href", "/orderdetails/" + data.orderId);
$('#consulting_orderplaced_span').html("Order number" + data.orderId + "");
$('#consulting_orderplaced').modal('show');
}
}
else {
if (data.error != null) {
if (data.error.indexOf("You are logged out") != -1) {
function closeReload() {
$(document).on('hidden.bs.modal', '.jsReloadPop', function () {
cReloadCallback();
});
}
commonConfirmPopup(cTNotification, data.error, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, closeReload, 'jsReloadPop');
}
else {
var errorText = "";
for (var i = 0; i < data.error.length; ++i) {
errorText += "
";
errorText += "- ";
errorText += data.error[i];
errorText += "
";
errorText += "
";
}
$('#consulting_checkout #paymentError').html(errorText);
$('#consulting_checkout #paymentError').show();
}
}
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$("#loadingWithBG").hide();
ConsultingCheckoutSubmitIsInProcess = false;
$('#consulting_checkout #paymentError').text('Server connection error. Please, try again.');
$('#consulting_checkout #paymentError').show();
}
});
}
function HidePaymentError() {
$('#consulting_checkout #paymentError').text('');
$('#consulting_checkout #paymentError').hide();
}
function HidePaymentOption() {
var showPaymentOptions = $("#consulting_checkout #showPaymentOptions");
if (showPaymentOptions.css('display') != 'none') {
var showPaymentOptionsLink = $("#consulting_checkout #showPaymentOptions_link");
showPaymentOptionsLink.click();
}
modalInscroll();
}
function ShowPaymentOption() {
var showPaymentOptions = $("#consulting_checkout #showPaymentOptions");
// alert(showPaymentOptions.css('display'));
if (showPaymentOptions.css('display') == 'none') {
var showPaymentOptionsLink = $("#consulting_checkout #showPaymentOptions_link");
showPaymentOptionsLink.click();
}
modalInscroll();
}
function ChangeCurrentPaymentProfile() {
HidePaymentError();
var selectedVal = $("#CurrentPaymentProfile").val() +"";
if (selectedVal == "0") {
ShowPaymentOption();
$("#consulting_checkout #CurrentPaymentProfile").val(selectedVal);
}
else {
HidePaymentOption();
$("#consulting_checkout #CurrentPaymentProfile").val(selectedVal);
}
}
function CloseConsultingCheckout() {
FirstAvailableCase = "";
var productId = $("#consulting_checkout_productid_hidden").val();
$.ajax({
cache: false,
url: "/ShoppingCart/ConsultingCheckoutClose/",
data: { productId: productId },
type: 'post',
success: function (data) {
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
}
});
}
function CalculateTimeZone() {
var localTime = new Date();
var year = localTime.getFullYear();
var month = localTime.getMonth() + 1;
var date = localTime.getDate();
var hours = localTime.getHours();
var minutes = localTime.getMinutes();
var seconds = localTime.getSeconds();
var h = localTime.getHours();
var m = localTime.getMinutes();
var _time = (h > 12) ? ('PM') : ('AM');
fulltime = month + "/" + date + "/" + year + " " + hours + ":" + minutes + ":" + seconds + " " + _time;
}
function rowno() {
$('.rowno').each(function (i) {
var i = i + 1;
$(this).attr('data-attr', i);
});
}
function Fstar() {
$('.Fstar').each(function (i) {
var i = i + 1;
$(this).attr('data-attr', i);
});
}
function datasort(sortingby, isSortName) {
sortingColumn = (isSortName ? "Name" : $('.actsort').attr('data-sorting'));
sortingBy = sortingby;
var trHClass = (isSortName ? "" : $('.asc_btn').attr('name'));
sortingspaciality = trHClass;
if (sortingColumn == "Country") {
sortingLocation.Country = $('#countrysel').val();
sortingLocation.State = $('#statesel').val();
sortingLocation.City = $('#citysel').val();
sortingLocation.Language = $('#languagesel').val();
} else {
//sortingLocation = {};
}
var Speciality = null;
$(".SpecialityConsultants").each(function () {
if ($(this).is(':checked')) {
var id = $(this).attr("id");
if (Speciality == null) {
Speciality = $(this).attr("id");
}
else {
Speciality += "," + $(this).attr("id");
}
}
});
$("#loadingWithBG").show();
$.ajax({
url: "/consulting/FindConsultantBySorted/",
type: 'POST',
datatype: 'html',
data: { CurrentTime: fulltime, sortColumn: sortingColumn, sortBy: sortingBy, sortingspaciality: sortingspaciality, location: sortingLocation, Specialitys: Speciality },
success: function (data) {
$("#dataappend").empty();
$("#dataappend").html(data);
if (isSortName == false) {
$('.choosePrice .btn').each(function () {
var btnTxt = $(this).text();
var CheckPrice = "";
if (sortingColumn == "StandardPrice") {
CheckPrice = $(this).closest('tr').find('td.lorange.itip').text();
} else if (sortingColumn == "ExpressRate") {
CheckPrice = $(this).closest('tr').find('td.ldarkblue:first').text();
} else if (sortingColumn == "MentoringRate") {
CheckPrice = $(this).closest('tr').find('td.lblue:first').text();
}
if (btnTxt == trHClass) {
$(this).closest('tr').addClass('sortHighlight');
}
});
$('.cico .fa, .itip').tooltip({
track: true
});
$('.contryTip').tooltip({
track: true,
content: function () {
return $(this).prop('title');
}
});
// $('#find_new_consultant .popover').remove();
// $('[data-toggle="popover"]').popover({
// placement: 'left',
// container: 'body',
// html: true,
// content: function () {
// return $(this).parent().children('.popData').html();
// }
// });
if ($('.actsort').hasClass('asc')) {
$('.actsort').removeClass('asc').addClass('desc');
}
else if ($('.actsort').hasClass('desc')) {
$('.actsort').removeClass('desc').addClass('asc');
}
else {
$('.sorting').removeClass('asc desc');
$('.actsort').addClass('asc');
}
} else {
if ($('.actsort').hasClass('asc')) {
$('.actsort').removeClass('asc');
}
else if ($('.actsort').hasClass('desc')) {
$('.actsort').removeClass('desc');
}
}
rowno();
Fstar();
$('#sorting_pop .cstpopFooter').remove();
$("#loadingWithBG").hide();
if (IsColleagueCase == true) {
$('.fcDiv').addClass('hide').next('.mcDiv').removeClass('hide');
$('#dataappend #ClearTable .fsTable th:nth-child(n+3):nth-child(-n+12), #dataappend #ClearTable .fsTable td:nth-child(n+3):nth-child(-n+12)').remove();
$('#dataappend #ClearTable .fsTable th:nth-child(2)').removeClass('w200');
dataovy();
$('#tr-FirstAvailableCase').attr('style', 'display:none;')
}
},
error: function (er) {
$("#loadingWithBG").hide();
}
});
}
function dataovy() {
var dataDivH = $('#dataappend').outerHeight();
var dataOVYH = $('.dataOVY').outerHeight();
if (dataDivH > dataOVYH) {
$('.dataOVY').addClass('mr--17');
}
else {
$('.dataOVY').removeClass('mr--17');
}
//console.log(dataDivH);
//console.log(dataOVYH);
}
function ShowPaymentOptionsOnClick(current) {
//InitializeGoogleAddressField();
var _this = current;
if ($(_this).parent().hasClass('active')) {
$(_this).parent().removeClass('active');
$('#consulting_checkout #showPaymentOptions').slideUp('slow');
}
else {
$(_this).parent().addClass('active');
$('#consulting_checkout #showPaymentOptions').slideDown('slow');
}
// $('#showPaymentOptions').slideToggle('slow');
$('#consulting_checkout #CurrentPaymentProfile option[selected="selected"]').each(
function () {
$(this).removeAttr('selected');
}
);
$("#consulting_checkout #CurrentPaymentProfile").val($("#consulting_checkout #CurrentPaymentProfile option:first").val())
}
function CheckConsultantSpecialities(FreeCaseImmediately) {
$("#AddNoteText").text('');
CalculateTimeZone();
if (IsColleagueCase == false) {
$.ajax({
url: "/Consulting/CheckConsultantSpecialities",
type: 'Post',
datatype: 'json',
data: { ConsultantId: ConsultantId, ConsultantSpeciality: ConsultantSpeciality, CurrentTime: fulltime },
async: false,
success: function (data) {
if (data != false) {
if (data.Note != null && FreeCaseImmediately != 1) {
var RateTypes = data.PriceType;
var Types = RateTypes.split(",");
if (Types.length > 1) {
$('#choosePrice, .cstpopshadow').fadeIn('slow');
$(".Standard").hide();
$(".Express").hide();
$(".Mentoring").hide();
if (Types.indexOf("Standard") > -1) {
$(".Standard").show();
//$("#StanderdReturnBy").text("Standerd: " + data.ReturnBy);
}
if (Types.indexOf("Express") > -1) {
$(".Express").show();
//$("#ExpressReturnBy").text("Express: " + data.ExpressReturnBy);
}
if (Types.indexOf("Mentoring") > -1) {
$(".Mentoring").show();
//$("#MentoringReturnBy").text("Mentoring: " + data.MentoringReturnBy);
}
}
}
else {
$('#choosePrice, .cstpopshadow').fadeIn('slow');
$(".Standard").hide();
$(".Express").hide();
$(".Mentoring").hide();
$("#ChooseRate").hide();
RateType = data.PriceType;
if (FreeCaseImmediately == 1) {
RateType = 'Mentoring';
}
RateTypeCase = RateType;
//AddToConsulting(data.PatientId, ConsultantId, data.Rate, data.ReturnBy, "Paid", data.PriceType);
}
}
else {
alert("Something went wrong. Please try after sometime.");
}
},
error: function () {
alert("Something went wrong. Please try after sometime.");
}
});
} else {
$('#choosePrice, .cstpopshadow').fadeIn('slow');
$(".Standard").hide();
$(".Express").hide();
$(".Mentoring").hide();
$("#ChooseRate").hide();
}
}
function setVisibilityForFreeCaseElements(isVisible) {
var HasFreeCaseCredit = $("#HasFreeCaseCredit").attr("data-freecasecredit");
if (isVisible) {
$("#SendFreeCase").show();
$('#SendCase').hide();
if (HasFreeCaseCredit != "True")
$("#freecasecreditmsg").css("display", "block");
else
$("#freecasecreditmsg").css("display", "none");
}
else {
$("#SendFreeCase").hide();
$('#SendCase').show();
$("#freecasecreditmsg").css("display", "none");
}
}
function openFindConsultant() {
$("#FindConsultant").click();
}
function ClearPaymentOptions() {
HidePaymentOption();
$('#PaymentInfoModel_CardholderName').val('');
$('#PaymentInfoModel_CardholderLastName').val('');
$('#PaymentInfoModel_CardNumber').val('');
$('#PaymentInfoModel_CardCode').val('');
$("#PaymentInfoModel_ExpireMonth").val($("#PaymentInfoModel_ExpireMonth option:first").val());
$("#PaymentInfoModel_ExpireYear").val($("#PaymentInfoModel_ExpireYear option:first").val());
$("#PaymentInfoModel_CreditCardType").val($("#PaymentInfoModel_CreditCardType option:first").val());
}
function ShowErrorConfirmDialog(error) {
setTimeout(function () {
function aEConfirm() {
$("#closeHref").click();
$("#FindConsultant").modal('hide');
}
commonConfirmPopup(POCResources.ConsultingCase, error, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, aEConfirm, cFalseCallback, cFalseCallback);
}, 500);
}
function SendFreeCase(consultantId, consultantSpeciality, rateType, IsAlreadyCheckedFreeCase) {
CalculateTimeZone();
var note = $("#AddNoteText").text();
$("#loadingWithBG").show();
setTimeout(function () {
$.ajax({
url: "/Consulting/SendFreeCase",
type: 'Post',
datatype: 'json',
data: { PatientId: PatientId, consultantId: consultantId, consultantSpeciality: consultantSpeciality, note: note, rateType: rateType, currentTime: fulltime, IsAlreadyChecked: IsAlreadyCheckedFreeCase },
async: false,
success: function (data) {
$("#loadingWithBG").hide();
$(".confirmation-modal").modal('hide');
FirstAvailableCase = "";
if (data.success == true || data.Status == "Success") {
$('#choosePrice, .cstpopshadow').fadeOut('slow');
if (data.ConsultingReceiverId > 0) {
$('#OrderPlacedNotificationLi').attr('data-id', data.ConsultingReceiverId);
$('#OrderPlacedNotificationLi').attr('data-customerName', data.ConsultantName);
$('#OrderPlacedNotificationLi').attr('data-RootPatientId', data.RootPatientId);
$('#OrderPlacedNotificationLi').find('.DirectMessageToConversation').trigger('click');
} else {
setTimeout(function () {
function aEConfirm() {
$("#closeHref").click();
$("#FindConsultant").modal('hide');
}
commonConfirmPopup('Case sent', data.Message, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, aEConfirm, cFalseCallback, cFalseCallback);
//commonConfirmPopup('Case sent', data.Message, cBYes, cBNo, cBCTheme, cBCDefault, cMCsm, aEConfirm, cFalseCallback, cFalseCallback);
}, 500);
}
//window.location.href = "";
}
else if (data.Status == "CaseExist") {
setTimeout(function () {
function aEConfirm() {
SendFreeCase(consultantId, consultantSpeciality, rateType, 1);
}
commonConfirmPopup('Already Exists', data.Message, cBYes, cBNo, cBCTheme, cBCDefault, cMCsm, aEConfirm, cFalseCallback, cFalseCallback);
}, 500);
}
else if (data.Status == "AlreadyExist") {
setTimeout(function () {
function aEConfirm() {
$("#closeHref").click();
$("#FindConsultant").modal('hide');
setTimeout(openFindConsultant, 2000);
}
commonConfirmPopup('Already Exists', data.Message, cBYes, cBNo, cBCTheme, cBCDefault, cMCsm, aEConfirm, cFalseCallback, cFalseCallback);
}, 500);
}
else {
$('#choosePrice, .cstpopshadow').fadeOut('slow');
ShowErrorConfirmDialog(data.Message);
}
},
error: function () {
//alert("Something went wrong. Please try after sometime.");
var cTextReload = 'Something went wrong. Please try after sometime.';
commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback);
}
});
}, 100);
}
function AddToConsulting(patientID, sendToID, price, returnBy, type, priceType) {
var note = $("#AddNoteText").text();
$("#loadingWithBG").show();
$.ajax({
url: "/ShoppingCart/AddConsultingProductToCart",
type: 'Post',
datatype: 'json',
data: { PatientId: patientID, sendToID: sendToID, _price: parseFloat(price), ReturnBy: returnBy, note: note, Type: type, PriceType: priceType, IsAlreadyChecked: IsAlreadyChecked },
async: false,
success: function (data) {
$("#loadingWithBG").hide();
if (data.success == true) {
//window.location.href = "/cart";
ShowConsultingCheckout(patientID, sendToID, price, returnBy, note, type, priceType, data.productid, data.description, data.price, data.Impersonate, "","", "");
}
else if (data.Status == "AlreadyExist") {
setTimeout(function () {
function aEConfirm() {
IsAlreadyChecked = 1;
$("#choosePrice .SendCase").click();
IsAlreadyChecked = 0;
}
function aECancel() {
IsAlreadyChecked = 0;
}
commonConfirmPopup('Already Exists', data.Message, cBYes, cBNo, cBCTheme, cBCDefault, cMCsm, aEConfirm, aECancel, cFalseCallback);
}, 500);
}
else if (data.Status == "MentoringSuccess") {
if (data.ConsultingReceiverId > 0) {
$('#OrderPlacedNotificationLi').attr('data-id', data.ConsultingReceiverId);
$('#OrderPlacedNotificationLi').attr('data-customerName', data.ConsultantName);
$('#OrderPlacedNotificationLi').attr('data-RootPatientId', data.RootPatientId);
$('#OrderPlacedNotificationLi').find('.DirectMessageToConversation').trigger('click');
} else {
$('#choosePrice, .cstpopshadow').fadeOut('slow');
ShowErrorConfirmDialog(data.Message);
}
}
else {
$('#choosePrice, .cstpopshadow').fadeOut('slow');
ShowErrorConfirmDialog(data.Message);
}
},
error: function () {
//alert("Something went wrong. Please try after sometime.");
var cTextReload = 'Something went wrong. Please try after sometime.';
commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback);
}
});
}
function FilterClearButtonDisable() {
if ($("#countrysel").val() == '0' && ($("#statesel").val() == "" || $("#statesel").val() == "0") && $("#citysel").val() == "" && ($("#languagesel").val() == "" || $("#languagesel").val() == "0")) {
$('.clsClearFilter').attr("disabled", "disabled");
}
else {
$('.clsClearFilter').removeAttr("disabled");
}
}
$(document).ready(function () {
rowno();
Fstar();
$('.cico .fa, .itip').tooltip({
track: true
});
if ($('body').hasClass('.dental_cad')) {
$('#smilestream_form').insertAfter('.flex-container');
}
else {
$('#smilestream_form').insertAfter('#container');
}
$('.contryTip').tooltip({
track: true,
content: function () {
return $(this).prop('title');
}
});
$('#consulting_orderplaced').insertAfter('.mFlex');
$(document).off('click', '.jsMentoringList');
$(document).on('click', '.jsMentoringList', function () {
var dataId = $(this).attr('data-Id');
$('#' + dataId).toggleClass('hide');
});
$(document).off('change', ".clsCountryBilling");
$(document).on('change', ".clsCountryBilling", function () {
var _this = this;
var stateCtrl = $('.clsStateBilling');
var hStateId = $('#billing_hStateId');
var result = changeCountry(_this, stateCtrl, hStateId);
return result;
});
$(document).off('click', '.pTermModal');
$(document).on('click', '.pTermModal', function () {
function cAddiMCallBack() {
$('.addiM').closest('.modal').addClass('consultTermModal');
}
$(this).addClass('active');
var cTitle = 'Terms';
var cText = $(this).next('.popData').html();
var cMClass = 'modal-lg addiM';
var cAdiCallBack = cAddiMCallBack;
commonConfirmPopup(cTitle, cText, cBClose, cBCancel, cBCDefault, cBCHide, cMClass, cFalseCallback, cFalseCallback, cAdiCallBack)
});
$(document).on('hidden.bs.modal', '.consultTermModal', function () {
$('.pTermModal').removeClass('active');
});
$(document).off('change', ".clsCountry");
$(document).on('change', ".clsCountry", function () {
var _this = this;
var stateCtrl = $('.clsState');
if (!IsOffline && ($.trim($(_this).val()) == '' || $(_this).val() == '0')) {
$(stateCtrl).empty();
$(stateCtrl).html('');
$(stateCtrl).val(0).removeClass('fieldEmpty').next('.error').hide();
return false;
}
$("#loadingWithBG").show();
$.ajax({
url: "/SessionLess/getStateList/",
type: 'POST',
// dataType: 'json',
async: "false",
data: { CountryId: $(_this).val() },
success: function (data) {
$(stateCtrl).empty();
$(stateCtrl).html(data);
$("#loadingWithBG").hide();
if ($('#hStateId').val() != '') {
$('#UserState').val($('#hStateId').val()).removeClass('fieldEmpty').next('.error').hide();
}
if ($(_this).attr('data-statename') != undefined) {
$(stateCtrl).val($(stateCtrl).find('option').filter(function () {
return $(this).html() == $(_this).attr('data-statename') || $(_this).attr('data-statename').indexOf($(this).html()) >= 0;
}).val()).removeClass('fieldEmpty').next('.error').hide();
//$(_this).removeAttr('data-statename');
}
if ($(stateCtrl).val() == null || $(stateCtrl).val() == '0') {
$(stateCtrl).val(0).addClass('fieldEmpty').next('.error').text($.parseHTML(requiredErrorMessage)[0].data).hide()
}
if ($(stateCtrl).find('option').length == 1) {
$('.jsAddressDetail').removeClass('hide');
}
},
error: function (xhr, status, error) {
$("#loadingWithBG").hide();
//alert(xhr.responseText);
}
});
});
$('.flex-flexible').scroll(function () {
var popId = $('body > .popover').attr('id');
$('[aria-describedby="' + popId + '"]').click();
});
$('.form-control:not(.notreq)').off('keyup');
$('.form-control:not(.notreq)').on('keyup', function () {
if ($(this).val() != '') {
$(this).removeClass('fieldEmpty');
$(this).next('.error').hide();
}
else {
$(this).addClass('fieldEmpty');
$(this).next('.error').text($.parseHTML(requiredErrorMessage)[0].data).show();
}
});
$('.adDetail select.form-control:not(.notreq)').off('change');
$('.adDetail select.form-control:not(.notreq)').on('change', function () {
if ($(this).val() != '0' && $(this).val() != '') {
$(this).removeClass('fieldEmpty');
$(this).next('.error').hide();
}
else {
$(this).addClass('fieldEmpty');
$(this).next('.error').text($.parseHTML(requiredErrorMessage)[0].data).show();
}
});
$(document).off('click', 'input[name="priceopt"]');
$(document).on('click', 'input[name="priceopt"]', function () {
$("#errormsg").css("display", "none")
//do stuff
});
$(document).off('click', '.clsClearFilter');
$(document).on('click', '.clsClearFilter', function () {
sortingLocation = {};
$('#countrysel').val('0');
$('#statesel').val('0');
$('#citysel').val('');
$('#languagesel').val('0');
FilterClearButtonDisable();
$('.asc_btn').click();
});
$(document).off('click', '.ssformclick');
$(document).on('click', '.ssformclick', function () {
$('#PatientTransfer').modal('show');
$('#title_patient_copy').text($.parseHTML(POCResources.SendPatientFile)[0].data);
$('#opt_consultant').hide();
$('#opt_other_office').hide();
$('#opt_transfer_file').hide();
$('#opt_referral_file').hide();
$('#ddl_destination').val('colleague');
});
$(document).off('shown.bs.modal', '#PatientTransfer');
$(document).on('shown.bs.modal', '#PatientTransfer', function () {
$('.destiSel').bind('change', function () {
var destiSelCls = $(this).val();
});
$('.destiSel').val('colleague').trigger('change');
});
$(document).off('show.bs.modal', '#find_new_consultant')
$(document).on('show.bs.modal', '#find_new_consultant', function () {
$('.clsCountry').trigger('change');
$('.clsCountryBilling').trigger('change');
});
$(document).off('click', '#smilestream_form .close');
$(document).on('click', '#smilestream_form .close', function () {
$('#smilestream_form').modal('hide');
});
$(document).off('click', 'input[name="SBDRadio"]');
$(document).on('click', 'input[name="SBDRadio"]', function () {
if ($(this).is(':checked')) {
$('.sbdTable tr').removeClass('selected');
$(this).closest('tr').addClass('selected');
}
});
$(document).off('change', '.sbdTable input[type="checkbox"]');
$(document).on('change', '.sbdTable input[type="checkbox"]', function () {
if ($(this).is(':checked')) {
$(this).closest('tr').addClass('selected');
}
else {
$(this).closest('tr').removeClass('selected');
}
});
$(document).off('click', '.consultantsdiv .sorting');
$(document).on('click', '.consultantsdiv .sorting', function (e) {
if ($(e.target).hasClass('infoClick')) {
return false;
}
var sortingColumn = $(this).attr('data-sorting');
if (sortingColumn == "Name") {
if ($(this).hasClass('asc')) {
$(this).removeClass('asc').addClass('desc');
datasort("desc", true);
}
else if ($(this).hasClass('desc')) {
$(this).removeClass('desc').addClass('asc');
datasort("asc", true);
}
else {
$(this).removeClass('desc').addClass('asc');
datasort("asc", true);
}
} else {
$('.cstpopshadow').fadeIn('slow');
if (sortingColumn == "Country") {
$('#filter_pop').fadeIn('slow', function () {
if (typeof (sortingLocation.Country) != "undefined") {
$('#countrysel').val(sortingLocation.Country);
$('#countrysel').change();
}
if (typeof (sortingLocation.City) != "undefined") {
$('#citysel').val(sortingLocation.City);
}
if (typeof (sortingLocation.Language) != "undefined") {
$('#languagesel').val(sortingLocation.Language);
}
});
FilterClearButtonDisable();
}
else {
$('#sorting_pop').fadeIn('slow');
}
if ($(this).hasClass('actsort')) {
$(this).addClass('actsort');
}
else {
$('.sorting').removeClass('actsort');
$(this).addClass('actsort');
}
}
});
$(document).off('change', 'input[name="sortingopt"]');
$(document).on('change', 'input[name="sortingopt"]', function () {
var btnNAttr = $(this).val().replace('s_', '');
if ($(this).closest('.cstpopindiv').children('.cstpopFooter').length == 0) {
$(this).closest('.cstpopindiv').append('');
} else {
$(this).closest('.cstpopindiv').find('.cstpopFooter').html('' +
'');
}
});
$(document).off('click', '.asc_btn');
$(document).on('click', '.asc_btn', function () {
datasort("asc", false);
});
$(document).off('click', '.desc_btn');
$(document).on('click', '.desc_btn', function () {
datasort("desc", false);
});
$(document).off('click', '.movedown');
$(document).on('click', '.movedown', function () {
$('.ui-tooltip').remove();
});
$(document).off('click', '.moveup');
$(document).on('click', '.moveup', function () {
$('.ui-tooltip').remove();
var crindex = $(this).closest('.group').index() + 1,
crindexUp = $(this).closest('.group').index();
$('.group:nth-child(' + crindex + ')').insertBefore($('.group:nth-child(' + crindexUp + ')'));
rowno();
});
$(document).on('click', function (e) {
$('[data-toggle="popover"],[data-original-title]').each(function () {
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
(($(this).popover('hide').data('bs.popover') || {}).inState || {}).click = false // fix for BS 3.3.6
}
});
});
$(document).off('hidden.bs.modal', '#find_new_consultant');
$(document).on('hidden.bs.modal', '#find_new_consultant', function () {
$('#find_new_consultant .popover').remove();
if ($('.smenu #FindConsultant').parent().hasClass('active')) {
$('.smenu #FindConsultant').parent().removeClass('active');
$('.smenu .pastActive').addClass('active').removeClass('pastActive');
}
if ($('.sepheader .patform_pos').length > 0) {
$('.pCapsuleDiv .capculedesign').prependTo($('.sepheader .patform_pos'));
}
});
$(document).on('click', '.jsPatientCapsule', function () {
if($('.mobPatform_pos').hasClass('open')){
$('.mobPatform_pos').removeClass('open');
$(this).removeClass('active');
}else{
$('.mobPatform_pos').addClass('open');
$(this).addClass('active');
}
});
$(document).on('click', '.jsMobFilterPane', function () {
if($('.mobFilterPane').hasClass('open')){
$('.mobFilterPane').removeClass('open');
$(this).removeClass('active');
}else{
$('.mobFilterPane').addClass('open');
$(this).addClass('active');
}
});
$(document).off('click', '.cstcommon .commonbtn');
$(document).on('click', '.cstcommon .commonbtn', function (e) {
var crid = $(this).attr('href');
var cridt = $(this).attr('href').replace('#', '');
if ($(crid).hasClass('crshow')) {
$(crid).fadeIn('slow');
$(crid).addClass('crshow');
$('button[name="' + cridt + '_mf"]').removeClass('hide');
}
else {
if (crid == '#referal') {
$('tr.group>td>a').removeClass('cstpop');
}
$('.crshow').fadeOut('slow', function () {
$(crid).fadeIn('slow');
$('.crshow').removeClass('crshow').addClass('crhide');
$(crid).removeClass('crhide').addClass('crshow');
$('.btnPlace .btn-theme').addClass('hide');
$('button[name="' + cridt + '_mf"]').removeClass('hide');
});
$('.cstcommon .commonbtn').addClass('default');
$(this).removeClass('default');
}
});
$(document).off('click', '.cstpop');
$(document).on('click', '.cstpop', function (e) {
e.preventDefault();
$('.replaceconsultant .crblock input[type="radio"]').prop('checked', false);
$('.replaceconsultant .form-group:eq(3) input[type="radio"]').prop('checked', false);
$('.replaceconsultant, .cstpopshadow').fadeOut();
$('.replaceconsultant .form-group:eq(3), .replaceconsultant h2:eq(1)').addClass('hide');
$('.replaceconsultant, .cstpopshadow').fadeIn('slow');
$(this).closest('tbody').children('tr').removeClass('active');
$(this).closest('tr').addClass('active');
});
$(document).off('change', '.replaceconsultant .crblock input[type="radio"]');
$(document).on('change', '.replaceconsultant .crblock input[type="radio"]', function () {
if (!$(this).hasClass('no')) {
$('.replaceconsultant .form-group:eq(3), .replaceconsultant h2:eq(1)').removeClass('hide');
} else {
$('.replaceconsultant .form-group:eq(3), .replaceconsultant h2:eq(1)').addClass('hide');
}
});
$(document).off('change', '.replaceconsultant .form-group:eq(3) input[type="radio"]');
$(document).on('change', '.replaceconsultant .form-group:eq(3) input[type="radio"]', function () {
var fgindex = $(this).closest('.form-group').index();
var rtext = $(this).next('span').text();
var rtrw = $(this).closest('.consultantsdiv').children('.consulttable2').children('tbody').find('tr:eq(' + fgindex + ')');
var rtract = $(this).closest('.consultantsdiv').children('.consulttable2').children('tbody').find('tr.active');
var rtractindex = $(this).closest('.consultantsdiv').children('.consulttable2').children('tbody').find('tr.active').index() + 1;
var rtractplace = $(this).closest('.consultantsdiv').children('.consulttable2').children('tbody').find('tr:eq(' + rtractindex + ')');
rtract.insertBefore(rtrw);
rtract.removeClass('active').addClass('group');
rtract.find('td>a').removeClass('cstpop');
rtrw.insertBefore(rtractplace);
rtrw.removeClass('group');
rtrw.find('td>a').addClass('cstpop');
$('.replaceconsultant .form-group:eq(3), .replaceconsultant h2:eq(1)').addClass('hide');
$('.replaceconsultant, .cstpopshadow').fadeOut('slow');
});
$(document).off('click', 'input.no, .cstpopshadow, .cstClose');
$(document).on('click', 'input.no, .cstpopshadow, .cstClose', function () {
$('.replaceconsultant .form-group:eq(3), .replaceconsultant h2:eq(1)').addClass('hide');
$('.cstpopover, .cstpopshadow').fadeOut('slow');
$('.sorting').removeClass('actsort');
});
$(document).off('click', '.cstpopover');
$(document).on('click', '.cstpopover', function (e) {
if (e.target !== this)
return;
$('.replaceconsultant .form-group:eq(3), .replaceconsultant h2:eq(1)').addClass('hide');
$('.cstpopover, .cstpopshadow').fadeOut('slow');
});
$(document).off('click', '#consult .fsl .subdata');
$(document).on('click', '#consult .fsl .subdata', function () {
var subid = $(this).attr('href');
var servicetxt = $(this).text();
$(this).closest('.fsl').slideUp('slow', function () {
$(subid).find('.servicetxt').html('');
$(subid).slideDown('slow');
$(subid).find('.servicetxt').html('' + servicetxt + '');
});
});
$(document).off('click', '#consult .sback');
$(document).on('click', '#consult .sback', function (e) {
e.preventDefault();
var stabid = $(this).attr('href');
$(this).closest(stabid).slideUp('slow', function () {
$('.fAvailable').find('.fAName').removeClass('orangetext').addClass('hide');
$('.fAvailable').find('.fAName').parent().children('span').removeClass('fAP');
$('.fAvailable').find('.fAs').children('a').removeClass('hide');
$('.fAvailable').find('.fAs').children('strong').remove();
$('.fAvailable').find('.fAs').addClass('nofz');
$('.fsl').slideDown('slow');
});
});
$(document).off('click', '#consult .fnc .sright .commonbtn');
$(document).on('click', '#consult .fnc .sright .commonbtn', function (e) {
e.preventDefault();
var clickclass = $(this).attr('href');
if (clickclass == 's100') {
$('.specialtydiv').addClass('s25');
$('.consultantsdiv').addClass('s100');
$('.consultantsdiv').find('.sleft').html('');
}
});
$(document).off('click', '#consult .sleft .commonbtn');
$(document).on('click', '#consult .sleft .commonbtn', function (e) {
e.preventDefault();
var clickclass = $(this).attr('href');
if (clickclass == 's25') {
$('.specialtydiv').removeClass('s25');
$('.consultantsdiv').removeClass('s100');
$('.consultantsdiv').find('.sleft').children('.commonbtn').remove();
}
});
$(document).off('click', '#consult .addcardbtn');
$(document).on('click', '#consult .addcardbtn', function (e) {
e.preventDefault();
var adclass = $(this).attr('href');
if ($('.' + adclass).is(':visible')) {
$('.' + adclass).slideUp('slow', function () {
$('.paycards').slideDown('slow');
});
}
else {
$('.paycards').slideUp('slow', function () {
$('.' + adclass).slideToggle('slow');
});
}
});
$('#find_new_consultant').off('click', '.fnc .sright .commonbtn');
$('#find_new_consultant').on('click', '.fnc .sright .commonbtn', function (e) {
e.preventDefault();
var clickclass = $(this).attr('href');
if (clickclass == 's100') {
$('.specialtydiv').addClass('s25');
$('.consultantsdiv').addClass('s100');
$('.consultantsdiv').find('.sleft').html('');
}
});
$('#find_new_consultant').off('click', '.sleft .commonbtn');
$('#find_new_consultant').on('click', '.sleft .commonbtn', function (e) {
e.preventDefault();
var clickclass = $(this).attr('href');
if (clickclass == 's25') {
$('.specialtydiv').removeClass('s25');
$('.consultantsdiv').removeClass('s100');
$('.consultantsdiv').find('.sleft').children('.commonbtn').remove();
}
});
$('#find_new_consultant').off('click', 'td > .pinfo');
$('#find_new_consultant').on('click', 'td > .pinfo', function () {
var pfname = $(this).closest('tr').children('td:eq(0)').text();
var pftitle = pfname.replace(pfname, pfname + ' Profile Information');
$('#pinfo_name').text(pftitle);
$('.pname').text(pfname);
});
$(document).off('hidden.bs.modal', '#consulting_checkout');
$(document).on('hidden.bs.modal', '#consulting_checkout', function () {
$('#consulting_checkout #paymentError').hide();
});
$(document).off('shown.bs.modal', '#consulting_checkout');
$(document).on('shown.bs.modal', '#consulting_checkout', function () {
$('#consulting_checkout #CurrentPaymentProfile').change();
});
$(document).off('change', 'input[type="radio"][name="replacewhichcons"]');
$(document).on('change', 'input[type="radio"][name="replacewhichcons"]', function () {
var idreplace = $('input[type="radio"][name="replacewhichcons"]:checked').attr('id').replace('r', '');
var currenttdtext = $('#' + idreplace).children('td:eq(0)').text();
$('#' + idreplace).children('td:eq(0)').html('' + currenttdtext + '');
var currenthtml = $('#' + idreplace).html();
trhtml = trhtml.replace(firsttdhtml, '' + firsttdtext + '');
$('#' + idreplace).html(trhtml);
$(currenttr).html(currenthtml);
$('.replaceconsultant, .cstpopshadow').fadeOut('slow');
$('td').off('click', '.pinfo');
$('td').on('click', '.pinfo', function () {
var pfname = $(this).closest('tr').children('td:eq(0)').text();
var pftitle = pfname.replace(pfname, pfname + ' Profile Information');
$('#pinfo_name').text(pftitle);
$('.pname').text(pfname);
});
});
var IsRequiredPreValueNote = false;
$(document).off('click', '.FindConsultantaddNote');
$(document).on('click', '.FindConsultantaddNote', function () {
var prevNoteValue = $('#AddNoteText').text();
if (IsRequiredPreValueNote) { IsRequiredPreValueNote = false; prevNoteValue = ""; }
$('#FindConsultantnoteMdl').appendTo($('body'));
$('#FindConsultantnoteMdl').modal('show');
$('#NoteText').val(prevNoteValue);
commonfroalaEditor('#NoteText', frNoteToolbar);
});
$(document).off('click', '#FindConsultantnoteMdlSave');
$(document).on('click', '#FindConsultantnoteMdlSave', function () {
var editorVal = $('#NoteText').froalaEditor('html.get', true);
$('#NoteText').val(editorVal);
if ($($("#NoteText").val()).text().trim() != "") {
$('#AddNoteText').text($("#NoteText").val());
}
else {
$('#AddNoteText').text('');
}
$('#FindConsultantnoteMdl').modal('hide');
});
//To show profile information of consultant
$(document).off('click', '.GetConsultantInfo');
$(document).on('click', '.GetConsultantInfo', function () {
$("#CityInfo").empty();
$("#ZipInfo").empty();
$("#StateInfo").empty();
$("#CountryInfo").empty();
$("#LanguageInfo").empty();
$("#FullName").empty();
var CustomerName = $(this).attr("name");
var Cityname = $(this).closest('tr').find('.cityname').text();
var zipcode = $(this).closest('tr').find('.zipcode').text();
var Statename = $(this).closest('tr').find('.statename').text();
var CountryName = $(this).closest('tr').find('.countryname').text();
var Language = $(this).closest('tr').find('.language').text();
$("#FullName").append(CustomerName);
$("#CityInfo").append(Cityname);
$("#ZipInfo").append(zipcode);
$("#StateInfo").append(Statename);
$("#CountryInfo").append(CountryName);
$("#LanguageInfo").append(Language);
});
//On consultant's name click
$(document).off('click', '.MakeFavourite');
$(document).on('click', '.MakeFavourite', function () {
Consultantid = $(this).attr("name");
$("#whichone").hide();
});
$(document).off('click', '.SendFreeCaseImmediately');
$(document).on('click', '.SendFreeCaseImmediately', function () {
$("#SendCase").hide();
setVisibilityForFreeCaseElements(true);
ConsultantId = $(this).attr('name');
PatientId = $(this).attr('data-patientId');
//first available
if (ConsultantId == 0) {
$('.first_available_specialty').removeClass('hide');
FirstAvailableCase = true;
FirstAvailableReturnby = $(this).attr("data-returnby");
FirstAvailableRate = $("#FirstAvailable").attr("name");
// PatientId = $("#FirstAvailable").attr("class");
selectedFirstAvailableSpacialty = $(this).attr("data-speciality");
$('#choosePrice, .cstpopshadow').fadeIn('slow');
$(".Standard").hide();
$(".Express").hide();
$(".Mentoring").hide();
$("#ChooseRate").hide();
$("#errormsg").css("display", "none");
}
else {
$('.first_available_specialty').addClass('hide');
ConsultantSpeciality = $(this).attr('data-freecasespeciality');
CheckConsultantSpecialities(1);
}
});
$(document).off('click', '.SelectSpeciality');
$(document).on('click', '.SelectSpeciality', function () {
$('.first_available_specialty').addClass('hide');
$("#errormsg").css("display", "none");
$("#freecasecreditmsg").css("display", "none");
FirstAvailableCase = false;
IsRequiredPreValueNote = true;
ConsultantId = $(this).attr('name');
ConsultantSpeciality = $(this).attr('id');
PatientId = $(this).attr("data-patientId");
AcceptsFreeCase = $(this).attr('data-freecase');
HasFreeCase = $(this).attr('data-hasfreecase');
RepeatFreeCase = $(this).attr('data-repeatfreecase');
$("#SendCase").show();
// if (AcceptsFreeCase == "True" && (HasFreeCase == "True" || RepeatFreeCase == "True") && (RateType == "" || RateType == "Standard")) {
//if (AcceptsFreeCase == "True" && (HasFreeCase == "True" || RepeatFreeCase == "True")) {
// $("input[value='Standard'].PriceType").click();
//}
//setVisibilityForFreeCaseElements(false);
$("input[value='Standard'].PriceType").click();
CheckConsultantSpecialities();
});
$(document).off('click', '.PriceType');
$(document).on('click', '.PriceType', function () {
RateType = $(this).val();
var freeCaseEl = $("#SendFreeCase");
if (freeCaseEl != null)
//if (RateType != "Mentoring") {
// setVisibilityForFreeCaseElements(false);
//}
//else
if ((RateType == "Standard" || RateType == "Mentoring") && AcceptsFreeCase == "True" && (HasFreeCase == "True" || RepeatFreeCase == "True")) {
setVisibilityForFreeCaseElements(true);
} else {
setVisibilityForFreeCaseElements(false);
}
});
//Send Free Case
$(document).off('click', '.SendFreeCase');
$(document).on('click', '.SendFreeCase', function () {
// First Available never being send as free case now, so code is commented.
//if (FirstAvailableCase != null && FirstAvailableCase != "") {
// if (FirstAvailableCase == true) {
// if (selectedFirstAvailableSpacialty != "" && selectedFirstAvailableSpacialty != null && selectedFirstAvailableSpacialty != undefined) {
// SendFreeCase(0, "AvailableFlatRate_" + selectedFirstAvailableSpacialty, "AvailableFlatRate_" + selectedFirstAvailableSpacialty, 0);
// return;
// } else
// CommonResponseDialog("Direct send case", "Please select specialty.", function () { });
// }
//}
if (RateType != null && RateType != "") {
SendFreeCase(ConsultantId, ConsultantSpeciality, RateType, 0);
//SendFreeCase(ConsultantId, ConsultantSpeciality, "Mentoring", 0);
}
else {
$("#loadingWithBG").hide();
$("#errormsg").css("display", "block")
}
});
$(document).off('click', '.SendCase');
$(document).on('click', '.SendCase', function () {
if (IsColleagueCase == false) {
$("#loadingWithBG").show();
var SendCaseDirectly = true;
CalculateTimeZone();
setTimeZoneCookie();
if (FirstAvailableCase != null && FirstAvailableCase != "") {
if (FirstAvailableCase == true) {
if (selectedFirstAvailableSpacialty != "" && selectedFirstAvailableSpacialty != null && selectedFirstAvailableSpacialty != undefined) {
$.ajax({
url: "/Consulting/IsValidSendFirstAvailable",
type: 'Post',
datatype: 'json',
data: { patientID: PatientId, speciality: "AvailableFlatRate_" + selectedFirstAvailableSpacialty },
async: false,
success: function (data) {
if (data.validMessage == "Success") {
$("#consulting_checkout .product-name").text('Consulting: Patient ' + data.PatientName);
AddToConsulting(PatientId, 0, FirstAvailableRate, FirstAvailableReturnby, "Paid", "AvailableFlatRate_" + selectedFirstAvailableSpacialty);
} else {
$("#loadingWithBG").hide();
CommonResponseDialog(POCResources.Sendcase, data.validMessage, function () { });
}
},
error: function () {
$("#loadingWithBG").hide();
alert("Something went wrong. Please try after sometime.");
},
complete: function () {
$("#loadingWithBG").hide();
}
});
}
else {
$("#loadingWithBG").hide();
CommonResponseDialog(POCResources.Sendcase, "Please select specialty.", function () { });
}
}
}
else {
if (RateType != null && RateType != "") {
$("#loadingWithBG").show();
$.ajax({
url: "/Consulting/CaseDetails",
type: 'Post',
datatype: 'json',
data: { patientID: PatientId, ConsultantId: ConsultantId, ConsultantSpeciality: ConsultantSpeciality, CurrentTime: fulltime, RateType: RateType },
async: false,
success: function (data) {
if (data.Status == "MentoringExist") {
commonConfirmPopup('Warning', data.Message, cBOk, cBNo, cBCTheme, cBCHide, cMCsm, cFalseCallback, cFalseCallback, cFalseCallback);
}
else if (data != null) {
$("#consulting_checkout .product-name").text("Consulting: Patient " + data.PatientName);
AddToConsulting(data.PatientId, ConsultantId, data.Rate, data.ReturnBy, "Paid", data.PriceType);
} else {
// alert("Something went wrong. Please try after sometime.");
var cTextReload = 'Something went wrong. Please try after sometime.';
commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback);
}
},
error: function () {
// alert("Something went wrong. Please try after sometime.");
var cTextReload = 'Something went wrong. Please try after sometime.';
commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback);
},
complete: function () {
$("#loadingWithBG").hide();
}
});
}
else {
$("#loadingWithBG").hide();
$("#errormsg").css("display", "block")
}
}
} else if (allStudents != null && allStudents.length > 0) {
$('#choosePrice, .cstpopshadow').fadeOut('slow');
$("#loadingWithBG").show();
$.ajax({
url: "/Colleague/TransferCaseForStudent",
type: 'Post',
datatype: 'json',
data: { allStudentIDs: allStudents, note: $("#AddNoteText").text(), specialization: 2 },
async: true,
success: function (data) {
if (data == false) {
window.location.reload();
}
$("#loadingWithBG").hide();
if (data != null && data.length > 0) {
// $('#choosePrice, .cstpopshadow').fadeOut('slow');
//var html = "First Name | Last Name | Email | Message |
";
var html = "User name | Message |
";
$.each(data, function (index, value) {
html += "";
html += "" + value.FirstName + " " + value.LastName + " (" + value.Email + ") | ";
html += "" + value.Message + " | ";
html += "
";
});
html += "
";
CommonResponseDialog("Direct send case", html, function () { });
}
},
error: function () {
$("#loadingWithBG").hide();
CommonResponseDialog("Direct send case", "Something went wrong. Please try after sometime.", function () { window.location.reload(); });
}
});
}
else {
$("#loadingWithBG").show();
$.ajax({
url: "/Colleague/TransferCaseColleague",
type: 'Post',
datatype: 'json',
data: { sendToID: ConsultantId, note: $("#AddNoteText").text(), speciality: ConsultantSpeciality, specialization: 1 },
async: false,
success: function (data) {
if (data.Status == false) {
window.location.reload();
}
$('#choosePrice, .cstpopshadow').fadeOut('slow');
commonConfirmPopup(POCResources.ColleagueCase, data.Message, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cFalseCallback, cFalseCallback, cFalseCallback);
},
error: function () {
// alert("Something went wrong. Please try after sometime.");
var cTextReload = 'Something went wrong. Please try after sometime.';
commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback);
}
});
}
//$('#consulting_checkout').modal('show');
//$('.cstClose').click();
});
$(document).off('click', '.FirstAvailableCase');
$(document).on('click', '.FirstAvailableCase', function () {
if ($(this).attr('data-hasfreecase') == "True") {
FirstAvailableCase = true;
} else {
FirstAvailableCase = true;
$("#SendFreeCase").hide();
$("#freecasecreditmsg").css("display", "none");
}
$('.first_available_specialty').removeClass('hide');
$("#SendCase").show();
$("#AddNoteText").text('');
FirstAvailableReturnby = $(this).attr("name");
FirstAvailableRate = $(this).attr("data-flatRate");
PatientId = $("#FirstAvailable").attr("class");
selectedFirstAvailableSpacialty = $(this).attr("id");
$('#choosePrice, .cstpopshadow').fadeIn('slow');
$(".Standard").hide();
$(".Express").hide();
$(".Mentoring").hide();
$("#ChooseRate").hide();
$(".SendFreeCase").hide();
$("#errormsg").css("display", "none");
});
//Transfer Case from Find Consulting Screen
//To put consultant into fav list or to replace consultant from fav list
$(document).off('click', '#OpenReplacedConsultants');
$(document).on('click', '#OpenReplacedConsultants', function () {
CalculateTimeZone()
$.ajax({
url: "/Consulting/NumberofFavoriteConsultants",
type: 'POST',
dataType: 'json',
async: false,
success: function (data) {
if (data == true) {
$("#whichone").show();
}
else {
var FavConsultantId = Consultantid;
$.ajax({
url: "/Consulting/MakeConsultantsFavourite",
type: 'POST',
dataType: 'json',
data: { FavConsultantId: FavConsultantId },
async: false,
success: function (data) {
if (data != false) {
if (data == true) {
$.ajax({
url: "/Consulting/FindConsultant/",
type: 'POST',
dataType: 'html',
data: { CurrentTime: fulltime },
async: false,
success: function (data) {
$("#find_new_consultant").html(data);
$('#find_new_consultant .modal').insertAfter($('.mFlex'));
var dataisrc = $('.AFC').attr('data-src'),
dataialt = $('.AFC').attr('data-alt');
if (!$('.AFC').children('img').length > 0) {
$('.AFC').append('
');
}
$("#find_new_consultant").show();
}
});
}
}
else {
// alert("Something went wrong. Please try after sometime.");
var cTextReload = 'Something went wrong. Please try after sometime.';
commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback);
}
},
error: function () {
// alert("Something went wrong. Please try after sometime.");
var cTextReload = 'Something went wrong. Please try after sometime.';
commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback);
}
});
}
}
});
});
//To replace consultant with another fav consultant
$(document).off('click', '.ConfirmFavourite');
$(document).on('click', '.ConfirmFavourite', function () {
CalculateTimeZone()
var FavConsultantId = Consultantid;
var ToBeReplaced = $(this).attr("id");
$.ajax({
url: "/Consulting/MakeConsultantsFavourite",
type: 'POST',
dataType: 'json',
data: { FavConsultantId: FavConsultantId, ToBeReplaced: ToBeReplaced },
async: false,
success: function (data) {
if (data != false) {
if (data == true) {
$.ajax({
url: "/Consulting/FindConsultant/",
type: 'POST',
dataType: 'html',
data: { CurrentTime: fulltime },
async: false,
success: function (data) {
$("#find_new_consultant").html(data);
$('#find_new_consultant .modal').insertAfter($('.mFlex'));
var dataisrc = $('.AFC').attr('data-src'),
dataialt = $('.AFC').attr('data-alt');
if (!$('.AFC').children('img').length > 0) {
$('.AFC').append('
');
}
$("#find_new_consultant").show();
$('.contryTip').tooltip({
track: true,
content: function () {
return $(this).prop('title');
}
});
// $('#find_new_consultant .popover').remove();
// $('[data-toggle="popover"]').popover({
// placement: 'left',
// container: 'body',
// html: true,
// content: function () {
// return $(this).parent().children('.popData').html();
// }
// });
},
error: function () {
// alert("Something went wrong. Please try after sometime.");
var cTextReload = 'Something went wrong. Please try after sometime.';
commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback);
}
});
}
} else {
// alert("Something went wrong. Please try after sometime.");
var cTextReload = 'Something went wrong. Please try after sometime.';
commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback);
}
},
error: function () {
// alert("Something went wrong. Please try after sometime.");
var cTextReload = 'Something went wrong. Please try after sometime.';
commonConfirmPopup(cTNotification, cTextReload, cBOk, cBCancel, cBCTheme, cBCHide, cMCsm, cReloadCallback, cFalseCallback, cFalseCallback);
}
});
});
//Sort Consultants according to speciality
$(document).off('click', '.SpecialityConsultants');
$(document).on('click', '.SpecialityConsultants', function (e) {
var patientId = $("#SelectedPatietnt").val();
var isRefreshCache = ($(this).attr("data-refresh") == "true" || typeof ($(this).attr("data-refresh")) == "undefined") ? true : false;
CalculateTimeZone();
var name = $(this).attr("name");
var Speciality = null;
$(".SpecialityConsultants").each(function () {
if ($(this).is(':checked')) {
var id = $(this).attr("id");
if (Speciality == null) {
Speciality = $(this).attr("id");
}
else {
Speciality += "," + $(this).attr("id");
}
}
});
var checkradio = "";
if (!$(this).is(':checked')) {
checkradio = true;
}
$("#FavSpecialisedConsultant").show();
var callFunction = $('input[name=network]:checked', '#myForm').attr('id');
if (callFunction == "SmileStreamConsultants") {
IsColleagueCase = false;
allStudents = [];
$.ajax({
url: "/Consulting/FindSpecialisedConsultants",
type: 'POST',
datatype: 'html',
data: { Specialitys: Speciality, CurrentTime: fulltime, sortColumn: sortingColumn, sortBy: sortingBy, sortingspaciality: sortingspaciality, location: sortingLocation, IsRefreshCache: isRefreshCache, SelectedPatientid: patientId },
async: false,
success: function (data) {
$("#dataappend").empty();
$("#dataappend").html(data);
$('.fcDiv').removeClass('hide').next('.mcDiv').addClass('hide');
dataovy();
$('.cico .fa, .itip').tooltip({
track: true
});
$('.choosePrice .btn').each(function () {
var btnTxt = $(this).text();
if (btnTxt == sortingspaciality) {
$(this).closest('tr').addClass('sortHighlight');
}
});
},
error: function (er) {
$("#loadingWithBG").hide();
}
});
}
else {
IsColleagueCase = true;
allStudents = [];
$.ajax({
url: "/consulting/ColleagueConsultants/",
type: 'POST',
datatype: 'html',
data: { Specialitys: Speciality, CurrentTime: fulltime, sortColumn: sortingColumn, sortBy: sortingBy, sortingspaciality: sortingspaciality, location: sortingLocation },
async: false,
success: function (data) {
$("#dataappend").empty();
$("#dataappend").html(data);
$('.fcDiv').addClass('hide').next('.mcDiv').removeClass('hide');
$('#dataappend #ClearTable .fsTable th:nth-child(n+3):nth-child(-n+12), #dataappend #ClearTable .fsTable td:nth-child(n+3):nth-child(-n+12)').remove();
$('#dataappend #ClearTable .fsTable th:nth-child(2)').removeClass('w200');
dataovy();
$('.cico .fa, .itip').tooltip({
track: true
});
$('.choosePrice .btn').each(function () {
var btnTxt = $(this).text();
if (btnTxt == sortingspaciality) {
$(this).closest('tr').addClass('sortHighlight');
}
});
$('#tr-FirstAvailableCase').attr('style', 'display:none;')
},
error: function (er) {
$("#loadingWithBG").hide();
}
});
}
$('.Fstar:visible').each(function (i) {
var i = i + 1;
$(this).attr('data-attr', i);
});
$('.contryTip').tooltip({
track: true,
content: function () {
return $(this).prop('title');
}
});
// $('#find_new_consultant .popover').remove();
// $('[data-toggle="popover"]').popover({
// placement: 'left',
// container: 'body',
// html: true,
// content: function () {
// return $(this).parent().children('.popData').html();
// }
// });
setTimeout(function () {
$("#loadingWithBG").hide();
}, 1000);
setTimeout(function () {
if (checkradio == true) {
$('input[type="checkbox"][name="' + name + '"]').prop('checked', false);
}
else {
$('input[type="checkbox"][name="' + name + '"]').prop('checked', true);
}
}, 100);
});
$(document).off('click', '#btn_search_smilestream');
$(document).on('click', '#btn_search_smilestream', function () {
if (($('#search_email').val() != "" && $('#search_email').val() != null) || ($('#search_firstname').val() != "" && $('#search_firstname').val() != null) || ($('#search_lastname').val() != "" && $('#search_lastname').val() != null)) {
var isValidEmailAddress = (($('#search_email').val() != null && $('#search_email').val() != "") ? IsValidEmail($('#search_email').val()) : true);
if (isValidEmailAddress) {
$('#tdbody_searchresult').html('');
$(".sbdTableloader").show();
$.ajax({
url: "/Consulting/SearchStudentRecord",
type: 'POST',
dataType: 'json',
data: { email: $('#search_email').val(), firstName: $('#search_firstname').val(), lastName: $('#search_lastname').val() },
async: false,
success: function (data) {
$('#btn_sendcase').text('Send');
if (data != null && data.Item3.length > 0) {
IsFoundAllFillFieldResult = true;
var isAdmin = data.Item1;
if (isAdmin) {
$('.sendBoxDiv').removeClass('regular_user').addClass('admin_user');
}
else {
$('.sendBoxDiv').removeClass('admin_user').addClass('regular_user');
}
if (data.Item3.length > 5) {
$('#tdbody_searchresult').closest('.flex-flexible').addClass('wauto mr--17');
}
else {
$('#tdbody_searchresult').closest('.flex-flexible').removeClass('wauto mr--17');
}
$.each(data.Item3, function (index, value) {
var html = "";
if (value.IsCurrentCustomer == false) {
if (isAdmin) {
html += ' | ';
} else {
html += ' | ';
}
} else {
html += ' | ';
}
html += '' + value.Name + ' | ';
html += '' + (value.Country != null ? value.Country : "") + ' | ';
html += '' + (value.State != null ? value.State : "") + ' | ';
html += '' + (value.City != null ? value.City : "") + ' | ';
html += "
";
$('#tdbody_searchresult').append(html);
});
$('.chk_student').on('click', function () {
$('.chk_student').each(function (index, value) {
if ($(this).prop('checked')) {
$('#btn_sendcase').removeAttr('disabled');
return false;
} else {
$('#btn_sendcase').attr('disabled', 'disabled');
}
});
});
} else {
$('#tdbody_searchresult').append('No result found. |
');
if (!data.Item2) {
if (($('#search_email').val() != "" && $('#search_email').val() != null) && ($('#search_firstname').val() != "" && $('#search_firstname').val() != null) && ($('#search_lastname').val() != "" && $('#search_lastname').val() != null)) {
CommonResponseDialog("Direct send case", $('#search_firstname').val() + ' ' + $('#search_lastname').val() + " is not registered with Smilestream. Send him an invitation email to SmileStream.", function () {
IsFoundAllFillFieldResult = false;
$('#btn_sendcase').removeAttr('disabled');
$('#btn_sendcase').text('Send Invitation');
});
} else if ($('#search_email').val() != "" && $('#search_email').val() != null) {
CommonResponseDialog("Direct send case", "Please enter first name and last name.", function () { });
}
} else {
CommonResponseDialog("Direct send case", "Entered names are wrong. Please correct or remove it.", function () { });
}
}
$(".sbdTableloader").hide();
},
error: function () {
CommonResponseDialog("Direct send case", "Something went wrong. Please try after sometime.", function () { });
}
});
} else {
CommonResponseDialog("Direct send case", "Entered email is incorrect. Please enter correct email.", function () { });
}
}
else {
$('#search_email').focus();
}
});
$(document).off('click', '#btn_sendcase');
$(document).on('click', '#btn_sendcase', function () {
$('#SendFreeCase').hide();
if (IsFoundAllFillFieldResult) {
IsColleagueCase = true;
allStudents = [];
$('#smilestream_form').modal('hide');
$('.chk_student').each(function (index, value) {
var id = $(this).attr('data-studentid');
if ($(this).prop('checked') && id != null && id != "") {
allStudents.push(id);
}
});
$('#choosePrice, .cstpopshadow').fadeIn('slow');
$(".Standard").hide();
$(".Express").hide();
$(".Mentoring").hide();
$("#ChooseRate").hide();
//$(this).closest('.modal-body .alert').remove();
//$(this).closest('.modal-body').prepend('Your case sent successfully!
');
//setTimeout(function () {
// $('.alert').remove();
//}, 5000);
} else {
$('#smilestream_form').modal('hide');
$("#loadingWithBG").show();
$.ajax({
url: "/Colleague/SendMailtoUserDoNotHaveRegister/",
type: 'POST',
dataType: 'json',
data: { RecevierEmail: $('#search_email').val(), Name: $('#search_firstname').val() + ' ' + $('#search_lastname').val() },
async: true,
success: function (data) {
$("#loadingWithBG").hide();
if (data != null && data == true) {
CommonResponseDialog(POCResources.Directsendcase, POCResources.Emailsentsucessfully, function () {
$('#btn_sendcase').attr('disabled', 'disabled');
});
} else {
CommonResponseDialog(POCResources.Directsendcase, POCResources.Alreadyexistsinsmilestream, function () {
$('#btn_sendcase').attr('disabled', 'disabled');
});
}
},
error: function (er) {
$("#loadingWithBG").hide();
CommonResponseDialog(POCResources.Directsendcase, "Something went wrong. Please try after sometime.", function () {
window.location.reload();
});
}
});
}
});
$(document).off('click', '#select_multplerow');
$(document).on('click', '#select_multplerow', function () {
isCheked = (isCheked == true ? false : true);
$('.chk_student').each(function (index, value) {
if (isCheked) {
$(this).parents('tr').addClass('selected');
$(this).attr('checked', 'checked');
$(this).prop('checked', 'checked');
$('#btn_sendcase').removeAttr('disabled');
} else {
$(this).parents('tr').removeClass('selected');
$(this).removeAttr('checked');
$(this).removeProp('checked');
$('#btn_sendcase').attr('disabled', 'disabled');
}
});
});
$(document).off('hidden.bs.modal', '#consulting_orderplaced');
$(document).on('hidden.bs.modal', '#consulting_orderplaced', function () {
$('#find_new_consultant').modal('hide');
});
});
$(window).resize(function () {
dataovy();
});
function IsFormValid() {
var isValidate = true;
if ($("#consulting_checkout_CCEUPlan").val() == 1) {
isValidate;
}
else {
var selectedVal = $("#consulting_checkout #CurrentPaymentProfile").val()+"";
var paymentMethodInvoice = $('#consulting_checkout #paymentmethod_invoice');
var paymentMethodPayPal = $('#consulting_checkout #paymentmethod_paypal');
if (paymentMethodInvoice.length != 0 && paymentMethodInvoice.is(':checked') == true) {
isValidate = IsAddressValid('_Invoice_');
if (!isValidate) {
$('#GoogleAddressInvoiceDetails_' + CurrentModelName).removeClass('hide')
}
}
else if (paymentMethodPayPal.length != 0 && paymentMethodPayPal.is(':checked') == true) {
isValidate = IsAddressValid('_PayPal_');
if (!isValidate) {
$('#GoogleAddressPayPalDetails_' + CurrentModelName).removeClass('hide')
}
}
else {
if (selectedVal == "0" || selectedVal == "" || selectedVal == null) {
var googleAddress = $("#GoogleAddressFindConsultant");
var googleAddressDetails = $("#GoogleAddressFindConsultantDetails");
if (googleAddressDetails.css('display') == 'none' && googleAddress.val() == "") {
isValidate = false;
googleAddressDetails.removeClass('hide');
googleAddressDetails.addClass('active');
}
if ($("#consulting_checkout #CardholderName").val() == "") {
isValidate = false;
$('#consulting_checkout #CardholderName_err').html($.parseHTML(POCResources.Thisfieldisrequired)[0].data);
$('#consulting_checkout #CardholderName_err').show();
}
else {
$('#consulting_checkout #CardholderName_err').hide();
}
if ($("#consulting_checkout #CardholderLastName").val() == "") {
isValidate = false;
$('#consulting_checkout #CardholderLastName_err').html($.parseHTML(POCResources.Thisfieldisrequired)[0].data);
$('#consulting_checkout #CardholderLastName_err').show();
}
else {
$('#consulting_checkout #CardholderLastName_err').hide();
}
if ($("#consulting_checkout #CardNumber").val() == "") {
isValidate = false;
$('#consulting_checkout #CardNumber_err').html($.parseHTML(POCResources.Thisfieldisrequired)[0].data);
$('#consulting_checkout #CardNumber_err').show();
}
else {
$('#consulting_checkout #CardNumber_err').hide();
}
if ($("#consulting_checkout #CardCode").val() == "") {
isValidate = false;
$('#consulting_checkout #CardCode_err').html($.parseHTML(POCResources.Thisfieldisrequired)[0].data);
$('#consulting_checkout #CardCode_err').show();
}
else {
$('#consulting_checkout #CardCode_err').hide();
}
if ($("#consulting_checkout #StreetAddress1").val() == "") {
isValidate = false;
$('#consulting_checkout #StreetAddress1').parent().find('p').html($.parseHTML(POCResources.Thisfieldisrequired)[0].data);
$('#consulting_checkout #StreetAddress1').parent().find('p').show();
}
else {
$('#consulting_checkout #StreetAddress1').parent().find('p').hide();
}
if ($("#consulting_checkout #Zip_City").val() == "") {
isValidate = false;
$('#consulting_checkout #Zip_City').parent().find('p').html($.parseHTML(POCResources.Thisfieldisrequired)[0].data);
$('#consulting_checkout #Zip_City').parent().find('p').show();
}
else {
$('#consulting_checkout #Zip_City').parent().find('p').hide();
}
if ($("#consulting_checkout #Zip").val() == "") {
isValidate = false;
$('#consulting_checkout #Zip').parent().find('p').html($.parseHTML(POCResources.Thisfieldisrequired)[0].data);
$('#consulting_checkout #Zip').parent().find('p').show();
}
else {
$('#consulting_checkout #Zip').parent().find('p').hide();
}
/*if($("#UserState").val() == "" || $("#UserState").val() == "0")
{
isValidate = false;
$('#UserState').parent().find('p').html("This field is required");
$('#UserState').parent().find('p').show();
}
else{
$('#UserState').parent().find('p').hide();
}*/
}
}
}
return isValidate;
}
function DoConfirmOrderRequest(data) {
ConsultingCheckoutSubmit();
}
function HidePayPal() {
$("#consulting_checkout #paymentmethod_paypal_lbl").hide();
}
function ShowPayPal() {
$("#consulting_checkout #paymentmethod_paypal_lbl").show();
}