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

$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">
            <button title="状态列表" type="button" class="btn btn-default btn-task" onclick="javascript: window.location.href = '<?= Url::to([$this->context->id . '/index']) ?>';">
                <i class="icon-list-ul"></i>
            </button>
            <div class="tab-right">
                <button title="添加状态" type="button" data-url='<?= Url::to([$this->context->id . '/create']) ?>' data-title='添加状态' class="btn btn-default btn-task open-dialog">
                <i class="icon-plus"></i>
                </button>
            </div>
        </div>

		<?php $mainForm = ActiveForm::begin([ 'id' => 'main-form', 'action' => '']); ?>
		<table class="table task-table">

			<tr>
                <th width="90"><label style="font-weight:lighter" ><input type="checkbox" name="select_all" class="box-select-all" style="position:relative;top:2px;" /> 全选</label></th>
				<th width="80">ID</th>
                <th width="80">排序</th>
				<th>合同状态名称</th>
				<th width="150">状态</th>
				<th width="150" align="center">操作</th>
			</tr>

				<?php if (empty($models)) : ?>
					<tr><td colspan="10" 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->status_id ?>" /></td>
						<td><?= $model->status_id ?></td>
                        <td><?= $model->sort ?></td>
						<td><?= $model->name ?></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->status_id]) ?>" data-title='编辑状态' >编辑</a>  
							<a href="<?= Url::to([$this->context->id . '/delete', 'id' => $model->status_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">
			<?= \yii\widgets\LinkPager::widget(['pagination' => $pages]); ?>
        </div>
    </div>
	<!--manage-right-->

</div>
<!--container-->