<div class="row">
  <dl class="dl-horizontal">
    <div class="col-sm-6" ng-if="item.id"><dt>{{ "ID" | translate }}:</dt><dd><a ng-href="#/All/alert/{{item.id}}">{{item.id}}</a></dd></div>
    <div class="col-sm-6" ng-if="item.orgClient"><dt>{{ "ORGCLIENT" | translate }}:</dt><dd>{{item.orgClient}}</dd></div>
    <div class="col-sm-6" ng-if="item.category"><dt>{{ "CATEGORY" | translate }}:</dt><dd>{{item.category | translate }}</dd></div>
    <div class="col-sm-6" ng-if="item.Creation_Date"><dt>{{ "CREATED" | translate }}:</dt><dd>{{item.Creation_Date | parseDate | formatTimestamp}}</dd></div>
    <div class="col-sm-6" ng-if="item.status"><dt>{{ "STATUS" | translate }}:</dt><dd>{{item.status | translate }}</dd></div>
    <div class="col-sm-6"><dt>{{ "SESSION" | translate }}:</dt><dd ng-if="!chooseSession">{{item.session}}</dd><dd ng-if="chooseSession"><a ng-click="chooseSession(item.session)" class="no-link-link">{{item.session}}</a></dd></div>
    <div class="col-sm-6" ng-if="item.user.username"><dt>{{ "ASSIGNED_TO" | translate }}:</dt><dd>{{item.user.username}}</dd></div>
    <!-- <div class="col-sm-6" ng-if="item.Similarity"><dt>{{ "SIMILARITY" | translate }}:</dt><dd>{{item.Similarity | number:4}}</dd></div> -->
    <div class="col-sm-6" ng-show='item.listEntries'>
      <dt>{{ "WHITE_WATCH_LISTS" | translate }}:</dt>
      <dd>{{item.listEntries | parseWatchLists}}</dd>
    </div>
  </dl>
</div>

<hr />

