<?php $__env->startSection('title', 'Proses Clustering Baru'); ?>

<?php $__env->startSection('content'); ?>
    <div class="flex justify-between items-center mb-6">
        <h1 class="text-2xl font-bold text-gray-800">Proses Clustering Baru</h1>
        <a href="<?php echo e(route('admin.clustering.index')); ?>" class="px-4 py-2 bg-gray-600 text-white rounded-md hover:bg-gray-700">
            <i class="fas fa-arrow-left mr-2"></i> Kembali
        </a>
    </div>

    <div class="bg-white rounded-lg shadow-sm p-6">
        <form action="<?php echo e(route('admin.clustering.store')); ?>" method="POST">
            <?php echo csrf_field(); ?>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div class="mb-4">
                    <label for="nama_proses" class="block text-sm font-medium text-gray-700 mb-1">Nama Proses <span class="text-red-600">*</span></label>
                    <input type="text" name="nama_proses" id="nama_proses" class="w-full border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200" value="<?php echo e(old('nama_proses')); ?>" required>
                    <?php $__errorArgs = ['nama_proses'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div class="mb-4">
                    <label for="jumlah_cluster" class="block text-sm font-medium text-gray-700 mb-1">Jumlah Cluster <span class="text-red-600">*</span></label>
                    <input type="number" name="jumlah_cluster" id="jumlah_cluster" class="w-full border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200" value="<?php echo e(old('jumlah_cluster', 3)); ?>" min="2" max="10" required>
                    <p class="text-xs text-gray-500 mt-1">Jumlah cluster yang akan dibentuk (2-10)</p>
                    <?php $__errorArgs = ['jumlah_cluster'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div class="mb-4">
                    <label for="program_studi_id" class="block text-sm font-medium text-gray-700 mb-1">Program Studi</label>
                    <select name="program_studi_id" id="program_studi_id" class="w-full border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200">
                        <option value="">Semua Program Studi</option>
                        <?php $__currentLoopData = $programStudis; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $prodi): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($prodi->id); ?>" <?php echo e(old('program_studi_id') == $prodi->id ? 'selected' : ''); ?>><?php echo e($prodi->nama); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                    <p class="text-xs text-gray-500 mt-1">Kosongkan untuk memproses semua program studi</p>
                    <?php $__errorArgs = ['program_studi_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div class="grid grid-cols-2 gap-4">
                    <div class="mb-4">
                        <label for="tahun_lulus_awal" class="block text-sm font-medium text-gray-700 mb-1">Tahun Lulus Awal</label>
                        <input type="number" name="tahun_lulus_awal" id="tahun_lulus_awal" class="w-full border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200" value="<?php echo e(old('tahun_lulus_awal')); ?>" min="2000" max="<?php echo e(date('Y')); ?>">
                        <?php $__errorArgs = ['tahun_lulus_awal'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="mb-4">
                        <label for="tahun_lulus_akhir" class="block text-sm font-medium text-gray-700 mb-1">Tahun Lulus Akhir</label>
                        <input type="number" name="tahun_lulus_akhir" id="tahun_lulus_akhir" class="w-full border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200" value="<?php echo e(old('tahun_lulus_akhir')); ?>" min="2000" max="<?php echo e(date('Y')); ?>">
                        <?php $__errorArgs = ['tahun_lulus_akhir'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                </div>
            </div>

            <div class="mb-4 mt-4">
                <label for="deskripsi" class="block text-sm font-medium text-gray-700 mb-1">Deskripsi</label>
                <textarea name="deskripsi" id="deskripsi" rows="3" class="w-full border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200"><?php echo e(old('deskripsi')); ?></textarea>
                <?php $__errorArgs = ['deskripsi'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                    <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>

            <div class="mb-6">
                <label class="block text-sm font-medium text-gray-700 mb-2">Atribut yang Digunakan <span class="text-red-600">*</span></label>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                    <div class="flex items-start">
                        <div class="flex items-center h-5">
                            <input type="checkbox" name="atribut[]" id="atribut_gaji" value="gaji" class="rounded border-gray-300 text-blue-600 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200 focus:ring-opacity-50" <?php echo e(in_array('gaji', old('atribut', [])) ? 'checked' : ''); ?>>
                        </div>
                        <div class="ml-3 text-sm">
                            <label for="atribut_gaji" class="font-medium text-gray-700">Gaji</label>
                            <p class="text-gray-500">Gaji alumni pada pekerjaan saat ini</p>
                        </div>
                    </div>
                    <div class="flex items-start">
                        <div class="flex items-center h-5">
                            <input type="checkbox" name="atribut[]" id="atribut_bidang_pekerjaan" value="bidang_pekerjaan" class="rounded border-gray-300 text-blue-600 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200 focus:ring-opacity-50" <?php echo e(in_array('bidang_pekerjaan', old('atribut', [])) ? 'checked' : ''); ?>>
                        </div>
                        <div class="ml-3 text-sm">
                            <label for="atribut_bidang_pekerjaan" class="font-medium text-gray-700">Bidang Pekerjaan</label>
                            <p class="text-gray-500">Bidang pekerjaan alumni</p>
                        </div>
                    </div>
                    <div class="flex items-start">
                        <div class="flex items-center h-5">
                            <input type="checkbox" name="atribut[]" id="atribut_waktu_tunggu" value="waktu_tunggu" class="rounded border-gray-300 text-blue-600 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200 focus:ring-opacity-50" <?php echo e(in_array('waktu_tunggu', old('atribut', [])) ? 'checked' : ''); ?>>
                        </div>
                        <div class="ml-3 text-sm">
                            <label for="atribut_waktu_tunggu" class="font-medium text-gray-700">Waktu Tunggu</label>
                            <p class="text-gray-500">Waktu tunggu mendapatkan pekerjaan pertama</p>
                        </div>
                    </div>
                    <div class="flex items-start">
                        <div class="flex items-center h-5">
                            <input type="checkbox" name="atribut[]" id="atribut_jenjang_pendidikan" value="jenjang_pendidikan" class="rounded border-gray-300 text-blue-600 shadow-sm focus:border-blue-500 focus:ring focus:ring-blue-200 focus:ring-opacity-50" <?php echo e(in_array('jenjang_pendidikan', old('atribut', [])) ? 'checked' : ''); ?>>
                        </div>
                        <div class="ml-3 text-sm">
                            <label for="atribut_jenjang_pendidikan" class="font-medium text-gray-700">Jenjang Pendidikan</label>
                            <p class="text-gray-500">Jenjang pendidikan lanjut alumni</p>
                        </div>
                    </div>
                </div>
                <?php $__errorArgs = ['atribut'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                    <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                <?php $__errorArgs = ['atribut.*'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                    <p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p>
                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>

            <div class="bg-blue-50 p-4 rounded-lg mb-6">
                <div class="flex items-start">
                    <div class="flex-shrink-0">
                        <i class="fas fa-info-circle text-blue-500"></i>
                    </div>
                    <div class="ml-3">
                        <h3 class="text-sm font-medium text-blue-800">Informasi Algoritma</h3>
                        <div class="mt-2 text-sm text-blue-700">
                            <p>Algoritma Single Linkage Clustering adalah metode hierarchical clustering yang menggabungkan cluster berdasarkan jarak minimum antara anggota dari masing-masing cluster.</p>
                            <p class="mt-1">Pilih atribut yang relevan dan jumlah cluster yang sesuai untuk mendapatkan hasil yang optimal.</p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="flex justify-end">
                <button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700">
                    <i class="fas fa-cogs mr-2"></i> Proses Clustering
                </button>
            </div>
        </form>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        const atributCheckboxes = document.querySelectorAll('input[name="atribut[]"]');
        const submitButton = document.querySelector('button[type="submit"]');
        
        function validateForm() {
            let atLeastOneChecked = false;
            atributCheckboxes.forEach(checkbox => {
                if (checkbox.checked) {
                    atLeastOneChecked = true;
                }
            });
            
            if (!atLeastOneChecked) {
                submitButton.disabled = true;
                submitButton.classList.add('opacity-50', 'cursor-not-allowed');
            } else {
                submitButton.disabled = false;
                submitButton.classList.remove('opacity-50', 'cursor-not-allowed');
            }
        }
        
        atributCheckboxes.forEach(checkbox => {
            checkbox.addEventListener('change', validateForm);
        });
        
        validateForm();
    });
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\Source Code\STIAB Jinarakkhita Lampung\Tracer-Study\resources\views/admin/clustering/create.blade.php ENDPATH**/ ?>