1window.angular && (function(angular) {
2  'use strict';
3
4  angular.module('app.common.directives').directive('logEvent', [
5    'APIUtils',
6    function(APIUtils) {
7      return {
8        'restrict': 'E',
9        'template': require('./log-event.html'),
10        'scope': {'event': '=', 'tmz': '=', 'multiSelected': '='},
11        'controller': [
12          '$rootScope', '$scope', 'dataService', '$location', '$timeout',
13          function($rootScope, $scope, dataService, $location, $timeout) {
14            $scope.dataService = dataService;
15            $scope.copySuccess = function(event) {
16              event.copied = true;
17              $timeout(function() {
18                event.copied = false;
19              }, 5000);
20            };
21            $scope.copyFailed = function(err) {
22              console.error('Error!', err);
23            };
24            $scope.resolveEvent = function(event) {
25              APIUtils.resolveLogs([{Id: event.Id}]).then(function() {
26                event.Resolved = 1;
27              });
28            };
29
30            $scope.accept = function() {
31              $scope.event.selected = true;
32              $timeout(function() {
33                $scope.$parent.accept();
34              }, 10);
35            };
36          }
37        ]
38      };
39    }
40  ]);
41})(window.angular);
42