This commit is contained in:
2026-03-23 17:12:35 -05:00
parent 92328713f4
commit d59a0a563d
9 changed files with 346 additions and 40 deletions

View File

@@ -1,12 +1,13 @@
import { shipSalesOrder } from "@/lib/actions";
import { SalesOrderFulfillmentForm } from "@/components/sales-order-fulfillment-form";
import { SalesOrderForm } from "@/components/sales-order-form";
import { formatCurrency, formatDate } from "@/lib/format";
import { getCustomers, getOrderItemOptions, getSalesOrders } from "@/lib/repository";
import { getCustomers, getOrderItemOptions, getSalesOrderLineDetails, getSalesOrders } from "@/lib/repository";
export default function SalesOrdersPage() {
const customers = getCustomers();
const items = getOrderItemOptions();
const orders = getSalesOrders();
const orderLines = getSalesOrderLineDetails();
return (
<div className="grid">
@@ -18,7 +19,7 @@ export default function SalesOrdersPage() {
</article>
<article className="panel">
<h2 className="section-title">Shipping Flow</h2>
<p className="section-copy">Leave line quantities blank to ship the remaining balance, or enter `SKU,quantity` rows for a partial shipment.</p>
<p className="section-copy">Ship relational order lines directly by choosing quantities from the remaining balance on each line.</p>
<div className="table-wrap">
<table className="table">
<thead><tr><th>Order</th><th>Customer</th><th>Status</th><th>Total</th><th>Qty Progress</th><th>Created</th><th>Action</th></tr></thead>
@@ -38,11 +39,10 @@ export default function SalesOrdersPage() {
{order.status === "shipped" ? (
<span className="muted">Shipped</span>
) : (
<form action={shipSalesOrder} className="form-grid">
<input type="hidden" name="orderId" value={order.id} />
<textarea className="textarea" name="lines" placeholder={"PART-001,1\nKIT-100,2"} />
<button className="button secondary" type="submit">Ship</button>
</form>
<SalesOrderFulfillmentForm
orderId={order.id}
lines={orderLines.filter((line) => line.salesOrderId === order.id && line.remainingQuantity > 0)}
/>
)}
</td>
</tr>