# Split Navigation Management System

## 🎯 Overview

The navigation system now supports **separate management** for:
1. **Webová navigace** (Frontend) - Public website menu
2. **Admin panel** - Admin sidebar navigation
3. **Sociální sítě** - Social media links

## ✨ Key Features

### Frontend Navigation
- **Dynamic menu** on public website
- Supports dropdown menus with sub-items
- Mobile-responsive
- Hover menus on desktop
- Customizable ordering

### Admin Panel Navigation
- **Manage sidebar** menu in admin interface
- **Preset admin pages** - Quick selection
- **Custom links** - Add external tools (Webmail, etc.)
- **Categories** - Group items with dropdown
- **Hide unused sections** - Keep it clean
- **Reorder items** - Prioritize your workflow

### Social Media Links
- Add/remove social platforms
- Customizable ordering
- Show/hide toggle
- Supports: Facebook, Instagram, YouTube, Twitter, TikTok, LinkedIn, Discord, Twitch

## 📍 Quick Access

**Admin Panel Location:** `/admin` → **Navigace** (in sidebar under "Nastavení")

**Quick Search:** Press `Ctrl+K` in admin and type "navigace"

## 🚀 Getting Started

### 1. Frontend Navigation Setup

1. Go to `/admin/navigace`
2. Click tab **"Webová navigace"**
3. Click **"Přidat hlavní položku"**
4. Select:
   - **Type:** Page (for existing pages) or External (for outside links)
   - **Page:** Choose from dropdown (Home, Blog, Calendar, etc.)
   - **Visible:** Toggle on/off
5. Use up/down arrows to reorder
6. For dropdown menus:
   - Set type to "Dropdown"
   - After saving, click "Přidat podpoložku" to add children

**Example:** Create "Teams" dropdown with sub-pages
```
Main Item:
- Label: Týmy
- Type: Dropdown
- Visible: Yes

Sub-items (click "Přidat podpoložku"):
- A-tým → /hraci
- Mládež → /mladez
- Trenéři → /treneri
```

### 2. Admin Panel Navigation Setup

1. Go to `/admin/navigace`
2. Click tab **"Admin panel"**
3. Click **"Přidat položku do admin panelu"**
4. Choose from preset admin pages OR create custom link:

**Preset Pages:**
- Nástěnka, Analytika, Týmy, Zápasy, etc.
- Automatically sets correct URL

**Custom External Link (e.g., Webmail):**
```
Label: Webmail
Type: Externí odkaz
URL: https://webmail.yourclub.com
Target: _blank (new window)
```

**Create Category:**
```
Main Item:
- Label: Obsah
- Type: Kategorie (dropdown)

Sub-items:
- Články → /admin/clanky
- Videa → /admin/videa
- Galerie → /admin/galerie
```

### 3. Social Media Links

1. Go to `/admin/navigace`
2. Click tab **"Sociální sítě"**
3. Click **"Přidat sociální síť"**
4. Select platform and enter URL
5. Reorder with up/down arrows

## 🎨 Admin Panel Customization Examples

### Hide Unused Sections
Don't use Teams feature? Just toggle **visibility off** - item stays in database but hidden from sidebar.

### Add External Tools
```yaml
Webmail:
  Label: "Webmail"
  Type: External
  URL: "https://webmail.example.com"
  Target: _blank

Google Analytics:
  Label: "Analytics Dashboard"
  Type: External
  URL: "https://analytics.google.com/..."
  Target: _blank
```

### Organize by Category
```
📊 Dashboard
  - Nástěnka
  - Analytika

📝 Content Management
  - Články
  - Videa
  - Galerie
  
⚙️ Settings
  - Nastavení
  - Uživatelé
  - Navigace

🔗 External Tools
  - Webmail
  - Google Drive
```

### Custom Names
Rename default pages:
```
"Články" → "News & Updates"
"Zápasy" → "Match Center"
"Týmy" → "Squad Management"
```

## 📋 Available Preset Admin Pages

### Main
- **Nástěnka** - `/admin` - Dashboard overview
- **Analytika** - `/admin/analytika` - Analytics & stats

### Content
- **Týmy** - `/admin/tymy` - Team management
- **Zápasy** - `/admin/zapasy` - Match management
- **Aktivity** - `/admin/aktivity` - Events & activities
- **Hráči** - `/admin/hraci` - Player roster
- **Články** - `/admin/clanky` - Articles/Blog posts
- **Videa** - `/admin/videa` - Video management
- **Galerie** - `/admin/galerie` - Photo gallery

