<div class="form-group">
  <label for="id"
         class="col-sm-1 control-label">{{ "ID" | translate }}:</label>
  <div class="col-sm-2">
    <input id="id"
           class="form-control"
           type="text"
           ng-model="filter.fuzzy_id"/>
    <div class="padR-5 padL-0" ng-if="config.general.factiva">
      <checkboxes items="['EMPLOYEE_ALERT']"
                ng-model="filter.employee_alert"></checkboxes>
    </div>
  </div>

  <div ng-show="vm.currentUser.role !== 'user'">
    <label for="user"
           class="col-sm-1 control-label">{{ "USER" | translate }}:</label>
    <div class="col-sm-2">
      <abbr  class="hide-abbr" title="{{'AS_OWNER' | translate}}">
          <input type="checkbox" style="float: left; margin-top: 10px !important;" ng-model="pseudoFilter.strict_username">
      </abbr>
      <div style="overflow: hidden;">
        <input id="user"
               class="form-control"
               type="text"
               ng-model="pseudoFilter.username"/>
      </div>
    </div>
  </div>
  
  <label class="col-md-1 control-label">{{ "STATUS" | translate }}:</label>
  <div class="col-sm-5"
       ng-init="vm.detectShowAdvanced()">
    <checkboxes items="vm.statuses"
      ng-model="filter.status"
      ng-if="vm.currentUser"
      ng-init="vm.setupStatusFilterAlert()"
      labels="vm.statusesLabels"></checkboxes>
    <a ng-click="showAdvanced = !showAdvanced"
       class="pull-right checkbox-inline">{{ showAdvanced ? 'LESS_FILTERS' : 'MORE_FILTERS' | translate }}</a>
  </div>
</div>

