71 lines
2.5 KiB
JavaScript
71 lines
2.5 KiB
JavaScript
"use strict";
|
|
/**
|
|
* Value object for service request item.
|
|
*
|
|
* @author Keerthana Kuchibhotla
|
|
* @constructor
|
|
*/
|
|
function ServiceRequestVO() {
|
|
this.type = EntityVO.TYPE_SERVICEREQUEST;
|
|
this.quantity = '';
|
|
this.price = '';
|
|
this.expectedDate = '';
|
|
this.requiredDate = '';
|
|
this.isCrossLaunchRequest = '';
|
|
this.isCrossLaunchSubmitted = '';
|
|
this.crossLaunchURL = '';
|
|
this.crossLaunchURLDisplay = '';
|
|
this.crossLaunchURLCreate = '';
|
|
this.requestTemplateTitle = '';
|
|
this.requestTemplateId = '';
|
|
this.currency = '';
|
|
this.instructions = '';
|
|
this.ticketType = EntityVO.TYPE_SERVICEREQUEST;
|
|
this.accessMappings = {};
|
|
this.questionDefinitions = null;
|
|
this.conditionalQuestions = null;
|
|
this.questionResponses = null;
|
|
this.approvalSummaries = null;
|
|
this.hideAttributes = null;
|
|
this.isAttributeHidden = {};
|
|
}
|
|
ServiceRequestVO.prototype = new TicketVO();
|
|
ServiceRequestVO.prototype.constructor = ServiceRequestVO;
|
|
/**
|
|
* @override
|
|
* @return {Array} properties
|
|
*/
|
|
ServiceRequestVO.prototype.getProps = function () {
|
|
return TicketVO.prototype.getProps().concat('quantity', 'price', 'expectedDate', 'requiredDate', 'isCrossLaunchRequest', 'isCrossLaunchSubmitted', 'crossLaunchURL', 'crossLaunchURLDisplay', 'crossLaunchURLCreate', 'requestTemplateTitle', 'requestTemplateId', 'questionDefinitions', 'conditionalQuestions', 'questionResponses', 'currency', 'instructions', 'approvalSummaries', 'hideAttributes', 'accessMappings', 'completionDate');
|
|
};
|
|
/**
|
|
* @override
|
|
*/
|
|
ServiceRequestVO.prototype.postBuild = function () {
|
|
if (this.hideAttributes) {
|
|
var self = this;
|
|
_.each(this.hideAttributes, function (hideAttribute) {
|
|
self.isAttributeHidden[hideAttribute] = true;
|
|
});
|
|
}
|
|
if (!_.isEmpty(this.accessMappings)) {
|
|
var accessMappings = {};
|
|
for (var i = 0; i < this.accessMappings.length; i++) {
|
|
var accessMappingId = this.accessMappings[i].id.indexOf('action') !== -1 ?
|
|
this.accessMappings[i].id.replace(/\-/g, '').replace('action', '') + 'ActionAllowed' :
|
|
this.accessMappings[i].id + 'EditAllowed';
|
|
accessMappings[accessMappingId] = (this.accessMappings[i].permission === 'write');
|
|
}
|
|
this.accessMappings = accessMappings;
|
|
}
|
|
else {
|
|
this.accessMappings = {
|
|
detailsEditAllowed: false,
|
|
statusEditAllowed: true,
|
|
timelineEditAllowed: true,
|
|
relationsEditAllowed: false
|
|
};
|
|
}
|
|
this.resolvedDate = this.completionDate;
|
|
};
|