62 lines
1.8 KiB
JavaScript
62 lines
1.8 KiB
JavaScript
"use strict";
|
|
//TODO: should inherit from ticket-template-vo.js
|
|
//TODO: however backend data for incident, workorder and task template are not consistent, waiting for backend data
|
|
/**
|
|
* Value object for incident template item.
|
|
*
|
|
* @constructor
|
|
*/
|
|
function TaskTemplateVO() {
|
|
// simple fields
|
|
this.name = '';
|
|
this.summary = '';
|
|
this.type = '';
|
|
this.desc = '';
|
|
this.notes = '';
|
|
// complex fields
|
|
this.company = null;
|
|
this.templateObject = null;
|
|
this.modifiedDate = null;
|
|
// derived fields
|
|
this.context = '';
|
|
this.priority = '';
|
|
this.activityType = '';
|
|
this.supportGroup = null;
|
|
this.assignee = null;
|
|
this.categorizations = null;
|
|
}
|
|
/**
|
|
* Setup inheritance chain.
|
|
*/
|
|
TaskTemplateVO.prototype = Object.create(BaseVO.prototype);
|
|
TaskTemplateVO.prototype.constructor = TaskTemplateVO;
|
|
/**
|
|
* @override
|
|
* @return {Array}
|
|
*/
|
|
TaskTemplateVO.prototype.getProps = function () {
|
|
return BaseVO.prototype.getProps().concat('name', 'summary', 'type', 'desc', 'notes', 'company', 'templateObject', 'modifiedDate');
|
|
};
|
|
/**
|
|
* @override
|
|
*/
|
|
TaskTemplateVO.prototype.postBuild = function () {
|
|
var template = this.templateObject;
|
|
if (template) {
|
|
this.context = template.context;
|
|
this.priority = template.priority;
|
|
if (this.type === 'Single Tasks') {
|
|
this.activityType = template.taskType;
|
|
this.supportGroup = template.supportGroup;
|
|
this.assignee = template.assignee;
|
|
this.categorizations = template.categorizations;
|
|
_.each(template.categorizations, function (categorization) {
|
|
categorization.tiersArray = _.values(categorization.tiers);
|
|
});
|
|
}
|
|
else {
|
|
this.activityType = template.taskGroupType;
|
|
}
|
|
}
|
|
};
|