C-005: Order Acknowledgement Detail + PDF - Order detail page with full line items, releases, addresses, paint codes - PDF export via Puppeteer matching legacy format - Clickable order # links and PDF icons in orders table C-007: BOL Detail + PDF - BOL detail page with ship-from/to, line items, weights - PDF export matching legacy BOL format - PDF icon column in shipments table C-008: Coil Activity - Usage Report - Date range picker (max 31 days, default last 10 days) - Reusable UI: Popover, Calendar (react-day-picker v9), DateRangePicker - SQL from legacy portal_CoilActivityUsage.sql with OnHandQty dedup - 11-column sortable table with search and CSV export C-009: Coil Activity - Receipts Report - VGL customer exception (special SQL vs portal view) - 10-column sortable table with search and CSV export - Shared date range picker component Also: dashboard API route, shipments API route, HDC→HDM mapping, Puppeteer PDF infrastructure, improved error handling. Progress: 9/16 Phase 2 tasks complete. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 lines
748 B
TypeScript
22 lines
748 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { getTop100Shipments } from '@/services/shipments';
|
|
import { getQuestSession, getActiveCompany } from '@/lib/permissions';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
export async function GET() {
|
|
const session = await getQuestSession();
|
|
const activeCompany = await getActiveCompany();
|
|
|
|
if (!session || !activeCompany) {
|
|
return NextResponse.json({ error: 'No active company' }, { status: 401 });
|
|
}
|
|
|
|
try {
|
|
const shipments = await getTop100Shipments(activeCompany.epicor_cust_id);
|
|
return NextResponse.json(shipments);
|
|
} catch (err) {
|
|
const message = err instanceof Error ? err.message : String(err);
|
|
return NextResponse.json({ error: message }, { status: 500 });
|
|
}
|
|
}
|