"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 WorkorderTemplateVO() { // simple fields this.name = ''; this.type = ''; this.desc = ''; this.notes = ''; this.summary = ''; // complex fields this.company = null; this.templateObject = null; this.modifiedDate = null; // derived fields this.status = ''; this.priority = ''; this.supportGroup = ''; this.managerGroup = ''; this.categorizations = []; this.allCategories = []; this.templateCategory = ''; this.createDateLabel = ''; this.modifiedDateLabel = ''; } /** * Setup inheritance chain. */ WorkorderTemplateVO.prototype = Object.create(BaseVO.prototype); WorkorderTemplateVO.prototype.constructor = WorkorderTemplateVO; /** * @override * @return {Array} */ WorkorderTemplateVO.prototype.getProps = function () { return BaseVO.prototype.getProps().concat('name', 'type', 'desc', 'notes', 'summary', 'company', 'templateObject', 'modifiedDate'); }; /** * @override */ WorkorderTemplateVO.prototype.postBuild = function () { var template = this.templateObject; if (template) { this.status = template.status ? template.status.value : ''; this.priority = template.priority ? template.priority : ''; this.supportGroup = template.supportGroup.name; this.managerGroup = template.managerGroup && template.managerGroup.name; this.templateCategory = template.categorizations[0].tiers.operationCategoryTier3; this.categorizations = template.categorizations; } this.type = 'workorderTemplate'; // transform date to human readable string this.createDateLabel = moment(this.createDate).calendar(); this.modifiedDateLabel = moment(this.modifiedDate).calendar(); };