
<?php $__env->startSection('title'); ?> পরীক্ষা | TESTPAPER <?php $__env->stopSection(); ?>
<?php $__env->startSection('exam.create'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('styles'); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('main_content_section'); ?>

<!-- BEGIN: Content-->
<div class="main-content overflow-x-hidden">

    <div class="row py-3 ps-2">
        <div class="heading d-flex justify-content-start heading-margin-bottom-minus">
            <h3 class="mb-0 pb-0"><span>নতুন পরীক্ষা</span><span> <a class="heading-font"
                        href="<?php echo e(route('admin.dashboard')); ?>"> । এডমিন</a></span></h3>
        </div>
    </div>

    <div class="card">

        <div class="card-body">
            <form action="<?php echo e(route('exam.store')); ?>" method="post" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">



                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <div class="form-group custom-select2-form">
                                <label for="name">শ্রেণির নাম <span class=" text-danger">(required)</span> </label>
                                <select id="classname_id" name="classname_id" value="<?php echo e(old('classname_id')); ?>"
                                    class="form-select select2" onchange="classWiseDeptForCreate()" required>
                                    <option value="" selected disabled> শ্রেণি সিলেক্ট করুন </option>
                                    <?php $__currentLoopData = $classes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $class): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($class->id); ?>"><?php echo e($class->class_name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <?php $__errorArgs = ['classname_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <div class="form-group custom-select2-form">
                                <label for="department_id">বিভাগের নাম <span class=" text-danger">(required)</span>
                                </label>
                                <select id="department_id" name="department_id" class="form-select select2"
                                    onchange="deptWiseSubForCreate()" required>
                                    <option value="" selected disabled> বিভাগ সিলেক্ট করুন </option>

                                </select>
                            </div>
                            <?php $__errorArgs = ['department_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <div class="form-group custom-select2-form">
                                <label for="subject_id">বিষয়ের নাম <span class=" text-danger">(required)</span> </label>
                                <select id="subject_id" name="subject_id" class="form-select select2" 
                                    onchange="subWiseChapForCreate()" required>
                                    <option value="" selected disabled> বিষয় সিলেক্ট করুন </option>

                                </select>
                            </div>
                            <?php $__errorArgs = ['subject_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <div class="form-group custom-select2-form">
                                <label for="chapter_id">অধ্যায়ের নাম <span class=" text-danger">(required)</span>
                                </label>
                                <select id="chapter_id" name="chapter_id" class="form-select select2" required>
                                    <option value="" selected disabled> অধ্যায় সিলেক্ট করুন </option>

                                </select>
                            </div>
                            <?php $__errorArgs = ['chapter_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-12 mb-3">
                            <div class="form-group">
                                <label for="name">পরীক্ষার নাম <span class=" text-danger">(required)</span> </label>
                                <input type="text" name="exam_name" required class="form-control"
                                    placeholder="পরিক্ষার নাম" required>
                            </div>

                            <?php $__errorArgs = ['exam_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <div class="form-group">
                                <label for="name">প্রশ্নের সংখ্যা <span class=" text-danger">(required)</span>
                                </label>
                                <input type="number" name="question_qty" required class="form-control"
                                    placeholder="প্রশ্নের সংখ্যা" required>
                            </div>

                            <?php $__errorArgs = ['question_qty'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <div class="form-group">
                                <label for="name">পরীক্ষার সময়কাল <span class=" text-danger">(required)</span>
                                </label>
                                <input type="number" name="exam_duration" required class="form-control"
                                    placeholder="পরীক্ষার সময়কাল" required>
                            </div>

                            <?php $__errorArgs = ['exam_duration'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <div class="form-group">
                                <label for="total_mark">টোটাল নাম্বার <span class=" text-danger">(required)</span>
                                </label>
                                <input type="number" name="total_mark" required id="total_mark" class="form-control"
                                    placeholder="টোটাল নাম্বার" required>
                            </div>

                            <?php $__errorArgs = ['total_mark'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <div class="form-group">
                                <label for="pass_mark">পাস নাম্বার <span class=" text-danger">(required)</span> </label>
                                <input type="number" name="pass_mark" required id="pass_mark" class="form-control"
                                    placeholder="পাস নাম্বার" required>
                            </div>

                            <?php $__errorArgs = ['pass_mark'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <label class="form-label" for="start_date">শুরু তারিখ <span
                                    class=" text-danger">(required)</span> </label>
                            <input type="text" class="form-control flatpickr-disabled-range custom-date-picker" required
                                name="start_date" id="start_date" placeholder="DD-MM-YYYY" required />

                            <?php $__errorArgs = ['start_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <label class="form-label" for="end_date">শেষ তারিখ <span
                                    class=" text-danger">(required)</span> </label>
                            <input type="text" class="form-control flatpickr-disabled-range custom-date-picker" required
                                name="end_date" id="end_date" placeholder="DD-MM-YYYY" required />

                            <?php $__errorArgs = ['end_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="col-md-6 mb-3">
                            <label for="start_time">শুরুর সময় <span class=" text-danger">(required)</span></label>
                            <input type="text" id="start_time" name="start_time"
                                class="form-control flatpickr-time text-left flatpickr-input custom-time-picker"
                                placeholder="HH:MM" readonly="readonly" required>
                        </div>

                        <div class="col-md-6 mb-3">
                            <label for="end_time">শেষ সময় <span class=" text-danger">(required)</span></label>
                            <input type="text" id="end_time" name="end_time"
                                class="form-control flatpickr-time text-left flatpickr-input custom-time-picker"
                                placeholder="HH:MM" readonly="readonly" required>
                        </div>


                        <div class="col-12 col-sm-12 col-md-2 col-lg-2 col-xl-2 d-flex align-items-center">
                            <button type="submit" class="btn btn btn-success m-0 py-2 text-right">সংরক্ষন</button>
                        </div>

                    </div>

                </div>
            </form>
        </div>

    </div>

</div>
<!-- END: Content-->

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

<?php $__env->startSection('scripts'); ?>
<script>
    $(document).ready(function(){
        $("#classname_id").select2();
        $("#department_id").select2();
        $("#subject_id").select2();
        $("#chapter_id").select2();
    });

    //For date & time section...
    $("#start_date, #end_date").flatpickr({
        allowInput: true,
		dateFormat: "d-m-Y",
	});

	$("#start_time, #end_time").flatpickr({
		enableTime: true,
		noCalendar: true,
		allowInput: true
	});

    
  //Toget class wise depertment...
  function classWiseDeptForCreate(){
	var classname_id = $("#classname_id").val();
	if(classname_id){
		$.ajax({
			url: "<?php echo e(url('/get_department/')); ?>/" + classname_id,
			type:"GET",
			dataType:"json",
			success:function(data){
				$("#department_id").empty();
				$("#department_id").append('<option value="" selected disabled>বিভাগ সিলেক্ট করুন</option>');
				$.each(data,function(key,value){
					$("#department_id").append('<option value="'+value.id+'">'+value.department_name+'</option>');
				});
			},
		});
	}  
};

//To get depertment wise subject...
function deptWiseSubForCreate(){
  var department_id = $("#department_id").val();
  if(department_id){
    $.ajax({
    url: "<?php echo e(url('/get_subject/')); ?>/" + department_id,
    type:"GET",
    dataType:"json",
    success:function(data){
        $("#subject_id").empty();
        $("#subject_id").append('<option value="" selected disabled>বিষয় সিলেক্ট করুন</option>');
        $.each(data,function(key,value){
            
            $("#subject_id").append('<option value="'+value.id+'">'+value.subject_name+'</option>');
        });
      },
    });
  }  
};

    //To get Chapter, Subject wise.
    function subWiseChapForCreate(){
      var subject_id = $("#subject_id").val();
      if(subject_id){
        $.ajax({
        url: "<?php echo e(url('/get_chapter/')); ?>/" + subject_id,
        type:"GET",
        dataType:"json",
        success:function(data){
            $("#chapter_id").empty();
            $("#chapter_id").append('<option value="" selected disabled>অধ্যায় সিলেক্ট করুন</option>');
            $.each(data,function(key,value){                
                $("#chapter_id").append('<option value="'+value.id+'">'+value.chapter_name+'</option>');
            });
          },
        });
      }  
    };
	
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\Project\Personal-Project\Office-Project\update\test-paper-final\resources\views/admin/exam/create.blade.php ENDPATH**/ ?>