{% load i18n %}
<div ng-controller="alarmNotificationFieldController as ctrl" ng-init="ctrl.init('{{ data }}')">

    <div ng-if="ctrl.empty">
        {% trans 'No notifications available.' %} (<a href="{% url 'horizon:monitoring:notifications:index' %}">{% trans 'Add' %}</a>)
    </div>

    <table ng-if="ctrl.list.length" class="table table-condensed" id="notification_table">
        <thead>
            <tr>
                <th class="name">{% trans 'Name' %}</th>
                <th class="type">{% trans 'Type' %}</th>
                <th class="address">{% trans 'Address' %}</th>
                <th class="alarm">{% trans 'Alarm' %}</th>
                <th class="ok">{% trans 'OK' %}</th>
                <th class="undetermined">{% trans 'Undetermined' %}</th>
                <th>&nbsp;</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="notify in ctrl.list">
                <td class="name">{$ notify.name $}</td>
                <td class="type">{$ notify.type $}</td>
                <td class="address">{$ notify.address $}</td>
                <td class="alarm">
                    <input type="checkbox" ng-model="notify.alarm">
                    <input type="hidden" name="alarm_actions" value="{$ notify.id $}" ng-if="notify.alarm"/>
                </td>
                <td class="ok">
                    <input type="checkbox" ng-model="notify.ok">
                    <input type="hidden" name="ok_actions" value="{$ notify.id $}" ng-if="notify.ok"/>
                </td>
                <td class="undetermined">
                    <input type="checkbox" ng-model="notify.undetermined" ng-disabled="ctrl.isDeterministic">
                    <input type="hidden" name="undetermined_actions" value="{$ notify.id $}" ng-if="notify.undetermined"/>
                </td>
                <td>
                    <a href="#" title="{% trans 'Remove' %}" ng-click="ctrl.remove(notify.id)">X</a>
                </td>
            </tr>
        </tbody>
    </table>

    <div ng-if="ctrl.select.options.length">
        <select ng-model="ctrl.select.model" ng-options="item.id as item.label for item in ctrl.select.options">
            <option value="">{% trans "Select Notification" %}</option>
        </select>
        <a href="#" title="{% trans 'Add' %}" class="btn" ng-click="ctrl.add()">{% trans 'Add' %}</a>
    </div>

</div>
