# 🚀 Apper Reserve - Geliştirme Planı

**Proje:** Online Restoran Rezervasyon Sistemi  
**Durum:** Aktif Geliştirme  
**Son Güncelleme:** 19 Nisan 2026 - Bildirim Sistemi tamamlandı

---

## 📋 Proje Özeti

Apper Reserve, restoranların online rezervasyon alabilmesi ve müşterilerin kredi kartı ile ön ödeme yapabilmesi için geliştirilmiş bağımsız bir rezervasyon sistemidir.

### Temel Özellikler
- ✅ Bağımsız sistem (PosCloud entegrasyonu yok)
- ✅ Kredi kartı ile ön ödemeli rezervasyon
- ✅ Otomatik masa atama sistemi
- ✅ Çoklu restoran desteği (team-based)
- ✅ Apper ekosistem entegrasyonu (workspace.apper.com.tr)
- ✅ PayTR ödeme gateway entegrasyonu

---

## ✅ TAMAMLANAN İŞLER

### 1. Proje Hazırlığı ve Temizlik
- [x] Gereksiz dosyaların temizlenmesi (126 dosya silindi)
  - [x] POS/Inventory/Menu ile ilgili modeller silindi
  - [x] Gereksiz controller'lar silindi
  - [x] Livewire component'leri temizlendi
  - [x] View klasörleri temizlendi
  - [x] Migration dosyaları temizlendi
- [x] Composer autoload güncellendi
- [x] Cache temizleme işlemleri yapıldı
- [x] Git commit'leri oluşturuldu

### 2. Veritabanı Katmanı
- [x] Migration dosyaları oluşturuldu (Ana projede)
  - [x] res_restaurants
  - [x] res_tables
  - [x] res_reservations
  - [x] res_restaurant_settings
  - [x] res_reservation_notifications
  - [x] res_blocked_dates
- [x] Tüm tablolara `user_id` ve `current_team_id` kolonları eklendi
- [x] Veritabanı migration işlemi tamamlandı

### 3. Model Katmanı
- [x] Restaurant Model oluşturuldu
  - [x] Fillable alanları tanımlandı
  - [x] Relationships kuruldu (tables, settings, reservations, blockedDates)
  - [x] CurrentTeamScope uygulandı
  - [x] Slug generation özelliği eklendi
  
- [x] Table Model oluşturuldu
  - [x] Fillable alanları tanımlandı
  - [x] Relationships kuruldu (restaurant, reservations)
  - [x] CurrentTeamScope uygulandı
  - [x] Capacity ve section yönetimi
  
- [x] Reservation Model oluşturuldu
  - [x] Fillable alanları tanımlandı
  - [x] Relationships kuruldu (restaurant, table, notifications)
  - [x] CurrentTeamScope uygulandı
  - [x] Status enum tanımlandı (pending, confirmed, cancelled, completed)
  - [x] Confirmation code generation
  - [x] Duration hesaplama mantığı
  
- [x] RestaurantSetting Model oluşturuldu
  - [x] Fillable alanları tanımlandı
  - [x] Relationships kuruldu (restaurant)
  - [x] CurrentTeamScope uygulandı
  - [x] JSON cast'ler tanımlandı (working_hours, reservation_settings, notification_settings)
  - [x] PayTR API credentials alanları
  
- [x] ReservationNotification Model oluşturuldu
  - [x] Fillable alanları tanımlandı
  - [x] Relationships kuruldu (reservation)
  - [x] CurrentTeamScope uygulandı
  - [x] Scope metodları (pending, sent, failed)
  
- [x] BlockedDate Model oluşturuldu
  - [x] Fillable alanları tanımlandı
  - [x] Relationships kuruldu (restaurant)
  - [x] CurrentTeamScope uygulandı
  - [x] Scope metodları (fullDay, forDate)
  - [x] Static helper metod (isBlocked)

