@extends('layouts.app')
@section('title')
User Feedback
@parent
@stop
@section('content')

  <main>
    
    <section>
      <div class="container">
        <div class="row">
                 
                  <div class="col-12">          
					 <h2 class="h4">Author Feedback Form</h2>
		 
		 <hr>
		 
					
					<div class="card bigbox-hvr-slow">
<div class="card-body">
				  
				  
<div class="col-md-12 fieldset-border">		

		@if (Session::has('error'))

	     <div class="alert alert-danger alert-dismissible fade show" data-auto-dismiss="5000" role="alert">

	      <b>Thank You </b>{{ Session::get('error') }}

	         <button type="button" class="close" data-dismiss="alert" aria-label="Close">

	          <span aria-hidden="true">&times;</span>

	        </button>

	      </div>

		@endif

		@if(isset($message))
			<hr>
		<div class="alert alert-success">
		
		  <strong>Thank You </strong> 
			<br>
			We appreciate you taking the time to fill out the Feedback Form.<br> 
		</div>
		@endif	

@if(isset($article))

		<form method="POST" action="{{ url('feedback/') }}">
		    @csrf
		 <hr>
		<div class="form-row">
			<div class="form-group col-md-6 border-bottom">
				<label class="control-label"><strong>Name:</strong></label>
				Dr. {!! $article->author !!}
				<input type="hidden" name="author_id" value="{{$article->author_id}}">
			</div>

			<div class="form-group  col-md-6 border-bottom">
				<label class="control-label"><strong>Email:</strong></label>
				{{$article->email}}
			</div>

			<div class="form-group col-md-6 border-bottom">
				<label class="control-label"><strong>Journal:</strong></label>
				{!! $article->journal_title !!}
				<input type="hidden" name="journal_id" value="{{$article->journal_id}}">
			</div>

			<div class="form-group  col-md-6 border-bottom">
				<label class="control-label"><strong>Article:</strong></label>
				{!! $article->article_title !!}
				<input type="hidden" name="article_id" value="{{$article->article_id}}">
			</div>

			<div class="form-group col-md-6 border-bottom pb-1 border-right">
				<p><strong>How would you rate your experience of publishing your article in this journal?<span class="text-danger">*</span></strong></p>
				<div class="row px-4">
					<div class="col-md-3">
					  <input class="form-check-input" type="radio"  name="experience" id="experience1" value="1" aria-label="..." @if(old('experience') == 1) checked="true" @endif>
					  <label class="form-check-label" for="inlineRadio1">Excellent</label>
					</div>
					<div class="col-md-3">
					  <input class="form-check-input" type="radio"  name="experience" id="experience2" value="2" aria-label="..." @if(old('experience') == 2) checked="true" @endif>
					  <label class="form-check-label" for="inlineRadio2">Good</label>
					</div>
					<div class="col-md-3">
					  <input class="form-check-input" type="radio" name="experience" id="experience3" value="3" aria-label="..." @if(old('experience') == 3) checked="true" @endif>
					  <label class="form-check-label" for="inlineRadio2">Average</label>
					</div>
					<div class="col-md-3">
					  <input class="form-check-input" type="radio" name="experience" id="experience4" value="0" aria-label="..." @if(old('experience') == 0) checked="true" @endif>
					  <label class="form-check-label" for="inlineRadio2">Not Good</label>
					</div>
				</div>
				@if ($errors->has('experience')) 
					<label class="text-danger">The field is required.</label>
				@endif
			</div>

			

			<div class="form-group col-md-6 border-bottom pb-1">
				<p><strong>How satisfied are you with our communications, services and assistance?</strong></p>
				<div class="row px-4">
				<div class="col-md-4">
				  <input class="form-check-input" type="radio" name="services" id="services1" value="1" aria-label="..." @if(old('services') == 1) checked="true" @endif>
				  <label class="form-check-label" for="inlineRadio1">Very satisfied</label>
				</div>
				<div class="col-md-4">
				  <input class="form-check-input" type="radio" name="services" id="services2" value="2" aria-label="..." @if(old('services') == 2) checked="true" @endif>
				  <label class="form-check-label" for="inlineRadio2">Somewhat satisfied</label>
				</div>
				<div class="col-md-4">
				  <input class="form-check-input" type="radio" name="services" id="services3" value="0" aria-label="..." @if(old('services') == 0) checked="true" @endif>
				  <label class="form-check-label" for="inlineRadio2">Not satisfied</label>
				</div>
			</div>
				@if ($errors->has('services')) 
					<label class="text-danger">The field is required.</label>
				@endif
			</div>
		</div>
			<div class="form-group pb-2 border-bottom">
				<label class="control-label"><strong>Please suggest how we can improve our services.</strong></label>
				<textarea cols="60" rows="3" name="improvement" class="form-control">{{ old('improvement') }}</textarea>
				
			</div>
			
			<div class="form-group col-md-12">

          <div class="form-group row mt-3 w-100"> 
                
                  <div class="col-auto mx-auto w-100 d-flex ">
                      <div class="col-md-6 text-right">
                          <div class="captcha">                                       
                              <span>{!! captcha_img() !!}</span>             
                          </div>
                      </div>
                      <div class="col-md-6">                                        
                          <button type="button" class="btn btn-danger" class="refresh-captcha" id="refresh-captcha">
                              &#x21bb;
                          </button> 
                      </div>
                  </div>
                  <div class="form-group my-2 mx-auto">
                      <input id="captcha" type="text" class="form-control" placeholder="Enter Captcha" name="captcha">
                      @if ($errors->has('captcha'))
                        <span class="invalid-feedback" style="display: block;">
                            <strong>{{ $errors->first('captcha') }}</strong>
                        </span>
                    @endif
                  </div>
          </div>

			<div class="form-group col-md-12 text-center">
				<input class="btn btn-primary" name="submit_lot" type="submit" value="Submit Your Feedback">
			</div>
			
		</div>
		
   
		</form>		

@endif
	<script>
      radiobutton = document.getElementById("experience1");
      radiobutton.checked = true;
      radiobutton = document.getElementById("services1");
      radiobutton.checked = true;
   </script>

	  </div>
	  
	</div>
				
        </div>
					
	  </div>
         
      
      </div>
         
     </div>
    </section>
    
  </main>
  
  <!----Main Section Ends----> 

@endsection
