50 lines
2.3 KiB
JavaScript
50 lines
2.3 KiB
JavaScript
"use strict";
|
|
/**
|
|
* Created by amichauh on 05-09-2017.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
angular.module('myitsmApp')
|
|
.directive('fieldActionsDropdown', ['$filter', 'screenConfigurationModel', 'screenConfigurationService', 'metadataModel', 'i18nService',
|
|
function ($filter, screenConfigurationModel, screenConfigurationService, metadataModel, i18nService) {
|
|
return {
|
|
restrict: 'E',
|
|
scope: {
|
|
context: '=',
|
|
action: '=',
|
|
icon: '=',
|
|
dropDownOptions: '=',
|
|
bulkContext: '=',
|
|
bulkContextType: '@',
|
|
launchActionCallback: '&'
|
|
},
|
|
templateUrl: 'views/common/field-action-directive.html',
|
|
controller: 'LaunchActionController',
|
|
link: function (scope) {
|
|
scope.checkValidActions = true;
|
|
scope.init = function (actions) {
|
|
if (actions && actions.actionList && actions.actionList.length) {
|
|
//fieldPropertyMapping(actions.actionList);
|
|
_.forEach(actions.actionList, function (actionItem) {
|
|
actionItem.label = actionItem.labels[i18nService.language] || actionItem.labels.default;
|
|
});
|
|
if (actions.actionOrder === 'alphabetical') {
|
|
actions.actionList = _.sortBy(actions.actionList, 'label');
|
|
}
|
|
else {
|
|
actions.actionList = _.sortBy(actions.actionList, 'sequenceNo');
|
|
}
|
|
scope.actions = actions;
|
|
}
|
|
};
|
|
// if (angular.isDefined(scope.context) && (scope.context.type || scope.context.ticketType)) {
|
|
// contextType = scope.context.ticketType && scope.context.ticketType === EntityVO.TYPE_ASSET ?
|
|
// scope.context.ticketType : scope.context.type;
|
|
// } else if (scope.bulkContextType) {
|
|
// contextType = scope.bulkContextType;
|
|
// }
|
|
}
|
|
};
|
|
}]);
|
|
}());
|