<?php
    $statusOptions = [
        ['value' => 'active', 'label' => 'Aktif'],
        ['value' => 'inactive', 'label' => 'Pasif'],
        ['value' => 'blocked', 'label' => 'Engelli'],
        ['value' => 'potential', 'label' => 'Potansiyel'],
    ];
    $priorityOptions = [['value' => '1', 'label' => 'Öncelikli'], ['value' => '0', 'label' => 'Normal']];
    $genderOptions = [['value' => 'male', 'label' => 'Erkek'], ['value' => 'female', 'label' => 'Kadın'], ['value' => 'other', 'label' => 'Diğer']];
    $contactMethods = [['value' => 'email', 'label' => 'E-posta'], ['value' => 'phone', 'label' => 'Telefon'], ['value' => 'sms', 'label' => 'SMS']];
?>

<?php if (isset($component)) { $__componentOriginalafd3b985888fa2a33a2082f2c35a64dc = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalafd3b985888fa2a33a2082f2c35a64dc = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.layout','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <!-- ─── HEADER ─── -->
    <?php if (isset($component)) { $__componentOriginala42916bd54053bb95821e6cf6446ae2c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginala42916bd54053bb95821e6cf6446ae2c = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.header','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.header'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
         <?php $__env->slot('avatar', null, ['class' => ''.e($customer->customer_type === 'corporate' ? 'corp' : '').'']); ?> 
            <?php echo e($customer->initials); ?>

         <?php $__env->endSlot(); ?>

         <?php $__env->slot('title', null, []); ?> 
            <span class="inline-editable" data-id="<?php echo e($customer->id); ?>" data-field="first_name"><?php echo e($customer->first_name); ?></span>
            <span class="inline-editable" data-id="<?php echo e($customer->id); ?>" data-field="last_name"><?php echo e($customer->last_name); ?></span>
            <?php if($customer->priority): ?>
                <i class="fas fa-star text-warning animate__animated animate__pulse animate__infinite" style="font-size: 1rem;"></i>
            <?php endif; ?>
         <?php $__env->endSlot(); ?>

         <?php $__env->slot('subtitle', null, []); ?> 
            <span class="sb <?php echo e($customer->status); ?> inline-editable" data-id="<?php echo e($customer->id); ?>" data-field="status" data-type="select" data-options="<?php echo e(json_encode($statusOptions)); ?>" data-value="<?php echo e($customer->status); ?>">
                <?php echo e($customer->status_label); ?>

            </span>
            <span class="text-muted small fw-500">ID: #<?php echo e($customer->id); ?></span>
            <?php if($customer->blacklisted): ?>
                <span class="badge bg-danger-soft text-danger border-0 px-2" style="font-size: 0.7rem; font-weight: 700;">KARA LİSTE</span>
            <?php endif; ?>
         <?php $__env->endSlot(); ?>

         <?php $__env->slot('metrics', null, []); ?> 
            <div class="qv-metric">
                <span class="qv-metric-label">TOPLAM SATIŞ</span>
                <span class="qv-metric-val"><?php echo e(number_format($financial['total_spent'], 0, ',', '.')); ?> ₺</span>
            </div>
            <div class="qv-metric">
                <span class="qv-metric-label">ÖDENEN</span>
                <span class="qv-metric-val text-success"><?php echo e(number_format($financial['total_paid'], 0, ',', '.')); ?> ₺</span>
            </div>
            <div class="qv-metric">
                <span class="qv-metric-label">BAKİYE</span>
                <span class="qv-metric-val <?php echo e($financial['balance'] > 0 ? 'text-danger' : 'text-muted'); ?>"><?php echo e(number_format($financial['balance'], 0, ',', '.')); ?> ₺</span>
            </div>
         <?php $__env->endSlot(); ?>

         <?php $__env->slot('actions', null, []); ?> 
            
         <?php $__env->endSlot(); ?>

         <?php $__env->slot('tabs', null, []); ?> 
            <?php if (isset($component)) { $__componentOriginal7a160e0e89328e649a5d556167387bab = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal7a160e0e89328e649a5d556167387bab = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.tab','data' => ['id' => 'overview','label' => 'Özet','icon' => 'fas fa-bolt-lightning','active' => 'true']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.tab'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'overview','label' => 'Özet','icon' => 'fas fa-bolt-lightning','active' => 'true']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $attributes = $__attributesOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__attributesOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $component = $__componentOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__componentOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal7a160e0e89328e649a5d556167387bab = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal7a160e0e89328e649a5d556167387bab = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.tab','data' => ['id' => 'details','label' => 'Profil Bilgileri','icon' => 'fas fa-user-gear']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.tab'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'details','label' => 'Profil Bilgileri','icon' => 'fas fa-user-gear']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $attributes = $__attributesOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__attributesOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $component = $__componentOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__componentOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal7a160e0e89328e649a5d556167387bab = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal7a160e0e89328e649a5d556167387bab = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.tab','data' => ['id' => 'sales','label' => 'Satışlar','icon' => 'fas fa-shopping-cart','count' => $financial['bookings_count']]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.tab'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'sales','label' => 'Satışlar','icon' => 'fas fa-shopping-cart','count' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($financial['bookings_count'])]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $attributes = $__attributesOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__attributesOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $component = $__componentOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__componentOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal7a160e0e89328e649a5d556167387bab = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal7a160e0e89328e649a5d556167387bab = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.tab','data' => ['id' => 'passengers','label' => 'Yolcular','icon' => 'fas fa-users','count' => $customer->passengers->count()]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.tab'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'passengers','label' => 'Yolcular','icon' => 'fas fa-users','count' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($customer->passengers->count())]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $attributes = $__attributesOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__attributesOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $component = $__componentOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__componentOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal7a160e0e89328e649a5d556167387bab = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal7a160e0e89328e649a5d556167387bab = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.tab','data' => ['id' => 'documents','label' => 'Dökümanlar','icon' => 'fas fa-folder-open','count' => $customer->customerDocuments->count()]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.tab'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'documents','label' => 'Dökümanlar','icon' => 'fas fa-folder-open','count' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($customer->customerDocuments->count())]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $attributes = $__attributesOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__attributesOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $component = $__componentOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__componentOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal7a160e0e89328e649a5d556167387bab = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal7a160e0e89328e649a5d556167387bab = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.tab','data' => ['id' => 'custom','label' => 'Özel Alanlar','icon' => 'fas fa-puzzle-piece']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.tab'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'custom','label' => 'Özel Alanlar','icon' => 'fas fa-puzzle-piece']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $attributes = $__attributesOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__attributesOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $component = $__componentOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__componentOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal7a160e0e89328e649a5d556167387bab = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal7a160e0e89328e649a5d556167387bab = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.tab','data' => ['id' => 'financial','label' => 'Finansal','icon' => 'fas fa-wallet']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.tab'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'financial','label' => 'Finansal','icon' => 'fas fa-wallet']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $attributes = $__attributesOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__attributesOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal7a160e0e89328e649a5d556167387bab)): ?>
