Add earnings analytics: payment tracking + sitter dashboard#24
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fact-check pass: guarded INSERT idiom spelled out, paidTotal route glue, icon/error-banner conventions corrected, migration test dropped to match repo convention. Design pass: per-booking payments panel (list + delete), deletePayment scoped to booking id, refund/cancel-after-payment decision documented, isRealDate/isValidRate reuse, pending-deposit semantics, all-time labels. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add client-side validation to prevent submission of zero/negative amounts or empty dates. Validates amount is a positive integer and date is non-empty. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fix 1: paidText now returns null when paidTotal is 0 (no paid text shown until a payment exists). Fix 2: PaymentsPanel mount now gated on row status (cancelled/declined), matching the toggle button condition to prevent stuck-open panels. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The final-task verification gate runs `npm run format`, which caught whitespace-only drift left over from earlier tasks; no behavior change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…working Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ry bounds Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… in panel Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Change outstanding empty state to neutral "No outstanding balances." - Hoist duplicated "No payments recorded yet." to module constant NO_PAYMENTS - Add overflow: hidden with text-overflow: ellipsis to hbars grid cells and list items - Hide SVG bar chart totals when >= 5 digits to prevent overlap Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. Four independent review passes over the 19-file diff (head 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Paymentstable (migration 0008 + schema.sql lockstep): multiple whole-dollar payments per booking (deposits/partials), recorded by the sitter with method/date/note; deleting a record is the correction mechanism (no refunds/negative amounts by design)insertPayment(pending allowed; blocked/cancelled/foreign refused), triple-id-scopeddeletePayment,listPaymentsForBooking,PaidTotaljoin on the bookings list, andgetAnalytics(12-month zero-filled monthly revenue, all-time by-service + top-clients, outstanding balances over confirmed bookings)POST/GET/DELETE /:slug/admin/bookings/:id/payments,GET /:slug/admin/analytics(camelCase payload + JS-derived tiles),paidTotalon the bookings listPaymentsPanel(list + record form + delete), Bookings rows show paid state with an inline panel, and a new Earnings section — stat tiles, hand-rolled 12-month SVG revenue chart, by-service and top-client breakdowns (all-time), outstanding table with inline payment recording. No new dependencies.Design spec:
docs/superpowers/specs/2026-07-11-earnings-analytics-design.md(committed on this branch).Test plan
#earningsdeep-link, fresh-tenant empty statesmigrations/0008_payments.sqlagainst remote D1 on deployKnown follow-ups (deferred by review)
🤖 Generated with Claude Code