
<div class="col-md-6">

<h5>{{$text[$type]}} Form:</h5>

@if ($errors->any())
<div class="form-group col-md-12">
    <div class="alert alert-danger">
        <strong>Whoops!</strong> There were some problems with your input.<br>
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
</div>
@endif                    
<hr>
<input type="hidden" name="order_type" value="{{$type}}">
<div class="form-group col-md-12">
	<label class="control-label">{{$text[$type]}}: *</label>
	<select class="form-control" id="reprint_copies_select" name="reprint_copies_select" onchange="reprintNum()" required = 'required'>
		<option value="">Select Copies</option>
		<option value="100" @if (old('reprint_copies_select') == '100') selected @endif>100</option>
		<option value="200" @if (old('reprint_copies_select') == '200') selected @endif>200</option>
		<option value="300" @if (old('reprint_copies_select') == '300') selected @endif>300</option>
		<option value="400" @if (old('reprint_copies_select') == '400') selected @endif>400</option>
		<option value="500" @if (old('reprint_copies_select') == '500') selected @endif>500</option>
		<option value="other" @if (old('reprint_copies_select') == 'other') selected @endif >other</option>
	</select>
</div>


<div id="reprintNum" class="form-group col-md-12" @if (old('reprint_copies_select') != 'other') style="display:none;" @endif >
<label class="control-label">{{$text[$type]}}:</label>
<input type="text" maxlength="50" name="preview[reprint_copies]" id="reprint_copies" size="60" class="form-control">
@if ($errors->has('reprint_copies'))															
	<label class="control-label text-danger">{{ $errors->first('reprint_copies') }} </label>
@endif	
</div>

<div class="form-group col-md-12">
<label class="control-label">{{$field[1]}}: *</label>
 <select class="form-control" id="cover_title" name="preview[cover_title]" required = 'required'>
	<option value="Yes">Yes</option>
	<option value="No">No</option>
</select>
</div>

@if($type == 'reprint')

	<div class="form-group col-md-12">
	<label class="control-label">{{$field[2]}}:</label>
	<input type="text" maxlength="50" name="preview[color_plates]" id="color_plates" size="60"  class="form-control">
	@if ($errors->has('color_plates'))															
		<label class="control-label text-danger">{{ $errors->first('color_plates') }} </label>
	@endif	
	</div>
	<div class="form-group col-md-12">
	<label class="control-label">{{$field[3]}}:</label>
	<input type="text" maxlength="50" name="preview[no_of_figures]" id="no_of_figures" size="60" class="form-control">
	@if ($errors->has('no_of_figures'))															
		<label class="control-label text-danger">{{ $errors->first('no_of_figures') }} </label>
	@endif	
		<div class="text-info">Note: Separate with comma e.g. 1,2,5</div>
	</div>
	
@endif

<div class="form-group col-md-12">
<label class="control-label">{{$field[4]}}: *</label>
<input type="text" maxlength="50" name="preview[fname]" id="control-label" size="60"  class="form-control" required = 'required'>
@if ($errors->has('fname'))															
	<label class="control-label text-danger">{{ $errors->first('fname') }} </label>
@endif	
</div>
<div class="form-group col-md-12">
<label class="control-label">{{$field[5]}}: *</label>
<input type="text" maxlength="50" name="preview[lname]" id="lname" size="60" class="form-control" required = 'required'>
@if ($errors->has('lname'))															
	<label class="control-label text-danger">{{ $errors->first('lname') }} </label>
@endif	
</div>

<div class="form-group col-md-12" >
<label for="edit-email">{{$field[6]}}: *</label>
<input type="email" maxlength="100" name="preview[email]" id="email" size="60" class="form-control" required="required">
@if ($errors->has('email'))															
	<label class="control-label text-danger">{{ $errors->first('email') }} </label>
@endif	
</div>
<div class="form-group col-md-12">         
<label for="organization">{{$field[7]}}: *</label>
<input type="text" maxlength="200" name="preview[organization]" id="organization" size="60" class="form-control" required = 'required'>
@if ($errors->has('organization'))															
	<label class="control-label text-danger">{{ $errors->first('organization') }} </label>
@endif	
</div>

<div class="form-group col-md-12">
	<label for="edit-lname">{{$field[8]}}: *</label>
	<select class="form-control w-100" id="country" name="preview[country]"  required = 'required'>
		
		<option value="">Select Country</option>
         @foreach ($country as $countries)
            <option value="{{$countries->printable_name}}" > {{$countries->printable_name}}</option>
        @endforeach

	</select>
</div>

<div class="form-group col-md-12">
      <!--label for="password" class="col-md-4  col-form-label text-md-right">Captcha</label-->
              <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 col-md-12 text-center">
<button class="btn btn-primary" id="page" name="page" type="submit" value="preview">Preview</button>
</div>

</div>


{{-- page level scripts --}}
@section('footer_scripts')
<script>

	function reprintNum()
	{
		var reprint_copies = $('#reprint_copies_select').val();
		
		
		if(reprint_copies == 'other')
		{
			$('#reprintNum').show();
			$('#reprint_copies').attr('required', 'required');
			$('#reprint_copies').val('');
		}
		else
		{
			$('#reprintNum').hide();
			$('#reprint_copies').removeAttr('required');
			$('#reprint_copies').val(reprint_copies);
		}
	}

</script>
@stop