<?php $component = $__componentOriginal7a160e0e89328e649a5d556167387bab; ?>
<?php unset($__componentOriginal7a160e0e89328e649a5d556167387bab); ?>
<?php endif; ?>
         <?php $__env->endSlot(); ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginala42916bd54053bb95821e6cf6446ae2c)): ?>
<?php $attributes = $__attributesOriginala42916bd54053bb95821e6cf6446ae2c; ?>
<?php unset($__attributesOriginala42916bd54053bb95821e6cf6446ae2c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginala42916bd54053bb95821e6cf6446ae2c)): ?>
<?php $component = $__componentOriginala42916bd54053bb95821e6cf6446ae2c; ?>
<?php unset($__componentOriginala42916bd54053bb95821e6cf6446ae2c); ?>
<?php endif; ?>

    <!-- ─── CONTENT ─── -->
    <?php if (isset($component)) { $__componentOriginal35806a9d22165045bbdc1bc197c3b156 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal35806a9d22165045bbdc1bc197c3b156 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.content','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.content'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
        <!-- PANELS (Using Grid per-tab if needed) -->
        <div id="qv-tab-overview" class="qv-tab-panel active">
            <?php if (isset($component)) { $__componentOriginal0b5c730a957d61f80b0044e786216866 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal0b5c730a957d61f80b0044e786216866 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.main','data' => ['class' => 'border-0']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.main'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'border-0']); ?>
                <div class="row g-4">
                    <div class="col-12">
                        <!-- Activity Editor -->
                        <div class="qv-activity-editor-card shadow-sm border-0 mb-5" style="background: #fff; border-radius: 20px;">
                            <form id="qv-activity-form" action="<?php echo e(route('agency.customers.activities.store', $customer)); ?>">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="activity_type" id="qv-activity-type" value="note">
                                <div class="qv-editor-header border-bottom-0 p-2 overflow-x-auto d-flex flex-nowrap hide-scrollbar" style="-webkit-overflow-scrolling: touch;">
                                    <div class="qv-editor-tab active flex-shrink-0" onclick="setQvActivityType('note', this)"><i class="fas fa-sticky-note me-2 text-warning"></i>Not</div>
                                    <div class="qv-editor-tab flex-shrink-0" onclick="setQvActivityType('call', this)"><i class="fas fa-phone me-2 text-primary"></i>Arama</div>
                                    <div class="qv-editor-tab flex-shrink-0" onclick="setQvActivityType('whatsapp', this)"><i class="fab fa-whatsapp me-2 text-success"></i>WhatsApp</div>
                                    <div class="qv-editor-tab flex-shrink-0" onclick="setQvActivityType('email', this)"><i class="fas fa-envelope me-2 text-info"></i>E-posta</div>
                                    <div class="qv-editor-tab flex-shrink-0" onclick="setQvActivityType('meeting', this)"><i class="fas fa-calendar me-2 text-danger"></i>Toplantı</div>
                                    <div class="qv-editor-tab flex-shrink-0" onclick="setQvActivityType('sms', this)"><i class="fas fa-sms me-2" style="color: #6366f1;"></i>SMS</div>
                                    <div class="qv-editor-tab flex-shrink-0" onclick="setQvActivityType('offer', this)"><i class="fas fa-tag me-2" style="color: #8b5cf6;"></i>Teklif</div>
                                    <div class="qv-editor-tab flex-shrink-0" onclick="setQvActivityType('payment', this)"><i class="fas fa-credit-card me-2 text-success"></i>Ödeme</div>
                                    <div class="qv-editor-tab flex-shrink-0" onclick="setQvActivityType('complaint', this)"><i class="fas fa-triangle-exclamation me-2 text-danger"></i>Şikayet</div>
                                    <div class="qv-editor-tab flex-shrink-0" onclick="setQvActivityType('visit', this)"><i class="fas fa-map-location-dot me-2 text-secondary"></i>Ziyaret</div>
                                </div>
                                <div class="qv-editor-content p-4 pt-0">
                                    <div class="qv-editor-input-wrap mb-3 p-3" style="background: #f8fafc; border-radius: 16px; border: 1px dashed #e2e8f0;">
                                        <input type="text" name="subject" class="qv-editor-subject w-100 border-0 bg-transparent mb-2 fw-700" placeholder="Konu başlığı (opsiyonel)..." style="outline: none; font-size: 1.1rem;">
                                        
                                        <!-- Meeting & Visit Details (Conditional) -->
                                        <div id="qv-location-details" class="row g-2 mb-3 d-none">
                                            <div class="col-md-5">
                                                <div class="input-group input-group-sm">
                                                    <span class="input-group-text bg-light border-0"><i class="fas fa-location-dot text-muted"></i></span>
                                                    <input type="text" name="location" class="form-control border-0 bg-light" placeholder="Konum / Yer..." style="font-size: 0.8rem;">
                                                </div>
                                            </div>
                                            <div class="col-md-5">
                                                <div id="qv-meeting-link-wrap" class="input-group input-group-sm">
                                                    <span class="input-group-text bg-light border-0"><i class="fas fa-link text-muted"></i></span>
                                                    <input type="text" name="meeting_link" class="form-control border-0 bg-light" placeholder="Toplantı Linki..." style="font-size: 0.8rem;">
                                                </div>
                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" name="reference_no" class="form-control form-control-sm border-0 bg-light text-center fw-700" placeholder="REF#" style="font-size: 0.7rem; color: #64748b;">
                                            </div>
                                        </div>

                                        <!-- Financial Details (Conditional) -->
                                        <div id="qv-financial-details" class="row g-2 mb-3 d-none">
                                            <div class="col-md-5">
                                                <div class="input-group input-group-sm shadow-none">
                                                    <span class="input-group-text bg-light border-0 fw-800 text-muted">TUTAR</span>
                                                    <input type="number" name="amount" step="0.01" class="form-control border-0 bg-light" placeholder="0.00" style="font-size: 0.8rem;">
                                                </div>
                                            </div>
                                            <div class="col-md-3">
                                                <select name="currency" class="form-select form-select-sm border-0 bg-light fw-700" style="font-size: 0.8rem;">
                                                    <option value="TRY">₺ TRY</option>
                                                    <option value="USD">$ USD</option>
                                                    <option value="EUR">€ EUR</option>
                                                    <option value="GBP">£ GBP</option>
                                                </select>
                                            </div>
                                        </div>

                                        <textarea name="description" class="qv-editor-textarea w-100 border-0 bg-transparent" placeholder="Neler yaşandı? Detayları buraya yazın..." required style="outline: none; min-height: 100px; resize: none;"></textarea>
                                    </div>
                                    <div class="d-flex align-items-center justify-content-between">
                                        <div class="d-flex gap-4">
                                            <div class="form-check form-switch smaller">
                                                <input class="form-check-input" type="checkbox" name="priority" value="urgent" id="qv-urgent">
                                                <label class="form-check-label text-danger fw-700" for="qv-urgent">Acil/Önemli İşaretle</label>
                                            </div>
                                            <div class="d-flex align-items-center gap-2 text-muted smaller fw-600">
                                                <i class="fas fa-paperclip"></i> Dosya Ekle (Yakında)
                                            </div>
                                        </div>
                                        <button type="submit" id="qv-submit-btn" class="btn btn-primary px-5 py-2 fw-800" style="border-radius: 14px; box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);">
                                            Kaydet <i class="fas fa-paper-plane ms-2"></i>
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>

                        <!-- Activity Timeline Content Full Width -->
                        <div class="qv-timeline-container px-2">
                            <div class="d-flex justify-content-between align-items-center mb-5">
                                <h6 class="fw-800 text-dark mb-0 d-flex align-items-center gap-3" style="font-size: 1.1rem; letter-spacing: -0.01em;">
                                    <span class="p-2 bg-primary-soft text-primary rounded-12"><i class="fas fa-history"></i></span>
                                    MÜŞTERİ ETKİNLİK AKIŞI
                                </h6>
                                <div class="d-flex gap-3">
                                    <div class="qv-stat-pill bg-light border px-4 py-2 rounded-pill smaller fw-800">Toplam: <?php echo e($activityStats['total'] ?? 0); ?></div>
                                    <div class="qv-stat-pill bg-danger-soft text-danger border-0 px-4 py-2 rounded-pill smaller fw-800">Açık Şikayetler: <?php echo e($activityStats['complaints'] ?? 0); ?></div>
                                </div>
                            </div>
                            
                            <div class="qv-timeline-v2">
                                <?php $__empty_1 = true; $__currentLoopData = $recentActivities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $activity): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <?php
                                        $icon = match($activity->activity_type) {
                                            'call' => 'phone', 'email' => 'envelope', 'meeting' => 'handshake',
                                            'note' => 'sticky-note', 'booking' => 'cart-shopping', 'complaint' => 'triangle-exclamation',
                                            'whatsapp' => 'whatsapp', 'sms' => 'comment-sms', 'offer' => 'tag',
                                            'payment' => 'credit-card', 'visit' => 'map-marker-alt',
                                            default => 'circle-dot'
                                        };
                                        $color = match($activity->activity_type) {
                                            'call' => '#3b82f6', 'email' => '#ec4899', 'meeting' => '#10b981',
                                            'note' => '#f59e0b', 'booking' => '#6366f1', 'complaint' => '#ef4444',
                                            'whatsapp' => '#22c55e', 'sms' => '#8b5cf6', 'offer' => '#d946ef',
                                            'payment' => '#10b981', 'visit' => '#64748b',
                                            default => '#64748b'
                                        };
                                        $isBrandIcon = $activity->activity_type === 'whatsapp';
                                    ?>
                                    <div class="qv-activity-item">
                                        <div class="qv-activity-connector"></div>
                                        <div class="qv-activity-icon-v2" style="background: <?php echo e($color); ?>">
                                            <i class="<?php echo e($isBrandIcon ? 'fab' : 'fas'); ?> fa-<?php echo e($icon); ?>"></i>
                                        </div>
                                        <div class="qv-activity-card-v2 <?php echo e($activity->priority === 'urgent' ? 'urgent' : ''); ?>">
                                            <div class="d-flex justify-content-between align-items-start mb-2">
                                                <div>
                                                    <span class="qv-activity-label" style="color: <?php echo e($color); ?>"><?php echo e(strtoupper($activity->activity_type_label)); ?></span>
                                                    <?php if($activity->subject): ?>
                                                        <h6 class="mb-1 fw-700 mt-1"><?php echo e($activity->subject); ?></h6>
                                                    <?php endif; ?>
                                                </div>
                                                <span class="qv-activity-time"><?php echo e($activity->activity_date->diffForHumans()); ?></span>
                                            </div>
                                            <p class="qv-activity-text mb-2"><?php echo e($activity->description); ?></p>

                                            <?php if($activity->location || $activity->meeting_link || $activity->reference_no): ?>
                                                <div class="qv-activity-meta d-flex flex-wrap gap-3 mb-2 p-2 rounded-12" style="background: #f8fafc; font-size: 0.75rem;">
                                                    <?php if($activity->location): ?>
                                                        <span class="text-muted"><i class="fas fa-location-dot me-1 text-primary"></i> <?php echo e($activity->location); ?></span>
                                                    <?php endif; ?>
                                                    <?php if($activity->meeting_link): ?>
                                                        <a href="<?php echo e(str_starts_with($activity->meeting_link, 'http') ? $activity->meeting_link : 'https://' . $activity->meeting_link); ?>" target="_blank" class="text-primary fw-700 text-decoration-none">
                                                            <i class="fas fa-video me-1"></i> Toplantıya Katıl
                                                        </a>
                                                    <?php endif; ?>
                                                    <?php if($activity->reference_no): ?>
                                                        <span class="ms-auto text-muted fw-700 bg-white px-2 rounded border" style="font-size: 0.65rem;">#<?php echo e($activity->reference_no); ?></span>
                                                    <?php endif; ?>
                                                </div>
                                            <?php endif; ?>

                                            <div class="d-flex align-items-center gap-3 mt-2 pt-2 border-top">
                                                <span class="smaller fw-600 text-muted"><i class="fas fa-user-circle me-1"></i> <?php echo e($activity->performedBy?->first_name ?: 'Sistem'); ?></span>
                                                <?php if($activity->status): ?>
                                                    <span class="activity-status-pille <?php echo e($activity->status); ?>"><?php echo e($activity->status_label); ?></span>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <div class="text-center py-5 opacity-50 bg-light" style="border-radius: 24px; border: 2px dashed #e2e8f0;">
                                        <i class="fas fa-ghost mb-3" style="font-size: 3rem;"></i>
                                        <p class="fw-800">Henüz bir etkinlik kaydedilmemiş.</p>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal0b5c730a957d61f80b0044e786216866)): ?>
