Seth commited on
Commit ·
478ea27
1
Parent(s): de686dc
Update
Browse files- src/App.tsx +24 -22
- src/components/PrLineItemsTable.tsx +23 -23
- src/components/ProcurementFormBlock.tsx +1 -1
- src/components/RequestSummaryPanel.tsx +7 -7
src/App.tsx
CHANGED
|
@@ -340,7 +340,7 @@ export default function App() {
|
|
| 340 |
</p>
|
| 341 |
</div>
|
| 342 |
|
| 343 |
-
<aside className="flex min-h-0 min-w-0 flex-1 flex-col gap-
|
| 344 |
<RequestSummaryPanel
|
| 345 |
requestNumber={requestNumber}
|
| 346 |
requestedBy={requestedBy}
|
|
@@ -352,27 +352,29 @@ export default function App() {
|
|
| 352 |
onBudgetCodeChange={setBudgetCode}
|
| 353 |
onRequestedDateChange={setRequestedDate}
|
| 354 |
/>
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
|
|
|
|
|
|
| 376 |
</aside>
|
| 377 |
</div>
|
| 378 |
)}
|
|
|
|
| 340 |
</p>
|
| 341 |
</div>
|
| 342 |
|
| 343 |
+
<aside className="flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden bg-surface-container-low/60 px-gutter py-3 lg:py-4">
|
| 344 |
<RequestSummaryPanel
|
| 345 |
requestNumber={requestNumber}
|
| 346 |
requestedBy={requestedBy}
|
|
|
|
| 352 |
onBudgetCodeChange={setBudgetCode}
|
| 353 |
onRequestedDateChange={setRequestedDate}
|
| 354 |
/>
|
| 355 |
+
<div className="flex min-h-0 flex-1 flex-col gap-2">
|
| 356 |
+
{accumulatedPrRows.length > 0 ? (
|
| 357 |
+
<PrLineItemsTable rows={accumulatedPrRows} />
|
| 358 |
+
) : (
|
| 359 |
+
<div className="flex min-h-[120px] flex-1 items-center justify-center rounded-xl border border-dashed border-outline-variant bg-white px-4 py-6 text-center text-xs text-secondary shadow-sm">
|
| 360 |
+
No line items yet. Confirm selections in the chat to populate
|
| 361 |
+
this table.
|
| 362 |
+
</div>
|
| 363 |
+
)}
|
| 364 |
+
</div>
|
| 365 |
+
<div className="shrink-0 space-y-2 pt-1">
|
| 366 |
+
<button
|
| 367 |
+
type="button"
|
| 368 |
+
disabled={accumulatedPrRows.length === 0}
|
| 369 |
+
onClick={handleSubmitRequest}
|
| 370 |
+
className="w-full rounded-xl bg-primary py-2.5 text-sm font-bold text-on-primary shadow-sm transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40"
|
| 371 |
+
>
|
| 372 |
+
Submit Request
|
| 373 |
+
</button>
|
| 374 |
+
{submitFeedback ? (
|
| 375 |
+
<p className="text-center text-xs text-primary">{submitFeedback}</p>
|
| 376 |
+
) : null}
|
| 377 |
+
</div>
|
| 378 |
</aside>
|
| 379 |
</div>
|
| 380 |
)}
|
src/components/PrLineItemsTable.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import type { PrRow } from "../api/form";
|
|
| 2 |
|
| 3 |
type Props = {
|
| 4 |
rows: PrRow[];
|
| 5 |
-
/** Extra classes on the outer
|
| 6 |
className?: string;
|
| 7 |
};
|
| 8 |
|
|
@@ -11,39 +11,39 @@ export function PrLineItemsTable({ rows, className = "" }: Props) {
|
|
| 11 |
|
| 12 |
return (
|
| 13 |
<div
|
| 14 |
-
className={`w-full overflow-hidden rounded-xl border border-outline-variant bg-white shadow-sm ${className}`}
|
| 15 |
>
|
| 16 |
-
<div className="border-b border-outline-variant bg-surface-container-high px-
|
| 17 |
-
|
| 18 |
</div>
|
| 19 |
-
<div className="
|
| 20 |
-
<table className="w-full min-w-[
|
| 21 |
<colgroup>
|
| 22 |
-
<col className="w-[
|
| 23 |
-
<col className="w-[
|
| 24 |
-
<col className="w-[
|
| 25 |
-
<col className="w-[
|
| 26 |
<col className="w-[8%]" />
|
| 27 |
<col className="w-[12%]" />
|
| 28 |
</colgroup>
|
| 29 |
-
<thead>
|
| 30 |
<tr className="border-b border-outline-variant bg-surface-container-low">
|
| 31 |
-
<th className="px-
|
| 32 |
PR Line Item
|
| 33 |
</th>
|
| 34 |
-
<th className="px-
|
| 35 |
MAT GRP
|
| 36 |
</th>
|
| 37 |
-
<th className="px-
|
| 38 |
PR SHORT TEXT
|
| 39 |
</th>
|
| 40 |
-
<th className="px-
|
| 41 |
PR LONG TEXT
|
| 42 |
</th>
|
| 43 |
-
<th className="px-
|
| 44 |
PR Quantity
|
| 45 |
</th>
|
| 46 |
-
<th className="px-
|
| 47 |
Delivery Date
|
| 48 |
</th>
|
| 49 |
</tr>
|
|
@@ -54,22 +54,22 @@ export function PrLineItemsTable({ rows, className = "" }: Props) {
|
|
| 54 |
key={`${r.pr_line_item}-${idx}`}
|
| 55 |
className="border-b border-outline-variant/80 align-top last:border-0"
|
| 56 |
>
|
| 57 |
-
<td className="px-
|
| 58 |
{r.pr_line_item}
|
| 59 |
</td>
|
| 60 |
-
<td className="px-
|
| 61 |
{r.mat_grp}
|
| 62 |
</td>
|
| 63 |
-
<td className="min-w-0 px-
|
| 64 |
{r.pr_short_text}
|
| 65 |
</td>
|
| 66 |
-
<td className="min-w-0 px-
|
| 67 |
{r.pr_long_text}
|
| 68 |
</td>
|
| 69 |
-
<td className="px-
|
| 70 |
{r.pr_quantity}
|
| 71 |
</td>
|
| 72 |
-
<td className="min-w-0 px-
|
| 73 |
{r.delivery_date}
|
| 74 |
</td>
|
| 75 |
</tr>
|
|
|
|
| 2 |
|
| 3 |
type Props = {
|
| 4 |
rows: PrRow[];
|
| 5 |
+
/** Extra classes on the outer flex wrapper (e.g. flex-1 min-h-0). */
|
| 6 |
className?: string;
|
| 7 |
};
|
| 8 |
|
|
|
|
| 11 |
|
| 12 |
return (
|
| 13 |
<div
|
| 14 |
+
className={`flex min-h-0 w-full flex-1 flex-col overflow-hidden rounded-xl border border-outline-variant bg-white shadow-sm ${className}`}
|
| 15 |
>
|
| 16 |
+
<div className="shrink-0 border-b border-outline-variant bg-surface-container-high px-2 py-1.5 font-label-caps text-[8px] font-bold uppercase leading-none tracking-wide text-secondary">
|
| 17 |
+
Line items
|
| 18 |
</div>
|
| 19 |
+
<div className="min-h-0 flex-1 overflow-auto">
|
| 20 |
+
<table className="w-full min-w-[720px] table-fixed border-collapse text-left text-[11px] leading-snug">
|
| 21 |
<colgroup>
|
| 22 |
+
<col className="w-[7%]" />
|
| 23 |
+
<col className="w-[9%]" />
|
| 24 |
+
<col className="w-[24%]" />
|
| 25 |
+
<col className="w-[32%]" />
|
| 26 |
<col className="w-[8%]" />
|
| 27 |
<col className="w-[12%]" />
|
| 28 |
</colgroup>
|
| 29 |
+
<thead className="sticky top-0 z-10">
|
| 30 |
<tr className="border-b border-outline-variant bg-surface-container-low">
|
| 31 |
+
<th className="px-2 py-1.5 align-bottom text-[10px] font-semibold text-primary">
|
| 32 |
PR Line Item
|
| 33 |
</th>
|
| 34 |
+
<th className="px-2 py-1.5 align-bottom text-[10px] font-semibold text-primary">
|
| 35 |
MAT GRP
|
| 36 |
</th>
|
| 37 |
+
<th className="px-2 py-1.5 align-bottom text-[10px] font-semibold text-primary">
|
| 38 |
PR SHORT TEXT
|
| 39 |
</th>
|
| 40 |
+
<th className="px-2 py-1.5 align-bottom text-[10px] font-semibold text-primary">
|
| 41 |
PR LONG TEXT
|
| 42 |
</th>
|
| 43 |
+
<th className="px-2 py-1.5 align-bottom text-center text-[10px] font-semibold text-primary">
|
| 44 |
PR Quantity
|
| 45 |
</th>
|
| 46 |
+
<th className="px-2 py-1.5 align-bottom text-[10px] font-semibold text-primary">
|
| 47 |
Delivery Date
|
| 48 |
</th>
|
| 49 |
</tr>
|
|
|
|
| 54 |
key={`${r.pr_line_item}-${idx}`}
|
| 55 |
className="border-b border-outline-variant/80 align-top last:border-0"
|
| 56 |
>
|
| 57 |
+
<td className="px-2 py-1 font-data-mono text-[10px] tabular-nums whitespace-nowrap">
|
| 58 |
{r.pr_line_item}
|
| 59 |
</td>
|
| 60 |
+
<td className="px-2 py-1 font-data-mono text-[10px] whitespace-nowrap">
|
| 61 |
{r.mat_grp}
|
| 62 |
</td>
|
| 63 |
+
<td className="min-w-0 px-2 py-1 break-words text-on-background">
|
| 64 |
{r.pr_short_text}
|
| 65 |
</td>
|
| 66 |
+
<td className="min-w-0 px-2 py-1 break-words text-on-background">
|
| 67 |
{r.pr_long_text}
|
| 68 |
</td>
|
| 69 |
+
<td className="px-2 py-1 text-center tabular-nums whitespace-nowrap">
|
| 70 |
{r.pr_quantity}
|
| 71 |
</td>
|
| 72 |
+
<td className="min-w-0 px-2 py-1 whitespace-nowrap text-[10px] text-secondary">
|
| 73 |
{r.delivery_date}
|
| 74 |
</td>
|
| 75 |
</tr>
|
src/components/ProcurementFormBlock.tsx
CHANGED
|
@@ -383,7 +383,7 @@ export function ProcurementFormBlock({
|
|
| 383 |
) : null}
|
| 384 |
{justAdded ? (
|
| 385 |
<p className="mb-3 text-body-sm font-semibold text-[#10B981]">
|
| 386 |
-
Line items added to the
|
| 387 |
</p>
|
| 388 |
) : null}
|
| 389 |
|
|
|
|
| 383 |
) : null}
|
| 384 |
{justAdded ? (
|
| 385 |
<p className="mb-3 text-body-sm font-semibold text-[#10B981]">
|
| 386 |
+
Line items added to the table on the right.
|
| 387 |
</p>
|
| 388 |
) : null}
|
| 389 |
|
src/components/RequestSummaryPanel.tsx
CHANGED
|
@@ -13,7 +13,7 @@ type Props = {
|
|
| 13 |
};
|
| 14 |
|
| 15 |
const INPUT =
|
| 16 |
-
"mt-
|
| 17 |
|
| 18 |
function MiniField({
|
| 19 |
label,
|
|
@@ -24,7 +24,7 @@ function MiniField({
|
|
| 24 |
}) {
|
| 25 |
return (
|
| 26 |
<div>
|
| 27 |
-
<label className="font-label-caps text-[
|
| 28 |
{label}
|
| 29 |
</label>
|
| 30 |
{children}
|
|
@@ -44,17 +44,17 @@ export function RequestSummaryPanel({
|
|
| 44 |
onRequestedDateChange,
|
| 45 |
}: Props) {
|
| 46 |
return (
|
| 47 |
-
<div className="rounded-
|
| 48 |
-
<h2 className="mb-
|
| 49 |
Request details
|
| 50 |
</h2>
|
| 51 |
-
<div className="grid grid-cols-
|
| 52 |
<MiniField label="Request Number">
|
| 53 |
<input
|
| 54 |
type="text"
|
| 55 |
readOnly
|
| 56 |
value={requestNumber}
|
| 57 |
-
className={`${INPUT} bg-surface-container-high font-data-mono text-
|
| 58 |
aria-readonly
|
| 59 |
/>
|
| 60 |
</MiniField>
|
|
@@ -84,7 +84,7 @@ export function RequestSummaryPanel({
|
|
| 84 |
className={INPUT}
|
| 85 |
/>
|
| 86 |
</MiniField>
|
| 87 |
-
<div className="
|
| 88 |
<MiniField label="Budget Code">
|
| 89 |
<input
|
| 90 |
type="text"
|
|
|
|
| 13 |
};
|
| 14 |
|
| 15 |
const INPUT =
|
| 16 |
+
"mt-0.5 w-full rounded-md border border-outline-variant bg-surface-container-lowest px-2 py-1 text-[11px] leading-tight text-primary shadow-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary";
|
| 17 |
|
| 18 |
function MiniField({
|
| 19 |
label,
|
|
|
|
| 24 |
}) {
|
| 25 |
return (
|
| 26 |
<div>
|
| 27 |
+
<label className="font-label-caps text-[8px] font-bold uppercase leading-none tracking-wide text-secondary">
|
| 28 |
{label}
|
| 29 |
</label>
|
| 30 |
{children}
|
|
|
|
| 44 |
onRequestedDateChange,
|
| 45 |
}: Props) {
|
| 46 |
return (
|
| 47 |
+
<div className="shrink-0 rounded-lg border border-outline-variant bg-surface-container-low px-2.5 py-2 shadow-sm">
|
| 48 |
+
<h2 className="mb-1.5 font-label-caps text-[8px] font-bold uppercase leading-none tracking-wide text-secondary">
|
| 49 |
Request details
|
| 50 |
</h2>
|
| 51 |
+
<div className="grid grid-cols-2 gap-x-2 gap-y-1.5">
|
| 52 |
<MiniField label="Request Number">
|
| 53 |
<input
|
| 54 |
type="text"
|
| 55 |
readOnly
|
| 56 |
value={requestNumber}
|
| 57 |
+
className={`${INPUT} bg-surface-container-high font-data-mono text-[10px]`}
|
| 58 |
aria-readonly
|
| 59 |
/>
|
| 60 |
</MiniField>
|
|
|
|
| 84 |
className={INPUT}
|
| 85 |
/>
|
| 86 |
</MiniField>
|
| 87 |
+
<div className="col-span-2">
|
| 88 |
<MiniField label="Budget Code">
|
| 89 |
<input
|
| 90 |
type="text"
|