# Fusion Schedule Redesign

Date: 2026-03-15
Status: Approved

## Summary

Redesign the `/my/schedule` portal page with responsive mobile-friendly layout,
add email/phone to the booking form, enable reschedule/cancel for both staff and
public visitors, show source calendar in event listings, and add a share button
for the public booking link.

## Features

### 1. Booking Form -- Email & Phone Fields

Add optional Email and Phone fields to the internal booking form (Step 2).
If email is provided, find-or-create a `res.partner` and add them as an attendee
so Odoo sends a calendar invitation. If no email, event is created with only the
staff user as attendee (current behavior).

Files: `portal_schedule.xml`, `portal_schedule.py`

### 2. Reschedule & Cancel

**Staff users** (logged in, `/my/schedule`):
- Each event row gets Reschedule and Cancel action buttons
- Reschedule opens a modal with date picker + slot selector (reuses existing slot API)
- Cancel shows confirmation, then deletes the event
- New endpoints: `/my/schedule/event/reschedule`, `/my/schedule/event/cancel`

**External visitors** (booked via public link):
- After booking, show a manage URL with a unique token: `/schedule/manage/<token>`
- Token stored as `x_fc_manage_token` on `calendar.event`
- Manage page shows appointment details + Reschedule / Cancel buttons
- No login required; token is the auth
- New endpoints: `/schedule/manage/<token>`, `/schedule/manage/<token>/reschedule`,
  `/schedule/manage/<token>/cancel`

Files: `calendar_event.py`, `portal_schedule.py`, `portal_schedule.xml`,
`public_booking.xml`, `portal_schedule_accounts.js`

### 3. Source Calendar Column

Add a "Source" column to Today's Appointments and Upcoming Appointments tables.
Show provider icon (Google/Outlook) + truncated email, or "Odoo" for local events.
Data already available via `x_fc_source_account_id`.

Files: `portal_schedule.xml`, `portal_schedule.py`

### 4. Share Public Booking Link

Add a prominent "Share Calendar" button in the header area of `/my/schedule`.
Clicking copies the public booking link to clipboard. The public booking page
already only shows available time slots (no existing events).

Files: `portal_schedule.xml`

### 5. Responsive Redesign

- Connected Calendars: collapsible section, compact status bar when collapsed,
  full details when expanded. Collapsed by default.
- Today's Appointments: card-based on mobile, list on desktop
- Upcoming Appointments: table on desktop, card list on mobile
- All action buttons: icon-only on mobile, icon+text on desktop
- Bootstrap 5 responsive utilities throughout

Files: `portal_schedule.xml`, new CSS in `portal_schedule.css`

## Data Model Changes

`calendar.event`:
- Add `x_fc_manage_token` (Char, index=True) for public manage links

## New Endpoints

| Route | Auth | Method | Purpose |
|-------|------|--------|---------|
| `/my/schedule/event/cancel` | user | JSONRPC | Cancel/delete a calendar event |
| `/my/schedule/event/reschedule` | user | JSONRPC | Reschedule a calendar event |
| `/schedule/manage/<token>` | public | HTTP | View appointment details |
| `/schedule/manage/<token>/reschedule` | public | POST | Reschedule via token |
| `/schedule/manage/<token>/cancel` | public | POST | Cancel via token |

## Security

- Staff reschedule/cancel: verify `partner_ids` contains current user
- Public manage: token-only access, tokens are 32-char hex random
- All mutations use CSRF protection