<?php $attributes = $__attributesOriginal0b5c730a957d61f80b0044e786216866; ?>
<?php unset($__attributesOriginal0b5c730a957d61f80b0044e786216866); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal0b5c730a957d61f80b0044e786216866)): ?>
<?php $component = $__componentOriginal0b5c730a957d61f80b0044e786216866; ?>
<?php unset($__componentOriginal0b5c730a957d61f80b0044e786216866); ?>
<?php endif; ?>
        </div>

            <div id="qv-tab-details" class="qv-tab-panel">
                <div class="row g-0 h-100 overflow-hidden">
                    <div class="col-md-8 h-100 overflow-y-auto border-end">
                        <div class="p-4">
                            <div class="qv-card shadow-sm border-0 mb-4" style="border-radius: 20px;">
                                <h5 class="fw-800 text-dark mb-4">Profil ve Kimlik Bilgileri</h5>
                                <div class="row g-4">
                                    <div class="col-md-4">
                                        <div class="qv-detail-field">
                                            <label>Adı</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="first_name"><?php echo e($customer->first_name); ?></div>
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="qv-detail-field">
                                            <label>İkinci Adı</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="middle_name" data-placeholder="Varsa ikinci ad"><?php echo e($customer->middle_name ?: '—'); ?></div>
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="qv-detail-field">
                                            <label>Soyadı</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="last_name"><?php echo e($customer->last_name); ?></div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="qv-detail-field">
                                            <label>TC / Kimlik No</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="national_id"><?php echo e($customer->national_id ?: '—'); ?></div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="qv-detail-field">
                                            <label>Cinsiyet</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="gender" data-type="select" data-options="<?php echo e(json_encode($genderOptions)); ?>" data-value="<?php echo e($customer->gender); ?>">
                                                <?php echo e($customer->gender ? ($genderOptions[array_search($customer->gender, array_column($genderOptions, 'value'))]['label'] ?? '—') : '—'); ?>

                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="qv-detail-field">
                                            <label>Doğum Tarihi</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="birth_date" data-type="date" data-value="<?php echo e($customer->birth_date ? $customer->birth_date->format('Y-m-d') : ''); ?>">
                                                <?php echo e($customer->birth_date ? $customer->birth_date->format('d.m.Y') : '—'); ?>

                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="qv-detail-field">
                                            <label>Doğum Yeri</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="birth_place" data-placeholder="Şehir/İlçe"><?php echo e($customer->birth_place ?: '—'); ?></div>
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="qv-detail-field">
                                            <label>Uyruk</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="nationality"><?php echo e(strtoupper($customer->nationality ?: 'TR')); ?></div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="qv-card shadow-sm border-0 mb-4" style="border-radius: 20px;">
                                <h6 class="fw-800 text-dark mb-4">İletişim ve Adres Bilgileri</h6>
                                <div class="row g-4">
                                    <div class="col-md-6">
                                        <div class="qv-detail-field">
                                            <label>Telefon</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="phone"><?php echo e($customer->phone ?: '—'); ?></div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="qv-detail-field">
                                            <label>Alternatif Telefon</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="phone_alt"><?php echo e($customer->phone_alt ?: '—'); ?></div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="qv-detail-field">
                                            <label>E-posta</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="emails"><?php echo e(is_array($customer->emails) ? ($customer->emails[0] ?? '—') : ($customer->emails ?: '—')); ?></div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="qv-detail-field">
                                            <label>Alternatif E-posta</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="email_alt" data-placeholder="Yedek e-posta"><?php echo e($customer->email_alt ?: '—'); ?></div>
                                        </div>
                                    </div>
                                    <div class="col-12">
                                        <div class="qv-detail-field">
                                            <label>Açık Adres</label>
                                            <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="address" data-type="textarea"><?php echo e($customer->address ?: '—'); ?></div>
                                        </div>
                                    </div>
                                    <?php if($customer->customer_type === 'corporate'): ?>
                                    <div class="col-12 mt-4 pt-3 border-top">
                                        <h6 class="fw-800 text-dark mb-3">Kurumsal Şirket Bilgileri</h6>
                                        <div class="row g-4">
                                            <div class="col-md-12">
                                                <div class="qv-detail-field">
                                                    <label>Şirket Adı / Unvan</label>
                                                    <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="company_name"><?php echo e($customer->company_name ?: '—'); ?></div>
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="qv-detail-field">
                                                    <label>Vergi No</label>
                                                    <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="company_tax_number"><?php echo e($customer->company_tax_number ?: '—'); ?></div>
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="qv-detail-field">
                                                    <label>Vergi Dairesi</label>
                                                    <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="company_tax_office"><?php echo e($customer->company_tax_office ?: '—'); ?></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-4 h-100 overflow-y-auto bg-light p-4">
                        <section class="mb-5">
                            <span class="qv-section-title mb-3 d-block">SİSTEM BİLGİLERİ</span>
                            <div class="d-flex flex-wrap gap-2">
                                <span class="sb priority-<?php echo e($customer->priority ? 'true' : 'false'); ?> inline-editable" data-id="<?php echo e($customer->id); ?>" data-field="priority" data-type="select" data-options="<?php echo e(json_encode($priorityOptions)); ?>" data-value="<?php echo e($customer->priority ? '1' : '0'); ?>">
                                    <?php echo e($customer->priority_label); ?>

                                </span>
                                <span class="segment-pill bg-white border"><?php echo e($customer->customer_type === 'corporate' ? 'Kurumsal' : 'Bireysel'); ?></span>
                            </div>
                        </section>

                        <section class="mb-5">
                            <span class="qv-section-title mb-3 d-block">ATANMIŞ TEMSİLCİ</span>
                            <div class="agent-card bg-white shadow-sm" style="border-radius: 16px;">
                                <?php if($customer->assignedAgent): ?>
                                    <img src="https://ui-avatars.com/api/?name=<?php echo e(urlencode($customer->assignedAgent->full_name)); ?>&background=2563eb&color=fff" alt="">
                                    <div>
                                        <div class="fw-800 text-dark small"><?php echo e($customer->assignedAgent->full_name); ?></div>
                                        <div class="text-muted smaller">Satış Temsilcisi</div>
                                    </div>
                                <?php else: ?>
                                    <div class="p-3 text-muted smaller">Atanmamış</div>
                                <?php endif; ?>
                            </div>
                        </section>

                        <section class="mb-5">
                            <span class="qv-section-title mb-3 d-block">DAHİLİ NOTLAR</span>
                            <div class="internal-notes-box bg-white border-dashed text-muted smaller" style="min-height: 120px;">
                                <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="internal_notes" data-type="textarea" data-value="<?php echo e($customer->internal_notes); ?>">
                                    <?php echo e($customer->internal_notes ?: 'Notlar...'); ?>

                                </div>
                            </div>
                        </section>
                    </div>
                </div>
            </div>

            <div id="qv-tab-sales" class="qv-tab-panel">
                <div class="p-4">
                    <div class="row g-4">
                        <?php $__empty_1 = true; $__currentLoopData = $customer->reservations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $res): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <div class="col-md-6">
                                <div class="res-mini-card shadow-sm">
                                    <div class="d-flex justify-content-between mb-3">
                                        <h6 class="fw-800 text-dark mb-0">#<?php echo e($res->id); ?></h6>
                                        <div class="res-status-badge <?php echo e($res->status); ?>"><?php echo e($res->status_label); ?></div>
                                    </div>
                                    <div class="smaller fw-700 mb-3"><?php echo e($res->product_title); ?></div>
                                    <div class="d-flex justify-content-between align-items-center">
                                        <div class="text-muted smaller"><?php echo e($res->start_date ? $res->start_date->format('d.m.Y') : '—'); ?></div>
                                        <div class="fw-800 text-primary"><?php echo e(number_format($res->total_amount, 2, ',', '.')); ?> <?php echo e($res->currency); ?></div>
                                    </div>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div class="text-center py-5 opacity-50">Kayıt bulunamadı.</div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>

            <div id="qv-tab-documents" class="qv-tab-panel">
                <div class="p-4">
                    <div class="qv-card shadow-sm p-0 overflow-hidden border-0 mb-4" style="border-radius: 20px;">
                        <div class="p-4 border-bottom bg-light">
                            <h6 class="fw-800 text-dark mb-3">Döküman Yükle</h6>
                            <form id="ajax-doc-upload" action="<?php echo e(route('agency.customers.documents.store', $customer)); ?>" method="POST" enctype="multipart/form-data">
                                <?php echo csrf_field(); ?>
                                <div class="row g-2">
                                    <div class="col-md-5">
                                        <select name="document_type_id" class="form-select form-select-sm" required>
                                            <option value="">Tip Seçin...</option>
                                            <?php $__currentLoopData = $documentTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($type->id); ?>"><?php echo e($type->name); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                    <div class="col-md-5">
                                        <input type="file" name="file" class="form-control form-control-sm" required>
                                    </div>
                                    <div class="col-md-2">
                                        <button type="submit" class="btn btn-primary btn-sm w-100 fw-700">Yükle</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="p-4">
                            <h6 class="fw-800 text-dark mb-4">Mevcut Dökümanlar</h6>
                            <div class="qv-docs-list">
                                <?php $__empty_1 = true; $__currentLoopData = $customer->customerDocuments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $doc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <div class="qv-doc-item shadow-sm p-3 bg-white border rounded-12 mb-2 d-flex justify-content-between align-items-center">
                                        <div class="d-flex align-items-center gap-3">
                                            <div class="qv-doc-icon text-primary"><i class="fas fa-file-invoice"></i></div>
                                            <div>
                                                <div class="fw-700 small"><?php echo e($doc->original_name); ?></div>
                                                <div class="smaller text-muted"><?php echo e($doc->type?->name); ?> • <?php echo e($doc->created_at->format('d.m.Y')); ?></div>
                                            </div>
                                        </div>
                                        <div class="d-flex gap-2">
                                            <a href="<?php echo e(asset('storage/'.$doc->file_path)); ?>" target="_blank" class="btn btn-light btn-sm"><i class="fas fa-download"></i></a>
                                            <button onclick="deleteDocument(<?php echo e($doc->id); ?>, this)" class="btn btn-light btn-sm text-danger"><i class="fas fa-trash"></i></button>
                                        </div>
                                    </div>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <div class="text-center py-4 opacity-50 small">Henüz döküman bulunmuyor.</div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div id="qv-tab-passengers" class="qv-tab-panel">
                <div class="p-4">
                    <div class="row g-3">
                        <?php $__empty_1 = true; $__currentLoopData = $customer->passengers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $passenger): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <div class="col-md-6">
                                <div class="passenger-card p-3 bg-white border rounded-16 d-flex align-items-center gap-3">
                                    <div class="pas-avatar bg-light rounded-circle" style="width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-weight: 800;"><?php echo e($passenger->initials); ?></div>
                                    <div class="fw-700 small"><?php echo e($passenger->full_name); ?></div>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div class="text-center py-5 opacity-50">Yolcu kaydı yok.</div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>

            <div id="qv-tab-custom" class="qv-tab-panel">
                <div class="p-4">
                    <div class="qv-card shadow-sm border-0" style="border-radius: 20px;">
                        <h5 class="fw-800 text-dark mb-4">Özel Bilgiler</h5>
                        <div class="row g-4">
                            <?php $__currentLoopData = $definitions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $def): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php $val = $customer->getCustomFieldValue($def->field_key); ?>
                                <div class="col-md-6">
                                    <div class="qv-detail-field">
                                        <label><?php echo e($def->label); ?></label>
                                        <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="custom_field_<?php echo e($def->id); ?>" data-type="<?php echo e($def->field_type); ?>" data-value="<?php echo e($val); ?>">
                                            <?php echo e($val ?: '—'); ?>

                                        </div>
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    </div>
                </div>
            </div>

            <div id="qv-tab-financial" class="qv-tab-panel">
                <div class="p-4">
                    <div class="row g-4 mb-4">
                        <div class="col-md-4">
                            <div class="fin-stat-card p-4 bg-primary text-white" style="border-radius: 20px;">
                                <label class="smaller fw-700 opacity-75 d-block">HARCAMA</label>
                                <h4 class="fw-800 mb-0"><?php echo e(number_format($financial['total_spent'], 2, ',', '.')); ?> ₺</h4>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="fin-stat-card p-4 bg-success text-white" style="border-radius: 20px;">
                                <label class="smaller fw-700 opacity-75 d-block">ÖDENEN</label>
                                <h4 class="fw-800 mb-0"><?php echo e(number_format($financial['total_paid'], 2, ',', '.')); ?> ₺</h4>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="fin-stat-card p-4 bg-white border" style="border-radius: 20px;">
                                <label class="smaller fw-700 text-muted d-block">BAKİYE</label>
                                <h4 class="fw-800 mb-0 text-danger"><?php echo e(number_format($financial['balance'], 2, ',', '.')); ?> ₺</h4>
                            </div>
                        </div>
                    </div>

                    <div class="qv-card shadow-sm border-0" style="border-radius: 24px;">
                        <h6 class="fw-800 text-dark mb-4 d-flex align-items-center gap-2">
                             <i class="fas fa-file-invoice-dollar text-primary"></i> Fatura ve Finansal Detaylar
                        </h6>
                        <div class="row g-4">
                            <div class="col-md-12">
                                <div class="qv-detail-field">
                                    <label>Fatura Adresi</label>
                                    <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="billing_address" data-type="textarea"><?php echo e($customer->billing_address ?: '—'); ?></div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="qv-detail-field">
                                    <label>Fatura E-posta</label>
                                    <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="billing_email"><?php echo e($customer->billing_email ?: '—'); ?></div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="qv-detail-field">
                                    <label>Vergi Dairesi</label>
                                    <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="billing_tax_office"><?php echo e($customer->billing_tax_office ?: '—'); ?></div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="qv-detail-field">
                                    <label>Vergi No / TC</label>
                                    <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="billing_tax_number"><?php echo e($customer->billing_tax_number ?: '—'); ?></div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="qv-detail-field">
                                    <label>Kredi Limiti</label>
                                    <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="credit_limit"><?php echo e(number_format($customer->credit_limit ?: 0, 0, ',', '.')); ?> ₺</div>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="qv-detail-field">
                                    <label>Vade Günü</label>
                                    <div class="inline-editable w-100" data-id="<?php echo e($customer->id); ?>" data-field="payment_term_days"><?php echo e($customer->payment_term_days ?: 0); ?> gün</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal35806a9d22165045bbdc1bc197c3b156)): ?>
