
  <h1>
    {{item.category | translate }} {{ 'ALERT' | translate }} {{item.id}}
  </h1>

  <div class="two-column-view">
    <div class="" ng-if="item.id"><dl class="dl-horizontal"><dt>{{ "ID" | translate }}:</dt><dd><a ng-href="#/All/alert/{{item.id}}">{{item.id}}</a></dd></dl></div>
    <div class="" ng-if="item.Creation_Date"><dl class="dl-horizontal"><dt>{{ "CREATED" | translate }}:</dt><dd>{{item.Creation_Date | parseDate | formatTimestamp}}</dd></dl></div>
    <div class="" ng-if="item.status"><dl class="dl-horizontal"><dt>{{ "STATUS" | translate }}:</dt><dd>{{item.status | translate }}</dd></dl></div>
    <div class="" ng-if="item.payment_status"><dl class="dl-horizontal"><dt>{{ item.subtype === "&lt;payments&gt;" ? "PAYMENT_STATUS" : "RELATIONSHIP_STATUS" | translate }}:</dt><dd>{{item.payment_status | translate }}</dd></dl></div>
    <div class="" ng-if="item.orgClient"><dl class="dl-horizontal"><dt>{{ "ORGCLIENT" | translate }}:</dt><dd>{{item.orgClient}}</dd></dl></div>
    <div class="" ng-if="item.category"><dl class="dl-horizontal"><dt>{{ "CATEGORY" | translate }}:</dt><dd>{{item.category | translate }}</dd></dl></div>
    <div class=""><dl class="dl-horizontal"><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></dl></div>
    <div class="" ng-if="item.user.username"><dl class="dl-horizontal"><dt>{{ "ASSIGNED_TO" | translate }}:</dt><dd>{{item.user.username}}</dd></dl></div>
    <div class="" ng-if="item.Similarity"><dl class="dl-horizontal"><dt>{{ "SIMILARITY" | translate }}:</dt><dd>{{item.Similarity | number:4}}</dd></dl></div>
    <div class="" ng-show='item.listEntries'>
      <dl class="dl-horizontal"><dt>{{ "WHITE_WATCH_LISTS" | translate }}:</dt>
      <dd>{{item.listEntries | parseWatchLists}}</dd></dl>
    </div>
  </div>

  <div ng-if="item.transaction" class="no-text-center">
      <show-transaction data="item.transaction" type="'profiling'" />
  </div>

  <div ng-if="item.datamart" class="no-text-center">
    <show-transaction data="item.datamart" type="'client'" />
  </div>

  <div ng-if="item.behavior" ng-repeat="behavior in item.behavior" class="no-text-center">
    <div class="panel panel-primary"> 
      <div class="panel-body">
          <div class="col-sm-6" ng-if="behavior.ClientType"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.ClientType | translate }} ">{{ "ClientType" | translate }}:</abbr></dt><dd>{{behavior.ClientType}}</dd></dl></div>
          <div class="col-sm-6" ng-if="behavior.ClientNumber"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.ClientNumber | translate }} ">{{ "ClientNumber" | translate }}:</abbr></dt><dd>{{behavior.ClientNumber}}</dd></dl></div>
          <div class="col-sm-6 marB-15" ng-if="behavior.ClusterID"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.ClusterID | translate }} ">{{ "ClusterID" | translate }}:</abbr></dt><dd>{{behavior.ClusterID}}</dd></dl></div>
          <div class="col-sm-6 marB-15" ng-if="behavior.NameMonth"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.NameMonth | translate }} ">{{ "NameMonth" | translate }}:</abbr></dt><dd>{{behavior.NameMonth}}</dd></dl></div>
          <div class="col-sm-6" ng-if="behavior.BHVCluster"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.BHVCluster | translate }} ">{{ "Class" | translate }}:</abbr></dt><dd>{{behavior.BHVCluster}}</dd></dl></div>
          <div class="col-sm-6" ng-if="behavior.prev_BHVCluster"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.prev_BHVCluster | translate }} ">{{ "prev_Class" | translate }}:</abbr></dt><dd>{{behavior.prev_BHVCluster}}</dd></dl></div>
          <div class="col-sm-6" ng-if="behavior.max_day_sum_Amount"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.max_day_sum_Amount | translate }} ">{{ "max_day_sum_Amount" | translate }}:</abbr></dt><dd>{{behavior.max_day_sum_Amount | thousandSeparatorDec}}</dd></dl></div>
          <div class="col-sm-6" ng-if="behavior.prev_max_day_sum_Amount"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.prev_max_day_sum_Amount | translate }} ">{{ "prev_max_day_sum_Amount" | translate }}:</abbr></dt><dd>{{behavior.prev_max_day_sum_Amount | thousandSeparatorDec}}</dd></dl></div>
          <div class="col-sm-6" ng-if="behavior.meantop_W_AmountCHF"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.meantop_W_AmountCHF | translate }} ">{{ "meantop_W_AmountCHF" | translate }}:</abbr></dt><dd>{{behavior.meantop_W_AmountCHF | thousandSeparatorDec}}</dd></dl></div>
          <div class="col-sm-6" ng-if="behavior.max_meantop_W_AmountCHF"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.max_meantop_W_AmountCHF | translate }} ">{{ "max_meantop_W_AmountCHF" | translate }}:</abbr></dt><dd>{{behavior.max_meantop_W_AmountCHF | thousandSeparatorDec}}</dd></dl></div>
          <div class="col-sm-6" ng-if="behavior.N_month_trans"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.N_month_trans | translate }} ">{{ "N_month_trans" | translate }}:</abbr></dt><dd>{{behavior.N_month_trans}}</dd></dl></div>
          <div class="col-sm-6" ng-if="behavior.prev_max_N_month_trans"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.prev_max_N_month_trans | translate }} ">{{ "prev_max_N_month_trans" | translate }}:</abbr></dt><dd>{{behavior.prev_max_N_month_trans}}</dd></dl></div>
          <div class="col-sm-6" ng-if="behavior.Score"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.ClientRisk | translate }} ">{{ "ClientRisk" | translate }}:</abbr></dt><dd>{{behavior.Score}}</dd></dl></div>
      </div>
    </div>
  </div>
  
  <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>
    <table class="table table-hover">
      <thead>
        <tr>
          <th>{{ "RULE" | translate }}</th>
          <th>{{ "MESSAGE" | translate }}</th>
          <th>{{ "SCORE" | translate }}</th>
          <th ng-show="vm.showListEntries">{{ "WHITE_WATCH_LISTS" | translate }}</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="row in item.reason.rules">
          <td>{{row.Rule}}<div ng-if="row.Message.split('~').length > 2"><rule-message message='row.Message' rulenamemode="row.Rule"></rule-message></div></td>
          <td compile="row.Message" ng-if="!(row.Message.split('~').length > 2)"></td>
          <td ng-if="row.Message.split('~').length > 2">
            <rule-message message='row.Message'></rule-message>
          </td>
          <td>{{row.Score | number:4}}</td>
          <td ng-show="vm.showListEntries">
            <div ng-if="row.listEntries" ng-init="vm.showListEntries = true; row.listEntriesTable = vm.parseListEntries(row.listEntries);">
                <dd ng-repeat = "myLink in row.listEntriesTable track by $index">
                  <a href = "{{myLink.myurl}}">{{myLink.mycaption}}</a>
                </dd>
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </div>

  <div ng-show="item.reason.matches.length > 0">
    <h1>{{ "MATCHES" | translate }}</h1>
    <table class="table table-hover">
      <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.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 track by $index">
            <div ng-if="$index != 0 && !row.highlightingData">{{row.list[col.field]}}</div>
            <div ng-if="$index != 0 && row.highlightingData"><span compile="row.list[col.field] | highlight : row.highlightingData:col.field"></span></div>
            <div ng-if="$index == 0">
               <a ng-click="scrollTo('list' + row.list.id)" class="no-link-link"><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.showListEntries">
            <div ng-if="row.listEntries" ng-init="vm.showListEntries = true; row.listEntriesTable = vm.parseListEntries(row.listEntries);">
                <dd ng-repeat = "myLink in row.listEntriesTable track by $index">
                  <a href = "{{myLink.myurl}}">{{myLink.mycaption}}</a>
                </dd>
            </div>
          </td>
        </tr>
      </tbody>
    </table>

    <div ng-repeat="row in item.reason.matches">
      <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>
    </div>
  </div>

  <div ng-show="item.reason.transactions.length > 0">
    <h2>{{ "ALERTS" | translate }}</h2>
    <uib-accordion>
      <table class="table table-hover">
        <thead>
          <tr>
            <th>{{ "ID" | translate }}</th>
            <th>{{ "REASONING" | translate }}</th>
            <th>{{ "MESSAGE" | translate }}</th>
            <th>{{ "SCORE" | translate }}</th>
            <th>{{ "Debit_Credit" | translate }}</th>
            <th>{{ "DT" | translate }}</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="row in item.reason.transactions">
            <td>{{ row.id}}</td>
            <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 compile="row.Message"></td>
            <td>{{row.Score | number:4}}</td>
            <td>{{ row.Debit_Credit}}</td>
            <td>{{ row.DT | parseDateOdata | formatTimestamp}}</td>
          </tr>
        </tbody>
      </table>
    </uib-accordion>
  </div>

  <div ng-show="item.reason.behavior.length > 0">
    <h2>{{ "ALERTS" | translate }}</h2>
    <uib-accordion>
      <table class="table table-hover">
        <thead>
          <tr>
            <th>{{ "REASONING" | translate }}</th>
            <th>{{ "MESSAGE" | translate }}</th>
            <th>{{ "SCORE" | translate }}</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="row in item.reason.behavior">
            <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 compile="row.Message"></td>
            <td>{{row.Score | number:4}}</td>
          </tr>
        </tbody>
      </table>
    </uib-accordion>
  </div>

  <h3>{{ 'COMMENTS' | translate }}</h3>
  <comments-list comments="item.comments"
                 category="'comment'"></comments-list>
