<div ng-if="vm.islist">
<!--   <div class="row padB-3">
    <div class="col-sm-2 col-sm-offset-4 marR-2 row"><button class="btn btn-primary col-sm-12 glyphicon glyphicon-circle-arrow-up" ng-click="vm.prevAlert()"></button></div>
    <div class="col-sm-2 marL-2 row"><button class="btn btn-primary col-sm-12 glyphicon glyphicon-circle-arrow-down mar" ng-click="vm.nextAlert()"></button></div>
  </div> -->
  <h1>
    <a ng-href="#/{{item.category}}/alert/{{item.id}}" ng-click="vm.okOnModal()"><b ng-show = "item.color == 2" class = "swamp">&#10004; </b><b ng-show = "item.color == 1" class = "dark-yellow">&#10004; </b>{{item.id}}</a>
    <button ng-show='item.query.virtual_client.id' ng-click="vm.openPrintWindow(item)" class="btn btn-default btn-sm glyphicon glyphicon-list-alt"></button> 
    <button ng-show='item.client.id' ng-click="vm.openPrintWindowBatch(item)" class="btn btn-default btn-sm glyphicon glyphicon-list-alt"></button>
    <status-assign item="item"
                   type="'alert'"
                   aux="vm"
                   is-not-validated="vm.isNotValidated()"></status-assign>
    <button class="btn btn-danger btn-sm"
            ng-show="vm.isAvailableToInvestigate()"
            ng-click="vm.createProcess()"
            ng-disabled="vm.currentUser === undefined || config === undefined">{{ 'INVESTIGATE' | translate }}</button>
    <add-to-list ng-show = "item.reason.matches.length > 0 || item.reason.rules.length > 0"
                 item="item"
                 type="'alert'"
                 aux="vm"
                 matchid = "item.reason.matches[vm.currentmatch].list.id || item.reason.rules[vm.currentmatchrule].id"
                 is-not-validated="vm.isNotValidated()"></add-to-list>
    <button class="btn btn-primary btn-sm"
                ng-click="vm.addCommentBaloon()" ng-disabled="vm.islist && vm.currentUser === undefined">{{ 'ADD_COMMENT' | translate }}</button>

  </h1>
</div>