<?php $attributes = $__attributesOriginal35806a9d22165045bbdc1bc197c3b156; ?>
<?php unset($__attributesOriginal35806a9d22165045bbdc1bc197c3b156); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal35806a9d22165045bbdc1bc197c3b156)): ?>
<?php $component = $__componentOriginal35806a9d22165045bbdc1bc197c3b156; ?>
<?php unset($__componentOriginal35806a9d22165045bbdc1bc197c3b156); ?>
<?php endif; ?>

    <!-- ─── FOOTER ─── -->
    <?php if (isset($component)) { $__componentOriginaldb591679e66bcf56321701245af431a1 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginaldb591679e66bcf56321701245af431a1 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.quick-view.footer','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('quick-view.footer'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
        <div class="mini-agent smaller text-muted">
            <i class="fas fa-clock me-1"></i> Güncelleme: <?php echo e($customer->updated_at->format('d.m.Y H:i')); ?>

        </div>
        <div class="d-flex gap-3">
             <button class="btn btn-secondary-glass" onclick="closeQuickView()">Kapat</button>
             <a href="<?php echo e(route('agency.sales.create', ['customer_id' => $customer->id])); ?>" class="btn btn-primary" style="border-radius: 12px; font-weight: 800;">
                 <i class="fas fa-plus me-2"></i> Yeni Rezervasyon
             </a>
        </div>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginaldb591679e66bcf56321701245af431a1)): ?>
