{$layout}
{$template "../menu"}

<second-menu>
    <menu-item href=".?status=0" :active="status == 0">等待发送({{countWaiting}})</menu-item>
    <menu-item href=".?status=3" :active="status == 3">发送错误({{countFailed}})</menu-item>
</second-menu>


<p class="comment" v-if="tasks.length == 0">暂时还没有发送任务。</p>

<div v-if="tasks.length > 0">
    <div class="margin"></div>
    <table class="ui table selectable definition" v-for="task in tasks">
        <tr>
            <td class="title">简介</td>
            <td>
                {{task.user}} <span class="disabled">&nbsp; | &nbsp;</span> <span v-if="task.instance != null">媒介：{{task.instance.name}}<link-icon :href="'/admins/recipients/instances/instance?instanceId=' + task.instance.id"></link-icon></span>
                <span class="disabled">&nbsp; | &nbsp;</span> 时间：{{task.createdTime}}

                <a href="" title="删除" class="op" @click.prevent="deleteTask(task.id)"><i class="icon remove small"></i></a>
            </td>
        </tr>
        <tr v-if="task.subject.length > 0">
            <td>标题</td>
            <td>{{task.subject}}</td>
        </tr>
        <tr v-if="task.body.length > 0">
            <td>内容</td>
            <td>{{task.body}}</td>
        </tr>
        <tr v-if="task.status == 3 && task.result != null && !task.result.isOk" class="error">
            <td>错误信息</td>
            <td>{{task.result.error}}</td>
        </tr>
    </table>
</div>

<div class="page" v-html="page"></div>