<table class="table">
  <tr>
    <!--
      Первая колонка используется также для значков коллапсирования, поэтому её ширина фиксирована
      (чтобы значок не убегал из-под курсора в момент коллапсирования блока из-за перераспределения размеров колонок)
    -->
    <th style="width: 66px;" translate translate-comment="(заголовок столбца 'номер шлейфа')">Номер</th>
    <th></th>
    <th translate>Тип</th>
    <th translate translate-comment="(заголовок столбца 'норма шлейфа')">Норма</th>
    <th ng-if="showResistors()" translate>Резисторы</th>
    <th translate>Задержка на вход</th>
    <th translate>Задержка на выход</th>
    <!--
      Последняя колонка используется для всяких иконок типа корзины и "(i)"
    -->
    <th></th>
  </tr>


  <tbody ng-if="zonesMap().ownWiredZonesIndices.length > 0"
         class="zones-section-head">
    <tr>
      <td style="vertical-align: middle;">
        <div ng-class="isExpanded('OWN_WIRED_ZONES') ? 'triangle-down' : 'triangle-right'"
             ng-click="toggleExpanded('OWN_WIRED_ZONES')"
             style="margin: auto;">
        </div>
      </td>
      <td colspan="11">
        <div style="font-weight: bold;" translate>Шлейфы на приборе</div>
      </td>
    </tr>
  </tbody>
  <tbody ng-repeat="ind in zonesMap().ownWiredZonesIndices"
         augeas-replace-with-template="augeas/templates/nord/zone.html"
         class="no-border no-row-border"
         ng-show="isExpanded('OWN_WIRED_ZONES')">
  </tbody>


  <tbody ng-if="rpsh8Able() && rpsh12.rpsh12_status() == 'not_configured'"
         class="zones-section-head">
    <tr>
      <td style="vertical-align: middle;">
        <div ng-show="security().extend_zone_enabled"
             ng-class="isExpanded('RPSH8_ZONES') ? 'triangle-down' : 'triangle-right'"
             ng-click="toggleExpanded('RPSH8_ZONES')"
             style="margin: auto;">
        </div>
      </td>
      <td colspan="11">
        <div class="checkbox">
          <label class="control-label" style="font-weight: bold;">
            <input type="checkbox"
                   ng-model="security().extend_zone_enabled"
                   ng-change="updateRPSH12Ticker()">
            <translate>Расширитель РПШ‐8</translate>
          </label>
        </div>
      </td>
    </tr>
  </tbody>
  <tbody ng-if="rpsh8Able() && rpsh12.rpsh12_status() == 'not_configured'"
         ng-repeat="ind in zonesMap().rpsh8ZonesIndices"
         augeas-replace-with-template="augeas/templates/nord/zone.html"
         class="no-border no-row-border"
         ng-show="isExpanded('RPSH8_ZONES')">
  </tbody>


  <tbody ng-if="rpsh12Able() && rpsh12.rpsh12_status() != 'not_configured'"
         class="zones-section-head">
    <tr>
      <td style="vertical-align: middle;">
        <div ng-class="isExpanded('RPSH12_ZONES') ? 'triangle-down' : 'triangle-right'"
             ng-click="toggleExpanded('RPSH12_ZONES')"
             style="margin: auto;">
        </div>
      </td>
      <td colspan="11">
        <span style="font-weight: bold;">
          <span translate>Расширитель РПШ‐12</span>
          <span style="margin-left: 10px;">{[ rpsh12.rpsh12().id ]}</span>
        </span>
        <span style="margin-left: 20px;">
          <span ng-show="rpsh12.rpsh12_status() != 'not_connected'" translate>есть связь</span>
          <span ng-show="rpsh12.rpsh12_status() == 'not_connected'" class="text-danger" translate>нет связи</span>
        </span>
        <span class="pull-right">
          <a href="" ng-click="show_rpsh12_help()" >
            <img ng-src="{[ '/images/glyph-info.svg' | augeasStatic ]}"/>
          </a>
          <a href="" ng-show="rpsh12.rpsh12_status() == 'not_connected'"
                     ng-click="delete_rpsh12()"
                     style="margin-left: 20px;">
            <img ng-src="{[ '/images/glyph-delete.svg' | augeasStatic ]}"/>
          </a>
        </span>
      </td>
    </tr>
  </tbody>
  <tbody ng-if="rpsh12Able()"
         ng-repeat="ind in zonesMap().rpsh12ZonesIndices"
         augeas-replace-with-template="augeas/templates/nord/zone.html"
         class="no-border no-row-border"
         ng-show="isExpanded('RPSH12_ZONES')">
  </tbody>

  <tbody class="zones-section-head"
         augeas-replace-with-template="augeas/templates/partials/ex81.html"
         ng-repeat-start="dev in ex81 track by dev.id">
  </tbody>
  <tbody ng-repeat="ind in getEx81ZoneIndices(dev.ex81Index)"
         augeas-replace-with-template="augeas/templates/nord/zone.html"
         class="no-border no-row-border"
         ng-if="availableEx81(dev.ex81Index)"
         ng-show="isExpanded('EX81_' + dev.ex81Index)">
  </tbody>
  <tbody ng-repeat-end></tbody>

  <tbody class="zones-section-head"
         augeas-replace-with-template="augeas/templates/partials/wired_temperature_sensors.html">
  </tbody>

  <tbody class="zones-section-head"
         augeas-replace-with-template="augeas/templates/partials/nordbusKeyboard.html"
         ng-repeat="dev in nordbusKeyboards track by dev.id">
  </tbody>

</table>

<div ng-if="canSwitchNordbus" class="alert alert-info">
  <span ng-show="!isNordbusEnabled()">
    <button class="btn btn-info"
            ng-disabled="preventNordbusSlavesChanges"
            ng-click="switchNorbusOn()">
      Включить NordBus
    </button>
  </span>
  <span ng-show="isNordbusEnabled()">
    <button class="btn btn-info"
            ng-disabled="preventNordbusSlavesChanges"
            ng-click="switchNorbusOff()">
      Выключить NordBus
    </button>
  </span>
  <span class="pull-right">
    <translate>
    Примечание: расширители NB-EX81 и адресный режим клавиатур работают только в NordBus
    </translate>
  </span>
</div>
