fix(orders): align order status lifecycle between backend and frontend#190
Open
ArshVermaGit wants to merge 4 commits into
Open
fix(orders): align order status lifecycle between backend and frontend#190ArshVermaGit wants to merge 4 commits into
ArshVermaGit wants to merge 4 commits into
Conversation
… Add BILLED status to backend OrderStatus enum - Add BILLED to active order statuses list in OrderServiceImpl - Align all frontend status keys to uppercase backend enum values - Add support for CONFIRMED, SERVED, and CANCELLED statuses on the frontend - Update mock fallback data, dashboard components, and StatusLegend config - Fix commented API paths to target correct secure API endpoints - Deprecate duplicate OrderStatus enum in entity package - Update ProjectDetails.md order lifecycle documentation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns the order status lifecycle across the Java backend and the admin frontend by introducing the missing BILLED backend status and updating the frontend to use uppercase status identifiers compatible with EnumType.STRING, plus adding safer UI fallbacks.
Changes:
- Backend: add
BILLEDtoOrderStatusand include it in “active orders” retrieval; deprecate the duplicate enum underorder.entity. - Frontend: replace lowercase status strings with uppercase enum-aligned values across dashboard components; add status styling coverage and an unknown-status fallback to avoid UI crashes.
- Docs: update the documented order lifecycle flow and payment-flow wording to match the intended status progression.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| RestroHub/src/main/java/com/restroly/qrmenu/order/service/impl/OrderServiceImpl.java | Adds BILLED to the active-status list used by the active orders endpoint. |
| RestroHub/src/main/java/com/restroly/qrmenu/order/entity/OrderStatus.java | Deprecates and aligns the duplicate enum to the canonical status set. |
| RestroHub/src/main/java/com/restroly/qrmenu/common/enums/OrderStatus.java | Adds BILLED("Billed") to the canonical backend enum. |
| RestroHub-FrontEnd/src/components/admin/orders/Orders.jsx | Updates filter tab IDs to uppercase enum values and adds a Cancelled filter. |
| RestroHub-FrontEnd/src/components/admin/orders/orderComponents/StatusLegend.jsx | Updates legend labels (Cooking → Preparing) and adds legend entries for Completed/Cancelled. |
| RestroHub-FrontEnd/src/components/admin/orders/orderComponents/OrdersGrid.jsx | Updates mock statuses to uppercase; updates commented API path; adjusts completed-status handling. |
| RestroHub-FrontEnd/src/components/admin/orders/orderComponents/OrderCard.jsx | Updates status/action configs to uppercase enum values, adds more statuses, and adds a default fallback status. |
| RestroHub-FrontEnd/src/components/admin/dashboard/cards/LiveOrders.jsx | Updates status badge config and fallback feed data to uppercase enum values. |
| ProjectDetails.md | Updates the lifecycle diagram and payment-flow text to reference BILLED. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
|
Hi @ArshVermaGit , |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Author
|
Hi @rdodiya ! The necessary code changes have been made. Please review the PR and merge it under GSSoC. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #188
Description
This PR resolves a latent integration bug where the backend
OrderStatusenum values were completely mismatched with the hardcoded lowercase status strings used on the frontend admin dashboard (e.g.,cookingvsPREPARING, missingBILLEDenum).Once API integration is enabled, these mismatches would cause deserialization failures on status updates and component crashes on the order grid due to undefined status styling properties.
Type of Change
Key Changes
1. Backend Alignment
OrderStatus.java(Canonical): AddedBILLED("Billed")to support the final billing stage before completion.OrderStatus.java(Duplicate): Aligned the duplicate enum under theorder.entitypackage to match the canonical one and marked it@Deprecatedto prevent future misuse.OrderServiceImpl.java: AddedOrderStatus.BILLEDto the list of active statuses ingetActiveOrdersByBranchso billed orders awaiting payment remain visible on the dashboard.2. Frontend Status Alignment
OrderCard.jsx&OrdersGrid.jsx:PENDING,PREPARING,READY,BILLED,COMPLETED).CONFIRMED,SERVED, andCANCELLED.defaultStatusfallback to gracefully handle unknown statuses without crashing./secure/api/v1/orders/...) and corrected the HTTP method toPATCH.LiveOrders.jsx(Dashboard): Updated dashboard feeds, mock status records, and badge helper to align with the new uppercase schema.Orders.jsx&StatusLegend.jsx:displayName.3. Documentation
ProjectDetails.md: Updated the order lifecycle flowchart to reflect the actual agreed-upon flow:Pending → Confirmed → Preparing → Ready → Served → Billed → CompletedVerification & Test Plan
Live Ordersfeed correctly maps all status colorscooking,billed, etc.) remain in any config map or filterundefinedcrashes on the order gridfix/...) fromCONTRIBUTING.md