IMMREX7
@extends('schools.school_layout')
@section('content')
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="header">
<h2><strong>Exam </strong> Questions</h2>
</div>
<div class="body">
{!! Form::open(['url' => 'school/exam/questions','class'=>'form-horizontal','id'=>'form']) !!}
@if(isset($template))
<h6 style="margin-left: 20px;"> Exam Details</h6>
<div class="table-responsive" style="margin: 20px;">
<table class="table table-bordered">
<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>{{$template->examName}}</td>
<td>{{$template->classM->className}}</td>
<td>@if(isset($template->section->sectionName)){{$template->section->sectionName}}@else All Section @endif</td>
<td>{{$template->subjectName}}</td>
<td>{{$template->examDate}}</td>
<td>{{$template->examTime}}</td>
<td>{{$template->totalMarks}}</td>
</tr>
</tbody>
</table>
</div>
<h6 style="margin-left: 20px;">Question Template</h6>
<div class="row clearfix" style="margin: 20px;">
<hr>
<div class="table-responsive">
<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;?>
@foreach($paper as $value)
<tr>
<th scope="row">{{$k}}</th>
<td>{{$questions["$value->typeName"]}}</td>
<td>{{$value->questions}}</td>
<td>{{$value->marks}}</td>
</tr>
<?php $k++;?>
@endforeach
</tbody>
</table>
</div>
</div>
@else
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="body table-responsive">
<table class="table table-bordered table-striped table-hover js-basic-example dataTable" id="examtable">
<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>
@foreach($exams as $value)
<tr>
<td>{{$value->examName}}</td>
<td>{{$value->classM->className}}</td>
<td>@if(isset($value->section->sectionName)){{$value->section->sectionName}}@else All Section @endif</td>
<td>{{$value->subjectName}}</td>
<td>{{$value->examDate}}</td>
<td>{{$value->totalMarks}}</td>
<td>
<a href="{{ url('school/exam/addquestions/' . $value->idMcq) }}" class="btn btn-raised btn-primary waves-effect btn-round">Add Question</a>
<a href="{{ url('school/exam/addquestions/' . $value->idMcq.'/show') }}" class="btn btn-raised btn-info waves-effect btn-round">View</a>
</td>
<td>
<?php
$questions = DB::table('exam_ques_types')->where('idExam',$value->idMcq)->sum('questions');
$total = \App\ExamQuestions::where('idMcq', $value->idMcq)->count();
?>
@if($questions == $total)
<a href="#" class="btn btn-primary waves-effect btn-round">Done</a>
@else
<a href="{{ url('school/exam/addquestions/' . $value->idMcq) }}" class="btn btn-danger waves-effect btn-round">Pending</a>
@endif
</td>
</tr>
@endforeach
</tbody>-->
</table>
</div>
</div>
</div>
</div>
@endif
@if(isset($show))
<?php $exampparagraph = \App\ExamParagraph::where('idMcq','=',$template->idMcq)->get();?>
@if(count($exampparagraph)>0)
@foreach($exampparagraph as $ep)
<div class="row clearfix">
<div class="col-sm-2">
Question Text
</div>
<div class="col-sm-10">
{{$ep->paraText}}
</div>
</div>
<?php $paramcq = DB::table('exam_mcq_questions')->where('idMcq',$template->idMcq)->where('idParagraph',$ep->idParagraph)->where('questionType','=','paragraph_mcq')->get();
$paramshort = DB::table('exam_mcq_questions')->where('idMcq',$template->idMcq)->where('idParagraph',$ep->idParagraph)->where('questionType','=','paragraph_short')->get();
$p = 1;
?>
@foreach($paramcq as $mques)
<div class="row clearfix">
<div class="col-sm-10 offset-sm-2">
<div class="header">
<h2 style="float: right;">( <strong>{{$mques->marks}} mark</strong> )</h2>
</div>
<p> Question : {{$mques->question}}</p>
@if($mques->questionType == "paragraph_mcq")
<p>A. {{$mques->answerA}}</p>
<p>B. {{$mques->answerB}}</p>
<p>C. {{$mques->answerC}}</p>
<p>D. {{$mques->answerD}}</p>
@endif
@if(isset($mques->answerCorrect) && $mques->answerCorrect != null)
<p>Correct Answer : {{$mques->answerCorrect}}</p>
@endif
</div>
</div>
@endforeach
@foreach($paramshort as $mques)
<div class="row clearfix">
<div class="col-sm-10 offset-sm-2">
<div class="header">
<h2 style="float: right;">( <strong>{{$mques->marks}} mark</strong> )</h2>
</div>
<p> Question : {{$mques->question}}</p>
</div>
</div>
@endforeach
@endforeach
@endif
@foreach($paper as $value)
<?php $mcq = DB::table('exam_mcq_questions')->where('idMcq',$template->idMcq)->where('questionType',$value->typeName)->get();
$p = 1;
?>
@foreach($mcq as $mques)
<div class="row clearfix">
<div class="col-sm-10 offset-sm-2">
<div class="header">
<h2 style="float: right;">( <strong>{{$mques->marks}} mark</strong> )</h2>
</div>
@if($mques->questionType == "math_type")
<p>Question : <math-field id="mv_{{$p}}">{{$mques->question}}</math-field></p>
@else
@if($mques->questionType != "image_image" && $mques->questionType != "images_questions" && $mques->questionType != "math_type")
<p> Question : {{$mques->question}}</p>
@else
<p>Question : </p>
<img src="{{ asset('storage/schools/'.$template->idSchool.'/mcq/'.$mques->question)}}" alt="questions" width="100px" style="margin: 20px;" />
@endif
@endif
@if($mques->questionType == "paragraph_mcq" || $mques->questionType == "mcq" || $mques->questionType == "images_questions" || $mques->questionType == "paragraph_mcq")
<p>A. {{$mques->answerA}}</p>
<p>B. {{$mques->answerB}}</p>
<p>C. {{$mques->answerC}}</p>
<p>D. {{$mques->answerD}}</p>
@else
@if($mques->questionType == "question_image" || $mques->questionType == "image_image" )
<div class="row clearfix">
<div class="col-sm-5">A. <img src="{{ asset('storage/schools/'.$template->idSchool.'/mcq/'.$mques->answerA)}}" alt="questions" width="100px"/></div>
<div class="col-sm-5">B. <img src="{{ asset('storage/schools/'.$template->idSchool.'/mcq/'.$mques->answerB)}}" alt="questions" width="100px"/></div>
<div class="col-sm-5">C. <img src="{{ asset('storage/schools/'.$template->idSchool.'/mcq/'.$mques->answerC)}}" alt="questions" width="100px"/></div>
<div class="col-sm-5">D. <img src="{{ asset('storage/schools/'.$template->idSchool.'/mcq/'.$mques->answerD)}}" alt="questions" width="100px"/></div>
</div>
@endif
@if($mques->questionType == "math_type")
<p><math-field id="mva_{{$p}}">A. {{$mques->answerA}}</math-field></p>
<p><math-field id="mvb_{{$p}}">B. {{$mques->answerB}}</math-field></p>
<p><math-field id="mvc_{{$p}}">C. {{$mques->answerC}}</math-field></p>
<p><math-field id="mvd_{{$p}}">D. {{$mques->answerD}}</math-field></p>
<?php $p++; ?>
@endif
@endif
@if(isset($mques->answerCorrect) && $mques->answerCorrect != null)
<p>Correct Answer : {{$mques->answerCorrect}}</p>
@endif
</div>
</div>
@endforeach
@endforeach
@else
@if(isset($template))
<?php
$i = 0;
$k = $qno;?>
@foreach($paper as $value)
@if($value->typeName == 'paragraph_mcq' || $value->typeName == 'paragraph_short')
@if($value->typeName == 'paragraph_short')
<div class="row clearfix" style="margin-top: 20px;">
<label class="col-sm-6 col-form-label">Same as Above ParaGraph (Check If Yes Otherwise Enter New Paragraph Text)</label>
<div class="col-sm-4 checkbox-inline">
<input type="checkbox" name='samepara' value="Y">
</div>
</div>
@endif
<div class="row clearfix" style="margin-top: 20px;">
<label class="col-sm-2 col-form-label">Paragraph MCQ Type Question</label>
<div class="col-sm-10">
{!! Form::textarea('mcq['.$k.'][paraText]',null,['class' => 'form-control','placeholder'=>'Enter Paragraph Text','rows' => 3]) !!}
</div>
</div>
@endif
<div class="row clearfix" style="margin-top: 20px;">
<input type="hidden" name="{{'mcq['.$k.'][id]'}}" value="{{$value->idType}}">
<label class="col-sm-2 col-form-label">Number {{$qno}} <br>{{$questions[$value->typeName]}} </label>
<div class="col-sm-10">
<div class="form-group">
@if($value->typeName == "images_questions" || $value->typeName == "image_image")
{!! Form::file('mcq['.$k.'][questions]',null,['class' => 'form-control']) !!}
@else
@if($value->typeName == "math_type")
<math-field id="mf_{{$i+1}}" style="border: 1px solid #ccc!important;">
</math-field>
<input type="hidden" id="mf_input_{{$i+1}}" name="{{'mcq['.$k.'][questions]'}}">
@else
@if($value->typeName == "paragraph_mcq" || $value->typeName == "paragraph_short")
{!! Form::textarea('mcq['.$k.'][questionsparamcq]',null,['class' => 'form-control','placeholder'=>$questions["$value->typeName"],'rows' => 2]) !!}
@else
{!! Form::textarea('mcq['.$k.'][questions]',null,['class' => 'form-control','placeholder'=>$questions["$value->typeName"],'rows' => 2]) !!}
@endif
@endif
@endif
</div>
</div>
</div>
@if($value->typeName == "paragraph_mcq" || $value->typeName == "mcq" || $value->typeName == "images_questions" || $value->typeName == "image_image"|| $value->typeName == "question_image" )
<div class="row clearfix offset-sm-2">
<div class="col-sm-6">
<div class="form-group"> A.
@if($value->typeName == "question_image" || $value->typeName == "image_image")
{!! Form::file('mcq['.$k.'][optionsA]',null,['class' => 'form-control']) !!}
@else
{!! Form::textarea('mcq['.$k.'][optionsA]',null,['class' => 'form-control','placeholder'=>'Option A : ','rows' => 2]) !!}
@endif
</div>
</div>
<div class="col-sm-6">
<div class="form-group"> B.
@if($value->typeName == "question_image" || $value->typeName == "image_image")
{!! Form::file('mcq['.$k.'][optionsB]',null,['class' => 'form-control']) !!}
@else
{!! Form::textarea('mcq['.$k.'][optionsB]',null,['class' => 'form-control','placeholder'=>'Option B : ','rows' => 2]) !!}
@endif
</div>
</div>
<div class="col-sm-6">
<div class="form-group"> C.
@if($value->typeName == "question_image" || $value->typeName == "image_image")
{!! Form::file('mcq['.$k.'][optionsC]',null,['class' => 'form-control']) !!}
@else
{!! Form::textarea('mcq['.$k.'][optionsC]',null,['class' => 'form-control','placeholder'=>'Option C : ','rows' => 2]) !!}
@endif
</div>
</div>
<div class="col-sm-6">
<div class="form-group"> D.
@if($value->typeName == "question_image" || $value->typeName == "image_image")
{!! Form::file('mcq['.$k.'][optionsD]',null,['class' => 'form-control']) !!}
@else
{!! Form::textarea('mcq['.$k.'][optionsD]',null,['class' => 'form-control','placeholder'=>'Option D : ','rows' => 2]) !!}
@endif
</div>
</div>
</div>
@else
@if($value->typeName == "math_type" )
<div class="row clearfix offset-sm-2">
<div class="col-sm-6">
<div class="form-group">
A.
<math-field id="mf_{{$i+1}}_a" style="border: 1px solid #ccc!important;">
</math-field>
{!! Form::hidden('mcq['.$k.'][optionsA]',null,['class' => 'form-control','placeholder'=>'Option A : ','id'=>'mf_ainput_'.($i+1) ]) !!}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
B.
<math-field id="mf_{{$i+1}}_b" style="border: 1px solid #ccc!important;">
</math-field>
{!! Form::hidden('mcq['.$k.'][optionsB]',null,['class' => 'form-control','placeholder'=>'Option B : ','id'=>'mf_binput_'.($i+1)]) !!}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
C.
<math-field id="mf_{{$i+1}}_c" style="border: 1px solid #ccc!important;">
</math-field>
{!! Form::hidden('mcq['.$k.'][optionsC]',null,['class' => 'form-control','placeholder'=>'Option C : ','id'=>'mf_cinput_'.($i+1)]) !!}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
D.
<math-field id="mf_{{$i+1}}_d" style="border: 1px solid #ccc!important;">
</math-field>
{!! Form::hidden('mcq['.$k.'][optionsD]',null,['class' => 'form-control','placeholder'=>'Option D : ','id'=>'mf_dinput_'.($i+1)]) !!}
</div>
</div>
</div>
@endif
@endif
@if($value->typeName == "paragraph_mcq" || $value->typeName == "mcq" || $value->typeName == "images_questions" || $value->typeName == "image_image"|| $value->typeName == "question_image"|| $value->typeName == "math_type" )
<div class="row clearfix">
<label class="col-sm-2 col-form-label">Correct Option </label>
<div class="col-sm-3">
<div class="form-group">
{!! Form::select('mcq['.$k.'][correct]',$options,null,['class' => 'form-control select2 show-tick ms']) !!}
</div>
</div>
</div>
@endif
<div class="row clearfix">
<label class="col-sm-2 col-form-label">Marks </label>
<div class="col-sm-3">
<div class="form-group">
{!! Form::text('mcq['.$k.'][marks]',$value->marks,['class' => 'form-control','readonly']) !!}
</div>
</div>
</div>
<hr>
@break
@endforeach
<div class="row clearfix">
<div class="col-sm-6 offset-sm-2">
@if(isset($template))
{!! Form::submit('Add Question',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
{!! Form::submit('Next Question',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
@endif
{!! Form::close() !!}
</div>
<div class="col-sm-12">
<label id="markserror" class="error col-sm-12" for="minmaxlength">
</label>
</div>
</div>
@endif
@endif
</div>
</div>
</div>
</div>
@stop
@section('script')
<script>
@if(!isset($template))
$( document ).ready(function() {
if ( $.fn.dataTable.isDataTable( '#examtable' ) ) {
table = $('#examtable').DataTable();
table.destroy();
table = $('#examtable').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "{{url('school/exam/question')}}"
});
}
});
@else
$('#form').on('submit',function(e){
$.ajaxSetup({
header:$('meta[name="_token"]').attr('content')
});
$('.page-loader-wrapper').css('display','block');
var formData = new FormData($('#form')[0]);
$("#submit-btn").prop('disabled', true);
$.ajax({
type:"POST",
url: "{{url('school/exam/questions') }}",
processData: false,
contentType: false,
data:formData,
timeout: 50000,
dataType: 'json',
success:function(data){
$('.page-loader-wrapper').css('display','none');
if( data[Object.keys(data)[0]] === 'SUCCESS' ){
$("#submit-btn").prop('disabled', true);
window.location.reload();
}
else { //False Case: With error msg
$("#markserror").html(data); //$msg is the id of empty msg
}
},
error: function(data){
$('.page-loader-wrapper').css('display','none');
if( data.status === 422 ) {
var errors = data.responseJSON.errors;
$('#markserror').html('<div class="alert alert-danger">'+errors+'</div>');
}
}
});
return false;
});
@endif
</script>
<script type="module">
//import {serialize } from 'https://unpkg.com/@cortex-js/compute-engine/dist/compute-engine.min.esm.js';
@if(isset($template))
@foreach($paper as $value)
@if($value->typeName == "math_type")
if (document.getElementById('mf_1'))
{
const mf = document.getElementById('mf_1');
mf.setOptions({
virtualKeyboardMode: "onfocus",
virtualKeyboards: 'numeric symbols'
});
mf.addEventListener('input',(ev) => {
$('#mf_input_1').val(mf.value);
});
}
if (document.getElementById('mf_1_a'))
{
const mf = document.getElementById('mf_1_a');
mf.setOptions({
virtualKeyboardMode: "onfocus",
virtualKeyboards: 'numeric symbols'
});
mf.addEventListener('input',(ev) => {
$('#mf_ainput_1').val(mf.value);
});
}
if (document.getElementById('mf_1_b'))
{
const mf = document.getElementById('mf_1_b');
mf.setOptions({
virtualKeyboardMode: "onfocus",
virtualKeyboards: 'numeric symbols'
});
mf.addEventListener('input',(ev) => {
$('#mf_binput_1').val(mf.value);
});
}
if (document.getElementById('mf_1_c'))
{
const mf = document.getElementById('mf_1_c');
mf.setOptions({
virtualKeyboardMode: "onfocus",
virtualKeyboards: 'numeric symbols'
});
mf.addEventListener('input',(ev) => {
$('#mf_cinput_1').val(mf.value);
});
}
if (document.getElementById('mf_1_d'))
{
const mf = document.getElementById('mf_1_d');
mf.setOptions({
virtualKeyboardMode: "onfocus",
virtualKeyboards: 'numeric symbols'
});
mf.addEventListener('input',(ev) => {
$('#mf_dinput_1').val(mf.value);
});
}
@endif
@endforeach
@endif
</script>
@stop
Copyright © 2021 -