<?php $__env->startSection('content'); ?>
<style>
    .check-item {
        height:15px;
    }
</style>

<div class="row-fluid">
    <div class="span9">
        <h4 class="nametag"><?php echo e(trans($_CONST["LANG_DEST"].".class_title")); ?></h4>
<?php /*
        <a href="<?php echo e(action($_CONST['SUB_CONTROLLER'].'@index')); ?>" class="btn btn-success">
            <span class="glyphicon glyphicon-arrow-left"></span>
            <?php echo e(trans($_CONST["LANG_DEST"].".turn_back")); ?>

        </a>
*/ ?>
		<a href="<?php echo URL::to('admin/productclass'); ?>" class="btn btn-link btn-custom" style="margin-top:10px">
			<span class="glyphicon glyphicon-file"></span>
			產品管理
		</a>
		<a href="<?php echo URL::to('admin/articleclass'); ?>" class="btn btn-success btn-custom" style="margin-top:10px">
			<span class="glyphicon glyphicon-file"></span>
			文章管理
		</a>
		<a href="<?php echo URL::to('admin/userclass'); ?>" class="btn btn-link btn-custom" style="margin-top:10px">
			<span class="glyphicon glyphicon-file"></span>
			部落客管理
		</a>
        <hr>
        <?php echo Form::open(array( 'action'=>$_CONST["CONTROLLER_ROUTE"].'.store', 'class'=>'form-horizontal well')); ?>

        <div class="input-group">
            <span class="input-group-addon"><?php echo e(trans($_CONST["LANG_DEST"].".new_class_name")); ?>：</span>
            <?php echo Form::text('title', null, array('class' => 'form-control')); ?>

            <span class="input-group-btn">
                <input type="submit" href="<?php echo route($_CONST["CONTROLLER_ROUTE"].'.create'); ?>" class="btn btn-primary" value="<?php echo e(trans($_CONST["LANG_DEST"].".class_create_action")); ?>">
            </span>
        </div>
        <?php echo Form::close(); ?>

        <table class="table table-bordered">
            <tr>
                <th>分類名稱</th>
                <th class="col-md-4">操作</th>
                <th>刪除</th>
                <th>呈現</th>
            </tr>
            <?php foreach($categories as $category): ?>
                <tr>
                <td><a href="<?php echo action($_CONST["SUB_CONTROLLER"].'@'.'show', $category->id); ?>"><?php echo e($category->title); ?></a></td>
                <td>
<?php echo Form::model($category, array(
    'route' => array($_CONST["CONTROLLER_ROUTE"].'.update', $category->id),
    'class' =>'form-horizontal',
    'method' => 'put'
)); ?>

        <div class="input-group">
            <?php echo Form::text('title', '', array('class' => 'form-control')); ?>

            <span class="input-group-btn">
                <input type="submit" href="<?php echo route($_CONST["CONTROLLER_ROUTE"].'.create'); ?>" class="btn btn-primary" value="<?php echo e(trans($_CONST["LANG_DEST"].".class_rename_action")); ?>">
            </span>
        </div>
<?php echo Form::close(); ?>

</td>
                <td>
                    <?php echo Form::open(array(
                        'route'=>array($_CONST["CONTROLLER_ROUTE"].'.destroy', $category->id),
                        'method' => 'delete')
                    ); ?>

                    <?php echo Form::submit(trans($_CONST["LANG_DEST"].".class_delete_action"), array("class"=>"delete  btn btn-large btn-danger"));; ?>

                    <?php echo Form::close(); ?>

                </td>
		<td>
			<?php if($category->is_available): ?>
				<input type="checkbox" name ="visible" checked class="form-control check-item" onchange="isVisiable(1,<?php echo $category->id; ?>)"/>
			<?php else: ?>
				<input name ="visible" type = "checkbox"  class="form-control check-item" onClick='isVisiable(0,<?php echo $category->id; ?>)'/>
			<?php endif; ?>
		</td>
                </tr>
            <?php endforeach; ?>
        </table>
    </div>
</div>
<script type="text/javascript" charset="utf-8">
    function isVisiable(is, id){
	var base_url = "<?php echo URL::to('admin/articleclass/'); ?>";
        if (is == 0) {
            var target = base_url + '/' + "enable" + '/' + id;
        }else {
            var target = base_url + '/' + "disable" + '/' + id;
        }
        window.location = target;
    }
</script>


<?php $__env->stopSection(); ?>

<?php echo $__env->make('Myadmin::layout.basic', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>