import { Form, Head } from '@inertiajs/react'; import { ExternalLink, MapPin, Pencil, Plus, Trash2 } from 'lucide-react'; import type { ReactNode } from 'react'; import { ConfirmDelete, FormDialog, FormField, PageHeader, } from '@/components/admin/form-controls'; import Heading from '@/components/heading'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { officeAddress } from '@/data/site'; import { edit } from '@/routes/admin/company'; import { update as updateContact } from '@/routes/admin/company/contact'; import { destroy, store, update } from '@/routes/admin/offices'; import type { Office, SiteInfo } from '@/types'; export default function CompanyEdit({ contact, offices }: SiteInfo) { return ( <>
{({ processing, errors }) => ( <>
)}
Tambah Kantor } />
{offices.map((office) => (
{office.name} {office.district} · {office.phone}
} /> } />

{officeAddress(office)}

{office.maps_url && ( Buka di Google Maps )}
))}
); } function OfficeDialog({ office, nextOrder = 1, trigger, }: { office?: Office; nextOrder?: number; trigger: ReactNode; }) { const id = (field: string) => `office-${office?.id ?? 'new'}-${field}`; const text = ( field: keyof Office, label: string, errors: Partial>, extra: { placeholder?: string; required?: boolean } = { required: true, }, ) => ( ); return ( {(errors) => ( <> {text('name', 'Nama kantor', errors)} {text('building', 'Gedung / nomor', errors)} {text('street', 'Jalan', errors)}
{text('area', 'Kelurahan / kecamatan', errors)} {text('city', 'Kota & kode pos', errors)} {text('district', 'Label wilayah', errors, { placeholder: 'Mis. Bintaro', required: true, })} {text('phone', 'Telepon', errors)}
{text('maps_url', 'Link Google Maps (opsional)', errors, { placeholder: 'https://maps.app.goo.gl/…', })}
{text('icon', 'Ikon (Material Symbols)', errors, { placeholder: 'apartment', required: true, })}
)}
); } CompanyEdit.layout = { breadcrumbs: [{ title: 'Info Perusahaan', href: edit() }], };