<?php

use home\assets\MainAsset;
use yii\helpers\Url;
use home\modules\customer\models\Level;
use yii\widgets\ActiveForm;
use common\components\Tool;

/* @var $this yii\web\View */
$this->title = '等级列表';
?>

<!--container-->
<div class="container manage-project fix">
  	<?= $this->render('@home/views/site/_left-menu') ?>
  <!--manage-left -->
  
    <div class="manage-right">
        <div class="tab-column tab-manage">
            <div class="tab-right">
                <button title="添加等级" type="button" data-url='<?= Url::to([$this->context->id . '/create']) ?>' data-title="添加等级" data-width='400' data-height="162" class="btn btn-default btn-task open-dialog">
                    <i class="icon-plus"></i>
                </button>
            </div>
            <p class="caption">等级列表</p>
    </div>
        <?= \home\widgets\Alert::widget(); ?>
        <?= $this->render('@home/views/site/_search', ['model' => $model, 'get' => $get]) ?>
        <?php $mainForm = ActiveForm::begin([ 'id' => 'main-form', 'action' => '']); ?>
		<table class="table task-table">
				<tr>
                    <th width="60"><label style="font-weight:lighter" ><input type="checkbox" name="select_all" class="box-select-all" style="position:relative;top:2px;" /> 全选</label></th>
					<th >等级名称</th>
                    <th>创建时间</th>
					<th width="50">状态</th>
					<th width="120" align="center">操作</th>
				</tr>
	
			<?php if (empty($models)) : ?>
				<tr><td colspan="5" class="tac red">还没有任何数据...</td></tr>
			<?php else : ?>
				<?php foreach ($models as $key =>$model) : ?>
				<tr>
                    <td><input type="checkbox" name="delete[]" class="box-delete" value="<?= $model->level_id ?>" /></td>
                    <td><?= $model->name ?></td>
                    <td><?=  date('Y-m-d',$model->create_time) ?></td>
                    <td><?= ($model->status == Level::STATUS_ENABLE) ? '<font color="green">启用</font>' : '<font color="red">禁用</font>' ?></td>
					<td align="center" >
                        
						<a href="javascript:;" class="open-dialog"  data-url="<?= Url::to([$this->context->id .'/view', 'id' => $model->level_id]) ?>" data-title='编辑等级' data-width='400' data-height="162" >编辑</a>
                        <a href="<?= Url::to([$this->context->id .'/delete', 'id'=>$model->level_id]) ?>" class="link-delete" >删除</a>
					</td>
				</tr>
				<?php endforeach; ?>
			<?php endif; ?>
			
		</table>
        <div class="tab-column tab-manage">
            <button title="删除" type="button" class="btn btn-default btn-task batch-delete" data-url="<?= Url::to([$this->context->id.'/delete']) ?>" >
            <i class="icon-trash"></i>
            </button>
        </div>
        <?php ActiveForm::end(); ?>

        <!--分页标签-->
      	<div class="pages">
            <?php if ($pages->totalCount != 0) : ?><span class="pagetotal">共<em><?= $pages->totalCount ?></em>条记录<em><?= $pages->page + 1 ?>/<?= $pages->pageCount ?></em>页 </span><?php endif; ?>
            <?= \yii\widgets\LinkPager::widget(['pagination' => $pages, 'prevPageLabel' => '上一页','nextPageLabel' => '下一页', 'firstPageLabel' => '首页', 'lastPageLabel' => '末页']); ?>
        </div>
        <!--分页标签-->
    </div>
  <!--manage-right--> 
  
</div>
<!--container-->

