IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/bf87b000728b9222b0d21fe5a16fa488fff302c1.php

<?php $__env->startSection('content'); ?>
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong><?php if(isset($template)): ?>  <?php if(!isset($show)): ?> Edit <?php else: ?> Show <?php endif; ?> <?php else: ?>  Add <?php endif; ?> Exam  </strong>Master</h2>
            </div>
            <div class="body">
                <?php if(isset($template)): ?>
                <?php echo Form::model( $template, ['route' => ['master.update', $template->idMcq], 'method' => 'put','class'=>'form-horizontal','id'=>'form'] ); ?>

                <h6> Exam Details</h6>
                <hr>
                <div class="table-responsive">
                <table class="table table-bordered"  style="margin-bottom: 30px;">
                    <thead>
                        <tr>
                            <th>Exam Name</th>
                            <th>Class</th>
                            <th>Section</th>
                            <th>Subject</th>
                            <th>Start Time</th>
                            <th>Duration</th>
                            <th>Total Marks</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td><?php echo e($template->examName); ?></td>
                            <td><?php echo e($template->classM->className); ?></td>
                            <td><?php if(isset($template->section->sectionName)): ?><?php echo e($template->section->sectionName); ?><?php else: ?> All Section <?php endif; ?></td>
                            <td><?php echo e($template->subjectName); ?></td>
                            <td><?php echo e($template->examDate); ?></td>
                            <td><?php echo e($template->examTime); ?></td>
                            <td><?php echo e($template->totalMarks); ?></td>
                        </tr>     
                    </tbody>
                </table>
                </div>
                <?php else: ?>
                <?php echo Form::open(['url' => 'school/exam/master','class'=>'form-horizontal','id'=>'form']); ?>

                <?php endif; ?>
                <?php if(!isset($show)): ?>
                <h6> Enter Form Details</h6>
                <hr>
                    <div class="row clearfix" style="margin-top:  30px;">
                        <label class="col-sm-2 col-form-label">Class </label>
                        <div class="col-sm-4">
                            <div class="form-group">
                                    <?php echo Form::select('idClass',$classes,null,['class' => 'form-control select2 show-tick ms','required'=>'required']); ?>

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

                    <div class="row clearfix">    
                        <label class="col-sm-2 col-form-label">Section </label>
                        <div class="col-sm-4">
                            <div class="form-group">
                                <?php if(isset($template)): ?>
                                    <?php echo Form::select('idSection',$section,null,['class' => 'form-control select2 show-tick ms','id'=>'idSection']); ?>

                                 <?php else: ?>
                                    <?php echo Form::select('idSection',$section,null,['class' => 'form-control select2 show-tick ms','required'=>'required','id'=>'idSection']); ?>

                                    <?php endif; ?>
                            </div>
                        </div>
                        </div>
                       <div class="row clearfix">
                        <label class="col-sm-2 col-form-label">Subject </label>
                        <div class="col-sm-4">
                            <div class="form-group">
                                    <?php if(isset($template)): ?>
                                    <?php echo Form::select('idSubject',$subject,null,['class' => 'form-control select2 show-tick ms','id'=>'idSubject']); ?>

                                    <?php else: ?>
                                    <?php echo Form::select('idSubject',$subject,null,['class' => 'form-control select2 show-tick ms','required'=>'required','id'=>'idSubject']); ?>

                                    <?php endif; ?>
                             </div>
                        </div>
                     </div>

                      <div class="row clearfix">
                        <label class="col-sm-2 col-form-label">Exam Name </label>
                        <div class="col-sm-4">
                            <div class="form-group">
                                <?php if(isset($template)): ?>
                                    <?php echo Form::text('examName',$template->examName,['class' => 'form-control','required'=>'required','placeholder'=>'Exam Name']); ?>

                                <?php else: ?> 
                                   <?php echo Form::text('examName',null,['class' => 'form-control','required'=>'required','placeholder'=>'Exam Name']); ?>   
                                <?php endif; ?>    
                            </div>
                        </div>
                      </div>

                      <div class="row clearfix">

                        <label class="col-sm-2 col-form-label">Exam Date </label>
                        <div class="col-sm-4">
                            <div class="form-group">
                                     <div class="input-group date" id="datetimepicker1" data-target-input="nearest">
                                     <?php if(isset($template)): ?>
                                    <?php echo Form::text('examDate',null,['class' => 'form-control  datetimepicker-input','placeholder'=>$template->examDate,'data-target'=> '#datetimepicker1']); ?>

                                    <?php else: ?>
                                    <?php echo Form::text('examDate',null,['class' => 'form-control  datetimepicker-input','required'=>'required','placeholder'=>'Select Date and Time','data-target'=> '#datetimepicker1']); ?>

                                    <?php endif; ?>
                                    <div class="input-group-append" data-target="#datetimepicker1" data-toggle="datetimepicker">
                                    <div class="input-group-text"><i class="zmdi zmdi-calendar-check"></i></div>
                                    </div>
                                    </div>
                            </div>
                        </div>
                      </div>
                      <div class="row clearfix">
                        <label class="col-sm-2 col-form-label">Duration </label>
                        <div class="col-sm-4">
                            <div class="form-group">
                                    <div class="input-group date" id="datetimepicker3" data-target-input="nearest">
                                      <?php if(isset($template)): ?>  
                                      <?php echo Form::text('totalTime',null,['class' => 'form-control datetimepicker-input','placeholder'=> $template->examTime,'data-target'=>"#datetimepicker3", 'value'=>'00:00']); ?>

                                      <?php else: ?>
                                      <?php echo Form::text('totalTime',null,['class' => 'form-control datetimepicker-input','required'=>'required','placeholder'=>'Total Time','data-target'=>"#datetimepicker3", 'value'=>'00:00']); ?>

                                     <?php endif; ?>
                                    <div class="input-group-append" data-target="#datetimepicker3" data-toggle="datetimepicker">
                                    <div class="input-group-text"><i class="zmdi zmdi-time"></i></div>
                                    </div>        
                                    </div>
                            </div>
                        </div>

                      </div>

                       <div class="row clearfix">
                        <label class="col-sm-2 col-form-label">Total Marks </label>
                        <div class="col-sm-4">
                            <div class="form-group">
                                    <?php echo Form::text('totalMarks',null,['class' => 'form-control','required'=>'required','placeholder'=>'Total Marks']); ?>

                            </div>
                        </div>
                      </div>
 				  <?php endif; ?>
                  <?php if(isset($show)): ?>
                  <div class="row clearfix">
                    <label class="col-sm-2 col-form-label">Question Template </label>
                        <div class="table-responsive col-sm-10">
                        <table class="table table-bordered">
                          <thead>
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">Question Type</th>
                              <th scope="col">Number of Questions</th>
                              <th scope="col">Marks</th>
                            </tr>
                          </thead>
                          <tbody id="total_question">
                            <?php $k= 1;?>
                            <?php $__currentLoopData = $paper; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                              <th scope="row"><?php echo e($k); ?></th>
                              <td><?php echo e($questions["$value->typeName"]); ?></td>
                              <td><?php echo e($value->questions); ?></td>
                              <td><?php echo e($value->marks); ?></td>
                            </tr>
                            <?php $k++;?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                          </tbody>
                        </table>
                      </div>
                    </div>
                  <?php else: ?>
                  <?php if(isset($template)): ?>
                   <div class="row clearfix">
                    <label class="col-sm-2 col-form-label">Question Template </label>
                        <div class="table-responsive col-sm-10">
                        <table class="table table-bordered">
                          <thead>
                          	
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">Question Type</th>
                              <th scope="col">Number of Questions</th>
                              <th scope="col">Marks</th>
                            </tr>
                         
                          </thead>
                          <tbody id="total_question">
                          	 <?php $k= 1;?>
                            <?php $__currentLoopData = $paper; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                              <th scope="row"><span class="questionno"><?php echo e($k); ?></span></th>
                               <td style="min-width: 250px;"> <?php echo Form::select('questions['.$k.'][type]',$questions,$value->typeName,['class' => 'form-control']); ?>

                              </td>
                              <td><?php echo Form::text('questions['.$k.'][total]',$value->questions,['class' => 'form-control','placeholder'=>'No. of Question']); ?></td>
                              <td style="min-width: 100px;"><?php echo Form::text('questions['.$k.'][marks]',$value->marks,['class' => 'form-control','placeholder'=>'Marks']); ?></td>
                              <td style="text-align:right;vertical-align: middle;"><input type="button" class="btn btn-sm btn-danger" value="Delete" id="remove_row"></td>
                            </tr>
                             <?php $k++;?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                          </tbody>
                          <tr>
                            <td colspan="13" style="text-align: right"><input type="button" class="add-row-question btn btn-sm btn-success" value="Add Row"></td>
                        </tr>
                        </table>
                      </div>
                    </div>
                  <?php else: ?>
                   <div class="row clearfix">
                    <label class="col-sm-2 col-form-label">Question Template </label>
                        <div class="table-responsive col-sm-10">
                        <table class="table table-bordered">
                          <thead>
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">Question Type</th>
                              <th scope="col">Number of Questions</th>
                              <th scope="col">Marks</th>
                            </tr>
                          </thead>
                          <tbody id="total_question">
                            <tr>
                              <th scope="row"><span class="questionno">1</span></th>
                               <td style="min-width: 250px;"> <?php echo Form::select('questions[1][type]',$questions,null,['class' => 'form-control']); ?>

                              </td>
                              <td><?php echo Form::text('questions[1][total]',null,['class' => 'form-control','placeholder'=>'No. of Question']); ?></td>
                              <td  style="min-width: 100px;"><?php echo Form::text('questions[1][marks]',null,['class' => 'form-control','placeholder'=>'Marks']); ?></td>
                              <td></td>
                            </tr>
                          </tbody>
                          <tr>
                            <td colspan="13" style="text-align: right"><input type="button" class="add-row-question btn btn-sm btn-success" value="Add Row"></td>
                        </tr>
                        </table>
                      </div>
                    </div>
                    <?php endif; ?>
                    <?php endif; ?>

                    <div class="row clearfix">
                    <div class="col-sm-6 offset-sm-2">
                      <?php if(isset($template)): ?>
                      <?php if(!isset($show)): ?>
                      <?php echo Form::submit('UPDATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect','id'=>'update-btn']); ?>

                      <?php endif; ?>
                      <?php else: ?>
                      <?php echo Form::submit('SAVE NOW',['class' => 'btn btn-raised btn-primary btn-round waves-effect','id'=>'submit-btn']); ?>

                      <?php endif; ?>
                      <?php echo Form::close(); ?> 
                    </div>
                    <div class="col-sm-12">
                     <label id="markserror" class="error col-sm-12" for="minmaxlength">
                    </label>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>List Of Exam  MCQs </strong></h2>
            </div>
            <div class="body table-responsive">
                <table class="table table-bordered table-striped table-hover js-basic-example dataTable" id ="templates">
                    <thead>
                        <tr>
                            <th>Exam Name</th>
                            <th>Class</th>
                            <th>Section</th>
                            <th>Subject</th>
                            <th>Start Time</th>
                            <th>Total Marks</th>
                            <th>Action</th>
                            <th>Question Status</th>
                        </tr>
                    </thead>
                    <tbody>
                        <!--<?php $__currentLoopData = $exams; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e($value->examName); ?></td>
                            <td><?php echo e($value->classM->className); ?></td>
                            <td><?php if(isset($value->section->sectionName)): ?><?php echo e($value->section->sectionName); ?><?php else: ?> All Section <?php endif; ?></td>
                            <td><?php echo e($value->subjectName); ?></td>
                            <td><?php echo e($value->examDate); ?></td>
                            <td><?php echo e($value->totalMarks); ?></td>
                            <td>
                              
                                <a href="<?php echo e(url('school/exam/master/' . $value->idMcq)); ?>"  class="btn btn-raised btn-primary waves-effect btn-round">View</a>
                                <a href="<?php echo e(url('school/exam/master/' . $value->idMcq.'/edit')); ?>"  class="btn btn-raised btn-info waves-effect btn-round">Edit</a>
                                <button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($value->idMcq); ?>" data-type="confirm">DELETE</button>
                            </td>
                            <td>
                            	<?php 
                            		$questions = DB::table('exam_ques_types')->where('idExam',$value->idMcq)->sum('questions');
                            		$total =  \App\ExamQuestions::where('idMcq', $value->idMcq)->count();
                            	?>

                            	<?php if($questions == $total): ?>
                                <a href="#"  class="btn btn-primary waves-effect btn-round">Done</a>
                            	<?php else: ?>
 									<a href="<?php echo e(url('school/exam/addquestions/' . $value->idMcq)); ?>"  class="btn btn-danger waves-effect btn-round">Pending</a>
                            	<?php endif; ?>

                            </td>
                        </tr>    
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>-->
                    </tbody>
                </table>
                <!--<?php echo e($exams->links()); ?>-->
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).ready(function() {
	//$('.dataTables_paginate').css('display','none');
    if ( $.fn.dataTable.isDataTable( '#templates' ) ) {
    table = $('#templates').DataTable();
    table.destroy();
    table = $('#templates').DataTable( {
        "processing": true,
        "serverSide": true,
        "ajax": "<?php echo e(url('school/exam/master')); ?>"
    });
  }
    var classID = 'All';
    $('select[name="idClass"]').on('change', function() {
        classID = $(this).val();
        if(classID!='All') {
            $.ajax({
                url: "<?php echo e(url('/school/class')); ?>"+'/' +classID + "/sections",
                type: "GET",
                dataType: "json",
                success:function(data) {
                    $('#idSection').empty();
                    $('#idSection').append('<option value="" selected="selected">-- Select Section --</option>');
                    $('#idSection').append('<option value="all" selected="selected">-- All Section --</option>');
                    $.each(data, function(key, value) {
                       $('#idSection').append('<option value="'+key+'">'+value+'</option>');
                        
                    });
                }
            });
            
            $.ajax({
                url: "<?php echo e(url('/school/class')); ?>"+'/' +classID + "/subjects",
                type: "GET",
                dataType: "json",
                success:function(data) {
                    $('#idSubject').empty();
                    $('#idSubject').append('<option value="" selected="selected">-- Select Section --</option>');
                    $.each(data, function(key, value) {
                       $('#idSubject').append('<option value="'+key+'">'+value+'</option>');
                        
                    });
                }
            });
        }else{
            $('select[name="idSection"]').empty();
        }
    });
    $.fn.datetimepicker.Constructor.Default = $.extend({}, $.fn.datetimepicker.Constructor.Default, {
            icons: {
                time: 'zmdi zmdi-time',
                date: 'zmdi zmdi-calendar-alt',
                up: 'zmdi zmdi-long-arrow-up',
                down: 'zmdi zmdi-long-arrow-down',
                previous: 'zmdi zmdi-chevron-left',
                next: 'zmdi zmdi-chevron-right',
                today: 'zmdi zmdi-calendar-check',
                clear: 'zmdi zmdi-delete',
                close: 'zmdi zmdi-close'
            } });
    $('#datetimepicker1').datetimepicker();
     
    $('#datetimepicker3').datetimepicker({
                    defaultDate:moment(new Date()).hours(0).minutes(0).seconds(0).milliseconds(0)   ,
                    format: 'HH:mm'
                });

    $( "#size_custom" ).change(function() {
        var id = $(this).data('id');
        if( $(this).val() == 'custom') 
        {
            $("#custom_"+id).show();
            $("#custom_"+id).css('display','inline-flex')
        }
        else $("#custom_"+id).hide();
    });
    

    //Add Input field if others is selecyted
    var k = $('.questionno:last').text();
    $(".add-row-question").click(function(){
        k++;  
         var markup = '<tr><td><span class="questionno">'+k+'</span></td>\
                <td><select class="form-control" required="required" name="questions['+k+'][type]" tabindex="-1" title=""><option value="">-- Select Questions --</option><option value="mcq">MCQ Questions</option><option value="images_questions">Image to Questions</option><option value="question_image">Questions to Images</option><option value="image_image">Image to Image</option><option value="math_type">Math Type</option><option value="short">Short Question</option><option value="long">Long Question</option><option value="image_long">Image for Long Question</option><option value="paragraph_mcq">Paragraph MCQ</option><option value="paragraph_short">Paragraph Short Question</option></select></td>\n\
                <td><input class="form-control" type="text" name="questions['+k+'][total]" required="required"  placeholder = "No. of Question"></td>\n\
                <td><input class="form-control" type="text" name="questions['+k+'][marks]" required="required"  placeholder = "Marks"></td>\n\
                <td style="text-align:right;vertical-align: middle;"><input type="button" class="btn btn-sm btn-danger" value="Delete" id="remove_row"></td></tr>';
                
            $("#total_question").append(markup);
           
    });
    
    $('#total_question').on('click', 'input[type="button"]', function () {
        $(this).closest('tr').remove();
        k = $('.longno:last').text();
         
    });
});

