<form name="validation" class="form-horizontal compliance-form">

    <?php if (isActionAllowed('settings.notification_scripts')) { ?>
    <div class="control-group">
        <div class="controls">
            <div class="checkbox">
                <label>
                    <input name="notify" type="checkbox" ng-click="check(this);alertData.customNotificationSelection = {}" ng-model="shownotify">
                    Custom action
                </label>
            </div>
        </div>

        <div class="controls">
            <ul class="unstyled" ng-class="{'muted':!shownotify}">
                <?php if (isActionAllowed('settings.notification_scripts_update')) { ?>
                <li class="margin-top-small margin-bottom-small">
                     <a ng-show="shownotify" class="margin-left margin-bottom" href="/settings/notification-scripts/add">Add a new custom action</a>
                     <span ng-show="!shownotify" class="margin-left margin-bottom">Add a new custom action</span>
                </li>
                <?php } ?>

                <li ng-repeat="script in customNotificationScriptsData">
                     <div class="margin-left checkbox">
                        <label>
                            <input type="checkbox" ng-disabled="!shownotify" ng-model="alertData.customNotificationSelection[script.id]">
                            {{script.name}}
                        </label>
                        <p class="label-description">{{script.description}}</p>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <?php } ?>

    <div class="control-group">
        <div class="controls">
            <div class="checkbox">
                <label>
                    <input name="notify" type="checkbox" ng-click="check(this);clearEmail()" ng-model="shownotifymail">
                    Email notifications
                </label>
            </div>
        </div>

        <div ng-class="{error:validation.email.$invalid || validation.email.$error.required}" class="margin-top-small">
            <div class="controls">
                <div class="margin-left">
                    <label id="email-notify" class="margin-left">
                        To:
                    </label>

                    <div class="margin-left">
                        <input ng-focus="validation.email.isFocused=true" ng-blur="validation.email.isFocused=false" ng-disabled="!shownotifymail" type="email" name="email" ng-model="alertData.emailToNotify" placeholder="Enter a valid email address">

                        <div ng-show="validation.email.$dirty && validation.email.$invalid">
                           <span class="help-block error" ng-show="(validation.email.$error.email||validation.email.$error.required)&&!validation.email.isFocused">Enter a valid email address.</span>
                       </div>
                    </div>
                </div>
            </div>
        </div>

    </div>

    <div class="control-group margin-top">
         <div class="controls">
            <div class="checkbox">
                <label>
                    <input type="checkbox" ng-click="check(this);alertData.reminder=0;" ng-model="showreminder">
                    Set reminders
                </label>
            </div>

            <div class="margin-left margin-top-small">
                <select
                    chozen
                    ng-options="f.value as f.label for f in DCA.CheckReminder_dropDown"
                    ng-model="alertData.reminder"
                    disable="!showreminder"
                    search="false"
                    watch="DCA.CheckReminder_dropDown"
                    >
                </select>
            </div>
         </div>
     </div>

</form>