<uib-tabset> 
  <uib-tab heading="{{'SUMMARY' | translate}}" ng-if="item.reason.matches.length > 0">
    <div ng-show="item.reason.matches.length > 0">
      <h1>{{ "MATCHES" | translate }}</h1>

      <uib-carousel active="vm.currentmatch" no-wrap="true">
        <uib-slide ng-repeat="row in item.reason.matches track by row.list.id" index="$index" class="no-text-center">
           <embed-item item="{list: row.list, client: item.query.client || item.client, virtual_client : item.query.virtual_client || item.virtual_client, uclient: item.query.client || item.client || item.query.virtual_client || item.virtual_client, color: row.color}" item-type="list" view-template="config.types.list.view.clientdetails"></embed-item>
        </uib-slide>
      </uib-carousel> 
    </div>
    <div ng-show="item.reason.rules.length > 0">
      <h2>{{ "RULES" | translate }}</h2>
      <table class="table table-striped">
        <thead>
          <tr>
            <th>{{ "RULE" | translate }}</th>
            <th>{{ "MESSAGE" | translate }}</th>
            <th>{{ "SCORE" | 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>
          </tr>
        </tbody>
      </table>
    </div>
  </uib-tab>
  <uib-tab heading="{{'DETAILS' | translate}}" ng-if="item">
    <div ng-show="item.query.client || item.client">
      <h1>{{ "CLIENT" | translate }}</h1>
     <embed-item item="item.query.client || item.client" item-type="'client'" view-template="config.types.client.view.details"></embed-item>
    </div>


    <div ng-show="item.query.virtual_client || item.virtual_client">
      <h1>{{ "VIRTUAL_CLIENT" | translate }}</h1>
     <embed-item item="item.query.virtual_client || item.virtual_client" item-type="'virtual_client'" view-template="config.types.virtual_client.view.details"></embed-item>
    </div>

    <div ng-show="item.reason.rules.length > 0">
      <h2>{{ "RULES" | translate }}</h2>
      <uib-carousel active="vm.currentmatchrule" no-wrap="true">
        <uib-slide ng-repeat="row in item.reason.rules track by $index" index="$index" class="no-text-center">
          <dl class="dl-horizontal">
            <div class="col-sm-6"><dt>{{ "RULE" | translate }}:</dt><dd><b ng-show = "row.color == 2" class = "swamp">&#10004; </b><b ng-show = "row.color == 1" class = "dark-yellow">&#10004; </b> {{row.Rule}}</dd></div>
            <div class="col-sm-6"><dt>{{ "MESSAGE" | translate }}:</dt><dd>{{row.Message}}</dd></div>
            <div class="col-sm-6"><dt>{{ "SCORE" | translate }}:</dt><dd>{{row.Score}}</dd></div>
          </dl>
        </uib-slide>
      </uib-carousel>

    </div>

    <div ng-show="item.reason.matches.length > 0">
      <h1>{{ "MATCHES" | translate }}</h1>
      <!-- <uib-carousel active="currentmatch" no-wrap="false" template-url="config/my_carousel.html"> -->
      <uib-carousel active="vm.currentmatch" no-wrap="true">
        <uib-slide ng-repeat="row in item.reason.matches track by row.list.id" index="$index" class="no-text-center">
            <h2 id="list{{row.list.id}}">{{ "LIST" | translate }} {{row.list.id}} <b ng-show = "row.color == 2" class = "swamp">&#10004; </b><b ng-show = "row.color == 1" class = "dark-yellow">&#10004; </b></h2>
            <embed-item item="row.list" item-type="list" view-template="config.types.list.view.details"></embed-item>
        </uib-slide>
      </uib-carousel>
    </div>

  </uib-tab>
</uib-tabset>

<div class="padT-3">
  <h3>{{ 'ALERT' | translate }}</h3>
  <div class="row  padB-9">
    <dl class="dl-horizontal">
      <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> -->
    </dl>
  </div>

  <hr />

  <div class="row  padB-9">
    <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>
    </dl>
  </div>

  <div ng-if="vm.list_id_comments.length + vm.list_id_other_comments.length > 0">
    <h3>{{ 'COMMENTS' | translate }}</h3>
    <comments-list comments="vm.all_list_id_comments"
                   category="'comment'"></comments-list>  
  </div>


  <div class="text-center">
    <status-assign item="item"
                   type="'alert'"
                   aux="vm"
                   is-not-validated="vm.isNotValidated()"></status-assign>
    <button class="btn btn-danger btn-sm"
            ng-show="vm.isAvailableToInvestigate()"
            ng-click="vm.createProcess()"
            ng-disabled="vm.currentUser === undefined || config === undefined">{{ 'INVESTIGATE' | translate }}</button>
    <add-to-list ng-show = "item.reason.matches.length > 0 || item.reason.rules.length > 0"
                 item="item"
                 type="'alert'"
                 aux="vm"
                 matchid = "item.reason.matches[vm.currentmatch].list.id || item.reason.rules[vm.currentmatchrule].id"
                 is-not-validated="vm.isNotValidated()"></add-to-list>
    <button class="btn btn-primary btn-sm"
                ng-click="vm.addCommentBaloon()" ng-disabled="vm.islist && vm.currentUser === undefined">{{ 'ADD_COMMENT' | translate }}</button>
  </div>
<!--   <div class="row padB-3">
    <div class="col-sm-2 col-sm-offset-4 marR-2 row"><button class="btn btn-primary col-sm-12 glyphicon glyphicon-circle-arrow-up" ng-click="vm.prevAlert()"></button></div>
    <div class="col-sm-2 marL-2 row"><button class="btn btn-primary col-sm-12 glyphicon glyphicon-circle-arrow-down mar" ng-click="vm.nextAlert()"></button></div>
  </div> -->
</div>