$(document).on('click', '.js-sweetalert', function (e) {
    $.ajaxSetup({
        headers: {
          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    e.preventDefault();
    var idPaper = $(this).data('id');
    swal({
            title: "Are you sure?",
            text: "Are You sure you want to delete this exam as it will delete all the questions and result assosiated with it!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: true
        },
        function() {
         //   console.log('here');
            $.ajax({
                type: "DELETE",
                url: "<?php echo e(url('/school/exam/master/')); ?>"+"/"+idPaper
            })
            .done(function(data) {
                swal({
                    title: "Deleted", 
                    text: "Exam has been successfully deleted", 
                    type: "success"
                },function() {
                    location.reload();
                });
            })
            .fail(function(data) {
              swal("Oops", "We couldn't connect to the server!", "error");
            });
            return false;
    });
});

<?php if(isset($template)): ?>
// Saving form data
$('#form').on('submit',function(e){
    $.ajaxSetup({
    header:$('meta[name="_token"]').attr('content')
});
 var formData =  new FormData($('#form')[0]);
 $("#update-btn").prop('disabled', true);
    $.ajax({
        type:"POST",
        url: "<?php echo e(url('school/exam/master/'.$template->idMcq)); ?>",
        processData: false,
        contentType: false,
        data:formData,
        dataType: 'json',
        success:function(data){
            if( data[Object.keys(data)[0]] === 'SUCCESS' ){
                $("#update-btn").prop('disabled', true);
                window.location = "<?php echo e(url('school/exam/master')); ?>";
            }
            else {                  //False Case: With error msg
                $("#markserror").html(data);   //$msg is the id of empty msg
                $("#update-btn").prop('disabled', false);
            }
        },

        error: function(data){
           $("#update-btn").prop('disabled', false);
           if( data.status === 422 ) {
                    var errors = data.responseJSON.errors;
                     $('#markserror').html('<div class="alert alert-danger">'+errors+'</div>');
                }
            }
    });
    return false;
});
<?php else: ?>
// Saving form data
$('#form').on('submit',function(e){
    $.ajaxSetup({
    header:$('meta[name="_token"]').attr('content')
});
 var formData =  new FormData($('#form')[0]);
 $("#submit-btn").prop('disabled', true);
    $.ajax({
        type:"POST",
        url: "<?php echo e(url('school/exam/master')); ?>",
        processData: false,
        contentType: false,
        data:formData,
        dataType: 'json',
        success:function(data){
            if( data[Object.keys(data)[0]] === 'SUCCESS' ){
                $("#submit-btn").prop('disabled', true);
                window.location = "<?php echo e(url('school/exam/master')); ?>";
            }
            else {                  //False Case: With error msg
                $("#markserror").html(data);   //$msg is the id of empty msg
                $("#submit-btn").prop('disabled', false);
            }
        },

        error: function(data){
           $("#submit-btn").prop('disabled', false);
           if( data.status === 422 ) {
                    var errors = data.responseJSON.errors;
                     $('#markserror').html('<div class="alert alert-danger">'+errors+'</div>');
                }
            }
    });
    return false;
});
<?php endif; ?>

</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

Copyright © 2021 - 2025 IMMREX7