var newCaseTypeDefinitionTemplate = {
activityTypes: [
- {name: 'Open Case', max_instances: 1 },
- {name: 'Example activity'}
+ {name: 'Open Case', max_instances: 1 }
],
activitySets: [
{
label: 'Standard Timeline',
timeline: '1', // Angular won't bind checkbox correctly with numeric 1
activityTypes: [
- {name: 'Open Case', status: 'Completed' },
- {name: 'Example activity', reference_activity: 'Open Case', reference_offset: 3, reference_select: 'newest'}
+ {name: 'Open Case', status: 'Completed' }
]
}
],
controller: 'CaseTypeCtrl',
resolve: {
selectedCaseType: function($route, crmApi) {
- return crmApi('CaseType', 'getsingle', {id: $route.current.params.id});
+ if ( $route.current.params.id !== 'new') {
+ return crmApi('CaseType', 'getsingle', {id: $route.current.params.id});
+ }
+ else {
+ return { title: "New case type", name: "New case type", definition: _.extend({}, newCaseTypeDefinitionTemplate) };
+ }
}
}
});
};
$scope.caseType = selectedCaseType;
- $scope.caseType.definition = $scope.caseType.definition || _.extend({}, newCaseTypeDefinitionTemplate);
+ $scope.caseType.definition = $scope.caseType.definition || [];
$scope.caseType.definition.activityTypes = $scope.caseType.definition.activityTypes || [];
$scope.caseType.definition.activitySets = $scope.caseType.definition.activitySets || [];
$scope.caseType.definition.caseRoles = $scope.caseType.definition.caseRoles || [];