Skip to content

Travel: round-trip and guest booking - #14

Closed
vendz wants to merge 54 commits into
mainfrom
feat/travel-guest-adhyayan-roundtrip
Closed

vendz wants to merge 54 commits into
mainfrom
feat/travel-guest-adhyayan-roundtrip

Conversation

@vendz

@vendz vendz commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Travel: round-trip, guest booking & adhyayan question removal

Member app for the travel feature set (pairs with the aashray-backend PR).

What's included

  • Round-trip travel via a room-booking-style date-range calendar (single date = one-way; pick a return date = round trip; return leg is the reverse of the onward route). Available for self, mumukshu, and guest.
  • Guest travel booking flow (new Guest chip + GuestForm), routed through the dynamic guest-booking screen.
  • Removed the self-reported "leaving post adhyayan?" question app-wide (standalone form, add-ons, page initializers, dropdown constant).
  • Add-on date inheritance: travel add-ons and other add-ons inherit the primary booking's date range (a round-trip travel primary propagates its return date as add-on end date); return date has a Clear control.
  • Round-trip is shown on the primary travel cards (swap-horizontal between the two dates).

Review & simplify

Passed a high-recall code review + fixes (return-leg arrival-time clearing, guest add-on date inheritance, add-on end-date order, cleared-one-way persistence) and a simplify pass (shared TravelReturnDateField + TravelDateDisplay components, dead prepareSelfRequestBody removed). expo export clean.

Testing

No unit-test framework in this repo; verified via expo export compile + manual smoke on iOS simulator (one-way, round-trip, guest, add-on inheritance).

🤖 Generated with Claude Code

