<?php
use wap\assets\AppAsset;
use yii\helpers\StringHelper;
use yii\helpers\Url;

$this->title = '我的任务 - 首页';

$asset = $this->getAssetManager()->getBundle(AppAsset::className());
?>

<div class="mainbody">
    <ul class="switchtab">
        <li class="active"><a href="<?= Url::to(['index']) ?>"><i class="icon-tasks"></i>我的任务</a></li>
        <li ><a href="<?= Url::to(['announce']) ?>"><i class="icon-envelope"></i>消息中心<?= (!empty($notReadNum)) ? '<span>' . $notReadNum . '</span>' : '' ?></a></li>
    </ul>

    <div class="common-list task-list message-list">
        <ul>
            <?php if (!empty($tasks['tasks'])) : ?>
                <?php foreach($tasks['tasks'] as $task) : ?>
                <li <?= ($task['leader_id'] == Yii::$app->user->id || ($task['leader_id'] == 0 && $task['user_id'] == Yii::$app->user->id)) ? 'class="task-respons"' : '' ?> >
                <a href="<?= Url::to(['/task/detail', 'id' => $task['task_id']]) ?>">
                    <h4><?= StringHelper::truncate($task['name'], 14) ?></h4>
                    <p><?= date('Y-m-d', $task['create_time']) ?><span class="project-leader"><?= isset($task['leader']) ? '负责人 : ' . $task['leader']['realname'] : '' ?></span></p>
                </a>
                </li>
                <?php endforeach; ?>
                <?php if ($tasks['count'] > 10) : ?>
                    <li style="text-align:center;"><a href="<?= Url::to(['/task/index']) ?>">点击查看更多</a></li>
                <?php endif; ?>
            <?php else : ?>
                    <li style="text-align:center;">还没有任何数据...</li>
            <?php endif; ?>
        </ul>
    </div>

</div>


