# Quick Start: Map Import Feature 🗺️

## How to Use the Map Link Import Feature

### Step 1: Get Your Map URL

#### From **mapy.cz**:
1. Go to https://mapy.cz
2. Search for your stadium/location
3. Copy the URL from the browser address bar
   - Example: `mapy.com/en/letecka?x=17.6996859&y=50.0947150&z=19`

#### From **Google Maps**:
1. Go to https://maps.google.com
2. Search for your stadium/location
3. Copy the URL from the browser address bar
   - Example: `google.com/maps/@50.0946232,17.6987331,226m`

### Step 2: Import in Admin Panel

1. **Login to Admin Panel**
   - Navigate to your website's admin area
   - Login with your admin credentials

2. **Go to Settings**
   - Click on "Nastavení" (Settings) in the sidebar
   - Or navigate directly to `/admin/settings`

3. **Open "Kontakt & Mapa" Tab**
   - You'll see tabs at the top: Obecné, SEO, Sociální sítě, **Kontakt & Mapa**, etc.
   - Click on **"Kontakt & Mapa"**

4. **Paste Your Map URL**
   - Find the section "Importovat z URL mapy"
   - Paste your URL into the input field
   - The system will automatically recognize it! ✨

5. **Review the Details**
   - You'll see a green success message showing:
     - ✅ Source (mapy.cz or Google Maps)
     - 📍 Latitude & Longitude
     - 🔍 Zoom level
     - 📍 Location name (if available)
   - A **live map preview** appears below

6. **Import the Coordinates**
   - Click the green **"Importovat"** button
   - You'll see a confirmation toast
   - Coordinates are now applied to your settings

7. **Configure Display Options**
   - Toggle **"Zobrazit mapu na titulní stránce"** to show/hide on homepage
   - Select **map style**: Výchozí, Tmavý, or Satelitní

8. **Save Your Settings**
   - Scroll to the bottom
   - Click **"Uložit nastavení"** (Save Settings)
   - Done! 🎉

## Example URLs (For Krnov Stadium)

### mapy.cz URL:
```
mapy.com/en/letecka?q=krnov%20stadion&source=firm&id=12954454&ds=2&x=17.6996859&y=50.0947150&z=19
```

### Google Maps URL:
```
www.google.com/maps/place/Fotbalový+stadión/@50.0946232,17.6987331,226m/data=!3m1!1e3!4m10!1m2!2m1!1skrnov+stadion
```

## What Gets Imported

When you paste a URL, the system extracts:

| Field | Description | Example |
|-------|-------------|---------|
| **Latitude** | Geographic latitude | 50.0947150 |
| **Longitude** | Geographic longitude | 17.6996859 |
| **Zoom** | Map zoom level | 19 |
| **Address** | Location name (optional) | "krnov stadion" |

## Troubleshooting

### ❌ "Nepodařilo se rozpoznat URL mapy"
- **Problem**: URL format not recognized
- **Solution**: Make sure you copied the full URL from mapy.cz or Google Maps
- **Tip**: The URL should contain coordinates (numbers like `50.094` and `17.699`)

### ❌ "Souřadnice jsou mimo platný rozsah"
- **Problem**: Invalid coordinates
- **Solution**: This shouldn't happen with valid map URLs, but check if the URL was corrupted

### ℹ️ Map Not Showing on Homepage
- **Check**: Make sure "Zobrazit mapu na titulní stránce" is toggled ON
- **Check**: Verify coordinates are saved (refresh settings page)
- **Backend**: Ensure backend supports the new fields (see MAP_LINK_IMPORT_FEATURE.md)

## Additional Contact Information

In the same "Kontakt & Mapa" tab, you can also fill in:

- 🏠 **Adresa** (Street address)
- 🏙️ **Město** (City)
- 📮 **PSČ** (Postal code)
- 🌍 **Země** (Country)
- ☎️ **Telefon** (Phone)
- 📧 **E-mail** (Email)

These will be displayed on your contact page and homepage!

## Need Help?

If you encounter any issues:
1. Check the browser console for errors (F12)
2. Verify your admin permissions
3. Contact your system administrator
4. Refer to `MAP_LINK_IMPORT_FEATURE.md` for technical details

---

**Note**: The backend must support the new fields. If you're getting errors when saving, contact your developer to update the backend settings model.
