<?php $__env->startSection('title', 'Firma Yönetimi'); ?>
<?php $__env->startSection('header_title', 'Firma Yönetimi'); ?>
<?php $__env->startSection('header_subtitle', 'Sistemdeki firmaları (organizasyonları) ekleyin, düzenleyin veya silin.'); ?>

<?php $__env->startSection('content'); ?>
<div class="panel-grid">
    <!-- Left: Add New Organization Form -->
    <div class="card">
        <div class="card-title">Yeni Firma Ekle</div>
        <form action="<?php echo e(route('organizations.create')); ?>" method="POST">
            <?php echo csrf_field(); ?>
            
            <div class="form-group">
                <label for="name">Firma / Grup Adı</label>
                <input type="text" name="name" id="name" class="form-control" placeholder="Örn: Lexa Bilişim" required>
            </div>

            <button type="submit" class="btn btn-primary" style="width: 100%; margin-top: 1rem;">
                <ion-icon name="add-circle-outline" style="font-size: 1.2rem;"></ion-icon>
                Firmayı Oluştur
            </button>
        </form>
    </div>

    <!-- Right: Organizations Table -->
    <div class="card">
        <div class="card-title">Kayıtlı Firmalar</div>
        
        <div class="table-responsive">
            <table class="table">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Firma Adı</th>
                        <th>Kullanıcı Sayısı</th>
                        <th>Oluşturulma Tarihi</th>
                        <th style="width: 100px;">İşlemler</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $organizations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $org): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td>#<?php echo e($org->id); ?></td>
                            <td><strong><?php echo e($org->name); ?></strong></td>
                            <td>
                                <span class="badge badge-processing">
                                    <?php echo e($org->users_count); ?> Kullanıcı
                                </span>
                            </td>
                            <td><?php echo e($org->created_at->format('d.m.Y H:i')); ?></td>
                            <td>
                                <form action="<?php echo e(route('organizations.delete', $org->id)); ?>" method="POST" style="display: inline;" onsubmit="return confirm('Bu firmayı silmek istediğinize emin misiniz? Bu firmaya ait kullanıcılar bağımsız kalacaktır.');">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('DELETE'); ?>
                                    <button type="submit" class="btn btn-danger btn-sm" title="Sil" style="width: 32px; height: 32px; border-radius: 50% !important; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center;">
                                        <ion-icon name="trash-outline"></ion-icon>
                                    </button>
                                </form>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="5" style="text-align: center; color: var(--text-secondary); padding: 2rem;">
                                Kayıtlı hiçbir firma bulunamadı.
                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</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\melih\Desktop\LEXALOG\resources\views/organizations/index.blade.php ENDPATH**/ ?>