# 📍 QUICK REFERENCE - GPS Absensi Guru

## ⚡ Setup Cepat (5 Menit)

### 1. Set Koordinat Sekolah
```sql
UPDATE pengaturans SET 
    latitude = -5.30134,     -- GANTI dengan koordinat sekolah Anda
    longitude = 122.29880,   -- GANTI dengan koordinat sekolah Anda
    radius = 100             -- Radius dalam meter (default: 100m)
WHERE id = 1;
```

### 2. Clear Cache
```bash
php artisan config:clear && php artisan cache:clear && php artisan view:clear
```

### 3. Test
- Login sebagai guru
- Akses: `/simaju/absensi-guru/create`
- Klik "Absen Masuk Sekarang"
- Allow GPS → Test absensi

---

## 🔍 Cara Dapat Koordinat

### Google Maps:
1. Buka: https://maps.google.com
2. Cari lokasi sekolah
3. **Klik kanan** pada titik
4. Klik koordinat yang muncul (contoh: -5.30134, 122.29880)
5. Copy ke pengaturan

### Smartphone:
1. Berdiri di lokasi sekolah
2. Buka Google Maps
3. Tap lokasi Anda (titik biru)
4. Lihat koordinat di bawah
5. Catat dan input

---

## 📊 Default Values

Jika belum set di database:
- **Latitude:** -5.30134
- **Longitude:** 122.29880
- **Radius:** 100 meter

⚠️ **PENTING:** Segera ganti dengan koordinat sekolah sebenarnya!

---

## ✅ Testing Checklist

### Test 1: Dalam Radius ✅
- [ ] Login guru
- [ ] Klik absen masuk
- [ ] Allow GPS
- [ ] GPS detected dalam radius
- [ ] Foto berhasil diambil
- [ ] Absensi tersimpan

### Test 2: Luar Radius ❌
- [ ] Login dari lokasi jauh (atau set radius kecil: 10m)
- [ ] Klik absen masuk
- [ ] GPS detected diluar radius
- [ ] Error message muncul
- [ ] Button capture disabled
- [ ] Tidak bisa submit

### Test 3: GPS Off ❌
- [ ] Matikan GPS/Lokasi
- [ ] Klik absen masuk
- [ ] Error: "Lokasi tidak tersedia"
- [ ] Button disabled

---

## 🐛 Troubleshooting Cepat

| Masalah | Fix |
|---------|-----|
| "GPS tidak terdeteksi" | Aktifkan GPS → Refresh |
| "Selalu diluar radius" | Cek koordinat → Naikkan radius |
| "Izin ditolak" | Address bar → Reset permission → Refresh |
| Button disabled | Check console (F12) → Lihat error GPS |

---

## 📱 User Flow

```
Guru → Buka Halaman Absensi
  ↓
Klik "Absen Masuk"
  ↓
Allow Kamera + GPS
  ↓
GPS Detection → Calculate Distance
  ↓
┌─────────────────┬─────────────────┐
│  Dalam Radius   │  Luar Radius    │
│      ✅         │      ❌         │
├─────────────────┼─────────────────┤
│ Button Enabled  │ Button Disabled │
│ Ambil Foto      │ Show Error      │
│ Submit          │ Cannot Continue │
│ Save to DB      │ -               │
└─────────────────┴─────────────────┘
```

---

## 🔐 Security

**Frontend:** UX validation (instant feedback)  
**Backend:** Security validation (cannot bypass)  
**Result:** Double protection ✅

---

## 📄 Docs

- `DOKUMENTASI_GPS_ABSENSI_GURU.md` - Full documentation
- `TESTING_GPS_ABSENSI_GURU.md` - Testing guide
- `RINGKASAN_IMPLEMENTASI_GPS.md` - Implementation summary
- `QUICK_REFERENCE_GPS.md` - This file

---

## ⚙️ Konfigurasi Advanced

### Adjust Radius per Kebutuhan:
- **50-100m:** Area kecil (akurat)
- **100-200m:** Standard (recommended)
- **200-500m:** Area besar

### Browser yang Didukung:
- ✅ Chrome (Desktop + Mobile)
- ✅ Firefox
- ✅ Safari (iOS)
- ✅ Edge
- ❌ Internet Explorer (tidak support)

---

**Last Updated:** 7 Agustus 2026  
**Status:** ✅ READY FOR PRODUCTION
