"use client"; import { AlignLeft, Globe, Mail, MapPin, Phone, Plus } from "lucide-react"; import { useRef, useState } from "react"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { cn } from "@/lib/utils"; interface CompaniesCreate4Props { className?: string; } const CompaniesCreate4 = ({ className }: CompaniesCreate4Props) => { const [formData, setFormData] = useState>({}); const [logo, setLogo] = useState(null); const logoInputRef = useRef(null); const FIELDS = [ { label: "معرفی شرکت", name: "description", placeholder: "معرفی کوتاهی از فعالیت‌ها، محصولات و خدمات شرکت بنویسید...", icon: AlignLeft, type: "text", }, { label: "ایمیل", name: "email", type: "email", placeholder: "info@example.ir", icon: Mail, required: true, }, { label: "تلفن", name: "phone", type: "tel", placeholder: "۰۹۱۲ ۳۴۵ ۶۷۸۹", icon: Phone, }, { label: "آدرس", name: "address", type: "text", placeholder: "تهران، خیابان ولیعصر، پلاک ۱۲", icon: MapPin, }, { label: "وب‌سایت", name: "website", type: "url", placeholder: "https://example.ir", icon: Globe, }, ]; const handleInputChange = (name: string, value: string) => { setFormData((prev) => ({ ...prev, [name]: value })); }; return (
ثبت شرکت
e.preventDefault()}>
setLogo(e.target.files?.[0] || null)} />
logoInputRef.current?.click()} onKeyDown={(e) => { if (e.key === "Enter" || e.key === " ") { logoInputRef.current?.click(); } }} className="flex size-26 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-md border text-muted-foreground sm:size-16" > {!logo ? ( ) : ( لوگوی شرکت )}
handleInputChange("name", e.target.value)} required className={cn( "h-auto rounded-none border-x-0 border-t-0 !bg-transparent p-0 py-1.5 shadow-none !ring-0 !outline-none focus:border-b sm:border-b-transparent sm:!text-xl sm:focus:!border-input/70", )} />
{FIELDS.map((field, i) => { return (
handleInputChange(field.name, e.target.value) } type={field.type} required={field.required} className={cn( "h-auto rounded-none border-x-0 border-t-0 !bg-transparent p-0 py-1.5 shadow-none !ring-0 !outline-none focus:border-b sm:border-b-transparent sm:focus:!border-input/70", )} />
); })}
); }; export { CompaniesCreate4 };