<div class="row">
  <dl class="dl-horizontal">
    <div class="col-sm-6" ng-if="item.Product_group"><dt>{{ "Product_group" | translate }}:</dt><dd>{{item.Product_group}}</dd></div>
    <div class="col-sm-6" ng-if="item.Country"><dt>{{ "Country" | translate }}:</dt><dd>{{item.Country}}</dd></div>
    <div class="col-sm-6" ng-if="item.Actual_sales_volume_m1"><dt>{{ "Actual_sales_volume_m1" | translate }}:</dt><dd>{{item.Actual_sales_volume_m1 | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item.Predicted_volume"><dt>{{ "Predicted_volume" | translate }}:</dt><dd>{{item.Predicted_volume | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item.Actual_sales_volume_m2"><dt>{{ "Actual_sales_volume_m2" | translate }}:</dt><dd>{{item.Actual_sales_volume_m2 | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item.Predicted_3m_volume"><dt>{{ "Predicted_3m_volume" | translate }}:</dt><dd>{{item.Predicted_3m_volume | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item.Actual_sales_volume_m3"><dt>{{ "Actual_sales_volume_m3" | translate }}:</dt><dd>{{item.Actual_sales_volume_m3 | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item.Prod_load_level"><dt>{{ "Prod_load_level" | translate }}:</dt><dd>{{item.Prod_load_level | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item.Stock_level_local"><dt>{{ "Stock_level_local" | translate }}:</dt><dd>{{item.Stock_level_local | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item.Stock_level"><dt>{{ "Stock_level" | translate }}:</dt><dd>{{item.Stock_level | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item.Prod_plan_1m"><dt>{{ "Prod_plan_1m" | translate }}:</dt><dd>{{item.Prod_plan_1m | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item.Prod_plan_3m"><dt>{{ "Prod_plan_3m" | translate }}:</dt><dd>{{item.Prod_plan_3m | number:0}}</dd></div>

    <div class="col-sm-6" ng-if="item['Verkaufsbeleg']"><dt>{{ "Verkaufsbeleg" | translate }}:</dt><dd>{{item['Verkaufsbeleg'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['Lieferung']"><dt>{{ "Lieferung" | translate }}:</dt><dd>{{item['Lieferung'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['Auftr_geb']"><dt>{{ "Auftr_geb" | translate }}:</dt><dd>{{item['Auftr_geb'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['VArt']"><dt>{{ "VArt" | translate }}:</dt><dd>{{item['VArt']}}</dd></div>
    <div class="col-sm-6" ng-if="item['VkOrg']"><dt>{{ "VkOrg" | translate }}:</dt><dd>{{item['VkOrg'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['VWeg']"><dt>{{ "VWeg" | translate }}:</dt><dd>{{item['VWeg'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['SP']"><dt>{{ "SP" | translate }}:</dt><dd>{{item['SP'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['Nettowert']"><dt>{{ "Nettowert" | translate }}:</dt><dd>{{item['Nettowert'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['Nettogewicht2']"><dt>{{ "Nettogewicht2" | translate }}:</dt><dd>{{item['Nettogewicht2'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['Gesamtgewicht']"><dt>{{ "Gesamtgewicht" | translate }}:</dt><dd>{{item['Gesamtgewicht'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['Bestellpreis, EUR']"><dt>{{ "Bestellpreis, EUR" | translate }}:</dt><dd>{{item['Bestellpreis, EUR'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['Werk_perc']"><dt>{{ "Werk_perc" | translate }}:</dt><dd>{{item['Werk_perc']}}</dd></div>
    <div class="col-sm-6" ng-if="item['IncTm']"><dt>{{ "IncTm" | translate }}:</dt><dd>{{item['IncTm']}}</dd></div>
    <div class="col-sm-6" ng-if="item['Inco_2']"><dt>{{ "Inco_2" | translate }}:</dt><dd>{{item['Inco_2']}}</dd></div>
    <div class="col-sm-6" ng-if="item['Lnd']"><dt>{{ "Lnd" | translate }}:</dt><dd>{{item['Lnd']}}</dd></div>
    <div class="col-sm-6" ng-if="item['Rg']"><dt>{{ "Rg" | translate }}:</dt><dd>{{item['Rg'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['Gruppe']"><dt>{{ "Gruppe" | translate }}:</dt><dd>{{item['Gruppe'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['City']"><dt>{{ "City" | translate }}:</dt><dd>{{item['City']}}</dd></div>
    <div class="col-sm-6" ng-if="item['post_2']"><dt>{{ "post_2" | translate }}:</dt><dd>{{item['post_2'] | number:0}}</dd></div>
    <div class="col-sm-6" ng-if="item['Postfach']"><dt>{{ "Postfach" | translate }}:</dt><dd>{{item['Postfach']}}</dd></div>
      <!--     <div class="col-sm-6" ng-show='item.query.virtual_client || item.virtual_client'>
      <dt></dt>
      <dd><a ng-href="#/anon-alert/{{item.query.virtual_client.id}}" ng-if="item.query.virtual_client" target="_blank">Anonymous link</a>
      <a ng-href="#/anon-alert/{{item.virtual_client.id}}" ng-if="item.virtual_client" target="_blank">Anonymous link</a></dd>
    </div> -->
  </dl>
</div>

<div ng-show="item.query.client || item.client">
  <h1>{{ "CLIENT" | translate }}</h1>
  <list data="[item.query.client || item.client]"
        columns="config.types.client.view.list.full"
        show-brief-id-type="'client'"></list>
</div>

<div ng-show="item.query.virtual_client || item.virtual_client">
  <h1>{{ "VIRTUAL_CLIENT" | translate }}</h1>
  <list data="[item.query.virtual_client || item.virtual_client]"
        columns="config.types.virtual_client.view.list.brief"></list>
</div>

<div ng-show="item.reason.rules.length > 0">
  <h2>{{ "RULES" | translate }}</h2>
  <uib-accordion>
    <table class="table table-striped">
      <thead>
        <tr>
          <th>{{ "RULE" | translate }}</th>
          <th>{{ "MESSAGE" | translate }}</th>
          <th>{{ "SCORE" | translate }}</th>
          <th ng-show="vm.canShowActionColumn()">{{ "ACTION" | translate }}</th>
          <th ng-show="showListEntries">{{ "WHITE_WATCH_LISTS" | translate }}</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="row in item.reason.rules">
          <td><b ng-show = "row.color == 2" class = "swamp">&#10004; </b><b ng-show = "row.color == 1" class = "dark-yellow">&#10004; </b> {{row.Rule}}</td>
          <td>{{row.Message}}</td>
          <td>{{row.Score | number:4}}</td>
          <td ng-show="vm.canShowActionColumn()">
            <!-- <button class="btn btn-default btn-sm" ng-click="vm.actionHamburgers[row.list.id] = !vm.actionHamburgers[row.list.id]"><span class="caret"></span></button> -->
            
              <div uib-accordion-group class="panel-primary" heading="{{ 'ACTION' | translate }}...">
                <div class="marT-3 padL-3 padR-3 text-center">
                  <add-to-list item="item" type="'alert'" matchid = "row.id" is-not-validated="vm.isNotValidated()">
                  </add-to-list>  
                </div>
                <div class="marT-3 padL-3 padR-3 text-center">
                  <button class="btn btn-default btn-sm marT-3 marB-3 text-center" ng-click="vm.addCommentListId(row.id)">{{ 'ADD_COMMENT' | translate }}</button>  
                </div>
              </div>
          </td>
          <td ng-show="showListEntries">
            <dd ng-repeat = "myLink in row.listEntriesTable track by $index">
              <a href = "{{myLink.myurl}}">{{myLink.mycaption}}</a>
            </dd>
          </td>
        </tr>
      </tbody>
    </table>
  </uib-accordion>
</div>

<div ng-show="item.reason.matches.length > 0">
  <h2>{{ "MATCHES" | translate }}</h2>
  <uib-accordion>
    <table class="table table-striped">
      <thead>
        <tr>
          <th ng-repeat="col in config.types.list.view.list.brief" ng-class="col.class ? col.class : ''">{{col.label | translate }}</th>
          <th>{{ "SIMILARITY" | translate }}</th>
          <th ng-show="vm.canShowActionColumn()">{{ "ACTION" | translate }}</th>
          <th ng-show="showListEntries">{{ "WHITE_WATCH_LISTS" | translate }}</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="row in item.reason.matches">
          <td ng-repeat="col in config.types.list.view.list.brief">
            <div ng-if="col.label !== 'ID'">{{row.list[col.field]}}</div>
            <div ng-if="col.label === 'ID'">
               <a ng-href="#/objects/list/{{row.list.id}}" ng-if="!vm.viewMatchInfo"><b ng-show = "row.color == 2" class = "swamp">&#10004; </b><b ng-show = "row.color == 1" class = "dark-yellow">&#10004; </b>{{row.list.id}}</a>
              <a ng-if="vm.viewMatchInfo" ng-click="vm.viewMatchInfo(row.list)" class="no-link-link" title="{{ 'Matched: ' + row.match_version + ', shown: ' + row.list_version }}"><b ng-show = "row.color == 2" class = "swamp">&#10004; </b><b ng-show = "row.color == 1" class = "dark-yellow">&#10004; </b>{{row.list.id}}</a>
            </div>
          </td>
          <td>{{row.Similarity | number:4}}</td>
          <td ng-show="vm.canShowActionColumn()">
            <!-- <button class="btn btn-default btn-sm" ng-click="vm.actionHamburgers[row.list.id] = !vm.actionHamburgers[row.list.id]"><span class="caret"></span></button> -->
            
              <div uib-accordion-group class="panel-primary" heading="{{ 'ACTION' | translate }}...">
                <div class="marT-3 padL-3 padR-3 text-center">
                  <add-to-list item="item" type="'alert'" matchid = "row.list.id" is-not-validated="vm.isNotValidated()">
                  </add-to-list>  
                </div>
                <div class="marT-3 padL-3 padR-3 text-center">
                  <button class="btn btn-default btn-sm marT-3 marB-3 text-center" ng-click="vm.addCommentListId(row.list.id)">{{ 'ADD_COMMENT' | translate }}</button>  
                </div>
              </div>
          </td>
          <td ng-show="showListEntries">
            <dd ng-repeat = "myLink in row.listEntriesTable track by $index">
              <a href = "{{myLink.myurl}}">{{myLink.mycaption}}</a>
            </dd>
          </td>
        </tr>
      </tbody>
    </table>
  </uib-accordion>
</div>

<div ng-if="item.reason.matches.length === 0 && item.reason.rules.length === 0" ng-init="vm.hideAddToList = true;"></div>
