Skip to content

Phase 3: Itinerary & Sailing Management Page

Overview

Phase 3 of the Cruise Management Rework creates cruise-itin.html, a dedicated itinerary management page that replaces the right-side workspace of the monolithic cruisemgmt.html. This page manages a single itinerary and its sailings, accessed via cruise-itin.html?itineraryId=N from the dashboard's "Manage" link.

Page Layout

The page uses a two-pane, 50/50 split layout (col-md-6 each):

Left Pane: Itinerary Information

  • Itinerary Info Form - Code, name, duration, area (dropdown), ship (dropdown) with inline Save/Status/Delete buttons
  • Itinerary Template - Port sequence table (#, Port, Day Arr, Arrive, Day Dep, Depart, Actions) with Add button
  • Pricing Template - Two sub-sections:
  • Cabin Prices (Default) - table with "Init Cabins" button to auto-create from ship cabins
  • Other Charges (Default) - table with Indicator badge column and Add button

Right Pane: Sailing Management

  • Sailing Bar - Pill-shaped buttons showing date + status for each sailing, with "Add New" button
  • Sailing Details (shown when a sailing is selected):
  • Action toolbar: Regen Points, Status dropdown, Delete
  • Sailing Itinerary - cruise points table (#, Port, Arrival, Departure, Actions)
  • Cabin Pricing - table with Prebk/Avail columns and Prebook button
  • Other Charges - table with Indicator badge column
  • Bookings - table showing current bookings for the sailing

New Features (vs cruisemgmt.html)

1. Indicator Field

Single-letter indicator shown as a small badge on: - Other charge templates (left pane) - Other charges (right pane) - Booking add-on badges (right pane)

2. Exchange Rate Auto-Fill

When a currency is selected in any pricing dialog: - If currency = local currency, exchange rate is set to 1.0 - Otherwise, rate is fetched from exchange-rate-service.js (24h cached) - Field remains editable (user can override the auto-filled value)

Applied to: cabin price template, charge template, cabin charge, other charge dialogs.

3. Pre-Booking Management

Dedicated dialog accessible via "Prebook" button: - Cabin type selector (from ship cabins) - On selection: shows current pre-booking count and booked/reserved count - Target count input with validation (cannot reduce below booked+reserved) - Cost per cabin, Price per cabin, Commission % inputs - "Apply price to all" checkbox - Uses CruiseAPI.managePrebookings() for smart add/reduce logic

4. Pre-Booking Columns

Cabin charges table shows two additional columns: - Prebk - count of pre-bookings for this cabin type + sailing - Avail - prebk minus booked/reserved (minimum 0)

5. Bookings Table

Shows current bookings for the selected sailing: - Columns: Customer, Cabin / Add-ons, #Pax, Amount, Status - Add-on badges: small indicator circles, deduplicated - Clickable rows (future Phase 4: navigates to booking management page)

6. Breadcrumb Navigation

Dashboard > Cruises > [Itinerary Name] with links back to cruise-dash.html

Files Created

File Purpose Lines
tqweb-adm/cruise-itin.html Page structure with two panes + 9 modal dialogs ~760
tqweb-adm/js/modules/cruise-itin.js Page module with all functionality ~900

Files Modified

File Change
tqweb-adm/css/cruise.css Added ~130 lines: itin-section, sailing-bar, indicator-badge, itin-table, prebook-info, bookings-table styles
tqweb-adm/js/modules/cruise-dash.js Changed "Manage" link from cruisemgmt.html to cruise-itin.html

Key Dependencies

Module Used For
cruise-common.js CruiseAPI, initCommon(), dimension getters/finders, statusBadge()
exchange-rate-service.js loadCurrencyConfig(), fetchRates(), populateCurrencySelect()
globals.js escapeHtml, formatDisplayDate, formatDisplayDateTime, formatDateTimeLocal
pageutil.js modalShow(), modalHide(), loadBootstrapTemplates()
Dialog Purpose
template_dlg Add/edit itinerary template entry (port sequence)
cabintemplate_dlg Edit cabin price template (with exchange rate auto-fill)
chargetemplate_dlg Add/edit other charge template (with indicator field + exchange rate)
sailing_dlg Create new sailing (start date + generate skeleton)
cruisepoint_dlg Edit sailing point (port, arrival/departure datetime)
cabincharge_dlg Edit cabin charge (with exchange rate auto-fill)
othercharge_dlg Add/edit other charge (with indicator field + exchange rate)
prebook_dlg Manage pre-bookings (cabin type, count, cost/price/commission)
confirm_dlg Generic confirmation dialog

Status Transitions

Itinerary Status

Draft -> Active -> Suspended -> Archived
         ^           |
         +-----------+

Sailing Status

Draft -> Active -> Suspended
         |    |         |
         |    +--> Cancelled
         |    +--> Completed
         |
         <-- Draft

Verification Checklist

  1. Navigate from cruise-dash.html -> click "Manage" -> opens cruise-itin.html
  2. Left pane shows itinerary info with correct data and status badge
  3. Save/status change/delete itinerary works
  4. Template table shows port sequence, add/edit/delete works
  5. Cabin price templates render, "Init Cabins" creates from ship cabins
  6. Other charge templates show indicator badge column
  7. Currency dropdown change auto-fills exchange rate (editable)
  8. Sailing bar shows pill buttons with date and status
  9. Clicking a sailing pill loads all detail sections
  10. Cruise points table shows ports with arrival/departure
  11. Cabin charges table shows Prebk and Avail columns
  12. Prebook dialog validates against booked/reserved minimum
  13. Other charges table shows indicator badge column
  14. Bookings table shows current bookings with add-on badges
  15. Delete itinerary redirects to cruise-dash.html
  16. Old cruisemgmt.html still works independently