From: Tim Otten Date: Sat, 19 Apr 2014 22:28:20 +0000 (-0700) Subject: CRM-14481 - crmCaseType - First pass at Angular-based case-type screen (view-only) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4c58e2513cae6cb76a372e422d8e09b2d4ab6f56;p=civicrm-core.git CRM-14481 - crmCaseType - First pass at Angular-based case-type screen (view-only) --- diff --git a/CRM/Case/Info.php b/CRM/Case/Info.php index 8ed9054fd7..4bef8ddd84 100644 --- a/CRM/Case/Info.php +++ b/CRM/Case/Info.php @@ -52,6 +52,15 @@ class CRM_Case_Info extends CRM_Core_Component_Info { ); } + /** + * {@inheritDoc} + */ + public function getAngularModules() { + $result = array(); + $result['crmCaseType'] = array('ext' => 'civicrm', 'files' => array('js/angular-crmCaseType.js')); + return $result; + } + // docs inherited from interface public function getManagedEntities() { // Use hook_civicrm_caseTypes to build a list of OptionValues diff --git a/js/angular-crmCaseType.js b/js/angular-crmCaseType.js new file mode 100644 index 0000000000..2214efa4c6 --- /dev/null +++ b/js/angular-crmCaseType.js @@ -0,0 +1,99 @@ +(function(angular, $, _) { + + var partialsUrl = CRM.resourceUrls['civicrm'] + '/partials/crmCaseType'; + var crmCaseType = angular.module('crmCaseType', ['ngRoute']); + + crmCaseType.config(['$routeProvider', + function($routeProvider) { + $routeProvider.when('/caseType/:id', { + templateUrl: partialsUrl + '/edit.html', + controller: 'CaseTypeCtrl' + }); + } + ]); + + crmCaseType.controller('CaseTypeCtrl', function($scope) { + $scope.partialsUrl = partialsUrl; + $scope.caseType = { + id: 123, + label: 'Adult Day Care Referral', + description: 'Superkalafragalisticexpialitotious', + is_active: '1', // Angular won't bind checkbox correctly with numeric 1 + definition: { // This is the serialized field + name: 'Adult Day Care Referral', + activityTypes: [ + {name: 'Open Case', max_instances: 1 }, + {name: 'Medical evaluation'} + ], + activitySets: [ + { + name: 'standard_timeline', + label: 'Standard Timeline', + timeline: '1', // Angular won't bind checkbox correctly with numeric 1 + activityTypes: [ + {name: 'Open Case', status: 'Completed' }, + {name: 'Medical evaluation', reference_activity: 'Open Case', reference_offset: 3, reference_select: 'newest'} + ] + }, + { + name: 'my_sequence', + label: 'Sequence', + pipeline: '1', // Angular won't bind checkbox correctly with numeric 1 + activityTypes: [ + {name: 'Medical evaluation'}, + {name: 'Meeting'}, + {name: 'Phone Call'} + ] + } + + ], + caseRoles: [ + { name: 'Senior Services Coordinator', creator: '1', manager: '1' }, + { name: 'Health Services Coordinator' }, + { name: 'Benefits Specialist' } + ] + } + }; + + $scope.onManagerChange = function(managerRole) { + angular.forEach($scope.caseType.definition.caseRoles, function(caseRole) { + if (caseRole != managerRole) { + caseRole.manager = '0'; + } + }); + }; + + $scope.removeItem = function(array, item) { + var idx = _.indexOf(array, item); + if (idx != -1) { + array.splice(idx, 1); + } + }; + + $scope.getWorkflowName = function(activitySet) { + if (activitySet.timeline) return "Timeline"; + if (activitySet.pipeline) return "Sequence"; + return "Unknown"; + }; + + /** + * Determine which HTML partial to use for a particular + * + * @return string URL of the HTML partial + */ + $scope.activityTableTemplate = function(activitySet) { + if (activitySet.timeline) { + return partialsUrl + '/timelineTable.html'; + } else if (activitySet.pipeline) { + return partialsUrl + '/pipelineTable.html'; + } else { + return ''; + } + }; + + $scope.dump = function() { + console.log($scope.caseType); + } + }); + +})(angular, CRM.$, CRM._); \ No newline at end of file diff --git a/partials/crmCaseType/activitySetDetails.html b/partials/crmCaseType/activitySetDetails.html new file mode 100644 index 0000000000..bc8287fd00 --- /dev/null +++ b/partials/crmCaseType/activitySetDetails.html @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + +
Label + +
Name + +
Workflow + {{ getWorkflowName(activitySet) }} +
diff --git a/partials/crmCaseType/activityTypesTable.html b/partials/crmCaseType/activityTypesTable.html new file mode 100644 index 0000000000..d600c2f19d --- /dev/null +++ b/partials/crmCaseType/activityTypesTable.html @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + +
Activity TypeMax Instances
+ {{ activityType.name }} + + {{ activityType.max_instances }} + + +
diff --git a/partials/crmCaseType/caseTypeDetails.html b/partials/crmCaseType/caseTypeDetails.html new file mode 100644 index 0000000000..c7f89b5dce --- /dev/null +++ b/partials/crmCaseType/caseTypeDetails.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + +
Label + +
Name + +
Description + +
Enabled? + +
diff --git a/partials/crmCaseType/edit.html b/partials/crmCaseType/edit.html new file mode 100644 index 0000000000..c0a208bd78 --- /dev/null +++ b/partials/crmCaseType/edit.html @@ -0,0 +1,34 @@ + +
+
+ +

Roles

+
+ +

Activities

+ +
+
+ Activity Types + +
+
+ +
+ {{ activitySet.label }} + +
+ +
+ Advanced +
+
+ +
+
+ + +
diff --git a/partials/crmCaseType/pipelineTable.html b/partials/crmCaseType/pipelineTable.html new file mode 100644 index 0000000000..bd7834c062 --- /dev/null +++ b/partials/crmCaseType/pipelineTable.html @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + +
Activity Type
{{ activity.name }} + +
diff --git a/partials/crmCaseType/rolesTable.html b/partials/crmCaseType/rolesTable.html new file mode 100644 index 0000000000..2b9e3c1f59 --- /dev/null +++ b/partials/crmCaseType/rolesTable.html @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + +
NameAssign to CreatorIs Manager
{{relType.name}} + +
diff --git a/partials/crmCaseType/timelineTable.html b/partials/crmCaseType/timelineTable.html new file mode 100644 index 0000000000..877362d358 --- /dev/null +++ b/partials/crmCaseType/timelineTable.html @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + +
Activity TypeStatusReferenceOffsetSelect
+ {{ activity.name }} + + {{ activity.status }} + + {{ activity.reference_activity }} + + {{ activity.reference_offset }} + + {{ activity.reference_select }} + + +