<?php session_start(); 
if(isset($_SESSION)) { if(!isset($_SESSION['starttime'])) { 
$_SESSION['starttime'] = date('H:i:s');
}   } else {  $_SESSION['starttime'] = date('H:i:s'); } ?>
@extends('layouts.examlive')    
@section('content')

<div class="container">
            <div class="row">
            <div class="col-sm-12">
                    <div class="mobilesecitoninner" >                   
                        <div id="homepageseciton">    
                            <div class="megacontentbiscion"> 
                                <div class="examsectionshow"> 
                                    <div class="totalquestiondisplay">
                                         No. of Ques. : 50
                                    </div>
                                    <div class="timersectionshow">
                                        <div class="countdown"> Time: 25:00</div>
                                    </div>
                                    <div class="clearall"></div>
                                    <div id="userquestionsetsection" class="questiondetailshiw">
                                        <ul class="subjectseciton">
                                            <li> <a href="#answersection0"> G.K. </a> </li>
                                            <li> <a href="#answersection10"> Science </a> </li>
                                            <li> <a href="#answersection20"> Hindi </a> </li>
                                            <li> <a href="#answersection30"> English </a> </li>
                                            <li> <a href="#answersection40"> Mathematics </a> </li>
                                        </ul>
                                        <form action="{{ SITEURL }}savepaper" id="submitpapart" method="post">
                                        <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
                                            <!-- Indicators -->
                                            <ol class="carousel-indicators">
                                                <?php for($questionumber = 0; $questionumber < 50; $questionumber++ ) { ?>
                                            <li data-target="#myCarousel" id="answersection{{ $questionumber }}"  data-slide-to="{{ $questionumber }}" <?php if($questionumber == 0) {  ?>class="active answersection{{ $questionumber }}" <?php  }  ?>> {{ $questionumber+1 }}</li>
                                            <?php }   ?>
                                            </ol>

                                            <!-- Wrapper for slides -->
                                             <?php  // G.k. Questions
                                                $datetime_1 = date('Y-m-d').' '.$_SESSION['starttime']; 
                                                $datetime_2 = date('Y-m-d H:i:s');
                                                
                                                $start_datetime = new DateTime($datetime_1); 
                                                $diff = $start_datetime->diff(new DateTime($datetime_2));   

                                               //  echo $diff->i.' Minutes<br>'; 
                                                // echo $diff->s.' Seconds<br>';

                                                  $timetakendata =  '00:'.$diff->i.':'.$diff->s;

                                                // Creating DateTime objects
                                                $dateTimeObject1 = date_create('00:25:00'); 
                                                $dateTimeObject2 = date_create($timetakendata); 

                                                // Calculating the difference between DateTime objects
                                                $interval = date_diff($dateTimeObject1, $dateTimeObject2); 

                                                // Printing result in hours
                                          
                                                // echo $interval->h;
                                                /// echo "\n<br/>";
                                                $minutes = $interval->days * 24 * 60;
                                                $minutes += $interval->h * 60;
                                                $minutes += $interval->i;

                                                //Printing result in minutes
                                            
                                                 /// echo $minutes.' minutes'.$interval->s.' Seconds';

                                                  $remaingtime = $minutes.':'.$interval->s;
                                                

                                         
                                         
                                   
                                                    
                                                    /////// echo '<pre>'; print_r($compitetionassignment); echo '</pre>';

                                             $questionsgeneral  = array();  $questionhindi  = array();  $questionobjectfirst  = array(); $questionobjectsecond  = array();
                                              $questionobjectthird  = array();  $questionobjectfourth  = array();  $questionobjectfirsthindi  = array();  $questionobjectsecondhindi  = array();  $questionobjectthirdhindi  = array();  $questionobjectfourthhindi  = array();  $questionobjectanswer  = array();  
                                             
                                             ////////// Science Questions
                                             $questionsscience  = array(); $questionhindiscience  = array();$questionobjectfirstscience  = array();$questionobjectsecondscience  = array();$questionobjectthirdscience  = array();$questionobjectfourthscience  = array();$questionobjectfirsthindiscience  = array();$questionobjectsecondhindiscience  = array();$questionobjectthirdhindiscience  = array();$questionobjectfourthhindiscience  = array();$questionobjectanswerscience  = array(); 
                                             
                                              //////// Hindi                                             
                                             $questionshindi  = array();  $questionhindi_hindi  = array();  $questionobjectfirst_hindi  = array();  $questionobjectsecond_hindi  = array();  $questionobjectthird_hindi  = array();  $questionobjectfourth_hindi  = array();  $questionobjectanswer_hindi  = array();  
                                             
                                             ///////// English
                                             $questionsenglish  = array(); $questionobjectfirst_english  = array(); $questionobjectsecond_english  = array(); $questionobjectthird_english  = array(); $questionobjectfourth_english  = array(); $questionobjectanswer_english  = array();  
                                             
                                             /////// Mathematics
                                             $questionsmaths  = array();  $questionhindimaths  = array(); $questionobjectfirstmaths  = array(); $questionobjectsecondmaths  = array(); $questionobjectthirdmaths  = array(); $questionobjectfourthmaths  = array(); $questionobjectfirsthindimaths  = array(); $questionobjectsecondhindimaths  = array(); $questionobjectthirdhindimaths  = array(); $questionobjectfourthhindimaths  = array(); $questionobjectanswermaths  = array(); 

                                             ///////////// G.K. Section 
                                            if($questions_general) {  
                                                $questionsgeneral  = array_values(json_decode($questions_general->questionlist, true));
                                                $questionhindi  = array_values(json_decode($questions_general->questionhindi, true));
                                                
                                                ////////// Option for English
                                                $questionobjectfirst  = array_values(json_decode($questions_general->questionobjectfirst, true));
                                                $questionobjectsecond  = array_values(json_decode($questions_general->questionobjectsecond, true));
                                                $questionobjectthird  = array_values(json_decode($questions_general->questionobjectthird, true));
                                                $questionobjectfourth  = array_values(json_decode($questions_general->questionobjectfourth, true));

                                                 ////////// Option for Hindi
                                                 $questionobjectfirsthindi  = array_values(json_decode($questions_general->questionobjectfirsthindi, true));
                                                 $questionobjectsecondhindi  = array_values(json_decode($questions_general->questionobjectsecondhindi, true));
                                                 $questionobjectthirdhindi  = array_values(json_decode($questions_general->questionobjectthirdhindi, true));
                                                 $questionobjectfourthhindi  = array_values(json_decode($questions_general->questionobjectfourthhindi, true));
                                                 
                                                 $questionobjectanswer  = array_values(json_decode($questions_general->questionobjectanswer, true));
                                             }
                                            if($questions_science) {  
                                                $questionsscience  = array_values(json_decode($questions_science->questionlist, true));
                                                $questionhindiscience  = array_values(json_decode($questions_science->questionhindi, true));
                                                
                                                ////////// Option for English
                                                $questionobjectfirstscience  = array_values(json_decode($questions_science->questionobjectfirst, true));
                                                $questionobjectsecondscience  = array_values(json_decode($questions_science->questionobjectsecond, true));
                                                $questionobjectthirdscience  = array_values(json_decode($questions_science->questionobjectthird, true));
                                                $questionobjectfourthscience  = array_values(json_decode($questions_science->questionobjectfourth, true));

                                                 ////////// Option for Hindi
                                                 $questionobjectfirsthindiscience  = array_values(json_decode($questions_science->questionobjectfirsthindi, true));
                                                 $questionobjectsecondhindiscience  = array_values(json_decode($questions_science->questionobjectsecondhindi, true));
                                                 $questionobjectthirdhindiscience  = array_values(json_decode($questions_science->questionobjectthirdhindi, true));
                                                 $questionobjectfourthhindiscience  = array_values(json_decode($questions_science->questionobjectfourthhindi, true));
                                                 
                                                 $questionobjectanswerscience  = array_values(json_decode($questions_science->questionobjectanswer, true));
                                            
                                            }
                                            if($questions_hindi) {  
                                                $questionshindi  = array_values(json_decode($questions_hindi->questionlist, true));  
                                                
                                                ////////// Option for English
                                                $questionobjectfirst_hindi  = array_values(json_decode($questions_hindi->questionobjectfirst, true));
                                                $questionobjectsecond_hindi  = array_values(json_decode($questions_hindi->questionobjectsecond, true));
                                                $questionobjectthird_hindi  = array_values(json_decode($questions_hindi->questionobjectthird, true));
                                                $questionobjectfourth_hindi  = array_values(json_decode($questions_hindi->questionobjectfourth, true));
 
                                                 $questionobjectanswer_hindi  = array_values(json_decode($questions_hindi->questionobjectanswer, true));
                                            }
                                            if($questions_english) { 
                                                 $questionsenglish  = array_values(json_decode($questions_english->questionlist, true)); 
                                                 
                                                
                                                ////////// Option for English
                                                $questionobjectfirst_english  = array_values(json_decode($questions_english->questionobjectfirst, true));
                                                $questionobjectsecond_english  = array_values(json_decode($questions_english->questionobjectsecond, true));
                                                $questionobjectthird_english  = array_values(json_decode($questions_english->questionobjectthird, true));
                                                $questionobjectfourth_english  = array_values(json_decode($questions_english->questionobjectfourth, true)); 
                                                 
                                                 $questionobjectanswer_english  = array_values(json_decode($questions_english->questionobjectanswer, true));
                                                
                                                }
                                            if($questions_maths) {  
                                                $questionsmaths  = array_values(json_decode($questions_maths->questionlist, true)); 
                                         
                                                $questionhindimaths  = array_values(json_decode($questions_maths->questionhindi, true));
                                                
                                                ////////// Option for English
                                                $questionobjectfirstmaths  = array_values(json_decode($questions_maths->questionobjectfirst, true));
                                                $questionobjectsecondmaths  = array_values(json_decode($questions_maths->questionobjectsecond, true));
                                                $questionobjectthirdmaths  = array_values(json_decode($questions_maths->questionobjectthird, true));
                                                $questionobjectfourthmaths  = array_values(json_decode($questions_maths->questionobjectfourth, true));

                                                 ////////// Option for Hindi
                                                 $questionobjectfirsthindimaths  = array_values(json_decode($questions_maths->questionobjectfirsthindi, true));
                                                 $questionobjectsecondhindimaths  = array_values(json_decode($questions_maths->questionobjectsecondhindi, true));
                                                 $questionobjectthirdhindimaths  = array_values(json_decode($questions_maths->questionobjectthirdhindi, true));
                                                 $questionobjectfourthhindimaths  = array_values(json_decode($questions_maths->questionobjectfourthhindi, true));
                                                 
                                                 $questionobjectanswermaths  = array_values(json_decode($questions_maths->questionobjectanswer, true));
                                            
                                            }
                                             
                                             ?>
                                            
                                            <div class="carousel-inner">
                                            <?php $counter = 0; $quescounter = 1;  
                                            ////////// G.K. Questions Section
                                            foreach($questionsgeneral as $questionsgeneraldata){ ?>
                                            <div class="item <?php if($counter == 0) { ?> active <?php } ?>">
                                                <div class="questiojpatterdisplay">
                                                 <h3> Ques.{{ $quescounter }} :  {{  $questionsgeneraldata }}   </h3>
                                                 <h3>   ( {{  $questionhindi[ $counter] }} )  </h3>
                                                 <ul>
                                                    <li> <p> A: <input type="radio" dataid="#answersection{{  $counter }}" class="optionseletedata" name="useroption[{{  $counter }}]" id="questionobjectfirst" value="A"> {{ $questionobjectfirst[ $counter]  }} ( {{ $questionobjectfirsthindi[ $counter]  }} ) </p> </li>
                                                    <li> <p> B: <input type="radio" dataid="#answersection{{  $counter }}" class="optionseletedata" name="useroption[{{  $counter }}]" id="questionobjectsecond" value="B"> {{ $questionobjectsecond[ $counter]  }} ( {{ $questionobjectsecondhindi[ $counter]  }} ) </p> </li>
                                                    <li> <p> C: <input type="radio" dataid="#answersection{{  $counter }}"  class="optionseletedata" name="useroption[{{  $counter }}]" id="questionobjectthird" value="C"> {{ $questionobjectthird[ $counter]  }} ( {{ $questionobjectthirdhindi[ $counter]  }} ) </p> </li>
                                                    <li> <p> D: <input type="radio" dataid="#answersection{{  $counter }}"  class="optionseletedata" name="useroption[{{  $counter }}]" id="questionobjectfourth" value="D"> {{ $questionobjectfourth[ $counter]  }} ( {{ $questionobjectfourthhindi[ $counter]  }} ) 
                                                    <input type="hidden" name="questionobjectanswer[{{  $counter }}]" id="questionobjectanswer" value="{{ $questionobjectanswer[ $counter] }}">
                                                    </p> </li> 
                                                  </ul> 
                                                 </div>
                                            </div>
                                            <?php $counter = $counter+1;  ; $quescounter =  $quescounter + 1;   }

                                     
                                            
                                             $counter =  0;
                                            ///// Science Section  
                                             foreach($questionsscience as $questionssciencedata){ ?>
                                            <div class="item">
                                                <div class="questiojpatterdisplay">
                                                 <h3> Ques.{{ $quescounter }} :  {{  $questionssciencedata }}   </h3>
                                                 <h3>   ( {{  $questionhindiscience[ $counter] }} )  </h3>
                                                 <ul>
                                                    <li> <p> A: <input type="radio" dataid="#answersection{{  $quescounter-1 }}" class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectfirst" value="A"> {{ $questionobjectfirstscience[ $counter]  }} ( {{ $questionobjectfirsthindiscience[ $counter]  }} ) </p> </li>
                                                    <li> <p> B: <input type="radio" dataid="#answersection{{  $quescounter-1 }}" class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectsecond" value="B"> {{ $questionobjectsecondscience[ $counter]  }} ( {{ $questionobjectsecondhindiscience[ $counter]  }} ) </p> </li>
                                                    <li> <p> C: <input type="radio" dataid="#answersection{{  $quescounter-1 }}"  class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectthird" value="C"> {{ $questionobjectthirdscience[ $counter]  }} ( {{ $questionobjectthirdhindiscience[ $counter]  }} ) </p> </li>
                                                    <li> <p> D: <input type="radio" dataid="#answersection{{  $quescounter-1 }}"  class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectfourth" value="D"> {{ $questionobjectfourthscience[ $counter]  }} ( {{ $questionobjectfourthhindiscience[ $counter]  }} ) 
                                                    <input type="hidden" name="questionobjectanswer[{{  $quescounter-1 }}]" id="questionobjectanswer" value="{{ $questionobjectanswerscience[ $counter] }}">
                                                    </p> </li> 
                                                  </ul> 
                                                 </div>
                                            </div>
                                            <?php $counter = $counter+1;   $quescounter =  $quescounter + 1;   }
                                            
                                              ///// Hindi Section   
                                                 $counter = 0;
                                             foreach($questionshindi as $questionshindidata){ ?>
                                            <div class="item">
                                                <div class="questiojpatterdisplay">
                                                 <h3> Ques.{{ $quescounter }} :  {{  $questionshindidata }}   </h3>                                                
                                                 <ul>
                                                    <li> <p> A: <input type="radio" dataid="#answersection{{  $quescounter-1 }}" class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectfirst" value="A"> {{ $questionobjectfirst_hindi[ $counter]  }}  </p> </li>
                                                    <li> <p> B: <input type="radio" dataid="#answersection{{  $quescounter-1 }}" class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectsecond" value="B"> {{ $questionobjectsecond_hindi[ $counter]  }}  </p> </li>
                                                    <li> <p> C: <input type="radio" dataid="#answersection{{  $quescounter-1 }}"  class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectthird" value="C"> {{ $questionobjectthird_hindi[ $counter]  }} </p> </li>
                                                    <li> <p> D: <input type="radio" dataid="#answersection{{  $quescounter-1 }}"  class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectfourth" value="D"> {{ $questionobjectfourth_hindi[ $counter]  }} 
                                                    <input type="hidden" name="questionobjectanswer[{{  $quescounter-1 }}]" id="questionobjectanswer" value="{{ $questionobjectanswer_hindi[ $counter] }}">
                                                    </p> </li> 
                                                  </ul> 
                                                 </div>
                                            </div>
                                            <?php $counter = $counter+1;  ; $quescounter =  $quescounter + 1;   }

                                              ///// English Section    
                                              $counter = 0;
                                             foreach($questionsenglish as $questionsenglishdata){ ?>
                                            <div class="item">
                                                <div class="questiojpatterdisplay">
                                                 <h3> Ques.{{ $quescounter }} :  {{  $questionsenglishdata }}   </h3>                                                
                                                 <ul>
                                                    <li> <p> A: <input type="radio" dataid="#answersection{{  $quescounter-1 }}" class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectfirst" value="A"> {{ $questionobjectfirst_english[ $counter]  }}  </p> </li>
                                                    <li> <p> B: <input type="radio" dataid="#answersection{{  $quescounter-1 }}" class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectsecond" value="B"> {{ $questionobjectsecond_english[ $counter]  }}  </p> </li>
                                                    <li> <p> C: <input type="radio" dataid="#answersection{{  $quescounter-1 }}"  class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectthird" value="C"> {{ $questionobjectthird_english[ $counter]  }} </p> </li>
                                                    <li> <p> D: <input type="radio" dataid="#answersection{{  $quescounter-1 }}"  class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectfourth" value="D"> {{ $questionobjectfourth_english[ $counter]  }} 
                                                    <input type="hidden" name="questionobjectanswer[{{  $quescounter-1 }}]" id="questionobjectanswer" value="{{ $questionobjectanswer_english[ $counter] }}">
                                                    </p> </li> 
                                                  </ul> 
                                                 </div>
                                            </div>
                                            <?php $counter = $counter+1;  ; $quescounter =  $quescounter + 1;   }
 
                                                 
                                                $counter = 0;
                                             ///// Mathematics Section  
                                             foreach($questionsmaths as $questionsmathsdata){ ?>
                                            <div class="item">
                                                <div class="questiojpatterdisplay">
                                                 <h3> Ques.{{ $quescounter }} :  {{  $questionsmathsdata }}   </h3>
                                                 <h3>   ( {{  $questionhindimaths[ $counter] }} )  </h3>
                                                 <ul>
                                                    <li> <p> A: <input type="radio" dataid="#answersection{{  $quescounter-1 }}" class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectfirst" value="A"> {{ $questionobjectfirstmaths[ $counter]  }} ( {{ $questionobjectfirsthindimaths[ $counter]  }} ) </p> </li>
                                                    <li> <p> B: <input type="radio" dataid="#answersection{{  $quescounter-1 }}" class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectsecond" value="B"> {{ $questionobjectsecondmaths[ $counter]  }} ( {{ $questionobjectsecondhindimaths[ $counter]  }} ) </p> </li>
                                                    <li> <p> C: <input type="radio" dataid="#answersection{{  $quescounter-1 }}"  class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectthird" value="C"> {{ $questionobjectthirdmaths[ $counter]  }} ( {{ $questionobjectthirdhindimaths[ $counter]  }} ) </p> </li>
                                                    <li> <p> D: <input type="radio" dataid="#answersection{{  $quescounter-1 }}"  class="optionseletedata" name="useroption[{{  $quescounter }}]" id="questionobjectfourth" value="D"> {{ $questionobjectfourthmaths[ $counter]  }} ( {{ $questionobjectfourthhindimaths[ $counter]  }} ) 
                                                    <input type="hidden" name="questionobjectanswer[{{  $quescounter-1 }}]" id="questionobjectanswer" value="{{ $questionobjectanswermaths[ $counter] }}">
                                                    </p> </li> 
                                                  </ul> 
                                                 </div>
                                            </div>
                                            <?php $counter = $counter+1;  ; $quescounter =  $quescounter + 1;   }
                                            
                                            ?> 
                                            <!-- Left and right controls -->
                                            <a class="left carousel-control" href="#myCarousel" data-slide="prev">
                                            <span class="glyphicon glyphicon-chevron-left"></span>
                                            <span class="sr-only">Previous</span>
                                            </a>
                                            <a class="right carousel-control" href="#myCarousel" data-slide="next">
                                            <span class="glyphicon glyphicon-chevron-right"></span>
                                            <span class="sr-only">Next</span>
                                            </a>
                                            <h3 class="useranswersheetdata"> Answer Sheet </h3>
                                            <input type="submit" value="Exam Submit" class="questionsubmitdata" id="submitbutton"> 
                                        </div>
                                        {!! csrf_field() !!}
                                        <input type="hidden" name="competitionassignid" value="{{ $compitetionassignment->id  }}" />
                                         <input type="hidden" name="competitiontitle" value="{{ $compitetionassignment->compitetiontitle  }}" />
                                          <input type="hidden" name="compitetionid" value="{{  $compitetionassignment->compitetionid  }}" />
                                           <input type="hidden" name="compitetionname" value="{{  $compitetionassignment->compitetionname  }}" />
                                            <input type="hidden" name="questionsetid" value="{{  $compitetionassignment->questionsetid  }}" />
                                             <input type="hidden" name="questiomnsetname" value="{{  $compitetionassignment->questiomnsetname  }}" />
                                             <input type="hidden" name="classgroupid" value="{{  $compitetionassignment->groupclassid  }}" />
                                             <input type="hidden" name="classgroupname" value="{{  $compitetionassignment->groupclassname  }}" />
                                              <input type="hidden" name="closetime" value="{{  $compitetionassignment->examendtime  }}" />
                                              <input type="hidden" name="usertime" id="usertime" value="00:00" />
                                              <input type="hidden" name="userid" value="{{ Auth::user()->id  }}" />
                                    </form>
                                    </div>
                                </div>
                            </div>
                    </div>
            </div>
        </div>
    </div>
    <script src="{{ asset('public/frontend/js/jquery.min.js') }}"></script> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>

