From d7c25f6c940e90bb9cb81dfd7cd0459207674a03 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 8 May 2014 16:06:16 -0700 Subject: [PATCH] CRM-14483 - crmCaseType - Implement row addition for "Activity Types" table --- css/angular-crmCaseType.css | 14 ++++++++++++++ js/angular-crmCaseType.js | 18 ++++++++++++++++++ partials/crmCaseType/activityTypesTable.html | 17 +++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/css/angular-crmCaseType.css b/css/angular-crmCaseType.css index 294049f27a..21d928927c 100644 --- a/css/angular-crmCaseType.css +++ b/css/angular-crmCaseType.css @@ -10,3 +10,17 @@ .crmCaseType .ui-tabs-nav select { float: right; } + +.crmCaseType tr.addRow td { + background: #ddddff; + padding: 0.5em 1em; + text-align: center; +} + +.crmCaseType input[type=number] { + width: 3.5em; +} + +.crmCaseType .add-activity { + width: 50%; +} \ No newline at end of file diff --git a/js/angular-crmCaseType.js b/js/angular-crmCaseType.js index fd0447ff2c..c7b48bc355 100644 --- a/js/angular-crmCaseType.js +++ b/js/angular-crmCaseType.js @@ -20,6 +20,7 @@ $scope.activityStatuses = CRM.crmCaseType.actStatuses; $scope.activityTypes = CRM.crmCaseType.actTypes; + $scope.activityTypeNames = _.pluck(CRM.crmCaseType.actTypes, 'name'); $scope.workflows = { 'timeline': 'Timeline', @@ -85,6 +86,23 @@ }); }; + /// Add a new activity entry to an activity-set + $scope.addActivity = function(activitySet, activityType) { + activitySet.activityTypes.push({ + name: activityType + }); + }; + + /// Add a new top-level activity-type entry + $scope.addActivityType = function(activityType) { + var names = _.pluck($scope.caseType.definition.activityTypes, 'name'); + if (!_.contains(names, activityType)) { + $scope.caseType.definition.activityTypes.push({ + name: activityType + }); + } + }; + $scope.onManagerChange = function(managerRole) { angular.forEach($scope.caseType.definition.caseRoles, function(caseRole) { if (caseRole != managerRole) { diff --git a/partials/crmCaseType/activityTypesTable.html b/partials/crmCaseType/activityTypesTable.html index 38b10fe6fb..a2299e3ff1 100644 --- a/partials/crmCaseType/activityTypesTable.html +++ b/partials/crmCaseType/activityTypesTable.html @@ -25,5 +25,22 @@ Required vars: caseType + + + Add: + + + + + -- 2.25.1