function doImport(url) { const file = document.getElementById('importFile').files[0]; if (!file) { Swal.fire({ icon: 'warning', title: 'Perhatian', text: 'Pilih file Excel terlebih dahulu.', timer: 2000, showConfirmButton: false }); return; } const btn = document.getElementById('btnImport'); btn.disabled = true; btn.innerHTML = 'Memproses...'; const fd = new FormData(); fd.append('file', file); fd.append('_token', CSRF); fetch(url, { method: 'POST', body: fd }) .then(r => r.json()) .then(res => { btn.disabled = false; btn.innerHTML = ' Import'; const resultDiv = document.getElementById('importResult'); const msgDiv = document.getElementById('importMsg'); const errorsDiv = document.getElementById('importErrors'); resultDiv.style.display = 'block'; msgDiv.className = 'alert ' + (res.errors && res.errors.length ? 'alert-warning' : 'alert-success'); msgDiv.textContent = res.message; if (res.errors && res.errors.length) { errorsDiv.innerHTML = res.errors.map(e => `