### 4. Global Scopes
- [x] CurrentTeamScope tüm modellere uygulandı
  - [x] Restaurant
  - [x] Table
  - [x] Reservation
  - [x] RestaurantSetting
  - [x] ReservationNotification
  - [x] BlockedDate

---

## 🔄 DEVAM EDEN İŞLER

### ADIM 4: Admin Panel 🎛️
- [x] RestaurantController oluşturuldu
  - [x] index() - Restoran listesi
  - [x] create() - Yeni restoran formu
  - [x] store() - Restoran kaydet
  - [x] edit() - Restoran düzenle formu
  - [x] update() - Restoran güncelle
  - [x] destroy() - Restoran sil
- [x] TableController oluşturuldu
  - [x] index() - Masa listesi
  - [x] create() - Yeni masa formu
  - [x] store() - Masa kaydet
  - [x] show() - Masa detayı
  - [x] edit() - Masa düzenle formu
  - [x] update() - Masa güncelle
  - [x] destroy() - Masa sil
- [x] ReservationController oluşturuldu
  - [x] index() - Rezervasyon listesi (filtreleme ile)
  - [x] show() - Rezervasyon detayı
  - [x] confirm() - Rezervasyon onayla
  - [x] cancel() - Rezervasyon iptal et
  - [x] complete() - Rezervasyon tamamla
  - [x] today() - Bugünkü rezervasyonlar
- [x] SettingsController oluşturuldu
  - [x] edit() - Ayarlar düzenle
  - [x] update() - Ayarlar güncelle
  - [x] workingHours ayarları
  - [x] deposit ayarları
  - [x] notification ayarları
  - [x] PayTR API credentials
- [x] BlockedDateController oluşturuldu
  - [x] index() - Engellenen tarihler
  - [x] store() - Tarih engelle
  - [x] destroy() - Engel kaldır
- [x] Admin routes tanımlandı
  - [x] /admin/dashboard
  - [x] /admin/restaurants (CRUD)
  - [x] /admin/restaurants/{restaurant}/tables (CRUD)
  - [x] /admin/restaurants/{restaurant}/reservations (CRUD + actions)
  - [x] /admin/restaurants/{restaurant}/settings
  - [x] /admin/restaurants/{restaurant}/blocked-dates
- [x] Admin layout oluşturuldu
- [x] Dashboard view oluşturuldu
- [x] Restaurant CRUD view'ları oluşturuldu
- [x] Reservation management view oluşturuldu

---

## 📝 YAPILACAK İŞLER

### ADIM 5: Bildirim Sistemi 🔔
- [x] NotificationService oluşturuldu
  - [x] sendConfirmationEmail() - Onay maili gönder
  - [x] sendReminderEmail() - Hatırlatma maili gönder
  - [x] sendCancellationEmail() - İptal maili gönder
  - [x] sendAdminNotification() - Admin'e bildirim
- [x] Email Templates oluşturuldu
  - [x] reservation-confirmation.blade.php
  - [x] reservation-reminder.blade.php
  - [x] reservation-cancellation.blade.php
  - [x] admin-new-reservation.blade.php
  - [x] layout.blade.php (base email template)
