Skip to content

Supplier web: Express jobs and printing files from the PC - #330

Merged
rqms40 merged 2 commits into
devfrom
fm/gg-327-web-express
Nov 21, 2026
Merged

rqms40 merged 2 commits into
devfrom
fm/gg-327-web-express

Conversation

@rqms40

@rqms40 rqms40 commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #327 (issue report 35304A2A)

A shop on a PC can now take an Express document job from start to finish in the browser: accept, open and print the file, mark it ready, and hand it over with the client's code. The supplier rail now matches the phone app's four sections. Built against the contract in gridgoph/gridgo-api#419; where an API doesn't have a #419 field yet, the screen falls back cleanly.

What changed

Sidebar (supplier only; Operations and Super Admin are unchanged)

  • Four sections, in the phone's order: To do (Today, All jobs, Schedule, How the shop is doing), Messages, Money (Owner only), and My shop.
  • A shop status pill sits at the top: the shop's name and "Open / Closed · Express on / off". It opens My shop.
  • The header has "Find a job" (opens All jobs filtered by order reference, title, size or material), the light/dark toggle and the bell. The search shows from 768px up; on a phone, All jobs has its own search.
  • No page was deleted; each one was moved. Pages that left the rail (Product types, Services, Capacity, Reviews, Legal, Your data, Report a problem) still have their routes and are linked from My shop (railHidden in nav.ts). The old dashboard moved to /supplier/performance ("How the shop is doing").
  • Supplier home is now /supplier/dashboard (Today), for the Owner and for Staff.

Today

  • An Express "do this first" card shows pages and print settings, pickup or delivery, how the client paid, what the shop earns (Owner only), the five-minute countdown and a big Accept (Dawata, shortcut A). "Can't do it" offers the phone's fixed reasons.
  • Once accepted, the card shows Open files and It's ready (Andam na, shortcut R). When ready for pickup, it shows Type code (Ihatag).
  • Below the cards: After that (every other job's next step), Due today, You earned today (Owner only) and Alerts with sound (the existing Desk chime preference).
  • Only the lead card draws the yellow action; the other cards use the monochrome fill, to keep one yellow per page.

File viewer (/supplier/jobs/:id/files)

  • PDFs and pictures open inside the page, and Print is the main action (Ctrl+P prints the file, not the page around it). Download is the smaller second button.
  • The print settings and the client's note show as chips. The side notes say "print from here, nothing is saved on your PC" and "if you download it, delete it after the job".
  • Opening a file records opened and downloading records downloaded (POST /orders/:id/files/:fileId/access), sending this browser's device id. The signed-link request carries X-GRIDGO-Device-Id.
  • It's ready (R) is also available here and returns to Today.

Hand over

  • A side panel with six boxes. It hands over by itself on the sixth digit; there is nothing to press.
  • A wrong code clears the boxes and says so. Too many tries shows when to try again. It says "Already paid. Don't collect cash." only when the payment was in-app or by voucher.

Done panel

  • Shows "Handed over. Salamat po!" and, for the Owner, what was earned.
  • The delete reminder ("I deleted it/them") appears only if a file was downloaded: a downloaded row from the API, or this browser's own record of a download. If nothing was downloaded, the panel shows "Back to To do".

My shop (Owner only)

  • The Express switch is on top (GET/PATCH /me/express-settings, with the expectedVersion handshake; 409 shop_profile_stale reloads and says so). An API without the switch shows "Express is set on each product for now".
  • Below it: Document updates, then Products, Staff, Hours, Shop details, Shop papers, Where you get paid, and a "More" list of the pages that left the rail.

Staff

  • Staff see Today and All jobs only. They see no money (earnings, payment amounts or You earned today), no Messages and no My shop. Owner-only pages render "Owner only" with "Back to To do".

Small fixes on touched pages

  • Job headers and rows show a readable order reference (3FF0-128E-105A) instead of the raw id.
  • Express rows on All jobs show the work ("24 pages · B&W"), an Express chip and how the client paid. Search on All jobs also matches the order reference and the words Express and Regular.
  • The "Document updates" banner that sat above every supplier page now lives on My shop.
  • The Owner-only screen's button now reads "Back to To do" and goes to Today.
  • It's ready on an older API: when the one-step payment_authorized → ready_for_dispatch is refused (transition_not_allowed), the card sends production then ready_for_dispatch. If GRIDGO wants a photo or its own check first, the card says so and links to the job.
  • A pickup refused with payment_required now says GRIDGO hasn't confirmed the payment, instead of a connection error.
  • The file viewer decides what it may show only from the type GRIDGO detected in the file's bytes, never from the name. It re-types the blob to application/pdf or the image type before drawing it on this origin. SVG, HTML and anything else is download-only.

API gaps and decisions (no stop needed)

  • Word files cannot print from the browser. A browser can't render .docx, so Word files (and anything other than PDF, PNG, JPEG, WebP or GIF) show Download to print as the main action, with a note to delete the file afterwards. The brief said to note this rather than stop.
  • No job id in the API. POST …/files/:fileId/access needs a jobId, but orders don't expose job ids to the shop. The portal reuses the jobId from existing fileAccesses rows, and otherwise sends "", which the API treats as all of this shop's jobs on the order.
  • One-step It's ready needs gridgo-api#419. Before #419 the two-step fallback above runs.
  • "Open on my PC" pairing is out of scope, as the brief says. Nothing in this PR pairs devices.

Screenshots

docs/screenshots/supplier-express/. Names and shop names are anonymised. The #RIG_… references come from seeded test ids; real ids read like 3FF0-128E-105A.

  • Before: before-owner-dashboard-1440, before-owner-dashboard-390, before-owner-express-job-1440, before-staff-jobs-1440
  • Today (Owner): owner-today-offer-desktop-{light,dark}, owner-today-offer-390-{light,dark}
  • The whole job on a PC: flow-1-accepted-by-A → flow-2-viewer-after-download → flow-3-ready-counter → flow-4-code-five-digits → flow-5-done-delete-reminder
  • Viewer: owner-viewer-pdf-desktop-{light,dark}, owner-viewer-pdf-390-light, owner-viewer-word-desktop-light
  • My shop: owner-my-shop-desktop-{light,dark}, owner-my-shop-390-dark
  • Staff: staff-today-1440-{light,dark}, staff-today-390-light, staff-my-shop-owner-only

How it was tested

  • Browser walk: done on a production build of this branch (next build plus the standalone server on a spare port). The API was gridgo-api#419's branch, run on its own scratch Postgres and MinIO, with Express jobs seeded for a dev shop. Nothing touched the shared dev API or database.
    • Owner and Staff, at 1440×900 and 390×844, in light and dark.
    • The flow shots are the real sequence: A accepted, the PDF opened in the page, Download saved the file and recorded downloaded, R marked it ready, typing 012345 handed it over, and the Done panel asked to delete the downloaded file.
    • "Before" shots come from a build of dev.
  • Checks run:
    • npm run typecheck: clean.
    • npm run lint: 0 errors; 2 warnings, both in files this PR doesn't touch.
    • npm test: 401 files, 3,602 tests passed (exit 0, no unhandled errors).
    • npm run build: passes, including the account-address and Clerk-secret scans.
  • New tests:
    • src/lib/__tests__/express-shop.test.ts: stage, payment words, counter code, the delete reminder only after a download, the viewer's type rules and the shortcut guard.
    • src/app/supplier/_components/express/__tests__/express-card.test.tsx: Accept on A but not while typing, the note tick, R ready in one step and the two-step fallback, Staff sees no money, the typed handover on the sixth digit, a wrong code clearing, and the Done panel with and without a download.
    • src/app/supplier/jobs/[id]/files/__tests__/page.test.tsx: the PDF shows with Print first, Print and Ctrl+P print the frame, Download records downloaded, Word is download-only, and R marks ready.
    • src/app/supplier/__tests__/today.test.ts: the Today queue and panels.
    • Existing nav, AppShell, shop-team, routes and legal-gate tests are updated for the new rail and Staff home, including Staff visibility.

Review fixes (second commit)

  • The older API path can always be finished. The job page no longer clears the regular actions just because an order is Express. Once the job is on the press, or the API's readiness check still names a shop step (photos, finished work or GRIDGO's review), the regular steps come back: Send finished work for review, the progress and packing photos, and Ready for rider pickup. Accept and decline stay with the Express card. While they show, the regular step leads, and the card drops its yellow and its A/R shortcuts. expressNeedsRegularSteps in src/lib/express-shop.ts makes that call.
    • Regression test: src/app/supplier/jobs/[id]/__tests__/express-older-api.test.tsx walks the whole older path. The card's It's ready is refused, finished photos are sent, GRIDGO approves, and Ready for rider pickup goes through. With the fix switched off, the test fails.
  • The code field unlocks on time. After too many wrong codes, it now unlocks at GRIDGO's retryAfter time on its own (the timer is cleaned up). A fake-clock test covers it, and it also fails without the fix.
  • Checks after these fixes:
    • npm run typecheck: clean.
    • npm run lint: 0 errors, the same 2 warnings.
    • npm run build: passes.
    • npm test: 402 files, 3,606 tests. The full run had 4 failures in two files this PR doesn't touch (admin/broadcast, orders/inbox-workspace), all 5-second timeouts under load. Both files pass on their own: 8 of 8.

