S
Shahram norouzi

Restaurant Menu and Order System

Bootstrap Sales Console shows a menu grid with search filtering and a sticky cart summary. Implements item cards, quantity controls, and a payment modal using Bootstrap layout and components.

LIVE DEMO
Generated using Instruct UI - An AI for Blazor UI Generation
## What's implemented - Menu item grid with image, name, description, price and an Add button. - Instant search/filter input bound with @bind-value and oninput behavior. - In-memory shopping cart with add, remove, increment/decrement quantity controls. - Order summary card with subtotal, tax calculation, total, and action buttons (Place Order, Clear Cart, Payment). - Simple payment modal implemented by toggling a boolean and applying Bootstrap modal classes. ## Key components - HTML input with @bind-value and @bind-value:event="oninput" for search filter. - foreach rendering of MenuItemModel into Bootstrap card elements. - Buttons with @onclick and @onclick:stopPropagation for card vs button clicks. - Modal markup using Bootstrap classes and a boolean (isPaymentModalOpen) to show/hide. - Properties and methods: FilteredMenuItems (LINQ), AddToCart, UpdateQuantity, RemoveItem, ClearCart, PlaceOrder, SubTotal/Tax/Total computed properties. - Models: MenuItemModel, CartItemModel with calculated Total. ## How it works - The search box updates searchTerm on every keystroke; FilteredMenuItems uses LINQ to filter Name/Description. - Clicking a card or the Add button invokes AddToCart; existing cart items increase quantity. - Quantity buttons call UpdateQuantity(change) and remove items when quantity <= 0. - SubTotal, Tax, and Total are computed from CartItems and rendered in the order summary. - Payment modal is shown by setting isPaymentModalOpen and toggles CSS classes (show d-block) rather than using Bootstrap JS. ## Styling - Uses Bootstrap grid and utility classes (container-fluid, row, col-*, card, btn, input-group, form-control) and Font Awesome icons. - Cards use responsive columns (col-md-6, col-xl-4) for desktop-to-mobile layout. - Order summary uses sticky-top for a persistent right column on large viewports. - Modal uses a simple backdrop via inline style and class toggling; no Bootstrap JS dependency is required but recommended for full accessibility. ## Reuse steps 1. Add the Razor file and the MenuModels.cs to a Blazor Server or WebAssembly project; ensure _Host.cshtml or index.html includes Bootstrap and Font Awesome. 2. Import namespaces where needed and add the component to a page or navigation (e.g., <SalesConsole />). 3. Replace the in-memory MenuItems with a service or API: add an interface, register it in Program.cs, and inject it into the component. 4. Persist cart state as required (local storage, scoped service, or server-side session) and implement a payment API for PlaceOrder/OpenPaymentModal. 5. Optional: replace modal CSS toggle with Bootstrap JS or a Blazor modal component for improved accessibility and focus management. ## Limitations & next steps - Payment is a placeholder; no payment gateway integration or server-side order processing is provided. - No validation UI for checkout details and no user authentication or authorization is included. - Modal accessibility and keyboard focus are not fully handled by the CSS toggle approach. - Concurrency, persistence, and error handling require backend services and state management integration. - Next steps: wire a cart service, implement checkout form with validation (EditForm/DataAnnotationsValidator), and connect to a payment API.