<?php $__env->startSection('header'); ?>
<script src="<?php echo App::make("myadmin")->asset('/ckeditor/ckeditor.js'); ?>"></script>
<script>
    $(document).ready(function(){
        $("[name=is_available]").change(function(){
            var obj = {"is_available" : $(this).prop("checked"), "id": $(this).parents("tr").data("id")}
                $.get( "<?php echo URL::to('admin/delivery/check-update'); ?>", obj , function(str) {
                    alert(str);
            });
        });
    });
</script>
<style>
    [name=is_available] {
        width:12px;
    }
</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="row-fluid">
    <div>
        <h4 class="nametag"><?php echo $_CONST['title']; ?></h4>
        <hr>
                <a href="<?php echo action($_CONST["CONTROLLER_ACTION"].'@create'); ?>" class="btn btn-primary" ><i class="icon-ok-circle"></i>新增</a>
        <hr>
        <div class="span10 offset1">
            <table class="table table-bordered">
                <tr>
                    <th>標題</th>
                    <th>內容</th>
                    <th>更新時間</th>
                    <th>編輯</th>
                    <th>前端是否呈現</th>
                </tr>
                <?php foreach($backends as $backend): ?>
                <tr data-id=<?php echo $backend->id; ?>>
                    <td><?php echo e($backend->title); ?></td>
                    <td><?php echo $backend->origin_content; ?></td>
                    <td><?php echo e($backend->updated_at); ?></td>
                    <td>
                <a href="<?php echo URL::to('front/page/'.$backend->id); ?>" class="btn btn-primary">檢閱</a>
                <a href="<?php echo action($_CONST["CONTROLLER_ACTION"].'@edit', $backend->id); ?>" class="btn btn-info" ><i class="icon-ok-circle"></i>編輯</a>
                    </td>
                    <td>
                <?php echo Form::checkbox('is_available', 1, $backend->is_available, array('class' => 'form-control')); ?>

                    </td>
                </tr>
                <?php endforeach; ?>
            </table>
        </div> <!-- span10 offset1 -->
    </div>
</div>
<?php $__env->stopSection(); ?>

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