<section class="content-header">
    <h1><?= __('Add task') ?></h1>

    <div class="actions">
        <a data-ajax class="btn btn-default btn-sm" href="<?= admin_url_to('/cronjobs') ?>"><?= __('List') ?></a>
    </div>
</section>

<section class="content">
    <div class="box box-default">
        <form data-ajax class="form-focus" action="<?= admin_url_to('/cronjobs/add') ?>" method="post">
            <?= csrf_field() ?>

            <div class="box-body">
                <div class="section">
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
                            <h5><?= __('Task') ?></h5>
                        </div>

                        <div class="col-lg-9 col-md-9 col-sm-8 col-xs-12">
                            <div class="row">
                                <div class="col-md-10">
                                    <div class="form-group">
                                        <label class="control-label" for="name"><?= __('Name') ?> <span class="required">*</span></label>
                                        <input class="form-control" type="text" id="name" name="name" />
                                    </div>
                                </div>

                                <div class="col-md-2">
                                    <div class="form-group">
                                        <label class="control-label" for="active"><?= __('Active') ?></label>
                                        <div>
                                            <input class="form-control toggle" type="checkbox" id="active" value="1" name="active" />
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label" for="script"><?= __('Script') ?> <span class="required">*</span></label>
                                <select class="form-control" id="script" name="script">
                                    <?php foreach ($tasks as $group => $task): ?>
                                        <optgroup label="<?= __($group) ?>">
                                            <?php foreach ($task as $t => $name): ?>
                                                <option value="<?= $t ?>"><?= $name ?></option>
                                            <?php endforeach ?>
                                        </optgroup>
                                    <?php endforeach ?>
                                </select>
                            </div>

                            <div class="row">
                                <div class="col-md-2-5">
                                    <div class="form-group">
                                        <label class="control-label" for="minutes"><?= __('Minutes') ?> <span class="required">*</span></label>
                                        <input class="form-control" value="*" type="text" id="minutes" name="minutes" />
                                    </div>
                                </div>

                                <div class="col-md-2-5">
                                    <div class="form-group">
                                        <label class="control-label" for="hours"><?= __('Hours') ?> <span class="required">*</span></label>
                                        <input class="form-control" value="*" type="text" id="hours" name="hours" />
                                    </div>
                                </div>

                                <div class="col-md-2-5">
                                    <div class="form-group">
                                        <label class="control-label" for="days"><?= __('Days') ?> <span class="required">*</span></label>
                                        <input class="form-control" value="*" type="text" id="days" name="days" />
                                    </div>
                                </div>

                                <div class="col-md-2-5">
                                    <div class="form-group">
                                        <label class="control-label" for="weeks"><?= __('Weeks') ?> <span class="required">*</span></label>
                                        <input class="form-control" value="*" type="text" id="weeks" name="weeks" />
                                    </div>
                                </div>

                                <div class="col-md-2-5">
                                    <div class="form-group">
                                        <label class="control-label" for="months"><?= __('Months') ?> <span class="required">*</span></label>
                                        <input class="form-control" value="*" type="text" id="months" name="months" />
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="box-footer">
                <div class="row">
                    <div class="col-sm-offset-3" style="padding-left:15px">
                        <input type="submit" class="btn btn-primary" value="<?= __('Save') ?>" />
                    </div>
                </div>
            </div>
        </form>
    </div>
</section>