<div ng-show="showAdvanced">
  <div class="form-group">
    <label for="text"
           class="col-sm-1 control-label">{{ "TEXT" | translate }}:</label>
    <div ng-class="(config.types.alert.f_customer_nr || config.types.alert.f_customer_nr_or_id) ? 'col-sm-2' : 'col-sm-5'" ng-hide="filter.category === 'profiling' || filter.category === 'behavioral'">
      <input id="text"
             class="form-control"
             type="text"
             ng-model="filter.text"
             ng-disabled="!(filter.category === 'batch' || filter.category === 'online')"/>
    </div>
    <div ng-class="(config.types.alert.f_customer_nr || config.types.alert.f_customer_nr_or_id) ? 'col-sm-2' : 'col-sm-5'" ng-hide="!(filter.category === 'profiling' || filter.category === 'behavioral')">
      <input id="text"
             class="form-control"
             type="text"
             ng-model="filter.text_profiling_behavioral"/>
    </div>
    <label class="col-sm-1 control-label" ng-if="config.types.alert.f_customer_nr">{{ "F_CUSTOMER_NR" | translate }}:</label>
    <div class="col-sm-2" ng-if="config.types.alert.f_customer_nr">
      <input id="text"
             class="form-control"
             type="text"
             ng-model="filter.f_customer_nr"/>
    </div>
    <label class="col-sm-1 control-label" ng-if="config.types.alert.f_customer_nr_or_id">{{ "F_CUSTOMER_ID" | translate }}:</label>
    <div class="col-sm-2" ng-if="config.types.alert.f_customer_nr_or_id">
      <input id="text"
             class="form-control"
             type="text"
             ng-model="filter.f_customer_nr_or_id"/>
    </div>
    <label class="col-sm-1 control-label">{{ "DATES" | translate }}:</label>
    <div class="col-sm-5">
      <dates-from-to data="filter.Creation_Date"></dates-from-to>
    </div>
  </div>

  <div class="form-group" ng-if="config.general.factiva" ng-hide="!(filter.category === 'batch' || filter.category === 'online')">
    <label for="list"
           class="col-sm-1 control-label">{{ "List category 1" | translate }}:</label>
    <div class="col-sm-2">
      <select id="list"
              ng-model="filter['reason.matches[*].list.ListType']"
              class="form-control"
              ng-if="!config.general.alertsListTypeMultiple && vm.alertsListType"
              ng-init="vm.recheckJoinedChoice('reason.matches[*].list.ListType', vm.alertsListType)"
              ng-disabled="!(filter.category === 'batch' || filter.category === 'online')">
              <option ng-repeat="list in vm.alertsListType" ng-value="list">{{ list | firstElement | translate }}</option>
      </select>
      <select2 multiple
               ng-if="config.general.alertsListTypeMultiple && (filter.category === 'batch' || filter.category === 'online') && config.general.alertsListType"
               ng-model="filter['reason.matches[*].list.ListType']"
               s2-options="list as listTypeFilterFormatter(list) for list in config.general.alertsListType"
               options="{ separator : '\n\n\n\n\n' }">
      </select2>
      <select class="form-control" ng-if="config.general.alertsListTypeMultiple && !(filter.category === 'batch' || filter.category === 'online') && config.general.alertsListType" ng-disabled="true">
      </select>
    </div>
    <label for="list"
           class="col-sm-1 control-label">{{ "List category 2" | translate }}:</label>
    <div class="col-sm-2">
      <select id="list"
              ng-model="filter['reason.matches[*].list.List']"
              class="form-control"
              ng-if="!config.general.alertsListMultiple"
              ng-disabled="!(filter.category === 'batch' || filter.category === 'online')">
              <option ng-repeat="list in [''].concat(config.general.alertsList)" ng-value="list">{{ vm.alertsListHumanName && vm.alertsListHumanName[list] ? vm.alertsListHumanName[list] : list }}</option>
      </select>
      <select2 multiple
         ng-if="config.general.alertsListMultiple && (filter.category === 'batch' || filter.category === 'online') && config.general.alertsList"
         ng-model="filter['reason.matches[*].list.List']"
         s2-options="list as listFilterFormatter(list) for list in config.general.alertsList"
         options="{ separator : '\n\n\n\n\n' }">
      </select2>
      <select class="form-control" ng-if="config.general.alertsListMultiple && !(filter.category === 'batch' || filter.category === 'online') && config.general.alertsList" ng-disabled="true">
      </select>
    </div>

    <label class="col-sm-1 control-label">{{ "Official list" | translate }}:</label>
    <div class="col-sm-5" ng-if="config.general.factiva">
      <select2 multiple
               ng-if="(filter.category === 'batch' || filter.category === 'online')"
               ng-model="filter['official_list']"
               s2-options="list as list for list in config.general.sanctionReferencesList"
               options="{ separator : '\n\n\n\n\n' }">
      </select2>
      <select class="form-control" ng-if="!(filter.category === 'batch' || filter.category === 'online')" ng-disabled="true">
      </select>
    </div>
  </div>

  <div class="form-group">
    <label for="similarity"
           class="col-sm-1 control-label">{{ "MIN_SIM" | translate }}:</label>
    <div class="col-sm-2">
      <input id="similarity"
             class="form-control"
             type="number"
             min=0
             max=1
             step=0.001
             ng-model="pseudoFilter.Similarity"
             ng-change="pseudoFilter.Similarity ? filter.Similarity='' + pseudoFilter.Similarity + ':' : filter.Similarity=undefined"/>
    </div>
    <label for="list"
           class="col-sm-1 control-label"
            ng-if="!config.general.factiva && !config.general.wuestenrot">{{ "LIST" | translate }}:</label>
    <div class="col-sm-2" ng-if="!config.general.factiva && !config.general.wuestenrot">
      <select id="list"
              ng-model="filter['reason.matches[*].list.List']"
              class="form-control"
              ng-if="!config.general.alertsListMultiple"
              ng-disabled="!(filter.category === 'batch' || filter.category === 'online')">
              <option ng-repeat="list in [''].concat(config.general.alertsList)" ng-value="list">{{ vm.alertsListHumanName && vm.alertsListHumanName[list] ? + '[' + list + '] ' + vm.alertsListHumanName[list] : list }}</option>
      </select>
      <select2 multiple
         ng-if="config.general.alertsListMultiple && (filter.category === 'batch' || filter.category === 'online') && config.general.alertsList"
         ng-model="filter['reason.matches[*].list.List']"
         s2-options="list as listFilterFormatter(list) for list in config.general.alertsList"
         options="{ separator : '\n\n\n\n\n' }">
      </select2>
      <select class="form-control" ng-if="config.general.alertsListMultiple && !(filter.category === 'batch' || filter.category === 'online') && config.general.alertsList" ng-disabled="true">
      </select>
    </div>
    <label for="list"
           class="col-sm-1 control-label"
            ng-if="config.general.wuestenrot || config.general.factiva">{{ "RULES_TYPE" | translate }}:</label>
    <div class="col-sm-2" ng-if="config.general.wuestenrot || config.general.factiva">
      <select2 multiple
               ng-if="config.general.rulesTypeList && (filter.category === 'profiling' || filter.category === 'online')"
               ng-model="filter['rulesType']"
               s2-options="x.code as translate(x.description) for x in config.general.rulesTypeList"
               options="{ separator : '\n\n\n\n\n' }">
      </select2>
      <select class="form-control" ng-if="config.general.rulesTypeList && !(filter.category === 'profiling' || filter.category === 'online')" ng-disabled="true">
      </select>
    </div>

    <label for="list"
           class="col-sm-1 control-label"
            ng-if="!config.general.factiva">{{ "TYPE_OF_LIST" | translate }}:</label>
    <div class="col-sm-2"  ng-if="!config.general.factiva">
      <select id="list"
              ng-model="filter['reason.matches[*].list.ListType']"
              class="form-control"
              ng-if="!config.general.alertsListTypeMultiple && vm.alertsListType"
              ng-disabled="!(filter.category === 'batch' || filter.category === 'online')"
              ng-init="vm.recheckJoinedChoice('reason.matches[*].list.ListType', vm.alertsListType)">
              <option ng-repeat="list in vm.alertsListType" ng-value="list">{{ list | firstElement | translate }}</option>
      </select>
      <select2 multiple
               ng-if="config.general.alertsListTypeMultiple && (filter.category === 'batch' || filter.category === 'online') && config.general.alertsListType"
               ng-model="filter['reason.matches[*].list.ListType']"
               s2-options="list as listTypeFilterFormatter(list) for list in config.general.alertsListType"
               options="{ separator : '\n\n\n\n\n' }">
      </select2>
      <select class="form-control" ng-if="config.general.alertsListTypeMultiple && !(filter.category === 'batch' || filter.category === 'online') && config.general.alertsListType" ng-disabled="true">
      </select>
    </div>
    <label for="list"
           class="col-sm-1 control-label">{{ "WHITE_W_LIST" | translate }}:</label>
    <div class="col-sm-2">
      <select id="list"
              ng-model="filter['listEntry']"
              class="form-control"
              ng-disabled="!(filter.category === 'batch' || filter.category === 'online')">
              <option ng-repeat="list in [''].concat(config.general.lists)" value="{{list}}">{{ list | translate }}</option>
      </select>
    </div>
    <label for="list"
           class="col-sm-1 control-label" ng-if="config.general.factiva">{{ "KEYWORD" | translate }}:</label>
    <div class="col-sm-2" ng-if="config.general.factiva && !config.general.factivaKeywordsList">
      <select2 multiple
         ng-model="filter['keywords']"
         options="{ tags: [] , separator : '; ' }"
         ng-disabled="!(filter.category === 'online' || filter.category === 'batch')">
      </select2>
    </div>
    <div class="col-sm-2" ng-if="config.general.factiva && config.general.factivaKeywordsList">
      <select2 multiple
         ng-model="filter['keywords']"
         options="{ tags: config.general.factivaKeywordsList, separator : '; ', matcher: keywordMatch }"
         ng-disabled="!(filter.category === 'online' || filter.category === 'batch')">
      </select2>
    </div>
  </div>
  <div class="form-group" ng-if="config.general.factiva && (filter.category === 'batch' || filter.category === 'online')">
    <label for="list"
       class="col-sm-1 control-label">{{ "COUNTRY" | translate }}:</label>
    <div class="col-sm-5">
      <!-- <select id="list"
              ng-model="filter['country']"
              class="form-control"
              ng-disabled="!(filter.category === 'batch' || filter.category === 'online')">
              <option value="{{null}}"></option>
              <option ng-repeat="x in config.general.countryList" value="{{x.code}}">{{ x.description }} ({{ x.code }})</option>
      </select> -->

      <select2 multiple
               ng-if="config.general.countryList"
               ng-model="filter['country']"
               s2-options="x.code as countryFormatter(x) for x in countryListFilter(config.general.countryList)"
               options="{ separator : '\n\n\n\n\n' }">
      </select2>
    </div>
    <label for="list"
       class="col-sm-1 control-label"
       ng-init="vm.detectPrimaryOccFlag()">{{ "OCC_CAT" | translate }}:</label>
    <div class="col-sm-4" ng-if="!vm.primary_occ[0]">
      <select2 multiple
               ng-if="config.general.factivaRolesList"
               ng-model="filter['roles']"
               s2-options="x.code as x.description for x in config.general.factivaRolesList"
               options="{ separator : '\n\n\n\n\n' }">
      </select2>
    </div>
    <div class="col-sm-4" ng-if="vm.primary_occ[0]">
      <select2 multiple
               ng-if="config.general.factivaRolesList"
               ng-model="filter['roles']"
               s2-options="x.primary_code as x.description for x in config.general.factivaRolesList"
               options="{ separator : '\n\n\n\n\n' }">
      </select2>
    </div>
    <div class="col-sm-1 padR-5 padL-0">
      <checkboxes items="['PRIMARY_OCC']"
                ng-model="vm.primary_occ"></checkboxes>
    </div>
  </div>
  <label for="text"
         ng-if="config.general.ProductCode_cd"
          class="col-sm-1 control-label">{{ "Product ID" | translate }}:</label>
    <div class="col-sm-2" ng-if="config.general.ProductCode_cd">
      <select2 multiple
      ng-model="filter['ProductCode_cd']"
      s2-options="val.key as ('[' + val.key + '] ' + val.value) for val in vm.ProductCode_cd_translated"
      ng-init="vm.translateProductCodeCd()"></select2>
    </div>
</div>