Skip to content

Feat/restaurant module 15837268278844475554#184

Open
hemidirasim wants to merge 26 commits intoBrainWise-DEV:developfrom
hemidirasim:feat/restaurant-module-15837268278844475554
Open

Feat/restaurant module 15837268278844475554#184
hemidirasim wants to merge 26 commits intoBrainWise-DEV:developfrom
hemidirasim:feat/restaurant-module-15837268278844475554

Conversation

@hemidirasim
Copy link
Copy Markdown

No description provided.

google-labs-jules bot and others added 8 commits March 10, 2026 16:41
- Added Restaurant Area and Restaurant Table doctypes
- Added fields in pos_settings and Sales Invoice to support tracking table and kds status
- Added restaurant store in frontend to handle state and offline caching of tables and areas
- Added TableSelector.vue component in POSSale page to allow selection of empty/occupied tables
- Updated InvoiceCart to show current active table and support sending orders to Kitchen Display System (KDS)
- Added new KDS page with KDSOrderCard components to view orders and update status
- Updated posSync offline logic to sync restaurant tables and areas when enabled

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Added `posa_special_instructions` custom field to Sales Invoice Item doctype to store item modifiers.
- Updated `posCart` store to capture and send `posa_special_instructions` to backend during invoice submission.
- Created `ItemModifiersDialog.vue` to allow cashiers to quickly add pre-defined or custom notes to cart items.
- Added special instructions badge and edit button to items in `InvoiceCart.vue`.
- Updated `KDSOrderCard.vue` to prominently display special instructions on the Kitchen Display System.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Updated app_title in hooks.py
- Updated HTML document title in index.html
- Updated header text and tooltips in POSHeader.vue
- Updated dev/prod websocket socketio_port import logic to gracefully fallback when building outside frappe bench

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Added enable_restaurant_mode and default_restaurant_area to POS_SETTINGS_FIELDS in backend to allow api response
- Updated DEFAULT_POS_SETTINGS with restaurant fields
- Added enableRestaurantMode computed property to frontend posSettings store to correctly evaluate settings state

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Updated TableSelector component to forcefully fetch from the network when local indexedDB cache is empty, ensuring newly created tables in Frappe are visible to the user immediately.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Exported `setRestaurantTable` and `setKdsStatus` actions from the posCart store so that they can be successfully called by components when a table is selected or an order is sent to the kitchen.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Added document hook `on_invoice_update` to Sales Invoice to automatically sync the Restaurant Table status (Occupied, Cleaning, Empty) based on the invoice docstatus.
- Updated `pos_next/fixtures/print_format.json` to visibly render the `restaurant_table` and item `posa_special_instructions` on the printed receipt.
- Verified that `kds_status` and `restaurant_table` correctly flow through the `update_invoice` API when saving Draft/Hold orders, which powers the KDS display.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
@engahmed1190
Copy link
Copy Markdown
Contributor

@MostafaKadry Please check this PR

google-labs-jules bot and others added 18 commits March 10, 2026 19:56
…r kds

- Updated TableSelector.vue to check the draftsStore for an existing draft tied to the selected table. If found, it loads that draft into the cart instead of opening a blank one.
- Updated handleSaveDraft in POSSale.vue to forcefully push the draft invoice to the server via pos_next.api.invoices.update_invoice when a restaurant table is set. This bypasses the typical "offline-first" queue just for KDS orders, ensuring kitchen staff see the order immediately.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Updated TableSelector to always clear the cart when a new table is selected to prevent products from different tables bleeding into each other.
- Moved the active table banner and close table button from InvoiceCart to the main POSSale grid view layout.
- Added 'All' area filter default to the TableSelector view.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Removed the "Draft invoice loaded successfully" toast which triggered too often when selecting tables.
- Updated the "Kitchen" button styling to be more prominent with a purple background instead of outline.
- Ensured "Hold" and "Kitchen" buttons swap depending on whether a restaurant table is actively selected.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Removed unnecessary load draft success toast
- Fixed Kitchen button not rendering correctly by ensuring logic is properly configured to replace 'Hold'
- Added a `hasUnsentChanges` tracker in `posCart` store to track when items are modified.
- Disabled `Checkout` button when a restaurant table is set and there are unsent changes to KDS.
- Disabled `Kitchen` button when no new changes have been made to the cart.
- Added table and KDS status indicators to the Draft Invoices dialog list so waiters can distinguish KDS orders.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Correctly initialized hasUnsentChanges as a reactive ref in posCart.js to prevent "is not defined" errors during item addition or stock validation.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Prevented cart from clearing automatically when holding/sending to KDS if an active table is selected.
- Adjusted KDS sync logic so `posa_special_instructions` are actively preserved and tracked into the Frappe backend.
- Updated footer branding to "Powered by Midiya" linking to midiya.az.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Updated `pos_next.api.restaurant.get_kds_orders` to check if the `posa_special_instructions` column exists before attempting to query it, preventing 500 errors if `bench migrate` was not successfully run.
- Changed filter syntax from `["is", "set"]` to `["!=", ""]` to ensure compatibility across older Frappe versions that do not support the `is` operator natively in all contexts.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Updated `pos_next.api.branding.get_default_config` to return Midiya base64 strings instead of BrainWise.
- Updated `POSFooter.vue` constants to match Midiya strings as the fallback defaults.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
…filter

