{$layout}
{$template "menu"}

<p class="comment" v-if="userPlans.length == 0">暂时还没有已购套餐。</p>

<table class="ui table selectable celled" v-if="userPlans.length > 0">
    <thead>
        <tr>
            <th>套餐</th>
            <th>备注名</th>
            <th>价格设置</th>
            <th>有效期</th>
            <th>网站</th>
            <th class="two op">操作</th>
        </tr>
    </thead>
    <tr v-for="userPlan in userPlans">
        <td>
            <span v-if="userPlan.plan.id > 0">
                {{userPlan.plan.name}}
            </span>
            <span class="red" v-else>[已删除]</span>
        </td>
        <td>
            <span v-if="userPlan.name.length > 0">{{userPlan.name}}</span>
            <span v-else class="disabled">-</span>
        </td>
        <td>
            <div v-if="userPlan.plan != null">
                <!-- 价格设置 -->
                <plan-price-view :v-plan="userPlan.plan"></plan-price-view>

                <!-- 流量限制 -->
                <plan-limit-view :value="userPlan.plan"></plan-limit-view>

                <!-- 带宽限制 -->
                <plan-bandwidth-limit-view :value="userPlan.plan"></plan-bandwidth-limit-view>
            </div>
        </td>
        <td>{{userPlan.dayTo}}</td>
        <td>
            <div v-if="userPlan.servers != null && userPlan.servers.length > 0">
                <div v-for="server in userPlan.servers">
                    <a :href="'/servers/server/settings/plan?serverId=' + server.id" v-if="server.type == 'httpProxy' || server.type == 'httpWeb'">{{server.name}}</a>
                    <a :href="'/lb/server/settings/plan?serverId=' + server.id" v-if="server.type == 'tcpProxy' || server.type == 'udpProxy'">{{server.name}}</a>
                </div>
            </div>
            <span v-else class="disabled">尚未绑定</span>
        </td>
        <td>
            <a href="" @click.prevent="renewUserPlan(userPlan.id)">续费</a> &nbsp;
            <a href="" @click.prevent="deleteUserPlan(userPlan.id)">删除</a>
        </td>
    </tr>
</table>

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