Update 3 Oct 2026: brought up to date and fixed (not merged)

  • main merged in (SDK 57; main's app.config.js kept).
  • Today's rules kept (owner decisions pending):
    • The "Leaving post Adhyayan?" question stays, and its answer is sent.
    • Vendor is not added to the guest types.
  • Review threads fixed: return state is per chip, and the itinerary handles an empty pickup or drop.
  • The guest travel-only review screen no longer errors: the Adhyayan add-on uses the travel dates when there's no stay.
  • Tested on the iOS simulator against Travel: guest booking, authoritative adhyayan visibility & round-trip aashray-backend#346 locally:
    • a Self round trip gave 2 linked rows;
    • a Guest round trip gave 2 linked rows;
    • one-way and a duplicate one-way were refused;
    • a guest travel-only booking reached review with no error.
      tsc shows the same errors as main.
  • Needs #346 live in production before the store build.
  • Later conflict: the room-changes branch (room changes #17) touches 17 of these files and still uses the deleted TRAVEL_ADHYAYAN_ASK_LIST.

Update 28 Oct 2026: merged with current main (SDK 58), verified, ready for review

  • main merged in (no conflicts). The app builds on SDK 58 (Android and iOS bundles export). Type and lint results match main exactly (no new errors).
  • Tested end to end on an Android emulator against the merged backend and staff panel:
    • Round trip: pick a date range, the return card shows the reversed route, review, confirm. Both legs are stored as one trip.
    • Repeat the same dates: refused with "Travel already booked for this direction on the selected date".
    • Guest: look up a guest by phone, book a one-way trip. Booked by the member, shown as "Booked For" the guest.
    • After staff confirm the round trip in the panel, the member's Bookings shows both legs confirmed and the guest trip still waiting.
  • JavaScript only: no native or config changes.
  • Needs the backend (#346) live first. To ship: version bump and an updates row, as for 1.1.62.

iPhone (28 Oct, later): the same flow also passes end to end on an iPhone simulator (iOS 27, SDK 58 dev build): sign-in, round trip booked (return shown reversed), the repeat refused with "Travel already booked...", a guest found by phone and booked, then after staff confirmed in the panel the Bookings tab shows both legs confirmed and the guest trip awaiting. Re-run: travel-logs/full/run-ios.sh (kept outside the repo).

vendz and others added 18 commits July 7, 2026 00:48
Backend no longer persists leaving_post_adhyayan, so drop the client-side
question, form state, and payload field from both self and mumukshu
travel booking flows.
…lows

Task 6 removed this self-reported question from the standalone
TravelBooking.tsx + preparingRequestBody.js, but it still lingered in
TravelAddon.tsx, MumukshuTravelAddon.tsx, and the travel form
initializers in booking/[booking].tsx and mumukshuBooking/[booking].tsx.
Also drops the now-unused TRAVEL_ADHYAYAN_ASK_LIST dropdown.
Adds a One-way/Round trip toggle to travel booking. When round trip is
selected, an editable return-leg section collects a return date (min
= onward date) and return pickup/drop defaulting to the reverse of the
onward route, plus a return flight/train time when required. On
submit, the onward mumukshuGroup is mirrored into returnMumukshuGroup
with swapped/edited endpoints, and preparingRequestBody emits
return_date + returnMumukshuGroup (run through the same per-group
transform as the onward leg) only when both are present, so one-way
submissions are unchanged.
Adds a Guest chip to TravelBooking.tsx that books travel for a host's
guests via /guest -> guestGroup transform -> updateGuestBooking('travel')
-> guestBooking/[booking].tsx (dynamic route, booking='travel') ->
bookingReview.tsx -> /guest/validate + /guest/booking. Round trip works
for guest travel too by generalizing attachReturnLeg to branch on
guestGroup vs mumukshuGroup. Adds the guest travel case to
prepareGuestRequestBody and a travel branch to transformGuestGroup, plus
a GuestTravelBookingDetails card wired into the addons and review screens.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-on flows

Round trip is now a date RANGE (CustomCalender period): single date = one-way,
range = round trip with the return leg auto-reversing the onward route on the end
date. Replaces the earlier trip-type toggle + dual calendars. Applied to the main
TravelBooking (self/mumukshu/guest) and both travel add-ons; the reversed return
leg is built in transformAddons when a return_date is present.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…i-day stays); drop under-calendar helper text
… travel is primary; revert food Meal Dates label
… guest add-on date inheritance; align Room/Food endDay order; respect cleared one-way on re-sync
…DateField shared components; delete dead prepareSelfRequestBody
@claude

claude Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 9m 16s —— View job


Review complete

  • Gather context (PR diff, files, CLAUDE.md)
  • Review travel round-trip logic (TravelBooking.tsx, TravelReturnDateField.tsx, TravelDateDisplay.tsx)
  • Review guest travel booking flow
  • Review add-on date inheritance changes
  • Review adhyayan-question removal
  • Review preparingRequestBody.js changes
  • Post inline comments for findings
  • Post summary

Posted 1 inline comment + a summary comment. Highlights:

Inline — TravelBooking.tsx (~L410-420): the primary-flow round-trip calendar can accept a return date earlier than the travel date with no visual feedback; the only symptom is "Book Now" silently becoming disabled.

In summary (outside this diff, so no inline anchor) — the Adhyayan add-on's date-range query wasn't updated to inherit round-trip travel's return_date, unlike Room/Food which this PR explicitly fixed:

  • src/components/booking addons/AdhyayanAddon.tsx:31
  • src/components/booking addons/MumukshuAdhyayanAddon.tsx:41

Everything else — guest travel flow, attachReturnLeg's leg-reversal/arrival_time clearing, prepareGuestRequestBody/prepareMumukshuRequestBody round-trip handling, and the full removal of TRAVEL_ADHYAYAN_ASK_LIST/leaving_post_adhyayan — checked out correctly. Did not implement any changes since this was a review-only request; could not run npm run lint or expo export locally (no node_modules/network install), so relied on static diff review.

Comment on lines +410 to +420
<CustomCalender
selectedDay={travelForm.date}
setSelectedDay={(day: any) => {
type={'period'}
startDay={travelForm.date}
setStartDay={(day: any) => {
setTravelForm((prev) => ({ ...prev, date: day }));
setMumukshuForm((prev) => ({ ...prev, date: day }));
setGuestTravelForm((prev) => ({ ...prev, date: day }));
setReturnDate('');
}}
endDay={returnDate}
setEndDay={(day: any) => setReturnDate(day || '')}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CustomCalender's period mode (handlePeriodPress in CustomCalender.tsx) doesn't guard against the second tap landing before startDay: if day.dateString < startDay, its date-range loop never runs (so no visual highlight is shown) but it still calls setEndDay(day.dateString) with the earlier date. Here that flows straight into setReturnDate(day), so a user can end up with a returnDate before travelForm.date with zero visual feedback that anything happened.

isReturnLegValid() does catch this at validation time, but the only visible effect is that "Book Now" silently becomes disabled (isDisabled={... : !isMumukshuFormValid()}) — there's no message telling the user their return date is invalid or before the travel date. Worth either clamping/ignoring an out-of-order setEndDay here, or surfacing an explicit error state (e.g. a validation message) rather than a silently-disabled button.

Fix this →

@claude

claude Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review summary

Solid implementation overall — round-trip modeling as a start/end date range (mirroring the room-booking calendar), the shared TravelReturnDateField/TravelDateDisplay components, and the adhyayan-question removal are all clean and consistently threaded through self/mumukshu/guest flows and preparingRequestBody.js.

Two things worth a look (one inline, one below since it's outside the diff):

  1. Inline comment on src/components/booking/TravelBooking.tsx (~line 410-420): the primary-flow round-trip calendar can silently accept a return date earlier than the travel date (no highlight shown), and the only symptom is "Book Now" becoming disabled with no explanation.

  2. Adhyayan add-on date inheritance was missed (not part of this diff, so I can't anchor an inline comment, but it's directly related to this PR's "add-on date inheritance" goal):

    • src/components/booking addons/AdhyayanAddon.tsx:31 — endDate = booking === types.ROOM_DETAILS_TYPE ? mumukshuData.room?.endDay : '' never looks at mumukshuData.travel?.return_date, so when travel is the primary round-trip booking (and there's no room), the adhyayan /adhyayan/getrange query gets end_date: '' instead of the return date.
    • src/components/booking addons/MumukshuAdhyayanAddon.tsx:41 — same gap: end_date: mumukshuData.room?.endDay || mumukshuData.flat?.endDay has no mumukshuData.travel?.return_date fallback, unlike RoomAddon.tsx/FoodAddon.tsx which this PR explicitly updated to include it.

    Net effect: adding an Adhyayan add-on on top of a round-trip travel primary booking will query available shibirs using only the onward date, not the full round-trip range — inconsistent with how Room/Food add-ons now behave.

Everything else (guest booking flow, attachReturnLeg's pickup/drop reversal and arrival_time clearing, prepareGuestRequestBody/prepareMumukshuRequestBody handling of return_date/returnMumukshuGroup/returnGuestGroup, and the full removal of TRAVEL_ADHYAYAN_ASK_LIST/leaving_post_adhyayan) checked out correctly.

…er return tap; adhyayan add-on inherits round-trip return date
@claude

claude Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 1m 53s —— View job


Review complete — fix commit verified

  • Gather context (PR diff, previous review comments, CLAUDE.md)
  • Verify fix for out-of-order return-date tap (TravelBooking.tsx)
  • Verify fix for Adhyayan add-on round-trip date inheritance
  • Full re-review of latest diff for new issues
  • Post inline comments for any findings (none needed)
  • Post summary

Both previously-flagged issues are fixed correctly in 3f0bac5:

  1. Out-of-order return-date tap (src/components/booking/TravelBooking.tsx:420-435) — setEndDay now checks moment(day).isBefore(moment(travelForm.date), 'day') and, if so, restarts the range at the tapped day (updating travelForm/mumukshuForm/guestTravelForm and clearing returnDate) instead of letting an invalid return date silently disable "Book Now". This mirrors setStartDay's behavior and is consistent with isReturnLegValid()'s same-day-is-valid semantics. Confirmed CustomCalender.handlePeriodPress always calls setEndDay(day.dateString) on the second tap regardless of order, so this guard is necessary and correctly placed.

  2. Adhyayan add-on date inheritance (AdhyayanAddon.tsx:31-34, MumukshuAdhyayanAddon.tsx:41-44) — both now fall back to mumukshuData.travel?.return_date when there's no room, matching the pattern already used in RoomAddon.tsx/FoodAddon.tsx. The /adhyayan/getrange and /mumukshu/* queries now correctly use the full round-trip range when travel is the primary booking.

No new issues found in this diff (3f0bac5). Also spot-checked the newly extracted TravelDateDisplay/TravelReturnDateField components from the prior simplify commit — both are clean, no regressions.

@claude

claude Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 2m 11s —— View job


Review complete — re-review of latest push (99a16e9)

  • Gather context (PR diff, previous review comments, CLAUDE.md)
  • Review new commit 99a16e9 (flight-style itinerary on cards, cancellation list, calendar Callout)
  • Full re-review of latest diff for regressions
  • Post inline comments for any findings (none needed)
  • Post summary

Reviewed the delta since the last review (3f0bac5 → 99a16e9), which touches TravelDateDisplay.tsx, GuestTravelBookingDetails.tsx, MumukshuTravelBookingDetails.tsx, TravelBookingDetails.tsx, TravelBooking.tsx, and TravelBookingCancellation.tsx.

No new bugs found. Specifically checked:

  • TravelDateDisplay's new Route/Leg split — Route guards on !from || !to so missing pickup/drop renders nothing rather than crashing; onward/return legs correctly reverse pickup↔drop.
  • TravelBookingDetails.tsx still indexes mumukshuGroup[0] for pickup/drop (pre-existing pattern from before this PR, unchanged risk — not introduced here) and correctly drops the now-redundant standalone Pickup/Drop row since TravelDateDisplay shows the route inline.
  • GuestTravelBookingDetails/MumukshuTravelBookingDetails correctly use optional chaining (guestGroup?.[0]?.pickup) for the new pickup/drop props.
  • TravelBookingCancellation.tsx's new route header uses item.pickup_point/item.drop_point, both of which are already used elsewhere in the same file/API — no new/undefined field introduced.
  • TravelBooking.tsx's calendar text was swapped for a Callout (variant="default" is a valid variant); the out-of-order return-date-tap fix from the prior review round is untouched and still correct.
  • Cosmetic tag color change (blue → orange for "Round trip") — no functional impact.

Everything from the earlier review rounds (round-trip modeling, guest travel flow, add-on date inheritance for Room/Food/Adhyayan, attachReturnLeg, adhyayan-question removal) remains correct and unaffected by this push.

@claude

claude Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 1m 39s —— View job


Review complete — re-review of latest push (44e3899)

  • Gather context (PR diff, previous review comments, CLAUDE.md)
  • Review new commit 44e3899 (calendar callout style change)
  • Full re-review of latest diff for regressions
  • Post inline comments for any findings (none needed)
  • Post summary

Reviewed the delta since the last review (99a16e9 → 44e3899), which only touches src/components/booking/TravelBooking.tsx:405-409 — swaps the round-trip calendar's Callout from variant="default" with a longer explanatory message to variant="warning" with a shorter message ("For a round trip, add a return date — the same route is booked in reverse."), matching FoodBooking.tsx's warning-style callout convention. Confirmed warning is a valid/consistently-used Callout variant elsewhere in the codebase (FoodBooking.tsx, booking/[booking].tsx, mumukshuBooking/[booking].tsx, guestBooking/[booking].tsx). No functional change, no new issues.

Diffed the full PR (bcf416b..44e3899, 19 files, +800/-280) against the reported file list — matches exactly, confirming nothing outside prior review rounds was missed.

No new bugs found. Everything from earlier rounds (round-trip modeling, guest travel flow, add-on date inheritance for Room/Food/Adhyayan, attachReturnLeg, the out-of-order return-date-tap fix, adhyayan-question removal) remains correct and unaffected by this push.

@claude

claude Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 1m 11s —— View job


Review complete — re-review of latest push (995d664)

  • Gather context (diff since last review, CLAUDE.md)
  • Review new commit 995d664 (em-dash removal from user-facing text/comments)
  • Full re-review of latest diff for regressions
  • Post inline comments for any findings (none needed)
  • Post summary

Reviewed the delta since the last review (44e3899 → 995d664), which is a pure text/comment cleanup: replaces em-dashes with periods/colons in three places:

  • TravelReturnDateField.tsx:55 — banner copy "Round trip — return..." → "Round trip: return..."
  • TravelBooking.tsx:409 — Callout message "...add a return date — the same route..." → "...add a return date. The same route..."
  • TravelBooking.tsx:427 — inline code comment rewording
  • TravelBookingCancellation.tsx:188 — code comment Route — actual pickup → drop → Route: actual pickup to drop

No logic changes, no new bugs. Confirmed no leftover em-dashes remain in any file touched by this PR.

No new issues found. All prior review rounds' findings (round-trip modeling, guest travel flow, add-on date inheritance for Room/Food/Adhyayan, attachReturnLeg, the out-of-order return-date-tap fix, adhyayan-question removal) remain correct and unaffected by this push.

vendz and others added 2 commits July 8, 2026 19:01
- Unify requiresArrivalTime on the shared src/utils/travel.ts helper for both
  field visibility and validation everywhere, fixing an Utsav soft-lock where an
  EVENT_LOCATION_LIST airport/railway value required a time the UI never showed.
- Resolve the return leg's guest cardnos from the post-/guest updatedGuests so a
  new guest's round trip no longer ships returnGuestGroup with cardno undefined.
- Reset the return (re-mirror onward) on chip switch and on adding/removing a
  traveler, so stale travelerIndices can no longer book the wrong/missing person.
- Block submission (with a clear reason) when a split return has an empty group
  or leaves any traveler unassigned.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extract reverseOnwardGroups into src/utils/travel.ts and use it in the mumukshu
and guest travel add-ons; remove the unused colors import in TravelReturnDetails.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 3m 11s —— View job


Review complete — re-review of latest push (b065668 → afb8163)

  • Gather context (diff since last review b065668 → afb8163, CLAUDE.md)
  • Review 8b3251f (return block placement + autofill in add-ons; prefill new groups)
  • Review 3cfc097 (fix: address code-review findings on round-trip)
  • Review afb8163 (refactor: dedup return-group reversal, drop dead import)
  • Check whether previously-flagged issues were addressed
  • Full re-review of latest diff for new issues
  • Post inline comments for findings (none needed)
  • Post summary

This push is a fix/cleanup round that directly resolves four items open from earlier review rounds:

  1. 4-way duplicated requiresArrivalTime — fixed. TravelBooking.tsx and TravelAddon.tsx now import from src/utils/travel.ts (3cfc097); GuestTravelAddon.tsx/MumukshuTravelAddon.tsx already did. Confirmed no local copies remain in any of the four files. Bonus: this also fixed a real bug called out in the commit message — an Utsav-date booking using EVENT_LOCATION_LIST could require an arrival time the UI never showed a field for, soft-locking submission.
  2. Stale returnGroups surviving a chip switch — fixed. handleChipClick now resets returnGroups/returnEdited (TravelBooking.tsx:108-110), and the sync effect's dep array includes selectedChip (:595), so the return leg re-mirrors the newly active chip's travelers. Also extended to addMumukshuForm/removeMumukshuForm/addGuestTravelForm/removeGuestTravelForm, since adding/removing a traveler shifts travelerIndices the same way a chip switch does.
  3. Traveler-coverage / empty-group validation missing — fixed in the primary form. isReturnLegValid() (:167-171) and the new returnBlockingReason() (:455-461) now require every returnGroups entry to be non-empty and every activeTravelers index to be assigned to exactly one group.
  4. New guest's return leg shipping cardno: undefined — fixed. attachReturnLeg now takes an optional resolvedTravelers param, and the guest submit path passes the post-/guest-POST updatedGuests (with real cardnos) instead of the stale pre-POST activeTravelers (:616, :1251-1261).

afb8163 is a clean, behavior-preserving follow-up: extracts the reversal logic duplicated between GuestTravelAddon.tsx/MumukshuTravelAddon.tsx into reverseOnwardGroups in src/utils/travel.ts, and drops an unused colors import in TravelReturnDetails.tsx. Also verified 8b3251f's "prefill new group from last group" additions and moving TravelReturnDetails below the traveler list in the two multi-traveler add-ons (so effectiveReturnGroups can live-mirror the latest onward edits) — both are UI/ergonomics changes with no logic issues.

No new bugs found in this diff.

Still open, unaddressed by this push (all pre-existing, flagged in earlier rounds, scoped to files/lines outside this diff so not re-annotated inline):

  • validateTravelForm in src/app/guestBooking/[booking].tsx:598-627 and src/app/mumukshuBooking/[booking].tsx:609-638 still only checks the return leg's arrival_time, never blank pickup/drop/luggage or traveler-coverage on returnGroups — the fix landed in the primary form (TravelBooking.tsx) but not these two add-on screens.
  • src/components/booking details cards/TravelItinerary.tsx's GroupBlock still lacks the !pickup && !drop render guard the deleted TravelDateDisplay/TravelLegDetails had.
  • Minor/non-blocking: buildTravelPayload in guestBooking/[booking].tsx:552-564 and the equivalent in mumukshuBooking/[booking].tsx still duplicate the same reversal logic inline instead of using the newly-extracted reverseOnwardGroups from src/utils/travel.ts — worth folding in for consistency now that the util exists, but not a bug.

(branch)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 49s —— View job


Review complete — re-review of latest push (afb8163 → 8f5f5b4)

  • Gather context (diff since last review afb8163, CLAUDE.md)
  • Review new commit 8f5f5b4 ("add Vendor to guest type options")
  • Full re-review of latest diff for regressions
  • Post inline comments for findings (none needed)
  • Post summary

This push is a single one-line, purely additive change: src/constants/dropdowns.js:81 adds { key: 'vendor', value: 'Vendor' } to GUEST_TYPE_LIST. Confirmed GUEST_TYPE_LIST is only consumed generically as dropdown data (GuestForm.tsx:182, OtherUsersForm.tsx:133) — no switch/enum logic keyed off specific guest-type values elsewhere, so this can't regress anything.

No new issues found.

Still open from earlier review rounds (unaffected by this push, not touched by this commit):

  • validateTravelForm in src/app/guestBooking/[booking].tsx and src/app/mumukshuBooking/[booking].tsx still doesn't validate returnGroups field-completeness/traveler-coverage when return_date is set.
  • TravelItinerary.tsx's GroupBlock still lacks the !pickup && !drop render guard the deleted TravelDateDisplay/TravelLegDetails had.
  • Minor: buildTravelPayload in guestBooking/[booking].tsx/mumukshuBooking/[booking].tsx still duplicate reversal logic inline instead of using reverseOnwardGroups from src/utils/travel.ts.

(branch)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 36s —— View job


Review complete — re-review of latest push (8f5f5b4 → 79e01eb)

  • Gather context (diff since last review 8f5f5b4 → 79e01eb, CLAUDE.md)
  • Review new commit 79e01eb (version bump)
  • Full re-review of latest diff for regressions
  • Post inline comments for findings (none needed)
  • Post summary

This push is a trivial one-line version bump: app.config.js:25 version: '1.1.50' → '1.1.52'. No logic touched, no regressions possible.

No new issues found.

Still open from earlier review rounds (unaffected by this push):

  • validateTravelForm in src/app/guestBooking/[booking].tsx and src/app/mumukshuBooking/[booking].tsx still doesn't validate returnGroups field-completeness/traveler-coverage when return_date is set.
  • TravelItinerary.tsx's GroupBlock still lacks the !pickup && !drop render guard the deleted TravelDateDisplay/TravelLegDetails had.
  • Minor: buildTravelPayload in guestBooking/[booking].tsx/mumukshuBooking/[booking].tsx still duplicate reversal logic inline instead of using reverseOnwardGroups from src/utils/travel.ts.

(branch)

Swap the Guest and Mumukshu chip positions. Chip logic now keys off string
literals instead of CHIPS array indices, so display order is decoupled from
behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 50s —— View job


Review complete — re-review of latest push (79e01eb → fa49e72)

  • Gather context (diff since last review 79e01eb → fa49e72, CLAUDE.md)
  • Review new commit fa49e72 (reorder booking chips: Self, Guest, Mumukshus)
  • Full re-review of latest diff for regressions
  • Post inline comments for findings (none needed)
  • Post summary

This push reorders the chip tab labels from ['Self', 'Mumukshus', 'Guest'] to ['Self', 'Guest', 'Mumukshus'] in src/components/booking/TravelBooking.tsx:27 and replaces every remaining CHIPS[0]/CHIPS[1] positional comparison with the literal chip name ('Self'/'Mumukshus') at lines 466, 470, 1176, 1204, 1278.

Verified this is safe:

  • Every selectedChip comparison in the file already used (or now uses) string literals ('Self', 'Mumukshus', 'Guest') rather than array indices — confirmed via full grep of selectedChip/CHIPS usage, no remaining positional (CHIPS[n]) reads.
  • CHIPS = ['Self'] guest-user override (line 96) is unaffected by the reorder.
  • chips={CHIPS} (line 710) just drives the rendered tab order — purely cosmetic.

No new issues found.

Still open from earlier review rounds (unaffected by this push):

  • validateTravelForm in src/app/guestBooking/[booking].tsx and src/app/mumukshuBooking/[booking].tsx still doesn't validate returnGroups field-completeness/traveler-coverage when return_date is set.
  • TravelItinerary.tsx's GroupBlock still lacks the !pickup && !drop render guard the deleted TravelDateDisplay/TravelLegDetails had.
  • Minor: buildTravelPayload in guestBooking/[booking].tsx/mumukshuBooking/[booking].tsx still duplicate reversal logic inline instead of using reverseOnwardGroups from src/utils/travel.ts.

(branch)

vendz and others added 2 commits July 23, 2026 20:49
A one-way travel addon booked alongside a multi-day room/food/adhyayan
stay silently became a round trip: the travel form's return_date was
cross-referenced from the companion booking's end date. If the onward
leg required an arrival time, the auto-generated return leg had none and
submission hard-blocked with a generic 'fill all travel fields' error.

Round trip is now strictly an explicit user opt-in; return_date is only
seeded from existing travel data, never from a companion booking. Fixes
both the mumukshu and guest booking screens (initial form + sync effect).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The travel-addon path set return_date whenever present and only attached
the return group if it happened to exist, and treated an empty array as a
valid group. A return_date without a resolved group triggers the backend's
'return_date and returnMumukshuGroup must be provided together' 400.

Now both are sent together or not at all, matching the primary path, with
an empty group array counting as absent. Guest and mumukshu paths both.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
vendz and others added 2 commits October 3, 2026 06:14
- Today's rule kept: the "Leaving post Adhyayan?" question is back for Self
  and Mumukshus, and leaving_post_adhyayan is sent as main sends it.
  Removing it is an owner decision (see the PR description).
- Vendor is not in the guest types until the owner decides.
- Return groups and the edited flag are kept per chip (Self / Mumukshus /
  Guest); the return date stays one shared range.
- The itinerary shows a dash for an empty pickup or drop.
- Guest Adhyayan add-on on a travel-only guest booking uses the travel dates
  when there is no room or flat, only asks when it has a valid start date,
  and shows a plain message instead of "Invalid time value".
- Prettier on the PR's travel files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 1m 9s —— View job


Re-review of latest push (fa49e72 → ec76d2f, plus main merge and b98805d/c25bd14)

  • Gather context (diff since last review)
  • Review ec76d2f (Adhyayan question restored, return state per chip, guest Adhyayan add-on dates, Prettier)
  • Post inline comments
  • Summary

1 inline comment:

  • src/components/booking/TravelBooking.tsx:646-654: the restored "Leaving post adhyayan?" question is never asked for the return leg, and its answer is never sent there. That leg is usually the one that departs Research Centre (RC). The onward group sends leaving_post_adhyayan (default 0), but return groups never do. The add-on payload builders in booking/[booking].tsx and mumukshuBooking/[booking].tsx have the same gap.

Checked, OK:

  • returnByChip per-chip state: setReturnGroups and setReturnEdited both use functional updates, so setReturnGroups(g); setReturnEdited(true) together work correctly. Clearing the return date also clears every chip's return state. Adding or removing a traveler resets only the active chip, which is right because the traveler lists can only be edited from their own chip. The stale-return-groups-after-chip-switch issue from earlier rounds stays fixed, and edits now survive switching chips and coming back.
  • transformMumukshuGroup: the group-level adhyayan and the fallback that reads it from each mumukshu match how main handles it. The primary return leg builds mumukshus: [{cardno}], so it can't accidentally copy the onward answer.
  • GuestAdhyayanAddon: the travel-date fallback, the enabled: hasDates guard, and the per-guest-date queryKey are all correct. The old key room.startDay && room.endDay evaluated to a single value, so different date ranges could collide in the cache. The new key fixes that.
  • TravelItinerary now shows — for an empty pickup or drop, which resolves the earlier render-guard finding.
  • b98805d/c25bd14 (return date only when the user asks for a round trip; return_date and the return group sent together or not at all) look correct.
  • Vendor removed from GUEST_TYPE_LIST, and the cancellation changes are Prettier-only.

Housekeeping: the PR title and description still say the Adhyayan question is removed app-wide. After ec76d2f that's no longer true, so they should be updated.

Still open from earlier rounds: validateTravelForm in guestBooking/[booking].tsx and mumukshuBooking/[booking].tsx still doesn't check that return groups are complete or that every traveler is in one. The inline reversal in their buildTravelPayload still duplicates reverseOnwardGroups (minor).

I couldn't run lint or expo export because there's no node_modules; this review is from reading the code only.
· branch

Comment on lines +646 to +654
const base = {
pickup: rg.pickup,
drop: rg.drop,
type: rg.type,
luggage: rg.luggage || [],
arrival_time: rg.arrival_time || '',
special_request: rg.comments || '',
total_people: rg.total_people,
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that ec76d2f restores "Leaving post adhyayan?", the return leg never gets it. The question only shows when pickup is Research Centre (LOCATION_LIST[0]). On a normal round trip (city → RC onward, RC → city return), the return group is the leg that departs RC. But TravelReturnDetails/TravelReturnGroups don't render the question and this payload has no adhyayan. So transformMumukshuGroup leaves out leaving_post_adhyayan on every return group. The onward group still sends it (defaults to 'No' → 0), even though the onward leg doesn't leave RC.

Net effect: for the case the flag exists for (leaving RC after an adhyayan), round-trip bookings never send the user's answer. Same gap in the add-on payload builders (booking/[booking].tsx ~L102, mumukshuBooking/[booking].tsx ~L567).

Fix options: (a) ask the question on return groups whose pickup is RC (in TravelReturnGroups/the flat return form) and pass adhyayan through here, or (b) if the owner decides to drop the question, drop it everywhere. Either way, the onward and return legs should behave the same.

@vendz vendz changed the title Travel: round-trip, guest booking & adhyayan question removal Travel: round-trip and guest booking Oct 3, 2026
… returns

- On a round trip, the return group asks "Leaving post Adhyayan?" when it
  departs the Research Centre, and return groups send leaving_post_adhyayan.
  The member's answer goes on the leg leaving the centre; other legs send No.
- The booking, guest and Mumukshu screens refuse an edited return that is
  incomplete or leaves a traveller out of every group.
- The guest and Mumukshu payload builders reuse reverseOnwardGroups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vendz

vendz commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

Review round handled in 855b13c: the return leg asks "Leaving post Adhyayan?" when it departs the Research Centre and sends the answer (other legs send No); the forms refuse an incomplete edited return; the payload builders reuse reverseOnwardGroups. Checked with the app's real request builder against SRATRC/aashray-backend#346 locally: a return leaving the centre saved 1, with the same trip_group_id as its onward leg. Title updated; the description's "Update 3 Oct" section supersedes the earlier "question removed" wording.

@claude

claude Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 44s —— View job


Re-review of latest push (ec76d2f → 855b13c)

  • Read the diff since the last review
  • Check the return-leg Adhyayan fix, isReturnIncomplete, and the reverseOnwardGroups reuse
  • Post inline comments
  • Summary

Found 1 bug, posted inline.

1 inline comment:

  • src/components/TravelReturnDetails.tsx:287: the "Leaving post adhyayan?" question was added only to the grouped return editor (Mumukshu/Guest). The flat editor, which Self uses on the main form and in TravelAddon, still doesn't show it. On a Self round trip, the return leg leaves the Research Centre but always sends leaving_post_adhyayan = 0, and the user can't change it. A ready-to-apply suggestion is included in the comment. The same applies to any return leg the user hasn't edited: the default is No and the question only appears after tapping "Edit".

Checked, OK:

  • leavingPostAdhyayanFor is wired into all 3 payload builders that send Mumukshu-shaped groups: TravelBooking.attachReturnLeg, booking/[booking].tsx, and mumukshuBooking/[booking].tsx. The guest path sends no Adhyayan answer, which matches the onward guest leg.
  • isReturnIncomplete checks each group for: pickup, drop, type and luggage; at least one traveller; exactly one end at the Research Centre; total people for a full car; and a comment when "Other" is picked. It also checks that every traveller is in some group. That fully closes the open item from earlier rounds for the guest, Mumukshu and self add-on screens. It is only enforced when returnEdited is true. That's fine, because a return the user hasn't edited is built by reverseOnwardGroups from an onward leg that has already been validated.
  • Self add-on: allIndices = ['0'] matches the flat group's travelerIndices: ['0'].
  • reverseOnwardGroups now replaces the inline reversal in both buildTravelPayloads with no change in behaviour, and adds the default adhyayan. That closes the minor duplication item.

Minor, not blocking: the onward group still sends whatever travelForm.adhyayan or mumukshu.adhyayan holds. Suppose the user sets the onward pickup to the Research Centre, answers Yes, then changes the pickup to a city. The question is now hidden, but the stale Yes is still sent on the onward leg. That doesn't match the commit's "other legs send No" rule. You could apply leavingPostAdhyayanFor to the onward groups as well. This was already the behaviour before this push.

Still open: nothing else from earlier rounds.

I couldn't run lint or expo export because there's no node_modules; this review is from reading the code only.
· branch

onCancel={() => setTimeVisible(false)}
/>
</>
) : null}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

855b13c added "Leaving post adhyayan?" to the grouped editor (TravelReturnGroups), but the flat editor here never got it. The flat editor is what Self uses, both on the main travel form (TravelBooking.tsx) and in the add-on (TravelAddon.tsx).

So on a normal Self round trip (city → Research Centre (RC), then RC → city), the return group keeps its default adhyayan: 'No'. leavingPostAdhyayanFor(rg) then sends leaving_post_adhyayan = 0 on the leg that actually leaves RC, and the user has no way to change it. Self is the most common case, so the fix only works for Mumukshu and Guest.

The onward leg doesn't cover for it either. The onward question only shows when the onward pickup is RC, and on a city → RC trip it isn't.

Suggest mirroring the grouped editor:

Suggested change
) : null}
) : null}
{firstGroup?.pickup === 'Research Centre' && (
<CustomSelectBottomSheet
className="mt-5"
label="Leaving post adhyayan?"
options={dropdowns.TRAVEL_ADHYAYAN_ASK_LIST}
selectedValue={firstGroup?.adhyayan || dropdowns.TRAVEL_ADHYAYAN_ASK_LIST[1].value}
onValueChange={(val: any) => updateFlat({ adhyayan: val })}
saveKeyInsteadOfValue={false}
/>
)}

The read-only summary, shown before the user taps "Edit", has the same gap. An untouched round trip always sends No on the return. You could show the question outside the Edit panel whenever the return pickup is RC.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in ba318a0: the Self return card asks the question whenever the return leaves the Research Centre, outside the Edit panel. Any leg not leaving the centre sends 0, which also covers the stale onward Yes. Checked with the app's request builder against #346 locally: a Self round trip with the return leaving the centre saved 1, the onward leg saved 0, and a stale onward Yes saved 0.

- The Self return card shows "Leaving post adhyayan?" whenever the return
  leaves the Research Centre, outside the Edit panel, so a default return
  can be answered without editing it.
- Any onward or return group that doesn't leave the Research Centre sends
  leaving_post_adhyayan = 0, so a Yes left over from an earlier pickup
  choice is sent as No.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 46s —— View job


Re-review of latest push (855b13c → ba318a0)

  • Read the diff (TravelReturnDetails.tsx, preparingRequestBody.js)
  • Post inline comments
  • Summary

1 inline comment:

  • src/components/TravelReturnDetails.tsx:335: answering the new Self "Leaving post adhyayan?" question goes through updateFlat → onChangeReturnGroups. That sets returnEdited = true in both TravelBooking.tsx:1188 and TravelAddon.tsx:309, so the return stops mirroring the onward leg. If the user then changes the onward pickup, luggage or vehicle type, the old return is still submitted. Suggested fix: save the answer without marking the return as edited, and keep adhyayan when the auto-sync rebuilds the groups.

Checked, OK:

  • The question now shows for Self outside the Edit panel, so a return the user hasn't edited can still be answered. This closes the last round's finding, apart from the side effect above.
  • preparingRequestBody.js: any group whose pickup isn't the Research Centre now sends leaving_post_adhyayan = 0, which removes the stale Yes. The check only runs when the field was already set, so payloads with no Adhyayan answer are unchanged. Guest groups don't send the field, which is the same as before.

Still open from earlier rounds: nothing else.

I couldn't run lint or expo export because there's no node_modules; this review is from reading the code only.
· branch

options={dropdowns.TRAVEL_ADHYAYAN_ASK_LIST}
selectedValue={firstGroup.adhyayan || dropdowns.TRAVEL_ADHYAYAN_ASK_LIST[1].value}
onValueChange={(val: any) => updateFlat({ adhyayan: val })}
saveKeyInsteadOfValue={false}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answering this question goes through updateFlat → onChangeReturnGroups. Both callers treat that as a user edit:

  • TravelBooking.tsx:1188: setReturnGroups(g); setReturnEdited(true)
  • TravelAddon.tsx:309: returnEdited: true

After that, the return leg stops mirroring the onward leg. Example on the Self form:

  1. Onward: Mumbai Airport → Research Centre (RC), 2 bags. Pick a return date. The default return is RC → Mumbai Airport.
  2. Answer "Leaving post adhyayan?" = Yes. returnEdited is now true.
  3. Change the onward pickup to Pune, or change the luggage or vehicle type.
  4. The return still says RC → Mumbai Airport with the old luggage and type, and it gets submitted that way. The read-only card shows it, but nothing tells the user that the return no longer follows the onward leg.

Before this commit, a Self user who never tapped Edit always got a return that matched the onward leg. Now, just answering the question switches that off.

Suggested fix: keep the answer out of the "edited" flag. For example, add an onChangeReturnAdhyayan prop that patches only adhyayan on the groups, without calling setReturnEdited(true) or setting returnEdited: true. Then make the auto-sync effect in TravelBooking.tsx (and effectiveReturnGroups in TravelAddon.tsx) keep the existing adhyayan when it rebuilds the groups from the onward leg.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in 77e883f: the answer has its own callback and state and no longer marks the return as edited; the auto-sync carries it. Checked: answering Yes, then changing the onward leg to Dadar→RC, Large Bag, Full Car x3, rebuilds the return as RC→Dadar with the same values and saves 1 on the return and 0 on the onward.

The answer is stored on its own (per chip, and as returnAdhyayan in the
add-on), not through the return-group change, so it no longer marks the
return as edited. The default return keeps mirroring the onward leg
(pickup, luggage, vehicle, people) and carries the answer when rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 30s —— View job


Re-review of latest push (ba318a0 → 77e883f)

  • Read the diff (TravelBooking.tsx, TravelAddon.tsx, TravelReturnDetails.tsx, booking/[booking].tsx, utils/travel.ts)
  • Check that the last round's finding is fixed
  • Summary

No new issues found. I posted no inline comments.

Last round's finding is fixed. Answering "Leaving post adhyayan?" on the Self return no longer stops the return from following the onward leg:

  • Main form (TravelBooking.tsx): each chip now stores the answer separately (returnByChip[chip].answer). setReturnAnswer writes it into groups[0] but does not touch edited. The auto-sync effect passes returnAnswer into reverseGroups, so the answer survives when the return is rebuilt. returnAnswer is also in the effect's dependency list. Both setReturnGroups and setReturnEdited now spread prev[selectedChip], so neither one wipes answer. Clearing the return date (setReturnByChip({})) also clears the answer.
  • Add-on (TravelAddon.tsx, booking/[booking].tsx): a new returnAdhyayan field is set on init, on collapse and on clear. Both reverseGroups() and transformToMumukshuFormat read it, so the screen and the payload match. If the return was already edited, the answer is also written into returnGroups[0]. If it wasn't, effectiveReturnGroups picks it up from reverseGroups().
  • TravelReturnDetails: uses onChangeLeavingAnswer when it's provided and falls back to updateFlat otherwise, so other callers behave as before.
  • reverseOnwardGroups: the new answer parameter defaults to DEFAULT_LEAVING_POST_ADHYAYAN, so the guest and Mumukshu callers are unchanged.

Edge case checked: a stale Yes can survive in adhyayan after the onward route changes so the return no longer leaves the Research Centre. It isn't sent, because preparingRequestBody sends 0 for any group whose pickup isn't the Research Centre.

Still open from earlier rounds: nothing.

I couldn't run lint or expo export because there's no node_modules, so this review is from reading the code only.
· branch

@claude

claude Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Claude finished @vendz's task in 23s —— View job


Re-review of latest push (77e883f → 9bb983e, main merged in)

  • Read the diff since the last review
  • Check the merge on the files this PR touches
  • Summary

No new issues found. I posted no inline comments.

9bb983e only merges main (#29, version 1.1.62). It brings in no travel logic changes. It touches 4 files this PR also changes, and in each one it only adds useScreenSettled and gates the validation modal with validationDataError && screenSettled:

  • booking/[booking].tsx
  • guestBooking/[booking].tsx
  • guestBooking/bookingReview.tsx
  • mumukshuBooking/[booking].tsx

Checked, OK:

  • The merge is clean: no conflict markers are left in src/.
  • The PR's diff against main still covers the same 23 files.

Housekeeping: the description's "Update 3 Oct" section says "SDK 57". CLAUDE.md on main now says Expo 58, so that line is out of date.

Still open from earlier rounds: nothing.

I couldn't run lint or expo export because there's no node_modules, so this review is from reading the code only.
· branch

@vendz

vendz commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Split into smaller PRs: guest travel #30, round trip #31 (stacked on #30).

@vendz vendz closed this Oct 29, 2026
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