{$layout "layout_popup"}

<!-- <h3>创建ACME用户</h3> -->
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
	<csrf-token></csrf-token>
    <input type="hidden" name="platformUserId" :value="platformUserId"/>
	<table class="ui table definition selectable">
        <tr v-if="platformUser != null">
            <td>所属平台用户</td>
            <td><user-link :v-user="platformUser"></user-link></td>
        </tr>
		<tr>
			<td class="title">用户邮箱 *</td>
			<td>
				<input type="text" name="email" maxlength="100" ref="focus"/>
				<p class="comment">用于自动注册用户的邮箱。</p>
			</td>
		</tr>
        <tr>
            <td>所属证书服务商 *</td>
            <td>
                <b-select
                    name="providerCode"
                    v-model="providerCode"
                    @change="changeProvider"
                    auto-width
                    :options="[
                        {label: '[选择服务商]', value: ''},
                        ...providers.map(provider => ({
                            label: provider.name,
                            value: provider.code,
                        }))
                    ]"
                ></b-select>

                <!-- <select class="ui dropdown auto-width" name="providerCode" v-model="providerCode" @change="changeProvider">
                    <option value="">[选择服务商]</option>
                    <option v-for="provider in providers" :value="provider.code">{{provider.name}}</option>
                </select> -->
            </td>
        </tr>
        <tr v-if="selectedProvider != null">
            <td>所属服务商账号 <span v-if="selectedProvider.requireEAB">*</span><em v-else>（可选）</em></td>
            <td>
                <div class="ui fields inline">
                    <div class="ui field" v-if="accounts.length > 0">
                        <b-select
                            name="accountId"
                            v-model="accountId"
                            auto-width
                            :options="[
                                {label: '[选择账号]', value: '0'},
                                ...accounts.map(account => ({
                                    label: account.name,
                                    value: account.id,
                                }))
                            ]"
                        ></b-select>

                        <!-- <select class="ui dropdown auto-width" name="accountId" v-model="accountId">
                            <option value="0">[选择账号]</option>
                            <option v-for="account in accounts" :value="account.id">{{account.name}}</option>
                        </select> -->
                    </div>
                    <div class="ui field">
                        <a href="" @click.prevent="addAccount">[添加]</a>
                    </div>
                </div>
            </td>
        </tr>
		<tr>
			<td>备注</td>
			<td>
				<textarea name="description" rows="3" maxlength="100"></textarea>
			</td>
		</tr>
	</table>
	<submit-btn></submit-btn>
</form>