@extends('layout.app')


@section('content')
   <!-- Content Wrapper. Contains page content -->
   <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0">Questions</h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li>
              <li class="breadcrumb-item active">Add Question</li>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

    <!-- Main content -->
    <div class="content">
      <div class="container-fluid">
          <div class="row">
               <div class="col-12">
                    <!-- Row Start -->
                    @if (count($errors) > 0)
                        <div class="alert alert-danger">
                            <strong>Whoops!</strong> There were some problems with your input.<br><br>
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif

                    <div class="row">
                        <div class="col-md-12">
                            <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">Add Question</h3>
              </div>
              <!-- /.card-header -->
              <!-- form start -->
              <form method="POST" name="question-form" 
              action="{{ route('question.store')}}">
                @csrf
                <div class="card-body">
                  <div class="row">
                    <div class="col-md-6">
                      <div class="form-group">
                       <label for="exampleInputEmail1">Category</label>
                        <select name="category" class="form-control" required>
                          <option value="">Choose Category</option>
                          @foreach($category as $key=>$val)
                            <option value="{{$val->id}}">{{$val->name}}</option>
                          @endforeach
                        </select>
                      </div>
                    </div>
                    <div class="col-md-6">
                      
                      <div class="form-group">
                        <label for="exampleInputEmail1">Question</label>
                        <input type="text" class="form-control" name="question" id="categoryinput" placeholder="Enter Question">
                      </div>
                    </div>
                  </div>
                  <div class="row">
                    <div class="col-md-12">
                        <div class="form-group">
                          <label for="exampleInputEmail1">Choices:</label>
                        </div>
                    </div>
                  </div>  
                  <hr/>
                  <div class="row">
                    <div class="col-md-6">
                            <div class="form-group">
                              <label for="exampleInputEmail1">Choices 1:</label>
                              <input type="text" name="choice[1]" class="form-control">
                            </div>
                            <div class="form-group">
                              <label for="exampleInputEmail1">Is Correct:</label>
                              <input type="radio" name="is_correct[1]" value="1"> Yes
                              <input type="radio" name="is_correct[1]" value="0" checked> No
                            </div>
                            <hr style="border: dashed solid 1px;" />
                    </div>
                    <div class="col-md-6">
                             <div class="form-group">
                                <label for="exampleInputEmail1">Choices 2:</label>
                                <input type="text" name="choice[2]" class="form-control">
                              </div>
                              <div class="form-group">
                                <label for="exampleInputEmail1">Is Correct:</label>
                                <input type="radio" name="is_correct[2]" value="1"> Yes
                                <input type="radio" name="is_correct[2]" value="0" checked> No
                              </div>
                              <hr style="border: dashed solid 1px;" />
                    </div>
                  </div>  
                  <div class="row">
                    <div class="col-md-6">
                             <div class="form-group">
                                <label for="exampleInputEmail1">Choices 3:</label>
                                <input type="text" name="choice[3]" class="form-control">
                              </div>
                              <div class="form-group">
                                <label for="exampleInputEmail1">Is Correct:</label>
                                <input type="radio" name="is_correct[3]" value="1"> Yes
                                <input type="radio" name="is_correct[3]" value="0" checked> No
                              </div>
                              <hr style="border: dashed solid 1px;" />

                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                          <label for="exampleInputEmail1">Choices 4:</label>
                          <input type="text" name="choice[4]" class="form-control">
                        </div>
                        <div class="form-group">
                          <label for="exampleInputEmail1">Is Correct:</label>
                          <input type="radio" name="is_correct[4]" value="1"> Yes
                          <input type="radio" name="is_correct[4]" value="0" checked> No
                        </div>
                        <hr style="border: dashed solid 1px;" />
                    </div>
                  </div>  
                 
                  
                </div>
                <!-- /.card-body -->

                <div class="card-footer">
                  <button type="submit" class="btn btn-primary">Submit</button>
                </div>
              </form>
            </div>
                        </div>
                    </div>
                   
                    <!-- Row End -->
                </div>
           </div>
       </div>
    </div>   
     <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
        


@endsection
