Project

General

Profile

« Previous | Next » 

Revision 58323

View differences:

organizations.js
283 283
     }
284 284
});
285 285

  
286
orgsModule.directive('orgFormConflicts', function($http, $location, $route) {
286
orgsModule.directive('orgFormConflicts', function($http, $location, $route, $q) {
287 287
	return {
288 288
		restrict: 'E',
289 289
		scope: {
290
			'orgId'          : '@',   
290 291
			'conflicts'      : '=',
291 292
			'showSaveButton' : '@',
292 293
			'saveFunction'   : '&'
293 294
		},
294 295
		templateUrl: 'resources/html/forms/org_conflicts.html',
295
		link: function(scope, element, attrs, ctrl) {}
296
		link: function(scope, element, attrs, ctrl) {
297
			scope.candidateConflicts = [];
298
			scope.selectedConflicts = [];
299
			
300
			scope.prepareConflictsModal = function() {
301
				scope.candidateConflicts = [];
302
				scope.selectedConflicts = [];
303
				
304
				var gets = [ $http.get('api/organizations/get?id=' + scope.orgId) ];
305
				angular.forEach(scope.conflicts, function(c) { gets.push($http.get('api/organizations/get?id=' + c.id)); });
306
				
307
				$q.all(gets).then(function(responses) {
308
					scope.candidateConflicts = responses.map((resp) => resp.data);
309
					angular.forEach(scope.candidateConflicts, function(org) { org.show = 'secondary'; });
310
				});
311
			}
312
		}
296 313
     }
297 314
});
298 315

  

Also available in: Unified diff