<?php
$input_name = array(
    'name' => 'name',
    'type' => 'text',
    'value' => $name,
    'placeholder' => '',
    'class' => '',
    'style' => 'width: 100%'
);
$input_description = array(
    'name' => 'description',
    'type' => 'text',
    'value' => $description,
    'placeholder' => '',
    'autocomplete' => 'off',
    'class' => '',
    'style' => 'width: 100%'
);
?>
<div class="row">
    <div class="widget-box">
        <div class="widget-header">
            <p class="widget-title">Thêm mới nhóm quản trị</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/addGroup', $attributes);
                ?>
                <div class="form-group">
                    <label class="col-lg-3">Mã nhóm (*)</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ả nhóm (*)</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">
                        <input name="is_active" type="checkbox" <?php if($is_active == 'on') echo 'checked' ?>>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3">Gán quyền Controller cho Nhóm</label>
                    <div class="col-lg-9">
                        <div class="row">
                            <?php foreach($controllerList as $controllerItem): ?>
                            <div class="col-lg-6">
                                <label>
                                    <input name="group_access_controller[]" type="checkbox" value="<?php echo $controllerItem['id']; ?>" <?php if($group_access_controller && in_array($controllerItem['id'], $group_access_controller)) echo 'checked' ?>/>
                                    <?php echo $controllerItem['name'].' ('.$controllerItem['description'].')'; ?>
                                </label>
                            </div>
                            <?php endforeach; ?>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-lg-3">
                        <a href="<?php echo base_url().'backend/cmsSetting/listGroup'?>" 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 -->