<h3 class="text-left">創建用戶角色</h3>

<ul class="table-toolbar" style="text-align: left;"><li><a class="toolbar-element btn btn-default btn-create" href="/role"><i class="fa fa-chevron-left" style="margin-right: 8px;"></i>返回</a></li></ul>

<?php echo form_open('role/add', array("class" => "form-horizontal form-container")); ?>
<?php //print_r($tasks); ?>
<div class="form-group">
    <label for="name" class="col-sm-4 control-label"><span class="text-danger">*</span>用戶角色名稱</label>
    <div class="col-sm-8">
        <input type="text" name="name" value="<?php echo $this->input->post('name'); ?>" class="form-control" id="name" />
        <span class="text-danger"><?php echo form_error('name'); ?></span>
    </div>
</div>
<?php if ($isAdmin || $isSuperAdmin || $isSiteAdmin) { ?>
<div class="form-group">
    <label for="isAdmin" class="col-sm-4 control-label"><span class="text-danger">*</span>擁有管理員權限</label>
    <div class="col-sm-8">
        <input class="form-check-input" type="checkbox" name="isAdmin" value="1" id="isAdmin" />
        <span class="text-danger"><?php echo form_error('name'); ?></span>
    </div>
</div>
<?php } ?>
<?php if ($isSuperAdmin || $isSiteAdmin) { ?>
<div class="form-group">
    <label for="isTenant" class="col-sm-4 control-label"><span class="text-danger">*</span>擁有分校控制權限</label>
    <div class="col-sm-8">
        <input class="form-check-input" type="checkbox" name="isTenant" value="1" id="isTenant" />
        <span class="text-danger"><?php echo form_error('name'); ?></span>
    </div>
</div>
<?php } ?>
<div class="form-group" scrollable>
    <label class="col-xs-2 control-label">權限</label>
    <label class="col-xs-2 control-label">Index</label>
    <label class="col-xs-2 control-label">Add</label>
    <label class="col-xs-2 control-label">Edit</label>
    <label class="col-xs-2 control-label">Save</label>
    <label class="col-xs-2 control-label">Delete</label>
</div>
<?php foreach ($tasks as $v): ?>
<div class="form-group" scrollable>
    <div class="col-xs-2">
        <label class="form-check-label">
            <?php echo $v['display_name'] . ' ' . $v['name']; ?>
        </label>
    </div>
    <div class="col-xs-2">
        <input class="form-check-input" type="checkbox" name="tasks[]" value="<?php echo $perm[$v['id']]['index'] ?>" />
    </div>
    <div class="col-xs-2">
        <input class="form-check-input" type="checkbox" name="tasks[]" value="<?php echo $perm[$v['id']]['add'] ?>" />
    </div>
    <div class="col-xs-2">
        <input class="form-check-input" type="checkbox" name="tasks[]" value="<?php echo $perm[$v['id']]['edit'] ?>" />
    </div>
    <div class="col-xs-2">
        <input class="form-check-input" type="checkbox" name="tasks[]" value="<?php echo $perm[$v['id']]['save'] ?>" />
    </div>
    <div class="col-xs-2">
        <input class="form-check-input" type="checkbox" name="tasks[]" value="<?php echo $perm[$v['id']]['delete'] ?>" />
    </div>
</div>
<?php endforeach ?>
<!--	<div class="form-group">
                <label for="createdate" class="col-sm-4 control-label">Createdate</label>
                <div class="col-sm-8">
                        <input type="text" name="createdate" value="<?php echo $this->input->post('createdate'); ?>" class="form-control" id="createdate" />
                </div>
        </div>
        <div class="form-group">
                <label for="updatedate" class="col-sm-4 control-label">Updatedate</label>
                <div class="col-sm-8">
                        <input type="text" name="updatedate" value="<?php echo $this->input->post('updatedate'); ?>" class="form-control" id="updatedate" />
                </div>
        </div>-->

<div class="form-group">
    <div class="">
        <input type="submit" class="btn btn-success" value="提交"/>
        <a href="/role" class="btn btn-cancel">取消</a>
    </div>
</div>

<?php echo form_close(); ?>