<?php $__env->startSection('title', 'İşletme Havuzu'); ?>
<?php $__env->startSection('header_title', 'İşletme Havuzu'); ?>
<?php $__env->startSection('header_subtitle', 'Taranmış ve sisteme kaydedilmiş tüm potansiyel müşteri veritabanı.'); ?>

<?php $__env->startSection('header_actions'); ?>
    <a href="<?php echo e(route('companies.export', request()->all())); ?>" class="btn btn-success">
        <ion-icon name="download-outline"></ion-icon>
        Excel/CSV Olarak Dışa Aktar
    </a>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<!-- Filter Bar -->
<form action="<?php echo e(route('companies.index')); ?>" method="GET" class="filter-bar">
    <div class="filter-item">
        <label for="search">Arama Kelimesi</label>
        <input type="text" name="search" id="search" value="<?php echo e(request('search')); ?>" class="form-control" placeholder="Firma adı, tel, site, mail...">
    </div>

    <div class="filter-item">
        <label for="country">Ülke</label>
        <select name="country" id="country" class="form-select">
            <option value="">Tüm Ülkeler</option>
            <?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($c); ?>" <?php echo e(request('country') == $c ? 'selected' : ''); ?>><?php echo e($c); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
    </div>

    <div class="filter-item">
        <label for="city">Şehir</label>
        <select name="city" id="city" class="form-select">
            <option value="">Tüm Şehirler</option>
            <?php $__currentLoopData = $cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($c); ?>" <?php echo e(request('city') == $c ? 'selected' : ''); ?>><?php echo e($c); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
    </div>

    <div class="filter-item">
        <label for="category">Kategori</label>
        <select name="category" id="category" class="form-select">
            <option value="">Tüm Kategoriler</option>
            <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($c); ?>" <?php echo e(request('category') == $c ? 'selected' : ''); ?>><?php echo e($c); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
    </div>

    <div class="filter-buttons">
        <button type="submit" class="btn btn-primary">
            <ion-icon name="funnel-outline"></ion-icon>
            Filtrele
        </button>
        <?php if(request()->anyFilled(['search', 'country', 'city', 'category'])): ?>
            <a href="<?php echo e(route('companies.index')); ?>" class="btn btn-secondary">
                Temizle
            </a>
        <?php endif; ?>
    </div>
</form>

<!-- Table Card -->
<div class="card">
    <div class="table-responsive">
        <table class="table">
            <thead>
                <tr>
                    <th>Firma Adı</th>
                    <th>Telefon</th>
                    <th>Web Sitesi</th>
                    <th>E-mail</th>
                    <th>Sosyal Medya</th>
                    <th>Konum (Ülke/Şehir)</th>
                    <th>Kategori</th>
                    <th>Kayıt Tarihi</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $companies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $company): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td><strong><?php echo e($company->name); ?></strong></td>
                        <td><?php echo e($company->phone); ?></td>
                        <td>
                            <?php if($company->website && $company->website !== '-'): ?>
                                <a href="<?php echo e($company->website); ?>" target="_blank" style="color: var(--primary); text-decoration: none;" title="<?php echo e($company->website); ?>">
                                    Web Sitesini Aç
                                    <ion-icon name="open-outline" style="font-size: 12px; vertical-align: middle;"></ion-icon>
                                </a>
                            <?php else: ?>
                                -
                            <?php endif; ?>
                        </td>
                        <td>
                            <?php if($company->email && $company->email !== '-'): ?>
                                <a href="mailto:<?php echo e($company->email); ?>" style="color: var(--primary); text-decoration: none;"><?php echo e($company->email); ?></a>
                            <?php else: ?>
                                -
                            <?php endif; ?>
                        </td>
                        <td>
                            <div style="display: flex; gap: 8px; font-size: 18px;">
                                <?php if($company->instagram && $company->instagram !== '-'): ?>
                                    <a href="<?php echo e($company->instagram); ?>" target="_blank" style="color: #e1306c;" title="Instagram">
                                        <ion-icon name="logo-instagram"></ion-icon>
                                    </a>
                                <?php endif; ?>
                                <?php if($company->facebook && $company->facebook !== '-'): ?>
                                    <a href="<?php echo e($company->facebook); ?>" target="_blank" style="color: #1877f2;" title="Facebook">
                                        <ion-icon name="logo-facebook"></ion-icon>
                                    </a>
                                <?php endif; ?>
                                <?php if(($company->instagram == '-' || !$company->instagram) && ($company->facebook == '-' || !$company->facebook)): ?>
                                    -
                                <?php endif; ?>
                            </div>
                        </td>
                        <td><?php echo e($company->country); ?> / <strong><?php echo e($company->city); ?></strong></td>
                        <td style="font-size: 0.8rem; opacity: 0.8;"><?php echo e($company->category); ?></td>
                        <td><?php echo e($company->created_at->format('d.m.Y H:i')); ?></td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="8" style="text-align: center; color: var(--text-secondary); padding: 3rem;">
                            <ion-icon name="search-outline" style="font-size: 40px; opacity: 0.3; margin-bottom: 10px;"></ion-icon>
                            <p>Aradığınız kriterlere uygun hiçbir işletme bulunamadı.</p>
                        </td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>

    <!-- Custom styled Laravel Pagination -->
    <?php if($companies->hasPages()): ?>
        <div class="pagination-wrapper">
            <div style="color: var(--text-secondary); font-size: 0.9rem;">
                Toplam <strong><?php echo e($companies->total()); ?></strong> kayıttan <strong><?php echo e($companies->firstItem()); ?>-<?php echo e($companies->lastItem()); ?></strong> arası gösteriliyor.
            </div>
            <div>
                <?php echo e($companies->links()); ?>

            </div>
        </div>
    <?php endif; ?>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\zeyde\Desktop\LEXALOG\resources\views/companies.blade.php ENDPATH**/ ?>