<div class="content-wrapper">
    <section class="content-header">
        <h1>Nuevo Usuario</h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-md-8">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <strong>Formulario de registro</strong>
                    </div>
                    <div class="panel-body">

                        <?php echo validation_errors('<div class="alert alert-danger">', '</div>'); ?>

                        <form method="post" action="<?php echo base_url('index.php/seguridad/usuarios/store'); ?>">

                            <div class="form-group">
                                <label>Nombre completo</label>
                                <input type="text" name="nombre" class="form-control" value="<?php echo set_value('nombre'); ?>" required>
                            </div>

                            <div class="form-group">
                                <label>Usuario</label>
                                <input type="text" name="usuario" class="form-control" value="<?php echo set_value('usuario'); ?>" required>
                            </div>

                            <div class="form-group">
                                <label>Contraseña</label>
                                <input type="password" name="clave" class="form-control" required>
                            </div>

                            <div class="form-group">
                                <label>Correo electrónico</label>
                                <input type="email" name="email" class="form-control" value="<?php echo set_value('email'); ?>">
                            </div>

                            <div class="form-group">
                                <label>Rol</label>
                                <select name="rol_id" class="form-control" required>
                                    <option value="">Seleccione un rol</option>
                                    <?php foreach($roles as $rol): ?>
                                        <option value="<?php echo $rol->id; ?>" <?php echo set_select('rol_id', $rol->id); ?>>
                                            <?php echo $rol->nombre; ?>
                                        </option>
                                    <?php endforeach; ?>
                                </select>
                            </div>

                            <button type="submit" class="btn btn-primary">
                                <i class="fa fa-save"></i> Guardar
                            </button>
                            <a href="<?php echo base_url('index.php/seguridad/usuarios'); ?>" class="btn btn-default">
                                Cancelar
                            </a>

                        </form>

                    </div>
                </div>
            </div>
        </div>
    </section>
</div>