<script> 

  var idleTime = 0;
    $(document).ready(function () {
        // Increment the idle time counter every minute.
        var idleInterval = setInterval(timerIncrement, 60000); // 1 minute

        // Zero the idle timer on mouse movement.
        $(this).mousemove(function (e) {
            idleTime = 0;
        });
        $(this).keypress(function (e) {
            idleTime = 0;
        });
    });

    function timerIncrement() {
        idleTime = idleTime + 1;
        if (idleTime > 2) { // 20 minutes
            window.location.reload();
        }
    }
    
     
    $( document ).ready(function() { 
        //////////////// User Time
        d = new Date(); 
        d.setMinutes(00);
        d.setSeconds(0, 0);
        setInterval(function () {
         var usertimesection  = d.getMinutes()+':'+ d.getSeconds();
         console.log(usertimesection);
         $('#usertime').val(usertimesection);
       //  document.getElementById("m").innerHTML = d.getMinutes();
        ///  document.getElementById("s").innerHTML = d.getSeconds();
        d.setTime(d.getTime() + 1000);
        }, 1000);

          ////////// Green Section 
             $( ".optionseletedata" ).on( "click", function() {
                    var newdata = $(this).attr('dataid');
                      /// alert(newdata);
                    if($(newdata).hasClass('noansweruser')){ 
                            $(newdata).addClass('useranswered');
                             $(newdata).removeClass('noansweruser');
                    } else {
                       $(newdata).addClass('useranswered');  
                    }
                   
                });

                ////////// Subject Section

                  $( ".subjectseciton li a" ).on( "click", function() {
                        var newdata = $(this).attr('href');
                            ///  alert(newdata);
                        $(newdata).click();
                        return false;
                        });

                //////////////// Blank Question 
                 $( ".carousel-control" ).on( "click", function() {
                    var rewctpj = $('.carousel-indicators li.active').attr('id');
                      var addred = '#'+rewctpj;
                      ///// alert(addred);
                        if ($(addred).hasClass('useranswered')){ } else {
                             $(addred).addClass('noansweruser');
                        } 
                });

                 $( ".carousel-indicators li" ).on( "click", function() {
                    var rewctpj = $('.carousel-indicators li.active').attr('id');
                      var addred = '#'+rewctpj;
                        if ($(addred).hasClass('useranswered')){ } else {
                             $(addred).addClass('noansweruser');
                        } 
                });


            /////////////// Countdown
            var timer2 = "{{ $remaingtime }}";
            var interval = setInterval(function() {


            var timer = timer2.split(':');
            //by parsing integer, I avoid all extra string processing
            var minutes = parseInt(timer[0], 10);
            var seconds = parseInt(timer[1], 10);
            --seconds;
            minutes = (seconds < 0) ? --minutes : minutes;
            if (minutes < 0) clearInterval(interval);
            seconds = (seconds < 0) ? 59 : seconds;
            seconds = (seconds < 10) ? '0' + seconds : seconds;
            //minutes = (minutes < 10) ?  minutes : minutes;
            if (parseInt(minutes) <= 0 && parseInt(seconds) <= 1) {
               /////  alert('Jai');
                $('#submitbutton').click();
                $('.countdown').hide();
                 $('#userquestionsetsection').fadeOut();
            }
            $('.countdown').html('Time : '+minutes + ':' + seconds);
            timer2 = minutes + ':' + seconds;
            }, 1000);
            
                }); 
</script>
@endsection   