<?php
$input_fullname = array('name' => 'fullname','type' => 'text','value' => ($fullname) ? $fullname : $adminById[0]['fullname'],'style' => 'width: 100%');
$input_username = array('name' => 'username','type' => 'text','value' => ($username) ? $username : $adminById[0]['username'],'style' => 'width: 100%');
$input_password = array('name' => 'password','type' => 'password','value' => $password,'style' => 'width: 100%');
$input_password2 = array('name' => 'password2','type' => 'password','value' => $password2,'style' => 'width: 100%');
$input_email = array('name' => 'email','type' => 'email','value' => ($email) ? $email : $adminById[0]['email'],'style' => 'width: 100%');
?>

<div class="row">
    <div class="widget-box">
        <div class="widget-header">
            <p class="widget-title">Cập nhật thông tin User</p>
        </div>
        <div class="widget-body">
            <div class="widget-main">
                <?php
                $attributes = array('class' => 'form-horizontal', 'id' => 'myform');
                echo form_open(base_url().'backend/cmsSetting/editUserAdmin/'.$adminById[0]['id'], $attributes);
                ?>
                <div class="form-group">
                    <label class="col-lg-3">Thuộc nhóm người dùng (*)</label>
                    <div class="col-lg-3">
                        <?php
                        $attr = 'class="form-control" style= "width:100%"';
                        $group_id = ($group_id) ? $group_id : $adminById[0]['group_id'];
                        echo form_dropdown('group_id', $groupList, $group_id, $attr);
                        ?>
                    </div>
                    <div class="col-lg-3">
                        <?php if(validation_errors()){echo form_error('group_id', '<div class="error">', '</div>');}?>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-lg-3">Họ và tên (*)</label>
                    <div class="col-lg-3">
                        <?php echo form_input($input_fullname); ?>
                    </div>
                    <div class="col-lg-3">
                        <?php if(validation_errors()){echo form_error('fullname', '<div class="error">', '</div>');} ?>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-lg-3">Tên tài khoản (*)</label>
                    <div class="col-lg-3">
                        <?php echo form_input($input_username); ?>
                    </div><div class="col-lg-3">
                        <?php if(validation_errors()){echo form_error('username', '<div class="error">', '</div>');} ?>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-lg-3">Mật khẩu (*)</label>
                    <div class="col-lg-3">
                        <?php echo form_input($input_password); ?>
                    </div><div class="col-lg-3">
                        <?php if(validation_errors()){echo form_error('password', '<div class="error">', '</div>');} ?>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-lg-3">Nhập lại mật khẩu (*)</label>
                    <div class="col-lg-3">
                        <?php echo form_input($input_password2); ?>
                    </div><div class="col-lg-3">
                        <?php if(validation_errors()){echo form_error('password2', '<div class="error">', '</div>');} ?>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-lg-3">Email (*)</label>
                    <div class="col-lg-3">
                        <?php echo form_input($input_email); ?>
                    </div><div class="col-lg-3">
                        <?php if(validation_errors()){echo form_error('email', '<div class="error">', '</div>');} ?>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-lg-3">Kích hoạt</label>
                    <div class="col-lg-3">
                        <?php $isActive = ($is_active) ? $is_active : $adminById[0]['is_active'] ?>
                        <input name="is_active" type="checkbox" <?php if($isActive == 'on' || $isActive == 1) echo 'checked' ?>>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-lg-3">
                        <a href="<?php echo base_url().'backend/cmsSetting/listUserAdmin'?>" onclick="return confirm('Bạn có chắc chắn muốn quay lại Danh sách không?')">
                            <button type="button" class="btn btn-sm btn-default">
                                <i class="ace-icon fa fa-arrow-left"></i>Quay lại
                            </button>
                        </a>
                    </div>
                    <div class="col-lg-4">
                        <button class="btn btn-sm btn-primary" type="submit" name="btnSave">
                            <i class="ace-icon fa fa-check bigger-110"></i>Lưu lại
                        </button>
                        <button class="btn btn-sm" type="reset">
                            <i class="ace-icon fa fa-undo bigger-110"></i>Xóa form
                        </button>
                    </div>
                </div>
                <?php echo form_close(); ?>
            </div>
        </div>
    </div>
</div><!-- /.row -->