Repository navigation
fix(customers): preserve address on customer edit - #1131
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@greptile review |
|
|
The feature is useful, but I found several issues that should be addressed before merging. 1. Preserve existing customer records The edit form now sends This means editing only a customer's name or phone can fail if they have a legacy over-limit address. Please omit an unchanged address from edit requests. Continue sending it when the user actually changes or clears the address. 2. Fix modal scrolling Adding Address and Notes makes the modal taller. The current centered modal has no viewport height limit or internal scrolling, so the Save button can become unreachable on short screens. Constrain the modal to the available viewport height and allow vertical scrolling. Verify that all fields and buttons remain accessible on a phone in landscape mode. 3. Update the shared Customer type Add the supported 4. Add focused regression coverage Please verify:
The PR currently reports no completed live product validation. Please run the relevant automated tests and actual browser validation, and include the results. Keep the changes focused. Do not alter the database schema, phone validation, or unrelated customer functionality. Avoid unnecessary formatting changes. |
4f0678f to
9dcfba6
Compare
Add bounded address and notes inputs to the customer create/edit modal in frontend/src/app/(dashboard)/customers/page.tsx, wired to existing POST/PUT /api/customers fields and existing i18n keys. Fixes #1084
…idation spec (`frontend/e2e/tmp-issue-1084-validation.spec.ts`), which had hardcoded a local macOS evidence path (`/Users/gurkiratkhaira/.no-mistakes/evidence/01M4VGZA4NATH6B7021QQ5QYGN`) and caused `Playwright E2E (Shard 4/4)`, `End-to-End Playwright Tests`, and `Required Checks Gate` to fail on Linux CI runners with `EACCES: permission denied`. The permanent test coverage for Issue #1084 remains in `tests/customer-top-items-ui.test.ts`
Omit unchanged address on customer edit requests so legacy over-limit addresses do not block unrelated edits, surface backend validation errors when address changes, add notes to shared Customer type, constrain modal height with vertical scrolling, and expand unit and Playwright E2E regression tests. Fixes #1084
9dcfba6 to
8134818
Compare
Fixes #1084
Intent
Verify and implement the surgical fix for FreeOpenSourcePOS/FloCafe issue #1084 ("Customer create/edit modal omits address and notes fields supported by backend"): add
addressandnotesinputs to the customer create/edit modal infrontend/src/app/(dashboard)/customers/page.tsxwired to the existing backendPOST/PUT /api/customersfields and existing i18n keys. Deliver via theno-mistakespipeline as its own PR withFixes #1084in the PR summary.What Changed
addressinput andnotestextarea (500-character limit) to the customer create/edit modal infrontend/src/app/(dashboard)/customers/page.tsx, wired toPOST /api/customersandPUT /api/customers/:idusing existingpos.customerAddress,common.optional, andorders.notesOptionali18n keys, and addednotes?: string | nullto theCustomerinterface infrontend/src/lib/types.ts.addressvalues fromPUT /api/customers/:idpayloads when editing an existing customer so legacy or non-conforming stored addresses do not block unrelated edits, surfaced backend error messages on save failure, and addedmax-h-[90vh] overflow-y-autoso the modal remains scrollable on smaller viewports.tests/customer-top-items-ui.test.tsand Playwright E2E coverage infrontend/e2e/customer-address-round-trip.spec.tsfor creating, editing, clearing, and preserving customeraddressandnotesfields from the/customersmodal.Fixes #1084
Risk Assessment
✅ Low: The change is a small, well-bounded UI update that wires the existing backend customer address and notes fields and existing i18n keys into the Customers page create/edit modal with comprehensive unit and E2E coverage.
Testing
Ran the focused unit/UI test suite (
npm run test:customer-top-items) and stood up the live E2E backend and static desktop frontend to drivee2e/customer-address-round-trip.spec.tsin headless Chromium via Playwright, capturing 6 visual evidence screenshots in~/.no-mistakes/evidence/01M4VV82BC3ZHP3631GY122MEV; all 4 live scenarios and all unit/E2E assertions passed.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm run test:customer-top-itemsEVIDENCE_DIR=~/.no-mistakes/evidence/01M4VV82BC3ZHP3631GY122MEV npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-address-round-trip.spec.ts✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.