<?php $__env->startSection('title', $tour->name . ' - Genel Bilgiler'); ?>
<?php $__env->startSection('page_title', 'Tur Düzenle'); ?>

<?php
    $breadcrumbs = [
        ['title' => 'Ana Sayfa', 'url' => route('agency.dashboard')],
        ['title' => 'Kültür Turları', 'url' => route('agency.products.kultur-turlari.index')],
        ['title' => $tour->name, 'url' => route('agency.products.kultur-turlari.show', $tour)],
        ['title' => 'Genel Bilgiler', 'url' => '']
    ];
?>

<?php $__env->startPush('styles'); ?>
    <!-- Quill Rich Text Editor CSS -->
    <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
    <style>
        .tour-detail-container {
            max-width: 1200px;
            margin: 0 auto;
        }

        .tour-header {
            background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
            color: white;
            padding: 2rem;
            border-radius: var(--radius-xl);
            margin-bottom: 2rem;
            position: relative;
            overflow: hidden;
        }

        .tour-header::before {
            content: '';
            position: absolute;
            top: 0;
            right: 0;
            width: 200px;
            height: 200px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 50%;
            transform: translate(50%, -50%);
        }

        .tour-header-content {
            position: relative;
            z-index: 2;
        }

        .tour-title {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 0.5rem;
        }

        .tour-code {
            font-size: 14px;
            opacity: 0.9;
            margin-bottom: 1rem;
        }

        .tour-meta {
            display: flex;
            gap: 2rem;
            flex-wrap: wrap;
        }

        .tour-meta-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 14px;
        }

        .tour-meta-icon {
            font-size: 16px;
            opacity: 0.8;
        }

        .tabs-container {
            background: white;
            border: 1px solid var(--gray-200);
            border-radius: var(--radius-xl);
            overflow: hidden;
            margin-bottom: 2rem;
        }

        .nav-tabs {
            background: var(--gray-50);
            border-bottom: 1px solid var(--gray-200);
            padding: 0 1rem;
            margin: 0;
        }

        .nav-tabs .nav-link {
            border: none;
            border-radius: 0;
            color: var(--gray-600);
            font-weight: 500;
            padding: 1rem 1.5rem;
            position: relative;
            transition: var(--transition);
        }

        .nav-tabs .nav-link:hover {
            color: var(--primary-color);
            background: transparent;
            border-color: transparent;
        }

        .nav-tabs .nav-link.active {
            color: var(--primary-color);
            background: transparent;
            border-color: transparent;
            font-weight: 600;
        }

        .nav-tabs .nav-link.active::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: var(--primary-color);
            border-radius: 3px 3px 0 0;
        }

        .tab-content {
            padding: 2rem;
        }

        .form-section {
            margin-bottom: 2.5rem;
            padding-bottom: 2rem;
            border-bottom: 1px solid var(--gray-200);
        }

        .form-section:last-child {
            margin-bottom: 0;
            padding-bottom: 0;
            border-bottom: none;
        }

        .section-header {
            display: flex;
            align-items: center;
            justify-content: between;
            margin-bottom: 1.5rem;
        }

        .section-title {
            font-size: 18px;
            font-weight: 600;
            color: var(--gray-900);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin: 0;
        }

        .section-icon {
            width: 20px;
            height: 20px;
            color: var(--primary-color);
        }

        .section-actions {
            display: flex;
            gap: 0.5rem;
        }

        .form-group {
            margin-bottom: 1.5rem;
        }

        .form-label {
            font-weight: 600;
            color: var(--gray-700);
            margin-bottom: 0.5rem;
            display: block;
        }

        .form-label.required::after {
            content: '*';
            color: var(--danger-color);
            margin-left: 4px;
        }

        .form-control {
            border: 1px solid var(--gray-300);
            border-radius: var(--radius-lg);
            padding: 0.75rem 1rem;
            font-size: 14px;
            transition: var(--transition);
        }

        .form-control:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
            outline: none;
        }

        .form-text {
            font-size: 12px;
            color: var(--gray-500);
            margin-top: 0.25rem;
        }

        .tags-input {
            position: relative;
        }

        .tags-container {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-bottom: 0.5rem;
        }

        .tag-item {
            background: var(--primary-color);
            color: white;
            padding: 4px 8px;
            border-radius: var(--radius-md);
            font-size: 12px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 0.25rem;
        }

        .tag-remove {
            background: none;
            border: none;
            color: white;
            cursor: pointer;
            padding: 0;
            width: 16px;
            height: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: var(--transition);
        }

        .tag-remove:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        .categories-tree {
            max-height: 400px;
            overflow-y: auto;
            border: 1px solid var(--gray-200);
            border-radius: var(--radius-lg);
            padding: 1rem;
            background: #f8f9fa;
        }

        .category-group {
            background: white;
            border-radius: var(--radius-md);
            padding: 0.75rem;
            border: 1px solid var(--gray-200);
        }

        .category-icon {
            width: 32px;
            height: 32px;
            border-radius: var(--radius-md);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
        }

        .category-children {
            border-left: 2px solid var(--gray-200);
            padding-left: 1rem;
            margin-top: 0.5rem;
        }

        .category-checkbox {
            border-radius: var(--radius-sm);
            cursor: pointer;
        }

        .form-check-label {
            cursor: pointer;
            user-select: none;
        }

        .category-header {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 0.5rem;
        }

        .category-checkbox {
            border-radius: var(--radius-sm);
        }

        .category-name {
            font-weight: 600;
            color: var(--gray-900);
            font-size: 14px;
        }

        .category-description {
            font-size: 12px;
            color: var(--gray-600);
            line-height: 1.4;
        }

        .form-actions {
            background: var(--gray-50);
            padding: 1.5rem 2rem;
            margin: -2rem -2rem 0;
            border-top: 1px solid var(--gray-200);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .action-buttons {
            display: flex;
            gap: 0.75rem;
        }

        .save-status {
            font-size: 13px;
            color: var(--gray-600);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .save-status.saving {
            color: var(--warning-color);
        }

        .save-status.saved {
            color: var(--success-color);
        }

        .quick-nav {
            position: fixed;
            right: 2rem;
            top: 50%;
            transform: translateY(-50%);
            background: white;
            border: 1px solid var(--gray-200);
            border-radius: var(--radius-lg);
            padding: 1rem;
            box-shadow: var(--shadow-lg);
            z-index: 1000;
            display: none;
        }

        .quick-nav-item {
            display: block;
            padding: 0.5rem;
            color: var(--gray-600);
            text-decoration: none;
            font-size: 12px;
            transition: var(--transition);
            border-radius: var(--radius-sm);
        }

        .quick-nav-item:hover {
            color: var(--primary-color);
            background: var(--gray-100);
            text-decoration: none;
        }

        .quick-nav-item.active {
            color: var(--primary-color);
            background: var(--primary-color) 10;
        }

        @media (max-width: 768px) {
            .tour-detail-container {
                margin: 0;
            }

            .tour-header {
                padding: 1.5rem;
                margin-bottom: 1rem;
            }

            .tour-title {
                font-size: 22px;
            }

            .tour-meta {
                gap: 1rem;
            }

            .tab-content {
                padding: 1.5rem;
            }

            .form-actions {
                flex-direction: column;
                gap: 1rem;
                text-align: center;
            }

            .action-buttons {
                justify-content: center;
                width: 100%;
            }

            .categories-grid {
                grid-template-columns: 1fr;
            }

            .quick-nav {
                display: none !important;
            }
        }

        @media (min-width: 1200px) {
            .quick-nav {
                display: block;
            }
        }
        /* Quill Editor Styling */
        .quill-editor-container {
            background: white;
            border: 1px solid var(--gray-300);
            border-radius: var(--radius-lg);
            overflow: hidden;
        }

        .ql-toolbar.ql-snow {
            border: none;
            border-bottom: 1px solid var(--gray-200);
            background: var(--gray-50);
            padding: 12px;
        }

        .ql-container.ql-snow {
            border: none;
            font-size: 15px;
            font-family: inherit;
        }

        .ql-editor {
            min-height: 200px;
            padding: 20px;
        }

        .ql-editor.ql-blank::before {
            color: var(--gray-400);
            font-style: normal;
        }

        .ql-toolbar button:hover,
        .ql-toolbar button:focus,
        .ql-toolbar button.ql-active {
            color: var(--primary-color) !important;
        }

        .ql-toolbar .ql-stroke {
            stroke: var(--gray-600);
        }

        .ql-toolbar .ql-stroke:hover {
            stroke: var(--primary-color);
        }

        .ql-toolbar .ql-fill {
            fill: var(--gray-600);
        }

        .ql-toolbar .ql-fill:hover {
            fill: var(--primary-color);
        }

        .ql-editor h1, .ql-editor h2, .ql-editor h3 {
            font-weight: 600;
            margin-top: 1em;
            margin-bottom: 0.5em;
        }

        .ql-editor ul, .ql-editor ol {
            padding-left: 1.5em;
        }

        .ql-editor li {
            margin-bottom: 0.5em;
        }
    </style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="tour-detail-container">
        <!-- Tour Header -->
        <div class="tour-header">
            <div class="tour-header-content">
                <div class="tour-code">Tur Kodu: <?php echo e($tour->code); ?></div>
                <h1 class="tour-title"><?php echo e($tour->name); ?></h1>
                <div class="tour-meta">
                    <div class="tour-meta-item">
                        <i class="fas fa-map-marker-alt tour-meta-icon"></i>
                        <?php echo e($tour->departureCity->city ?? 'Belirtilmemiş'); ?> → <?php echo e($tour->arrivalCity->city ?? 'Belirtilmemiş'); ?>

                    </div>
                    <div class="tour-meta-item">
                        <i class="fas fa-clock tour-meta-icon"></i>
                        <?php echo e($tour->days); ?> Gün / <?php echo e($tour->nights); ?> Gece
                    </div>
                    <div class="tour-meta-item">
                        <i class="fas fa-eye tour-meta-icon"></i>
                        <?php echo e($tour->view_count); ?> Görüntülenme
                    </div>
                    <div class="tour-meta-item">
                        <i class="fas fa-calendar-check tour-meta-icon"></i>
                        <?php echo e($tour->booking_count); ?> Rezervasyon
                    </div>
                </div>
            </div>
        </div>

        <!-- Tabs Container -->
        <div class="tabs-container">
            <!-- Tab Navigation -->
            <?php echo $__env->make('agency.products.kultur-turlari._nav', ['active' => 'general'], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

            <!-- Tab Content -->
            <div class="tab-content">
                <form method="POST" action="<?php echo e(route('agency.products.kultur-turlari.update-general', $tour)); ?>" id="generalForm">
                    <?php echo csrf_field(); ?>
                    <?php echo method_field('PUT'); ?>

                    <!-- Basic Information Section -->
                    <div class="form-section" id="basic-info">
                        <div class="section-header">
                            <h3 class="section-title">
                                <i class="fas fa-info-circle section-icon"></i>
                                Temel Bilgiler
                            </h3>
                        </div>

                        <div class="row">
                            <div class="col-md-8">
                                <div class="form-group">
                                    <label class="form-label required">Tur Adı</label>
                                    <input type="text" name="name" class="form-control"
                                           value="<?php echo e(old('name', $tour->name)); ?>"
                                           placeholder="Tur adını girin" required>
                                    <div class="form-text">Turunuzun çekici ve açıklayıcı bir adını girin</div>
                                    <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="form-label required">Tur Tipi</label>
                                    <select name="tour_type" class="form-select" required>
                                        <option value="">Seçiniz</option>
                                        <option value="domestic" <?php echo e(old('tour_type', $tour->tour_type) === 'domestic' ? 'selected' : ''); ?>>Yurt İçi</option>
                                        <option value="international" <?php echo e(old('tour_type', $tour->tour_type) === 'international' ? 'selected' : ''); ?>>Yurt Dışı</option>
                                    </select>
                                    <?php $__errorArgs = ['tour_type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="form-label required">Kısa Açıklama</label>
                            <textarea name="short_description" class="form-control" rows="3"
                                      placeholder="Turunuzun kısa açıklamasını yazın..." required><?php echo e(old('short_description', $tour->short_description)); ?></textarea>
                            <div class="form-text">Maksimum 500 karakter. Arama sonuçlarında ve önizlemelerde kullanılır</div>
                            <?php $__errorArgs = ['short_description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="form-group">
                            <label class="form-label required">Detaylı Açıklama</label>
                            <div class="quill-editor-container">
                                <div id="editor-description"></div>
                            </div>
                            <input type="hidden" name="description" id="description-input" value="<?php echo e(old('description', $tour->description)); ?>" required>
                            <div class="form-text">Turunuzun tüm özelliklerini, deneyimlerini ve avantajlarını detaylı olarak açıklayın</div>
                            <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    </div>

                    <!-- Highlights Section -->
                    <div class="form-section" id="highlights">
                        <div class="section-header">
                            <h3 class="section-title">
                                <i class="fas fa-star section-icon"></i>
                                Öne Çıkan Özellikler
                            </h3>
                        </div>

                        <div class="form-group">
                            <label class="form-label">Gezilecek Yerler</label>
                            <div class="quill-editor-container">
                                <div id="editor-places-to-visit"></div>
                            </div>
                            <input type="hidden" name="places_to_visit" id="places-to-visit-input" value="<?php echo e(old('places_to_visit', $tour->places_to_visit)); ?>">
                            <div class="form-text">Tur kapsamında gezilecek yerleri listeleyin</div>
                            <?php $__errorArgs = ['places_to_visit'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label">Dahil Edilen Hizmetler</label>
                                    <?php if(isset($inclusionsTemplates) && $inclusionsTemplates->count() > 0): ?>
                                        <select class="form-select mb-2" id="inclusionsTemplateSelect">
                                            <option value="">Şablon Seç (Opsiyonel)</option>
                                            <?php $__currentLoopData = $inclusionsTemplates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $template): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($template->id); ?>" data-content="<?php echo e($template->description); ?>">
                                                    <?php echo e($template->name); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    <?php endif; ?>
                                    <div class="quill-editor-container">
                                        <div id="editor-inclusions"></div>
                                    </div>
                                    <input type="hidden" name="inclusions" id="inclusions-input" value="<?php echo e(old('inclusions', $tour->inclusions)); ?>">
                                    <div class="form-text">Tur fiyatına dahil olan hizmetleri listeleyin</div>
                                    <?php $__errorArgs = ['inclusions'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label">Dahil Edilmeyen Hizmetler</label>
                                    <?php if(isset($exclusionsTemplates) && $exclusionsTemplates->count() > 0): ?>
                                        <select class="form-select mb-2" id="exclusionsTemplateSelect">
                                            <option value="">Şablon Seç (Opsiyonel)</option>
                                            <?php $__currentLoopData = $exclusionsTemplates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $template): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($template->id); ?>" data-content="<?php echo e($template->description); ?>">
                                                    <?php echo e($template->name); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    <?php endif; ?>
                                    <div class="quill-editor-container">
                                        <div id="editor-exclusions"></div>
                                    </div>
                                    <input type="hidden" name="exclusions" id="exclusions-input" value="<?php echo e(old('exclusions', $tour->exclusions)); ?>">
                                    <div class="form-text">Tur fiyatına dahil olmayan hizmetleri belirtin</div>
                                    <?php $__errorArgs = ['exclusions'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Location Section -->
                    <div class="form-section" id="location">
                        <div class="section-header">
                            <h3 class="section-title">
                                <i class="fas fa-map-marker-alt section-icon"></i>
                                Konum Bilgileri
                            </h3>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label required">Kalkış Şehri</label>
                                    <select name="departure_city_id" class="form-select" required>
                                        <option value="">Şehir Seçiniz</option>
                                        <?php $__currentLoopData = $cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($city->id); ?>" <?php echo e(old('departure_city_id', $tour->departure_city_id) == $city->id ? 'selected' : ''); ?>>
                                                <?php echo e($city->city); ?>

                                            </option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    <?php $__errorArgs = ['departure_city_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label required">Varış Şehri</label>
                                    <select name="arrival_city_id" class="form-select" required>
                                        <option value="">Şehir Seçiniz</option>
                                        <?php $__currentLoopData = $cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($city->id); ?>" <?php echo e(old('arrival_city_id', $tour->arrival_city_id) == $city->id ? 'selected' : ''); ?>>
                                                <?php echo e($city->city); ?>

                                            </option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    <?php $__errorArgs = ['arrival_city_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Duration Section -->
                    <div class="form-section" id="duration">
                        <div class="section-header">
                            <h3 class="section-title">
                                <i class="fas fa-clock section-icon"></i>
                                Süre Bilgileri
                            </h3>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label required">Gün Sayısı</label>
                                    <input type="number" name="days" class="form-control"
                                           value="<?php echo e(old('days', $tour->days)); ?>" min="1" required id="daysInput">
                                    <div class="form-text">Turun toplam gün sayısını giriniz</div>
                                    <?php $__errorArgs = ['days'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label">Gece Sayısı</label>
                                    <input type="number" name="nights" class="form-control"
                                           value="<?php echo e(old('nights', $tour->nights)); ?>" min="0" id="nightsInput">
                                    <div class="form-text">Otomatik hesaplanır, elle de değiştirebilirsiniz</div>
                                    <?php $__errorArgs = ['nights'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Transportation Section -->
                    <div class="form-section" id="transportation">
                        <div class="section-header">
                            <h3 class="section-title">
                                <i class="fas fa-bus section-icon"></i>
                                Ulaşım Bilgileri
                            </h3>
                        </div>

                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label class="form-label">Ulaşım Yöntemi</label>
                                    <select name="transportation_method" class="form-select" id="transportationMethod">
                                        <option value="">Seçiniz</option>
                                        <option value="air" <?php echo e(old('transportation_method', $tour->transportation_method) === 'air' ? 'selected' : ''); ?>>Uçak</option>
                                        <option value="road" <?php echo e(in_array(old('transportation_method', $tour->transportation_method), ['road', 'bus', 'minibus', 'private_vehicle']) ? 'selected' : ''); ?>>Kara Yolu</option>
                                        <option value="train" <?php echo e(old('transportation_method', $tour->transportation_method) === 'train' ? 'selected' : ''); ?>>Tren</option>
                                        <option value="ferry" <?php echo e(old('transportation_method', $tour->transportation_method) === 'ferry' ? 'selected' : ''); ?>>Feribot</option>
                                        <option value="other" <?php echo e(old('transportation_method', $tour->transportation_method) === 'other' ? 'selected' : ''); ?>>Diğer</option>
                                    </select>
                                    <?php $__errorArgs = ['transportation_method'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>

                        <!-- Air Transportation Fields -->
                        <div id="airTransportFields" style="display: <?php echo e(old('transportation_method', $tour->transportation_method) === 'air' ? 'block' : 'none'); ?>;">
                            <div class="alert alert-info">
                                <i class="fas fa-info-circle me-2"></i>
                                <small>Uçaklı ulaşımda uçuş kalkış saati ve uçuş numarasını girin. Yolcu bazlı uçuş detayları operasyon yönetiminde tutulur.</small>
                            </div>
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="form-label">Uçuş Numarası</label>
                                        <input type="text" name="departure_flight_number" class="form-control"
                                               value="<?php echo e(old('departure_flight_number', $tour->departure_flight_number)); ?>"
                                               placeholder="Örn: TK1234">
                                        <div class="form-text">Opsiyonel - varsa giriniz</div>
                                        <?php $__errorArgs = ['departure_flight_number'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="form-label">Uçuş Kalkış Saati</label>
                                        <input type="time" name="flight_departure_time" class="form-control"
                                               value="<?php echo e(old('flight_departure_time', $tour->flight_departure_time ? \Carbon\Carbon::parse($tour->flight_departure_time)->format('H:i') : '')); ?>">
                                        <div class="form-text">Opsiyonel</div>
                                        <?php $__errorArgs = ['flight_departure_time'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- Road Transportation Fields -->
                        <div id="roadTransportFields" style="display: <?php echo e(in_array(old('transportation_method', $tour->transportation_method), ['road', 'bus', 'minibus', 'private_vehicle']) ? 'block' : 'none'); ?>;">
                            <div class="alert alert-info">
                                <i class="fas fa-info-circle me-2"></i>
                                <small>Kalkış ve transfer noktalarını ekleyebilirsiniz.</small>
                            </div>

                            <div class="form-check form-switch mb-3">
                                <input class="form-check-input" type="checkbox" id="hasTransferPoints" name="has_transfer_points"
                                       value="1" <?php echo e(old('has_transfer_points', $tour->has_transfer_points) ? 'checked' : ''); ?>>
                                <label class="form-check-label" for="hasTransferPoints">
                                    Transfer noktası ekle
                                </label>
                            </div>

                            <div id="transferPointsContainer" style="display: <?php echo e(old('has_transfer_points', $tour->has_transfer_points) ? 'block' : 'none'); ?>;">
                                <div class="d-flex justify-content-between align-items-center mb-3">
                                    <h6 class="mb-0">Transfer Noktaları</h6>
                                    <button type="button" class="btn btn-sm btn-primary" id="addTransferPoint">
                                        <i class="fas fa-plus me-1"></i>Nokta Ekle
                                    </button>
                                </div>

                                <div id="transferPointsList">
                                    <?php if($tour->transferPoints && $tour->transferPoints->count() > 0): ?>
                                        <?php $__currentLoopData = $tour->transferPoints; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $point): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <div class="transfer-point-item card mb-2">
                                                <div class="card-body">
                                                    <div class="row">
                                                        <div class="col-md-5">
                                                            <div class="form-group">
                                                                <label class="form-label small">Yer Adı</label>
                                                                <input type="text" name="transfer_points[<?php echo e($index); ?>][location_name]"
                                                                       class="form-control form-control-sm" value="<?php echo e($point->location_name); ?>"
                                                                       placeholder="Örn: Taksim Meydanı" required>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-2">
                                                            <div class="form-group">
                                                                <label class="form-label small">Saat</label>
                                                                <input type="time" name="transfer_points[<?php echo e($index); ?>][pickup_time]"
                                                                       class="form-control form-control-sm"
                                                                       value="<?php echo e($point->pickup_time ? \Carbon\Carbon::parse($point->pickup_time)->format('H:i') : ''); ?>" required>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-4">
                                                            <div class="form-group">
                                                                <label class="form-label small">Not</label>
                                                                <input type="text" name="transfer_points[<?php echo e($index); ?>][notes]"
                                                                       class="form-control form-control-sm" value="<?php echo e($point->notes); ?>"
                                                                       placeholder="Opsiyonel">
                                                            </div>
                                                        </div>
                                                        <div class="col-md-1 d-flex align-items-end">
                                                            <button type="button" class="btn btn-sm btn-danger remove-transfer-point w-100">
                                                                <i class="fas fa-trash"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                    <input type="hidden" name="transfer_points[<?php echo e($index); ?>][id]" value="<?php echo e($point->id); ?>">
                                                    <input type="hidden" name="transfer_points[<?php echo e($index); ?>][sort_order]" value="<?php echo e($index); ?>" class="sort-order-input">
                                                </div>
                                            </div>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>

                        <!-- Transportation Notes -->
                        <div class="row mt-3">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label class="form-label">Ulaşım Notları</label>
                                    <textarea name="transportation_notes" class="form-control" rows="3"
                                              placeholder="Ulaşım ile ilgili ek bilgiler..."><?php echo e(old('transportation_notes', $tour->transportation_notes)); ?></textarea>
                                    <?php $__errorArgs = ['transportation_notes'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Capacity Section -->
                    <div class="form-section" id="capacity">
                        <div class="section-header">
                            <h3 class="section-title">
                                <i class="fas fa-users section-icon"></i>
                                Kapasite ve Yaş Sınırları
                            </h3>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label required">Minimum Katılımcı</label>
                                    <input type="number" name="min_participants" class="form-control"
                                           value="<?php echo e(old('min_participants', $tour->min_participants)); ?>" min="1" required>
                                    <?php $__errorArgs = ['min_participants'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label">Maksimum Katılımcı</label>
                                    <input type="number" name="max_participants" class="form-control"
                                           value="<?php echo e(old('max_participants', $tour->max_participants)); ?>" min="1">
                                    <div class="form-text">Boş bırakırsanız sınırsız olur</div>
                                    <?php $__errorArgs = ['max_participants'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label">Minimum Yaş</label>
                                    <input type="number" name="min_age" class="form-control"
                                           value="<?php echo e(old('min_age', $tour->min_age)); ?>" min="0">
                                    <div class="form-text">Yaş sınırı yoksa boş bırakın</div>
                                    <?php $__errorArgs = ['min_age'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label">Maksimum Yaş</label>
                                    <input type="number" name="max_age" class="form-control"
                                           value="<?php echo e(old('max_age', $tour->max_age)); ?>" min="1">
                                    <div class="form-text">Yaş sınırı yoksa boş bırakın</div>
                                    <?php $__errorArgs = ['max_age'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label required">Zorluk Seviyesi</label>
                                    <select name="difficulty_level" class="form-select" required>
                                        <option value="">Seçiniz</option>
                                        <option value="easy" <?php echo e(old('difficulty_level', $tour->difficulty_level) === 'easy' ? 'selected' : ''); ?>>Kolay</option>
                                        <option value="moderate" <?php echo e(old('difficulty_level', $tour->difficulty_level) === 'moderate' ? 'selected' : ''); ?>>Orta</option>
                                        <option value="challenging" <?php echo e(old('difficulty_level', $tour->difficulty_level) === 'challenging' ? 'selected' : ''); ?>>Zor</option>
                                        <option value="extreme" <?php echo e(old('difficulty_level', $tour->difficulty_level) === 'extreme' ? 'selected' : ''); ?>>Çok Zor</option>
                                    </select>
                                    <?php $__errorArgs = ['difficulty_level'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label">Zorluk Açıklaması</label>
                                    <textarea name="difficulty_description" class="form-control" rows="3"
                                              placeholder="Zorluk seviyesi hakkında detaylı açıklama..."><?php echo e(old('difficulty_description', $tour->difficulty_description)); ?></textarea>
                                    <div class="form-text">Opsiyonel - Zorluk seviyesi hakkında ek bilgi verebilirsiniz</div>
                                    <?php $__errorArgs = ['difficulty_description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Categories Section -->
                    <div class="form-section" id="categories">
                        <div class="section-header">
                            <h3 class="section-title">
                                <i class="fas fa-tags section-icon"></i>
                                Kategoriler
                            </h3>
                        </div>

                        <?php if($categories->count() > 0): ?>
                            <div class="form-group">
                                <label class="form-label">Tur Kategorileri <span class="text-muted">(Opsiyonel)</span></label>
                                <div class="alert alert-info mb-3">
                                    <i class="fas fa-info-circle me-2"></i>
                                    <small>Ana kategorilere ve kendi oluşturduğunuz alt kategorilere tur ekleyebilirsiniz. Kategori seçmezseniz tur doğrudan hizmet türüne eklenecektir.</small>
                                </div>
                                <div class="categories-tree">
                                    <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php if($category->is_master_category): ?>
                                            <!-- Ana Kategori -->
                                            <div class="category-group mb-3">
                                                <div class="category-master">
                                                    <div class="d-flex align-items-center mb-2">
                                                        <div class="category-icon me-2" style="background-color: <?php echo e($category->color_code); ?>15;">
                                                            <i class="fas fa-<?php echo e($category->icon); ?>" style="color: <?php echo e($category->color_code); ?>;"></i>
                                                        </div>
                                                        <div class="flex-grow-1">
                                                            <div class="form-check">
                                                                <input type="checkbox" name="categories[]" value="<?php echo e($category->id); ?>"
                                                                       class="form-check-input category-checkbox"
                                                                       id="category<?php echo e($category->id); ?>"
                                                                    <?php echo e(in_array($category->id, old('categories', optional($tour->product)->categories->pluck('id')->toArray() ?? [])) ? 'checked' : ''); ?>>
                                                                <label class="form-check-label fw-bold" for="category<?php echo e($category->id); ?>">
                                                                    <?php echo e($category->name); ?>

                                                                    <span class="badge bg-warning bg-opacity-75 text-dark ms-2" style="font-size: 0.65rem;">
                                                                        <i class="fas fa-star me-1"></i>Ana Kategori
                                                                    </span>
                                                                </label>
                                                            </div>
                                                        </div>
                                                    </div>

                                                    <!-- Alt Kategoriler -->
                                                    <?php if(isset($category->agencyChildren) && $category->agencyChildren->count() > 0): ?>
                                                        <div class="category-children ms-4">
                                                            <?php $__currentLoopData = $category->agencyChildren; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $child): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                <div class="form-check mb-2">
                                                                    <input type="checkbox" name="categories[]" value="<?php echo e($child->id); ?>"
                                                                           class="form-check-input category-checkbox"
                                                                           id="category<?php echo e($child->id); ?>"
                                                                        <?php echo e(in_array($child->id, old('categories', optional($tour->product)->categories->pluck('id')->toArray() ?? [])) ? 'checked' : ''); ?>>
                                                                    <label class="form-check-label" for="category<?php echo e($child->id); ?>">
                                                                        <i class="fas fa-arrow-right text-muted me-1" style="font-size: 0.75rem;"></i>
                                                                        <?php echo e($child->name); ?>

                                                                    </label>
                                                                </div>
                                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </div>
                                                    <?php endif; ?>
                                                </div>
                                            </div>
                                        <?php elseif(!$category->master_category_id): ?>
                                            <!-- Bağımsız Acente Kategorisi -->
                                            <div class="category-group mb-3">
                                                <div class="form-check">
                                                    <input type="checkbox" name="categories[]" value="<?php echo e($category->id); ?>"
                                                           class="form-check-input category-checkbox"
                                                           id="category<?php echo e($category->id); ?>"
                                                        <?php echo e(in_array($category->id, old('categories', optional($tour->product)->categories->pluck('id')->toArray() ?? [])) ? 'checked' : ''); ?>>
                                                    <label class="form-check-label fw-semibold" for="category<?php echo e($category->id); ?>">
                                                        <i class="fas fa-folder text-primary me-2"></i>
                                                        <?php echo e($category->name); ?>

                                                    </label>
                                                </div>
                                            </div>
                                        <?php endif; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                                <div class="form-text">İsterseniz kategorisiz oluşturabilirsiniz</div>
                                <?php $__errorArgs = ['categories'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        <?php else: ?>
                            <div class="alert alert-warning">
                                <i class="fas fa-exclamation-triangle alert-icon"></i>
                                Henüz kategori oluşturmadınız. <a href="<?php echo e(route('agency.categories.create', ['product_type' => 'kultur-turu'])); ?>" target="_blank">Buradan</a> kategori oluşturabilirsiniz.
                            </div>
                        <?php endif; ?>
                    </div>

                    <!-- Terms Section -->
                    <div class="form-section" id="terms">
                        <div class="section-header">
                            <h3 class="section-title">
                                <i class="fas fa-file-contract section-icon"></i>
                                Şartlar ve Koşullar
                            </h3>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label">İptal Politikası</label>
                                    <select name="cancellation_policy_definition_id" class="form-select" id="cancellationPolicySelect">
                                        <option value="">Manuel Giriş</option>
                                        <?php if(isset($cancellationPolicies)): ?>
                                            <?php $__currentLoopData = $cancellationPolicies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $policy): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($policy->id); ?>"
                                                        data-description="<?php echo e($policy->description); ?>"
                                                    <?php echo e(old('cancellation_policy_definition_id', $tour->cancellation_policy_definition_id ?? '') == $policy->id ? 'selected' : ''); ?>>
                                                    <?php echo e($policy->name); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php endif; ?>
                                    </select>
                                    <div class="form-text">Hazır iptal politikası seçebilir veya manuel girebilirsiniz</div>
                                    <?php $__errorArgs = ['cancellation_policy_definition_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="form-label">İptal Son Tarihi (Saat)</label>
                                    <input type="number" name="cancellation_deadline_hours" class="form-control"
                                           value="<?php echo e(old('cancellation_deadline_hours', $tour->cancellation_deadline_hours)); ?>"
                                           min="1" placeholder="24">
                                    <div class="form-text">Tur başlangıcından kaç saat önce iptal edilebilir</div>
                                    <?php $__errorArgs = ['cancellation_deadline_hours'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="form-label">İptal Politikası Detayı</label>
                            <div class="quill-editor-container">
                                <div id="editor-cancellation"></div>
                            </div>
                            <input type="hidden" name="cancellation_policy" id="cancellation-input" value="<?php echo e(old('cancellation_policy', $tour->cancellation_policy)); ?>">
                            <div class="form-text">İptal koşulları ve iade politikasını belirtin</div>
                            <?php $__errorArgs = ['cancellation_policy'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="form-group">
                            <label class="form-label">Şartlar ve Koşullar</label>
                            <?php if(isset($termsConditions) && $termsConditions->count() > 0): ?>
                                <select class="form-select mb-2" id="termsTemplateSelect">
                                    <option value="">Şablon Seç (Opsiyonel)</option>
                                    <?php $__currentLoopData = $termsConditions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $template): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($template->id); ?>" data-content="<?php echo e($template->description); ?>">
                                            <?php echo e($template->name); ?>

                                        </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            <?php endif; ?>
                            <div class="quill-editor-container">
                                <div id="editor-terms"></div>
                            </div>
                            <input type="hidden" name="terms_conditions" id="terms-input" value="<?php echo e(old('terms_conditions', $tour->terms_conditions)); ?>">
                            <div class="form-text">Tura katılım için geçerli şartları belirtin</div>
                            <?php $__errorArgs = ['terms_conditions'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="text-danger small mt-1"><?php echo e($message); ?></div>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    </div>

                    <!-- Form Actions -->
                    <div class="form-actions">
                        <div class="save-status" id="saveStatus">
                            <i class="fas fa-circle"></i>
                            Değişiklikler kaydedilmedi
                        </div>
                        <div class="action-buttons">
                            <button type="button" class="btn btn-outline-secondary" onclick="resetForm()">
                                <i class="fas fa-undo"></i> Sıfırla
                            </button>
                            <button type="submit" class="btn btn-primary" id="saveBtn">
                                <i class="fas fa-save"></i> Değişiklikleri Kaydet
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <!-- Quick Navigation -->
        <div class="quick-nav" id="quickNav">
            <a href="#basic-info" class="quick-nav-item">Temel Bilgiler</a>
            <a href="#highlights" class="quick-nav-item">Özellikler</a>
            <a href="#location" class="quick-nav-item">Konum</a>
            <a href="#duration" class="quick-nav-item">Süre</a>
            <a href="#capacity" class="quick-nav-item">Kapasite</a>
            <a href="#categories" class="quick-nav-item">Kategoriler</a>
            <a href="#terms" class="quick-nav-item">Şartlar</a>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
    <!-- Quill Rich Text Editor JS -->
    <script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // Initialize Quill Editors
            const toolbarOptions = [
                [{ 'header': [1, 2, 3, false] }],
                ['bold', 'italic', 'underline', 'strike'],
                [{ 'list': 'ordered'}, { 'list': 'bullet' }],
                [{ 'color': [] }, { 'background': [] }],
                [{ 'align': [] }],
                ['link'],
                ['clean']
            ];

            // Description Editor
            const descriptionEditor = new Quill('#editor-description', {
                theme: 'snow',
                modules: {
                    toolbar: toolbarOptions
                },
                placeholder: 'Turunuzun detaylı açıklamasını yazın...'
            });

            const descriptionInput = document.getElementById('description-input');
            if (descriptionInput.value) {
                descriptionEditor.root.innerHTML = descriptionInput.value;
            }
            descriptionEditor.on('text-change', function() {
                descriptionInput.value = descriptionEditor.root.innerHTML;
            });

            // Places to Visit Editor
            const placesToVisitEditor = new Quill('#editor-places-to-visit', {
                theme: 'snow',
                modules: {
                    toolbar: toolbarOptions
                },
                placeholder: 'Gezilecek yerleri yazın...'
            });

            const placesToVisitInput = document.getElementById('places-to-visit-input');
            if (placesToVisitInput.value) {
                placesToVisitEditor.root.innerHTML = placesToVisitInput.value;
            }
            placesToVisitEditor.on('text-change', function() {
                placesToVisitInput.value = placesToVisitEditor.root.innerHTML;
            });

            // Inclusions Editor
            const inclusionsEditor = new Quill('#editor-inclusions', {
                theme: 'snow',
                modules: {
                    toolbar: toolbarOptions
                },
                placeholder: 'Dahil olan hizmetleri listeleyin...'
            });

            const inclusionsInput = document.getElementById('inclusions-input');
            if (inclusionsInput.value) {
                inclusionsEditor.root.innerHTML = inclusionsInput.value;
            }
            inclusionsEditor.on('text-change', function() {
                inclusionsInput.value = inclusionsEditor.root.innerHTML;
            });

            // Exclusions Editor
            const exclusionsEditor = new Quill('#editor-exclusions', {
                theme: 'snow',
                modules: {
                    toolbar: toolbarOptions
                },
                placeholder: 'Dahil olmayan hizmetleri listeleyin...'
            });

            const exclusionsInput = document.getElementById('exclusions-input');
            if (exclusionsInput.value) {
                exclusionsEditor.root.innerHTML = exclusionsInput.value;
            }
            exclusionsEditor.on('text-change', function() {
                exclusionsInput.value = exclusionsEditor.root.innerHTML;
            });

            // Cancellation Policy Editor
            const cancellationEditor = new Quill('#editor-cancellation', {
                theme: 'snow',
                modules: {
                    toolbar: toolbarOptions
                },
                placeholder: 'İptal politikası detaylarını yazın...'
            });

            const cancellationInput = document.getElementById('cancellation-input');
            if (cancellationInput.value) {
                cancellationEditor.root.innerHTML = cancellationInput.value;
            }
            cancellationEditor.on('text-change', function() {
                cancellationInput.value = cancellationEditor.root.innerHTML;
            });

            // Terms & Conditions Editor
            const termsEditor = new Quill('#editor-terms', {
                theme: 'snow',
                modules: {
                    toolbar: toolbarOptions
                },
                placeholder: 'Şartlar ve koşulları yazın...'
            });

            const termsInput = document.getElementById('terms-input');
            if (termsInput.value) {
                termsEditor.root.innerHTML = termsInput.value;
            }
            termsEditor.on('text-change', function() {
                termsInput.value = termsEditor.root.innerHTML;
            });

            // Template select handlers
            const inclusionsTemplateSelect = document.getElementById('inclusionsTemplateSelect');
            if (inclusionsTemplateSelect) {
                inclusionsTemplateSelect.addEventListener('change', function() {
                    const selectedOption = this.options[this.selectedIndex];
                    if (selectedOption.value) {
                        const content = selectedOption.getAttribute('data-content');
                        inclusionsEditor.root.innerHTML = content || '';
                        inclusionsInput.value = content || '';
                    }
                });
            }

            const exclusionsTemplateSelect = document.getElementById('exclusionsTemplateSelect');
            if (exclusionsTemplateSelect) {
                exclusionsTemplateSelect.addEventListener('change', function() {
                    const selectedOption = this.options[this.selectedIndex];
                    if (selectedOption.value) {
                        const content = selectedOption.getAttribute('data-content');
                        exclusionsEditor.root.innerHTML = content || '';
                        exclusionsInput.value = content || '';
                    }
                });
            }

            const cancellationPolicySelect = document.getElementById('cancellationPolicySelect');
            if (cancellationPolicySelect) {
                cancellationPolicySelect.addEventListener('change', function() {
                    const selectedOption = this.options[this.selectedIndex];
                    if (selectedOption.value) {
                        const content = selectedOption.getAttribute('data-description');
                        cancellationEditor.root.innerHTML = content || '';
                        cancellationInput.value = content || '';
                    }
                });
            }

            const termsTemplateSelect = document.getElementById('termsTemplateSelect');
            if (termsTemplateSelect) {
                termsTemplateSelect.addEventListener('change', function() {
                    const selectedOption = this.options[this.selectedIndex];
                    if (selectedOption.value) {
                        const content = selectedOption.getAttribute('data-content');
                        termsEditor.root.innerHTML = content || '';
                        termsInput.value = content || '';
                    }
                });
            }

            const form = document.getElementById('generalForm');
            const saveBtn = document.getElementById('saveBtn');
            const saveStatus = document.getElementById('saveStatus');
            const daysInput = document.getElementById('daysInput');
            const nightsInput = document.getElementById('nightsInput');

            // Form değişikliklerini takip et
            let formChanged = false;
            const originalFormData = new FormData(form);

            // Form değişiklik algılama
            form.addEventListener('input', function() {
                const currentFormData = new FormData(form);
                formChanged = !compareFormData(originalFormData, currentFormData);
                updateSaveStatus();
            });

            function compareFormData(fd1, fd2) {
                for (let [key, value] of fd1) {
                    if (fd2.get(key) !== value) return false;
                }
                for (let [key, value] of fd2) {
                    if (fd1.get(key) !== value) return false;
                }
                return true;
            }

            function updateSaveStatus() {
                if (formChanged) {
                    saveStatus.innerHTML = '<i class="fas fa-exclamation-circle"></i> Değişiklikler kaydedilmedi';
                    saveStatus.className = 'save-status';
                } else {
                    saveStatus.innerHTML = '<i class="fas fa-check-circle"></i> Tüm değişiklikler kaydedildi';
                    saveStatus.className = 'save-status saved';
                }
            }

            // Gece sayısını otomatik hesapla (kullanıcı elle değiştirmediyse)
            let nightsManuallyChanged = false;

            if (nightsInput) {
                nightsInput.addEventListener('input', function() {
                    nightsManuallyChanged = true;
                });
            }

            if (daysInput) {
                daysInput.addEventListener('input', function() {
                    const days = parseInt(this.value) || 0;

                    // Sadece kullanıcı elle değiştirmediyse otomatik hesapla
                    if (!nightsManuallyChanged && nightsInput) {
                        const nights = Math.max(0, days - 1);
                        nightsInput.value = nights;
                    }
                });
            }

            // Auto-fill arrival city from departure city
            const departureCitySelect = document.querySelector('select[name="departure_city_id"]');
            const arrivalCitySelect = document.querySelector('select[name="arrival_city_id"]');
            let arrivalCityManuallyChanged = false;

            if (arrivalCitySelect) {
                arrivalCitySelect.addEventListener('change', function() {
                    if (this.value) {
                        arrivalCityManuallyChanged = true;
                    }
                });
            }

            if (departureCitySelect) {
                departureCitySelect.addEventListener('change', function() {
                    // Only auto-fill if arrival city hasn't been manually changed
                    if (!arrivalCityManuallyChanged && this.value) {
                        arrivalCitySelect.value = this.value;
                    }
                });
            }

            // Category selection
            const categoryCards = document.querySelectorAll('.category-card');
            const categoryCheckboxes = document.querySelectorAll('.category-checkbox');

            if (categoryCards) {
                categoryCards.forEach(card => {
                    card.addEventListener('click', function(e) {
                        if (e.target.type !== 'checkbox') {
                            const checkbox = this.querySelector('.category-checkbox');
                            if (checkbox) {
                                checkbox.checked = !checkbox.checked;
                                checkbox.dispatchEvent(new Event('change'));
                            }
                        }
                        const checkbox = this.querySelector('.category-checkbox');
                        if (checkbox) {
                            this.classList.toggle('selected', checkbox.checked);
                        }
                    });
                });
            }

            if (categoryCheckboxes) {
                categoryCheckboxes.forEach(checkbox => {
                    checkbox.addEventListener('change', function() {
                        const card = this.closest('.category-card');
                        if (card) {
                            card.classList.toggle('selected', this.checked);
                        }
                    });

                    // Set initial state
                    const card = checkbox.closest('.category-card');
                    if (card) {
                        card.classList.toggle('selected', checkbox.checked);
                    }
                });
            }

            // Form submission
            form.addEventListener('submit', function(e) {
                // Category validation removed - categories are now optional

                // Mark as saved to prevent beforeunload warning
                formChanged = false;

                // Update save status
                saveStatus.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Kaydediliyor...';
                saveStatus.className = 'save-status saving';
                saveBtn.disabled = true;
                saveBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Kaydediliyor...';
            });

            // Reset form
            window.resetForm = function() {
                if (confirm('Tüm değişiklikleri geri almak istediğinizden emin misiniz?')) {
                    location.reload();
                }
            };

            // Quick navigation
            const quickNavItems = document.querySelectorAll('.quick-nav-item');
            const sections = document.querySelectorAll('.form-section');

            // Smooth scroll for quick nav
            if (quickNavItems && quickNavItems.length > 0) {
                quickNavItems.forEach(item => {
                    item.addEventListener('click', function(e) {
                        e.preventDefault();
                        const targetId = this.getAttribute('href').substring(1);
                        const targetSection = document.getElementById(targetId);
                        if (targetSection) {
                            targetSection.scrollIntoView({ behavior: 'smooth', block: 'start' });
                        }
                    });
                });
            }

            // Update active nav item on scroll
            function updateActiveNavItem() {
                let current = '';
                if (sections && sections.length > 0) {
                    sections.forEach(section => {
                        const sectionTop = section.offsetTop - 100;
                        if (window.pageYOffset >= sectionTop) {
                            current = section.getAttribute('id');
                        }
                    });

                    if (quickNavItems && quickNavItems.length > 0) {
                        quickNavItems.forEach(item => {
                            item.classList.remove('active');
                            if (item.getAttribute('href') === '#' + current) {
                                item.classList.add('active');
                            }
                        });
                    }
                }
            }

            window.addEventListener('scroll', updateActiveNavItem);
            updateActiveNavItem(); // Initial call

            // Auto-save functionality (optional)
            let autoSaveTimeout;
            form.addEventListener('input', function() {
                clearTimeout(autoSaveTimeout);
                autoSaveTimeout = setTimeout(function() {
                    if (formChanged) {
                        // Could implement auto-save here
                        console.log('Auto-save would trigger here');
                    }
                }, 5000); // 5 seconds after last change
            });

            // Initialize based on current values
            if (durationType.value) {
                durationType.dispatchEvent(new Event('change'));
            }
            if (daysInput.value && durationType.value === 'days') {
                daysInput.dispatchEvent(new Event('input'));
            }

            // Transportation method handling
            const transportationMethod = document.getElementById('transportationMethod');
            const airTransportFields = document.getElementById('airTransportFields');
            const roadTransportFields = document.getElementById('roadTransportFields');
            const hasTransferPoints = document.getElementById('hasTransferPoints');
            const transferPointsContainer = document.getElementById('transferPointsContainer');
            const addTransferPointBtn = document.getElementById('addTransferPoint');
            const transferPointsList = document.getElementById('transferPointsList');

            let transferPointIndex = <?php echo e($tour->transferPoints ? $tour->transferPoints->count() : 0); ?>;

            // Transportation method change handler
            if (transportationMethod) {
                transportationMethod.addEventListener('change', function() {
                    const value = this.value;

                    // Hide all transport fields
                    airTransportFields.style.display = 'none';
                    roadTransportFields.style.display = 'none';

                    // Show relevant fields
                    if (value === 'air') {
                        airTransportFields.style.display = 'block';
                    } else if (value === 'road') {
                        roadTransportFields.style.display = 'block';
                    }
                });
            }

            // Transfer points checkbox handler
            if (hasTransferPoints) {
                hasTransferPoints.addEventListener('change', function() {
                    transferPointsContainer.style.display = this.checked ? 'block' : 'none';
                });
            }

            // Add transfer point
            if (addTransferPointBtn) {
                addTransferPointBtn.addEventListener('click', function() {
                    const pointHtml = `
                        <div class="transfer-point-item card mb-2">
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-md-5">
                                        <div class="form-group">
                                            <label class="form-label small">Yer Adı</label>
                                            <input type="text" name="transfer_points[${transferPointIndex}][location_name]"
                                                   class="form-control form-control-sm"
                                                   placeholder="Örn: Taksim Meydanı" required>
                                        </div>
                                    </div>
                                    <div class="col-md-2">
                                        <div class="form-group">
                                            <label class="form-label small">Saat</label>
                                            <input type="time" name="transfer_points[${transferPointIndex}][pickup_time]"
                                                   class="form-control form-control-sm" required>
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <label class="form-label small">Not</label>
                                            <input type="text" name="transfer_points[${transferPointIndex}][notes]"
                                                   class="form-control form-control-sm"
                                                   placeholder="Opsiyonel">
                                        </div>
                                    </div>
                                    <div class="col-md-1 d-flex align-items-end">
                                        <button type="button" class="btn btn-sm btn-danger remove-transfer-point w-100">
                                            <i class="fas fa-trash"></i>
                                        </button>
                                    </div>
                                </div>
                                <input type="hidden" name="transfer_points[${transferPointIndex}][sort_order]" value="${transferPointIndex}" class="sort-order-input">
                            </div>
                        </div>
                    `;

                    transferPointsList.insertAdjacentHTML('beforeend', pointHtml);
                    transferPointIndex++;
                    formChanged = true;
                    updateSaveStatus();
                });
            }

            // Remove transfer point (using event delegation)
            if (transferPointsList) {
                transferPointsList.addEventListener('click', function(e) {
                    if (e.target.classList.contains('remove-transfer-point') || e.target.closest('.remove-transfer-point')) {
                        const btn = e.target.classList.contains('remove-transfer-point') ? e.target : e.target.closest('.remove-transfer-point');
                        const item = btn.closest('.transfer-point-item');

                        if (confirm('Bu transfer noktasını silmek istediğinizden emin misiniz?')) {
                            item.remove();
                            formChanged = true;
                            updateSaveStatus();

                            // Update sort orders
                            document.querySelectorAll('.transfer-point-item').forEach((item, index) => {
                                const sortInput = item.querySelector('.sort-order-input');
                                if (sortInput) {
                                    sortInput.value = index;
                                }
                            });
                        }
                    }
                });
            }

            // Prevent accidental navigation away
            window.addEventListener('beforeunload', function(e) {
                if (formChanged) {
                    e.preventDefault();
                    e.returnValue = 'Kaydedilmemiş değişiklikleriniz var. Sayfadan ayrılmak istediğinizden emin misiniz?';
                }
            });
        });
    </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/general.blade.php ENDPATH**/ ?>