Files
2026-05-06 00:18:37 +02:00

53 lines
2.5 KiB
Markdown

# Codebase Overview
**Project:** jachty3.pagedev.pl — Yacht Booking System
**Analyzed:** 2026-05-05
## What This Is
A custom WordPress plugin (`yacht-booking-system`) that provides yacht rental booking management with a FullCalendar frontend, REST API backend, Google Calendar bidirectional sync, and iCal feed export/import. Built for a Polish yacht charter company at `https://jachty.pagedev.pl`.
## Primary Entry Point
`wp-content/plugins/yacht-booking-system/yacht-booking-system.php`
- Defines 5 plugin constants (`YACHT_BOOKING_VERSION`, `YACHT_BOOKING_PLUGIN_DIR`, etc.)
- Registers a custom `spl_autoload_register` for the `YachtBooking\` namespace → `includes/class-*.php`
- Fires `Yacht_Booking::get_instance()` on `plugins_loaded`
- Activation hook: runs `Installer::install()`, schedules GCal and iCal cron jobs, flushes rewrite rules
## Core Data Model
Two parallel stores:
1. **WordPress CPTs** (in `wp_posts` + `wp_postmeta`):
- `yacht` — meta: capacity, price_per_day, gcal_id, features, ical_token, ical_import_url
- `yacht_booking` — meta: yacht_id, start_date, end_date, status, customer_*, total_price, gcal_event_id, source
- `yacht_inquiry` — meta: yacht_id, customer_*, preferred_dates, message (hidden from WP admin UI)
2. **Custom availability table** `wp_yacht_availability`:
- One row per yacht-date pair; only `booked` and `blocked` rows stored; absence = available
- Unique key on `(yacht_id, date)`
## User-Facing Features
- FullCalendar month view embedded via `[yacht_calendar yacht_id="X"]` shortcode or Elementor widget
- Booking form (date selection → customer details → submission via REST)
- Inquiry form (non-binding contact, sends email to admin)
- iCal feed per yacht at `{home_url}/yacht-ical/{yacht_id}/{token}.ics`
## Admin Features
- Custom admin menu with 6 pages: Bookings list, Inquiries list, Yachts list/edit, Settings, Google Calendar
- Approve/Cancel/Delete bookings with PRG pattern
- CSV export of bookings
- Google Calendar bidirectional sync (OAuth 2.0, manual + hourly cron)
- iCal import from external URLs per yacht (hourly cron)
- Email notifications: admin on booking create, customer on status change
## Language / Locale
UI language: Polish. All strings use `__()` / `esc_html__()` with `yacht-booking` text domain.
## Team / Deployment
Single developer. FTP deploy via ftp-kr VS Code extension. No CI/CD pipeline. Production: `https://jachty.pagedev.pl`. No Docker, no local environment config detected.