From 0d5c650cb424e3abc873f1c11e88a57c43713e06 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Mon, 1 Jan 2024 23:36:13 -0500 Subject: [PATCH 01/41] modified helpers.ts to add new statuses --- .../dashboard/frontend/src/api/helpers.ts | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/api/helpers.ts b/hackathon_site/dashboard/frontend/src/api/helpers.ts index 70f006753..193fbec7b 100644 --- a/hackathon_site/dashboard/frontend/src/api/helpers.ts +++ b/hackathon_site/dashboard/frontend/src/api/helpers.ts @@ -75,7 +75,9 @@ export const teamOrderListSerialization = ( const hardwareInTableRow = Object.values(hardwareItems); if (hardwareInTableRow.length > 0) - (order.status === "Submitted" || order.status === "Ready for Pickup" + (order.status === "Submitted" || + order.status === "Ready for Pickup" || + order.status === "Pending" //TODO: Treating pending orders (aka orders in progress of packing) as "Pending Orders" per table in participant side ? pendingOrders : checkedOutOrders ).push({ @@ -182,11 +184,14 @@ export const sortCheckedOutOrders = ( export const sortPendingOrders = (orders: OrderInTable[]): OrderInTable[] => { let ready_orders = []; let submitted_orders = []; + let pending_orders = []; // Added new array to ensure sorting of pending orders accomodates for the orders with "pending" tag for (let order of orders) { if (order.status === "Ready for Pickup") { ready_orders.push(order); - } else { + } else if (order.status === "Submitted") { submitted_orders.push(order); + } else { + pending_orders.push(order); } } ready_orders.sort((order1, order2) => { @@ -202,7 +207,20 @@ export const sortPendingOrders = (orders: OrderInTable[]): OrderInTable[] => { new Date(order2.updatedTime).valueOf() ); }); + // Sorting pending orders + pending_orders.sort((order1, order2) => { + return ( + new Date(order1.updatedTime).valueOf() - + new Date(order2.updatedTime).valueOf() + ); + }); - orders.splice(0, orders.length, ...submitted_orders, ...ready_orders); + orders.splice( + 0, + orders.length, + ...submitted_orders, + ...ready_orders, + ...pending_orders + ); return orders; }; From 2ea66035aba098d934ee2f3bdb7cc5ce8a9febd8 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Mon, 1 Jan 2024 23:40:19 -0500 Subject: [PATCH 02/41] added rejected order status to types.ts --- hackathon_site/dashboard/frontend/src/api/types.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hackathon_site/dashboard/frontend/src/api/types.ts b/hackathon_site/dashboard/frontend/src/api/types.ts index 0855ea36a..8d5599366 100644 --- a/hackathon_site/dashboard/frontend/src/api/types.ts +++ b/hackathon_site/dashboard/frontend/src/api/types.ts @@ -104,7 +104,8 @@ export type OrderStatus = | "Cancelled" | "Returned" | "Pending" - | "In Progress"; + | "In Progress" + | "Rejected"; //Added new type here export type PartReturnedHealth = "Healthy" | "Heavily Used" | "Broken" | "Lost"; export type ItemsInOrder = Omit; From 435e5a37e060f8f841fd283ce672db6c445a508c Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Mon, 1 Jan 2024 23:41:40 -0500 Subject: [PATCH 03/41] changed comment in types.ts --- hackathon_site/dashboard/frontend/src/api/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackathon_site/dashboard/frontend/src/api/types.ts b/hackathon_site/dashboard/frontend/src/api/types.ts index 8d5599366..73533fd73 100644 --- a/hackathon_site/dashboard/frontend/src/api/types.ts +++ b/hackathon_site/dashboard/frontend/src/api/types.ts @@ -105,7 +105,7 @@ export type OrderStatus = | "Returned" | "Pending" | "In Progress" - | "Rejected"; //Added new type here + | "Rejected"; //TODO: Added "Rejected" here export type PartReturnedHealth = "Healthy" | "Heavily Used" | "Broken" | "Lost"; export type ItemsInOrder = Omit; From c7b27ac384e3b84e3d86dffea8c11e25cd4b93ca Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Mon, 1 Jan 2024 23:44:13 -0500 Subject: [PATCH 04/41] updated helpers.ts comment --- hackathon_site/dashboard/frontend/src/api/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackathon_site/dashboard/frontend/src/api/helpers.ts b/hackathon_site/dashboard/frontend/src/api/helpers.ts index 193fbec7b..b55ac2c24 100644 --- a/hackathon_site/dashboard/frontend/src/api/helpers.ts +++ b/hackathon_site/dashboard/frontend/src/api/helpers.ts @@ -184,7 +184,7 @@ export const sortCheckedOutOrders = ( export const sortPendingOrders = (orders: OrderInTable[]): OrderInTable[] => { let ready_orders = []; let submitted_orders = []; - let pending_orders = []; // Added new array to ensure sorting of pending orders accomodates for the orders with "pending" tag + let pending_orders = []; // Added new array to ensure sorting of pending orders accomodates for the orders with "pending" tag. This likely helps with the order display on the admin + participant table for (let order of orders) { if (order.status === "Ready for Pickup") { ready_orders.push(order); From 37f0b8a3c11a947d5dda7653eda2863dccee4c07 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Mon, 1 Jan 2024 23:45:33 -0500 Subject: [PATCH 05/41] added pink colour to differentiate UI order tags and time tags --- .../dashboard/frontend/src/assets/abstracts/_variables.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss b/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss index 70cada0e3..d5014d6b6 100644 --- a/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss +++ b/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss @@ -19,6 +19,8 @@ $colors: ( blueLight: #c3e1ef, purple: #800080, purpleLight: #cec4f2, + pink: #ff007f, + pinkLight: #ffc0cb, ); $fonts: ( From 515230b71589d3abe0af25984dc9e0363feaef95 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Mon, 1 Jan 2024 23:47:48 -0500 Subject: [PATCH 06/41] added comments --- .../dashboard/frontend/src/assets/abstracts/_variables.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss b/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss index d5014d6b6..fe3897047 100644 --- a/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss +++ b/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss @@ -19,6 +19,7 @@ $colors: ( blueLight: #c3e1ef, purple: #800080, purpleLight: #cec4f2, + // added the pink colours. pink is now used to rep the "Updated at" UI tag. blue is now used to rep the "Pending" order tag (to mirror the order table on admin side created in prior merged PR [IEEE 269]) pink: #ff007f, pinkLight: #ffc0cb, ); From 6ae13b1dafb8b8afeb384b97d267f48e548acad3 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Mon, 1 Jan 2024 23:53:30 -0500 Subject: [PATCH 07/41] commented out line and added orderStatus --- .../frontend/src/components/dashboard/ItemTable/ItemTable.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hackathon_site/dashboard/frontend/src/components/dashboard/ItemTable/ItemTable.tsx b/hackathon_site/dashboard/frontend/src/components/dashboard/ItemTable/ItemTable.tsx index c8a5ad6ff..b766fc9f8 100644 --- a/hackathon_site/dashboard/frontend/src/components/dashboard/ItemTable/ItemTable.tsx +++ b/hackathon_site/dashboard/frontend/src/components/dashboard/ItemTable/ItemTable.tsx @@ -95,9 +95,10 @@ export const CheckedOutTables = () => > Date: Mon, 1 Jan 2024 23:55:26 -0500 Subject: [PATCH 08/41] added pink styling --- .../components/general/OrderTables/OrderTables.module.scss | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.module.scss b/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.module.scss index b54b3bc68..972b2efde 100644 --- a/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.module.scss +++ b/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.module.scss @@ -80,6 +80,13 @@ } } + &Pink { + background-color: color(pinkLight); + svg { + color: color(pink); + } + } + &Blue { background-color: color(blueLight); svg { From d55e7ba2db8b6b99b90943d5ab75ac1a893413be Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Mon, 1 Jan 2024 23:57:29 -0500 Subject: [PATCH 09/41] added new UI chip tag for pending order --- .../general/OrderTables/OrderTables.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.tsx b/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.tsx index a19795da3..38ed4698a 100644 --- a/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.tsx +++ b/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.tsx @@ -10,6 +10,7 @@ import WatchLater from "@material-ui/icons/WatchLater"; import Error from "@material-ui/icons/Error"; import EditIcon from "@material-ui/icons/Edit"; import UpdateIcon from "@material-ui/icons/Update"; +import HourglassEmptyIcon from "@material-ui/icons/HourglassEmpty"; import { Paper, Table, @@ -42,6 +43,15 @@ export const ChipStatus = ({ status }: { status: OrderStatus | "Error" }) => { className={`${styles.chipOrange} ${styles.chip}`} /> ); + //TODO: How is the following case going to be triggered? + case "Pending": + return ( + } + label="Packing order" + className={`${styles.chipBlue} ${styles.chip}`} //Made the colour of this tag blue to match the admin order table colour for the Pending tag + /> + ); case "Error": return ( ( +}: //additionalChipFormatting, //TODO: Commented out since not used +GeneralOrderTableTitleProps) => (
Order #{orderId} @@ -113,7 +123,7 @@ export const GeneralOrderTableTitle = ({ Updated at: , formatDateTime(updatedTime)]} icon={} - className={`${styles.chipBlue} ${styles.chip}`} + className={`${styles.chipPink} ${styles.chip}`} />
) : null} From 830d10dcc47dedf5fe292d448343f55e079d5146 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:00:25 -0500 Subject: [PATCH 10/41] added new status categories --- .../src/components/orders/OrdersFilter/OrderFilter.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx b/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx index 6d0225457..7d22d1d27 100644 --- a/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx +++ b/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx @@ -105,6 +105,15 @@ const OrderFilter = ({ handleReset, handleSubmit }: FormikValues) => { status: "Returned", numOrders: numStatuses["Returned"], }, + { + status: "Pending", // TODO: Pending -> interpreted as "currently building". This alligns with table changes in IEEE 269 + numOrders: numStatuses["Pending"], + }, + + { + status: "Rejected", + numOrders: numStatuses["Rejected"], + }, ]; return ( From f93615015e1d36c179f5b8d69c1d3fccffc0097d Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:04:54 -0500 Subject: [PATCH 11/41] added payload results for new statuses --- .../frontend/src/slices/order/adminOrderSlice.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts b/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts index 82fab7a4c..bcc32b6f7 100644 --- a/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts +++ b/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts @@ -16,6 +16,9 @@ interface numStatuses { "Picked Up"?: number; Cancelled?: number; Returned?: number; + //TODO: New entries added + Pending?: number; + Rejected?: number; } interface adminOrderExtraState { @@ -153,6 +156,18 @@ const adminOrderSlice = createSlice({ "Returned", payload.results ); + + //TODO: COMMENTED OUT MOCK DATA HERE FOR NOW, MAY NEED TO MODIFY SWAGGER ENDPOINT TO FETCH REAL VALUE + // state.numStatuses["Pending"] = 3; //Not sure why the above line works fine... somehow feature was already implemented? + //state.numStatuses["Rejected"] = 21; + state.numStatuses["Pending"] = numOrdersByStatus( + "Pending", + payload.results + ); + state.numStatuses["Rejected"] = numOrdersByStatus( + "Rejected", + payload.results + ); } adminOrderAdapter.setAll(state, payload.results); }); From d52667a384b66ad5f5216bdcc3cdc832d05fb986 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:07:12 -0500 Subject: [PATCH 12/41] added view for pending order in admin table. button incomplete --- .../teamDetail/SimpleOrderTables/SimpleOrderTables.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx index ef0ff82b5..f520b3bf4 100644 --- a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx +++ b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx @@ -222,6 +222,8 @@ export const SimplePendingOrderFulfillmentTable = () => { {pendingOrder.status === "Submitted" && ( )} + {pendingOrder.status === "Pending"} + {/*In above, probably will need to include a button that enables an "Pending" order to be switched status to "Ready for Pickup"*/} {pendingOrder.status === "Ready for Pickup" && ( Date: Tue, 2 Jan 2024 00:07:52 -0500 Subject: [PATCH 13/41] modified comment --- .../teamDetail/SimpleOrderTables/SimpleOrderTables.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx index f520b3bf4..71b920c28 100644 --- a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx +++ b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx @@ -223,7 +223,7 @@ export const SimplePendingOrderFulfillmentTable = () => { )} {pendingOrder.status === "Pending"} - {/*In above, probably will need to include a button that enables an "Pending" order to be switched status to "Ready for Pickup"*/} + {/* TODO: In above, probably will need to include a button that enables an "Pending" order to be switched status to "Ready for Pickup"*/} {pendingOrder.status === "Ready for Pickup" && ( Date: Tue, 2 Jan 2024 00:11:53 -0500 Subject: [PATCH 14/41] changed hardware signout date to ensure testing was possible locally --- hackathon_site/dashboard/frontend/src/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackathon_site/dashboard/frontend/src/constants.js b/hackathon_site/dashboard/frontend/src/constants.js index 2ea30905d..c0554c1e3 100644 --- a/hackathon_site/dashboard/frontend/src/constants.js +++ b/hackathon_site/dashboard/frontend/src/constants.js @@ -3,5 +3,5 @@ export const adminGroup = "Hardware Site Admins"; export const minTeamSize = 2; export const maxTeamSize = 4; export const hardwareSignOutStartDate = new Date(2020, 9, 1, 23, 59); -export const hardwareSignOutEndDate = new Date(2023, 9, 30, 11, 59); +export const hardwareSignOutEndDate = new Date(2024, 9, 30, 11, 59); export const hssTestUserGroup = "HSS Test Users"; From a9776c9086f677c126fcd83f096361dc5a4eccc0 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:14:13 -0500 Subject: [PATCH 15/41] additional changes --- .../dashboard/frontend/src/slices/order/adminOrderSlice.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts b/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts index bcc32b6f7..f1fa21e42 100644 --- a/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts +++ b/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts @@ -157,7 +157,8 @@ const adminOrderSlice = createSlice({ payload.results ); - //TODO: COMMENTED OUT MOCK DATA HERE FOR NOW, MAY NEED TO MODIFY SWAGGER ENDPOINT TO FETCH REAL VALUE + //TODO: COMMENTED OUT MOCK DATA HERE FOR NOW + // TODO: Is using payload.results essentially retrieving the "real data" from the (django?) backend? // state.numStatuses["Pending"] = 3; //Not sure why the above line works fine... somehow feature was already implemented? //state.numStatuses["Rejected"] = 21; state.numStatuses["Pending"] = numOrdersByStatus( From 934c29e3b2b7712e95df742e0113071bafaffbf0 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:15:32 -0500 Subject: [PATCH 16/41] modified pending order selector to fit new order statuses --- .../dashboard/frontend/src/slices/order/teamOrderSlice.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hackathon_site/dashboard/frontend/src/slices/order/teamOrderSlice.ts b/hackathon_site/dashboard/frontend/src/slices/order/teamOrderSlice.ts index 2281071ea..121bf2021 100644 --- a/hackathon_site/dashboard/frontend/src/slices/order/teamOrderSlice.ts +++ b/hackathon_site/dashboard/frontend/src/slices/order/teamOrderSlice.ts @@ -278,7 +278,9 @@ export const pendingOrdersSelector = createSelector( (orders) => orders.filter( (order) => - order.status === "Submitted" || order.status === "Ready for Pickup" + order.status === "Submitted" || + order.status === "Ready for Pickup" || + order.status === "Pending" ) ); From 6fbbe94b6d6b753838f9ff07fb76446bbb77359b Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:22:42 -0500 Subject: [PATCH 17/41] added new status to models.py --- hackathon_site/hardware/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hackathon_site/hardware/models.py b/hackathon_site/hardware/models.py index 241e5ed9e..9c0296ef0 100644 --- a/hackathon_site/hardware/models.py +++ b/hackathon_site/hardware/models.py @@ -107,6 +107,8 @@ class Order(models.Model): ("Picked Up", "Picked Up"), ("Cancelled", "Cancelled"), ("Returned", "Returned"), + ("Pending", "Pending"), # TODO: ADDED NEW ENTRIES HERE. See this for ref: https://github.com/ieeeuoft/hackathon-template/pull/293/files#diff-b5fcbda10cee3497387c38bdc3a12e6281d696a490b4bbbbce23e0c052baad4d + ("Rejected", "Rejected") ] hardware = models.ManyToManyField(Hardware, through=OrderItem) From 0814664c7ded9ebd7890187806c23b77599d5a54 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:24:55 -0500 Subject: [PATCH 18/41] added files with uncertainties about change --- hackathon_site/hardware/serializers.py | 2 +- hackathon_site/hardware/views.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hackathon_site/hardware/serializers.py b/hackathon_site/hardware/serializers.py index 130ab7468..8ce41586c 100644 --- a/hackathon_site/hardware/serializers.py +++ b/hackathon_site/hardware/serializers.py @@ -160,7 +160,7 @@ def get_team_code(obj: Order): class OrderChangeSerializer(OrderListSerializer): change_options = { - "Submitted": ["Cancelled", "Ready for Pickup"], + "Submitted": ["Cancelled", "Ready for Pickup"], # TODO: Unsure about whether I need to add the status "Pending" and "Rejected" to the list "Ready for Pickup": ["Picked Up"], "Picked Up": ["Returned"], } diff --git a/hackathon_site/hardware/views.py b/hackathon_site/hardware/views.py index c4d1a3992..5ce49acfb 100644 --- a/hackathon_site/hardware/views.py +++ b/hackathon_site/hardware/views.py @@ -40,6 +40,8 @@ logger = logging.getLogger(__name__) +#TODO: Uncertain about whether I need to add the new statuses (and corresponding messages) in here? + ORDER_STATUS_MSG = { "Ready for Pickup": "is Ready for Pickup!", "Picked Up": "has been Picked Up!", From 38849aa5462c018e1cbee798861ff3c68eccfee1 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:34:29 -0500 Subject: [PATCH 19/41] revert changes to type.ts --- hackathon_site/dashboard/frontend/src/api/types.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/api/types.ts b/hackathon_site/dashboard/frontend/src/api/types.ts index 73533fd73..0855ea36a 100644 --- a/hackathon_site/dashboard/frontend/src/api/types.ts +++ b/hackathon_site/dashboard/frontend/src/api/types.ts @@ -104,8 +104,7 @@ export type OrderStatus = | "Cancelled" | "Returned" | "Pending" - | "In Progress" - | "Rejected"; //TODO: Added "Rejected" here + | "In Progress"; export type PartReturnedHealth = "Healthy" | "Heavily Used" | "Broken" | "Lost"; export type ItemsInOrder = Omit; From c8e63ae2e9c19e280636037d539595f410423181 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:35:51 -0500 Subject: [PATCH 20/41] removed rejected order status --- .../src/components/orders/OrdersFilter/OrderFilter.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx b/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx index 7d22d1d27..c8f4b69c5 100644 --- a/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx +++ b/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx @@ -109,11 +109,6 @@ const OrderFilter = ({ handleReset, handleSubmit }: FormikValues) => { status: "Pending", // TODO: Pending -> interpreted as "currently building". This alligns with table changes in IEEE 269 numOrders: numStatuses["Pending"], }, - - { - status: "Rejected", - numOrders: numStatuses["Rejected"], - }, ]; return ( From 7e497faa2d50372dd67b0b50de6c78c6d0c5d1ee Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:37:44 -0500 Subject: [PATCH 21/41] deleted rejected payload --- .../dashboard/frontend/src/slices/order/adminOrderSlice.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts b/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts index f1fa21e42..6677b0c66 100644 --- a/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts +++ b/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts @@ -18,7 +18,6 @@ interface numStatuses { Returned?: number; //TODO: New entries added Pending?: number; - Rejected?: number; } interface adminOrderExtraState { @@ -165,10 +164,6 @@ const adminOrderSlice = createSlice({ "Pending", payload.results ); - state.numStatuses["Rejected"] = numOrdersByStatus( - "Rejected", - payload.results - ); } adminOrderAdapter.setAll(state, payload.results); }); From 34f3023dfb944012a9f49ddf513204d7b0c02dab Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:54:00 -0500 Subject: [PATCH 22/41] renamed pending orders to packing --- hackathon_site/dashboard/frontend/src/api/helpers.ts | 12 ++++++------ hackathon_site/dashboard/frontend/src/api/types.ts | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/api/helpers.ts b/hackathon_site/dashboard/frontend/src/api/helpers.ts index b55ac2c24..018b6c16b 100644 --- a/hackathon_site/dashboard/frontend/src/api/helpers.ts +++ b/hackathon_site/dashboard/frontend/src/api/helpers.ts @@ -77,7 +77,7 @@ export const teamOrderListSerialization = ( if (hardwareInTableRow.length > 0) (order.status === "Submitted" || order.status === "Ready for Pickup" || - order.status === "Pending" //TODO: Treating pending orders (aka orders in progress of packing) as "Pending Orders" per table in participant side + order.status === "Packing" //TODO: Treating "Packing" orders (aka orders in progress of packing) as "Pending Orders" per table in participant side ? pendingOrders : checkedOutOrders ).push({ @@ -184,14 +184,14 @@ export const sortCheckedOutOrders = ( export const sortPendingOrders = (orders: OrderInTable[]): OrderInTable[] => { let ready_orders = []; let submitted_orders = []; - let pending_orders = []; // Added new array to ensure sorting of pending orders accomodates for the orders with "pending" tag. This likely helps with the order display on the admin + participant table + let packing_orders = []; // Added new array to ensure sorting of orders being packed accomodates for the orders with "packing" tag. This likely helps with the order display on the admin + participant table for (let order of orders) { if (order.status === "Ready for Pickup") { ready_orders.push(order); } else if (order.status === "Submitted") { submitted_orders.push(order); } else { - pending_orders.push(order); + packing_orders.push(order); } } ready_orders.sort((order1, order2) => { @@ -207,8 +207,8 @@ export const sortPendingOrders = (orders: OrderInTable[]): OrderInTable[] => { new Date(order2.updatedTime).valueOf() ); }); - // Sorting pending orders - pending_orders.sort((order1, order2) => { + // Sorting packing orders + packing_orders.sort((order1, order2) => { return ( new Date(order1.updatedTime).valueOf() - new Date(order2.updatedTime).valueOf() @@ -220,7 +220,7 @@ export const sortPendingOrders = (orders: OrderInTable[]): OrderInTable[] => { orders.length, ...submitted_orders, ...ready_orders, - ...pending_orders + ...packing_orders ); return orders; }; diff --git a/hackathon_site/dashboard/frontend/src/api/types.ts b/hackathon_site/dashboard/frontend/src/api/types.ts index 0855ea36a..41371a344 100644 --- a/hackathon_site/dashboard/frontend/src/api/types.ts +++ b/hackathon_site/dashboard/frontend/src/api/types.ts @@ -104,7 +104,8 @@ export type OrderStatus = | "Cancelled" | "Returned" | "Pending" - | "In Progress"; + | "In Progress" + | "Packing"; export type PartReturnedHealth = "Healthy" | "Heavily Used" | "Broken" | "Lost"; export type ItemsInOrder = Omit; From 3123f6c08d1e9b592341f05654431545fbee8b34 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:57:00 -0500 Subject: [PATCH 23/41] changed pending to packing --- .../dashboard/frontend/src/assets/abstracts/_variables.scss | 2 +- .../src/components/general/OrderTables/OrderTables.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss b/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss index fe3897047..d8e0e3932 100644 --- a/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss +++ b/hackathon_site/dashboard/frontend/src/assets/abstracts/_variables.scss @@ -19,7 +19,7 @@ $colors: ( blueLight: #c3e1ef, purple: #800080, purpleLight: #cec4f2, - // added the pink colours. pink is now used to rep the "Updated at" UI tag. blue is now used to rep the "Pending" order tag (to mirror the order table on admin side created in prior merged PR [IEEE 269]) + // added the pink colours. pink is now used to rep the "Updated at" UI tag. blue is now used to rep the "Packing" order tag (to mirror the order table on admin side created in prior merged PR [IEEE 269]) pink: #ff007f, pinkLight: #ffc0cb, ); diff --git a/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.tsx b/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.tsx index 38ed4698a..507d7bab3 100644 --- a/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.tsx +++ b/hackathon_site/dashboard/frontend/src/components/general/OrderTables/OrderTables.tsx @@ -44,11 +44,11 @@ export const ChipStatus = ({ status }: { status: OrderStatus | "Error" }) => { /> ); //TODO: How is the following case going to be triggered? - case "Pending": + case "Packing": return ( } - label="Packing order" + label="Packing" className={`${styles.chipBlue} ${styles.chip}`} //Made the colour of this tag blue to match the admin order table colour for the Pending tag /> ); From ae549df3bc5ce5b9cee3b16faa31dee6e48145d2 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Thu, 4 Jan 2024 00:10:52 -0500 Subject: [PATCH 24/41] changed pending orders to packing, changed migrations too --- .../src/components/orders/OrdersFilter/OrderFilter.tsx | 4 ++-- .../teamDetail/SimpleOrderTables/SimpleOrderTables.tsx | 2 +- .../dashboard/frontend/src/slices/order/adminOrderSlice.ts | 6 +++--- .../dashboard/frontend/src/slices/order/teamOrderSlice.ts | 2 +- hackathon_site/hardware/models.py | 3 +-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx b/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx index c8f4b69c5..19d310316 100644 --- a/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx +++ b/hackathon_site/dashboard/frontend/src/components/orders/OrdersFilter/OrderFilter.tsx @@ -106,8 +106,8 @@ const OrderFilter = ({ handleReset, handleSubmit }: FormikValues) => { numOrders: numStatuses["Returned"], }, { - status: "Pending", // TODO: Pending -> interpreted as "currently building". This alligns with table changes in IEEE 269 - numOrders: numStatuses["Pending"], + status: "Packing", // TODO: Packing -> interpreted as "currently building". This alligns with table changes in IEEE 269 + numOrders: numStatuses["Packing"], }, ]; diff --git a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx index 71b920c28..5a60e6a76 100644 --- a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx +++ b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx @@ -222,7 +222,7 @@ export const SimplePendingOrderFulfillmentTable = () => { {pendingOrder.status === "Submitted" && ( )} - {pendingOrder.status === "Pending"} + {pendingOrder.status === "Packing"} {/* TODO: In above, probably will need to include a button that enables an "Pending" order to be switched status to "Ready for Pickup"*/} {pendingOrder.status === "Ready for Pickup" && ( diff --git a/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts b/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts index 6677b0c66..56ac5f1c8 100644 --- a/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts +++ b/hackathon_site/dashboard/frontend/src/slices/order/adminOrderSlice.ts @@ -17,7 +17,7 @@ interface numStatuses { Cancelled?: number; Returned?: number; //TODO: New entries added - Pending?: number; + Packing?: number; } interface adminOrderExtraState { @@ -160,8 +160,8 @@ const adminOrderSlice = createSlice({ // TODO: Is using payload.results essentially retrieving the "real data" from the (django?) backend? // state.numStatuses["Pending"] = 3; //Not sure why the above line works fine... somehow feature was already implemented? //state.numStatuses["Rejected"] = 21; - state.numStatuses["Pending"] = numOrdersByStatus( - "Pending", + state.numStatuses["Packing"] = numOrdersByStatus( + "Packing", payload.results ); } diff --git a/hackathon_site/dashboard/frontend/src/slices/order/teamOrderSlice.ts b/hackathon_site/dashboard/frontend/src/slices/order/teamOrderSlice.ts index 121bf2021..7af8ca8cf 100644 --- a/hackathon_site/dashboard/frontend/src/slices/order/teamOrderSlice.ts +++ b/hackathon_site/dashboard/frontend/src/slices/order/teamOrderSlice.ts @@ -280,7 +280,7 @@ export const pendingOrdersSelector = createSelector( (order) => order.status === "Submitted" || order.status === "Ready for Pickup" || - order.status === "Pending" + order.status === "Packing" ) ); diff --git a/hackathon_site/hardware/models.py b/hackathon_site/hardware/models.py index 9c0296ef0..96251faa6 100644 --- a/hackathon_site/hardware/models.py +++ b/hackathon_site/hardware/models.py @@ -107,8 +107,7 @@ class Order(models.Model): ("Picked Up", "Picked Up"), ("Cancelled", "Cancelled"), ("Returned", "Returned"), - ("Pending", "Pending"), # TODO: ADDED NEW ENTRIES HERE. See this for ref: https://github.com/ieeeuoft/hackathon-template/pull/293/files#diff-b5fcbda10cee3497387c38bdc3a12e6281d696a490b4bbbbce23e0c052baad4d - ("Rejected", "Rejected") + ("Packing", "Packing"), # TODO: ADDED NEW ENTRIES HERE. See this for ref: https://github.com/ieeeuoft/hackathon-template/pull/293/files#diff-b5fcbda10cee3497387c38bdc3a12e6281d696a490b4bbbbce23e0c052baad4d ] hardware = models.ManyToManyField(Hardware, through=OrderItem) From 1fd1436b376a91081b0eb9aa88f779501d911b2d Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Thu, 4 Jan 2024 00:24:38 -0500 Subject: [PATCH 25/41] made ui label changes to orders table on admin side --- hackathon_site/dashboard/frontend/src/api/orders.ts | 13 +++++++------ .../orders/OrdersTable/OrdersTable.module.scss | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/api/orders.ts b/hackathon_site/dashboard/frontend/src/api/orders.ts index 6a168cfdd..bff20f563 100644 --- a/hackathon_site/dashboard/frontend/src/api/orders.ts +++ b/hackathon_site/dashboard/frontend/src/api/orders.ts @@ -3,8 +3,9 @@ import ReadyForPickupIcon from "assets/images/icons/statusIcons/readyforpickup-s import PickedUpIcon from "assets/images/icons/statusIcons/checkout-status.svg"; import CancelledIcon from "assets/images/icons/statusIcons/cancelled-status.svg"; import ReturnedIcon from "assets/images/icons/statusIcons/checkout-status.svg"; -import PendingIcon from "assets/images/icons/statusIcons/pending-status.svg"; -import InProgressIcon from "assets/images/icons/statusIcons/inprogress-status.svg"; +import PackingIcon from "assets/images/icons/statusIcons/pending-status.svg"; +//TODO: A low-priority task, but perhaps looking into changing the PackingIcon to be a more accurate fit +//import InProgressIcon from "assets/images/icons/statusIcons/inprogress-status.svg"; import styles from "components/orders/OrdersTable/OrdersTable.module.scss"; @@ -14,8 +15,8 @@ export const statusIconMap: { [key: string]: string } = { PickedUp: PickedUpIcon, Cancelled: CancelledIcon, Returned: ReturnedIcon, - Pending: PendingIcon, - InProgress: InProgressIcon, + Packing: PackingIcon, + //InProgress: InProgressIcon, //Commented out since we likely don't need this status anymore (Packing should mean the same thing as "In Progress?") }; export const statusStylesMap: { [key: string]: string } = { @@ -24,6 +25,6 @@ export const statusStylesMap: { [key: string]: string } = { PickedUp: styles.PickedUpIcon, Cancelled: styles.CancelledIcon, Returned: styles.ReturnedIcon, - Pending: styles.PendingIcon, - InProgress: styles.InProgressIcon, + Packing: styles.PackingIcon, + //InProgress: styles.InProgressIcon, //Commented out since we likely don't need this status anymore (Packing should mean the same thing as "In Progress?") }; diff --git a/hackathon_site/dashboard/frontend/src/components/orders/OrdersTable/OrdersTable.module.scss b/hackathon_site/dashboard/frontend/src/components/orders/OrdersTable/OrdersTable.module.scss index eabbb68ac..b62d393da 100644 --- a/hackathon_site/dashboard/frontend/src/components/orders/OrdersTable/OrdersTable.module.scss +++ b/hackathon_site/dashboard/frontend/src/components/orders/OrdersTable/OrdersTable.module.scss @@ -48,7 +48,7 @@ background-color: #d9d9d9; } -.PendingIcon { +.PackingIcon { color: #2b7bbc; background-color: #c3e1ef; } From 91588b3b30fdf0d440811a4c1aa98e52168988e7 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Thu, 4 Jan 2024 00:37:37 -0500 Subject: [PATCH 26/41] modified django backend files --- hackathon_site/hardware/serializers.py | 2 +- hackathon_site/hardware/views.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hackathon_site/hardware/serializers.py b/hackathon_site/hardware/serializers.py index 8ce41586c..596b651f3 100644 --- a/hackathon_site/hardware/serializers.py +++ b/hackathon_site/hardware/serializers.py @@ -160,7 +160,7 @@ def get_team_code(obj: Order): class OrderChangeSerializer(OrderListSerializer): change_options = { - "Submitted": ["Cancelled", "Ready for Pickup"], # TODO: Unsure about whether I need to add the status "Pending" and "Rejected" to the list + "Submitted": ["Cancelled", "Ready for Pickup", "Packing"], # TODO: Unsure about whether I need to add the status "Pending" and "Rejected" to the list "Ready for Pickup": ["Picked Up"], "Picked Up": ["Returned"], } diff --git a/hackathon_site/hardware/views.py b/hackathon_site/hardware/views.py index 5ce49acfb..92ecb0c24 100644 --- a/hackathon_site/hardware/views.py +++ b/hackathon_site/hardware/views.py @@ -40,13 +40,14 @@ logger = logging.getLogger(__name__) -#TODO: Uncertain about whether I need to add the new statuses (and corresponding messages) in here? +# TODO: What is the difference between ORDER_STATUS_MSG and ORDER_STATUS_CLOSING_MSG ORDER_STATUS_MSG = { "Ready for Pickup": "is Ready for Pickup!", "Picked Up": "has been Picked Up!", "Cancelled": f"was Cancelled by a {settings.HACKATHON_NAME} Exec.", "Returned": f"has been returned.", + "Packing": f"is being packed!", #TODO: Have yet to test this change } ORDER_STATUS_CLOSING_MSG = { @@ -54,6 +55,7 @@ "Picked Up": "Take good care of your hardware and Happy Hacking! Remember to return the items when you are finished using them.", "Cancelled": f"A {settings.HACKATHON_NAME} exec will be in contact with you shortly. If you don't hear back from them soon, please go to the Tech Team Station for more information on why your order was cancelled.", "Returned": f"Thank you for returning all hardware items!", + "Packed": f"Your hardware order is being packed!", } From 280601107c426355c53b72cc3ad5df74f2cc52d2 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 7 Jan 2024 21:18:45 -0500 Subject: [PATCH 27/41] added files --- .../migrations/0012_alter_order_status.py | 18 ++++++++++++++++++ .../migrations/0013_alter_order_status.py | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 hackathon_site/hardware/migrations/0012_alter_order_status.py create mode 100644 hackathon_site/hardware/migrations/0013_alter_order_status.py diff --git a/hackathon_site/hardware/migrations/0012_alter_order_status.py b/hackathon_site/hardware/migrations/0012_alter_order_status.py new file mode 100644 index 000000000..ea461b822 --- /dev/null +++ b/hackathon_site/hardware/migrations/0012_alter_order_status.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.15 on 2024-01-01 04:52 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hardware', '0011_alter_order_team'), + ] + + operations = [ + migrations.AlterField( + model_name='order', + name='status', + field=models.CharField(choices=[('Submitted', 'Submitted'), ('Ready for Pickup', 'Ready for Pickup'), ('Picked Up', 'Picked Up'), ('Cancelled', 'Cancelled'), ('Returned', 'Returned'), ('Pending', 'Pending'), ('Rejected', 'Rejected')], default='Submitted', max_length=64), + ), + ] diff --git a/hackathon_site/hardware/migrations/0013_alter_order_status.py b/hackathon_site/hardware/migrations/0013_alter_order_status.py new file mode 100644 index 000000000..00580e6b2 --- /dev/null +++ b/hackathon_site/hardware/migrations/0013_alter_order_status.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.15 on 2024-01-04 05:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hardware', '0012_alter_order_status'), + ] + + operations = [ + migrations.AlterField( + model_name='order', + name='status', + field=models.CharField(choices=[('Submitted', 'Submitted'), ('Ready for Pickup', 'Ready for Pickup'), ('Picked Up', 'Picked Up'), ('Cancelled', 'Cancelled'), ('Returned', 'Returned'), ('Packing', 'Packing')], default='Submitted', max_length=64), + ), + ] From 4331948bf903979ce132a64ef4acf5662b321129 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 7 Jan 2024 21:19:39 -0500 Subject: [PATCH 28/41] finish commit --- .../SimpleOrderTables/SimpleOrderTables.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx index 5a60e6a76..6ca0c8692 100644 --- a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx +++ b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx @@ -149,6 +149,7 @@ export const SimplePendingOrderFulfillmentTable = () => { const toggleVisibility = () => setVisibility(!isVisible); const updateOrder = (orderId: number, status: OrderStatus) => { + // TODO: For some reason after pressing the COMPLETE ORDER button for "Packing" orders, the website goes white. Is this an issue with the endpoint or this method? const updateOrderData: UpdateOrderAttributes = { id: orderId, status: status, @@ -192,7 +193,7 @@ export const SimplePendingOrderFulfillmentTable = () => { @@ -202,7 +203,7 @@ export const SimplePendingOrderFulfillmentTable = () => { spacing={1} style={{ marginTop: "10px" }} > - {pendingOrder.status === "Submitted" && ( + {pendingOrder.status === "Submitted" && ( //Will not need to add this to the packing orders, since there is no reason to reject an order that is already being packed. )} + {pendingOrder.status === "Submitted" && ( )} - {pendingOrder.status === "Packing"} - {/* TODO: In above, probably will need to include a button that enables an "Pending" order to be switched status to "Ready for Pickup"*/} + {pendingOrder.status === "Packing" && ( + + )} + {/* TODO: In above, this adds the "Complete Order" button on the admin side for all orders with "Packing status". Intended to switch status to: "Ready for Pickup"*/} {pendingOrder.status === "Ready for Pickup" && ( Date: Sun, 7 Jan 2024 21:55:06 -0500 Subject: [PATCH 29/41] changes --- .../SimpleOrderTables/SimpleOrderTables.tsx | 49 ++++++++++++++++++- hackathon_site/hardware/serializers.py | 5 +- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx index 6ca0c8692..443394f06 100644 --- a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx +++ b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx @@ -222,10 +222,55 @@ export const SimplePendingOrderFulfillmentTable = () => { )} {pendingOrder.status === "Submitted" && ( - + + + + + + + )} + {/*/!*{pendingOrder.status === "Packing" && (*!/ Not needed*/} + {/* */} + {/*)}*/} {pendingOrder.status === "Packing" && ( - + + + + + + + )} {/* TODO: In above, this adds the "Complete Order" button on the admin side for all orders with "Packing status". Intended to switch status to: "Ready for Pickup"*/} {pendingOrder.status === "Ready for Pickup" && ( diff --git a/hackathon_site/hardware/serializers.py b/hackathon_site/hardware/serializers.py index 596b651f3..9b9103887 100644 --- a/hackathon_site/hardware/serializers.py +++ b/hackathon_site/hardware/serializers.py @@ -158,11 +158,12 @@ def get_team_code(obj: Order): return obj.team.team_code if obj.team else None -class OrderChangeSerializer(OrderListSerializer): +class OrderChangeSerializer(OrderListSerializer): # TODO: Modified flow of serializers change_options = { - "Submitted": ["Cancelled", "Ready for Pickup", "Packing"], # TODO: Unsure about whether I need to add the status "Pending" and "Rejected" to the list + "Submitted": ["Cancelled", "Packing"], # TODO: Unsure about whether I need to add the status "Pending" and "Rejected" to the list "Ready for Pickup": ["Picked Up"], "Picked Up": ["Returned"], + "Packing": ["Ready for Pickup"] } class Meta: From e65b57bba1ff8230173f9bfd06cd7f9307c68e30 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 7 Jan 2024 21:55:46 -0500 Subject: [PATCH 30/41] add helpers --- hackathon_site/dashboard/frontend/src/api/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackathon_site/dashboard/frontend/src/api/helpers.ts b/hackathon_site/dashboard/frontend/src/api/helpers.ts index 018b6c16b..2be346da4 100644 --- a/hackathon_site/dashboard/frontend/src/api/helpers.ts +++ b/hackathon_site/dashboard/frontend/src/api/helpers.ts @@ -190,7 +190,7 @@ export const sortPendingOrders = (orders: OrderInTable[]): OrderInTable[] => { ready_orders.push(order); } else if (order.status === "Submitted") { submitted_orders.push(order); - } else { + } else if (order.status === "Packing") { packing_orders.push(order); } } From 08e071adc762b7e0fdca9b0e0671b6d1d8a7402e Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Fri, 12 Jan 2024 00:08:02 -0500 Subject: [PATCH 31/41] resolved key issue in views.py --- hackathon_site/hardware/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackathon_site/hardware/views.py b/hackathon_site/hardware/views.py index 92ecb0c24..008f2019b 100644 --- a/hackathon_site/hardware/views.py +++ b/hackathon_site/hardware/views.py @@ -55,7 +55,7 @@ "Picked Up": "Take good care of your hardware and Happy Hacking! Remember to return the items when you are finished using them.", "Cancelled": f"A {settings.HACKATHON_NAME} exec will be in contact with you shortly. If you don't hear back from them soon, please go to the Tech Team Station for more information on why your order was cancelled.", "Returned": f"Thank you for returning all hardware items!", - "Packed": f"Your hardware order is being packed!", + "Packing": f"Your hardware order is being packed!", } From f29f40e1e4333291a7ebbbea0053f806f69d6732 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Fri, 12 Jan 2024 00:44:02 -0500 Subject: [PATCH 32/41] fixed checkmark box bug, added and revised comments --- .../SimpleOrderTables/SimpleOrderTables.tsx | 42 ++++++++++--------- hackathon_site/hardware/views.py | 2 +- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx index 443394f06..a734e738a 100644 --- a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx +++ b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.tsx @@ -149,7 +149,6 @@ export const SimplePendingOrderFulfillmentTable = () => { const toggleVisibility = () => setVisibility(!isVisible); const updateOrder = (orderId: number, status: OrderStatus) => { - // TODO: For some reason after pressing the COMPLETE ORDER button for "Packing" orders, the website goes white. Is this an issue with the endpoint or this method? const updateOrderData: UpdateOrderAttributes = { id: orderId, status: status, @@ -193,7 +192,7 @@ export const SimplePendingOrderFulfillmentTable = () => { @@ -221,6 +220,7 @@ export const SimplePendingOrderFulfillmentTable = () => { )} + {/* On Admin side: The code below adds a button that changes "Submitted" status => "Packing"*/} {pendingOrder.status === "Submitted" && ( { > + + {/*Commented out the code below since it caused a bug where if someone doesn't select all orders prior to pressing button, order status changes... */} + {/**/} + {/* updateOrder(*/} + {/* pendingOrder.id,*/} + {/* "Ready for Pickup"*/} + {/* )*/} + {/* }*/} + {/*>*/} + {/* Complete order*/} + {/**/} )} - {/* TODO: In above, this adds the "Complete Order" button on the admin side for all orders with "Packing status". Intended to switch status to: "Ready for Pickup"*/} {pendingOrder.status === "Ready for Pickup" && ( Date: Sun, 14 Jan 2024 15:09:16 -0500 Subject: [PATCH 33/41] minor comment and formatting changes --- hackathon_site/hardware/models.py | 4 +++- hackathon_site/hardware/serializers.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hackathon_site/hardware/models.py b/hackathon_site/hardware/models.py index 96251faa6..82a99e6d8 100644 --- a/hackathon_site/hardware/models.py +++ b/hackathon_site/hardware/models.py @@ -107,7 +107,9 @@ class Order(models.Model): ("Picked Up", "Picked Up"), ("Cancelled", "Cancelled"), ("Returned", "Returned"), - ("Packing", "Packing"), # TODO: ADDED NEW ENTRIES HERE. See this for ref: https://github.com/ieeeuoft/hackathon-template/pull/293/files#diff-b5fcbda10cee3497387c38bdc3a12e6281d696a490b4bbbbce23e0c052baad4d + ("Packing", "Packing",), + # TODO: ADDED NEW ENTRIES HERE. + # See ref: https://github.com/ieeeuoft/hackathon-template/pull/293/files#diff-b5fcbda10cee3497387c38bdc3a12e6281d696a490b4bbbbce23e0c052baad4d ] hardware = models.ManyToManyField(Hardware, through=OrderItem) diff --git a/hackathon_site/hardware/serializers.py b/hackathon_site/hardware/serializers.py index 9b9103887..5688e5efb 100644 --- a/hackathon_site/hardware/serializers.py +++ b/hackathon_site/hardware/serializers.py @@ -158,12 +158,12 @@ def get_team_code(obj: Order): return obj.team.team_code if obj.team else None -class OrderChangeSerializer(OrderListSerializer): # TODO: Modified flow of serializers +class OrderChangeSerializer(OrderListSerializer): # TODO: Modified flow of serializers change_options = { - "Submitted": ["Cancelled", "Packing"], # TODO: Unsure about whether I need to add the status "Pending" and "Rejected" to the list + "Submitted": ["Cancelled", "Packing"], "Ready for Pickup": ["Picked Up"], "Picked Up": ["Returned"], - "Packing": ["Ready for Pickup"] + "Packing": ["Ready for Pickup"], } class Meta: From 66d3d1100067c090ebdda8c571475d43bbdf2293 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 14 Jan 2024 15:12:33 -0500 Subject: [PATCH 34/41] added todo comment and fixed formatting of migration files --- .../migrations/0012_alter_order_status.py | 22 ++++++++++++++----- .../migrations/0013_alter_order_status.py | 21 +++++++++++++----- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/hackathon_site/hardware/migrations/0012_alter_order_status.py b/hackathon_site/hardware/migrations/0012_alter_order_status.py index ea461b822..343dff3da 100644 --- a/hackathon_site/hardware/migrations/0012_alter_order_status.py +++ b/hackathon_site/hardware/migrations/0012_alter_order_status.py @@ -2,17 +2,29 @@ from django.db import migrations, models - +# TODO: Between this, the 0013 and 0011 .py files, decide which to keep class Migration(migrations.Migration): dependencies = [ - ('hardware', '0011_alter_order_team'), + ("hardware", "0011_alter_order_team"), ] operations = [ migrations.AlterField( - model_name='order', - name='status', - field=models.CharField(choices=[('Submitted', 'Submitted'), ('Ready for Pickup', 'Ready for Pickup'), ('Picked Up', 'Picked Up'), ('Cancelled', 'Cancelled'), ('Returned', 'Returned'), ('Pending', 'Pending'), ('Rejected', 'Rejected')], default='Submitted', max_length=64), + model_name="order", + name="status", + field=models.CharField( + choices=[ + ("Submitted", "Submitted"), + ("Ready for Pickup", "Ready for Pickup"), + ("Picked Up", "Picked Up"), + ("Cancelled", "Cancelled"), + ("Returned", "Returned"), + ("Pending", "Pending"), + ("Rejected", "Rejected"), + ], + default="Submitted", + max_length=64, + ), ), ] diff --git a/hackathon_site/hardware/migrations/0013_alter_order_status.py b/hackathon_site/hardware/migrations/0013_alter_order_status.py index 00580e6b2..e706d0398 100644 --- a/hackathon_site/hardware/migrations/0013_alter_order_status.py +++ b/hackathon_site/hardware/migrations/0013_alter_order_status.py @@ -2,17 +2,28 @@ from django.db import migrations, models - +# TODO: Between this, the 0012 and 0011 .py files, decide which to keep class Migration(migrations.Migration): dependencies = [ - ('hardware', '0012_alter_order_status'), + ("hardware", "0012_alter_order_status"), ] operations = [ migrations.AlterField( - model_name='order', - name='status', - field=models.CharField(choices=[('Submitted', 'Submitted'), ('Ready for Pickup', 'Ready for Pickup'), ('Picked Up', 'Picked Up'), ('Cancelled', 'Cancelled'), ('Returned', 'Returned'), ('Packing', 'Packing')], default='Submitted', max_length=64), + model_name="order", + name="status", + field=models.CharField( + choices=[ + ("Submitted", "Submitted"), + ("Ready for Pickup", "Ready for Pickup"), + ("Picked Up", "Picked Up"), + ("Cancelled", "Cancelled"), + ("Returned", "Returned"), + ("Packing", "Packing"), + ], + default="Submitted", + max_length=64, + ), ), ] From ff10be9eeff720b6f2f2c86f7686ab43f67e751f Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 14 Jan 2024 15:18:33 -0500 Subject: [PATCH 35/41] testing if this change helped pass api tests --- hackathon_site/event/test_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hackathon_site/event/test_api.py b/hackathon_site/event/test_api.py index a19e15c71..01cc81890 100644 --- a/hackathon_site/event/test_api.py +++ b/hackathon_site/event/test_api.py @@ -188,7 +188,7 @@ def test_cannot_leave_with_order(self): for _, status_choice in Order.STATUS_CHOICES: order.status = status_choice order.save() - if status_choice not in ("Cancelled", "Returned"): + if status_choice not in ("Cancelled", "Returned", "Packing"): #TODO: Added the "Packing" status here self.check_cannot_leave_active() else: self.check_can_leave_cancelled_or_returned() From 9194b0c2527c2715e5287197b214129cfba83730 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 14 Jan 2024 15:19:03 -0500 Subject: [PATCH 36/41] formatted file --- hackathon_site/event/test_api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hackathon_site/event/test_api.py b/hackathon_site/event/test_api.py index 01cc81890..4a527812c 100644 --- a/hackathon_site/event/test_api.py +++ b/hackathon_site/event/test_api.py @@ -188,7 +188,11 @@ def test_cannot_leave_with_order(self): for _, status_choice in Order.STATUS_CHOICES: order.status = status_choice order.save() - if status_choice not in ("Cancelled", "Returned", "Packing"): #TODO: Added the "Packing" status here + if status_choice not in ( + "Cancelled", + "Returned", + "Packing", + ): # TODO: Added the "Packing" status here self.check_cannot_leave_active() else: self.check_can_leave_cancelled_or_returned() From 4ee7c349e6edd2074b2264bbbcdf077e448e121e Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 14 Jan 2024 15:39:26 -0500 Subject: [PATCH 37/41] revert changes to test_api.py --- hackathon_site/event/test_api.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hackathon_site/event/test_api.py b/hackathon_site/event/test_api.py index 4a527812c..a19e15c71 100644 --- a/hackathon_site/event/test_api.py +++ b/hackathon_site/event/test_api.py @@ -188,11 +188,7 @@ def test_cannot_leave_with_order(self): for _, status_choice in Order.STATUS_CHOICES: order.status = status_choice order.save() - if status_choice not in ( - "Cancelled", - "Returned", - "Packing", - ): # TODO: Added the "Packing" status here + if status_choice not in ("Cancelled", "Returned"): self.check_cannot_leave_active() else: self.check_can_leave_cancelled_or_returned() From b2b70cc489e8c96160abbefa7dc873fce3c46c0d Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 14 Jan 2024 15:58:04 -0500 Subject: [PATCH 38/41] revised a test in simpleOrderTable.test.tsx --- .../SimpleOrderTables/SimpleOrderTables.test.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.test.tsx b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.test.tsx index bb26d64d1..0c73071ee 100644 --- a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.test.tsx +++ b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.test.tsx @@ -59,12 +59,15 @@ describe("", () => { } else { expect(getByText(/reject order/i)).toBeInTheDocument(); } - if (status === "Submitted") { + if (status === "Packing") { + /*TODO: Changed from status === "Submitted" to status === "Packing"*/ expect(getByText(/complete order/i)).toBeInTheDocument(); expect(queryByText(/picked up/i)).not.toBeInTheDocument(); - } else { + } else if (status === "Submitted") { expect(queryByText(/complete order/i)).not.toBeInTheDocument(); - expect(getByText(/picked up/i)).toBeInTheDocument(); + expect(queryByText(/ready for packing/i)).toBeInTheDocument(); + //expect(queryByText(/complete order/i)).not.toBeInTheDocument(); + //expect(getByText(/picked up/i)).toBeInTheDocument(); } } }); From 2ef7970c40df3b3d853d3cc17fdad762df12a339 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 14 Jan 2024 16:07:29 -0500 Subject: [PATCH 39/41] modified more tests, made equality check stricter --- .../SimpleOrderTables/SimpleOrderTables.test.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.test.tsx b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.test.tsx index 0c73071ee..617e21a07 100644 --- a/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.test.tsx +++ b/hackathon_site/dashboard/frontend/src/components/teamDetail/SimpleOrderTables/SimpleOrderTables.test.tsx @@ -82,7 +82,8 @@ describe("", () => { const { queryByDisplayValue, getByDisplayValue } = within( getByTestId(`admin-simple-pending-order-${order.id}`) ); - if (order.status == "Submitted") { + if (order.status === "Packing") { + /*TODO: Changed from status === "Submitted" to status === "Packing"*/ order.hardwareInTableRow.forEach(({ id }) => { expect(getByDisplayValue(`hardware-${id}`)).toBeInTheDocument(); }); @@ -104,7 +105,9 @@ describe("", () => { }); mockPendingOrdersInTable - .filter(({ status }) => status === "Submitted") + .filter( + ({ status }) => status === "Packing" + ) /*TODO: Changed from status === "Submitted" to status === "Packing"*/ .map(({ id }) => { const { getByText } = within( getByTestId(`admin-simple-pending-order-${id}`) @@ -119,7 +122,9 @@ describe("", () => { }); const order = mockPendingOrdersInTable.find( - ({ status }) => status === "Submitted" + ({ status }) => + status === + "Packing" /*TODO: Changed from status === "Submitted" to status === "Packing"*/ ); if (order) { @@ -150,7 +155,9 @@ describe("", () => { }); const order = mockPendingOrdersInTable.find( - ({ status }) => status === "Submitted" + ({ status }) => + status === + "Packing" /*TODO: Changed from status === "Submitted" to status === "Packing"*/ ); if (order) { From f74e19142489484e4af902625d8e469da6de9019 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 14 Jan 2024 17:44:28 -0500 Subject: [PATCH 40/41] added a order with packing status to mockData.tsx --- .../dashboard/frontend/src/testing/mockData.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hackathon_site/dashboard/frontend/src/testing/mockData.tsx b/hackathon_site/dashboard/frontend/src/testing/mockData.tsx index 531cf58fe..73ac5f31c 100644 --- a/hackathon_site/dashboard/frontend/src/testing/mockData.tsx +++ b/hackathon_site/dashboard/frontend/src/testing/mockData.tsx @@ -845,6 +845,19 @@ export const mockPendingOrdersInTable: OrderInTable[] = [ createdTime: "2021-10-17T18:28:44.691969-03:00", updatedTime: "2021-10-17T18:28:44.691969-06:00", }, + { + id: 11, + hardwareInTableRow: [ + { + id: 10, + quantityRequested: 2, + quantityGranted: 1, + }, + ], + status: "Packing", + createdTime: "2024-01-17T18:28:44.691969-03:00", + updatedTime: "2024-12-17T18:28:44.691969-06:00", + }, { id: 4, hardwareInTableRow: [ From 5a90474cb24c1d4ba8857b4f677d675a92abdee0 Mon Sep 17 00:00:00 2001 From: carmen-chau <80921817+carmen-chau@users.noreply.github.com> Date: Sun, 14 Jan 2024 18:02:02 -0500 Subject: [PATCH 41/41] added todo comment --- hackathon_site/dashboard/frontend/src/testing/mockData.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hackathon_site/dashboard/frontend/src/testing/mockData.tsx b/hackathon_site/dashboard/frontend/src/testing/mockData.tsx index 73ac5f31c..0a9a9edbb 100644 --- a/hackathon_site/dashboard/frontend/src/testing/mockData.tsx +++ b/hackathon_site/dashboard/frontend/src/testing/mockData.tsx @@ -845,6 +845,8 @@ export const mockPendingOrdersInTable: OrderInTable[] = [ createdTime: "2021-10-17T18:28:44.691969-03:00", updatedTime: "2021-10-17T18:28:44.691969-06:00", }, + + /*TODO NOTE: Removing this new mock order would mean all dashboard test pass. Currently this causes test issues where the cancel order button doesn't work*/ { id: 11, hardwareInTableRow: [