### Communication
- **Zprávy** - `/admin/zpravy` - Messages/Contact forms
- **Kontakty** - `/admin/kontakty` - Contact management
- **Zpravodaj** - `/admin/newsletter` - Newsletter campaigns

### Settings
- **Navigace** - `/admin/navigace` - Navigation management
- **Uživatelé** - `/admin/uzivatele` - User accounts
- **Nastavení** - `/admin/nastaveni` - General settings
- **Soubory** - `/admin/soubory` - File manager
- **Prefetch** - `/admin/prefetch` - Cache management
- **Dokumentace** - `/admin/docs` - Help docs

## 🔧 Technical Details

### Navigation Item Properties

| Field | Frontend Nav | Admin Nav | Description |
|-------|-------------|-----------|-------------|
| **label** | ✅ | ✅ | Display name |
| **type** | page, internal, external, dropdown | internal, external, dropdown | Item type |
| **page_type** | Frontend pages | Admin pages | Preset page identifier |
| **url** | Auto or custom | Auto or custom | Link URL |
| **visible** | ✅ | ✅ | Show/hide toggle |
| **display_order** | ✅ | ✅ | Sort order |
| **parent_id** | ✅ | ✅ | For nested items |
| **target** | _self, _blank | _self, _blank | Link target |
| **requires_admin** | false | true | Marks as admin nav |

### Database Separation

Navigation items are **not stored in separate tables**. Instead:
- Items with `requires_admin = false` → Frontend navigation
- Items with `requires_admin = true` → Admin panel navigation

This allows:
- ✅ Unified management interface
- ✅ Shared functionality (reorder, visibility, etc.)
- ✅ Easy migration between frontend/admin
- ✅ Consistent API endpoints

### API Endpoints

Same endpoints handle both types:
```
GET    /api/v1/navigation        # Public (requires_admin=false only)
GET    /api/v1/admin/navigation  # Admin (all items)
POST   /api/v1/admin/navigation
PUT    /api/v1/admin/navigation/:id
DELETE /api/v1/admin/navigation/:id
POST   /api/v1/admin/navigation/reorder
```

## 💡 Best Practices

### Frontend Navigation
- **Keep it simple** - Max 7-9 top items
- **Logical grouping** - Use dropdowns for related pages
- **Clear labels** - Users should know where they're going
- **Mobile-first** - Test on mobile devices

### Admin Panel
- **Hide unused** - Don't delete, just hide
- **Categorize** - Group related pages
- **Custom tools** - Add frequently-used external links
- **Prioritize** - Most-used items at top

### General
- **Test changes** - Preview before making live
- **Document custom** - Note any custom URLs
- **Regular review** - Remove unused items periodically

## 🐛 Troubleshooting

### Admin panel items not showing
- Check `requires_admin` is set to `true`
- Verify visibility is enabled
- Check browser console for errors

### Frontend navigation not updating
- Changes require page refresh
- Check API endpoint returns data
- Verify `requires_admin` is `false`

### Dropdown not working
- Parent must have type="dropdown"
- Children must have parent_id set
- Children must be visible

### Custom URL not working
- Ensure URL starts with `/` for internal
- Use full `https://` for external
- Check target setting for external links

## 🎓 Examples & Use Cases

### Use Case 1: Multi-Team Club
```
Frontend:
├── Domů
├── Týmy (dropdown)
│   ├── A-tým
│   ├── B-tým
│   ├── Dorost
│   └── Přípravka
├── Zápasy
└── Kontakt

Admin:
├── Dashboard
├── Content (dropdown)
│   ├── Články
│   ├── Zápasy
│   └── Galerie
└── Nastavení
```

### Use Case 2: External Tools Integration
```
Admin Panel:
├── Dashboard
├── Content Management
├── Settings
├── ─────────────
├── 🔗 External Tools
│   ├── Webmail
│   ├── Google Drive
│   ├── Canva Design
│   └── Social Scheduler
```

### Use Case 3: Minimal Setup
Hide everything except:
```
Frontend:
- Domů
- Zápasy
- Kontakt

Admin:
- Nástěnka
- Zápasy
- Nastavení
```

## 📚 Related Documentation

- **ENHANCED_NAVIGATION_SYSTEM.md** - Full technical documentation
- **NAVIGATION_QUICK_START.md** - Quick reference guide
- **Admin Search** - `Ctrl+K` → Type "navigace"

## 🆘 Support

Having issues?
1. Check this guide first
2. Review browser console for errors
3. Verify database migrations are current
4. Check API responses in Network tab

---

**Version:** 2.0  
**Feature:** Split Navigation Management  
**Status:** ✅ Production Ready  
**Date:** October 2025
