<?php
use home\assets\MainAsset;
use home\assets\MenuAsset;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\helpers\StringHelper;
use home\models\Announcement;

MenuAsset::register($this);
$assetUrl = $this->getAssetManager()->getBundle(MainAsset::className())->baseUrl;
$this->registerJsFile($assetUrl.'/js/contract.status.js', ['depends' => [MainAsset::className()]]);

$this->title = $title;
?>

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

    <div class="manage-left">
        <ul>
            <li><a href="<?= Url::to(['message/inbox']) ?>">消息通知</a>
            <ul>
                <li><a href="<?= Url::to(['message/inbox']) ?>">收件箱</a></li>
                <li><a href="<?= Url::to(['message/outbox']) ?>">发件箱</a></li>
            </ul>
            </li>
            <li><a href="<?= Url::to(['announcement/index']) ?>">系统通知</a>
            <ul>
                <li><a href="<?= Url::to(['announcement/index']) ?>">通知列表</a></li>
            </ul>
            </li>
        </ul>
    </div>
    
    <div class="manage-right">
        <div class="tab-column tab-manage">
            <p class="caption">通知列表</p>
         </div>

        <?= $this->render('_search', ['model' => $model, 'get' => $get, 'action' => $action]) ?>

        <?php if (empty($models)) : ?>
        <div style="text-align: center">暂无数据</div>
        <?php else : ?>
        <div class="message-list">
            <ul>
                <?php foreach ($models as $model) : ?>
                    <li>
                        <img class="message-point" src="<?= $assetUrl ?>/images/<?= ($model->is_read)?'point-grey.gif':'point-red.gif' ?>">
                        <p class="message-title" data-src="<?= $assetUrl ?>" data-set-url="<?= Url::to(['set-read', 'id' => $model->announcement_id]) ?>" data-set-status="<?= $model->is_read ?>" >
                            <span><?= date('Y-m-d',$model->create_time) ?></span>
                            <a href="javascript:;"><?= StringHelper::truncate($model->title, 48) ?></a>
                        </p>
                        <p class="message-detail"><?= $model->content ?></p>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
        <?php endif; ?>

        <!--分页标签-->
      	<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-->
