<?php $__env->startSection('title', 'Organisations'); ?>

<?php $__env->startSection('content'); ?>
<div class="pg-head">
    <div>
        <h1>Organisations</h1>
        <p>Manage institutions and companies that own events on MeXCo.</p>
    </div>
    <a href="<?php echo e(route('mexco.super.organisations.create')); ?>" class="btn-purple">+ Create organisation</a>
</div>

<div class="card section-card" style="margin-bottom:1rem">
    <form method="GET" class="d-flex flex-wrap gap-2 align-items-center">
        <input type="search" name="q" class="form-input" style="max-width:280px" placeholder="Search name, slug, email…" value="<?php echo e($q); ?>">
        <select name="status" class="form-input" style="max-width:160px">
            <option value="">All statuses</option>
            <?php $__currentLoopData = ['active','suspended','archived']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($s); ?>" <?php if($status === $s): echo 'selected'; endif; ?>><?php echo e(ucfirst($s)); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
        <button type="submit" class="btn-outline btn-sm">Filter</button>
    </form>
</div>

<div class="card">
    <div class="tbl-wrap">
        <table class="data-tbl">
            <thead>
                <tr>
                    <th>Organisation</th>
                    <th>Type</th>
                    <th>Contact</th>
                    <th>Events</th>
                    <th>Organisers</th>
                    <th>Status</th>
                    <th style="text-align:right">Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $organisations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $org): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td>
                            <div class="cell-name"><?php echo e($org->name); ?></div>
                            <div class="cell-sub mono"><?php echo e($org->slug); ?></div>
                        </td>
                        <td><?php echo e(\App\Models\MexcoOrganisation::types()[$org->type] ?? $org->type); ?></td>
                        <td class="cell-sub">
                            <?php echo e($org->contact_person ?: '-'); ?><br>
                            <?php echo e($org->email ?: '-'); ?>

                        </td>
                        <td><?php echo e($org->events_count); ?></td>
                        <td><?php echo e($org->users_count); ?></td>
                        <td>
                            <span class="status-pill <?php echo e($org->status === 'active' ? 'success' : 'muted'); ?>"><?php echo e(ucfirst($org->status)); ?></span>
                        </td>
                        <td>
                            <div class="action-group">
                                <a href="<?php echo e(route('mexco.super.organisations.show', $org)); ?>" class="btn-outline btn-sm">View</a>
                                <a href="<?php echo e(route('mexco.super.organisations.edit', $org)); ?>" class="btn-outline btn-sm">Edit</a>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr><td colspan="7" class="text-center cell-sub py-4">No organisations yet.</td></tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('super-admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\myapp\resources\views/super-admin/organisations/index.blade.php ENDPATH**/ ?>