{{define "client_table"}}
<template slot="actions" slot-scope="text, client, index">
    <a-tooltip>
        <template slot="title">{{ i18n "qrCode" }}</template>
        <a-icon style="font-size: 24px;" type="qrcode" v-if="record.hasLink()" @click="showQrcode(record,index);"></a-icon>
    </a-tooltip>
    <a-tooltip>
        <template slot="title">{{ i18n "pages.client.edit" }}</template>
        <a-icon style="font-size: 24px;" type="edit" @click="openEditClient(record.id,client);"></a-icon>
    </a-tooltip>
    <a-tooltip>
        <template slot="title">{{ i18n "info" }}</template>
        <a-icon style="font-size: 24px;" type="info-circle" @click="showInfo(record,index);"></a-icon>
    </a-tooltip>
    <a-tooltip>
        <template slot="title">{{ i18n "pages.inbounds.resetTraffic" }}</template>
        <a-icon style="font-size: 24px;" type="retweet" @click="resetClientTraffic(client,record.id)" v-if="client.email.length > 0"></a-icon>
    </a-tooltip>
    <a-tooltip>
        <template slot="title"><span style="color: #FF4D4F"> {{ i18n "delete"}}</span></template>
        <a-icon style="font-size: 24px;" type="delete" v-if="isRemovable(record.id)" @click="delClient(record.id,client)"></a-icon>
    </a-tooltip>
</template>
<template slot="enable" slot-scope="text, client, index">
    <a-switch v-model="client.enable" @change="switchEnableClient(record.id,client)"></a-switch>
</template>   
<template slot="client" slot-scope="text, client">
    [[ client.email ]]
    <a-tag v-if="!isClientEnabled(record, client.email)" color="red">{{ i18n "depleted" }}</a-tag>
</template>                                    
<template slot="traffic" slot-scope="text, client">
    <a-popover :overlay-class-name="themeSwitcher.darkClass">
        <template slot="content" v-if="client.email">
            <table cellpadding="2" width="100%">
                <tr>
                    <td>↑[[ sizeFormat(getUpStats(record, client.email)) ]]</td>
                    <td>↓[[ sizeFormat(getDownStats(record, client.email)) ]]</td>
                </tr>
                <tr v-if="client.totalGB > 0">
                    <td>{{ i18n "remained" }}</td>
                    <td>[[ sizeFormat(client.totalGB - getUpStats(record, client.email) - getDownStats(record, client.email)) ]]</td>
                </tr>
            </table>
        </template>
        <a-tag :color="statsColor(record, client.email)">
            [[ sizeFormat(getUpStats(record, client.email) + getDownStats(record, client.email)) ]] /
            <template v-if="client.totalGB > 0">[[client._totalGB]]GB</template>
            <template v-else>
                <svg style="fill: currentColor; height: 16px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M484.4 96C407 96 349.2 164.1 320 208.5C290.8 164.1 233 96 155.6 96C69.75 96 0 167.8 0 256s69.75 160 155.6 160C233.1 416 290.8 347.9 320 303.5C349.2 347.9 407 416 484.4 416C570.3 416 640 344.2 640 256S570.3 96 484.4 96zM155.6 368C96.25 368 48 317.8 48 256s48.25-112 107.6-112c67.75 0 120.5 82.25 137.1 112C276 285.8 223.4 368 155.6 368zM484.4 368c-67.75 0-120.5-82.25-137.1-112C364 226.2 416.6 144 484.4 144C543.8 144 592 194.2 592 256S543.8 368 484.4 368z"/></svg>
            </template>
        </a-tag>
    </a-popover>
</template>                                    
<template slot="expiryTime" slot-scope="text, client, index">
    <template v-if="client.expiryTime > 0">
        <a-tag :color="usageColor(new Date().getTime(), app.expireDiff, client.expiryTime)">
            [[ DateUtil.formatMillis(client._expiryTime) ]]
        </a-tag>
    </template>
    <a-tag v-else-if="client.expiryTime < 0" color="cyan">
        [[ client._expiryTime ]] {{ i18n "pages.client.days" }}
    </a-tag>
    <a-tag v-else color="green">{{ i18n "indefinite" }}</a-tag>
</template>
{{end}}