@extends('admin.layout.master')


@section('content')
<div class="app-content  my-3 my-md-5">
  <div class="side-app">
    <div class="page-header">
      <ol class="breadcrumb">
        <li class="breadcrumb-item" aria-current="page"><a href="javascript:void(0)">Test Series Manager</a></li>
      <li class="breadcrumb-item active" aria-current="page"><a href="{{route('admin.test_series_manager.test.list', base64_encode($test['test_package_id']))}}">Test</a></li>
      <li class="breadcrumb-item active" aria-current="page">Test Add</li>
      </ol>
    </div>
    <!-- MAIN BODY CONTENT -->
    <h1>Add Test</h1>

    <!-- Table -->
    <div class="card">
      <div class="steps-wrap">
        <ul class="steps-item">
          <li class="grey-color">
            <a href="{{route('admin.test_series_manager.test.edit', $testId)}}">
            <div class="step-content">
              <p class="step">Step 1</p>
              <p class="step-desc">Create a New Test</p>
            </div>
            <svg
              class="step-img"
              xmlns="http://www.w3.org/2000/svg"
              width="24"
              height="24"
              viewBox="0 0 24 24"
            >
              <g transform="translate(21017.088 -1472.473)">
                <rect
                  width="24"
                  height="24"
                  transform="translate(-21017.088 1472.473)"
                  fill="none"
                />
                <g transform="translate(-21013.088 1474.973)">
                  <g transform="translate(0 6.846)">
                    <path
                      d="M8,12.154a1.51,1.51,0,0,1-.683-.165A7.716,7.716,0,0,0,4,11.317a9,9,0,0,0-2.2.263,1.45,1.45,0,0,1-.358.045A1.434,1.434,0,0,1,.432,11.2,1.455,1.455,0,0,1,0,10.163V1.927A1.494,1.494,0,0,1,.888.577,7.915,7.915,0,0,1,4,0,6.685,6.685,0,0,1,8,1.095a6.69,6.69,0,0,1,4-1.095,7.853,7.853,0,0,1,3.106.577A1.494,1.494,0,0,1,16,1.927v8.236a1.437,1.437,0,0,1-1.8,1.417,9,9,0,0,0-2.2-.263,7.643,7.643,0,0,0-3.317.672A1.476,1.476,0,0,1,8,12.154Zm4-10.693a8.806,8.806,0,0,0-4,1.1v8.4a8.815,8.815,0,0,1,4-1.095,9.163,9.163,0,0,1,1.673.146.768.768,0,0,0,.134.012.734.734,0,0,0,.739-.728V2.38a.739.739,0,0,0-.581-.716A9.2,9.2,0,0,0,12.006,1.46Z"
                      transform="translate(0 0)"
                      fill=""
                    />
                  </g>
                  <ellipse
                    cx="3.296"
                    cy="3.267"
                    rx="3.296"
                    ry="3.267"
                    transform="translate(4.894)"
                    fill=""
                  />
                </g>
              </g>
            </svg>
          </a>
          </li>
          <li class="grey-color">
            <a href="{{route('admin.test_series_manager.test.question.list', $testId)}}">
            <div class="step-content">
              <p class="step">Step 2</p>
              <p class="step-desc">Add Question</p>
            </div>
            <svg
              class="step-img"
              xmlns="http://www.w3.org/2000/svg"
              width="35"
              height="29.002"
              viewBox="0 0 35 29.002"
            >
              <path
                d="M3.807,24.191A13,13,0,0,1,13,2a12.91,12.91,0,0,1,5.4,1.168A9,9,0,0,0,25.849,17,13.012,13.012,0,0,1,13,28,12.909,12.909,0,0,1,3.807,24.191Zm8.244-4.721a1.5,1.5,0,0,0-.5.324,1.616,1.616,0,0,0-.336.487,1.542,1.542,0,0,0,.336,1.7,1.533,1.533,0,0,0,.5.325,1.647,1.647,0,0,0,.631.112,1.594,1.594,0,0,0,.619-.112,1.685,1.685,0,0,0,.5-.325,1.538,1.538,0,0,0,.341-.492,1.573,1.573,0,0,0,0-1.212,1.7,1.7,0,0,0-.341-.487,1.6,1.6,0,0,0-.5-.324,1.47,1.47,0,0,0-.619-.121A1.535,1.535,0,0,0,12.051,19.471Zm1.771-7.939a1.1,1.1,0,0,1,.355.859,1.534,1.534,0,0,1-.193.779,2.478,2.478,0,0,1-.474.59,5.351,5.351,0,0,1-.623.5,7.107,7.107,0,0,0-.619.474,2.281,2.281,0,0,0-.475.547,1.249,1.249,0,0,0-.191.7.787.787,0,0,0,.005.107.514.514,0,0,0,.008.08s0,.008,0,.012a.046.046,0,0,0,0,.012l.2,1.454h1.911l.252-1.262a.936.936,0,0,1,.283-.5,4.829,4.829,0,0,1,.539-.457c.05-.039.1-.076.153-.115l.08-.06.005-.006c.138-.1.278-.21.424-.322a3.683,3.683,0,0,0,.635-.631,3.262,3.262,0,0,0,.481-.865,3.351,3.351,0,0,0,.187-1.188,3.312,3.312,0,0,0-.251-1.31A2.915,2.915,0,0,0,15.78,9.91a3.394,3.394,0,0,0-1.158-.643A4.835,4.835,0,0,0,13.1,9.04a5.657,5.657,0,0,0-1.123.107,4.92,4.92,0,0,0-.967.289,5.5,5.5,0,0,0-.84.426,6.069,6.069,0,0,0-.727.524l.739,1.135a.626.626,0,0,0,.576.329.683.683,0,0,0,.342-.1l.119-.063.045-.024c.066-.037.136-.074.21-.113l.029-.015a2.972,2.972,0,0,1,.546-.223,2.818,2.818,0,0,1,.8-.1A1.4,1.4,0,0,1,13.822,11.532ZM18,8a8,8,0,1,1,8,8A8.01,8.01,0,0,1,18,8Zm3.534,1.2H25.09v3.847h2.435V9.2H31.1V7.052H27.526V3.226H25.09V7.052H21.534Z"
                transform="translate(0.5 0.5)"
                fill=""
                stroke="rgba(0,0,0,0)"
                stroke-width="1"
              />
            </svg>
          </a>
          </li>
          <li class="grey-color">
            <a href="{{route('admin.test_series_manager.test.setting.add', $testId)}}">
            <div class="step-content">
              <p class="step">Step 3</p>
              <p class="step-desc">Test Setting</p>
            </div>
            <svg
              class="step-img"
              xmlns="http://www.w3.org/2000/svg"
              width="24"
              height="24"
              viewBox="0 0 24 24"
            >
              <g transform="translate(-542 -154)">
                <rect
                  width="24"
                  height="24"
                  transform="translate(542 154)"
                  fill="rgba(0,0,0,0)"
                />
                <path
                  d="M561,175H547a2,2,0,0,1-2-2V159a2,2,0,0,1,2-2h4.18a2.988,2.988,0,0,1,5.64,0H561a2,2,0,0,1,2,2v14A2,2,0,0,1,561,175Zm-11-6a1,1,0,1,0,0,2h5a1,1,0,0,0,0-2Zm0-4a1,1,0,1,0,0,2h8a1,1,0,1,0,0-2Zm0-4a1,1,0,1,0,0,2h8a1,1,0,1,0,0-2Zm4-4a1,1,0,1,0,1,1A1,1,0,0,0,554,157Z"
                  fill=""
                />
              </g>
            </svg>
          </a>
          </li>
          <li class="active">
           <a href="{{route('admin.test_series_manager.test.final.review', $testId)}}">
            <div class="step-content">
              <p class="step">Step 4</p>
              <p class="step-desc">Finish Test</p>
            </div>
            <svg
              class="step-img"
              xmlns="http://www.w3.org/2000/svg"
              width="63"
              height="63"
              viewBox="0 0 63 63"
            >
              <g transform="translate(-644 -198)">
                <rect
                  width="63"
                  height="63"
                  transform="translate(644 198)"
                  fill="rgba(0,0,0,0)"
                />
                <path
                  d="M26.5,53A26.5,26.5,0,1,1,53,26.5,26.53,26.53,0,0,1,26.5,53ZM11.672,23.844A2.641,2.641,0,0,0,9.8,28.356l9.514,9.514a2.636,2.636,0,0,0,1.877.775,2.57,2.57,0,0,0,1.858-.775L43.169,17.754a2.642,2.642,0,1,0-3.737-3.735L21.2,32.25,13.54,24.618A2.624,2.624,0,0,0,11.672,23.844Z"
                  transform="translate(650 204)"
                  fill=""
                />
              </g>
            </svg>
          </a>
          </li>
        </ul>
        <div class="card-body">
          <h2>Finish Test</h2>

          <div class="summary-box mb-6">
            <h2>Test Creation Summary</h2>
            <p>
              Please review the test details namely Test Pattern, Subject, No. Of Questions, Question Type, Difficulty Level, Language etc
            </p>
            <p>
              It is recommended to go through these details thrice before finalization
            </p>
          </div>

          <div class="table-responsive mb-7">
            <input type="hidden" name="test_pattern" id="test_pattern" value="{{$test->test_pattern_type}}">
            <input type="hidden" name="test_package_id" id="test_package_id" value="{{base64_encode($test->test_package_id)}}">
            <table class="table card-table table-border-top table-center text-nowrap outline-border all_wise" style="display: none;">
              <thead>
                <tr class="bg-light">
                  <th class="section_name">Section Name</th>
                  <th>Subject Name</th>
                  <th>Total No Of Question</th>
                  <th>Difficulty Level</th>
                  <th>Question Type</th>
                  <th>Language</th>
                  <th>Sectional Time <br>(In Min.)</th>
                  <th class="section_instruction">Instruction</th>
                </tr>
              </thead>
              <tbody>
                @if(!$testSubject->isEmpty())
                @foreach($testSubject as $val)
                <tr>
                  <td class="section_name">{{$val['section_name']}}</td>
                  <td>{{$val['subject']}}</td>
                  <td>
                    @if($val->test_pattern_type > 0)
                      {{$val->no_of_questions}}
                    @else
                      {{$val->total_question_count}}
                    @endif
                  </td>
                  <td>
                    <p>Easy 
                        @if($val->test_pattern_type > 0)
                          {{$val->easy}}
                        @else
                          {{$val->total_easy_question_count}}
                        @endif
                    </p>
                    <p>Medium  
                      @if($val->test_pattern_type > 0)
                        {{$val->medium}}
                      @else
                        {{$val->total_mid_question_count}}
                      @endif
                    </p>
                    <p>Hard 
                        @if($val->test_pattern_type > 0)
                          {{$val->hard}}
                        @else
                          {{$val->total_hard_question_count}}
                        @endif
                    </p>
                  </td>
                  <td>
                    @if(isset($val->question_type))
                    @foreach($val->question_type as $v)
                      @if($v->question_type == 1)
                        <p>Mcq: {{$v->question_type_count}}</p>
                      @elseif($v->question_type == 2)
                        <p>Mrq: {{$v->question_type_count}}</p>
                      @elseif($v->question_type == 3)
                        <p>True False: {{$v->question_type_count}}</p>
                      @elseif($v->question_type == 4)
                        <p>Fill Up The Blanks: {{$v->question_type_count}}</p>
                      @elseif($v->question_type == 5)
                        <p>Match Following: {{$v->question_type_count}}</p>
                      @elseif($v->question_type == 6)
                        <p>Match Matrix: {{$v->question_type_count}}</p>
                      @elseif($v->question_type == 7)
                        <p>Essay: {{$v->question_type_count}}</p>
                      @elseif($v->question_type == 8)
                        <p>Single Dig: {{$v->question_type_count}}</p>
                      @else
                        <p>Subjective: {{$v->question_type_count}}</p>
                      @endif
                    @endforeach
                    @endif
                  </td>
                  <td>
                    @if(isset($val->lang_wise))
                    @foreach($val->lang_wise as $v)
                    @if($v->language_id > 0)
                       @if($v->language_id == 1)
                        <p>English: {{$v->lang_count}}</p>
                      @else
                        <p>Hindi: {{$v->lang_count}}</p>
                      @endif
                    @endif
                    @endforeach
                    @endif
                  </td>
                  <td>{{$val->section_time}}</td>
                  <td class="section_instruction">
                    @if(isset($val->instructionByTestSubject)){{$val->instructionByTestSubject->test_filename}}@endif</td>
                </tr>
                @endforeach
                @endif                        
              </tbody>
            </table>

            <table class="table card-table table-border-top table-center text-nowrap outline-border diff_wise" style="display: none;">
              <thead>
                <tr class="bg-light">
                  <th>Difficulty Name</th>
                  <th>Total No Of Question</th>
                  <th>Question Type</th>
                  <th>Language</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>Easy</td>
                  <td>{{$test->total_easy}}</td>
                  <td>
                    @foreach($easyQuestionTypeCount as $val)
                      @if($val->question_type == 1)
                        <p>Mcq: {{$val->easy_count}}</p>
                      @elseif($val->question_type == 2)
                        <p>Mrq: {{$val->easy_count}}</p>
                      @elseif($val->question_type == 3)
                        <p>True False: {{$val->easy_count}}</p>
                      @elseif($val->question_type == 4)
                        <p>Fill Up The Blanks: {{$val->easy_count}}</p>
                      @elseif($val->question_type == 5)
                        <p>Match Following: {{$val->easy_count}}</p>
                      @elseif($val->question_type == 6)
                        <p>Match Matrix: {{$val->easy_count}}</p>
                      @elseif($val->question_type == 7)
                        <p>Essay: {{$val->easy_count}}</p>
                      @elseif($val->question_type == 8)
                        <p>Single Dig: {{$val->easy_count}}</p>
                      @else
                        <p>Subjective: {{$val->easy_count}}</p>
                      @endif
                    @endforeach
                  </td>
                  <td>
                    @foreach($easyLang as $val)
                    @if($val->language_id > 0)
                      @if($val->language_id == 1)
                        <p>English: {{$val->easy_lang_count}}</p>
                      @else
                        <p>Hindi: {{$val->easy_lang_count}}</p>
                      @endif
                    @endif
                    @endforeach
                  </td>
                </tr>
                <tr>
                  <td>Medium</td>
                  <td>{{$test->total_medium}}</td>
                  <td>
                    @foreach($midQuestionTypeCount as $val)
                      @if($val->question_type == 1)
                        <p>Mcq: {{$val->mid_count}}</p>
                      @elseif($val->question_type == 2)
                        <p>Mrq: {{$val->mid_count}}</p>
                      @elseif($val->question_type == 3)
                        <p>True False: {{$val->mid_count}}</p>
                      @elseif($val->question_type == 4)
                        <p>Fill Up The Blanks: {{$val->mid_count}}</p>
                      @elseif($val->question_type == 5)
                        <p>Match Following: {{$val->mid_count}}</p>
                      @elseif($val->question_type == 6)
                        <p>Match Matrix: {{$val->mid_count}}</p>
                      @elseif($val->question_type == 7)
                        <p>Essay: {{$val->mid_count}}</p>
                      @elseif($val->question_type == 8)
                        <p>Single Dig: {{$val->mid_count}}</p>
                      @else
                        <p>Subjective: {{$val->mid_count}}</p>
                      @endif
                    @endforeach
                  </td>
                  <td>
                    @foreach($midLang as $val)
                    @if($val->language_id > 0)
                      @if($val->language_id == 1)
                        <p>English: {{$val->mid_lang_count}}</p>
                      @else
                        <p>Hindi: {{$val->mid_lang_count}}</p>
                      @endif
                    @endif
                    @endforeach
                  </td>
                </tr>
                <tr>
                  <td>Hard</td>
                  <td>{{$test->total_hard}}</td>
                  <td>
                    @foreach($hardQuestionTypeCount as $val)
                      @if($val->question_type == 1)
                        <p>Mcq: {{$val->hard_count}}</p>
                      @elseif($val->question_type == 2)
                        <p>Mrq: {{$val->hard_count}}</p>
                      @elseif($val->question_type == 3)
                        <p>True False: {{$val->hard_count}}</p>
                      @elseif($val->question_type == 4)
                        <p>Fill Up The Blanks: {{$val->hard_count}}</p>
                      @elseif($val->question_type == 5)
                        <p>Match Following: {{$val->hard_count}}</p>
                      @elseif($val->question_type == 6)
                        <p>Match Matrix: {{$val->hard_count}}</p>
                      @elseif($val->question_type == 7)
                        <p>Essay: {{$val->hard_count}}</p>
                      @elseif($val->question_type == 8)
                        <p>Single Dig: {{$val->hard_count}}</p>
                      @else
                        <p>Subjective: {{$val->hard_count}}</p>
                      @endif
                    @endforeach
                  </td>
                  <td>
                    @foreach($hardLang as $val)
                      @if($val->language_id > 0)
                      @if($val->language_id == 1)
                        <p>English: {{$val->hard_lang_count}}</p>
                      @else
                        <p>Hindi: {{$val->hard_lang_count}}</p>
                      @endif
                      @endif
                    @endforeach
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
          <h3 class="text-underline">Test Setting Detail</h3>

          <ul class="test-details-list">
            <li>
              <div class="test-left">
                <p>Test Pattern:</p>
              </div>
              <ul class="test-right">
                <li>
                  @if($test->test_pattern_type == 1)
                    <p>Section Wise</p>
                  @elseif($test->test_pattern_type == 2)
                    <p>Subject Wise</p>
                  @else
                    <p>Difficulty Wise</p>
                  @endif
                </li>
                @if($test->test_pattern_type == 1)
                <li>
                  <p>Interval Time</p>
                  <div class="disabled-inputs">
                    <label class="custom-control custom-radio no_bullet">
                      <input type="radio" class="custom-control-input" name="" value="" checked disabled/>
                      <span class="custom-control-label">
                        {{$test->interval_time}} Secs
                      </span>
                    </label>
                  </div> 
                </li>
                @endif
                @if($test->test_pattern_type != 3)
                <li>
                  <p>Show instruction details</p>
                    <div class="disabled-inputs">  
                      <label class="custom-control custom-radio">
                        <input type="radio" class="custom-control-input" name="" value="" checked disabled/>
                        <span class="custom-control-label">
                          @if($test->instruction_status == 2)
                            No
                          @else
                            Yes
                          @endif
                        </span>
                      </label>
                    </div>
                </li>
                @endif
                 @if($test->test_pattern_type == 1)
                <li>
                  <p>Show Section wise Test Summary </p>
                    <div class="disabled-inputs">  
                      <label class="custom-control custom-radio">
                        <input type="radio" class="custom-control-input" name="" value="" checked disabled/>
                        <span class="custom-control-label">
                          @if($test->test_summary_status == 2)
                            No
                          @else
                            Yes
                          @endif
                        </span>
                      </label>
                    </div>
                </li>
                @endif
              </ul>
            </li>
            <li>
              <div class="test-left">
                <p>Arrangement:</p>
              </div>
              <ul class="test-right">
                <li>
                  <p>Question Wise Shuffling</p>
                  <div class="disabled-inputs">
                    <label class="custom-control custom-radio">
                      <input type="radio" class="custom-control-input" name="" value="" checked disabled/>
                      <span class="custom-control-label">
                        @if($test->question_shuffle_status == 2)
                          No
                        @else
                          Yes
                        @endif
                      </span>
                    </label>
                  </div>
                </li>
                <li>
                  <p>Option Wise Shuffling</p>
                  <div class="disabled-inputs">                      
                      <label class="custom-control custom-radio">
                        <input type="radio" class="custom-control-input" name="" value="" checked disabled/>
                        <span class="custom-control-label">
                          @if($test->agreement_shuffling_status == 2)
                            No
                          @else
                            Yes
                          @endif
                        </span>
                      </label>
                    </div>
                </li>
              </ul>
            </li>
            <li>
              <div class="test-left">
                <p>Test Options:</p>
              </div>
              <ul class="test-right">
                @if(!$testOption->isEmpty())
                @foreach($testOption as $val)
                <li>
                    @if($val->options_id == 1)
                      <p>Allow user to move back and forward</p>
                    @elseif($val->options_id == 2)
                      <p>Allow user to attempt test in multiple language</p>
                    @elseif($val->options_id == 3)
                      <p>Show marks / points for test</p>
                    @elseif($val->options_id == 4)
                      <p>Show calculator</p>
                    @elseif($val->options_id == 5)
                      <p>Apply Partial Marking</p>
                    @else
                      <p>Allow user to pause and resume</p>
                    @endif
                     <div class="disabled-inputs">
                       <label class="custom-control custom-checkbox">
                          <input type="checkbox" class="custom-control-input"
                            name="example-checkbox1" value="option1" checked
                            disabled/>
                          <span class="custom-control-label"></span>
                        </label>
                     </div>
                </li>
                @endforeach
                @endif
              </ul>
            </li>
            <li>
              <div class="test-left">
                <p>Candidate Setting:</p>
              </div>
              <ul class="test-right">
                <li>
                   <p>Show result with Candidate as per your subsequent selection</p>
                   <div class="disabled-inputs">
                      <label class="custom-control custom-radio">
                        <input type="radio" class="custom-control-input" name="" value="" checked disabled/>
                        <span class="custom-control-label">
                          @if($test->candidate_setting_subsequent == 2)
                            Manual
                          @elseif($test->candidate_setting_subsequent == 3)
                            Dated
                          @else
                            Auto
                          @endif
                        </span>
                      </label>
                   </div>
                 </li>
                 <li>
                    <p>Calculate the ranks using automated or manual variations </p>
                    <div class="disabled-inputs">  
                     <label class="custom-control custom-radio">
                        <input type="radio" class="custom-control-input" name="" value="" checked disabled/>
                        <span class="custom-control-label">
                          @if($test->calculate_ranking_status == 2)
                            No
                          @else
                            Yes
                          @endif
                        </span>
                      </label>
                      </div>
                 </li>
                 <li>
                    <p>Show Top Performer of test with Candidatee</p>
                    <div class="disabled-inputs">
                      <label class="custom-control custom-radio">
                        <input type="radio" class="custom-control-input" name="" value="" checked disabled/>
                        <span class="custom-control-label">
                          @if($test->top_performer_status == 2)
                            No
                          @else
                            Yes
                          @endif
                        </span>
                      </label>
                    </div> 
                 </li>
                 
              </ul>
            </li>
            <li>
              <div class="test-left">
                <p>Multiple Attempt:</p>
              </div>
              <ul class="test-right">
                <li>
                  <p>Enable multiple attempt of test by a candidate</p>
                  <div class="disabled-inputs">
                    <label class="custom-control custom-radio">
                      <input type="radio" class="custom-control-input" name="" value="" checked disabled/>
                      <span class="custom-control-label">
                        @if($test->multiple_attemp_status == 2)
                          No
                        @else
                          Yes
                        @endif
                      </span>
                    </label>
                  </div>
                </li>
              </ul>
            </li>
          </ul>

          <div class="test-footer">
            <a href="{{route('admin.test_series_manager.test.setting.add', $testId)}}"><button class="btn btn-outline-primary btn-pill btn-streach font-book mt-7 fs-14">Back</button></a>
            @if($test->status == 1)
              <button class="btn btn-primary btn-streach font-book mt-7 fs-14  ml-3 finishTestBtn" data-id="{{base64_encode($test->id)}}">Finish Test</button>
            @else
              <button class="btn btn-primary btn-streach font-book mt-7 fs-14  ml-3 goToTest">Go to Test</button>
            @endif
          </div>
        </div>
      </div>
    </div>
    <!-- //Table -->
    <!--// MAIN BODY CONTENT -->
  </div>
</div>

  
@endsection
@section('scripts')
<script type="text/javascript">
  var package_id = $('#test_package_id').val();
  var status = "{{$test->status}}";
  var base_url = "{{ url('') }}";
  var link = base_url + "/admin/test_series_manager/test/list/" +package_id;
</script>
<script type="text/javascript" src="{{asset('js/test_final.js?v='.time())}}"></script> 
@endsection

