Browse Source

Awork-Aufgabe direkt erstellen

gc-server3 10 months ago
parent
commit
1f9440bc8c
5 changed files with 548 additions and 35 deletions
  1. 46 15
      app/db.php
  2. 4 0
      app/scripts/app.js
  3. 33 9
      app/scripts/controllers/overview.js
  4. 29 11
      app/views/overview.html
  5. 436 0
      app/views/report.html

+ 46 - 15
app/db.php

@@ -5,7 +5,7 @@ header('Access-Control-Allow-Headers: accept, content-type');
 header('Cache-Control: no-cache, must-revalidate');
 header('Content-type: application/json');
 
-$dbh = new PDO("mysql:host=localhost;dbname=tasks", "root", "gc01mysql");
+$dbh = new PDO("mysql:host=192.168.2.41;dbname=tasks;charset=utf8", "gaps", "Gcbs12ma");
 $dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
 
 $data = json_decode(file_get_contents('php://input'), true);
@@ -17,7 +17,7 @@ switch ($_REQUEST['a']) {
 		$datum = $_REQUEST['datum'];
 		$start = ($_REQUEST['start'] == "null") ? '00:00:00' : $_REQUEST['start'];
 
-		$q = $dbh->query("SELECT sm.*, k.whitelist FROM status_meldung sm
+		$q = $dbh->query("SELECT sm.*, k.whitelist, k.awork_company_id FROM status_meldung sm
 						  INNER JOIN kunden k USING (kunde)
 						  WHERE sm.datum = '{$datum}' AND sm.kunde = '{$kunde}' AND sm.start = '{$start}' LIMIT 1");
 		$result = $q->fetch(PDO::FETCH_ASSOC);
@@ -90,7 +90,8 @@ switch ($_REQUEST['a']) {
 		$kunde = "Jansen";
 		$q = $dbh->query("SELECT * FROM kunden_gcstarter WHERE kunde = '{$kunde}' ORDER BY datum DESC LIMIT 1");
 		$result = $q->fetch(PDO::FETCH_ASSOC);
-		$r = json_decode(utf8_decode($result['gcstarter']), true);
+		//$r = json_decode(mb_convert_encoding($result['gcstarter'], 'ISO-8859-1', 'UTF-8'), true);
+		$r = json_decode($result['gcstarter'], true);
 		//echo json_last_error();
 		$byDate = (isset($r['Kontenzuordnung GAPS.csv.log'])) ? $r['Kontenzuordnung GAPS.csv.log'] : array();
 
@@ -121,7 +122,8 @@ switch ($_REQUEST['a']) {
 				if (isset($kunde['kunde'])) {
 					$q = $dbh->exec("UPDATE kunden SET system = '{$kunde['system']}', start_soll = '{$kunde['start_soll']}', ende_soll = '{$kunde['ende_soll']}',
 									erster_status = '{$kunde['erster_status']}', aktiv = '{$kunde['aktiv']}', woche = '{$kunde['woche']}',
-									bundesland = '{$kunde['bundesland']}', plz = '{$kunde['plz']}', ort = '{$kunde['ort']}' WHERE kunde = '{$kunde['kunde']}' ");
+									bundesland = '{$kunde['bundesland']}', plz = '{$kunde['plz']}', ort = '{$kunde['ort']}', 
+									awork_company_id = '{$kunde['awork_company_id']}' WHERE kunde = '{$kunde['kunde']}' ");
 				}
 			}
 		}
@@ -129,9 +131,25 @@ switch ($_REQUEST['a']) {
 		$result = $q->fetchAll(PDO::FETCH_ASSOC);
 		foreach ($result as $i => $r) {
 			$result[$i]['whitelist'] = json_decode(stripslashes($r['whitelist']), true);
-			$result[$i]['ort'] = utf8_decode($r['ort']);
+			$result[$i]['aktiv'] = (string)$result[$i]['aktiv'];
+			//$result[$i]['ort'] = mb_convert_encoding($r['ort'], 'ISO-8859-1', 'UTF-8');
 		}
 		break;
+	case 'awork_projekte':
+		$result = array();
+		if (isset($_REQUEST['awork_company_id'])) {
+			$q = $dbh->query("SELECT * FROM awork_projekte WHERE awork_company_id = '{$_REQUEST['awork_company_id']}'  
+							  OR awork_project_id = 'a751120a-2f91-4110-a62d-f50b4769236e'
+							  ORDER BY projekt_allgemein DESC, tracked_duration DESC");
+			$result["projekte"] = $q->fetchAll(PDO::FETCH_ASSOC);
+		} else {
+			$q = $dbh->query("SELECT * FROM awork_projekte");
+			$result["projekte"] = $q->fetchAll(PDO::FETCH_ASSOC);
+		}
+		
+		$q = $dbh->query("SELECT DISTINCT awork_company_id, kunde_name FROM awork_projekte ORDER BY kunde_name");
+		$result["kunden"] = $q->fetchAll(PDO::FETCH_ASSOC);
+		break;
 
 	case 'tickets':
 		if ($data != null && count($data) > 0) {
@@ -172,7 +190,7 @@ switch ($_REQUEST['a']) {
 		}
 		break;
 	case 'benutzer':
-		$q = $dbh->query("SELECT * FROM benutzer");
+		$q = $dbh->query("SELECT * FROM benutzer WHERE aktiv = '1'");
 		$result = $q->fetchAll(PDO::FETCH_ASSOC);
 		break;
 	case 'kommentar':
@@ -181,15 +199,18 @@ switch ($_REQUEST['a']) {
 		if ($data != null && count($data) > 0) {
 			if ($id == '') {
 				$now = date('Y-m-d H:i:s');
-				$q = $dbh->exec("INSERT INTO status_kommentar (kunde, datum, start, benutzer, fehler, status, kommentar, cdate)
-								 VALUES ('{$data['kunde']}','{$data['datum']}','{$data['start']}','{$data['benutzer']}','{$data['fehler']}','{$data['status']}','{$data['kommentar']}','{$now}')");
+				$q = $dbh->exec("INSERT INTO status_kommentar (kunde, datum, start, benutzer, benutzer2, fehler, status, kommentar, awork_project_id, awork_task_id, cdate)
+								 VALUES ('{$data['kunde']}','{$data['datum']}','{$data['start']}',
+								 '{$data['benutzer']}','{$data['benutzer2']}','{$data['fehler']}','{$data['status']}',
+								 '{$data['kommentar']}','{$data['awork_project_id']}','{$data['awork_task_id']}',
+								 '{$now}')");
 				$id = $dbh->lastInsertId();
 
-				if ($data['status'] == '7' && $data['benutzer2'] != '') {
-					$q = $dbh->exec("INSERT INTO status_kommentar (kunde, datum, start, benutzer, fehler, status, kommentar, cdate)
-								     VALUES ('{$data['kunde']}','{$data['datum']}','{$data['start']}','{$data['benutzer2']}','{$data['fehler']}','2','','{$now}')");
-					$id = $dbh->lastInsertId();
-				}
+				// if ($data['status'] == '7' && $data['benutzer2'] != '') {
+				// 	$q = $dbh->exec("INSERT INTO status_kommentar (kunde, datum, start, benutzer, fehler, status, kommentar, cdate)
+				// 				     VALUES ('{$data['kunde']}','{$data['datum']}','{$data['start']}','{$data['benutzer2']}','{$data['fehler']}','2','','{$now}')");
+				// 	$id = $dbh->lastInsertId();
+				// }
 
 				$q = $dbh->exec("UPDATE status_meldung SET bearbeitet = '1', kommentar_id = '{$id}'
 							 WHERE kunde = '{$data['kunde']}' AND datum = '{$data['datum']}' AND start = '{$data['start']}' ");
@@ -199,9 +220,17 @@ switch ($_REQUEST['a']) {
 									benutzer = '{$data['benutzer']}',
 									fehler = '{$data['fehler']}',
 									status = '{$data['status']}',
-									kommentar = '{$data['kommentar']}'
+									kommentar = '{$data['kommentar']}',
+									awork_project_id = '{$data['awork_project_id']}', 
+									awork_task_id = '{$data['awork_task_id']}'
 								 WHERE id = '{$id}' ");
 			}
+
+			if (isset($data['awork_project_id']) && $data['awork_project_id'] != '' && $data['awork_task_id'] == '') {
+				// create task in awork
+				// save into $data['awork_task_id']
+				exec('C:\dev\python3.11\python.exe C:\Projekte\Python\awork\awork_tasks.py ' . $id);
+			}			
 		}
 		$q = $dbh->query("SELECT * FROM status_kommentar
 						  WHERE datum > date_add(now(), INTERVAL -32 DAY)
@@ -214,7 +243,9 @@ switch ($_REQUEST['a']) {
 		$datum_bis = (!isset($_REQUEST['datum_bis']) || $_REQUEST['datum_bis'] == '') ? "a.datum > date_add(now(), INTERVAL -32 DAY)" : "a.datum <= '{$_REQUEST['datum_bis']}' ";
 		$kunde = (!isset($_REQUEST['kunde']) || $_REQUEST['kunde'] == '') ? "1" : "k.kunde LIKE '%{$_REQUEST['kunde']}%'";
 
-		$q = $dbh->query("SELECT DISTINCT a.datum, k.kunde, sm.aufgabe, k.system, a.bundesland, a.feiertag, k.start_soll, k.ende_soll, sm.start, sm.ende, sm.anzahl, if(sk2.id IS NULL, sm.bearbeitet, '1') as bearbeitet,
+		$q = $dbh->query("SELECT DISTINCT a.datum, k.kunde, sm.aufgabe, k.awork_company_id, k.system, a.bundesland, a.feiertag, 
+							k.start_soll, k.ende_soll, sm.start, sm.ende, sm.anzahl, ifnull(sk.awork_task_id, '') as awork_task_id,
+							if(sk2.id IS NULL, sm.bearbeitet, '1') as bearbeitet,
 								case
 								 when woche = 'Mo-Fr' then mofr
 								 when woche = 'Mo-Sa' then mosa

+ 4 - 0
app/scripts/app.js

@@ -83,6 +83,10 @@
                     templateUrl: 'views/overview.html',
                     controller: 'OverviewCtrl'
                 })
+                .when('/report/:customer/:date/:start', {
+                    templateUrl: 'views/report.html',
+                    controller: 'OverviewCtrl'
+                })                
                 .when('/tickets', {
                     templateUrl: 'views/tickets.html',
                     controller: 'TicketsCtrl'

+ 33 - 9
app/scripts/controllers/overview.js

@@ -115,7 +115,8 @@ angular.module('fehlerberichtApp')
             'details': null,
             'status': 2,
             'kommentar': {},
-            'fehlerdetails': null
+            'fehlerdetails': null,
+            'awork_projekte': []
         };
 
         $scope.Filter = {
@@ -349,7 +350,9 @@ angular.module('fehlerberichtApp')
                 'fehler': (row.anzahl === null) ? 0 : parseInt(row.anzahl, 10),
                 'status': '0',
                 'kommentar': '',
-                'benutzer2': ''
+                'benutzer2': '',
+                'awork_project_id': '',
+                'awork_task_id': '',
             };
 
             $http.get(webservice + 'a=liste&kunde=' + $scope.current.zeile.kunde + '&datum=').success(function (data) {
@@ -357,7 +360,12 @@ angular.module('fehlerberichtApp')
             });
 
             $http.get(webservice + 'a=fehlerbericht&kunde=' + $scope.current.zeile.kunde + '&datum=' + $scope.current.zeile.datum + '&start=' + $scope.current.zeile.start).success(function (data) {
+                $http.get(webservice + 'a=awork_projekte&awork_company_id=' + data.awork_company_id).success(function (data2) {
+                    $scope.current.awork_projekte = data2.projekte;
+                });
+                
                 $scope.current.fehler = data;
+                $scope.current.template.fehler = $scope.current.fehler.anzahl;
                 if (data.whitelist === undefined || data.whitelist === null) {
                     data.whitelist = {
                         'User': [],
@@ -428,13 +436,9 @@ angular.module('fehlerberichtApp')
             return 'blubb';
         };
 
-        $scope.getCommentIcon = function (c) {
-            var c0 = c;
-            if (c.length > 0) {
-                c0 = c[0];
-            }
-            if (c0.status) {
-                return $scope.domain.comment[c0.status];
+        $scope.getCommentIcon = function (status) {
+            if (status !== undefined && $scope.domain.comment[status] != undefined) {
+                return $scope.domain.comment[status];
             }
             return "glyphicon-question-sign";
         };
@@ -468,6 +472,14 @@ angular.module('fehlerberichtApp')
             } );
         };
 
+        $scope.getProject = function (project_id) {
+            var project = _.filter($scope.current.awork_projekte, function (p) { return p.awork_project_id === project_id; });
+            if (project.length > 0) {
+                return project[0].projekt_name;
+            }
+            return "-- keine Aktion --";
+        };
+
         $scope.saveUser = function (name) {
             window.localStorage.setItem("Benutzer", name);
             $scope.benutzer = name;
@@ -516,4 +528,16 @@ angular.module('fehlerberichtApp')
         $scope.inWhitelist = function (key, value) {
             return $scope.current.fehler.whitelist[key] !== undefined && _.contains($scope.current.fehler.whitelist[key], value);
         };
+
+
+
+        if ($routeParams.start !== undefined) {
+            var row = {
+                kunde: $routeParams.customer,
+                datum: $routeParams.date,
+                start: $routeParams.start,
+                anzahl: 1,
+            };
+            $scope.setCurrent(row);
+        };
     });

+ 29 - 11
app/views/overview.html

@@ -18,32 +18,34 @@
 </div>
 
 <div class="row">
-    <div class="container-fluid col-md-8">
-<table class="table table-bordered table-striped">
+    <div class="container-fluid col-md-12">
+<table class="table table-bordered table-striped" style="width: auto;">
     <tr>
-        <th>
+        <th style="width: 130px;">
             <label>
                 Datum <i class="glyphicon glyphicon-sort-by-alphabet" ng-click="Predicate='datum'"></i><br/>
                 <input ng-model="DatumFilter.von" type="date" ng-change="refresh()" /><br/>
                 <input ng-model="DatumFilter.bis" type="date" ng-change="refresh()" />
             </label>
         </th>
-        <th>
+        <th style="width: 250px;">
             <label>
                 Kunde <i class="glyphicon glyphicon-sort-by-alphabet" ng-click="Predicate='kunde'"></i><br/>
                 <input ng-model="Filter.kunde" ng-change="refresh()" />
             </label>
         </th>
-        <th>Info</th>
-        <th>Start Soll<br/>Ende Soll <i class="glyphicon glyphicon-sort-by-alphabet" ng-click="Predicate='ende_soll'"></i></th>
-        <th>Start Ist<br/>Ende Ist</th>
-        <th>Abweichung</th>
-        <th>Fehler / Statistik</th>
-        <th>Kommentar</th>
+        <th style="width: 80px;">Awork</th>
+        <th style="width: 120px;">Info</th>
+        <th style="width: 120px;">Start Soll<br/>Ende Soll <i class="glyphicon glyphicon-sort-by-alphabet" ng-click="Predicate='ende_soll'"></i></th>
+        <th style="width: 120px;">Start Ist<br/>Ende Ist</th>
+        <th style="width: 120px;">Abweichung</th>
+        <th style="width: 100px;">Fehler / Statistik</th>
+        <th style="width: 150px;">Kommentar</th>
     </tr>
     <tr>
         <td></td>
 		<td></td>
+		<td></td>
         <td>
             <div class="dropdown">
                 <a class="btn dropdown-toggle" role="button" data-toggle="dropdown">{{Filter.system||'alle'}}&nbsp;<b class="caret"></b></a>
@@ -91,6 +93,14 @@
     <tr ng-repeat="zeile in overview | filter:DatumFilter.datum | filter:Filter | orderBy:Predicate:Reverse" ng-class="{'danger':zeile.fehlend==1}">
         <td>{{dateFormat(zeile.datum)}}</td>
         <td><a ng-href="#/overview/{{zeile.kunde}}/all/all">{{zeile.kunde}}</a> {{zeile.aufgabe}}</td>
+        <td>
+            <div ng-show="zeile.awork_company_id">
+                <a target="_blank" ng-href="https://mintcream-awesome-ninjas.awork.com/companies/{{zeile.awork_company_id}}/projects/list">
+                    <button type="button" class="btn btn-default btn-sm" title="Awork">
+                        <img src="/images/awork-01.svg" style="width: 14px;">
+                    </button>
+                </a></td>
+            </div>
         <td>
             <span class="label label-danger label-{{zeile.system}}">{{zeile.system}}</span>
         </td>
@@ -121,10 +131,18 @@
             <button type="button" class="btn btn-default btn-sm" ng-init="c = getComments(zeile)" ng-show="c" data-toggle="popover" data-placement="bottom"
                     title="" data-content="" data-popover="{{c[0].id}}" data-kunde="{{c[0].kunde}}" data-datum="{{c[0].datum}}">
                 <span ng-show="c[0].datum != zeile.datum">{{dateFormat(c[0].datum)}}: </span>
-                <span class="glyphicon {{getCommentIcon(c)}}"></span>
+                <span class="glyphicon {{getCommentIcon(c[0].status)}}"></span>
                 <span class="label label-danger label-{{c[0].fehler}}"> {{c[0].fehler}}</span>
                 {{c[0].benutzer}}
             </button>
+
+            <span ng-show="zeile.awork_task_id != ''">
+                <a target="_blank" ng-href="https://mintcream-awesome-ninjas.awork.com/tasks/{{zeile.awork_task_id}}">
+                    <button type="button" class="btn btn-default btn-sm" title="Awork">
+                        <img src="/images/awork-01.svg" style="width: 14px;">
+                    </button>
+                </a>
+            </span>
         </td>
     </tr>
 </table>

+ 436 - 0
app/views/report.html

@@ -0,0 +1,436 @@
+
+<!-- Modal -->
+<div class="modal" id="fehler-modal" tabindex="-1" role="dialog" aria-labelledby="fehler-modal-label" aria-hidden="false">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close"><a ng-href="#"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></a></button>
+                <h4 class="modal-title" id="fehler-modal-label"><span class="glyphicon glyphicon-exclamation-sign"></span>&nbsp; {{current.zeile.kunde}} - {{dateFormat(current.zeile.datum)}}</h4>
+            </div>
+
+
+            <div class="modal-body">
+                <h3>Kommentar</h3>
+
+                <table class="table table-hover table-bordered">
+                    <tr>
+                        <th>Benutzer</th>
+                        <td>
+                            <div class="dropdown">
+                                <a class="btn dropdown-toggle" role="button" data-toggle="dropdown">{{current.kommentar.benutzer||'unbekannt'}}&nbsp;<b class="caret"></b></a>
+                                <ul class="dropdown-menu" role="menu">
+                                    <li ng-repeat="val in domain.benutzer"><a ng-click="current.kommentar.benutzer=val">{{val}}</a></li>
+                                </ul>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Bearbeitungsstand</th>
+                        <td>
+                            <div class="dropdown">
+                                <a class="btn dropdown-toggle" role="button" data-toggle="dropdown"><span class="glyphicon {{getCommentIcon(current.kommentar)}}"></span> {{domain.bearbeitet[current.kommentar.status]||'unbekannt'}}&nbsp;<b class="caret"></b></a>
+                                <ul class="dropdown-menu" role="menu">
+                                    <li ng-repeat="(key,val) in domain.bearbeitet"><a ng-click="current.kommentar.status=key"><span class="glyphicon {{domain.comment[key]}}"></span> {{val}}</a></li>
+                                </ul>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Awork-Aufgabe erstellen</th>
+                        <td>
+                            <div class="dropdown">
+                                <a class="btn dropdown-toggle" role="button" data-toggle="dropdown">{{getProject(current.kommentar.awork_project_id)}}&nbsp;<b class="caret"></b></a>
+                                <ul class="dropdown-menu" role="menu">
+                                    <li><a ng-click="current.kommentar.awork_project_id=''">-- keine Aktion --</a></li>
+                                    <li ng-repeat="val in current.awork_projekte"><a ng-click="current.kommentar.awork_project_id=val.awork_project_id">{{val.projekt_name}}</a></li>
+                                </ul>
+                            </div>
+                        </td>
+                    </tr>
+                    <tr ng-show="current.kommentar.awork_project_id!=''">
+                        <th>Awork-Aufgabe zuweisen</th>
+                        <td>
+                            <div class="dropdown">
+                                <a class="btn dropdown-toggle" role="button" data-toggle="dropdown">{{current.kommentar.benutzer2||'mir selbst'}}&nbsp;<b class="caret"></b></a>
+                                <ul class="dropdown-menu" role="menu">
+                                    <li ng-repeat="val in domain.benutzer"><a ng-click="current.kommentar.benutzer2=val">{{val}}</a></li>
+                                </ul>
+                            </div>
+                        </td>
+                    <tr>
+                        <th>Anzahl Fehler
+                            <span class="label label-danger label-{{current.fehler.anzahl}}"> {{current.fehler.anzahl}}</span>
+                        </th>
+                        <td>
+                            <span class="label label-danger label-{{current.kommentar.fehler}}"> {{current.kommentar.fehler}}</span> &nbsp;
+                            <label>
+                                <input type="range" name="Anzahl" min="0" max="10" ng-model="current.kommentar.fehler" />
+                            </label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>Kommentar</th>
+                        <td>
+                            <label>
+                                <textarea cols="60" rows="5" ng-model="current.kommentar.kommentar"></textarea>
+                            </label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td></td>
+                        <td>
+                            <button type="button" class="btn btn-default" ng-click="saveComments()">Speichern</button>
+                            <button type="button" class="btn btn-primary" ng-click="saveComments()" data-dismiss="modal">Speichern und schließen</button>
+                        </td>
+                    </tr>
+                </table>
+
+
+                <h3>Fehler</h3>
+
+                <div class="logdatei" ng-repeat="e in current.fehler.fehlerbericht | filter: errorLevel | orderBy: 'ErrorLevel'">
+                    <a href="" onclick="$(this).next().toggle()" ng-click="e.Errors3 = e.Errors">
+                        <p class="modell" ng-class="{'rot':e.ErrorLevel < 3}">{{e.Type}}: {{e.Name}} ({{errorCount(e)}})</p>
+                    </a>
+
+                    <div class="closed-tab">
+                        <ul class="fehler" ng-show="e.Type=='Modell'">
+                            <li ng-repeat="error in e.Errors3"><a href="http://rbs06/wiki/{{error.Number}}" target="_blank">{{error.Number}}</a>:
+                                ({{error.Level}}) {{error.Message}}</li>
+                        </ul>
+                        <pre class="fehler" ng-show="e.Type=='Workflow'" ng-bind-html="e.Errors3[0]"></pre>
+                        <table class="ft" ng-show="e.Type=='Portal'||e.Type=='Versand'">
+                            <tbody ng-repeat="error in e.Errors3">
+                                <tr>
+                                    <td rowspan="6" class="number">{{$index+1}}
+                                    <td>Datei:</td>
+                                    <td></td>
+                                    <td>{{error.Filename}}</td>
+                                </tr>
+                                <tr>
+                                    <td>Stand:</td>
+                                    <td></td>
+                                    <td>{{error.Modified}}</td>
+                                </tr>
+                                <tr>
+                                    <td>Benutzer:</td>
+                                    <td><button class="btn btn-default btn-sm" ng-show="!inWhitelist('User', error.User)" ng-click="whitelistToggle('User', error.User)"><span class="glyphicon glyphicon-ban-circle"></span></button></td>
+                                    <td>{{error.User}}</td>
+                                </tr>
+                                <tr>
+                                    <td>Bericht:</td>
+                                    <td><button class="btn btn-default btn-sm" ng-show="!inWhitelist('Report', error.Report)" ng-click="whitelistToggle('Report', error.Report)"><span class="glyphicon glyphicon-ban-circle"></span></button></td>
+                                    <td>{{error.Report}}</td>
+                                </tr>
+                                <tr>
+                                    <td>Schicht:</td>
+                                    <td><button class="btn btn-default btn-sm" ng-show="!inWhitelist('Layer', error.Layer)" ng-click="whitelistToggle('Layer', error.Layer)"><span class="glyphicon glyphicon-ban-circle"></span></button></td>
+                                    <td>{{error.Layer}}</td>
+                                </tr>
+                                <tr class="strich">
+                                    <td><div  ng-show="e.Type=='Versand'">Empfänger:</div></td>
+                                    <td></td>
+                                    <td><div ng-bind-html="mailFormat(error.MailTo)"></div></td>
+                                </tr>
+                            </tbody>
+                            <tr ng-show="e.Errors2">
+                                <td colspan="4"><a ng-click="e.Show=!e.Show;">Ausgeblendete Berichte</a></td>
+                            </tr>
+                            <tbody ng-repeat="error in e.Errors2" ng-show="e.Show">
+                            <tr>
+                                <td rowspan="6" class="number">{{$index+1}}
+                                <td>Datei:</td>
+                                <td></td>
+                                <td>{{error.Filename}}</td>
+                            </tr>
+                            <tr>
+                                <td>Stand:</td>
+                                <td></td>
+                                <td>{{error.Modified}}</td>
+                            </tr>
+                            <tr>
+                                <td>Benutzer:</td>
+                                <td><button class="btn btn-default btn-sm" ng-show="!inWhitelist('User', error.User)" ng-click="whitelistToggle('User', error.User)"><span class="glyphicon glyphicon-ban-circle"></span></button></td>
+                                <td>{{error.User}}</td>
+                            </tr>
+                            <tr>
+                                <td>Bericht:</td>
+                                <td><button class="btn btn-default btn-sm" ng-show="!inWhitelist('Report', error.Report)" ng-click="whitelistToggle('Report', error.Report)"><span class="glyphicon glyphicon-ban-circle"></span></button></td>
+                                <td>{{error.Report}}</td>
+                            </tr>
+                            <tr>
+                                <td>Schicht:</td>
+                                <td><button class="btn btn-default btn-sm" ng-show="!inWhitelist('Layer', error.Layer)" ng-click="whitelistToggle('Layer', error.Layer)"><span class="glyphicon glyphicon-ban-circle"></span></button></td>
+                                <td>{{error.Layer}}</td>
+                            </tr>
+                            <tr class="strich">
+                                <td><div  ng-show="e.Type=='Versand'">Empfänger:</div></td>
+                                <td></td>
+                                <td><div ng-bind-html="mailFormat(error.MailTo)"></div></td>
+                            </tr>
+                            </tbody>
+                        </table>
+
+                    </div>
+                </div>
+
+                <h3>Weitere Logdateien</h3>
+
+                <table class="table table-hover table-bordered">
+                    <tr ng-repeat="(header, g) in current.fehler.weitere">
+                        <th>{{header}}</th>
+
+                        <td>
+                            <ul>
+                                <li ng-repeat="e in g" >
+                                    <a ng-click="current.fehlerdetails = e" ng-show="header != 'Modell'">{{e.Name}}</a>
+                                    <span ng-show="header == 'Modell'">{{e.Name}}</span>
+                                </li>
+                            </ul>
+                        </td>
+                    </tr>
+                </table>
+
+                <div class="logdatei" ng-show="current.fehlerdetails != null">
+                    <p class="modell">{{current.fehlerdetails.Type}}: {{current.fehlerdetails.Name}} ({{errorCount(current.fehlerdetails)}})</p>
+                    <pre class="fehler" ng-repeat="error in current.fehlerdetails.Errors">{{error}}</pre>
+                    <table class="ft" ng-show="current.fehlerdetails.Errors2">
+                        <tbody ng-repeat="error in current.fehlerdetails.Errors2">
+                        <tr>
+                            <td rowspan="6" class="number">{{$index+1}}
+                            <td>Datei:</td>
+                            <td></td>
+                            <td>{{error.Filename}}</td>
+                        </tr>
+                        <tr>
+                            <td>Stand:</td>
+                            <td></td>
+                            <td>{{error.Modified}}</td>
+                        </tr>
+                        <tr>
+                            <td>Benutzer:</td>
+                            <td><button class="btn btn-default btn-sm" ng-show="!inWhitelist('User', error.User)" ng-click="whitelistToggle('User', error.User)"><span class="glyphicon glyphicon-ban-circle"></span></button></td>
+                            <td>{{error.User}}</td>
+                        </tr>
+                        <tr>
+                            <td>Bericht:</td>
+                            <td><button class="btn btn-default btn-sm" ng-show="!inWhitelist('Report', error.Report)" ng-click="whitelistToggle('Report', error.Report)"><span class="glyphicon glyphicon-ban-circle"></span></button></td>
+                            <td>{{error.Report}}</td>
+                        </tr>
+                        <tr>
+                            <td>Schicht:</td>
+                            <td><button class="btn btn-default btn-sm" ng-show="!inWhitelist('Layer', error.Layer)" ng-click="whitelistToggle('Layer', error.Layer)"><span class="glyphicon glyphicon-ban-circle"></span></button></td>
+                            <td>{{error.Layer}}</td>
+                        </tr>
+                        <tr class="strich">
+                            <td><div  ng-show="e.Type=='Versand'">Empfänger:</div></td>
+                            <td></td>
+                            <td><div ng-bind-html="mailFormat(error.MailTo)"></div></td>
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+
+                <div ng-show="current.fehler.whitelist.User || current.fehler.whitelist.Report || current.fehler.whitelist.Layer">
+                    <h3>Ausgeblendete Berichte</h3>
+
+                    <table class="table table-hover table-bordered">
+                        <tr ng-show="current.fehler.whitelist.User">
+                            <th>Benutzer</th>
+                            <td>
+                                <ul>
+                                    <li ng-repeat="val in current.fehler.whitelist.User"><a ng-click="whitelistToggle('User', val)">{{val}}</a></li>
+                                </ul>
+                            </td>
+                        </tr>
+                        <tr ng-show="current.fehler.whitelist.Report">
+                            <th>Bericht</th>
+                            <td>
+                                <ul>
+                                    <li ng-repeat="val in current.fehler.whitelist.Report"><button ng-click="whitelistToggle('Report', val)"><span class="glyphicon glyphicon-trash"></span></button> {{val}}</li>
+                                </ul>
+                            </td>
+                        </tr>
+                        <tr ng-show="current.fehler.whitelist.Layer">
+                            <th>Schicht</th>
+                            <td>
+                                <ul>
+                                    <li ng-repeat="val in current.fehler.whitelist.Layer"><a ng-click="whitelistToggle('Layer', val)">{{val}}</a></li>
+                                </ul>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+
+                <h3>Historie</h3>
+
+                <table class="table table-hover table-bordered table-condensed">
+                    <tr>
+                        <th style="width: 140px;">Datum</th>
+                        <th style="width: 100px;">Start<br/>Ende</th>
+                        <th style="width: 110px;">Abweichung</th>
+                        <th style="width: 120px;">Fehler</th>
+                        <th style="width: 340px;">Kommentar</th>
+                    </tr>
+                    <tr ng-repeat="z in current.overview | orderBy: 'datum':true | limitTo: current.limit " ng-class="{'danger':z.fehlend==1}">
+                        <td>{{dateFormat(z.datum)}}</td>
+                        <td>
+                            <a ng-click="saveStartTime(z)">{{z.start}}</a><br/>
+                            <a ng-click="saveEndTime(z)">{{z.ende}}</a>
+                        </td>
+                        <td>
+                            {{timeDiffStart(z)}}<br/>
+                            {{timeDiff(z)}}
+                        </td>
+                        <td>
+                            <button type="button" class="btn btn-default btn-sm" ng-click="setCurrent(z)" ng-show="z.anzahl != null">
+                                <span class="glyphicon" ng-class="{'glyphicon-check': z.anzahl == 0 && z.bearbeitet == 1, 'glyphicon-eye-close': z.anzahl == 0 && z.bearbeitet == 0,  'glyphicon-exclamation-sign': z.anzahl > 0 && z.bearbeitet == 0,  'glyphicon-ok': z.anzahl > 0 && z.bearbeitet == 1}"></span>
+                                <span class="label label-danger label-{{z.anzahl}}"> {{z.anzahl}}</span>
+                            </button>
+
+                            <button type="button" data-trigger="focus" class="btn btn-default btn-sm" ng-click="setCurrent(zeile)" ng-show="z.anzahl == null">
+                                <span class="glyphicon glyphicon-question-sign"></span>
+                            </button>
+                        </td>
+                        <td>
+                            <button type="button" class="btn btn-default btn-sm" ng-init="c = getComments(z, '1')" ng-show="c" data-toggle="popover" data-placement="bottom"
+                                    title="" data-content="" data-popover="{{c.id}}">
+                                <span ng-show="c[0].datum != z.datum">{{dateFormat(c[0].datum)}}: </span>
+                                <span class="glyphicon {{getCommentIcon(c)}}"></span>
+                                <span class="label label-danger label-{{c[0].fehler}}"> {{c[0].fehler}}</span>
+                                {{c[0].benutzer}}
+                            </button>
+
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>
+                            <button class="btn btn-default" ng-click="current.limit=100"><span class="glyphicon glyphicon-plus"></span></button>
+                        </td>
+                    </tr>
+                </table>
+
+                <h3>Statistik</h3>
+
+                <div>
+                    <div id="durationChart" style="width: 750px; height: 550px"></div>
+
+                    </div>
+                    <br/><br/>
+                    <table class="table table-bordered table-striped">
+                        <tr>
+                            <th>Name</th>
+                            <th>Datum</th>
+                            <th>Zeit</th>
+                            <th>Dauer</th>
+                            <th>Quellen</th>
+                            <th>Kategorien</th>
+                            <th>Datensätze</th>
+                        </tr>
+                        <tr ng-repeat="e in current.fehler.fehlerbericht" ng-show="e.Summary.Duration != null">
+                            <td>{{e.Type}}: <a href="" ng-click="showDetails(e)">{{e.Name}}</a></td>
+                            <td>{{dateFormat(e.Modified)}}</td>
+                            <td>{{timeFormat(e.Modified)}}</td>
+                            <td>{{e.Summary.Duration}}</td>
+                            <td>{{e.Sources.length}}</td>
+                            <td>{{e.Summary.Categories}}</td>
+                            <td>{{e.Summary.Entities}}</td>
+                        </tr>
+                    </table>
+
+                    <div ng-show="current.details!=null">
+                        <h3>Details zu {{current.details.Type}}: {{current.details.Name}}</h3>
+                        <div id="durationDetailsChart" style="width: 750px; height: 550px">
+
+                        </div>
+                        <br/><br/>
+                        <table class="table table-bordered table-striped">
+                            <tr>
+                                <th>Name</th>
+                                <th ng-show="current.details.Type!='Modell'">Report</th>
+                                <th ng-show="current.details.Type=='Modell'">Datensätze</th>
+                                <th>Dauer</th>
+                            </tr>
+                            <tr ng-repeat="e in current.details.Sources">
+                                <td>{{e.Filename}}</td>
+                                <td ng-show="current.details.Type!='Modell'">{{e.Report}} ({{e.Layer}})</td>
+                                <td ng-show="current.details.Type=='Modell'">{{e.Entities}}</td>
+                                <td>{{e.Duration}}</td>
+                            </tr>
+                        </table>
+                    </div>
+                </div>
+
+
+
+
+            </div>
+        </div>
+    </div>
+</div>
+
+<style>
+.table tbody tr td {
+    vertical-align: middle;
+}
+
+.label-0 {
+    background-color: #aaaaaa;
+}
+
+.label-1 {
+    background-color: #bbbb00;
+}
+
+.label-2 {
+    background-color: #bb8800;
+}
+
+.label-3 {
+    background-color: #bb0000;
+}
+
+table.ft {
+    border: 1px solid #888;
+}
+
+table.ft td {
+    padding: 3px 5px;
+    margin: 2px;
+    background-color: #ddd;
+}
+
+.logdatei {
+    margin: 10px 5px 20px 5px;
+    padding: 0 20px 10px 20px;
+    background-color: #eee;
+    border: 1px solid #888;
+}
+
+.modell {
+    font-weight: bold;
+    background-color: #ccc;
+    padding: 10px;
+    margin: 0 -20px;
+}
+
+.rot {
+    background-color: #e88;
+}
+
+.number {
+    font-weight: bold;
+    background-color: #ccc;
+    border: 1px solid #888888;
+}
+
+.strich {
+    border-bottom: 1px solid #888888;
+}
+
+.modal {
+    display: block;
+    overflow: auto;
+}
+
+</style>