mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
76 lines
2.5 KiB
Markdown
76 lines
2.5 KiB
Markdown
# Nationality Mismatch Restart Booking - IMPLEMENTED
|
|
|
|
## Changes Made
|
|
|
|
### File: `edr-passenger-web/portal/src/app/booking/passengers/page.tsx`
|
|
|
|
**Changes:**
|
|
1. Added `clearBooking` to the imported hooks from `useBookingStore`
|
|
2. Updated the "Restart Booking" button click handler to:
|
|
- Clear the entire booking state using `clearBooking()`
|
|
- Perform a full page reload to `/booking/search` using `window.location.href`
|
|
- Added visual feedback with `ExternalLink` icon
|
|
|
|
**Before:**
|
|
```typescript
|
|
onClick={() => router.push('/booking/search')}
|
|
```
|
|
|
|
**After:**
|
|
```typescript
|
|
onClick={() => {
|
|
clearBooking();
|
|
window.location.href = '/booking/search';
|
|
}}
|
|
className="btn-primary w-full flex items-center justify-center gap-2"
|
|
>
|
|
<ExternalLink className="w-5 h-5" />
|
|
Restart Booking
|
|
</button>
|
|
```
|
|
|
|
## Behavior
|
|
|
|
When user encounters a nationality mismatch error:
|
|
1. Warning card displays with ⚠️ icon
|
|
2. User clicks "Restart Booking" button
|
|
3. Button action triggers:
|
|
- **State Clearing**: All booking data is cleared from Zustand store and localStorage:
|
|
- `searchCriteria`
|
|
- `selectedSchedule`
|
|
- `passengers`
|
|
- `seatHold`
|
|
- `bookingId`
|
|
- `pnr`
|
|
- `selectedPaymentMethod`
|
|
- `createAccount`
|
|
- `passengerId`
|
|
- **Full Page Reload**: Browser navigates to `/booking/search` with full page reload (not client-side navigation)
|
|
- **Visual Feedback**: ExternalLink icon indicates external/full navigation action
|
|
|
|
## Benefits
|
|
|
|
✅ **Complete State Reset**: Ensures all booking data is cleared, preventing stale data issues
|
|
✅ **Fresh Start**: Full page reload ensures clean state on search page
|
|
✅ **Clear UX**: ExternalLink icon visually indicates a reload action
|
|
✅ **No Residual Data**: Prevents any leftover booking information from previous attempt
|
|
✅ **Consistent User Flow**: Forces fresh search criteria entry
|
|
|
|
## Technical Details
|
|
|
|
- Uses `useBookingStore().clearBooking()` from Zustand store
|
|
- `window.location.href` triggers full page reload (unlike `router.push()` which is client-side navigation)
|
|
- All booking state is reset to initial values defined in store
|
|
- localStorage is automatically cleared due to Zustand's persist middleware
|
|
|
|
## Testing Checklist
|
|
|
|
- [ ] Login with account that has nationality A
|
|
- [ ] Search for passenger with nationality B
|
|
- [ ] Verify nationality mismatch error appears
|
|
- [ ] Click "Restart Booking" button
|
|
- [ ] Verify page reloads to search page
|
|
- [ ] Verify booking store is completely cleared
|
|
- [ ] Verify search page shows default/empty state
|
|
- [ ] Verify user can perform new search
|