Skip to content

Add product return (คืนสินค้า) feature to MARBOHUB POS - #15

Draft
thetigerone888 with Copilot wants to merge 4 commits into
mainfrom
copilot/thetigerone888-fix-issue-12
Draft

Add product return (คืนสินค้า) feature to MARBOHUB POS#15
thetigerone888 with Copilot wants to merge 4 commits into
mainfrom
copilot/thetigerone888-fix-issue-12

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown

Adds a "Return" (คืนสินค้า) order lifecycle stage to the POS app — previously paid orders could only be cancelled (pre-fulfilment), with no way to handle post-payment returns.

marbohub-pos/index.html (frontend JS)

  • q() return handler — mirrors the existing f() cancel function; restores stock via addStock and sets status: "return" with a returned.ts timestamp
  • "↩ คืน" button — appears in the expanded detail of paid orders (with confirm dialog); cancel button remains open-only
  • Filter tab — "คืนสินค้า" tab added between "จ่ายแล้ว" and "ยกเลิก" in the orders screen
  • Status badge — blue "↩ คืนสินค้า" badge, distinct from green (paid) and red (cancel)
  • "all" filter — excludes both cancel and return (shows active pipeline: open + paid)
  • Report — returned orders excluded from revenue/profit calculations; return count shown in the orders summary card via Q = r.filter(n => n.status === "return" && n.ts >= p)

marbohub-pos/api.php (backend)

New atomic returnOrder POST endpoint (consistent with existing addOrder pattern):

  • Finds order by orderId, validates status === "paid" before mutating
  • Returns 409 if status mismatch, 404 if not found, descriptive 400 for missing fields
  • Restores stock overrides atomically under file lock (same semantics as addOrder stock cuts — only adjusts products already present in stockOv)

Copilot AI linked an issue Jul 28, 2026 that may be closed by this pull request
Closed
Copilot AI changed the title [WIP] Fix issue related to Rt Add product return (คืนสินค้า) feature to MARBOHUB POS Jul 28, 2026
Copilot AI requested a review from thetigerone888 July 28, 2026 02:47
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.

Rt

2 participants