= 0) {
if (!$('a.print-toggle').parent().hasClass("disabled")) {
$('a.print-toggle').parent().addClass("disabled");
}
if (!$('a.download-toggle').parent().hasClass("disabled")) {
$('a.download-toggle').parent().addClass("disabled");
}
}
else if (data.indexOf('') >= 0) {
var wErrorMsgIndex = data.indexOf('');
var wEndErrorMsg = data.indexOf('');
data = data.substr(wErrorMsgIndex, wEndErrorMsg - wErrorMsgIndex);
$('div.' + divclass + '').append(data);
$('div.' + divclass + '').find('h3').remove();
$('div.' + divclass + '').find('.img-responsive').remove();
$('div.' + divclass + '').find('#errorHeader').html(wPortalErrorWereSorrySomethingWentWrongTryAgain.replace('{0}', '
= 0) {
$('div.' + divclass + '').html(data);
} else {
$('div.' + divclass + '').append(data);
}
if ($("." + divclass + " .series .image").length > 0) {
if (typeof ($("." + divclass + " .series .image img").lazy) == "function") {
$("." + divclass + " .series .image img").lazy({
chainable: false,
bind: "event",
delay: 200,
enableThrottle: true,
throttle: 250
});
}
}
if (divclass == "ccda-wrapper") {
ApplyUIComponents();
RegisterFormValidation($(".CCDA-Filter-wrapper form"));
//RegisterCustomValidation();
RegisterDateGreaterThanCheck();
}
if (divclass == "report-wrapper" || divclass == "goodfaith-wrapper" || divclass == "layletter-wrapper") {
if (divclass == "report-wrapper") {
$('.report-tab').removeAttr('disable-print');
}
if (divclass == "goodfaith-wrapper") {
$('.goodfaith-tab').removeAttr('disable-print');
$('.goodfaith-tab').attr('enable-download', 'true');
}
else if ( divclass == "layletter-wrapper") {
$('.layletter-tab').removeAttr('disable-print');
$('.layletter-tab').attr('enable-download', 'true');
}
if ($('a.print-toggle').parent().hasClass("disabled")) {
$('a.print-toggle').parent().removeClass("disabled");
}
if ($('a.download-toggle').parent().hasClass("disabled")) {
$('a.download-toggle').parent().removeClass("disabled");
}
if ($('.report-tab').attr("print-src") !== undefined) {
$('a.print-toggle').attr("print-src", $('.report-tab').attr("print-src"))
$('a.print-toggle').attr("print-src-type", $('.report-tab').attr("print-src-type"))
}
$('a.' + tabClass).click();
}
if (divClass == "authorization-wrapper") {
if ($('a.download-toggle').parent().hasClass("disabled")) {
$('a.download-toggle').parent().removeClass("disabled");
}
if ($('a.print-toggle').parent().hasClass("disabled")) {
$('a.print-toggle').parent().removeClass("disabled");
}
$('.authorization-tab').attr('disable-print', 'false');
$('.authorization-tab').attr('enable-download', 'true');
if ($('.authorization-tab').attr("print-src") !== undefined) {
$('a.print-toggle').attr("print-src", $('.authorization-tab').attr("print-src"))
$('a.print-toggle').attr("print-src-type", $('.authorization-tab').attr("print-src-type"))
}
}
if (divclass == "images-wrapper") {
ToggleAClick();
}
if (typeof RegisterLinkClickFadeContent == 'function') {
RegisterLinkClickFadeContent();
}
}
}).error(function (data) {
if (data.indexOf('') >= 0) {
var wErrorMsgIndex = data.indexOf('');
var wEndErrorMsg = data.indexOf('');
data = data.substr(wErrorMsgIndex, wEndErrorMsg - wErrorMsgIndex);
$('div.' + divclass + '').append(data);
}
});
}
function isNumeric(n) {
return /^\d+$/.test(n);
}
function EnsureNumber(obj, maxlen) {
var n = $(obj).val();
if (!isNumeric(n)) {
$(obj).val("");
}
if (n.length > maxlen) {
$(obj).val(n.substring(0, maxlen));
}
}
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}
$('#PersonSearchCriteria_ToDate').blur(function () {
var fromdate = $('#PersonSearchCriteria_SearchDate').val();
var fromdate = $('#PersonSearchCriteria_SearchDate').val();
if (fromdate != null && fromdate != '' && fromdate != undefined) {
//debugger;
var todate = $(this).val();
if (fromdate > todate) {
// $('#PersonSearchCriteria_ToDate_dp').after("
Please enter password
");
if (document.getElementById("PersonSearchCriteria_ToDate_dp") != null) {
document.getElementById("PersonSearchCriteria_ToDate_dp").style.borderColor = "red";//and you want to remove invalid style
$('#errorlabel').html(wPleaseEnterPassword);
}
}
// e.preventDefault();
//if (!focusSet) {
// $("#PersonSearchCriteria_ToDate").focus();
//}
}
else {
$("#PersonSearchCriteria_ToDate").parent().next(".validation").remove();
return true;
}
});
$('ul.nav.details-tabs a[update-src]').bind("click.UpdateContentFromServer", function (event) {
var wtabName = $(this)[0].className;
if (wtabName != null) {
var divclass = wtabName.replace("-tab", "-wrapper");
var wGridID = $('div.' + divclass + ' table')[0].id;
var wGrid = window[wGridID];
var UpdateURL = $(this).attr("update-src");
$(this).removeAttr("update-src");
$(this).unbind("click.UpdateContentFromServer");
$.ajax({
type: "POST",
url: UpdateURL
}).done(function (data) {
wGrid.UpdateData(data);
});
}
});
$(function () {
$("#PatientJumpMenu #PatientSelect").hide();
$("#PatientJumpMenu select").change(function () {
window.location = $("#PatientJumpMenu select option:selected").val();
})
if ($('a.print-toggle')) {
$('ul.nav.details-tabs [data-toggle^="tab"]').click(function () {
if ($(this).attr("disable-print") == "true") {
if (!$('a.print-toggle').parent().hasClass("disabled")) {
if ($('a.print-toggle').parent().hasClass("active")) {
$('a.print-toggle').click();
}
$('a.print-toggle').parent().addClass("disabled");
}
} else if ($('a.print-toggle').parent().hasClass("disabled")) {
$('a.print-toggle').parent().removeClass("disabled");
}
$('a.print-toggle').attr("print-src", "");
$('a.print-toggle').attr('print-src-type', '');
if ($(this).attr("print-src") !== undefined) {
$('a.print-toggle').attr("print-src", $(this).attr("print-src"))
$('a.print-toggle').attr("print-src-type", $(this).attr("print-src-type"))
}
});
}
//enable-download="true" enable-send="true"
if ($('a.download-toggle')) {
$('ul.nav.details-tabs [data-toggle^="tab"]').click(function () {
if ($(this).attr("enable-download") == "true") {
if ($('a.download-toggle').parent().hasClass("active")) {
$('a.download-toggle').click();
}
if ($('a.download-toggle').parent().hasClass("disabled")) {
$('a.download-toggle').parent().removeClass("disabled");
}
if ($(this).context.className == "ccda-tab") {
$('a.download-toggle').attr("download-type", "CCDA");
} else if ($(this).context.className == "goodfaith-tab") {
$('a.download-toggle').attr("download-type", "goodfaith");
} else if ($(this).context.className == "layletter-tab") {
$('a.download-toggle').attr("download-type", "layletter");
} else if ($(this).context.className == "report-tab") {
$('a.download-toggle').attr("download-type", "report");
} else {
$('a.download-toggle').removeAttr("download-type");
}
} else if (!$('a.download-toggle').parent().hasClass("disabled")) {
if ($('a.download-toggle').parent().hasClass("active")) {
$('a.download-toggle').click();
}
$('a.download-toggle').parent().addClass("disabled");
}
});
}
if ($('a.send-toggle')) {
$('ul.nav.details-tabs [data-toggle^="tab"]').click(function () {
if ($(this).attr("enable-send") == "true") {
if ($('a.send-toggle').parent().hasClass("disabled")) {
$('a.send-toggle').parent().removeClass("disabled");
}
} else if (!$('a.send-toggle').parent().hasClass("disabled")) {
if ($('a.send-toggle').parent().hasClass("active")) {
$('a.send-toggle').click();
}
$('a.send-toggle').parent().addClass("disabled");
}
});
}
$('div.header.panel-toggles a.message-toggle:not(.active)').click(function () {
ClearMessage()
});
$('div.header.panel-toggles a.send-toggle:not(.active)').click(function () {
ClearDirectMessage();
});
});
function LogMyCounter(counterCode) {
$.ajax({ type: "POST", url: BaseRootURL + '/AJAX/CountersAction', data: { counter_type_code: counterCode } });
}
function SuccessfulResendValidation(e) {
if (e.success) {
toastr.success(wThevalidationcodehassuccessfullyresent);//"The validation code has successfully resent!"
} else {
toastr.error(wTherewasanissueresendingthevalidationcode);//"There was an issue resending the validation code."
//toastr.error(e.message);
}
}
// Handle the make default button
function AlertSaved() {
$('#makedefault').hide();
$('#makedefaultmessage').show();
$('#makedefaultmessage').css({
opacity: 1.0, visibility: "visible"
}).animate({
opacity: 0.5
}, 2000, function () {
$('#makedefaultmessage').hide();
$('#makedefault').show();
});
}
function BaseSaveSuccess(data, status, submittingFormID) {
////var json = data.get_response().get_object();
var wSucess = (data == true ? true : (data.success == true ? true : false));
var wMsg = (data && data.message && data.message.length > 0 ? data.message : "");
try {
if (wSucess) {
toastr.success(wMsg.length == 0 ? wSaveCompleted : wMsg);//"Save Completed"
} else {
toastr.error(wTherewasaproblemwithsavingthedata +" "+ wMsg);//'There was a problem with saving the data.'
}
//$('#notification').css("display", "block");
//if (!$('#notification').hasClass("alert")) {
// $('#notification').addClass("alert");
//}
//if ($('#notification').hasClass("alert-dismissable")) {
// $('#notification').removeClass("alert-dismissable");
//}
//if (data.success) {
// if ($('#notification').hasClass("alert-warning")) {
// $('#notification').removeClass("alert-warning");
// }
// if (!$('#notification').hasClass("alert-info")) {
// $('#notification').addClass("alert-info");
// }
//} else {
// if ($('#notification').hasClass("alert-info")) {
// $('#notification').removeClass("alert-info");
// }
// if (!$('#notification').hasClass("alert-warning")) {
// $('#notification').addClass("alert-warning");
// }
//}
//$('#notification').html(data.message);
//$('#notification').each(function () {
// //$(this).animate({ opacity: 0 }, 3000);
// $(this).delay(3000).fadeOut("slow");
//});
if (submittingFormID.indexOf("#") >= 0) {
var wSubmittingForm = $(submittingFormID);
if (data.lastupdated != null && data.lastupdated != "") {
$(submittingFormID + ' .form-group .form-text').first().html("
" + data.lastupdated + "");
}
if (data.success) {
//wSubmittingForm[0].reset();
}
}
} finally {
if (wSucess) {
UpdateOriginalValue(submittingFormID);
}
}
}
function TabInfo(tabElement) {
var wMasterNavTab = false;
if (tabElement.length == 0) {
tabElement = $('ul.nav li.active');
wMasterNavTab = true;
}
this.Tab = tabElement;
var wTabPanelIdentifier = this.Tab.first().find('> a').attr("id");
if (wTabPanelIdentifier != null) {
wTabPanelIdentifier = '.panel' + wTabPanelIdentifier.replace("tab", "");
} else {
var TabsClass = null;
if (this.Tab.context.title == wProviderAccount) {//'Provider Account'
TabsClass = this.Tab.first().find('a[class$=-tab]');
}
else {
TabsClass = this.Tab.find('a[class$=-tab]');
}
//var TabsClass = this.Tab.first().find('> a[class$=-tab]');
if (TabsClass != null && TabsClass.length != null && TabsClass.length > 0) {
for (var c = 0; c < TabsClass[0].classList.length; c++) {
if (TabsClass[0].classList[c].endsWith("-tab")) {
wTabPanelIdentifier = TabsClass[0].classList[c];
wTabPanelIdentifier = '.' + wTabPanelIdentifier.replace("tab", "wrapper");
break;
}
}
}
}
if (wMasterNavTab) {
wTabPanelIdentifier = '.row .form'
}
var wPanel = $(wTabPanelIdentifier);
this.Panel = wPanel
return this;
}
function PrintURL(aDocumentType, aTitle, aURL, aContainerClassName, aOverwrite, aDocType) {
var wDocumnetURL = '';
if (aDocType == "PDF") {
wDocumnetURL = BaseRootURL + aURL;
}
var hei = 0;//report.height();
var wid = 0;//report.width() + 40;
if (hei < 800) {
hei = 800;
}
if (wid < 800) {
wid = 800;
}
wMyPrintURLDocument = (window.open(wDocumnetURL, aDocumentType, 'scrollbars=yes, resizable = yes, location=no, width=' + wid + ',height=' + hei, false));
if (aDocType === undefined || aDocType == "") {
var html = "";
html += "
" + aTitle + "";
html += "
";
html += "";
html += "";
html += "
";
html += "";
wMyPrintURLDocument.document.write(html);
$.ajax({
type: "POST",
url: aURL,
success: function (data) {
if (data != "") {
if (aOverwrite) {
wMyPrintURLDocument.document.documentElement.innerHTML = data;
} else {
wMyPrintURLDocument.document.getElementById('PrintDocContent').innerHTML = data;
}
}
},
error: function () {
wMyPrintURLDocument.document.getElementById('PrintDocContent').innerHTML = wTherewasanissueloadingthepage;//"There was an issue loading the page."
}
});
wMyPrintURLDocument.document.close();
}
wMyPrintURLDocument.focus();
}
// Apply jquery code on DOM ready
function ApplyUIComponents() {
$('.truncate').each(function () {
var $this = $(this);
if (!$this.attr('title')) {
$(this).attr('title', $(this).text());
var practiceNameTextWidth = $(this).textWidth();
var divWidth = $('.truncate').width();
if (practiceNameTextWidth <= divWidth) {
$(this).tooltip('disable');
}
else {
$(this).tooltip('enable');
}
}
});
$(".popover-custom").each(function () {
$(this).popover({
html: true,
content: function () {
return $(this).parent().find('.popover').html();
}
});
//$(this).find('.toggle').click(function (e) {
// e.preventDefault();
// e.stopPropagation();
// .popover();
//});
});
$("div.noselect > a.print-toggle").off("click.PrintToggle");
$("div.noselect > a.print-toggle").on("click.click.PrintToggle", function () {
if ($(this).parent().hasClass("disabled")) {
return;
}
// var wReportSection = $("div.report-wrapper");
var wReportSection = $("div.content.panels-container-wrapper div:not(:hidden)");
if (wReportSection.length > 0) {
var hei = 0;//report.height();
var wid = 0;//report.width() + 40;
if (hei < 800) {
hei = 800;
}
if (wid < 800) {
wid = 800;
}
var wLastAccessedAlert = wReportSection.find(".alert");
wLastAccessedAlert.hide();//.addClass('hidden');
var wLastAccessedMessageBox = wReportSection.find(".messagebox");
wLastAccessedMessageBox.hide();//.addClass('hidden');
var wLastAccessedImages = wReportSection.find(".images");
wLastAccessedImages.hide();//.addClass('hidden');
var wLastAccessedFlags = wReportSection.find(".flags");
wLastAccessedFlags.hide();//.addClass('hidden');
var wLastAccessedappointPrint = wReportSection.find(".appointmentprint");
wLastAccessedappointPrint.hide();
var wLastAceessedemailPrint = wReportSection.find(".emailprintconfirmation");
wLastAceessedemailPrint.hide();
var wLastAccesseddownld = wReportSection.find(".Downloadbtn");
wLastAccesseddownld.hide();
var wtoggle = wReportSection.find(".menu-icon");
wtoggle.hide();
if ($('.expand-panel-body').attr('aria-expanded') == "true") {
$('.expand-panel-body').addClass("in");
$('.expand-panel-body').removeAttr("style");
}
else {
$('.menu-icon').click()
$('.expand-panel-body').removeClass("in");
$('.expand-panel-body').addClass("style");
}
var wReportURL='';
if ($(this).attr('print-src') !== undefined && $(this).attr('print-src') != "") {
wReportURL = $(this).attr('print-src');
if (wReportURL.trim() != "") {
wReportURL = BaseRootURL + wReportURL;
}
}
var w = (window.open(wReportURL, '', 'scrollbars=yes,location=no, width=' + wid + ',height=' + hei, false));
$(wReportSection[0]).find('table:first').append("
|
");
var wReportContent = wReportSection[0].innerHTML;
var ClassName = wReportSection[0].className;
if (ClassName.indexOf('padded-sm') > -1) {
ClassName = ClassName.replace("padded-sm", '');
}
if (wReportContent.indexOf('messagebox') > -1 && wReportContent.indexOf('padded-sm') > -1) {
wReportContent = wReportContent.replace('padded-sm', '');
}
var title = "Print ";
if (ClassName.toLowerCase().indexOf("summary") > -1) {
title += "Summary";
$.ajax({ type: "POST", url: BaseRootURL + '/Exams/PrintedSummaryStat' });
} else if (ClassName.toLowerCase().indexOf("report") > -1) {
title += "Report";
$.ajax({ type: "POST", url: BaseRootURL + '/Exams/PrintedReportStat' });
}
if (wReportURL === undefined || wReportURL == "") {
wLastAccessedFlags.show();//.removeClass('hidden');
wLastAccessedMessageBox.show();
wLastAccessedAlert.show();
wLastAccessedImages.show();
var html = "";
html += "
" + title + "";
html += "
";
html += ""
html += "";
html += "";
html += "";
html += "
" + wReportContent + "
";
html += "";
// using js instead of jquery so that the HEAD element will not be nested within
// the printing function has been moved to the onload funtion of the popup. This fixes the print not working on browsers such as chrome.
w.document.write(html);
w.document.close();
}
w.focus();
}
});
function OnSuccess(data) {
if (data.indexOf("field-validation-error") > -1) return;
if (data == false) return;
if (data.success == false) return;
}
// Apply bootstrap multiselects to selects with multiple option
$(".multiselect").each(function () {
var $ele = $(this);
wBootstrapOptions = {
// buttonID: 'apples',
selectAllText: wSelectAll,
filterPlaceholder: wSearch,
nonSelectedText: wNoneSelected,
nSelectedText: wSelected,
buttonClass: 'form-control',
includeSelectAllOption: true,
includeSelectAllDivider: true,
enableFiltering: false,
enableCaseInsensitiveFiltering: true,
filterPlaceholder: wFilter,
numberDisplayed: ($ele.hasClass('multiselect-large') ? 10 : 1),
maxHeight: 400,
buttonTitle: function (options, select) {
return "";
},
buttonText: function (options, select) {
if (options.length == 0) {
return '
' + wNoneSelected + ' ';
}
else {
if (options.length > this.numberDisplayed) {
if (options.length < select[0].children.length) {
return '
' + String.format(wSelected, options.length) + ' ';
} else {
return '
' + wAllSelected + ' ';
}
}
else {
var selected = '';
options.each(function () {
var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).html();
selected += label + ', ';
});
return '
' + selected.substr(0, selected.length - 2) + ' ';
}
}
}
};
//if ($ele[0].id == "OrderingProvider") {
// wReferringProviderOptions = {
// includeSelectAllOption: false,
// enableFiltering:true,
// ajaxSearch: true,
// ajaxURL: '~/SecureSystem/OrderingProvider'
// };
// $.extend(true, {}, wBootstrapOptions, wReferringProviderOptions)
//}
$ele.multiselect({
//wBootstrapOptions
selectAllText: wSelectAll,
filterPlaceholder: wSearch,
nonSelectedText: wNoneSelected,
nSelectedText: wSelected,
buttonClass: 'form-control',
includeSelectAllOption: true,
includeSelectAllDivider: true,
enableFiltering: false,
enableCaseInsensitiveFiltering: true,
filterPlaceholder: wFilter,
numberDisplayed: ($ele.hasClass('multiselect-large') ? 10 : 1),
maxHeight: 400,
buttonTitle: function (options, select) {
return "";
},
buttonText: function (options, select) {
if (options.length == 0) {
return '
' + wNoneSelected + ' ';
}
else {
if (options.length > this.numberDisplayed) {
if (options.length < select[0].children.length) {
return '
' + String.format(wSelected, options.length) + ' ';
} else {
return '
' + wAllSelected + ' ';
}
}
else {
var selected = '';
options.each(function () {
var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).html();
selected += label + ', ';
});
return '
' + selected.substr(0, selected.length - 2) + ' ';
}
}
}
//onChange: function (option, checked, select) {
// // var selections = this
// alert('change');
//}
});
if ($ele[0].id == "OrderingProvider") {
if (wUseReferringAJAXSearchList == "True" || wUseReferringAJAXSearchList == "true") {
wReferringProviderOptions = {
includeSelectAllOption: false,
enableFiltering: true,
ajaxSearch: true,
multiple: true,
maxBuildList: wMaxWLReferringList,
ajaxNoResults: wAJAXProviderNoResults,
ajaxURL: wReferringProviderBootstrapSearch
};
//$.extend(true, {}, wBootstrapOptions, wReferringProviderOptions)
$ele.multiselect('setOptions', wReferringProviderOptions);
}
}
});
//wReferringProviderOptions = {
// includeSelectAllOption: false,
// ajaxSearch: true,
// ajaxURL: '@Url.Content("~/SecureSystem/OrderingProvider")'
//};
//$("#cbxReferring").multiselect('setOptions', wReferringProviderOptions);
$('.form-control-feedback').each(function () {
$(this).html('
' + $(this).attr('title') + '');
});
// Allow for tabs to collapse into a dropdown
$('.drop-tabs').tabdrop({
text: ''
});
ApplyUIDatePickerComponents();
$('.no-link').click(function (e) {
e.preventDefault();
e.stopPropagation();
});
ApplyUIComponentsForGrid();
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": true,
"progressBar": true,
"positionClass": "toast-top-center",
"preventDuplicates": false,
"onclick": null,
"showDuration": "500",
"hideDuration": "1000",
"timeOut": "7000",
"extendedTimeOut": "3000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
GenerateSpinner();
ApplyInputMasks();
ApplyExtendedTextToolTip();
}
function ApplyExtendedTextToolTip() {
$('select.form-control:not(.multiselect)').mouseover(function () {
if ($(this).find("option:selected").length > 0 && $(this).find("option:selected").text() != "") {
if ($(this).textWidth() >= $(this).innerWidth()) {
$(this).css('cursor', 'auto').attr('title', $(this).find("option:selected").text());
}
}
else {
$(this).css('cursor', 'auto').attr('title', "");
}
});
$('input.form-control').keyup(function () {
var reasonExam = $(this).val();
if ($(this).textWidth() + 20 > $(this).innerWidth())
{ $(this).css('cursor', 'auto').attr('title', reasonExam); }
}).keydown(function () {
$(this).css('cursor', 'auto').attr('title', "");
});
}
function ApplyInputMasks() {
$('input[type=tel]').each(function () {
var country_mask = "+##########[#########]";
var masks = $(this).attr('placeholder').replace(/0/g, '#') + "[ #####]";
$(this).bind("change paste keyup", function (e) {
if ($(this).val().length <= 1) {
$(this).inputmask("remove");
} else {
if (e.type == "keyup" && [16, 17, 65, 37, 38, 39, 40, 8, 46].indexOf(e.keyCode) == -1) {
if ($(this).val().indexOf('+') > -1) {
$(this).inputmask({
mask: country_mask,
greedy: false,
definitions: { '#': { validator: "[0-9]", cardinality: 1 } }
});
} else {
$(this).inputmask({
mask: masks,
greedy: false,
definitions: { '#': { validator: "[0-9]", cardinality: 1 } }
});
}
}
}
});
//$(this).inputmask({
// mask: masks,
// greedy: false,
// definitions: { '#': { validator: "[0-9\+]", cardinality: 1 } }
//});
});
}
function RemoveInputMarks(element) {
element.unbind("change paste keyup");
element.inputmask('remove');
}
function GenerateSpinner() {
$('.spinner').each(function () {
var target = this;
var spinner = new Spinner(spinneropts).spin(target);
});
}
// Grid Refreshed UI Stuff
function ApplyUIComponentsForGrid() {
// Popover for datagrid overflow icons
$('[data-toggle="popover"]').popover({
html: true,
trigger: 'click',
content: function () {
var row = $(this).parent().parent().parent().children().not('.overflow');
var icons = $(this).parent().parent().find('.popovercontent').html();
var contents = '
';
for (var i = 0; i < row.length; i++) {
if (!$(row.get(i)).is('.no-summary, .more-info-icons, .quick-launch-icons')) {
var $td = $(row.get(i));
var $th = $td.closest('table').find('th').eq(i);
contents += "
" + $th.text() + "" + $td.html() + "
";
}
}
contents += '
';
return icons + contents;
}
});
// Apply ToolTips
var is_touch_device = 'ontouchstart' in document.documentElement;
if (!is_touch_device) {
$('[title]').tooltip({
//html: true, //Support html for new lines
container: 'body'
});
}
}
function DismissNotification(notificationCode) {
$.ajax({ type: "POST", url: BaseRootURL + '/SecureSystem/DismissNotification/' + notificationCode });
}
function ToggleAClick() {
$('.toggle a').click(function (e) {
e.preventDefault();
var wrapper = $(this).parent().parent().parent().find('.images-container-wrapper');
var container = wrapper.find('.images-container');
if ($(this).parent().hasClass('active')) {
$(this).parent().removeClass('active');
wrapper.animate({
height: wrapper.css('min-height')
});
} else {
var diff = Math.abs(wrapper.height() - container.height());
if (diff > 10) {
$(this).parent().addClass('active');
wrapper.animate({
height: container.height()
});
}
}
});
}
var CountDownIntervalID = null;
function startTimeoutTimer(duration, display, callbackfunction) {
if (display != null) {
var timer = duration, minutes, seconds;
CountDownIntervalID = setInterval(function () {
minutes = parseInt(timer / 60, 10)
seconds = parseInt(timer % 60, 10);
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
display.textContent = minutes + ":" + seconds;
if (--timer < 0) {
timer = duration;
}
if (timer <= 0 && callbackfunction !== undefined)
{
callbackfunction();
}
}, 1000);
}
}
// Attach DOM objects to events (CLICKS and such)
function SignUpForEvents() {
// Make Default button animation
$('#makedefault').click(function (e) {
e.preventDefault();
LogMyCounter("defaultfilter_tab_rp");
AlertSaved();
});
// update UI to reflect a change in filtering
$(".multiselect").change(function () {
if ($(this).find(":selected").length) {
if ($(this).find(":selected").length == $(this)[0].children.length) {
$(this).parent().removeClass('active');
}
else {
$(this).parent().addClass('active');
}
} else {
$(this).parent().removeClass('active');
}
HighlightButtons();
});
// Small filter icon clicked
$('.filter-sm a').click(function (e) {
e.preventDefault();
e.stopPropagation();
var button = $(this).parent();
var classList = $(button).attr('class').split(/\s+/);
$('.filter-bar-small > li').each(function () {
$(this).removeClass('active');
});
$.each(classList, function (index, class_name) {
if (class_name !== 'filter-sm' && class_name !== 'active') {
var filters = $('.filter-bar > li > div');
$.each(filters, function (indexf, filter_bar_item) {
if (!$(filter_bar_item).hasClass(class_name)) {
$(filter_bar_item).hide();
} else {
if ($(filter_bar_item).is(":visible")) {
$(this).hide();
} else {
button.parent().addClass('active');
$(this).show();
}
}
});
}
});
HighlightButtons();
});
// hide other pop overs when 1 is selected
$('[data-toggle^="popover"]').on('click', function (e) {
e.preventDefault();
$('[data-toggle="popover"]').not(this).popover('hide');
});
$('[data-toggle^="popover-attachments"]').on('click', function (e) {
e.preventDefault();
alert('portal_provider.js 1');
$('[data-toggle="popover-attachments"]').not(this).popover('hide');
});
// REMOVE THIS CODE!!! ONLY USED FOR DEMOS
//$('[data-demo="timed-fade"]').delay(5000).fadeOut(2000, 'easeInExpo', null);
// date-filter click
$('.date-filter div a').click(function (e) {
var wSearchCriteria = SearchResults.AppliedFilter()
if (wlSystemCriteria != null && typeof wlSystemCriteria !== 'undefined' && wlSystemCriteria.DayRangeFilterCriteria == "false") {
e.preventDefault();
}
else {
e.preventDefault();
e.stopPropagation();
var button = $(this).parent();
$('.date-filter div').not(button).each(function () {
$(this).removeClass('active');
});
if (!button.hasClass('active')) {
button.addClass('active');
}
HighlightButtons();
}
//var dayrange = $(this).attr('dayrange');
//var newSentenceHighlight = $('.searchsummary-text').html();
//var matchedWords = [dayrange];
//if (newSentenceHighlight.indexOf('Completed') >= 0 && matchedWords == 0) {
// matchedWords = ['today and yesterday'];
//}
//if (newSentenceHighlight.indexOf('Scheduled') >= 0 && matchedWords == 0) {
// matchedWords = ['today and tomorrow'];
//}
//if (newSentenceHighlight.indexOf('previous') >=0) {
// matchedWords = ['in the previous' +' ' +matchedWords+' '+ 'days'];
//}
//if (newSentenceHighlight.indexOf('next') >= 0) {
// matchedWords = ['in the next' +' ' +matchedWords+' '+ 'days'];
//}
//for (var i = 0; i < matchedWords.length; i++) {
// var txtpat = '\\b' + matchedWords[i] + '\\b';
// var regex2 = new RegExp(txtpat);
// //newSentenceHighlight = replaceAll(newSentenceHighlight, matchedWords[i], "
" + matchedWords[i] + "");
// newSentenceHighlight = newSentenceHighlight.replace(regex2, "
" + matchedWords[i] + "");
//}
//$(this).parent().addClass('active');
//$('.searchsummary-text').html(newSentenceHighlight);
//$('.searchsummary-text').children("span").animate({
// backgroundColor: "white"
// }, 3000);
//});
//mytimeout = setTimeout(function () {
// debugger;
// $('.searchsummary-text').html(newSentence);
//}, 3001);
});
$('.outside-practice-checkbox .checkbox').on('change', function (e) {
MarkCheckboxDependentsasRequired($(this))
ApplyRequiredCSS($(this))
});
// Dismiss popovers on document click
$('body').on('click', function (e) {
$('[data-toggle="popover"],.popover-custom').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover,.popover-custom').has(e.target).length === 0) {
$(this).popover('hide');
}
});
var attr = $(e.target).attr('data-toggle');
if (attr != 'collapse') {
$('.mobile-nav-menu.in ').collapse('hide');
}
});
$('.close-panel').click(function (e) {
e.preventDefault();
$('.panel-toggles div').removeClass('active');
$('.header-panel').each(function () {
if ($(this).is(':visible')) {
$(this).slideUp();
$(this).trigger("on:SlideUp"); // custom event so I can code things when we hide the tab...
}
});
});
$('.header-panel-wrapper div a.btn-link.btn-sm').click(function (e) {
if (!this.hasAttribute("data-dismiss")) {
e.preventDefault();
$('.panel-toggles div').removeClass('active');
$('.header-panel').each(function () {
if ($(this).is(':visible')) {
$(this).slideUp();
$(this).trigger("on:SlideUp"); // custom event so I can code things when we hide the tab...
}
});
}
});
$('.panel-toggles div a, .panel-toggles li a').click(function (e) {
if (!$(this).hasClass('nopanel') && !$(this).parent().hasClass('disabled')) {
e.preventDefault();
var buttonclass = $(this).attr("class");
if (typeof buttonclass !== 'undefined') {
var panelclass = buttonclass.replace('toggle', 'panel');
if ($(this).attr("download-type") != null) {
panelclass = panelclass.replace('-', '-' + $(this).attr("download-type") + '-');
if ($('.' + panelclass).length <=0) {
panelclass = buttonclass.replace('toggle', 'panel');
}
}
// console.log('click clack');
if ($(this).parent().hasClass('active')) {
$(this).parent().removeClass('active');
$('.' + panelclass).slideUp();
} else {
$('.panel-toggles div').removeClass('active');
$('.header-panel').hide();
$(this).parent().addClass('active');
$('.' + panelclass).slideDown();
$('.header-panel').trigger("on:SlideUp"); // custom event so I can code things when we hide the tab...
}
}
}
});
$('.panels-wrapper').each(function () {
var $panel_content_wrapper = $(this).find('.panels-container-wrapper');
var $tabs = $(this).find('.my-tabs');
$tabs.find('li a').click(function (e) {
var class_attr = $(this).attr("class");
if (typeof class_attr !== 'undefined') {
var buttonclass = class_attr.match(/[\w-]*-tab\b/) + "";
var panelclass = buttonclass.replace('-tab', '-wrapper');
if (!$(this).parent().hasClass('tabdrop') && !$(this).parent().hasClass('notatab')) {
if (!$(this).parent().hasClass('active')) {
$panel_content_wrapper.children('div').addClass('hidden');
$panel_content_wrapper.find('.' + panelclass).removeClass('hidden');
}
if (buttonclass.indexOf('images') > -1) {
$tabs.find('li.notatab').removeClass('invisible');
}
else {
$tabs.find('li.notatab').removeClass('invisible');
$tabs.find('li.notatab').addClass('invisible');
}
}
}
});
});
$('.subpanels-wrapper').each(function () {
var $panel_content_wrapper = $(this).find('.subpanels-container-wrapper');
var $tabs = $(this).find('.my-sub-tabs');
$tabs.find('li a').click(function (e) {
var class_attr = $(this).attr("class");
if (typeof class_attr !== 'undefined') {
var buttonclass = class_attr.match(/[\w-]*-tab\b/) + "";
var panelclass = buttonclass.replace('-tab', '-wrapper');
if (!$(this).parent().hasClass('tabdrop') && !$(this).parent().hasClass('notatab')) {
if (!$(this).parent().hasClass('active')) {
$panel_content_wrapper.children('div').addClass('hidden');
$panel_content_wrapper.find('.' + panelclass).removeClass('hidden');
}
if (buttonclass.indexOf('images') > -1) {
$tabs.find('li.notatab').removeClass('invisible');
}
else {
$tabs.find('li.notatab').removeClass('invisible');
$tabs.find('li.notatab').addClass('invisible');
}
}
}
});
});
$('.details-tabs li a').click(function (e) {
//e.preventDefault();
var buttonclass = $(this).attr("class") + "";
var panelclass = buttonclass.replace('tab', 'wrapper');
if (!$(this).parent().hasClass('tabdrop') && !$(this).parent().hasClass('notatab')) {
if (!$(this).parent().hasClass('active')) {
$('.content > div').addClass('hidden');
$('.' + panelclass).removeClass('hidden');
}
if (buttonclass.indexOf('images') > -1) {
$('.details-tabs li.notatab').removeClass('invisible');
}
else {
$('.details-tabs li.notatab').removeClass('invisible');
$('.details-tabs li.notatab').addClass('invisible');
}
}
});
$('.image > a').hover(function () {
if ($(this).is('.tophalf')) {
$(this).parent().addClass("topactive");
}
else if ($(this).is('.bottomhalf')) {
$(this).parent().addClass("bottomactive");
}
}, function () {
$(this).parent().removeClass("topactive bottomactive");
});
ToggleAClick();
$('.nav > .logo > a').mouseenter(function () {
$('.nav > .logo > a > .on').removeClass('hidden');
$('.nav > .logo > a > .off').removeClass('hidden');
$('.nav > .logo > a > .off').addClass('hidden');
});
$('.nav > .logo > a').mouseleave(function () {
$('.nav > .logo > a > .off').removeClass('hidden');
$('.nav > .logo > a > .on').removeClass('hidden');
$('.nav > .logo > a > .on').addClass('hidden');
});
// catch dialog if opened within a viewport smaller than the dialog width
$(document).on("dialogopen", ".ui-dialog", function (event, ui) {
fluidDialog();
});
//$('.modal').on('show.bs.modal', centerModal);
}
// handle popover close button click
function ClosePopover() {
$('[data-toggle="popover"].popover-custom').popover('hide');
}
function CloseFilter() {
$('.filter').hide();
$('.filter-bar-small > li').each(function () {
$(this).removeClass('active');
});
}
function fluidDialog() {
var $visible = $(".ui-dialog:visible");
// each open dialog
$visible.each(function () {
var $this = $(this);
var dialog = $this.find(".ui-dialog-content").data("ui-dialog");
// if fluid option == true
if (dialog !== undefined) {
if (dialog.options.fluid) {
var wWidth = $(window).width();
// check window width against dialog width
if (wWidth < (parseInt(dialog.options.maxWidth) + 50)) {
// keep dialog from filling entire screen
$this.css("max-width", "90%");
} else {
// fix maxWidth bug
$this.css("max-width", dialog.options.maxWidth + "px");
}
//reposition dialog
dialog.option("position", dialog.options.position);
}
}
});
}
// Highlight filter buttons
function HighlightButtons() {
$('.filter').each(function () {
var filter = $(this);
var class_name = "";
var classList = filter.attr('class').split(/\s+/);
$.each(classList, function (index, item) {
if (item !== 'filter') {
class_name = item;
}
});
if (class_name.length > 0) {
var button = $('.filter-bar-small > li > div.' + class_name);
if (filter.find('span.active,div.active').length) {
button.addClass('active');
} else {
button.removeClass('active');
}
}
});
}
function ReplaceSVGwithPNG() {
if (!Modernizr.svgasimg) {
//if (true) {
$("img[src$='.svg']").each(function () {
$(this).attr("src", $(this).attr('src').replace('.svg', '.png'));
});
}
}
function CheckForFeatures() {
ReplaceSVGwithPNG();
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement("style");
msViewportStyle.appendChild(
document.createTextNode(
"@-ms-viewport{width:auto!important}"
)
);
document.getElementsByTagName("head")[0].
appendChild(msViewportStyle);
}
}
// Highlight changes in now showing text.
function NowShowingSentenceChanged() {
var newSentence = $(".searchsummary-text").text();
var newSentenceHighlight = newSentence;
if (oldsentence != "" && newSentence != "" && oldsentence != newSentence) {
var pattern = /\w+/g;
var arr1 = newSentence.match(pattern);
var arr2 = oldsentence.match(pattern);
var matchedWords = new Array();
var newWordsIndex = 0;
var index1 = arr1.length;
var index2 = arr2.length;
for (var i = 0; i < index1; i++) {
var found = false;
for (var j = 0; j < index2; j++) {
if (arr1[i].toLowerCase() == arr2[j].toLowerCase()) {
found = true;
}
}
if (!found && matchedWords.indexOf(arr1[i]) < 0) {
matchedWords[newWordsIndex] = arr1[i];
newWordsIndex++;
}
}
oldsentence = $('.searchsummary-text').html();
clearTimeout(mytimeout);
for (var i = 0; i < matchedWords.length; i++) {
var txtpat = '\\b' + matchedWords[i] + '\\b';
var regex2 = new RegExp(txtpat);
//newSentenceHighlight = replaceAll(newSentenceHighlight, matchedWords[i], "
" + matchedWords[i] + "");
newSentenceHighlight = newSentenceHighlight.replace(regex2, "
" + matchedWords[i] + "");
}
$('.searchsummary-text').html(newSentenceHighlight);
$('.searchsummary-text').children("span").each(function () {
$(this).animate({
backgroundColor: "white"
}, 3000);
});
mytimeout = setTimeout(function () {
$('.searchsummary-text').html(newSentence);
}, 3001);
}
}
function centerModal() {
$(this).css('display', 'block');
var $dialog = $(this).find(".modal-dialog");
var offset = ($(window).height() - $dialog.height()) / 2;
// Center modal vertically in window
$dialog.css("margin-top", offset);
}
// Window Load Event
$(window).load(function () {
windows_width = $(window).width();
});
// Hide popovers on window resize
$(window).resize(function () {
$('[data-toggle^="popover"]').popover('hide');
if (windows_width != $(window).width()) {
windows_width = $(window).width();
if ($('.sm_screen').is(':visible')) {
if (!$('.exam_list,.messages_list').is('visible')) {
$('.exam_list,.messages_list').show();
}
} else {
$('.exam_list,.messages_list').hide();
}
if (!$('.filter-bar-small').is(":visible")) {
$('.filter').show();
} else {
$('.filter').hide();
$('.filter-bar-small > li').each(function () {
$(this).removeClass('active');
});
}
fluidDialog();
//$('.modal:visible').each(centerModal);
}
});
function GetUnique(inputArray) {
var outputArray = [];
for (var i = 0; i < inputArray.length; i++) {
if ((jQuery.inArray(inputArray[i], outputArray)) == -1) {
outputArray.push(inputArray[i]);
}
}
return outputArray;
}
function PasteValidationCode(e, destinationctrlWrapper) {
var text = "";
var wPasteType = "";
if (e.clipboardData) {
if (e.clipboardData.types) {
wPasteType = "text/plain";
text = e.clipboardData.getData("text/plain");
} else {
wPasteType = "text/plain";
text = e.clipboardData.getData('text/plain');
var url = e.clipboardData.getData('text/uri-list');
var html = e.clipboardData.getData('text/html');
}
} else if (window.clipboardData) {
wPasteType = "Text";
text = window.clipboardData.getData('Text');
var url = window.clipboardData.getData('URL');
}
text = text.replace(/-/g, '');
text = text.replace(/\s/g, "");
text = text.replace(/^\s+|\s+$/g, '');
var destinationctrlDisplay = $('#' + destinationctrlWrapper + ' input[type="text"]')
$('#' + destinationctrlWrapper + ' input[type="hidden"]').val(text)
if (destinationctrlDisplay.length != 1) {
var wMaxLength = 0;
try {
wMaxLength = destinationctrlDisplay.first()[0].maxLength
} catch (err) { }
if (wMaxLength == null || wMaxLength == 0 || wMaxLength == "") {
wMaxLength = text.length / destinationctrlDisplay.length;
}
var Counter = 0;
destinationctrlDisplay.each(function () {
var SplitValue = text.substring((Counter * wMaxLength), ((Counter * wMaxLength) + wMaxLength))
$(this).val(SplitValue);
$(this).focus();
Counter++
});
}
}
function MarkCheckboxDependentsasRequired(CheckBoxCtrl, CheckedFirstTimeLoad) {
var $input = CheckBoxCtrl.find('input');
var CheckBoxChecked = CheckedFirstTimeLoad;
if ($input.attr('make-Styled')) {
var wMakeStyled = $input.attr('make-Styled').split(',');
for (i = 0; i < wMakeStyled.length; i++) {
var wStyledFeild = $('#' + wMakeStyled[i].trim());
wStyledFeild.removeClass('cc-required');
}
if ($('#RequiredSearchParameter').length == 1 && $('#RequiredSearchParameter').val() == "true" || $('#RequiredSearchParameter').length <= 0) {
if ($input.prop('checked')) {
for (i = 0; i < wMakeStyled.length; i++) {
var wStyledFeild = $('#' + wMakeStyled[i].trim());
wStyledFeild.addClass('cc-required');
}
}
}
if (CheckBoxChecked != undefined && CheckBoxChecked == false && $input.attr('HiddenLabel') == "true" && $input.attr('name').trim() == "IncludeOutsideExams")
{
$input.attr('checked', true);
if ($('#RequiredSearchParameter').length == 1 && $('#RequiredSearchParameter').val() == "true" || $('#RequiredSearchParameter').length <= 0) {
for (i = 0; i < wMakeStyled.length; i++) {
var wStyledFeild = $('#' + wMakeStyled[i].trim());
wStyledFeild.addClass('cc-required');
}
}
}
}
if ($input.attr('make-required')) {
var wMakeRequired = $input.attr('make-required').split(',');
for (i = 0; i < wMakeRequired.length; i++) {
var wRequiredFeild = $('#' + wMakeRequired[i].trim());
wRequiredFeild.removeAttr('data-val');
wRequiredFeild.removeAttr('data-val-mvcvtkrequiredif-targetvalue');
wRequiredFeild.removeAttr('data-val-mvcvtkrequiredif-dependentproperty');
wRequiredFeild.removeAttr('data-val-mvcvtkrequiredif');
if (wRequiredFeild.hasClass("input-validation-error")) {
wRequiredFeild.removeClass('input-validation-error');
var wParentContainer = wRequiredFeild.parents('.form-group');
wParentContainer.removeClass('has-feedback');
wParentContainer.removeClass('has-error');
var wErrorMsgContainer = wParentContainer.find('.help-block');
wErrorMsgContainer.removeClass('field-validation-error');
wErrorMsgContainer.addClass('field-validation-valid');
wErrorMsgContainer.html("");
}
}
CheckBoxCtrl.parents('form').removeData("validator").removeData("unobtrusiveValidation");
if ($input.prop('checked')) {
for (i = 0; i < wMakeRequired.length; i++) {
var wRequiredFeild = $('#' + wMakeRequired[i].trim());
wRequiredFeild.attr('data-val', 'true');
wRequiredFeild.attr('data-val-mvcvtkrequiredif-targetvalue', 'true');
wRequiredFeild.attr('data-val-mvcvtkrequiredif-dependentproperty', 'RequiredSearchParameter');
wRequiredFeild.attr('data-val-mvcvtkrequiredif', String.format(wisRequired, wRequiredFeild.attr('placeholder')));
}
}
if (CheckBoxChecked != undefined && CheckBoxChecked == false && $input.attr('HiddenLabel') == "true" && $input.attr('name').trim() == "IncludeOutsideExams")
{
for (i = 0; i < wMakeRequired.length; i++) {
var wRequiredFeild = $('#' + wMakeRequired[i].trim());
wRequiredFeild.attr('data-val', 'true');
wRequiredFeild.attr('data-val-mvcvtkrequiredif-targetvalue', 'true');
wRequiredFeild.attr('data-val-mvcvtkrequiredif-dependentproperty', 'RequiredSearchParameter');
wRequiredFeild.attr('data-val-mvcvtkrequiredif', String.format(wisRequired, wRequiredFeild.attr('placeholder')));
}
}
$.validator.unobtrusive.parse(CheckBoxCtrl.parents('form'));
}
}
$('#RequiredSearchParameter').change(function (e) {
if ($("[make-Styled]").length > 0) {
$input = $("[make-Styled]");
var wMakeStyled = $input.attr('make-Styled').split(',');
if ($('#RequiredSearchParameter').val() == "true") {
if ($input.prop('checked')) {
for (i = 0; i < wMakeStyled.length; i++) {
var wStyledFeild = $('#' + wMakeStyled[i].trim());
wStyledFeild.removeClass('cc-required');
}
if ($input.prop('checked')) {
for (i = 0; i < wMakeStyled.length; i++) {
var wStyledFeild = $('#' + wMakeStyled[i].trim());
wStyledFeild.addClass('cc-required');
}
}
if (CheckBoxChecked != undefined && CheckBoxChecked == false && $input.attr('HiddenLabel') == "true" && $input.attr('name').trim() == "IncludeOutsideExams") {
$input.attr('checked', true);
for (i = 0; i < wMakeStyled.length; i++) {
var wStyledFeild = $('#' + wMakeStyled[i].trim());
wStyledFeild.addClass('cc-required');
}
}
}
} else {
for (i = 0; i < wMakeStyled.length; i++) {
var wStyledFeild = $('#' + wMakeStyled[i].trim());
wStyledFeild.removeClass('cc-required');
}
}
}
});
function ApplyRequiredCSS(CheckBoxCtrl, CheckedFirstTimeLoad) {
var $input = CheckBoxCtrl.find('input');
var CheckboxChecked = CheckedFirstTimeLoad;
var wExpandingTxt = CheckBoxCtrl.parents('.outside-practice-checkbox').find('.outside-practice-text');
if ($input.prop('checked')) {
wExpandingTxt.show();
} else {
wExpandingTxt.hide();
}
if (CheckboxChecked != undefined && CheckboxChecked == false && $input.attr('HiddenLabel') == "true" && $input.attr('name').trim() == "IncludeOutsideExams")
{
wExpandingTxt.show();
}
}
function containsAll(needles, haystack) {
for (var i = 0, len = needles.length; i < len; i++) {
if (!isNaN(needles[i]) && $.inArray(needles[i], haystack) == -1) return false;
}
return true;
}
function SelectedDesiredTab(aForcedSelection) {
var wFocusTab = null;
if (aForcedSelection != null) {
wFocusTab = aForcedSelection;
}
if (window.location.hash != "" && window.location.hash.trim() != "#" && (wFocusTab == null || wFocusTab.length <= 0)) {
wFocusTab = $("ul.my-tabs li a[href='" + window.location.hash + "']")
}
if (window.location.hash != "" && window.location.hash.trim() != "#" && (wFocusTab == null || wFocusTab.length <= 0)) {
wFocusTab = $("ul.details-tabs li a[href='" + window.location.hash + "']")
}
if (typeof DefaultSystemSelectedTab !== 'undefined' && DefaultSystemSelectedTab != null && DefaultSystemSelectedTab != "") {
if (wFocusTab == null || wFocusTab.length <= 0) {
wFocusTab = $("ul.details-tabs li a[href='#" + DefaultSystemSelectedTab + "']")
}
if (wFocusTab == null || wFocusTab.length <= 0) {
wFocusTab = $("ul.my-tabs li a[href='#" + DefaultSystemSelectedTab + "']")
}
}
if (wFocusTab == null || wFocusTab.length <= 0) {
wFocusTab = $("ul.my-tabs li.default_tab_section a[data-toggle='tab']").first();
if (wFocusTab == null || wFocusTab.length <= 0) {
$("ul.my-tabs li.default_tab_section").removeClass("default_tab_section");
}
}
if (wFocusTab == null || wFocusTab.length <= 0) {
wFocusTab = $("ul.details-tabs li.default_tab_section a[data-toggle='tab']").first();
if (wFocusTab == null || wFocusTab.length <= 0) {
$("ul.details-tabs li.default_tab_section").removeClass("default_tab_section");
}
}
//if (wFocusTab == null || wFocusTab.length <= 0) {
// wFocusTab = $("ul.my-tabs li a[data-toggle='tab']").first();
//}
//if (wFocusTab == null || wFocusTab.length <= 0) {
// wFocusTab = $("ul.details-tabs li a[data-toggle='tab']").first();
//}
if (wFocusTab == null || wFocusTab.length <= 0) {
wFocusTab = $("ul.my-tabs li a[href='#tab1']")
if (wFocusTab == null || wFocusTab.length == 0 && $("ul.my-tabs li a").length > 0) {
wFocusTab = $("ul.my-tabs li a[data-toggle='tab']").first();
}
}
if (wFocusTab == null || wFocusTab.length <= 0) {
wFocusTab = $("ul.details-tabs li a[href='#tab1']")
if (wFocusTab == null || wFocusTab.length == 0 && $("ul.details-tabs li a").length > 0) {
wFocusTab = $("ul.details-tabs li a[data-toggle='tab']").first();
}
}
if (wFocusTab != null && wFocusTab.length > 0) {
wFocusTab.trigger('click');
}
}
function FocusTab(tabName) {
var wDesiredTab = $('#' + tabName);
if (wDesiredTab == null || wDesiredTab.length <= 0) {
wDesiredTab = $("ul.my-tabs li a[href='#" + tabName + "']")
}
if (wDesiredTab == null || wDesiredTab.length <= 0) {
wDesiredTab = $("ul.details-tabs li a[href='#" + tabName + "']")
}
SelectedDesiredTab(wDesiredTab)
}
function FocusTabOrPage(tabName, pageLoad) {
var wDesiredTab = $('#' + tabName);
if (wDesiredTab == null || wDesiredTab.length <= 0) {
wDesiredTab = $("ul.my-tabs li a[href='#" + tabName + "']")
}
if (wDesiredTab == null || wDesiredTab.length <= 0) {
wDesiredTab = $("ul.details-tabs li a[href='#" + tabName + "']")
}
if (wDesiredTab != null && wDesiredTab.length > 0) {
SelectedDesiredTab(wDesiredTab)
} else {
window.location.href = pageLoad;
}
}
function ApplyResponce(e, status, statusDiv, formArea) {
if ($('#HideOnReloadFormMessage').length) {
//if (!$('#HideOnReloadFormMessage').hasClass('hidden')) {
// $('#HideOnReloadFormMessage').hide();
//}
$('#DisplayOnReloadFormMessage').hide()
}
if ($('#DisplayOnReloadFormMessage').length) {
if ($('#DisplayOnReloadFormMessage').hasClass('hidden')) {
$('#DisplayOnReloadFormMessage').removeClass('hidden');
}
$('#DisplayOnReloadFormMessage').show()
}
$('#' + formArea).find(":submit").removeClass('disabled');
if (e.HTTPRedirect != null && e.HTTPRedirect != "") {
window.location.href = e.HTTPRedirect;
}
if (e.HTMLResponce != null && e.HTMLResponce != "") {
var wFormAreaDiv = $('#' + formArea);
wFormAreaDiv.html(e.HTMLResponce);
ReplaceSVGwithPNG();
RegisterFormValidation($("form"));
MarkCheckboxDependentsasRequired($('.outside-practice-checkbox .checkbox'));
ApplyRequiredCSS($('.outside-practice-checkbox .checkbox'));
ApplyUIComponents();
RegisterCustomValidation();
ApplyHasChangesCheck();
ZipCodeFieldEnabled(wFormAreaDiv);
//SignUpForEvents();
//HighlightButtons();
//CheckForFeatures();
}
var wStatusDiv = $('#' + statusDiv);
if (e.message != null && e.message != "") {
wStatusDiv.css("display", "block");
if (e.success) {
if (!wStatusDiv.hasClass("alert-info")) {
wStatusDiv.addClass("alert-info");
}
if (!wStatusDiv.hasClass("alert-warning")) {
wStatusDiv.removeClass("alert-warning");
}
} else {
if (!wStatusDiv.hasClass("alert-warning")) {
wStatusDiv.addClass("alert-warning");
}
if (!wStatusDiv.hasClass("alert-info")) {
wStatusDiv.removeClass("alert-info");
}
}
wStatusDiv.html(e.message);
//wStatusDiv.each(function () {
// $(this).delay(3000).fadeOut("slow");
//});
}
else {
wStatusDiv.empty();
wStatusDiv.css("display", "none");
}
}
function OnAjaxComplete() {
$(document).ajaxStop(function () {
// TODO: it would be better to have the disabled class be removed per specific ajax call response function rather than this generic method. But it would be harder to maintain. Meanwhile I'll leave this as is. - AT
$('.submit-disabled').removeClass('disabled submit-disabled');
});
}
function ZipCodeFieldEnabled(Form)
{
if (PortalZipCodeEnabled.toLowerCase() == "false") {
if ($(Form[0]).find('#DefinePatient_ZipCode').length > 0) {
$(Form[0]).find('#DefinePatient_ZipCode').parent().parent().parent().find('span.important-text').remove();
$(Form[0]).find('#DefinePatient_ZipCode').rules("remove", "required");
}
else if ($(Form[0]).find('#GuestAccountAddress_ZipCode').length > 0) {
$(Form[0]).find('#GuestAccountAddress_ZipCode').parent().parent().parent().find('span.important-text').remove();
$(Form[0]).find('#GuestAccountAddress_ZipCode').rules("remove", "required");
}
else if($(Form[0]).find('input#primary_address_zipcode_req').length > 0)
{
$(Form[0]).find('input#primary_address_zipcode_req').parent().parent().parent().find('span.important-text').remove();
$(Form[0]).find('input#primary_address_zipcode_req').rules("remove", "required");
}
else
{
}
}
}
// DOM ready, release the kraken!
$(document).ready(function () {
$.fn.textWidth = function (text, font) {
if (!$.fn.textWidth.fakeEl) $.fn.textWidth.fakeEl = $('
').hide().appendTo(document.body);
if (this[0].nodeName.toLowerCase() == "select") {
$.fn.textWidth.fakeEl.text(text || this.text() || this.val()).css('font', font || this.css('font'));
} else {
$.fn.textWidth.fakeEl.text(text || this.val() || this.text()).css('font', font || this.css('font'));
}
return $.fn.textWidth.fakeEl.width();
};
RegisterFormValidation($("form"));
OnAjaxComplete();
MarkCheckboxDependentsasRequired($('.outside-practice-checkbox .checkbox'), false);
ApplyRequiredCSS($('.outside-practice-checkbox .checkbox'),false);
ApplyUIComponents();
GenerateRedirectToastMessages();
ApplyHasChangesCheck();
SignUpForEvents();
//LogMyCounter(counterCode);
HighlightButtons();
ZipCodeFieldEnabled($("form"));
CheckForFeatures();
if (navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)) {
$('input[type=text], select, textarea').on('focus', function () {
// replace CSS font-size with 16px to disable auto zoom on iOS
$(this).data('fontSize', $(this).css('font-size')).css('font-size', '16px');
}).on('blur', function () {
// put back the CSS font-size
$(this).css('font-size', $(this).data('fontSize'));
});
}
// Get the now showing sentence so that when changes occur they could be highlighted.
$('.searchsummary-text').each(function () {
oldsentence = $('.searchsummary-text').text();
});
$('.testchange').click(function (e) {
e.preventDefault();
$('.searchsummary-text').text(String.format(wCompletedExamsinPrevious0DaysFor1Provider, ((1 + Math.floor(Math.random() * 6)) * 10), ((1 + Math.floor(Math.random() * 30)))));
NowShowingSentenceChanged();
});
});
$('img.popoverbutton').click(function (e) {
alert("hi4");
});
$('[data-toggle="popover-attachments"]').click(function () {
alert('portal_provider.js 2');
$('[data-toggle="popover-attachments"]').not(this).popover('hide');
});
if (typeof String.prototype.endsWith !== 'function') {
String.prototype.endsWith = function (suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
}
if (typeof String.prototype.startsWith !== 'function') {
String.prototype.startsWith = function (prefix) {
return this.indexOf(prefix) === 0;
};
}
if (typeof String.prototype.includes !== 'function') {
String.prototype.includes = function (search, start) {
'use strict';
if (typeof start !== 'number') {
start = 0;
}
if (start + search.length > this.length) {
return false;
} else {
return this.indexOf(search, start) !== -1;
}
}
}
function DateFormatItems(formatItems, pattern)
{
for (var index = 0; index < formatItems.length; index++) {
var item = formatItems[index];
if (item.indexOf(pattern) > -1) {
return index;
}
}
}
function stringToDate(_date, _format, _delimiter) {
var formatLowerCase = _format.toLowerCase();
var formatItems = formatLowerCase.split(_delimiter);
var dateItems = _date.split(_delimiter);
var DateformatItems = [];
DateformatItems.push(_format.split(_delimiter));
var monthIndex = DateFormatItems(formatItems, "m");
var dayIndex = DateFormatItems(formatItems, "d");
var yearIndex = DateFormatItems(formatItems, "y");
var month = parseInt(dateItems[monthIndex]);
var year = dateItems[yearIndex];
if (year.length == 2) {
year = "20" + year;
}
month -= 1;
var formatedDate = new Date(year, month, dateItems[dayIndex]);
return formatedDate;
}
if (!String.prototype.format) {
String.prototype.format = function () {
var args = arguments;
return this.replace(/{(\d+)}/g, function (match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match;
});
};
}
if (!String.format) {
String.format = function (format) {
var args = Array.prototype.slice.call(arguments, 1);
return format.replace(/{(\d+)}/g, function (match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}
if (!String.prototype.replaceAll) {
String.prototype.replaceAll = function (search, replacement) {
var target = this;
return target.split(search).join(replacement);
};
}
(function ($) {
$.fn.serializeFormJSON = function () {
var o = {};
var a = this.serializeArray();
$.each(a, function () {
if (o[this.name]) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
})(jQuery);
(function ($) {
$.fn.spin = function (opts, color) {
var presets = {
"tiny": { lines: 9, length: 2, width: 2, radius: 4, trail: 70, speed: 1 },
"small": { lines: 8, length: 4, width: 3, radius: 5 },
"large": { lines: 10, length: 8, width: 4, radius: 8 }
};
var overlay = $('');
if (Spinner) {
return this.each(function () {
var $this = $(this),
data = $this.data();
if (data.spinner) {
data.spinner.stop();
delete data.spinner;
}
if (opts !== false) {
if (typeof opts === "string") {
if (opts in presets) {
opts = presets[opts];
} else {
opts = presets['tiny'];
}
if (color) {
opts.color = color;
}
}
else {
opts = presets['tiny'];
}
overlay.css({
width: $this.innerWidth(),
height: $this.innerHeight(),
left: 0,
top: 0
});
overlay.appendTo(this);
data.spinner = new Spinner($.extend({ color: $this.css('color') }, spinneropts)).spin(this);
}
else {
$this.find('.overlay').remove();
}
});
} else {
throw "Spinner class not available.";
}
};
})(jQuery);
/*
* classList.js: Cross-browser full element.classList implementation.
* 2014-07-23
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*global self, document, DOMException */
/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/
if ("document" in self) {
// Full polyfill for browsers with no classList support
if (!("classList" in document.createElement("_"))) {
(function (view) {
"use strict";
if (!('Element' in view)) return;
var
classListProp = "classList"
, protoProp = "prototype"
, elemCtrProto = view.Element[protoProp]
, objCtr = Object
, strTrim = String[protoProp].trim || function () {
return this.replace(/^\s+|\s+$/g, "");
}
, arrIndexOf = Array[protoProp].indexOf || function (item) {
var
i = 0
, len = this.length
;
for (; i < len; i++) {
if (i in this && this[i] === item) {
return i;
}
}
return -1;
}
// Vendors: please allow content code to instantiate DOMExceptions
, DOMEx = function (type, message) {
this.name = type;
this.code = DOMException[type];
this.message = message;
}
, checkTokenAndGetIndex = function (classList, token) {
if (token === "") {
throw new DOMEx(
"SYNTAX_ERR"
, "An invalid or illegal string was specified"
);
}
if (/\s/.test(token)) {
throw new DOMEx(
"INVALID_CHARACTER_ERR"
, "String contains an invalid character"
);
}
return arrIndexOf.call(classList, token);
}
, ClassList = function (elem) {
var
trimmedClasses = strTrim.call(elem.getAttribute("class") || "")
, classes = trimmedClasses ? trimmedClasses.split(/\s+/) : []
, i = 0
, len = classes.length
;
for (; i < len; i++) {
this.push(classes[i]);
}
this._updateClassName = function () {
elem.setAttribute("class", this.toString());
};
}
, classListProto = ClassList[protoProp] = []
, classListGetter = function () {
return new ClassList(this);
}
;
// Most DOMException implementations don't allow calling DOMException's toString()
// on non-DOMExceptions. Error's toString() is sufficient here.
DOMEx[protoProp] = Error[protoProp];
classListProto.item = function (i) {
return this[i] || null;
};
classListProto.contains = function (token) {
token += "";
return checkTokenAndGetIndex(this, token) !== -1;
};
classListProto.add = function () {
var
tokens = arguments
, i = 0
, l = tokens.length
, token
, updated = false
;
do {
token = tokens[i] + "";
if (checkTokenAndGetIndex(this, token) === -1) {
this.push(token);
updated = true;
}
}
while (++i < l);
if (updated) {
this._updateClassName();
}
};
classListProto.remove = function () {
var
tokens = arguments
, i = 0
, l = tokens.length
, token
, updated = false
, index
;
do {
token = tokens[i] + "";
index = checkTokenAndGetIndex(this, token);
while (index !== -1) {
this.splice(index, 1);
updated = true;
index = checkTokenAndGetIndex(this, token);
}
}
while (++i < l);
if (updated) {
this._updateClassName();
}
};
classListProto.toggle = function (token, force) {
token += "";
var
result = this.contains(token)
, method = result ?
force !== true && "remove"
:
force !== false && "add"
;
if (method) {
this[method](token);
}
if (force === true || force === false) {
return force;
} else {
return !result;
}
};
classListProto.toString = function () {
return this.join(" ");
};
if (objCtr.defineProperty) {
var classListPropDesc = {
get: classListGetter
, enumerable: true
, configurable: true
};
try {
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
} catch (ex) { // IE 8 doesn't support enumerable:true
if (ex.number === -0x7FF5EC54) {
classListPropDesc.enumerable = false;
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
}
}
} else if (objCtr[protoProp].__defineGetter__) {
elemCtrProto.__defineGetter__(classListProp, classListGetter);
}
}(self));
} else {
// There is full or partial native classList support, so just check if we need
// to normalize the add/remove and toggle APIs.
(function () {
"use strict";
var testElement = document.createElement("_");
testElement.classList.add("c1", "c2");
// Polyfill for IE 10/11 and Firefox <26, where classList.add and
// classList.remove exist but support only one argument at a time.
if (!testElement.classList.contains("c2")) {
var createMethod = function (method) {
var original = DOMTokenList.prototype[method];
DOMTokenList.prototype[method] = function (token) {
var i, len = arguments.length;
for (i = 0; i < len; i++) {
token = arguments[i];
original.call(this, token);
}
};
};
createMethod('add');
createMethod('remove');
}
testElement.classList.toggle("c3", false);
// Polyfill for IE 10 and Firefox <24, where classList.toggle does not
// support the second argument.
if (testElement.classList.contains("c3")) {
var _toggle = DOMTokenList.prototype.toggle;
DOMTokenList.prototype.toggle = function (token, force) {
if (1 in arguments && !this.contains(token) === !force) {
return force;
} else {
return _toggle.call(this, token);
}
};
}
testElement = null;
}());
}
}
$.isInArray = function (item, array) { return !!~$.inArray(item, array); };
jQuery.extend(jQuery.validator.messages, {
required: wFieldIsRequired,
remote: wPleaseFixThisField,
email: wPleaseEnteraValidEmail,
url: wPleaseEnterValidURL,
date: wPleaseEnterValidDate,
number: wPleaseEnterValidNumber,
digits: wPleaseEnterOnlyDigits,
equalTo: wPleaseEnterTheSameValueAgain,
accept: wPleaseEnterWithAValidExtension,
maxlength: jQuery.validator.format(wPleaseEnterNoMoreThan0Characters),
minlength: jQuery.validator.format(wPleaseEnterAtLeast0Characters),
rangelength: jQuery.validator.format(wPleaseEnterValueBetween0and1Long),
range: jQuery.validator.format(wPleaseEnterValueBetween0and1),
max: jQuery.validator.format(wPleaseEnterValuLessOrEqual),
min: jQuery.validator.format(wPleaseEnterValuGreaterOrEqual)
});
$(function () {
$.validator.methods.date = function (value, element) {
return this.optional(element) || moment(value, DateFormat, true).isValid();
}
});
$(function () {
$.fn.popover.Constructor.prototype.reposition = function () {
var $tip = this.tip()
var autoPlace = true
var placement = typeof this.options.placement === 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement
var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var orgPlacement = placement
var viewportDim = this.getPosition(this.$viewport)
placement = placement === 'bottom' &&
pos.bottom + actualHeight > viewportDim.bottom ? 'top' : placement === 'top' &&
pos.top - actualHeight < viewportDim.top ? 'bottom' : placement === 'right' &&
pos.right + actualWidth > viewportDim.width ? 'left' : placement === 'left' &&
pos.left - actualWidth < viewportDim.left ? 'right' : placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
}
})
//if (window.history.state != null) {
// let keys = Object.keys(window.history.state);
// for (var key of keys) {
// console.log(key);
// }
// //wExamWLData = window.history.state.wExamWLData;
// //SearchResults.UpdateData(wExamWLData);
// //SearchResults.RebuildResults();
// //ApplyMyView();
// //GeneratePatients();
// //GenerateWLMainTabNavCounters();
// //UpdateTabCounters();
// //if ($('.update-data-button image').hasClass("imageRotate")) {
// // $('.update-data-button image').removeClass("imageRotate");
// //}
// //$("#RefreshingData").hide();
// //$("#WLContainer").show();
//};
//$(function () {
// alert('function()');
//});
//$(document).ready(function () {
// alert('$(document).ready');
//});
//alert('auto');