<?php $__env->startSection('title', 'Kelola OPD - SKM Survey'); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid">
    <div class="row mb-4">
        <div class="col-12">
            <h2 style="color: #1e3a8a; font-weight: 700;">
                <i class="bi bi-building me-2"></i> Kelola Organisasi Perangkat Daerah (OPD)
            </h2>
            <p class="text-muted">Kelola data Organisasi Perangkat Daerah untuk Survey Kepuasan Masyarakat</p>
        </div>
    </div>

    <div class="card card-gov shadow-sm mb-4">
        <div class="card-header d-flex justify-content-between align-items-center">
            <h5 class="mb-0">
                <i class="bi bi-list-ul me-2"></i> Daftar OPD
            </h5>
            <a href="<?php echo e(route('admin.opds.create')); ?>" class="btn btn-gov-primary">
                <i class="bi bi-plus-circle me-2"></i> Tambah OPD
            </a>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-hover align-middle">
                    <thead class="table-light">
                        <tr>
                            <th style="width: 50px;">No</th>
                            <th>Nama OPD</th>
                            <th style="width: 100px;">Kode</th>
                            <th style="width: 200px;">Deskripsi</th>
                            <th style="width: 120px;" class="text-center">Total Response</th>
                            <th style="width: 100px;" class="text-center">Status</th>
                            <th style="width: 250px;" class="text-center">Aksi</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $opds; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $opd): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td class="fw-semibold"><?php echo e($index + 1); ?></td>
                                <td>
                                    <div class="d-flex align-items-center">
                                        <i class="bi bi-building text-primary me-2"></i>
                                        <strong><?php echo e($opd->name); ?></strong>
                                    </div>
                                </td>
                                <td>
                                    <span class="badge-gov"><?php echo e($opd->code); ?></span>
                                </td>
                                <td>
                                    <small class="text-muted"><?php echo e(\Illuminate\Support\Str::limit($opd->description, 50)); ?></small>
                                </td>
                                <td class="text-center">
                                    <span class="badge bg-secondary"><?php echo e($opd->responses_count); ?></span>
                                </td>
                                <td class="text-center">
                                    <?php if($opd->is_active): ?>
                                        <span class="badge bg-success">Aktif</span>
                                    <?php else: ?>
                                        <span class="badge bg-secondary">Nonaktif</span>
                                    <?php endif; ?>
                                </td>
                                <td>
                                    <div class="btn-group" role="group">
                                        <a href="<?php echo e(route('admin.opds.show', $opd->id)); ?>" class="btn btn-sm btn-info">
                                            <i class="bi bi-eye"></i> Detail
                                        </a>
                                        <a href="<?php echo e(route('admin.opds.edit', $opd->id)); ?>" class="btn btn-sm btn-primary">
                                            <i class="bi bi-pencil"></i> Edit
                                        </a>
                                        <a href="<?php echo e(route('admin.opd.results', $opd->id)); ?>" class="btn btn-sm btn-success" title="Lihat Hasil IKK">
                                            <i class="bi bi-graph-up"></i> Hasil IKK
                                        </a>
                                        <form action="<?php echo e(route('admin.opds.destroy', $opd->id)); ?>" method="POST" class="d-inline" onsubmit="return confirm('Apakah Anda yakin ingin menghapus OPD ini?');">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="btn btn-sm btn-danger">
                                                <i class="bi bi-trash"></i> Hapus
                                            </button>
                                        </form>
                                    </div>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="7" class="text-center py-4">
                                    <i class="bi bi-inbox text-muted" style="font-size: 3rem;"></i>
                                    <p class="text-muted mt-2 mb-0">Belum ada data OPD</p>
                                    <a href="<?php echo e(route('admin.opds.create')); ?>" class="btn btn-gov-primary mt-3">
                                        <i class="bi bi-plus-circle me-2"></i> Tambah OPD Pertama
                                    </a>
                                </td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>




<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/user/Documents/giriwidyan/project/inhouse/skm/resources/views/admin/opds/index.blade.php ENDPATH**/ ?>