<?php
use home\assets\MainAsset;
use yii\helpers\Url;
use common\models\User;
use yii\widgets\ActiveForm;
use yii\helpers\StringHelper;

$this->title = '标签列表';
?>

<!--container-->
<div class="container manage-project fix">

	<?= $this->render('/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-width='380' data-height='260' data-title='添加标签' 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('/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 width="20%">标签名称</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->tag_id ?>" /></td>
						<td class='theleft-min' title="<?= $model->name ?>"><?= StringHelper::truncate($model->name, 12) ?></td>
						<td class='theleft-min' title="<?= $model->remark ?>"><?= empty($model->remark) ? '' : StringHelper::truncate($model->remark, 32) ?></td>
						<td><?= ($model->status == User::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->tag_id]) ?>" data-width='380' data-height='260' data-title='编辑标签' >编辑</a>  
							<a href="<?= Url::to([$this->context->id . '/delete', 'id' => $model->tag_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-->

