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

<?php $__env->startSection('content'); ?>
<div class="max-w-2xl mx-auto">
    <div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
        <div class="p-6 border-b border-gray-100 bg-gray-50">
            <h3 class="text-lg font-bold text-gray-800">Upload File Data</h3>
            <p class="text-sm text-gray-500">Silakan upload file Excel (.xlsx, .xls) atau CSV yang berisi data penerima manfaat.</p>
        </div>
        
        <div class="p-8">
            <form action="<?php echo e(route('import.store')); ?>" method="POST" enctype="multipart/form-data" class="space-y-6">
                <?php echo csrf_field(); ?>
                
                <?php if(session('error')): ?>
                <div class="bg-red-50 border-l-4 border-red-400 p-4 text-red-700 text-sm">
                    <?php echo e(session('error')); ?>

                </div>
                <?php endif; ?>

                <div class="border-2 border-dashed border-gray-200 rounded-xl p-12 text-center hover:border-primary transition cursor-pointer group" onclick="document.getElementById('file-upload').click()">
                    <input type="file" name="file" id="file-upload" class="hidden" accept=".xlsx,.xls,.csv" onchange="updateFileName(this)">
                    <div class="space-y-4">
                        <div class="w-16 h-16 bg-blue-50 text-primary rounded-full flex items-center justify-center mx-auto group-hover:bg-primary group-hover:text-white transition">
                            <i class="fas fa-file-excel text-2xl"></i>
                        </div>
                        <div id="file-info">
                            <p class="text-gray-700 font-medium">Klik untuk pilih file atau drag and drop</p>
                            <p class="text-gray-400 text-xs mt-1">Format yang didukung: XLSX, XLS, CSV (Maks. 10MB)</p>
                        </div>
                    </div>
                </div>

                <div class="bg-blue-50 p-4 rounded-lg">
                    <h4 class="text-sm font-bold text-blue-800 mb-2 flex items-center">
                        <i class="fas fa-info-circle mr-2"></i> Petunjuk Format File
                    </h4>
                    <ul class="text-xs text-blue-700 space-y-1 list-disc list-inside">
                        <li>Gunakan baris pertama sebagai header (Nama, NIK, Alamat, Desa, Kecamatan, Nama Orang Tua Asuh, Jabatan Orang Tua Asuh).</li>
                        <li>Pastikan NIK unik dan terdiri dari 16 digit.</li>
                        <li>Data akan otomatis ditambahkan ke sistem.</li>
                    </ul>
                </div>

                <div class="flex items-center justify-end space-x-4 pt-4 border-t border-gray-100">
                    <a href="<?php echo e(route('beneficiaries.index')); ?>" class="px-6 py-2.5 rounded-lg text-sm font-medium text-gray-600 hover:bg-gray-100 transition">
                        Batal
                    </a>
                    <button type="submit" class="bg-primary text-white px-8 py-2.5 rounded-lg text-sm font-bold hover:bg-sky-600 transition shadow-md shadow-blue-100 flex items-center">
                        <i class="fas fa-upload mr-2"></i> Proses Import
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>

<script>
    function updateFileName(input) {
        const fileInfo = document.getElementById('file-info');
        if (input.files && input.files[0]) {
            const fileName = input.files[0].name;
            fileInfo.innerHTML = `
                <p class="text-primary font-bold">${fileName}</p>
                <p class="text-gray-400 text-xs mt-1">File siap diupload</p>
            `;
        }
    }
</script>
<?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/import/index.blade.php ENDPATH**/ ?>