<?php $__env->startSection('header', 'Data Penerima Manfaat'); ?>

<?php $__env->startSection('content'); ?>
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
    <div class="p-6 border-b border-gray-100 flex flex-col md:flex-row md:items-center justify-between gap-4">
        <div class="flex items-center space-x-2">
            <h3 class="text-lg font-semibold text-gray-800">Daftar Penerima</h3>
            <span class="px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800"><?php echo e($beneficiaries->total()); ?> Total</span>
        </div>
        <div class="flex items-center space-x-3">
            <form action="<?php echo e(route('beneficiaries.index')); ?>" method="GET" class="relative">
                <input type="text" name="search" value="<?php echo e(request('search')); ?>" placeholder="Cari nama, NIK, atau desa..." 
                    class="pl-10 pr-4 py-2 border border-gray-200 rounded-lg text-sm focus:ring-primary focus:border-primary outline-none w-64 transition-all">
                <i class="fas fa-search absolute left-3 top-2.5 text-gray-400"></i>
                <?php if(request('search')): ?>
                    <a href="<?php echo e(route('beneficiaries.index')); ?>" class="absolute right-3 top-2.5 text-gray-400 hover:text-red-500 transition-colors">
                        <i class="fas fa-times-circle"></i>
                    </a>
                <?php endif; ?>
            </form>
            <a href="<?php echo e(route('beneficiaries.create')); ?>" class="bg-primary text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-sky-600 transition flex items-center shadow-sm">
                <i class="fas fa-plus mr-2"></i> Tambah Data
            </a>
            <a href="<?php echo e(route('import.index')); ?>" class="border border-gray-200 text-gray-600 px-4 py-2 rounded-lg text-sm font-medium hover:bg-gray-50 transition flex items-center">
                <i class="fas fa-file-import mr-2"></i> Import
            </a>
        </div>
    </div>

    <div class="overflow-x-auto">
        <table class="w-full text-left">
            <thead>
                <tr class="bg-gray-50 text-gray-500 text-xs uppercase tracking-wider font-semibold">
                    <th class="px-6 py-4">Nama & NIK</th>
                    <th class="px-6 py-4">Lokasi (Desa/Kec)</th>
                    <th class="px-6 py-4">Orang Tua Asuh</th>
                    <th class="px-6 py-4">Komponen</th>
                    <th class="px-6 py-4">Status</th>
                    <th class="px-6 py-4 text-right">Aksi</th>
                </tr>
            </thead>
            <tbody class="divide-y divide-gray-100 text-sm">
                <?php $__currentLoopData = $beneficiaries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $beneficiary): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr class="hover:bg-gray-50 transition">
                    <td class="px-6 py-4">
                        <div class="font-medium text-gray-900"><?php echo e($beneficiary->name); ?></div>
                        <div class="text-gray-500 text-xs"><?php echo e($beneficiary->nik); ?></div>
                    </td>
                    <td class="px-6 py-4 text-gray-600">
                        <div><?php echo e($beneficiary->village); ?></div>
                        <div class="text-xs text-gray-400">Kec. <?php echo e($beneficiary->district); ?></div>
                    </td>
                    <td class="px-6 py-4">
                        <div class="text-gray-700"><?php echo e($beneficiary->foster_parent_name); ?></div>
                        <div class="text-xs text-blue-500 font-medium italic"><?php echo e($beneficiary->foster_parent_role); ?></div>
                    </td>
                    <td class="px-6 py-4">
                        <div class="flex flex-wrap gap-1">
                            <?php if($beneficiary->horticultures->count() > 0): ?>
                                <span class="px-2 py-0.5 rounded bg-green-50 text-green-700 text-[10px] font-bold uppercase">Horti</span>
                            <?php endif; ?>
                            <?php if($beneficiary->livestocks->count() > 0): ?>
                                <span class="px-2 py-0.5 rounded bg-orange-50 text-orange-700 text-[10px] font-bold uppercase">Ternak</span>
                            <?php endif; ?>
                            <?php if($beneficiary->poultries->count() > 0): ?>
                                <span class="px-2 py-0.5 rounded bg-yellow-50 text-yellow-700 text-[10px] font-bold uppercase">Unggas</span>
                            <?php endif; ?>
                            <?php if($beneficiary->fish->count() > 0): ?>
                                <span class="px-2 py-0.5 rounded bg-blue-50 text-blue-700 text-[10px] font-bold uppercase">Ikan</span>
                            <?php endif; ?>
                        </div>
                    </td>
                    <td class="px-6 py-4">
                        <span class="px-2.5 py-0.5 rounded-full text-xs font-medium 
                            <?php if($beneficiary->status == 'active'): ?> bg-green-100 text-green-800 
                            <?php elseif($beneficiary->status == 'graduated'): ?> bg-blue-100 text-blue-800
                            <?php else: ?> bg-gray-100 text-gray-800 <?php endif; ?>">
                            <?php echo e(ucfirst($beneficiary->status)); ?>

                        </span>
                    </td>
                    <td class="px-6 py-4 text-right">
                        <div class="flex items-center justify-end space-x-2">
                            <a href="<?php echo e(route('beneficiaries.show', $beneficiary->id)); ?>" class="p-1.5 text-gray-400 hover:text-primary transition" title="Detail">
                                <i class="fas fa-eye"></i>
                            </a>
                            <a href="<?php echo e(route('beneficiaries.edit', $beneficiary->id)); ?>" class="p-1.5 text-gray-400 hover:text-blue-500 transition" title="Edit">
                                <i class="fas fa-edit"></i>
                            </a>
                            <button class="p-1.5 text-gray-400 hover:text-red-500 transition" title="Hapus">
                                <i class="fas fa-trash"></i>
                            </button>
                        </div>
                    </td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>
    </div>
    <div class="p-6 border-t border-gray-100">
        <?php echo e($beneficiaries->links()); ?>

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

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/sumba001/public_html/pom500.sumbatengahkab.go.id/resources/views/beneficiaries/index.blade.php ENDPATH**/ ?>