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

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

<section class="content">

    <div class="box box-default">
        <form data-ajax class="form-focus" action="<?= admin_url_to('/users/edit/' . $user['id']) ?>" 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><?= __('User') ?></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" value="<?= $user['name'] ?>" type="text" name="name" id="name" />
                                    </div>
                                </div>

                                <div class="col-md-2">
                                    <div class="form-group">
                                        <label class="control-label" for="super-user"><?= __('Super user') ?>?</label>
                                        <div>
                                            <input class="form-control toggle" type="checkbox" id="super-user"<?= $user['super_user'] ? 'checked="checked"' : '' ?> value="1" name="super_user" />
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label" for="username"><?= __('Username') ?> <span class="required">*</span></label>
                                        <input class="form-control" value="<?= $user['username'] ?>" type="text" name="username" id="username" />
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label" for="password"><?= __('Password') ?> <span class="required">*</span></label>
                                        <input class="form-control" value="" type="password" name="password" id="password" />
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label" for="email"><?= __('Email') ?></label>
                                        <input class="form-control" value="<?= $user['email'] ?>" type="text" name="email" id="email" />
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label" for="user-group"><?= __('Group') ?></label>
                                        <select class="form-control" name="group_id" id="user-group">
                                            <?php foreach ($groups as $group): ?>
                                                <option<?= $user['group_id'] == $group['id'] ? ' selected' : '' ?> value="<?= $group['id'] ?>"><?= $group['name'] ?></option>
                                            <?php endforeach ?>
                                        </select>
                                    </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>