JEI_Import_Documents-App/app/layout.tsx
Mavis 7cf8d4b2e2 feat(order): new /order tab — stock-code picker + qty, cost preview, PDF export
Quick order-builder for the user. Pick a stock code, set a qty, hit Add.
Default unit price is the HIGHEST price ever paid for each code (worst-
case budget), with the reference invoice [no + date] shown in the table
so the price source is auditable. Ties broken by most-recent date so
the source reflects current market, not an old historical peak.

UI:
- Stock code dropdown shows code, description, default price, ref inv
- Inline-editable qty + unit price per row
- Running grand total at bottom
- Clear button (with confirm) wipes the list
- Export PDF button calls window.print() — browser "Save as PDF" gives
  a clean table with no chrome (header/nav/controls hidden via @media
  print stylesheet)

Persistence:
- List kept in localStorage key 'jei:order-list' across reloads

Files:
- app/order/page.tsx       [server: fetches stock codes + lines, builds highest-price map]
- app/order/OrderClient.tsx [client: UI, state, print stylesheet]
- app/layout.tsx           [nav: added Order link]

PB query note: when using `fields=...` to limit the response, you must
also include 'expand.invoice.invoice_no' and 'expand.invoice.invoice_date'
in the field selector, otherwise PB drops the expand data entirely.
2026-09-19 01:13:22 +02:00

37 lines
1.3 KiB
TypeScript

import "./globals.css";
import type { Metadata } from "next";
import Link from "next/link";
export const metadata: Metadata = {
title: "JEI South Africa",
description: "Invoice and stock tracker for JEI South Africa",
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
<header className="bg-brand text-white shadow">
<div className="max-w-7xl mx-auto px-4 py-4 flex items-center justify-between">
<Link href="/" className="text-xl font-semibold">
JEI South Africa
</Link>
<nav className="flex gap-6 text-sm">
<Link href="/" className="hover:underline">Dashboard</Link>
<Link href="/invoices" className="hover:underline">Invoices</Link>
<Link href="/unpaid" className="hover:underline">Unpaid</Link>
<Link href="/remittance" className="hover:underline">Remittance</Link>
<Link href="/stock-codes" className="hover:underline">Stock Codes</Link>
<Link href="/order" className="hover:underline">Order</Link>
</nav>
</div>
</header>
<main className="max-w-7xl mx-auto px-4 py-8">{children}</main>
</body>
</html>
);
}