
<div class="res-card">

    
    <form action="" method="GET" id="listFilterForm">
        <input type="hidden" name="view" value="list">
        <?php if(request()->has('product_type_id')): ?>
            <input type="hidden" name="product_type_id" value="<?php echo e(request('product_type_id')); ?>">
        <?php endif; ?>
        <?php if(request()->has('period')): ?>
            <input type="hidden" name="period" value="<?php echo e(request('period')); ?>">
        <?php endif; ?>
        <?php if(request()->has('year')): ?>
            <input type="hidden" name="year" value="<?php echo e(request('year')); ?>">
        <?php endif; ?>
        <?php if(request()->has('month')): ?>
            <input type="hidden" name="month" value="<?php echo e(request('month')); ?>">
        <?php endif; ?>
        <?php if(request()->has('target_type')): ?>
            <input type="hidden" name="target_type" value="<?php echo e(request('target_type')); ?>">
        <?php endif; ?>

        <div class="tb-bar">
            
            <div class="tb-search">
                <i class="fas fa-search"></i>
                <input type="text" name="search" value="<?php echo e(request('search')); ?>"
                    placeholder="Rezervasyon kodu veya müşteri adı ara..." onchange="this.form.submit()">
            </div>

            
            <select name="status" class="tb-filter-select" onchange="this.form.submit()">
                <option value="">Tüm Durumlar</option>
                <option value="potential" <?php echo e(request('status') === 'potential' ? 'selected' : ''); ?>>Potansiyel</option>
                <option value="offer_sent" <?php echo e(request('status') === 'offer_sent' ? 'selected' : ''); ?>>Teklif Verildi</option>
                <option value="revised" <?php echo e(request('status') === 'revised' ? 'selected' : ''); ?>>Revize Edildi</option>
                <option value="confirmed" <?php echo e(request('status') === 'confirmed' ? 'selected' : ''); ?>>Satış Tamamlandı</option>
                <option value="in_progress" <?php echo e(request('status') === 'in_progress' ? 'selected' : ''); ?>>Devam Ediyor</option>
                <option value="completed" <?php echo e(request('status') === 'completed' ? 'selected' : ''); ?>>Kapanan</option>
                <option value="cancelled" <?php echo e(request('status') === 'cancelled' ? 'selected' : ''); ?>>İptal Edildi</option>
                <option value="refunded" <?php echo e(request('status') === 'refunded' ? 'selected' : ''); ?>>İade Edildi</option>
            </select>

            
            <input type="date" name="date_from" value="<?php echo e(request('date_from')); ?>" class="tb-filter-select"
                style="width:140px;" onchange="this.form.submit()" title="Başlangıç tarihi">
            <input type="date" name="date_to" value="<?php echo e(request('date_to')); ?>" class="tb-filter-select"
                style="width:140px;" onchange="this.form.submit()" title="Bitiş tarihi">

            
            <?php if(request()->hasAny(['search', 'status', 'date_from', 'date_to'])): ?>
                <a href="<?php echo e(route('agency.sales.index', array_merge(request()->only(['view', 'product_type_id', 'period', 'year', 'month', 'target_type'])))); ?>"
                    class="tbl-action-btn" title="Filtreleri Temizle" style="color: #ef4444; border-color: #fecaca;">
                    <i class="fas fa-times"></i>
                </a>
            <?php endif; ?>

            
            <?php if($reservations): ?>
                <span
                    style="margin-left:auto; font-size:0.78rem; color:var(--text-muted); font-weight:600; white-space:nowrap;">
                    <?php echo e($reservations->total()); ?> sonuç
                </span>
            <?php endif; ?>
        </div>
    </form>

    
    <div class="table-responsive">
        <table class="table res-table mb-0">
            <thead>
                <tr>
                    <th>KOD / TARİH</th>
                    <th>MÜŞTERİ</th>
                    <th>HİZMET</th>
                    <th>REZ. TARİHİ</th>
                    <th>KİŞİ</th>
                    <th>TUTAR</th>
                    <th>DURUM</th>
                    <th style="text-align:right">İŞLEM</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $reservations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr class="sale-row" data-id="<?php echo e($r->id); ?>">
                        
                        <td>
                            <div style="font-weight:800; color:var(--cp); font-size:0.85rem; letter-spacing:0.3px;">
                                <?php echo e($r->reservation_code); ?>

                            </div>
                            <div style="font-size:.72rem; color:var(--text-muted); margin-top:2px;">
                                <?php echo e($r->created_at->format('d.m.Y H:i')); ?>

                            </div>
                        </td>

                        
                        <td>
                            <div class="d-flex align-items-center gap-2">
                                <div class="cust-avatar">
                                    <?php echo e(strtoupper(substr($r->customer?->first_name, 0, 1))); ?><?php echo e(strtoupper(substr($r->customer?->last_name, 0, 1))); ?>

                                </div>
                                <div>
                                    <div style="font-weight:700; font-size:0.875rem; color:var(--text-main);">
                                        <?php echo e($r->customer?->full_name ?? '—'); ?>

                                    </div>
                                    <div style="font-size:.72rem; color:var(--text-muted);">
                                        <?php echo e($r->customer?->phone); ?>

                                    </div>
                                </div>
                            </div>
                        </td>

                        
                        <td>
                            <span class="svc-badge">
                                <?php if($r->productType?->icon): ?>
                                    <i class="fas <?php echo e($r->productType->icon); ?>" style="font-size:0.65rem;"></i>
                                <?php endif; ?>
                                <?php echo e($r->productType?->name ?? '—'); ?>

                            </span>
                        </td>

                        
                        <td>
                            <div style="font-weight:700; font-size:0.875rem;">
                                <?php echo e($r->start_date?->format('d.m.Y')); ?>

                            </div>
                            <?php if($r->end_date && $r->end_date != $r->start_date): ?>
                                <div style="font-size:.72rem; color:var(--text-muted);">
                                    → <?php echo e($r->end_date->format('d.m.Y')); ?>

                                </div>
                            <?php endif; ?>
                        </td>

                        
                        <td>
                            <div style="font-weight:700; font-size:0.875rem;"><?php echo e($r->total_pax); ?> Kişi</div>
                            <div style="font-size:.7rem; color:var(--text-muted);">
                                <?php echo e($r->adult_count); ?>Y /
                                <?php echo e($r->child_count); ?>Ç /
                                <?php echo e($r->infant_count); ?>B
                            </div>
                        </td>

                        
                        <td>
                            <div style="font-weight:800; font-size:0.95rem; color:var(--text-main);">
                                <?php echo e(number_format($r->total_amount, 2, ',', '.')); ?> <?php echo e($r->currency); ?>

                            </div>
                            <?php if($r->remaining_amount > 0): ?>
                                <div style="font-size:.72rem; color:#ef4444; font-weight:600;">
                                    <i class="fas fa-clock" style="font-size:.6rem;"></i>
                                    Kalan: <?php echo e(number_format($r->remaining_amount, 2, ',', '.')); ?>

                                </div>
                            <?php else: ?>
                                <div style="font-size:.72rem; color:#10b981; font-weight:600;">
                                    <i class="fas fa-check" style="font-size:.6rem;"></i> Ödendi
                                </div>
                            <?php endif; ?>
                        </td>

                        
                        <td>
                            <span class="sale-status-badge"
                                style="background: <?php echo e($r->status_color); ?>18; color: <?php echo e($r->status_color); ?>; border: 1px solid <?php echo e($r->status_color); ?>30;">
                                <?php echo e($r->status_label); ?>

                            </span>
                        </td>

                        
                        <td>
                            <div class="d-flex gap-1 justify-content-end">
                                <a href="<?php echo e(route('agency.sales.show', $r)); ?>" class="tbl-action-btn eye" title="Görüntüle"
                                    onclick="event.stopPropagation()">
                                    <i class="fas fa-eye"></i>
                                </a>
                                <a href="<?php echo e(route('agency.sales.edit', $r)); ?>" class="tbl-action-btn edit" title="Düzenle"
                                    onclick="event.stopPropagation()">
                                    <i class="fas fa-pen"></i>
                                </a>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="8">
                            <div class="empty-state">
                                <div class="empty-state-icon">
                                    <i class="fas fa-search"></i>
                                </div>
                                <h5>Kayıt Bulunamadı</h5>
                                <p>Arama kriterlerinize uygun satış kaydı yok.</p>
                            </div>
                        </td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>

    
    <?php if($reservations && $reservations->hasPages()): ?>
        <div class="pagination-wrap">
            <?php echo e($reservations->links()); ?>

        </div>
    <?php endif; ?>
</div><?php /**PATH C:\xampp\htdocs\acente\resources\views/agency/sales/partials/list_view.blade.php ENDPATH**/ ?>