").dxCheckBox({
onValueChanged : function( ee ) {
updateTargeting( objectiveId, ee.value );
}
}).appendTo( container );
}
}
}
]
}).dxDataGrid( "instance" );
return eligibleObjectivesDataGrid.element();
},
onHidden : function( e ) {
eligiblePopup.element().remove();
eligiblePopup.dispose();
},
toolbarItems : [
{
toolbar : "bottom",
location : "after",
template : function() {
return submitButton.element();
}
}
]
}).dxPopup( "instance" );
$("body").append( eligiblePopup.element() );
eligiblePopup.show();
}
linkedObjectivesDataGrid = $("
").dxDataGrid( {
showBorders : true,
scrolling : { mode : "virtual" },
height : 450,
rowAlternationEnabled : true,
dataSource : Fse.Data.newDataSource( { object : "OPR.operatorObjectives", keyField : "objectiveId", paginate : false, objectParams : {
operatorId : instance.operatorId
}}),
columns : [
/*
{ dataField : "linkStatusKey", groupIndex : 0,
groupCellTemplate : function( container, options ) {
if( options.value == 1 ) {
container.append( "LINKED OBJECTIVES" )
} else {
container.append( "ELIGBILE OBJECTIVES" )
}
}
},
*/
{ type : "buttons", width : 30,
name : "viewObjectiveSummary",
buttons : [
{ icon : "info", hint : "View Objective Summary", onClick : function( e ) {
instance.viewObjectiveSummary( e.row.data );
}}
]
},
{ dataField : "objName", caption : "Objective" },
{ dataField : "objOwnerName", caption : "Owner" },
{ dataField : "publishDate", caption : "Start Date", dataType : "date", format : "shortDate", width : 85 },
{ dataField : "unpublishDate", caption : "End Date", dataType : "date", format : "shortDate", width : 85 },
{ dataField : "daysRemaining", caption : "Days Remaining", dataType : "number", width : 110 },
{ dataField : "achievement", caption : "Achievement", dataType : "number", format : "percent", width : 90 },
{ name : "objectiveActions", visible : true, showInColumnChooser : false, width : 30,
type: "buttons",
buttons: [{
template: function(data) {
let button = $("
").addClass("dx-icon-overflow").css( { "display" : "inline-block", "cursor" : "pointer" });
return button;
}
}]
}
/*,
{ dataField : "targetCount",caption : "Targets", dataType : "number", width : 100,
cellTemplate : function( container, options ) {
if( options.data.linkStatus == "ELIGIBLE" ) {
container.append( options.text );
}
}
},
{ dataField : "quota", caption : "Quota", dataType : "number", width : 100,
cellTemplate : function( container, options ) {
if( options.data.linkStatus == "ELIGIBLE" ) {
container.append( options.text );
}
}
},
{ dataField : "quotaAchieved", caption : "Achievement", dataType : "number", width : 100,
cellTemplate : function( container, options ) {
if( options.data.linkStatus == "ELIGIBLE" ) {
container.append( options.text );
}
}
},
{
caption : "Target",
width : 70,
name : "operatorSelected",
cellTemplate : function( container, options ) {
if( options.data.linkStatus == "ELIGIBLE" ) {
const objectiveId = options.data.objectiveId;
$("
").dxCheckBox({
onValueChanged : function( ee ) {
updateTargeting( objectiveId, ee.value );
}
}).appendTo( container );
}
}
}
*/
],
onCellClick : function( cce ) {
if( cce.rowType != "data" ) {
return;
}
const data = cce.data;
if( cce.column.name === "objectiveActions" ) {
// create a context menu
if( data.objectiveId ) {
let items = [
{ text : "View Objective Summary", actionCode : "viewObjectiveSummary" },
{ text : "Go to Objective Dashboard", actionCode : "objectiveDashboard" }
];
$("
").dxContextMenu( {
items : items,
hideOnOutsideClick : true,
onHidden : function( cme ) {
cme.component.element().remove();
cme.component.dispose();
},
onItemClick : function( cme ) {
if( cme.itemData.actionCode ) {
switch ( cme.itemData.actionCode ) {
case "viewObjectiveSummary" :
instance.viewObjectiveSummary( data );
break;
case 'objectiveDashboard' :
instance.gotoObjectiveDashboard( data );
break;
}
}
cme.component.hide();
},
target : cce.cellElement
}).appendTo( "body" ).dxContextMenu("show");
}
}
}
}).dxDataGrid( "instance" );
content.append( linkedObjectivesDataGrid.element() );
$("
").dxToolbar( {
items : [
{
location : "after",
widget : "dxButton",
options : {
text : "Add Objectives",
onClick : function( e ) {
addObjectives();
}
}
}
]
}).css( { "margin-top" : "5px", "margin-bottom" : "5px" } ).appendTo( content );
return content;
}
OperatorObjectives.prototype.gotoObjectiveDashboard = function( data ) {
let urlParams = {
id : data.objectiveId,
stfID : Fse.Portal.appConfiguration.STP.userId
}
let ddURL = Fse.Util.updateURL2( $("link#PortalDocRootURL").attr( "href" ) +
"/apps/BMYO/index.cfm?view=detail&id=&stfID=&srchPeriod=0000&terID=0",
urlParams
);
window.location.href = ddURL;
}
OperatorObjectives.prototype.viewObjectiveSummary = function( data ) {
let objectiveId = data.objectiveId;
let oLink = document.getElementById( "oprHandlerLink" );
let sURL = oLink.getAttribute( "href" ) + "?get=objectiveOverview&objectiveId=" + encodeURIComponent( objectiveId );
let oOptions = {
title : "Objective Overview",
width : "600px",
src : sURL,
namedButtons : "close"
};
Fse.DialogManager.show( "objectiveOverviewDialog$", oOptions );
}