<?php $__env->startSection('title', 'Taslak Kültür Turları'); ?>
<?php $__env->startSection('page_title', 'Taslaklar'); ?>

<?php
    $breadcrumbs = [
        ['title' => 'Ana Sayfa', 'url' => route('agency.dashboard')],
        ['title' => 'Ürünler', 'url' => '#'],
        ['title' => 'Kültür Turları', 'url' => route('agency.products.kultur-turlari.index')],
        ['title' => 'Taslaklar', 'url' => '']
    ];

    $columns = [
        ['key' => 'image',    'label' => 'Görsel',    'align' => 'center', 'width' => '70px'],
        ['key' => 'name',     'label' => 'Tur Adı'],
        ['key' => 'city',     'label' => 'Kalkış'],
        ['key' => 'duration', 'label' => 'Süre',      'align' => 'center'],
        ['key' => 'created',  'label' => 'Oluşturma'],
        ['key' => '_actions', 'label' => 'İşlemler',  'fixed' => true, 'align' => 'end', 'width' => '170px'],
    ];
?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid">
    <div class="mb-3">
        <a href="<?php echo e(route('agency.products.kultur-turlari.index')); ?>" class="btn btn-sm btn-outline-secondary">
            <i class="fas fa-arrow-left me-1"></i> Kültür Turlarına Dön
        </a>
    </div>

    <?php if (isset($component)) { $__componentOriginalc8463834ba515134d5c98b88e1a9dc03 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc8463834ba515134d5c98b88e1a9dc03 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.data-table','data' => ['module' => 'products-kultur-drafts','title' => 'Taslaklar','subtitle' => 'Tamamlanmamış kültür turu taslakları','icon' => 'fa-file-pen','columns' => $columns,'search' => request('search', ''),'searchPlaceholder' => 'Tur adı veya kod ara...','paginator' => $tours,'perPageOptions' => [24, 48, 96]]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('data-table'); ?>
<?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(['module' => 'products-kultur-drafts','title' => 'Taslaklar','subtitle' => 'Tamamlanmamış kültür turu taslakları','icon' => 'fa-file-pen','columns' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($columns),'search' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(request('search', '')),'search-placeholder' => 'Tur adı veya kod ara...','paginator' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($tours),'per-page-options' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute([24, 48, 96])]); ?>
        <?php $__empty_1 = true; $__currentLoopData = $tours; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tour): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr class="kultur-row" data-quickview-url="<?php echo e(route('agency.products.kultur-turlari.quick-view', $tour)); ?>" style="cursor:pointer">
                <td data-col="image" class="text-center">
                    <?php if($tour->coverImage?->galleryImage): ?>
                        <img class="dt-thumb" src="<?php echo e($tour->coverImage->galleryImage->thumbnail_url); ?>" alt="">
                    <?php else: ?>
                        <span class="dt-thumb-ph"><i class="fas fa-image"></i></span>
                    <?php endif; ?>
                </td>
                <td data-col="name">
                    <div class="dt-cell-main"><?php echo e($tour->name); ?></div>
                    <div class="dt-cell-sub"><i class="fas fa-hashtag" style="font-size:.62rem"></i> <?php echo e($tour->code ?? '—'); ?></div>
                </td>
                <td data-col="city">
                    <i class="fas fa-location-dot text-danger" style="font-size:.72rem"></i>
                    <?php echo e($tour->departureCity->city ?? 'Belirtilmemiş'); ?>

                </td>
                <td data-col="duration" class="text-center">
                    <span class="dt-badge dt-badge-slate"><?php echo e($tour->days); ?>G / <?php echo e($tour->nights); ?>Gece</span>
                </td>
                <td data-col="created"><span class="dt-cell-sub"><?php echo e($tour->created_at?->format('d.m.Y H:i')); ?></span></td>
                <td data-col="_actions" class="text-end">
                    <div class="dt-rowact">
                        <button type="button" class="dt-iconbtn success" onclick="publishDraft(<?php echo e($tour->id); ?>)" title="Taslaktan Çıkar"><i class="fas fa-check"></i></button>
                        <button type="button" class="dt-iconbtn danger" onclick="deleteDraft(<?php echo e($tour->id); ?>)" title="Sil"><i class="fas fa-trash"></i></button>
                    </div>
                </td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr>
                <td colspan="100">
                    <div class="dt-empty">
                        <i class="fas fa-file-pen"></i>
                        <h4>Taslak bulunmuyor</h4>
                        <p>Yeni bir taslak oluşturduğunuzda burada listelenir.</p>
                    </div>
                </td>
            </tr>
        <?php endif; ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc8463834ba515134d5c98b88e1a9dc03)): ?>
<?php $attributes = $__attributesOriginalc8463834ba515134d5c98b88e1a9dc03; ?>
<?php unset($__attributesOriginalc8463834ba515134d5c98b88e1a9dc03); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc8463834ba515134d5c98b88e1a9dc03)): ?>
<?php $component = $__componentOriginalc8463834ba515134d5c98b88e1a9dc03; ?>
<?php unset($__componentOriginalc8463834ba515134d5c98b88e1a9dc03); ?>
<?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
<script>
    function csrf() { return document.querySelector('meta[name="csrf-token"]').content; }

    function publishDraft(id) {
        if (!confirm('Bu turu taslaktan çıkarıp yayına almak istediğinizden emin misiniz?')) return;
        fetch(`/agency/products/kultur-turlari/${id}/publish-draft`, { method: 'POST', headers: { 'X-CSRF-TOKEN': csrf(), 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest' } })
            .then(r => r.json()).then(d => { if (d.success) location.reload(); });
    }
    function deleteDraft(id) {
        if (!confirm('Bu taslağı silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.')) return;
        fetch(`/agency/products/kultur-turlari/${id}`, { method: 'DELETE', headers: { 'X-CSRF-TOKEN': csrf(), 'Accept': 'application/json', 'X-Requested-With': 'XMLHttpRequest' } })
            .then(async r => {
                if (r.ok || r.status === 404) { location.reload(); return; }
                const d = await r.json().catch(() => ({}));
                alert(d.message || 'Taslak silinemedi.');
            })
            .catch(() => alert('Bağlantı hatası.'));
    }
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('agency.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\acente\resources\views/agency/products/kultur-turlari/drafts.blade.php ENDPATH**/ ?>