<?php $attributes = $__attributesOriginaldb591679e66bcf56321701245af431a1; ?>
<?php unset($__attributesOriginaldb591679e66bcf56321701245af431a1); ?>
<?php endif; ?>
<?php if (isset($__componentOriginaldb591679e66bcf56321701245af431a1)): ?>
<?php $component = $__componentOriginaldb591679e66bcf56321701245af431a1; ?>
<?php unset($__componentOriginaldb591679e66bcf56321701245af431a1); ?>
<?php endif; ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalafd3b985888fa2a33a2082f2c35a64dc)): ?>
<?php $attributes = $__attributesOriginalafd3b985888fa2a33a2082f2c35a64dc; ?>
<?php unset($__attributesOriginalafd3b985888fa2a33a2082f2c35a64dc); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalafd3b985888fa2a33a2082f2c35a64dc)): ?>
<?php $component = $__componentOriginalafd3b985888fa2a33a2082f2c35a64dc; ?>
<?php unset($__componentOriginalafd3b985888fa2a33a2082f2c35a64dc); ?>
<?php endif; ?>

<script>
    function toggleBlacklistDrawer() {
        const isBlacklisted = <?php echo e($customer->blacklisted ? 'true' : 'false'); ?>;
        if (isBlacklisted) {
            Swal.fire({
                title: 'Emin misiniz?',
                text: "Müşteriyi kara listeden çıkarmak istediğinize emin misiniz?",
                icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#10b981',
                confirmButtonText: 'Evet, Çıkar',
                cancelButtonText: 'İptal'
            }).then((result) => {
                if (result.isConfirmed) {
                    const form = document.createElement('form');
                    form.method = 'POST';
                    form.action = '<?php echo e(route("agency.customers.toggle-blacklist", $customer)); ?>';
                    form.innerHTML = `<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">`;
                    document.body.appendChild(form);
                    form.submit();
                }
            });
        } else {
            Swal.fire({
                title: 'Kara Listeye Al',
                text: 'Müşteriyi kara listeye alma nedeni belirtin:',
                input: 'text',
                inputPlaceholder: 'Neden...',
                showCancelButton: true,
                confirmButtonColor: '#ef4444',
                confirmButtonText: 'Listeye Ekle',
                cancelButtonText: 'İptal'
            }).then((result) => {
                if (result.isConfirmed && result.value) {
                    const form = document.createElement('form');
                    form.method = 'POST';
                    form.action = '<?php echo e(route("agency.customers.toggle-blacklist", $customer)); ?>';
                    form.innerHTML = `
                        <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                        <input type="hidden" name="blacklist_reason" value="${result.value}">
                    `;
                    document.body.appendChild(form);
                    form.submit();
                }
            });
        }
    }

    function updateDirectField(field, value) {
        $.ajax({
            url: '<?php echo e(route("agency.customers.update-field", $customer)); ?>',
            type: 'POST',
            data: { _token: '<?php echo e(csrf_token()); ?>', field: field, value: value },
            success: function(data) {
                if (data.success && typeof Swal !== 'undefined') {
                    Swal.mixin({
                        toast: true, position: 'top-end', showConfirmButton: false, timer: 1500
                    }).fire({ icon: 'success', title: data.message });
                }
            }
        });
    }

    // Customer specific activity handling
    function setQvActivityType(type, el) {
        document.querySelectorAll('.qv-editor-tab').forEach(t => t.classList.remove('active'));
        el.classList.add('active');
        const input = document.getElementById('qv-activity-type');
        if (input) input.value = type;

        // Show/Hide conditional details
        const locDetails = document.getElementById('qv-location-details');
        const finDetails = document.getElementById('qv-financial-details');
        const linkWrap = document.getElementById('qv-meeting-link-wrap');

        if (locDetails) {
            if (['meeting', 'visit'].includes(type)) {
                locDetails.classList.remove('d-none');
                if (linkWrap) {
                    type === 'meeting' ? linkWrap.classList.remove('d-none') : linkWrap.classList.add('d-none');
                }
            } else {
                locDetails.classList.add('d-none');
            }
        }

        if (finDetails) {
            ['payment', 'offer'].includes(type) ? finDetails.classList.remove('d-none') : finDetails.classList.add('d-none');
        }
    }

    function copyToClipboard(text, element) {
        if(!text || text === '—') return;
        navigator.clipboard.writeText(text).then(() => {
            const bubble = document.createElement('div');
            bubble.className = 'copy-bubble';
            bubble.innerText = 'Kopyalandı!';
            element.appendChild(bubble);
            setTimeout(() => bubble.remove(), 1000);
        });
    }

    // Handle Quick View Activity Form Submission
    $(document).off('submit', '#qv-activity-form').on('submit', '#qv-activity-form', function(e) {
        e.preventDefault();
        const form = $(this);
        const btn = $('#qv-submit-btn');
        const originalText = btn.html();
        
        btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i>');

        const formData = new FormData(this);
        
        $.ajax({
            url: form.attr('action'),
            type: 'POST',
            data: formData,
            processData: false,
            contentType: false,
            headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
            success: function(data) {
                if (data.success) {
                    if (activeQuickViewUrl) openQuickView(activeQuickViewUrl);
                    if (typeof Swal !== 'undefined') {
                        Swal.mixin({
                            toast: true, position: 'top-end', showConfirmButton: false, timer: 2000
                        }).fire({ icon: 'success', title: data.message });
                    }
                }
            },
            error: function(xhr) {
                alert('Etkinlik kaydedilirken bir hata oluştu.');
                btn.prop('disabled', false).html(originalText);
            }
        });
    });

    // Handle Quick View Document Upload
    $(document).off('submit', '#ajax-doc-upload').on('submit', '#ajax-doc-upload', function(e) {
        e.preventDefault();
        const form = $(this);
        const btn = form.find('button[type="submit"]');
        const originalText = btn.html();
        
        btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i> Yükleniyor...');
        const formData = new FormData(this);
        
        $.ajax({
            url: form.attr('action'),
            type: 'POST',
            data: formData,
            processData: false,
            contentType: false,
            headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
            success: function(data) {
                if (data.success) {
                    if (typeof Swal !== 'undefined') {
                        Swal.fire({ icon: 'success', title: 'Başarılı', text: data.message, timer: 1500, showConfirmButton: false });
                    }
                    if (activeQuickViewUrl) openQuickView(activeQuickViewUrl, 'documents');
                }
            },
            error: function(xhr) {
                const msg = xhr.responseJSON?.message || 'Yükleme sırasında bir hata oluştu.';
                if (typeof Swal !== 'undefined') Swal.fire({ icon: 'error', title: 'Hata', text: msg });
                btn.prop('disabled', false).html(originalText);
            }
        });
    });

    function deleteDocument(docId, btn) {
        Swal.fire({
            title: 'Silmek istediğinize emin misiniz?',
            icon: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#ef4444',
            confirmButtonText: 'Evet, Sil',
            cancelButtonText: 'İptal'
        }).then((result) => {
            if (result.isConfirmed) {
                const $btn = $(btn);
                const originalContent = $btn.html();
                $btn.prop('disabled', true).html('<i class="fas fa-spinner fa-spin"></i>');
                
                $.ajax({
                    url: "/agency/customers/documents/" + docId,
                    type: 'DELETE',
                    data: { _token: $('meta[name="csrf-token"]').attr('content') },
                    success: function(response) {
                        Swal.fire({ icon: 'success', title: 'Silindi', text: response.message, timer: 1500, showConfirmButton: false });
                        $btn.closest('.qv-doc-item').fadeOut();
                    },
                    error: function() {
                        Swal.fire('Hata', 'Bir hata oluştu.', 'error');
                        $btn.prop('disabled', false).html(originalContent);
                    }
                });
            }
        });
    }
