"use client"; import { Button } from "@suphark/ui/components/shared/button/button"; import { Combobox } from "@suphark/ui/components/shared/combobox"; import { DatePicker } from "@suphark/ui/components/shared/date/date-picker"; import { MultiSelectCombobox } from "@suphark/ui/components/shared/multi-select-combobox"; import { Badge } from "@suphark/ui/components/ui/badge"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@suphark/ui/components/ui/card"; import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSet, } from "@suphark/ui/components/ui/field"; import { Input } from "@suphark/ui/components/ui/input"; import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, } from "@suphark/ui/components/ui/input-group"; import { InputOTP, InputOTPGroup, InputOTPSlot } from "@suphark/ui/components/ui/input-otp"; import { Label } from "@suphark/ui/components/ui/label"; import { RadioGroup, RadioGroupItem } from "@suphark/ui/components/ui/radio-group"; import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, } from "@suphark/ui/components/ui/select"; import { Separator } from "@suphark/ui/components/ui/separator"; import { Slider } from "@suphark/ui/components/ui/slider"; import { Switch } from "@suphark/ui/components/ui/switch"; import { ToggleGroup, ToggleGroupItem } from "@suphark/ui/components/ui/toggle-group"; import { Building2, DollarSign, FileText, Search } from "lucide-react"; import * as React from "react"; export function ShowcaseForms() { const [hasErrors, setHasErrors] = React.useState(true); const [selectedCombobox, setSelectedCombobox] = React.useState("th-cement"); const [selectedMulti, setSelectedMulti] = React.useState(["concrete", "steel"]); const [toggleVal, setToggleVal] = React.useState("grid"); const [sliderVal, setSliderVal] = React.useState([45]); const [selectedDate, setSelectedDate] = React.useState(new Date()); const [otpVal, setOtpVal] = React.useState("2568"); const vendorOptions = [ { label: "Alpha Cement Co., Ltd.", value: "th-scg" }, { label: "Thai Concrete Industries", value: "th-cement" }, { label: "Boonthavorn Ceramic", value: "th-boonthavorn" }, { label: "Dynasty Ceramic PLC", value: "th-dynasty" }, { label: "TOA Paint Thailand", value: "th-toa" }, ]; const materialTags = [ { label: "งานคอนกรีตโครงสร้าง (Concrete)", value: "concrete" }, { label: "งานเหล็กรูปพรรณ (Structural Steel)", value: "steel" }, { label: "งานระบบไฟฟ้า (Electrical)", value: "electrical" }, { label: "งานสุขาภิบาล (Sanitary & Plumbing)", value: "plumbing" }, { label: "งานกระจกและอลูมิเนียม (Facade)", value: "facade" }, ]; return (
{/* Section Header */}
Form System FieldGroup, Field, InputGroup, Combobox & Validation States

ระบบฟอร์มและการจัดการข้อมูลนำเข้า

มาตรฐานฟอร์มแบบ Unified FieldGroup + Field{" "} พร้อมระบบตรวจสอบข้อผิดพลาดและ Accessibility

{/* Interactive Form Controls Showcase */}
{/* Left Column: Standard Field-Based Form */}
Field-Based Form Structure ใช้ FieldGroup และ Field เพื่อคุม Label, Description และ Error
{/* Field with simple input */} ชื่อแพ็กเกจจัดซื้อ (Package Title) ใช้ชื่อที่เป็นทางการและระบุอาคารให้ชัดเจน {/* Field with InputGroup (Search / Action) */} ค้นหาผู้เสนอราคา / เลขประจำตัวผู้เสียภาษี ระบบจะดึงประวัติการรับงานและคะแนนประเมินย้อนหลัง {/* Field with Select & SelectGroup */} วิธีการจัดหา (Procurement Method) {/* Field with Validation Error State */} งบประมาณกลางที่ได้รับอนุมัติ (Approved Budget) {hasErrors ? ( งบประมาณกลางต้องมากกว่า 0 บาท และตรงตามมติคณะกรรมการ ) : ( ระบุจำนวนเงินสุทธิรวมภาษีมูลค่าเพิ่ม 7% )} {/* Field with Textarea in InputGroup */} ขอบเขตงานและเงื่อนไขเทคนิค (Scope of Work) Scope
{/* Right Column: Advanced & Grouped Controls */}
{/* Combobox & MultiSelect */} Combobox & Multi-Select การเลือกข้อมูลจากรายการขนาดใหญ่และการแท็กหลายรายการ ผู้ขายที่ได้รับเชิญหลัก (Primary Vendor) หมวดหมู่วัสดุที่เกี่ยวข้อง (Material Categories) {/* Grouped FieldSet with Switches & Radios */} FieldSet & Grouped Controls ใช้ FieldSet และ FieldLegend รวมสวิตช์และเรดิโอที่เกี่ยวข้องกัน
การควบคุมกระบวนการอนุมัติ (Approval Workflow) อนุมัติแบบลำดับชั้น (Multi-level Approval) ล็อกงบประมาณทันทีเมื่อเปิดซองราคา ส่งอีเมลแจ้งเตือนผู้ขายอัตโนมัติ
เกณฑ์การตัดสิน (Evaluation Method)
{/* Specialized Controls (Date, OTP, Slider, ToggleGroup) */} Specialized Input Primitives Date Pickers, OTP, Sliders, และ ToggleGroup {/* DatePicker */} วันกำหนดส่งเอกสาร (Tender Deadline) {/* ToggleGroup */} รูปแบบมุมมองตาราง (View Layout) { if (val[0]) setToggleVal(val[0]); }} variant="outline" > Grid View Compact Table Kanban Board {/* Slider */}
สัดส่วนคะแนนด้านราคา (Price Weight): {sliderVal[0]}% เทคนิค: {100 - (sliderVal[0] ?? 0)}%
setSliderVal(Array.isArray(val) ? [...val] : [val])} max={100} step={5} />
{/* InputOTP */} รหัสยืนยันเปิดซองราคา (4-Digit Opening PIN)
); }