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

import ctxRef from "@/utils/ctx_ref.js"
import Context from "./deleteRecords.js"
import Menu from "@/views/ns/domains/batch/@menu.vue";
import TTextarea from "@/components/ui/TTextarea.vue";
import TInputText from "@/components/ui/TInputText.vue";
import PostForm from "@/components/form/PostForm.vue";
import TSelect from "@/components/ui/TSelect.vue";
import TOption from "@/components/ui/TOption.vue";
import NSRoutesSelector from "@/components/ns/NSRoutesSelector.vue";
import SubmitButton from "@/components/form/SubmitButton.vue";
import DefinitionTable from "@/components/common/DefinitionTable.vue";

const ctx = ctxRef(new Context())

</script>

<template>
	<Menu :ctx="ctx"></Menu>

	<PostForm action="$" @success="ctx.success">
		<DefinitionTable>
			<tbody>
			<tr>
				<td class="title">域名 *</td>
				<td>
					<TTextarea rows="15" name="names" placeholder="每行一个域名" autofocus class="w-full"></TTextarea>
				</td>
			</tr>
			<tr>
				<td>匹配条件</td>
				<td>
					<DefinitionTable>
						<tbody>
						<tr>
							<td class="title">记录名</td>
							<td>
								<TInputText name="searchName" class="w-full"/>
								<p class="comment">只有不为空时才生效。</p>
							</td>
						</tr>
						<tr>
							<td>记录值</td>
							<td>
								<TInputText name="searchValue" class="w-full"/>
								<p class="comment">只有不为空时才生效。</p>
							</td>
						</tr>
						<tr>
							<td>记录类型</td>
							<td>
								<TSelect name="searchType">
									<TOption v-for="type in ctx.types" :value="type.type">{{type.type}}</TOption>
								</TSelect>
							</td>
						</tr>
						<tr>
							<td>线路</td>
							<td>
								<NSRoutesSelector name="searchRouteCodes"></NSRoutesSelector>
							</td>
						</tr>
						</tbody>
					</DefinitionTable>
				</td>
			</tr>
			</tbody>
		</DefinitionTable>
		<SubmitButton>批量删除</SubmitButton>
	</PostForm>
</template>

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