import React from "react"; import { Accordion, AccordionItem, Button, Card, CardBody, CardHeader, Input, Switch, Textarea, } from "@heroui/react"; import type { TFunction } from "i18next"; import type { RuleSetForm, RuleSetFormMode } from "./adminRulesetTypes"; type RuleSetValidation = { name?: string | null; code?: string | null; points_per_qso?: string | null; points_per_km?: string | null; min_distance_km?: string | null; time_tolerance_sec?: string | null; out_of_window_dq_threshold?: string | null; time_diff_dq_threshold_percent?: string | null; time_diff_dq_threshold_sec?: string | null; bad_qso_dq_threshold_percent?: string | null; penalty_dup_points?: string | null; penalty_nil_points?: string | null; penalty_busted_call_points?: string | null; penalty_busted_rst_points?: string | null; penalty_busted_exchange_points?: string | null; penalty_busted_serial_points?: string | null; penalty_busted_locator_points?: string | null; penalty_out_of_window_points?: string | null; callsign_suffix_max_len?: string | null; callsign_levenshtein_max?: string | null; time_shift_seconds?: string | null; time_mismatch_max_sec?: string | null; }; type AdminRulesetFormProps = { formMode: Exclude; form: RuleSetForm; setForm: React.Dispatch>; validation: RuleSetValidation; formError: string | null; formSuccess: string | null; reportRequirementWarning: boolean; submitting: boolean; hasValidationErrors: boolean; label: (key: string, fallback: string) => string; helpLabel: (label: string, key: string) => React.ReactNode; tRules: TFunction; onSubmit: (event: React.FormEvent) => void; onClose: () => void; }; export default function AdminRulesetForm({ formMode, form, setForm, validation, formError, formSuccess, reportRequirementWarning, submitting, hasValidationErrors, label, helpLabel, tRules, onSubmit, onClose, }: AdminRulesetFormProps) { return (

{formMode === "create" ? label("admin_rulesets_form_create_title", "Nová sada pravidel") : label("admin_rulesets_form_edit_title", "Upravit sadu pravidel")}

{label("admin_rulesets_section_base_title", "Základ")}

{label( "admin_rulesets_section_base_desc", "Identita rulesetu a krátký popis pro rozhodčí." )}

setForm((prev) => ({ ...prev, name: e.target.value }))} isInvalid={!!validation.name} errorMessage={validation.name ?? undefined} /> setForm((prev) => ({ ...prev, code: e.target.value }))} isInvalid={!!validation.code} errorMessage={validation.code ?? undefined} />