The website builder is a single-page scrollable site per academy at `/site/{slug}`. It has 16 section types, 4 color pickers, 2 font selectors, 3 navbar styles, and a `template` column with 3 values (`bold_athletic`, `clean_professional`, `vibrant_playful`) that is **NOT implemented in rendering** — only one template renders regardless.
### Current DB Tables
-`website_settings` — one row per academy (colors, fonts, navbar_style, social_links JSON, custom_css, analytics IDs, is_published)
- No blog detail page (model has slug but no public show route)
- No language switcher on public site
---
## The 30 Upgrades
---
### UPGRADE 1: Template Switcher (3 → 8 Themes)
**What**: Implement the template system that already has a DB column but no UI or rendering logic. Add 5 more templates beyond the 3 in the CHECK constraint.
**Database Changes**:
```sql
-- Migration: alter website_settings template CHECK constraint
-`resources/views/livewire/website/theme-editor.blade.php` — add 4 new selects in Typography section
-`resources/views/website/layout.blade.php` — emit CSS variables from these settings
-`resources/css/website.css` — use the variables for all text sizing
**Additional Fonts to Add** (expand from 8 to 15):
Cairo, Tajawal, IBM Plex Sans Arabic, Noto Sans Arabic, Almarai, Readex Pro, Rubik, El Messiri, Changa, Noto Kufi Arabic, Amiri, Lateef, Baloo Bhaijaan 2, Scheherazade New, Alexandria
-`app/Livewire/Website/SectionManager.php` — add animation select per section
-`resources/views/website/index.blade.php` — add `data-animation="{{ $section->animation }}"` to section wrapper
-`resources/js/website.js` — refactor IntersectionObserver to read animation type from data attr, respect `animations_enabled` via `data-animations` on body
-`resources/css/website.css` — define keyframes for each animation type
Layouts: `split` (form left + info right, current), `centered` (form only, centered), `full_width` (form + map side by side), `cards` (form in a card with branch cards)
**Files to Modify**:
-`resources/views/website/sections/contact.blade.php` — rewrite with dynamic field rendering, layout switch, map embed
-`app/Livewire/Website/SectionManager.php` — add contact form field builder (add/remove fields, set type/required)
-`app/Http/Controllers/ContactFormController.php` — validate dynamically based on section settings fields config
-`resources/js/website.js` — update AJAX handler to collect dynamic fields
---
### UPGRADE 22: Multi-Page Support
**What**: Allow academies to have multiple pages beyond the single scrolling homepage.
**Sections column**: Array of section_key strings that appear on this page. The existing `website_sections` table remains the source of section content — pages just reference which sections to show and in what order.
-`app/Livewire/Website/SectionManager.php` — add achievements CRUD in partners section settings
-`app/Livewire/Website/PartnerManager.php` — ensure logo upload works (currently logo morphOne exists but verify upload UI)
---
### UPGRADE 26: Language Switcher on Public Site
**What**: Add a functional AR/EN language toggle on the public website.
**Current state**: Content is stored bilingually (title + title_en, etc.) but the public site always renders Arabic. The English URL `oc-sport.com/en` comes from their external WordPress — NOT from our system.
**SectionManager modification**: Add an `$inline` property. When `true`, render a compact version suitable for the side panel (no full page layout). On every save action, dispatch `refresh-preview` event.
---
## Migration Consolidation
All database changes should be in ONE migration file per upgrade phase:
| D | 12, 22, 23, 24, 25, 26 | Floating elements + multi-page + video + map + social proof + language | 3 weeks |
| E | 27, 28, 29, 30 | SEO + mobile overrides + code injection + live editor | 2 weeks |
---
## Important Rules for Implementation
1.**NEVER break existing sites** — all new columns have defaults. Existing sections render exactly as before until admin changes settings.
2.**CSS variables are the theming backbone** — every visual property that can change must be a CSS variable set in `layout.blade.php`.
3.**Settings JSON is for section-specific config** — don't add DB columns for things that only apply to one section type. Use the existing `settings` JSONB column.
4.**Respect the BelongsToAcademy scope** — all new models/queries must be tenant-scoped.
5.**Cache invalidation** — every save in admin must call `WebsiteCacheService::invalidateAll()`.
6.**No JavaScript frameworks** — Alpine.js only for interactivity. No React/Vue.
7.**Tailwind CSS only** — no Bootstrap, no custom CSS frameworks.
8.**Mobile-first** — all layouts must be responsive. Test at 375px width.
9.**RTL-first** — use logical properties (ms/me/ps/pe), never ml/mr/pl/pr.
10.**Bilingual** — every user-facing string uses `__()`. Every content field has `_en` variant.
11.**Piasters for money** — pricing plans store integers (piasters). Display with `format_money()`.
12.**No external API dependencies** — maps use Leaflet+OSM (free), no Google Maps API key needed.
13.**Image optimization** — all uploaded images should be processed (resize to max 1920px width, compress to 80% quality) via `MediaService`.
14.**Lazy loading** — all images below the fold get `loading="lazy"`.
15.**Existing section partials** — when adding layout variants, keep the existing view as the default. Add new variants as sub-partials, selected by settings.