Skip to content

Areej - #6

Open
areej-12 wants to merge 6 commits into
mainfrom
Areej
Open

Areej#6
areej-12 wants to merge 6 commits into
mainfrom
Areej

Conversation

@areej-12

@areej-12 areej-12 commented Aug 8, 2026

Copy link
Copy Markdown

Module 2: POS Billing Screen (frontend + backend)

Implements the POS billing screen end to end: display menu items, build a bill,
calculate subtotal/discount/tax/add-on/total, support parallel tickets, and store
each sale.

Summary

  • Menu grid loads items per company and supports category filtering + search
  • Cart with quantities, live line totals, and full money breakdown
  • User-decided discount % and tax %, plus a calculator to add extra/add-on charges
  • Parallel ordering: multiple open tickets, switch/close, checkout closes the ticket
  • Backend endpoints to list items and store a sale (order + line items) in a transaction

Backend

  • GET /api/v1/billing/items — list items for a company (billing.routes/controller/service)
  • POST /api/v1/billing/orders — validate cart, recompute totals from DB prices,
    insert orders + order_items inside a transaction (rollback on failure)
  • Order now stores full breakdown: subtotal, discount_rate, discount_amount, tax_rate, tax_amount, extra_charge, total, payment_method
  • schema.sql: added the columns above; created_at changed DATE → TIMESTAMP
  • Cleaned app.js (removed stray React code), mounted billing router, enabled CORS
  • Added cors dependency

Frontend

  • BillingPage — data owner: fetches items, filter/search, checkout, toasts, ticket tabs
  • useTickets hook — manages multiple independent tickets (cart, tax, discount, add-on)
  • CartPanel — ticket header, cart lines with line totals, payment/discount/calc toggles,
    live summary, Clear All confirm, Checkout
  • Calculator — keypad add-on tool that feeds an extra charge into the bill
  • MenuCard — Rs pricing, in-cart quantity badge + highlight
  • api/client.jsapiGet/apiPost helpers using VITE_API_URL
  • utils/money.jsformatRs() currency formatting (PKR)
  • Router: default route → /sales; JetBrains Mono font

Testing status

  • Frontend flow verified with local/fallback data: menu, filter, search, cart,
    quantities, discount/tax, calculator add-on, parallel tickets, checkout call
  • Backend endpoints implemented but NOT yet verified against a live PostgreSQL
    (DB connection pending). One real end-to-end checkout still needs confirmation.

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.

1 participant