- Replaced backend API call in `POSFooter.vue` with static variables to permanently force Midiya branding.
- Reworked `get_kds_orders` in `pos_next/api/restaurant.py` to remove the database-level filter on `restaurant_table` which frequently fails to match on MariaDB due to implicit NULL handling with Link fields. Now safely filters in Python.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Updated `pos_next/api/invoices.py` to use a direct `db.set_value` operation to commit `restaurant_table` and `kds_status` immediately after the draft is saved. This bypasses Frappe's strict ORM whitelist logic which occasionally strips custom fields on draft saves if metadata caches are stale.
- Relocated the `kds_status` filtering inside `get_kds_orders` from the SQL layer to the Python logic. This ensures MariaDB does not throw silent index matching errors when checking uninitialized custom column data types.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Added a cache-busting timestamp parameter to the KDS API call in KDS.vue to ensure the PWA service worker and aggressive browser caching do not serve stale empty lists after backend fixes have been deployed.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Added `invoice_doc.reload()` immediately after the manual `db.set_value` injection in `update_invoice`. This resynchronizes the document instance with the latest `modified` timestamp in the database before returning the data to the frontend. Prevents `TimestampMismatchError` during subsequent modifications or checkout.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Resynced invoice document immediately after forcing KDS db values to prevent version mismatch errors when user later submits cart.
- Completely overrode branding validation functions on frontend to force Midiya branding and ignore server telemetry attempts to reset it to BrainWise.
- Reverted KDS filter logic to properly parse orders.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Removed `showSuccess` alerts from routine POS Cart operations such as adding items, removing items, changing UOM, clearing cart, and loading drafts. These repetitive popups were causing notification fatigue for fast-moving cashiers.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Updated `posCart.js` `submitInvoice` action to silently and automatically apply the POS Profile's default customer if no customer was explicitly selected, instead of blocking checkout with an error toast.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Created `/pos/cfd` route which serves a large-format, high-contrast order summary view.
- Updated `posCart.js` to broadcast state changes via `BroadcastChannel` (`pos_cfd_sync`), allowing a secondary browser window to mirror the cart's contents, subtotals, discounts, and grand totals in real time with zero latency.
- Does not require a socket server as it operates entirely client-side via the browser's built-in IPC.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Fixed an issue where removing items from cart failed to reflect in the offer processing engine by properly wrapping `baseRemoveItemFromInvoice`.
- Made Customer Selection implicitly fallback to "Walk-In" or the Profile Default so checkout isn't blocked.
- Re-architected CFD and KDS sync logic: When items change or are sent to the kitchen, the backend now explicitly publishes realtime socket events (`kds_update`, `cfd_update`). The Vue pages dynamically connect via Socket.io to pull these updates with zero latency across browser sessions.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
- Fixed an aliasing bug in `posCart.js` where `removeItem` was incorrectly aliased to `baseRemoveItem` from `useInvoice.js`, causing a silent failure when trying to delete items from the cart.
- Re-aligned the export to point directly to `baseRemoveItemFromInvoice` to properly mutate the reactive item array.

Co-authored-by: hemidirasim <25175153+hemidirasim@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants