<?php
$input_name = array(
    'name' => 'name',
    'type' => 'text',
    'value' => ($name) ? $name : $accessControllerById[0]['name'],
    'placeholder' => '',
    'autocomplete' => 'off',
    'class' => '',
    'style' => 'width: 100%'
);
$input_description = array(
    'name' => 'description',
    'type' => 'text',
    'value' => ($description) ? $description : $accessControllerById[0]['description'],
    'placeholder' => '',
    'autocomplete' => 'off',
    'class' => '',
    'style' => 'width: 100%'
);
?>
<div class="row">
    <div class="widget-box">
        <div class="widget-header">
            <p class="widget-title">Cập nhật chức năng</p>
        </div>
        <div class="widget-body">
            <div class="widget-main">
                <?php
                //echo validation_errors('<ul style="color: red">', '</ul>');
                $attributes = array('class' => 'form-horizontal', 'id' => 'myform');
                echo form_open(base_url().'backend/cmsSetting/editAccessController/'.$accessControllerById[0]['id'], $attributes);
                ?>
                    <div class="form-group">
                        <label class="col-lg-3">Tên controller (*)</label>
                        <div class="col-lg-3">
                            <?php
                            echo form_input($input_name);
                            if(validation_errors()){echo form_error('name', '<div class="error">', '</div>');}
                            ?>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-3">Mô tả controller (*)</label>
                        <div class="col-lg-3">
                            <?php
                            echo form_input($input_description);
                            if(validation_errors()){echo form_error('description', '<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 : $accessControllerById[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/listAccessController'?>" 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 -->