</script>

<style>
    .btn-qv-edit {
        width: 28px; height: 28px; border-radius: 8px; border: 1px solid #f1f5f9; background: #fff;
        color: #94a3b8; display: flex; align-items: center; justify-content: center; font-size: 0.75rem;
        transition: all 0.2s; cursor: pointer;
    }
    .btn-qv-edit:hover { background: #eff6ff; color: #2563eb; border-color: #dbeafe; transform: scale(1.1); }

    /* Premium UI Components */
    .sb { padding: 6px 14px; border-radius: 10px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; border: 1px solid transparent; }
    .sb.active { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
    .sb.inactive { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
    .sb.blocked { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
    .sb.potential { background: #fef3c7; color: #92400e; border-color: #fde68a; }

    .qv-section-title { font-size: 0.72rem; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 1.25rem; display: block; }
    
    .qv-info-card { background: #fff; border: 1px solid #f1f5f9; border-radius: 20px; padding: 1.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.02); }
    .qv-field-group { margin-bottom: 1.5rem; }
    .qv-field-label { font-size: 0.68rem; font-weight: 700; color: #94a3b8; margin-bottom: 6px; display: block; }
    .qv-field-value { font-size: 0.95rem; font-weight: 700; color: #1e293b; display: flex; align-items: center; gap: 0.75rem; }

    .agent-card { 
        display: flex; align-items: center; gap: 1rem; padding: 1rem; 
        background: #fff; border: 1px solid #f1f5f9; border-radius: 16px; 
        box-shadow: 0 4px 12px rgba(0,0,0,0.02); transition: all 0.2s;
    }
    .agent-card:hover { transform: translateY(-2px); border-color: #e2e8f0; }
    .agent-card img { width: 42px; height: 42px; border-radius: 12px; }

    .internal-notes-box { 
        background: #fffbeb; border: 1px solid #fde68a; border-radius: 16px; padding: 1.25rem; 
        font-size: 0.9rem; color: #92400e; min-height: 100px; line-height: 1.6;
    }

    .qv-activity-editor-card { background: #fff; border-radius: 24px; border: 1px solid #f1f5f9; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.04); }
    .qv-editor-header { display: flex; background: #fafbfc; border-bottom: 1px solid #f1f5f9; padding: 0.5rem; gap: 0.5rem; }
    .qv-editor-tab { 
        padding: 0.6rem 1.25rem; font-size: 0.8rem; font-weight: 700; color: #64748b; 
        border-radius: 12px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 0.5rem;
    }
    .qv-editor-tab:hover { background: #f1f5f9; color: #1e293b; }
    .qv-editor-tab.active { background: #fff; color: #2563eb; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

    .qv-editor-subject { width: 100%; border: none; font-size: 1rem; font-weight: 700; outline: none; border-bottom: 1px solid #f1f5f9; padding: 1rem 0; margin-bottom: 1rem; }
    .qv-editor-textarea { width: 100%; min-height: 120px; border: none; outline: none; font-size: 1rem; resize: none; color: #334155; line-height: 1.6; }

    .qv-timeline-v2 { display: flex; flex-direction: column; gap: 1.5rem; }
    .qv-activity-item { position: relative; padding-left: 4rem; margin-bottom: 0.5rem; }
    .qv-activity-connector { position: absolute; left: 1.65rem; top: 3.5rem; bottom: -1.5rem; width: 2px; background: #f1f5f9; }
    .qv-activity-icon-v2 { 
        position: absolute; left: 0; top: 0; width: 3.3rem; height: 3.3rem; border-radius: 18px; 
        color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; 
        border: 5px solid #fff; box-shadow: 0 8px 20px rgba(0,0,0,0.08); z-index: 2; 
    }
    .qv-activity-card-v2 { 
        background: #fff; border: 1px solid #f1f5f9; border-radius: 20px; padding: 1.5rem; 
        box-shadow: 0 4px 15px rgba(0,0,0,0.02); transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); 
    }
    .qv-activity-card-v2:hover { transform: translateX(8px); box-shadow: 0 10px 30px rgba(0,0,0,0.06); border-color: #e2e8f0; }
    .qv-activity-card-v2.urgent { border-left: 5px solid #ef4444; }

    .btn-primary-glass { 
        background: #2563eb; color: #fff; border: none; font-size: 0.88rem; font-weight: 700; 
        padding: 0.8rem 1.5rem; border-radius: 14px; transition: all 0.3s; 
        display: flex; align-items: center; gap: 0.75rem; box-shadow: 0 8px 16px rgba(37, 99, 235, 0.15);
    }
    .btn-primary-glass:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25); background: #1d4ed8; }

    .btn-secondary-glass { 
        background: #fff; color: #475569; border: 1px solid #e2e8f0; font-size: 0.88rem; font-weight: 700; 
        padding: 0.8rem 1.5rem; border-radius: 14px; transition: all 0.2s; 
        display: flex; align-items: center; gap: 0.75rem; box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    }
    .btn-secondary-glass:hover { background: #f8fafc; color: #1e293b; border-color: #cbd5e1; }

    .loyalty-pill { padding: 5px 12px; border-radius: 10px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
    .lb-platinum { background: linear-gradient(135deg, #4338ca, #312e81); color: #fff; }
    .lb-gold { background: linear-gradient(135deg, #f59e0b, #b45309); color: #fff; }
    .lb-silver { background: #94a3b8; color: #fff; }
    .lb-bronze { background: #b45309; color: #fff; }

    .qv-card { background: #fff; border: 1px solid #f1f5f9; border-radius: 24px; padding: 2.5rem; box-shadow: 0 4px 20px rgba(0,0,0,0.02); }
    .qv-detail-field-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
    .qv-detail-field { margin-bottom: 0.5rem; }
    .qv-detail-field label { font-size: 0.72rem; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; display: block; }
    .qv-detail-field div { font-size: 1.05rem; font-weight: 700; color: #1e293b; letter-spacing: -0.01em; }

    .qv-tab-panel { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
    @keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

    .qv-stats-panel { background: linear-gradient(135deg, #fff, #f8faff); border-radius: 24px; border: 1px solid #f1f5f9; }
    .fin-stat-card { border-radius: 24px; overflow: hidden; position: relative; transition: transform 0.3s; }
    .fin-stat-card:hover { transform: translateY(-5px); }

    .res-mini-card { background: #fff; border: 1px solid #f1f5f9; border-radius: 20px; padding: 1.75rem; transition: all 0.3s; }
    .res-mini-card:hover { border-color: #2563eb; transform: translateY(-5px); box-shadow: 0 15px 35px rgba(0,0,0,0.05); }

    .inline-editable { cursor: pointer; border-bottom: 1px dashed #cbd5e1; transition: all 0.2s; display: inline-flex; align-items: center; min-width: 10px; }
    .inline-editable:hover { border-bottom-color: #2563eb; color: #2563eb; background: rgba(37, 99, 235, 0.05); }
    .copy-bubble {
        position: absolute;
        top: -25px;
        left: 50%;
        transform: translateX(-50%);
        background: #0f172a;
        color: #fff;
        font-size: 10px;
        padding: 4px 10px;
        border-radius: 8px;
        white-space: nowrap;
        pointer-events: none;
        z-index: 1100;
        animation: fadeInOut 1s ease forwards;
    }
    @keyframes fadeInOut { 0% { opacity: 0; transform: translate(-50%, 10px); } 20% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -10px); } }
    .qv-editor-header::-webkit-scrollbar { display: none; }
    .hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
</style>
<?php /**PATH /home/mehmetguruz/public_html/test/resources/views/agency/customers/quick-view.blade.php ENDPATH**/ ?>