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:
@@ -0,0 +1,25 @@
|
||||
import { requireAdmin } from '@/lib/auth/require-admin'
|
||||
import { BulkImportForm } from '@/components/admin/bulk-import-form'
|
||||
import { redirect } from 'next/navigation'
|
||||
|
||||
export const metadata = {
|
||||
title: 'Bulk Import Incidents — IMS'
|
||||
}
|
||||
|
||||
export default async function BulkImportPage() {
|
||||
const user = await requireAdmin()
|
||||
if (!user) redirect('/login')
|
||||
|
||||
return (
|
||||
<div className="max-w-4xl mx-auto p-6">
|
||||
<div className="mb-6">
|
||||
<h1 className="text-3xl font-bold mb-2">Bulk Import Incidents</h1>
|
||||
<p className="text-gray-600">
|
||||
Upload historical case folders. Each folder will become a closed incident
|
||||
with extracted metadata and attached evidence files.
|
||||
</p>
|
||||
</div>
|
||||
<BulkImportForm />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user