<?php $__env->startSection('title', 'Buat Undangan P5'); ?>

<?php $__env->startSection('content'); ?>
<div class="card">
    <div class="card-header"><h3 class="card-title">Form Undangan Ujian (P5)</h3></div>
    <div class="card-body">
        <form action="<?php echo e(route('p5.undangan_ujian.store')); ?>" method="POST">
            <?php echo csrf_field(); ?>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">No. Surat</label>
                <div class="col-sm-10"><input type="text" name="nosrt" class="form-control" value="<?php echo e($nosrt); ?>" required></div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">Mahasiswa</label>
                <div class="col-sm-10">
                    <select name="nim" class="form-control" required>
                        <?php $__currentLoopData = $mahasiswa; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($m->nim); ?>"><?php echo e($m->nim); ?> - <?php echo e($m->nama); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">Judul Skripsi</label>
                <div class="col-sm-10"><textarea name="judul_skripsi" class="form-control" required></textarea></div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">Tanggal Ujian</label>
                <div class="col-sm-10"><input type="date" name="tanggal_ujian" class="form-control" required></div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">Jam</label>
                <div class="col-sm-10"><input type="time" name="jam" class="form-control" required></div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label">Tempat</label>
                <div class="col-sm-10"><input type="text" name="tempat" class="form-control" value="Fakultas Hukum" required></div>
            </div>
            <button type="submit" class="btn btn-primary">Simpan & Cetak</button>
            <a href="<?php echo e(route('p5.undangan_ujian.index')); ?>" class="btn btn-secondary">Batal</a>
        </form>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
<script>
    $(document).ready(function() {
        var nimSelect = $('select[name="nim_mahasiswa"], select[name="nim"]');
        var judulTextarea = $('textarea[name="judul_skripsi"], textarea[name="judul"]');
        
        nimSelect.on('change', function() {
            var nim = $(this).val();
            if (nim) {
                $.ajax({
                    url: '/mahasiswa/detail/' + nim,
                    type: 'GET',
                    dataType: 'json',
                    success: function(data) {
                        if (data && data.judul_skripsi) {
                            judulTextarea.val(data.judul_skripsi);
                        } else {
                            judulTextarea.val('');
                        }
                    }
                });
            } else {
                judulTextarea.val('');
            }
        });
    });
</script>
<?php $__env->stopPush(); ?>


<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /opt/lampp/htdocs/skripsifh/resources/views/p5/undangan_ujian/create.blade.php ENDPATH**/ ?>