- [x] Scheduled Jobs oluşturuldu
  - [x] SendReservationReminder (günlük 09:00'da çalışır)
  - [x] CleanupOldReservations (haftalık Pazar 02:00'de çalışır)
- [x] Kernel.php'de schedule tanımları yapıldı
- [x] ReservationService entegrasyonu tamamlandı
  - [x] Rezervasyon oluşturma sırasında admin bildirimi
  - [x] Rezervasyon onaylama sırasında müşteri onay maili
  - [x] Rezervasyon iptal sırasında müşteri iptal maili

---

### ADIM 6: Middleware ve Güvenlik 🔒

#### 6.1. Middleware
- [ ] CheckReserveAccess middleware oluşturulacak
  - [ ] UserAccess kontrolü (type = 'reserve')
  - [ ] Yetkisiz erişimi engelle

#### 6.2. Policies
- [ ] RestaurantPolicy oluşturulacak
- [ ] ReservationPolicy oluşturulacak
- [ ] Policy'ler AuthServiceProvider'a kaydedilecek

#### 6.3. Validation Rules
- [ ] Custom validation rules oluşturulacak
  - [ ] ValidReservationTime
  - [ ] AvailableTable
  - [ ] NotBlockedDate

---

### ADIM 7: Testing 🧪

#### 7.1. Unit Tests
- [ ] ReservationService testleri
- [ ] AvailabilityService testleri
- [ ] Model relationship testleri

#### 7.2. Feature Tests
- [ ] Public reservation flow testleri
- [ ] Admin CRUD operations testleri
- [ ] Payment integration testleri
- [ ] Notification tests

#### 7.3. Browser Tests (Opsiyonel)
- [ ] Dusk tests for critical flows

---

### ADIM 8: Deployment ve Dokümantasyon 📚

#### 8.1. Environment Configuration
- [ ] .env.example güncellenecek
  - [ ] PayTR credentials
  - [ ] Email settings
  - [ ] Queue configuration

#### 8.2. Queue Setup
- [ ] Queue worker configuration
- [ ] Supervisor setup (production)

#### 8.3. Documentation
- [ ] README.md güncellenecek
- [ ] API documentation (eğer varsa)
- [ ] Admin user guide
- [ ] Deployment guide

#### 8.4. Performance Optimization
- [ ] Database indexing kontrolü
- [ ] Query optimization
- [ ] Caching strategy

---

## 📊 İLERLEME DURUMU

```
✅ Tamamlanan:        90% (Model, business logic, public sistem, admin panel ve bildirimler)
🔄 Devam Eden:        0%
⏳ Bekleyen:          10%
```

### Milestone Takibi
- [x] **Milestone 1:** Proje Hazırlığı ve Temizlik ✅
- [x] **Milestone 2:** Veritabanı ve Model Katmanı ✅
- [x] **Milestone 3:** Business Logic (Services) ✅
- [x] **Milestone 4:** Public Rezervasyon Sistemi ✅
- [x] **Milestone 5:** Admin Panel ✅
- [x] **Milestone 6:** Bildirim Sistemi ✅
- [ ] **Milestone 7:** Testing
- [ ] **Milestone 8:** Deployment

---

## 🔗 Faydalı Linkler

- **Ana Panel:** workspace.apper.com.tr
- **Geliştirme URL:** reserve.apper.test (local)
- **Production URL:** reserve.apper.com.tr
- **PayTR Dokümantasyon:** https://dev.paytr.com
- **Laravel Docs:** https://laravel.com/docs

---

## 📝 Notlar

### Kararlar
1. **Bağımsız Sistem:** PosCloud ile entegrasyon yok, tamamen bağımsız çalışıyor
2. **Tablo Prefix:** Tüm tablolar `res_` prefixi ile başlıyor
3. **Masa Ataması:** Otomatik, müşteriye gösterilmiyor
4. **Rezervasyon Süresi:** Varsayılan 2 saat, JSON config ile değiştirilebilir
5. **Ön Ödeme:** İşletme tarafından belirlenen tutar veya yüzde
6. **Onay:** Otomatik onay (ödeme başarılı olunca)

### Teknik Detaylar
- **Framework:** Laravel 10
- **Auth:** Jetstream + Fortify
- **Frontend:** Livewire + Blade
- **Database:** MySQL (Local)
- **Payment:** PayTR Gateway
- **Queue:** Redis/Database (TBD)

### Bilinen Sorunlar
*(Henüz yok)*

---

## 👥 Ekip

- **Developer:** [İsim]
- **Project Manager:** [İsim]
- **Last Updated:** 19 Nisan 2026

---

**Not:** Bu dosya geliştirme sürecinde sürekli güncellenecektir. Her milestone tamamlandığında işaretleyiniz.
