jQuery.namespace('lexisnexis.page');
/**
* DEFINE ALL THE GLOBAL EVENT TYPES
*/
var EVENT_TYPES = {
// This is the event sent for displaying the report outage info window
PAGE_LOAD_COMPLETE:0,
ON_DATASET_CHANGE : 1,
ON_PROVIDER_ROLE_CHANGE : 2,
SHOW_AJAX_INDICATOR : 4,
// Used in condition page
UPDATE_TABLE_DATA : 5,
APPLY_BUTTON_CLICK : 6,
DATE_RANGES_SUCCESS : 7,
UPDATE_SCREEN_PARAMETERS_SUCCESS : 8 ,
COMPARISON_PEER_GROUP_SUCCESS : 9,
SUB_CLIENT_PERMISSION_SUCCESS : 10 ,
OVERALL_EFFICIENCY_TOTALS_SUCCESS : 11
},leftNavActiveList=null;
/**
* Base Page Object which all objects should inherit from
*
* @class lexisnexis.page.Page
*/
lexisnexis.page.Page = lexisnexis.LNClass
.extend({
data : {
LISTENER_LIST : [],
renderLog : true,
zeroProviderCountMsgDivID : '#zeroProviderCountMsgDiv',
lnhccPotalKeepAliveFlag : true
},
// An array of listeners for update_map
init : function(config) {
this._super(config);
},
// Ready when JQuery is loaded
onLoad : function() {
var appType = $('#appType').val();
var cs = this;
// register startTime
cs.data.startTime = new Date();
cs.registerPageLoad();
cs.registerAjaxComplete();
cs.onClickDeletedPeerGroupModalOk();
cs.onClickSubClientPermissionChangedOk();
//if ( $('#ln_isCreatePeerGroupScreen').val() == "true" ) { Create New Peer Group
//if($('#ln_filterName').text().trim()!='My Templates' ||$('#ln_filterName').text().trim()!='Create New Peer Group') {
if($('#ln_filterName').text().trim()!='My Templates' && $('#ln_filterName').text().trim()!='Create New Peer Group'
&& $('#ln_filterName').text().trim() != 'Measure Compliance' && $('#ln_filterName').text().trim()!= "Template Library") {
cs.updateProviderCounts(false);
}
dlg.closeHlpDialog();
window.onerror = function (errorMsg, url, lineNumber) {
if(LN.isAjaxError && LN.isAjaxError===true) {
$('#ln_ajaxErrorDialog').modal();
LN.isAjaxError=false;
}
}
},
loaded : false,
// Method used to bind objects to the onLoad function of the page
onReady : function(handler) {
$(this).bind("ready", handler);
},
statusMessageBox : null,
statusMessageRemoveClass : 'msgToRemove',
/**
* This method will disable the left nav links along with save and
* run and run button,
*
*
* @method disableLeftNav
*/
disableLeftNav : function() {
$('#ln_leftNav').find('button').addClass('disabled');
//leftNavActiveList=$('#ln_leftNav button:enabled');
$('#ln_leftNav button:enabled').prop('disabled',true);
$('#runTemplateBtn').attr('disabled', 'disabled');
$('#runTemplateBtn').addClass('disabled');
$('#runTemplateBtn').css("pointer-events", "none");
$('#saveTemplateModalBtn').attr('disabled', 'disabled');
$('#saveTemplateModalBtn').addClass('disabled');
$('#saveTemplateModalBtn').css("pointer-events", "none");
$('.dropdown-menu').find('a').addClass('disabled');
$('div#activetemplate ').block({
message: '' ,
overlayCSS: { backgroundColor: '#fff' , cursor: '' , opacity: 0 }
});
},
/**
* This method will enable the left nav links along with save and
* run and run button,
*
*
* @method disableLeftNav
*/
enableLeftNav : function() {
$('#ln_leftNav').find('button').removeClass('disabled');
/*if(leftNavActiveList){
$(leftNavActiveList).removeAttr('disabled');
}*/
$('#ln_leftNav button:not(.ln-pointer-events-auto)').prop('disabled',false);
$('#runTemplateBtn').removeAttr('disabled');
$('#saveTemplateModalBtn').removeAttr('disabled');
$('#runTemplateBtn').removeClass('disabled');
$('#saveTemplateModalBtn').removeClass('disabled');
$('#runTemplateBtn').css("pointer-events", "auto");
$('#saveTemplateModalBtn').css("pointer-events", "auto");
$('.dropdown-menu').find('a').removeClass('disabled');
$('div#activetemplate ').unblock();
},
/**
* Displays status messages @ the top of the page.
* @componentId : the component id calling the displaymessage
* @messageId: the Id of the message
* @status: one of the following: INFO, WARNING, ERROR, SUCCESS,
* NONE
* @method displayStatusMessage
*/
displayStatusMessage : function(componentId, messageId, status,
message) {
var cs = this;
if (this.statusMessageBox == null) {
$(".main-row")
.prepend(
"<div id='dynamicStatusMessages' class='sixteen columns ui-state-highlight ui-corner-all'><span class='closeDynamicStatusMessages'>x</span></div>");
this.statusMessageBox = $(".main-row").find(
"#dynamicStatusMessages");
this.statusMessageBox.find('.closeDynamicStatusMessages')
.click(function() {
cs.statusMessageBox.remove();
return false;
});
}
var messageIcon;
switch (status) {
case "INFO":
messageIcon = "ui-icon-info";
break;
case "WARNING":
messageIcon = "ui-icon-notice";
break;
case "ERROR":
messageIcon = "ui-icon-alert";
break;
case "SUCCESS":
messageIcon = "ui-icon-check";
break;
default:
messageIcon = "";
}
this.statusMessageBox
.append("<div class='statusMessage "
+ componentId
+ "_"
+ messageId
+ "'><span style='float: left; margin-right: 0.3em;' class='ui-icon "
+ messageIcon + "'></span>" + message
+ "</div>");
},
/**
* Clears a specific message from the message box
*
* @componentId : the component id calling the clearMessage
* @messageId : the Id of the message
*/
clearMessage : function(componentId, messageId) {
LN.debug("Should clear message: " + messageId
+ " for component id " + componentId);
},
/**
* Clears all messages for the specific componentId from the message
* box
*
* @componentId : the component id calling the
* clearAllComponentMessages
*/
clearAllComponentMessages : function(componentId) {
var cs = this;
var classPattern = new RegExp(componentId, 'g');
$(cs.statusMessageBox).find('.statusMessage').each(
function() {
var classes = this.className.split(' ');
$.each(classes, function(index, value) {
if (classPattern.test(value)) {
$('.' + value).addClass(
cs.statusMessageRemoveClass);
}
});
});
$('div.' + cs.statusMessageRemoveClass).remove();
},
/**
* This method registers the event for which the listener wants the
* notification fo Since javascript doesn't store the object
* reference when we store the function reference, we have to store
* both to be able to call it.
*
* @method registerEvent
*/
registerEvent : function(eventType, obj, funcRef ,popPrevousEvent) {
var cs = this;
var objRef = {
'obj' : obj,
'func' : funcRef
};
/**
* if the popPrevousEvent is set to true and the eventType is EVENT_TYPES.COMPARISON_PEER_GROUP_SUCCESS
* pop all the previous events and register the new event
*/
if (popPrevousEvent && eventType=== EVENT_TYPES.COMPARISON_PEER_GROUP_SUCCESS && cs.data.LISTENER_LIST[eventType] ) {
while ( cs.data.LISTENER_LIST[eventType].length > 0 ) {
cs.data.LISTENER_LIST[eventType].pop()
}
}
/**
* if the popPrevousEvent is set to true and the eventType is EVENT_TYPES.SUB_CLIENT_PERMISSION_SUCCESS
* pop all the previous events and register the new event
*/
if (popPrevousEvent && eventType=== EVENT_TYPES.SUB_CLIENT_PERMISSION_SUCCESS && cs.data.LISTENER_LIST[eventType] ) {
while ( cs.data.LISTENER_LIST[eventType].length > 0 ) {
cs.data.LISTENER_LIST[eventType].pop()
}
}
if (cs.data.LISTENER_LIST[eventType]) {
cs.data.LISTENER_LIST[eventType].push(objRef);
} else {
cs.data.LISTENER_LIST[eventType] = [];
cs.data.LISTENER_LIST[eventType].push(objRef);
}
},
/**
* This method calls the function with the object reference for
* access to data elements
*
* @method pushEvent
*
*/
pushEvent : function(eventType, arrParams) {
var cs = this;
if (cs.data.LISTENER_LIST[eventType]) {
for (var i = 0; i < cs.data.LISTENER_LIST[eventType].length; i++) {
var objRef = cs.data.LISTENER_LIST[eventType][i];
if(objRef.func){
objRef.func(objRef.obj, arrParams);
}else{
LN.debug("pushEvent: function is empty");
}
}
}
// call unblock of the UI
$.unblockUI();
},
/**
* Register for the element on which to show the page waiting dialog
*/
registerPageLoad : function() {
var cs = this;
jQuery('a').each(function(index) {
cs.registerForWaiting(this);
});
jQuery('svg >> a').each(function(index) {
cs.registerForWaiting(this);
});
//RANJBA01 ; 08/07/2015 : UNREGISTER THE ENTER KEY ON ALL TEXT BOXES TO PREVENT SUBMISSION
$("input[type='text']").keydown(function(e) { if(e.keyCode===13){ e.preventDefault();} });
$.fn.dataTable.ext.errMode='throw';
$(document).keydown(function(e) { if(e.keyCode===27){ e.preventDefault();} });
},
// end of registerPageLoad
/**
* This method will register for the waiting dialog on all links,
* dataset change
*
* @method registerForWaiting
*/
registerForWaiting : function(elem) {
// Dont show the page level spinner for dummy urls on pagination
// requests
if (($(elem).attr('href') === '#')
|| $(elem).hasClass('paginate_button')
|| $(elem).attr('href') === 'javascript:void(0);'
|| $(elem).attr('data-toggle') === 'collapse'
|| $(elem).attr('data-toggle') === 'tab'
|| $(elem).attr('target')==='_blank'
|| $(elem).hasClass('mail')) {
return;
}
$(elem).on('click', function(e) {
if ($(elem).hasClass('disabled')) {
return false;
}
if (!(LN.IS_WARNING_DIALOG === true)) {
dlg.openLoadingDialog();
}
});
},
getTransactionID : function() {
LN.TRANSACTION_ID = LN.USERHASH + '' + (new Date().getTime());
return LN.TRANSACTION_ID;
},
disableRemoveUnsavedFiltersMenu : function() {
$('.ln-removeUnsavedFiltersMnu').addClass('disabled');
},
enableRemoveUnsavedFiltersMenu : function() {
if ($('.ln-removeUnsavedFiltersMnu').hasClass('disabled')) {
$(this).removeClass('disabled');
}
},
updateFilterCountPanel : function(filteredProviderCount, totalCount , drillDownFilterApplied , tempFilterApplied , unSaveableFilterApplied, exclusionsApplied ) {
if ($('#ln_filterName').text().trim() === 'Measure Compliance' && $("#filteredProviderCount").is(":visible") === true) {
return;
}
var cs = this;
if( tempFilterApplied || drillDownFilterApplied ) {
sessionStorage.SHOW_UNSAVED_MODAL = true ;
}else{
sessionStorage.SHOW_UNSAVED_MODAL = false ;
}
// display only the total count
if ($('#ln_providerCount')) {
$('#ln_providerCount').text(
numeral(totalCount).format('0,0'));
}
//368 - On Template Screen show filter message
if ( "true" === $("#ln_isCreateTemplateScreenFlag" ).attr('value') ) {
if(drillDownFilterApplied || tempFilterApplied ) {
$('#ln_ProvidersCountPanel').html(
cs.getTotalProvidersCountTemplateText(filteredProviderCount));
}else{
$('#ln_ProvidersCountPanel').html(
cs.getTotalProvidersCountTemplateText(totalCount));
}
} else {
var temporaryFiltersText = "" ;
if( drillDownFilterApplied || tempFilterApplied || unSaveableFilterApplied || exclusionsApplied) {
temporaryFiltersText = cs.getTemporaryFiltersText() ;
}
//This the work around solution to fix the Provider Profile Dynamic viewing message
if( cs.isProviderProfile()){
$('#ln_ProvidersCountPanel').html(
cs.getFilteredProviderCountText(1 , totalCount) + cs.getTemporaryFiltersText() );
}else if( ( tempFilterApplied || drillDownFilterApplied || unSaveableFilterApplied || exclusionsApplied) && filteredProviderCount !== -1 ) {
$('#ln_ProvidersCountPanel').html(
cs.getFilteredProviderCountText(filteredProviderCount , totalCount) + temporaryFiltersText );
}else{
$('#ln_ProvidersCountPanel').html(
cs.getTotalProvidersCountText(totalCount) + temporaryFiltersText );
}
//Check for Patient Profile - disable save menu
cs.isPatientProfile();
}
},
updateProviderCounts : function(reloadPage,eventArgs) {
var cs = this;
var timeIntervalId=setInterval(function(){
startTime();
},50);
var polingCounter = 0;
function startTime(){
if(polingCounter == 10) {
clearInterval(timeIntervalId);
cs.updateScreenSessionAndCount(cs,reloadPage,eventArgs);
} else {
polingCounter++;
}
var datasetRangeDesc=$.trim($('#ln_topmenu_dataset_range_id').text());
var datasetDesc=$.trim($('#ln_topmenu_dataset').text());
if(datasetRangeDesc && datasetDesc){
clearInterval(timeIntervalId);
cs.updateScreenSessionAndCount(cs,reloadPage,eventArgs);
}
}
},
updateActiveFilterPanelView: function(data) {
$('#activeFilters').html(data);
var activeFiltersMore = $('.activeFiltersMore').html();
$( '.activeFiltersMore' ).attr( 'style', 'height:auto;' );
if ( $( '.activeFiltersMore' ).outerHeight() > 45 ) {
$( '.activeFiltersMore' ).attr( 'style', 'height:5.28em;' );
$('#ln_templateActions').attr( 'style', 'top:20.2em;' );
$('.activeFiltersMore').trigger('update.dot', activeFiltersMore);
}else {
$('#ln_templateActions').attr( 'style', 'top:18.3em;' );
}
//$( '.activeFiltersMore' ).trigger( 'update.dot' );
},
updateScreenSessionAndCount: function(cs,reloadPage,eventArgs){
//if(!$('#ln_isProfileScreenFlag') || $('#ln_isProfileScreenFlag').val()==='false'){
$.ajax({
'url' : LN.getContextPath() + '/updateScreenParameters',
'contentType' : 'application/json',
'dataType' : 'json',
'method' : 'post',
'beforeSend' : function(jqXHR, obj) {
// hide all the children and display background
LN.showOpaqueAjaxIndicator($('.ln-viewpane'));
LN.debug('updateScreenParameters values---> '+obj.data);
},
'data' : JSON.stringify({
'selDataSet' : $('#ln_topmenu_dataset').attr("dataSetkey"),
'selDataSetDesc': $.trim($('#ln_topmenu_dataset').text()),
'selDataSetRangeDesc': $.trim($('#ln_topmenu_dataset_range_id').text()),
'selDataSetRangeBegin': $('#ln_topmenu_dataset_range_id').attr("beginDateKey"),
'selDataSetRangeEnd': $('#ln_topmenu_dataset_range_id').attr("endDateKey"),
'selDataSetRangeRiskColumnName': $('#ln_topmenu_dataset_range_id').attr("riskColumnName"),
'selSubClientId' : $('#ln_subClient_id').attr("data-key"),
'selLineOfBusiness' : $('#ln_lineofBusiness_id').attr("data-key"),
'selBenchMark' : $('#ln_benchid').attr("data-key"),
'selClientProduct' : $('#ln_selClientProduct').val(),
'selClientSpecialty' : $('#ln_selClientSpecialty').val(),
//'selProviderRole' : $('input[name="providerRoleViewBy"]:checked').val()
'selProviderRole' : $("#current_providerrole").val()
}),
'complete' : function(data, textStatus, jqXHR) {
cs.pushEvent(EVENT_TYPES.UPDATE_SCREEN_PARAMETERS_SUCCESS);
if ( cs.showDynamicViewingMsg()){
var url;
if(location.href.indexOf("episodedetail")!=-1){
url=LN.getContextPath() + '/getProviderCountForEpisodeDetail';
}else if(location.href.indexOf("patientprofile")!=-1 || location.href.indexOf("patientProfileTimeline")!=-1){
url=LN.getContextPath() + '/getProviderCountForPatientDetail';
}
else{
url=LN.getContextPath() + '/getProviderCount';
}
$.ajax({
'url' : url,
'contentType' : 'application/json',
'dataType' : 'json',
'method' : 'post',
'success' : function(data, textStatus, jqXHR) {
try {
$("#activeFilters").html(data.activeFilters);
if( data.temporaryFilters){
$("#drilldown-container").html("<label class='ln-colorRed'>Drill Down Criteria: </label>" + data.temporaryFilters );
}
else
{
$("#drilldown-container").html("");
}
if(location.href.indexOf("episodedetail")==-1 && reloadPage){
cs.data.renderLog = true;
cs.pushEvent(EVENT_TYPES.APPLY_BUTTON_CLICK,eventArgs);
LN.hideOpaqueAjaxIndicator($('#ln_topmenu_exclusions'));
}
cs.updateFilterCountPanel(
data.filteredProviderCount,
data.totalProviderCount ,
data.drillDownFilterApplied ,
data.tempFilterApplied ,
data.unSaveableFilterApplied,
data.exclusionsApplied
);
if(location.href.indexOf("episodedetail")!=-1 && reloadPage){
cs.data.renderLog = true;
cs.pushEvent(EVENT_TYPES.APPLY_BUTTON_CLICK,eventArgs);
LN.hideOpaqueAjaxIndicator($('#ln_topmenu_exclusions'));
}
cs.updateActiveFilterPanelView(data.activeFilters);
//Display model dialog only in create template
if ($('#ln_isInCreateTemplate_Screen').val() =="true") {
// if value is zero , display model dialog and disable runtemplate button
if(!$('.renameTxt').css('display') || $('.renameTxt').css('display') == 'none'){
$('#runTemplateBtn').removeAttr('disabled');
}
}
var showZeroProvider=true;
if($('#ln_isHideProviderCountFlag') && $('#ln_isHideProviderCountFlag').val()==='true'){
showZeroProvider=false;
}
if(showZeroProvider && (parseInt(data.filteredProviderCount)===0 || numeral(data.totalProviderCount).format('0') == 0)){
$('#runTemplateBtn').attr('disabled', 'disabled');
$('#runTemplateBtn').css("pointer-events", "none");
$(cs.data.zeroProviderCountMsgDivID)
.modal();
}else{
$('#runTemplateBtn').css("pointer-events", "auto");
}
} catch (err) {
LN.debug("error =" + err);
}
},
'complete' : function() {
LN.hideOpaqueAjaxIndicator($('.ln-viewpane'));
},
'error' : function(jqXHR, textStatus, errorThrown) {
$('#ln_ProvidersCountPanel').html('<span class="h6-custom-ph ln-providercount">Error occurred while getting provider count.</span>');
}
});
}else{
//hide Dynamic Viewing Msg Div
$("#ln_viewPopulationText").hide();
}
}
});
//}
},
/**
* This function validates is the current screen is a provider profile screen
*/
isProviderProfile:function(){
if ( $('#ln_isProfileScreenFlag').val()==='true'){
//PHM-2302: disable quick link "Save Filters To Template "
$("#ln_quicklink_saveFilters").prop("disabled", true).removeClass("btn-default").addClass("ln-text-left");
return true ;
}
},
isPatientProfile:function(){
if ( $('#ln_isPatientProfileScreenFlag').val()==='true'){
$("#ln_quicklink_saveFilters").prop("disabled", true).removeClass("btn-default").addClass("ln-text-left");
return true ;
}
},
showDynamicViewingMsg: function(){
var showDynamicViewingMsg = true ;
if($("#ln_provider_profile_filter_overall_btn").length > 0 &&
'overallPopulation' === $("#ln_provider_profile_filter_overall_btn").val() ) {
showDynamicViewingMsg = false ;
}
return showDynamicViewingMsg ;
},
/* DE818 - Active filter update based on out of stock starts */
/**
* @method to get updated active filter summary
*
*/
getUpdatedActiveFilterSummary : function() {
var cs = this;
$.ajax({
'url' : LN.getContextPath() + '/updatedActiveFilters',
'contentType' : 'application/json',
'dataType' : 'json',
'method' : 'post',
'data' : JSON.stringify({
'dataSet' : $('#dataSet').val()
}),
'success' : function(data, textStatus, jqXHR) {
try {
var ativeFilterSummary = data[0];
var activeFilter = data[1];
cs.updateActiveFilterPanel(ativeFilterSummary,
activeFilter);
} catch (err) {
LN.debug("error =" + err);
}
}
});
},
/**
* @method to get updated active filter summary
* @param ativeFilterSummary
* @param activeFilter
*/
updateActiveFilterPanel : function(ativeFilterSummary, activeFilter) {
$('#moreActiveFilters').html(ativeFilterSummary);
$('#activeFilters').html(activeFilter);
},
/* DE818 - Active filter update based on out of stock ends */
/**
* @method to get the filtered patient count
* @param filteredProviderCount
* @param totalProviderCount
*/
getFilteredProviderCountText : function(filteredProviderCount,
totalProviderCount) {
var filteredText = '<span class="h6-custom-ph">Viewing </span>';
filteredText += '<span id="filteredProviderCount" class="h6-custom-ph ln-providercount">';
filteredText += numeral(filteredProviderCount).format(0, 0)
+ "</span>";
filteredText += '<span class="ln-providercount"> provider(s)</span>';
filteredText += '<span class="h6-custom-ph"> out of template population of <span id="providerCount" class="ln-providercount">';
filteredText += numeral(totalProviderCount).format(0, 0)
+ '</span><span class="ln-providercount"> provider(s)</span></span>';
filteredText += '<input type="hidden" id="filteredCountForCheck" value="'
+ filteredProviderCount
+ '" /> <input type="hidden" id="totalCountForCheck" value="'
+ totalProviderCount + '" />';
return filteredText;
},
getTemporaryFiltersText : function( ) {
var filteredText = '<span id="ln_tempFilterApp" ' ;
filteredText += ' style="color: #333333; font-style: italic; font-size: 11px;"> ' ;
filteredText += ' Temporary filters in use.</span> ' ;
return filteredText ;
} ,
/**
* get the total providers count text
*/
getTotalProvidersCountTemplateText : function(totalProviderCount) {
var totalProviderText = '<span class="h6-custom-ph">Filter criteria will return <span id="providerCount" class="ln-providercount">'
+ numeral(totalProviderCount).format(0, 0)
+ '</span><span';
totalProviderText += ' class="ln-providercount"> provider(s)</span></span>';
totalProviderText += '<input type="hidden" id="totalCountForCheck" value="'
+ totalProviderCount + '" />';
return totalProviderText;
},
getTotalProvidersCountText : function(totalProviderCount) {
var totalProviderText = '<span class="h6-custom-ph">Viewing a template population of <span id="providerCount" class="ln-providercount">'
+ numeral(totalProviderCount).format(0, 0)
+ '</span><span';
totalProviderText += ' class="ln-providercount"> provider(s)</span></span>';
totalProviderText += '<input type="hidden" id="totalCountForCheck" value="'
+ totalProviderCount + '" />';
return totalProviderText;
},
/**
* function to register the ajax complete
*/
registerAjaxComplete : function() {
var cs = this;
$(document).bind(
"ajaxStart",
function() {
cs.data.lnhccPotalKeepAliveFlag = true;
});
$(document).bind(
"ajaxStop",
function() {
if(LN.isAjaxError && LN.isAjaxError===true) {
$('#ln_ajaxErrorDialog').modal();
LN.isAjaxError=false;
}
cs.pushEvent(EVENT_TYPES.PAGE_LOAD_COMPLETE);
cs.data.endTime = new Date();
/*if (typeof (Storage) != "undefined") {
localStorage.setItem("lastAccessedTime",
new Date().getTime());
} else {
lastAccessTime = new Date();
}*/
//function to ping lnchccportal keepalive controller
if(cs.data.lnhccPotalKeepAliveFlag){
LN.debug("sessionStorage.fromInvalidateSession---> "+sessionStorage.fromInvalidateSession);
if(!sessionStorage.fromInvalidateSession){
cs.lnhccPotalKeepAlive();
}else{
sessionStorage.fromInvalidateSession=false;
}
cs.data.lnhccPotalKeepAliveFlag = false;
}
if (cs.data.renderLog) {
cs.logRenderTime();
cs.data.renderLog = false;
}
if (LN.PAGE_NOT_COMPLETE === false) {
$.unblockUI();
}
});
},
lnhccPotalKeepAlive : function() {
var cs = this;
$.ajax({
'url': LN.getContextPath() + '/keepalive',
'method' : 'get',
'contentType':'text/plain',
'success': function(data) {
if (typeof(Storage) != "undefined") {
localStorage.setItem("lastAccessedTime", new Date().getTime());
} else {
lastAccessTime = new Date();
}
},
'error': function(err) {
/*
* Call PPM logout controller, PPM will take care of portal session log out
*/
document.location.href = LN.getContextPath() + '/j_spring_security_logout';
return;
}
});
},
getParameterByName : function(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(
window.location.search);
return match
&& decodeURIComponent(match[1].replace(/\+/g, ' '));
},
logRenderTime : function() {
var cs = this;
$.ajax({
'url' : LN.getContextPath() + '/home/logUIRenderTime',
'contentType' : 'application/json',
'dataType' : 'json',
'method' : 'post',
'beforeSend' : function(xhr) {
xhr.setRequestHeader('X-TransactionID',
LN.TRANSACTION_ID);
},
'data' : JSON.stringify({
'startTime' : cs.data.startTime,
'endTime' : cs.data.endTime,
'originUrl' : location.href
}
),
'success' : function(data, textStatus, jqXHR) {
try {
LN.debug("successful ajax post");
} catch (err) {
LN.debug("error =" + err);
}
}
});
},
/**
* This is used in createTemplate.js
*/
getCreateTemplateProvidersCountText : function(providerCount) {
var text = '<span class="ln-label">Filter criteria will return <span id="ln_providerCount" class="ln-providercount">'
+ providerCount
+ '</span><span class="ln-providercount"> provider(s)</span></span>';
LN.debug("text=" + text);
return text;
},
getBenchmarkList: function(){
var cs = this;
$.ajax({
url: LN.getContextPath()+'/getBenchmarkMapDetails',
dataType : "json",
success: function(data){
var index = 0;
$.each(data, function(key,value){
if(index == 0){
$("#ln_benchid").html(value);
$("#ln_benchid").attr("data-key", key);
}
$("#ln_topmenu_benchmark ul").append('<li><a href="#" data-key="' + key + '">' + value + '</a></li>');
index ++;
});
}
});
},
getLineOfBusinessList: function(){
var cs = this;
$.ajax({
url: LN.getContextPath()+'/getLineOfBusiness',
data: {dataSetId: $('#ln_topmenu_dataset').attr("datasetkey")},
async: true,
cache:true,
dataType : "json",
success: function(data){
var result={lineOfBusiness:[]};
result.lineOfBusiness = data;
var template = $('#lineofbusinessTopMenuTemplate').html();
var html = Mustache.to_html(template, result);
$('#ln_topmenu_lineofbusiness_list').html(html);
}
});
},
//Function to get Dataset ranges for given DataSet
updateClientDataSetDateRanges: function(needToCallProviderCount){
var cs = this;
$.ajax({
'url': LN.getContextPath()+'/updateClientDataSetDateRanges?schemaName=' + $('#ln_topmenu_dataset').attr("dataSetkey"),
'dataType' : "json",
'success': function(data){
//Clean existing menu values
$("#ln_topmenu_dataset_range ol").html("");
$.each(data.dataSetRangeList, function(key,valueObj){
if(key == 0){
$("#ln_topmenu_dataset_range_id").html((valueObj.dataRange).split(":")[1]);
$("#ln_topmenu_dataset_range_id").attr("beginDateKey", valueObj.beginDateKey);
$("#ln_topmenu_dataset_range_id").attr("endDateKey", valueObj.endDateKey);
$("#ln_topmenu_dataset_range_id").attr("riskColumnName", valueObj.riskColumnName);
}
$("#ln_topmenu_dataset_range ol").append('<li><a href="#" riskColumnName="' + valueObj.riskColumnName + '" beginDateKey="' + valueObj.beginDateKey + '" endDateKey="' + valueObj.endDateKey + '">' + valueObj.dataRange + '</a></li>');
});
},
'complete' : function() {
//true will update provider count also
if(needToCallProviderCount){
cs.updateProviderCounts(false);
}
$('a[href="#"]').on('click',function(e){
e.preventDefault();
});
cs.pushEvent(EVENT_TYPES.DATE_RANGES_SUCCESS);
}
});
},
/**
* This method will check the Selected Peer Group in the template is deleted.
* 1. If the selected Comparison Peer Group is deleted
* Show the Delete Comparison Peer Group Model.
* 2. If the peer group is not deleted, register an event
* "COMPARISON_PEER_GROUP_SUCCESS" to proceed with the subsequent steps.
*
*/
validateSelectedComparisonPeerGroup: function(templateId) {
LN.debug( "templateName ..."+ templateId) ;
var cs = this ;
if(templateId){
$('#deletedPeerGroupTemplateId').val(templateId);
}
$.ajax({
url: LN.getContextPath()+'/isComparisonPeerGroupDeleted',
data: { templateId: templateId },
async: false,
method : 'post',
cache:true,
dataType : "json",
success: function(data){
if(data.comparisonPeerGroupDeleted) {
$('#deletedPeerGroupName').text(data.comparisonPeerGroupName) ;
$('#deletedPeerGroupModal').modal('show');
}else{
cs.pushEvent(EVENT_TYPES.COMPARISON_PEER_GROUP_SUCCESS);
}
}
});
},
/**
* On Click of the "Delete PeerGroup PopUp" Ok button
* redirects to the "createTemplateGeneral" page
*/
onClickDeletedPeerGroupModalOk: function() {
$("#deletedPeerGroupModalOk,#deletedPeerGroupModalCross").off('click') ;
$("#deletedPeerGroupModalOk,#deletedPeerGroupModalCross").on('click' , function(e){
LN.debug( "deletedPeerGroupTemplateName ... "+ $('#deletedPeerGroupTemplateId').val() ); ;
e.preventDefault();
$.ajax({
url : LN.getContextPath()+'/getMyTemplateForEdit',
data : {
"templateId" : $('#deletedPeerGroupTemplateId').val()
},
type : "POST",
success : function(data) {
sessionStorage.templateViewFlag='EditTemplate';
location.href=LN.getContextPath()+'/createTemplateGeneral?clearComparisonPeerGroup=true';
}
});
}) ;
},
/**
* This method will check the sub client permission in the template is changed.
* 1. If the sub- client is deleted
* Show the warning Model.
* 2. If the peer group is not deleted, register an event
* "SUB_CLIENT_PERMISSION_SUCCESS" to proceed with the subsequent steps.
*
*/
validateUserSubClientPermission: function(templateId, templateName) {
LN.debug( "templateName ..."+ templateId) ;
var cs = this ;
$.ajax({
url: LN.getContextPath()+'/isSubClientPermissionChanged',
data: { templateId: templateId,
templateName: templateName,
dataSetId: $('#ln_topmenu_dataset').attr("datasetkey")},
async: false,
method : 'post',
cache:true,
dataType : "json",
success: function(data){
if(data) {
$('#permissionChangedModal').modal('show');
}else{
cs.pushEvent(EVENT_TYPES.SUB_CLIENT_PERMISSION_SUCCESS);
}
}
});
},
/**
* On Click of the "SubClient Permission Changed" Ok button
* register a event and proceed.
*/
onClickSubClientPermissionChangedOk: function() {
var cs = this;
$('#permissionChangedModalCross,#permissionChangedModalOk').bind('click', function(e) {
e.preventDefault();
cs.pushEvent(EVENT_TYPES.SUB_CLIENT_PERMISSION_SUCCESS);
});
} ,
/**
* function to check PCP role for Provider Profile
*/
checkPCPProviderProfile: function() {
var cs= this;
if($('#viewbyHiddenVal').val()==='PCP'){
$("#provider_profile_referralpatterns").attr("disabled", false);
$("#providerMeasureCompliance").attr("disabled", false);
$('#provider_referrals').show();
$('#provider_noncompliance_top5').show();
}else{
$("#provider_profile_referralpatterns").attr("disabled", true).removeClass("ln-btn-selected");
$("#providerMeasureCompliance").attr("disabled", true).removeClass("ln-btn-selected");
$('#provider_referrals').hide();
$('#provider_noncompliance_top5').hide();
}
},
/**
* Unasaved Modal
*/
showUnSavedWorkModal : function ( continueFunc , preProcessFunc ) {
if(preProcessFunc ) {
preProcessFunc () ;
}
if (sessionStorage.SHOW_UNSAVED_MODAL === 'true' &&
$('#ln_renameLbl').text().trim() != 'All Providers' ){
$("#unsavedWorkContinue").off('click');
$("#unsavedWorkContinue").on('click' , continueFunc );
$('#unsavedWorkModal').modal('show');
} else {
continueFunc() ;
}
}
});