feat(bulk-import): complete implementation

- API upload handler: extract folders/zip, analyze PDFs, return preview
- API batch creation: create incidents from reviewed metadata
- Form component: upload, editable preview table, import controls
- Admin page: bulk import page at /admin/bulk-import
- Admin link: button in admin panel

All components integrated and ready for testing.
This commit is contained in:
2026-08-16 15:35:33 +08:00
parent 303636326b
commit abb2b3e707
5 changed files with 411 additions and 0 deletions
+6
View File
@@ -5,6 +5,7 @@ import { asAdmin } from '@/lib/db/with-user'
import { getSession } from '@/lib/auth/get-session'
import { users, sites, zones, trucks } from '@/lib/db/schema'
import { desc, asc } from 'drizzle-orm'
import Link from 'next/link'
import { AdminPanel } from '@/components/admin/admin-panel'
import type { AdminUser, SiteOption } from '@/components/admin/user-manager'
import type { SiteWithZones } from '@/components/admin/site-zone-manager'
@@ -55,6 +56,11 @@ export default async function AdminHome() {
<h1 className="text-xl font-bold text-gray-900">Admin Panel</h1>
<p className="text-sm text-gray-500 mt-0.5">Manage users, sites, zones, and trucks</p>
</div>
<div className="mb-6 flex gap-3">
<Link href="/admin/bulk-import" className="px-4 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700">
Bulk Import Incidents
</Link>
</div>
<AdminPanel
users={adminUsers}
sites={sitesWithZones}