Skip to content

Commit 7938a92

Browse files
committed
Add nav tabs for unallocatedItem subtables
1 parent 148c06e commit 7938a92

4 files changed

Lines changed: 46 additions & 42 deletions

File tree

‎.husky/pre-commit‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
npm run lint
1+
#!/bin/sh
2+
cd "$(dirname "$0")/.."
3+
4+
# Try multiple ways to run the linter
5+
if [ -x "./node_modules/.bin/eslint" ]; then
6+
./node_modules/.bin/eslint . --ext .js,.jsx,.ts,.tsx --fix
7+
elif command -v eslint >/dev/null 2>&1; then
8+
eslint . --ext .js,.jsx,.ts,.tsx --fix
9+
elif [ -x "./node_modules/.bin/next" ]; then
10+
./node_modules/.bin/next lint
11+
else
12+
echo "Skipping lint - no linter found"
13+
exit 0
14+
fi

‎src/app/unallocatedItems/lineItems/page.tsx‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,21 @@ export default function UnallocatedItemsLineItemsPage() {
108108
</Link>
109109
</div>
110110
<h1 className="text-2xl font-semibold">{itemParams.title}: Unique Line Items</h1>
111+
112+
<div className="flex space-x-4 mt-4 border-b-2">
113+
<Link
114+
href={`/unallocatedItems/requests?${new URLSearchParams(itemParamsForUrl).toString()}`}
115+
className="px-2 py-1 text-md font-medium relative -mb-px transition-colors focus:outline-none text-gray-500 hover:text-black"
116+
>
117+
<div className="hover:bg-gray-100 px-2 py-1 rounded">Partner Requests</div>
118+
</Link>
119+
<button
120+
className="px-2 py-1 text-md font-medium relative -mb-px transition-colors focus:outline-none border-b-2 border-black bottom-[-1px]"
121+
>
122+
<div className="hover:bg-gray-100 px-2 py-1 rounded">Unique Line Items</div>
123+
</button>
124+
</div>
125+
111126
<h2 className="text-xl font-light text-gray-500 pt-4 pb-4">
112127
A list of all the unique items for this item.
113128
</h2>

‎src/app/unallocatedItems/requests/page.tsx‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,21 @@ export default function UnallocatedItemRequestsPage() {
137137
Partner Requests
138138
</span>
139139
</h1>
140+
141+
<div className="flex space-x-4 mt-4 border-b-2">
142+
<button
143+
className="px-2 py-1 text-md font-medium relative -mb-px transition-colors focus:outline-none border-b-2 border-black bottom-[-1px]"
144+
>
145+
<div className="hover:bg-gray-100 px-2 py-1 rounded">Partner Requests</div>
146+
</button>
147+
<Link
148+
href={`/unallocatedItems/lineItems?${new URLSearchParams(generalItemForUrl).toString()}`}
149+
className="px-2 py-1 text-md font-medium relative -mb-px transition-colors focus:outline-none text-gray-500 hover:text-black"
150+
>
151+
<div className="hover:bg-gray-100 px-2 py-1 rounded">Unique Line Items</div>
152+
</Link>
153+
</div>
154+
140155
<div className="relative w-1/3 py-4">
141156
<MagnifyingGlass
142157
className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"

‎src/screens/AdminUnallocatedItemsScreen.tsx‎

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
"use client";
22

33
import { useState, useEffect } from "react";
4-
import { DotsThree, Eye, MagnifyingGlass, Plus } from "@phosphor-icons/react";
4+
import { MagnifyingGlass, Plus } from "@phosphor-icons/react";
55
import { CgSpinner } from "react-icons/cg";
66
import { formatTableValue } from "@/utils/format";
77
import React from "react";
88
import toast from "react-hot-toast";
99
import { useRouter } from "next/navigation";
1010
import AddItemModal from "@/components/AddItemModal";
11-
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
1211

1312
interface UnallocatedItemData {
1413
title: string;
@@ -216,10 +215,7 @@ export default function AdminUnallocatedItemsScreen() {
216215
<th className="px-4 py-2 text-left">Quantity</th>
217216
<th className="px-4 py-2 text-left">Expiration</th>
218217
<th className="px-4 py-2 text-left">Unit type</th>
219-
<th className="px-4 py-2 text-left">Qty/Unit</th>
220-
<th className="px-4 py-2 text-left rounded-tr-lg w-12">
221-
Manage
222-
</th>
218+
<th className="px-4 py-2 text-left rounded-tr-lg">Qty/Unit</th>
223219
</tr>
224220
</thead>
225221
<tbody>
@@ -260,41 +256,6 @@ export default function AdminUnallocatedItemsScreen() {
260256
<td className="px-4 py-2">
261257
{formatTableValue(item.quantityPerUnit)}
262258
</td>
263-
<td
264-
className="px-4 py-2"
265-
onClick={(e) => e.stopPropagation()}
266-
>
267-
<Menu as="div" className="float-right relative">
268-
<MenuButton>
269-
<DotsThree weight="bold" />
270-
</MenuButton>
271-
<MenuItems className="absolute right-0 z-10 mt-2 origin-top-right rounded-md bg-white ring-1 shadow-lg ring-black/5 w-max">
272-
<MenuItem
273-
as="button"
274-
className="flex w-full px-3 py-2 text-sm text-gray-700 hover:bg-gray-100"
275-
onClick={() => {
276-
router.push(
277-
`/unallocatedItems/lineItems?${new URLSearchParams(
278-
{
279-
title: item.title,
280-
type: item.type,
281-
unitType: item.unitType,
282-
quantityPerUnit:
283-
item.quantityPerUnit.toString(),
284-
...(item.expirationDate
285-
? { expirationDate: item.expirationDate }
286-
: {}),
287-
}
288-
).toString()}`
289-
);
290-
}}
291-
>
292-
<Eye className="inline-block mr-2" size={22} />
293-
View unique items
294-
</MenuItem>
295-
</MenuItems>
296-
</Menu>
297-
</td>
298259
</tr>
299260
</React.Fragment>
300261
))}

0 commit comments

Comments
 (0)