<div class="row">      
        <div class="col-12">          
          <h2 class="h2">Trial Requests</h2>
          <hr>
        </div>

      
  <div class="col-12">

        @if ($errors->any())
        <div class="alert alert-danger">
        <ul>
          @foreach ($errors->all() as $error)
              <li>{{ $error }}</li>
          @endforeach
        </ul>
        </div>
        @endif

        @if ($message = Session::get('success'))
            <div class="alert alert-success alert-dismissable">
                <p>{!! $message !!}</p>
            </div>
        @endif

    <div class="card">
      <div class="card-body">
        
      
      <form name="first" method="post" action="{{ route('trial_requests') }}" enctype="multipart/form-data">
      <input type="hidden" name="_token" value="<?=csrf_token()?>">

          <div class="form-group">
              <label class="control-label" for="select21">Journal: *</label>
              <select class="form-control select2" id="journal_id" name="journal_id" required>
                  <option selected="true" value="" disabled="disabled" hidden>Select Journal:</option>
                  @foreach($journal_search as $key => $value)
                          <option value="{{ $key }}" {{ old('journal_id', $journal_id) == $key ? 'selected' : '' }}>{{ $value }}</option>
                  @endforeach 
              </select>
          </div>
        
            <h5 class="border-bottom pb-2 mt-5 mb-4">Institution Contact Details</h5>

          <div class="form-row">
            <div class="form-group col-md-6">
            <label>Institutional Contact: *</label>
            <input type="text" name="institutional_contact" class="form-control" required = 'required' value="{{ old('institutional_contact') }}"/>
          </div>         
            <div class="form-group col-md-6">
            <label>Institution Name: *</label>
            <input type="text" name="institution_name" class="form-control" required = 'required' value="{{ old('institution_name') }}" />
          </div>
        </div>
        <div class="form-row">
          <div class="form-group col-md-6">
            <label>Institution IP(s): *:</label>
            <input type="text" name="institution_ips" class="form-control" required = 'required' value="{{ old('institution_ips') }}" />
          </div>
          <div class="form-group col-md-6">
            <label>Institution Address: *</label>
            <textarea placeholder="Write something here..." name="institution_address" class="form-control resize_vertical " data-autogrow="" rows="3" cols="80" required = 'required'>{{ old('institution_address') }}</textarea>
          </div>
        </div>
        <div class="form-row">
          <div class="form-group col-md-6">
            <label>Institution Country: *</label>
             <select class="form-control" id="institution_country" name="institution_country" required = 'required'>
                <option value="">Country</option>
             @foreach ($country as $countries)
                <option value="{{$countries->printable_name}}" {{ (Request::old("institution_country") == $countries->printable_name ? "selected":"") }}> {{$countries->printable_name}}</option>
            @endforeach
            </select>
          </div>
          <div class="form-group col-md-6">
            <label>Institution Email: *</label>
            <input type="email" name="institution_email" class="form-control" required = 'required' value="{{ old('institution_email') }}" />
          </div>
        </div>
          <div class="form-row">
            <div class="form-group col-md-6">
            <label>Institution Phone:</label>
            <input type="text" name="institution_phone" class="form-control" value="{{ old('institution_phone') }}" />
            </div>
          <div class="form-group col-md-6">
            <label>Institution Fax:</label>
            <input type="text" name="institution_fax" class="form-control" value="{{ old('institution_fax') }}" />
          </div> 
        </div> 
            <h5 class="border-bottom pb-2 mt-5 mb-4">Contact Information</h5>
        <div class="form-row">
            <div class="form-group col-md-4">
            <label>Title: *</label>
             <select class="form-control" id="salutation" name="salutation" required = 'required'>
                <option value="Mr." {{ (Request::old("salutation") == 'Mr.'? "selected":"") }}>Mr</option>
                <option value="Mrs." {{ (Request::old("salutation") == 'Mrs.'? "selected":"") }}>Mrs</option>
                <option value="Ms." {{ (Request::old("salutation") == 'Ms.'? "selected":"") }}>Ms</option>
                <option value="Prof." {{ (Request::old("salutation") == 'Prof.'? "selected":"") }}>Prof</option>
                <option value="Dr." {{ (Request::old("salutation") == 'Dr.'? "selected":"") }}>Dr</option>
            </select>
          </div>
                    
            <div class="form-group col-md-4">
            <label>First Name:</label>            
            <input type="text" name="first_name" class="form-control" required = 'required' value="{{ old('first_name') }}" />
            </div>
            <div class="form-group col-md-4">
            <label>Last Name: *</label>
            <input type="text" name="last_name" class="form-control" required = 'required' value="{{ old('last_name') }}" />
          </div>
         </div>

        <div class="form-row">
          <div class="form-group col-md-4">
            <label>User Category: *</label>
             <select class="form-control" id="usercat" name="usercat" required = 'required'>
                <option value="">--Please select--</option>
                <option value="Professor" {{ (Request::old("usercat") == 'Professor'? "selected":"") }}>Professor</option>
                <option value="Student" {{ (Request::old("usercat") == 'Student'? "selected":"") }}>Student</option>
                <option value="Researcher" {{ (Request::old("usercat") == 'Researcher'? "selected":"") }}>Researcher</option>
                <option value="Medical professional/Practitioner"  {{ (Request::old("usercat") == 'Medical professional/Practitioner'? "selected":"") }}>Medical professional/Practitioner</option>
                <option value="Other" {{ (Request::old("usercat") == 'Other'? "selected":"") }}>Other</option>
            </select>
          </div>
        
        <div class="form-group col-md-4">
            <label>Address: *</label>
            <textarea name="address" placeholder="Write something here..." class="form-control resize_vertical " data-autogrow="" rows="3" cols="80" required = 'required'>{{ old('address') }}</textarea>
        </div>
      
        <div class="form-group col-md-4">
            <label>City/Town: *</label>
            <input type="text" name="city" class="form-control" required = 'required' value="{{ old('city') }}" />
        </div>
        </div>
        
      <div class="form-row">
        <div class="form-group col-md-4">
            <label>Country: *</label>
             <select class="form-control" id="country" name="country" required = 'required'>
                <option value="">Country</option>
             @foreach ($country as $countries)
                <option value="{{$countries->printable_name}}"  {{ (Request::old("country") == $countries->printable_name ? "selected":"") }}> {{$countries->printable_name}}</option>
            @endforeach
            </select>
        </div>
     
        <div class="form-group col-md-4">
            <label>State/Province:</label>
            <input type="text" name="state" class="form-control" value="{{ old('state') }}" />
        </div>
        <div class="form-group col-md-4">
            <label>ZIP/Postal code:</label>
            <input type="text" name="zip" class="form-control" value="{{ old('zip') }}" />
       </div>
      </div>
        
      <div class="form-row">
        <div class="form-group col-md-4">    
            <label>E-mail: *</label>
            <input type="email" name="email" class="form-control" required = 'required' value="{{ old('email') }}" />
        </div>
        <div class="form-group col-md-4">
            <label>Phone</label>
            <input type="text" name="phone" class="form-control" value="{{ old('phone') }}" />
        </div>
        <div class="form-group col-md-4">
            <label>Fax:</label>
            <input type="text" name="fax" class="form-control" value="{{ old('fax') }}" />
          </div>
      </div>

      <div class="form-group text-center">          <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>

          <div class="form-group text-center border-top pt-3">
            <input class="btn btn-dark col-md-2" type="submit" name="submit" />
          </div>

       
  </form>
        </div>
</div>  
</div>
    </div>