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

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

<section class="content">
    <div class="box box-default">
        <form data-ajax class="form-focus" action="<?= admin_url_to('/services/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><?= __('Service') ?></h5>
                        </div>

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

                                <div class="col-md-2">
                                    <div class="form-group">
                                        <label class="control-label" for="allowed"><?= __('Allowed') ?>?</label>
                                        <div>
                                            <input class="form-control toggle" type="checkbox" id="allowed" value="1" name="allowed" />
                                        </div>
                                    </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="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label" for="service"><?= __('Service') ?> <span class="required">*</span></label>
                                        <input class="form-control" type="text" name="service" id="service" />
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label" for="parent-id"><?= __('Parent service') ?></label>
                                        <select class="form-control" name="parent_id" id="parent-id">
                                            <option value=""></option>
                                            <?php foreach ($services as $service): ?>
                                                <option value="<?= $service['id'] ?>"><?= $service['name'] ?></option>
                                            <?php endforeach ?>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label" for="url">URL</label>
                                <input class="form-control" type="text" name="url" id="url" />
                            </div>

                            <div class="form-group">
                                <label class="control-label"><?= __('Allowed to') ?></label>
                                <div>
                                    <?php foreach (config('vip.types', []) as $id => $name): ?>
                                        <div style="width:25%;float:left">
                                            <input type="checkbox" id="services-vip<?= $id ?>" name="viptype[<?= $id ?>]" />
                                            <label for="services-vip<?= $id ?>"><?= $name ?></label>
                                        </div>
                                    <?php endforeach ?>
                                </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>