<script setup>
// Copyright 2024 FlexCDN root@flexcdn.cn. All rights reserved. Official site: https://flexcdn.cn .

import PopupLayout from "@/layouts/PopupLayout.vue";
import ctxRef from "@/utils/ctx_ref.js"
import Context from "./updatePopup.js"
import PostForm from "@/components/form/PostForm.vue";
import TTextarea from "@/components/ui/TTextarea.vue";
import SubmitButton from "@/components/form/SubmitButton.vue";
import DefinitionTable from "@/components/common/DefinitionTable.vue";

const ctx = ctxRef(new Context())

</script>

<template>
	<PopupLayout>
		<header>修改用户</header>
		<PostForm @success="ctx.success" action="$">
			<input type="hidden" name="userId" :value="ctx.user.id"/>
			<DefinitionTable>
				<tbody>
				<tr>
					<td class="title">用户邮箱 *</td>
					<td>
						{{ctx.user.email}}
						<p class="comment">用于自动注册用户的邮箱，不允许修改。</p>
					</td>
				</tr>
				<tr v-if="ctx.user.provider != null">
					<td>所属服务商</td>
					<td>{{ctx.user.provider.name}}</td>
				</tr>
				<tr v-if="ctx.user.account != null">
					<td>所属服务商账号</td>
					<td>{{ctx.user.account.name}}</td>
				</tr>
				<tr>
					<td>备注</td>
					<td>
						<TTextarea name="description" rows="3" maxlength="100" v-model="ctx.user.description" autofocus class="w-full"></TTextarea>
					</td>
				</tr>
				</tbody>
			</DefinitionTable>
			<SubmitButton></SubmitButton>
		</PostForm>
	</PopupLayout>
</template>

<style lang="postcss" scoped>
</style>