<form id="frm_update_aff" action="{{ route('affiliation.update',$affiliation->aff_id) }}" method="POST">

@method('PUT')

<div class="modal-header">

	<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
	<h4 class="modal-title">Update Author's Affiliations</h4>

</div>
<div class="modal-body">

<div class="row">
<div class="col-md-12">
	
	<input type="hidden" id="author_id" name="author_id" value="{{$affiliation->author_id}}" />

	<div id="div_aff_country" class="form-group col-lg-4 col-md-4 col-sm-4">
		<label class="control-label">Country:</label>
		<select class="form-control" id="country" name="country" onchange="GetState()">
		<option value="">Country</option>
			@foreach ($countries as $country)
			<option value="{{$country->country}}" @if(strtolower($affiliation->country) == strtolower($country->country)) selected @endif > {{$country->country}}</option>
			@endforeach
		</select>
	</div>
	
	<div  class="form-group col-lg-4 col-md-4 col-sm-4">
		<label class="control-label">State:</label>
		<select class="form-control" id="state" name="state" onchange="GetCity()">
		<option value="">State</option>
		
		@if($affiliation->country == 'United States')
			@foreach ($states as $state)
			<option value="{{$state->state}}" @if($affiliation->state == $state->state) selected @endif> {{$state->state}}</option>
			@endforeach
		@endif
		</select>
	</div>
	
	<div  class="form-group col-lg-4 col-md-4 col-sm-4">
		<label class="control-label">City:</label>
		<select class="form-control" id="city" name="city" onchange="GetInstitute()">
		<option value="">City</option>
			@foreach ($cities as $city)
			<option value="{{$city->city}}" @if($affiliation->city == $city->city) selected @endif > {{$city->city}}</option>
			@endforeach
		</select>
	</div>
	
	<div class="form-group col-lg-4 col-md-4 col-sm-4">
		<label class="control-label">Institution:</label>
		<select class="form-control" id="institution" name="institution" required="required">
		<option value="" hidden>Select Institution</option>
		@if(isset($institutions))
			@foreach ($institutions as $institution)
			<option value="{{$institution->institution_id}}" @if($affiliation->institution_id == $institution->institution_id) selected @endif > {{$institution->name}}</option>
			@endforeach
		@endif	
		</select>
	</div>
	
	<div  class="form-group col-lg-4 col-md-4 col-sm-4">
		<label class="control-label">Department:</label>
		<input type="text" id="department" name="department" class="form-control input-md" value="{{$affiliation->department}}" placeholder="Department">
	</div>

	<div  class="form-group col-lg-4 col-md-4 col-sm-4">
		<label class="control-label">Address:*</label>
		<input type="text" id="address" name="address" class="form-control input-md" value="{{$affiliation->address}}" placeholder="address">
	</div>

	<div  class="form-group col-lg-4 col-md-4 col-sm-4">
		<label class="control-label">Postal Code:</label>
		<input type="text" id="postal_code" name="postal_code" class="form-control input-md" value="{{$affiliation->postal_code}}" placeholder="Postal Code" >
	</div>

	<div  class="form-group col-lg-4 col-md-4 col-sm-4">
		<label class="control-label">Phone:</label>
		<input type="text" id="phone" name="phone" class="form-control input-md" value="{{$affiliation->phone}}" placeholder="Phone" >
	</div>

	<div  class="form-group col-lg-4 col-md-4 col-sm-4">
		<label class="control-label">Fax:</label>
		<input type="text" id="fax" name="fax" class="form-control input-md" value="{{$affiliation->fax}}" placeholder="Fax" >
	</div>

	<div  class="form-group col-lg-12 col-md-12 col-sm-12">
		<label class="control-label">Web View:*</label>
		<textarea id="web_view" name="web_view" class="form-control input-md" placeholder="Web View" >{{$affiliation->web_view}}</textarea> 
	</div>
	
</div>
</div>

<div class="modal-footer">



	<button class="btn btn-default btn-xs " type="button" onclick="show({{$affiliation->author_id}})">Back</button>
	<button class="btn btn-success btn-xs " type="button" onclick="update();">Update</button>

	<button type="button" data-dismiss="modal" class="btn btn-default pull-left">Close</button>

</div>

</form>
