<?php $__env->startSection('content'); ?>
<div class="row-fluid">
    <div class="span9">
        <h4 class="nametag"><?php echo e(trans($_CONST["LANG_DEST"].".title")); ?></h4>
        <a href="<?php echo route($_CONST["CONTROLLER_ROUTE"].'.create'); ?>" class="btn btn-primary">
            <span class="glyphicon glyphicon-file"></span>
<?php /*            <?php echo e(trans($_CONST["LANG_DEST"].".create_action")); ?>	*/ ?>
		新增最新消息
        </a>
<?php /*
        <a href="<?php echo action($_CONST["CLASS_CONTROLLER"].'@index'); ?>" class="btn btn-success">
            <span class="glyphicon glyphicon-th-list"></span>
            <?php echo e(trans($_CONST["LANG_DEST"].".browse_class")); ?>

        </a>
*/ ?>
        <hr>
<?php /*
        <?php echo Form::open(array( 'class'=>'form-horizontal well')); ?>

        <div class="input-group">
            <span class="input-group-addon"><?php echo e(trans($_CONST["LANG_DEST"].".select_class")); ?>：</span>
            <?php echo Form::select('id', $categories, 0, array('class' => 'form-control') ); ?>

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

*/ ?>
        <table class="table table-bordered">
            <tr>
                <th>發佈</th>
                <th>編號</th>
                <th>標題</th>
                <th>發文日期</th>
                <th>操作</th>
            </tr>

            <?php foreach($articles as $article): ?>
            <tr>
                <td>
                    <?php if($article->isActive): ?>
                    <a href="<?php echo action($_CONST["CONTROLLER_ACTION"].'@getDisable', $article->id); ?>" class="btn btn-success" ><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></a>
                    <?php else: ?>
                    <a href="<?php echo action($_CONST["CONTROLLER_ACTION"].'@getEnable', $article->id); ?>" class="btn btn-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a>
                    <?php endif; ?>
                </td>
                <td><?php echo e($article->id); ?></td>
                <td><?php echo e($article->title); ?></td>
                <td><?php echo date("d M Y",strtotime($article->created_at)); ?></td>

<?php /*                <td><?php echo e($article->updated_at); ?></td>*/ ?>

                <td>
			<a href="<?php echo action($_CONST["CONTROLLER_ACTION"].'@edit', $article->id); ?>" class="btn btn-default" ><span class="glyphicon glyphicon-pencil" aria-hidden = "true"></span></a>
                    <?php echo Form::open(array('route'=>array($_CONST["CONTROLLER_ROUTE"].'.destroy', $article->id),
                        'method' => 'delete','style'=>'display:inline', 'id'=>$article->id)
                    ); ?>

                    <a class ="delete btn btn-large btn-default" href="javascript:document.getElementById(<?php echo $article->id; ?>).submit();" ><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
                    <?php echo Form::close(); ?>

                </td>
            </tr>
            <?php endforeach; ?>

        </table>
    </div>
<script type="text/javascript" charset="utf-8">
    $(document).change(function(){
        var t = $("select[name=id]").val();
        var base_url = "<?php echo route($_CONST["CONTROLLER_ROUTE"].".index"); ?>";
        if (t == 0) {
            var target = base_url;
        }else {
            var target = base_url + '/' + t;
        }
        window.location = target;
    });
</script>
</div>
<?php $__env->stopSection(); ?>

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