
<?php
    $pricingClasses = $pricingClasses ?? collect();
    $capacities = is_array($tour->class_capacities ?? null) ? $tour->class_capacities : [];
    // Etkin toplam kelle: tarih-bazlı ele Faz 3'te; burada turun genel maks katılımcısı
    $maxParticipants = (int) ($tour->max_participants ?? 0);
?>

<div class="pqv-section pcc-block" data-pcc data-pcc-save="<?php echo e($saveUrl); ?>" data-pcc-max="<?php echo e($maxParticipants); ?>">
    <div class="pqv-sec-title"><i class="fas fa-layer-group"></i> Kademeli (Sınıf) Fiyatlandırma</div>

    <label class="pcc-toggle">
        <input type="checkbox" data-pcc-toggle <?php if($tour->use_pricing_classes): echo 'checked'; endif; ?>>
        <span>Bu turda <b>sınıf-bazlı</b> fiyatlandırma kullan</span>
    </label>

    <div data-pcc-body style="<?php echo e($tour->use_pricing_classes ? '' : 'display:none'); ?>">
        <?php if($pricingClasses->isEmpty()): ?>
            <p class="pcc-hint mt-2"><i class="fas fa-circle-info"></i> Henüz fiyat sınıfı yok. <b>Ayarlar → Fiyat Sınıfları</b>'ndan tanımlayın.</p>
        <?php else: ?>
            <div class="pcc-capbar">
                <span><i class="fas fa-users"></i> Sınıf kapasiteleri <small>(kelle = yetişkin + çocuk; bebek sayılmaz)</small></span>
                <button type="button" class="pcc-mini" data-pcc-autosplit><i class="fas fa-wand-magic-sparkles"></i> Otomatik böl</button>
            </div>

            <div class="pcc-grid">
                <?php $__currentLoopData = $pricingClasses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cls): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php $cap = $capacities[$cls->id] ?? null; ?>
                    <div class="pcc-cell">
                        <label>
                            <span class="pcc-code"><?php echo e($cls->code ?: mb_substr($cls->name, 0, 1)); ?></span>
                            <?php echo e($cls->name); ?>

                            <?php if($cls->is_base): ?><span class="pcc-base">taban</span><?php endif; ?>
                        </label>
                        <input type="number" min="0" step="1" data-pcc-cap data-class-id="<?php echo e($cls->id); ?>"
                               name="class_capacities[<?php echo e($cls->id); ?>]" value="<?php echo e($cap); ?>" placeholder="0">
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>

            <div class="pcc-total" data-pcc-total></div>
            <p class="pcc-hint"><i class="fas fa-circle-info"></i> Toplam, turun maksimum katılımcısını (kelle) aşamaz. Tarih bazlı maks kelle girilmişse tarih ekranında o baz alınır.</p>
        <?php endif; ?>
    </div>
</div>
<?php /**PATH C:\xampp\htdocs\acente\resources\views/agency/products/_qv-pricing-classes.blade.php ENDPATH**/ ?>