From a91154e34f21831fcbae7edcb67a0716f0925666 Mon Sep 17 00:00:00 2001 From: amywng <147568742+amywng@users.noreply.github.com> Date: Sun, 8 Feb 2026 17:53:25 -0500 Subject: [PATCH 1/2] fix admin order management and misc fixes --- .../components/forms/orderDetailsModal.tsx | 2 +- .../forms/pantryApplicationModal.tsx | 5 - .../src/containers/adminOrderManagement.tsx | 200 +++++++++--------- apps/frontend/src/types/types.ts | 29 +-- 4 files changed, 120 insertions(+), 116 deletions(-) diff --git a/apps/frontend/src/components/forms/orderDetailsModal.tsx b/apps/frontend/src/components/forms/orderDetailsModal.tsx index 672fefe08..917bc484d 100644 --- a/apps/frontend/src/components/forms/orderDetailsModal.tsx +++ b/apps/frontend/src/components/forms/orderDetailsModal.tsx @@ -63,7 +63,7 @@ const OrderDetailsModal: React.FC = ({ {foodRequest && ( <> - {order.pantry.pantryName} + {order.request.pantry.pantryName} Requested {formatDate(foodRequest.requestedAt)} diff --git a/apps/frontend/src/components/forms/pantryApplicationModal.tsx b/apps/frontend/src/components/forms/pantryApplicationModal.tsx index ceb8179c2..c3f5d150c 100644 --- a/apps/frontend/src/components/forms/pantryApplicationModal.tsx +++ b/apps/frontend/src/components/forms/pantryApplicationModal.tsx @@ -48,11 +48,6 @@ const PantryApplicationModal: React.FC = ({ Phone {pantryUser.phone} - - - Role - - {pantryUser.role} ) : ( No user details available. diff --git a/apps/frontend/src/containers/adminOrderManagement.tsx b/apps/frontend/src/containers/adminOrderManagement.tsx index 60273c428..59da9a657 100644 --- a/apps/frontend/src/containers/adminOrderManagement.tsx +++ b/apps/frontend/src/containers/adminOrderManagement.tsx @@ -120,8 +120,12 @@ const AdminOrderManagement: React.FC = () => { for (const order of data) { const status = order.status; + const orderWithColor: OrderWithColor = { ...order }; - if (order.pantry.volunteers && order.pantry.volunteers.length > 0) { + if ( + order.request.pantry.volunteers && + order.request.pantry.volunteers.length > 0 + ) { orderWithColor.assigneeColor = ASSIGNEE_COLORS[counters[status] % ASSIGNEE_COLORS.length]; counters[status]++; @@ -170,7 +174,7 @@ const AdminOrderManagement: React.FC = () => { // Get pantry options through all orders in the status const pantryOptions = [ - ...new Set(allOrders.map((o) => o.pantry.pantryName)), + ...new Set(allOrders.map((o) => o.request.pantry.pantryName)), ].sort((a, b) => a.localeCompare(b)); // Apply filters and sorting to all orders @@ -178,7 +182,9 @@ const AdminOrderManagement: React.FC = () => { .filter( (o) => filterState.selectedPantries.length === 0 || - filterState.selectedPantries.includes(o.pantry.pantryName), + filterState.selectedPantries.includes( + o.request.pantry.pantryName, + ), ) .sort((a, b) => filterState.sortAsc @@ -589,104 +595,104 @@ const OrderStatusSection: React.FC = ({ - {orders.map((order, index) => ( - - - - {selectedOrderId === order.orderId && ( - onOrderSelect(null)} - /> - )} - - { + const pantry = order.request.pantry; + const volunteers = pantry.volunteers || []; + + return ( + - {order.pantry.pantryName} - - - - {order.pantry.volunteers && - order.pantry.volunteers.length > 0 ? ( - - {/* TODO: Change logic later to only get one volunteer */} - {order.pantry.volunteers[0].firstName - .charAt(0) - .toUpperCase()} - {order.pantry.volunteers[0].lastName - .charAt(0) - .toUpperCase()} - - ) : ( - No Assignees + + {selectedOrderId === order.orderId && ( + onOrderSelect(null)} + /> )} - - - - + - {capitalize(order.status)} - - - - {formatDate(order.createdAt)} - - - ))} + {pantry.pantryName} + + + + {volunteers && volunteers.length > 0 ? ( + + {/* TODO: Change logic later to only get one volunteer */} + {volunteers[0].firstName.charAt(0).toUpperCase()} + {volunteers[0].lastName.charAt(0).toUpperCase()} + + ) : ( + No Assignees + )} + + + + + {capitalize(order.status)} + + + + {formatDate(order.createdAt)} + + + ); + })} diff --git a/apps/frontend/src/types/types.ts b/apps/frontend/src/types/types.ts index 12fd07980..c4d067d3d 100644 --- a/apps/frontend/src/types/types.ts +++ b/apps/frontend/src/types/types.ts @@ -47,7 +47,7 @@ export interface Pantry { secondaryContactPhone?: string; pantryUser?: User; status: PantryStatus; - dateApplied: Date; + dateApplied: string; activities: Activity[]; activitiesComments?: string; itemsInStock: string; @@ -183,8 +183,8 @@ export interface FoodRequest { requestedSize: string; requestedItems: string[]; additionalInformation: string | null; - requestedAt: Date; - dateReceived: Date | null; + requestedAt: string; + dateReceived: string | null; feedback: string | null; photos: string[] | null; orders?: Order[]; @@ -228,7 +228,7 @@ export interface CreateFoodRequestBody { additionalInformation: string | null | undefined; status: string; fulfilledBy: number | null | undefined; - dateReceived: Date | null | undefined; + dateReceived: string | null | undefined; feedback: string | null | undefined; photos: string[] | null | undefined; } @@ -287,14 +287,17 @@ export interface OrderSummary { orderId: number; status: OrderStatus; createdAt: string; - shippedAt: string | null; - deliveredAt: string | null; - pantry: { - pantryName: string; - volunteers?: { - id: number; - firstName: string; - lastName: string; - }[]; + shippedAt?: string; + deliveredAt?: string; + request: { + pantryId: number; + pantry: { + pantryName: string; + volunteers?: { + id: number; + firstName: string; + lastName: string; + }[]; + }; }; } From 1439c4a4062e7d6911894563822225be84a78ff4 Mon Sep 17 00:00:00 2001 From: amywng <147568742+amywng@users.noreply.github.com> Date: Tue, 10 Feb 2026 16:01:09 -0500 Subject: [PATCH 2/2] frontend fixes (cough cough cough cough cough @dalton cough) --- .../src/containers/adminOrderManagement.tsx | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/apps/frontend/src/containers/adminOrderManagement.tsx b/apps/frontend/src/containers/adminOrderManagement.tsx index 59da9a657..e6829dd90 100644 --- a/apps/frontend/src/containers/adminOrderManagement.tsx +++ b/apps/frontend/src/containers/adminOrderManagement.tsx @@ -565,9 +565,9 @@ const OrderStatusSection: React.FC = ({ {...tableHeaderStyles} borderRight="1px solid" borderRightColor="neutral.100" - width="25%" + width="15%" > - Pantry + Status = ({ {...tableHeaderStyles} borderRight="1px solid" borderRightColor="neutral.100" - width="15%" + width="25%" > - Status + Pantry - Date Started + Dates @@ -630,7 +630,18 @@ const OrderStatusSection: React.FC = ({ borderRight="1px solid" borderRightColor="neutral.100" > - {pantry.pantryName} + + {capitalize(order.status)} + = ({ borderRight="1px solid" borderRightColor="neutral.100" > - - {capitalize(order.status)} - + {pantry.pantryName} - {formatDate(order.createdAt)} + {formatDate(order.createdAt)}- + {order.deliveredAt && formatDate(order.deliveredAt)} );