A shop on a PC can now take an Express document job from start to
finish in the browser: accept (A), open and print the file, mark it
ready (R), and hand it over with the client's typed code. The supplier
rail now follows the phone app's four sections: To do, Messages, Money
and My shop. My shop carries the shop-wide Express switch.

- Today: the Express "do this first" card, then After that, Due today,
  You earned today (Owner) and Alerts with sound
- File viewer: PDFs and pictures print in the page; Word files are
  download only; opens and downloads are recorded with the device id
- Hand over: six digits in a side panel, sent on the sixth
- Done panel: the delete-files reminder only after a download
- Staff: Today and All jobs only, with no money anywhere
- Every existing supplier page keeps its route; the old dashboard is
  now "How the shop is doing" at /supplier/performance

Refs #327 (report 35304A2A)
…ield on time

Review fixes for PR #330:

- An Express job's page emptied the regular actions, so on an API that
  still gates Express like a regular job (before gridgo-api#419) the shop
  could never send its finished photos and was stuck. The page now keeps
  the regular steps (minus accept and decline, which the Express card
  owns) once the job is on the press or the API's readiness check still
  names a shop step (expressNeedsRegularSteps). While they are there,
  the regular step leads and the card drops its yellow and its shortcuts.
  A regression test walks the whole older path from the card's It's ready
  to Ready for rider pickup.
- After too many wrong codes, the code field stayed locked past GRIDGO's
  retry time until something else re-rendered. It now unlocks at the
  deadline on its own (timer cleaned up), with a fake-clock test.

Refs #327
@rqms40
rqms40 merged commit 21f2ac7 into dev Nov 21, 2026
6 checks passed
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