<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>{{ vm.config.general.factiva ? "OWNER" : "ASSIGNED_TO" | translate }}:</dt><dd>{{item.user.username}}</dd></dl></div>
  <div class="" ng-if="item.assignee.username"><dl class="dl-horizontal"><dt>{{ "ASSIGNEE" | translate }}:</dt><dd>{{item.assignee.username}}</dd></dl></div>
  <div class="" ng-if="item.employee_alert !== undefined"><dl class="dl-horizontal"><dt>{{ "CUSTOMER_IS_EMPLOYEE" | translate }}:</dt><dd>{{ item.employee_alert ? 'YES' : 'NO' | translate }}</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 && item.transaction.F_CUSTOMER_ID" class="no-text-center">
    <show-transaction data="item.transaction" type="'profiling'" />
</div>

<div ng-if="item.datamart && item.datamart.F_CUSTOMER_ID" class="no-text-center">
    <show-transaction data="item.datamart" type="'client'" additional-info="{ ALERT_CREATION_DATE: (item.Creation_Date | parseDate) }" />
</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 && !vm.openFafMbdata"><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" ng-if="behavior.ClientNumber && vm.openFafMbdata"><dl class="dl-horizontal"><dt><abbr class="hide-abbr" title="{{ config.hints.ClientNumber | translate }} ">{{ "ClientNumber" | translate }}:</abbr></dt><dd><a ng-click="vm.openFafMbdata('F_CUSTOMER_ID', behavior.ClientNumber, behavior.userbk_nr, null, behavior)" class="no-link-link">{{behavior.ClientNumber}}</a></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-if="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-if="(item.query.virtual_client || item.virtual_client) && (item.virtual_client.id || item.query.virtual_client.id)">
  <h1>{{ "VIRTUAL_CLIENT" | translate }}</h1>
  <list data="[item.query.virtual_client || item.virtual_client]"
        columns="config.types.virtual_client.view.list[item.subtype] || (config.types.virtual_client.view.list.alert || config.types.virtual_client.view.list.brief)"
        show-brief-id-type="'virtual_client'"></list>
</div>

<div ng-show="item.reason.rules.length > 0">
  <h2>{{ "RULES" | translate }}</h2>
  <uib-accordion>
    <table class="table table-hover">
      <thead>
        <tr>
          <th>{{ "RULE" | translate }}</th>
          <th>{{ "MESSAGE" | translate }}</th>
          <th>{{ "SCORE" | translate }}</th>
          <th ng-show="config.general.individualMatchMode && vm.addCommentListId">{{ "STATUS" | translate }}</th>
          <th ng-show="vm.canShowActionColumn()">{{ "ACTION" | translate }}</th>
          <th ng-show="vm.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}}<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="config.general.individualMatchMode && vm.addCommentListId">
            <span ng-dblclick="vm.addCommentListId(row.id, row.match_status !== 'Open')"  style="-ms-user-select: none; user-select: none;" ng-show="row.match_status">
                <i class="material-icons mini-icon"
                      ng-class="{
                        'red':           row.match_status === 'Open',
                        'pink':         row.match_status === 'Assigned',
                        'dark-yellow':   row.match_status.startsWith('In process'),
                        'green-crossed': row.match_status === 'Closed',
                        'black': row.match_status.startsWith('Blocked')}">flag</i>
                <span ng-class="{
                        'red':           row.match_status === 'Open',
                        'dark-pink':         row.match_status === 'Assigned',
                        'darker-yellow':   row.match_status.startsWith('In process'),
                        'green-crossed': row.match_status === 'Closed',
                        'black': row.match_status.startsWith('Blocked')}">{{ row.match_status | translate }}
                </span>
            </span>
          </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()" ng-if="row.id !== undefined" disabled="vm.isUnlockedWhenClosed && !vm.isUnlockedWhenClosed()">
                  </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, false)" ng-disabled="vm.isUnlockedWhenClosed && !vm.isUnlockedWhenClosed()">{{ 'ADD_COMMENT' | translate }}</button>
                </div>
                <div ng-if="config.general.individualMatchMode" class="text-center marB-5">
                    <status-assign item="item"
                     type="'alert'"
                     is-not-validated="vm.isNotValidated()"
                     match-mode="row.id"
                     ng-if="row.id !== undefined"></status-assign>
                </div>
              </div>
          </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>
  </uib-accordion>
</div>

<div ng-show="item.reason.matches.length > 0">
  <h2>{{ "MATCHES" | translate }}</h2>
  <uib-accordion>
    <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="config.general.individualMatchMode && vm.addCommentListId">{{ "STATUS" | translate }}</th>
          <th ng-show="vm.canShowActionColumn()">{{ "ACTION" | translate }}</th>
          <th ng-show="vm.showListEntries">{{ "WHITE_WATCH_LISTS" | translate }}</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="row in item.reason.matches" ng-class="row.list.id == vm.match_to_highlight ? 'danger' : '' ">
          <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-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="config.general.individualMatchMode && vm.addCommentListId">
            <span ng-dblclick="vm.addCommentListId(row.id, row.match_status !== 'Open')"  style="-ms-user-select: none; user-select: none;" ng-show="row.match_status">
                <i class="material-icons mini-icon"
                      ng-class="{
                        'red':           row.match_status === 'Open',
                        'pink':         row.match_status === 'Assigned',
                        'dark-yellow':   row.match_status.startsWith('In process'),
                        'green-crossed': row.match_status === 'Closed',
                        'black': row.match_status.startsWith('Blocked')}">flag</i>
                <span ng-class="{
                        'red':           row.match_status === 'Open',
                        'dark-pink':         row.match_status === 'Assigned',
                        'darker-yellow':   row.match_status.startsWith('In process'),
                        'green-crossed': row.match_status === 'Closed',
                        'black': row.match_status.startsWith('Blocked')}">{{ row.match_status | translate }}
                </span>
            </span>
          </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()" disabled="vm.isUnlockedWhenClosed && !vm.isUnlockedWhenClosed()">
                  </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, false)" ng-disabled="vm.isUnlockedWhenClosed && !vm.isUnlockedWhenClosed()">{{ 'ADD_COMMENT' | translate }}</button>
                </div>
                <div class="marT-3 padL-3 padR-3 text-center" ng-if="vm.itemId">
                  <button class="btn btn-default btn-sm marT-3 marB-3 text-center" ng-click="vm.addToMediaSearch(row.list.id)">{{ 'ADD_MATCH_MEDIA_SEARCH' | translate }}</button>
                </div>
                <div ng-if="config.general.individualMatchMode" class="text-center marB-5">
                    <status-assign item="item"
                     type="'alert'"
                     is-not-validated="vm.isNotValidated()"
                     match-mode="row.id"></status-assign>
                </div>
              </div>

          </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>
  </uib-accordion>
</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>
          <th ng-show="vm.canShowActionColumn()">{{ "ACTION" | translate }}</th>
          <th ng-show="vm.showListEntries">{{ "WHITE_WATCH_LISTS" | translate }}</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="row in item.reason.transactions track by $index">
          <td>{{ row.inner_alert_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>
          <td ng-show="vm.canShowActionColumn()">
            <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()" ng-if="row.id !== undefined" disabled="vm.isUnlockedWhenClosed && !vm.isUnlockedWhenClosed()">
                </add-to-list>
              </div>
            </div>
          </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>
  </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 | ruleName}}</td>
          <td compile="row.Message"></td>
          <td>{{row.Score | number:4}}</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>
