Created
February 14, 2020 10:54
-
-
Save lstables/bb0aa2f35761ffaff18b3eafee4c8330 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@section('content') | |
<h4>Address:</h4> | |
<div class="row"> | |
<div class="col-md-12"> | |
<div class="form-group"> | |
<label class="label-control" for="postcode">Search for address</label> | |
<input type="text" class="form-control" id="form-address" name="address"> | |
</div> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-xs-12 col-md-6"> | |
<label class="label-control" for="form-county">House No & Street</label> | |
<input type="text" class="form-control" id="form-street" name="street"> | |
</div> | |
<div class="col-xs-12 col-md-6"> | |
<label class="label-control" for="form-county">Town</label> | |
<input type="text" class="form-control" id="form-county" name="town"> | |
</div> | |
<div class="col-xs-12 col-md-6"> | |
<label class="label-control" for="form-city">City</label> | |
<input type="text" class="form-control" id="form-city" name="city"> | |
</div> | |
<div class="col-xs-12 col-md-6"> | |
<label class="label-control" for="form-zip">Postcode</label> | |
<input type="text" class="form-control" id="form-zip" name="postcode"> | |
</div> | |
</div> | |
<div class="mt-3"> | |
<button type="submit" class="btn btn-primary">Update Details</button> | |
</div> | |
@if ($company->isAgency()) | |
<a class="btn btn-sm btn-danger float-right" href="{{ route('company.transfer', user()->companies->first()->id) }}"><i class="fa fa-exchange fa-fw"></i> Transfer Ownership</a> | |
@endif | |
</form> | |
</div> | |
</div> | |
@endsection | |
@push('scripts') | |
<script src="https://cdn.jsdelivr.net/npm/places.js@1.17.1"></script> | |
<script> | |
(function() { | |
let placesAutocomplete = places({ | |
appId: 'plGI7NP6RD90', | |
apiKey: 'e7ef0a66fca5184686e136bb67c392f8', | |
container: document.querySelector('#form-address'), | |
templates: { | |
value: function(suggestion) { | |
return suggestion.name; | |
} | |
} | |
}).configure({ | |
type: 'address' | |
}); | |
placesAutocomplete.on('change', function resultSelected(e) { | |
document.querySelector('#form-street').value = e.suggestion.administrative || ''; | |
document.querySelector('#form-city').value = e.suggestion.city || ''; | |
document.querySelector('#form-zip').value = e.suggestion.postcode || ''; | |
}); | |
})(); | |
</script> | |
@endpush |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment