").css( { "height" : "100%" } );
instance.createUI().element().appendTo( instance.rootElement );
return instance.rootElement;
}
SalesCallLinkedObjectives.prototype.createUI = function() {
let instance = this;
instance.dataGrid = $("
").dxDataGrid( {
width : "100%",
height : "100%",
scrolling : {
mode : "virtual"
},
noDataText : "No Linked Objectives",
dataSource : Fse.Data.newDataSource( { object : "CRM.linkedObjectives", keyField : "objectiveId", objectParams : { interactionId : instance.interactionId, stfId : instance.stfId }} ),
columns : [
{
name : "objectiveHeading",
cellTemplate : function( container, options, containerx ) {
let objective = options.data;
container.append( $("
").text( objective.objName ) );
let noCreditLabel = "";
if( objective.noCreditText != "" ) {
noCreditLabel = ` - no credit for ${objective.noCreditText}`;
}
container.append( $("").text( ` [${objective.quotaTypeDesc}${noCreditLabel}]` ) );
}
}
],
masterDetail : {
enabled : true,
autoExpandAll : true,
template : function( container, options ) {
let objective = options.data;
let lineCSS = {
"margin-bottom" : "5px"
};
let leftSide = $("").css( { "width" : "100%", "padding-left" : "16px" } );
leftSide.append(
$("
").css( lineCSS )
.append( $("
").text( "Due Date: " ) )
.append( $("").text( DevExpress.localization.formatDate( new Date( objective.dueDate ), "MM/dd/yyyy" )) )
)
let rightSide = $("");
rightSide.append(
$("
").css( { "white-space" : "normal", "padding-right" : "30px" } ).css( lineCSS )
.append( $("
").text( "Description: " ) )
.append( $( "" ).text( objective.objDescription ) )
)
rightSide.append(
$("").css( lineCSS )
.append( $("
").text( "Total Quota: " ) )
.append( $( "" ).text( `${objective.totalQuota} ${objective.quotaTypeDesc}` ) )
)
// let staffAchievedPct = 0.0;
// if( objective.staffQuota != 0 ) {
// staffAchievedPct = objective.staffQuotaAchieved / objective.staffQuota;
// }
// rightSide.append(
// $("").css( lineCSS )
// .append( $("
").text( `${objective.staffLastName} Quota: ` ) )
// .append( $( "" ).text( `${objective.staffQuota} ${objective.quotaTypeDesc}, ` ) )
// .append( $( "" ).text( "Quota Achieved: " ) )
// .append( $( "" ).text(
// `${objective.staffQuotaAchieved} (${DevExpress.localization.formatNumber( staffAchievedPct, "percent" )})`
// ))
// )
rightSide.append(
$("").css( lineCSS )
.append( $("
").text( "Target Type: " ) )
.append( $( "" ).text( objective.targetTypeDesc ) )
)
if( objective.files.length ) {
let attachmentDiv = $("