avance del registro de negocio con google mapas
This commit is contained in:
@@ -164,6 +164,10 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src='https://maps.google.com/maps/api/js?libraries=places®ion=uk&language=en&sensor=true&key={{ env("GOOGLE_MAPS_API_KEY") }}'></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
@@ -254,11 +258,12 @@
|
||||
<div class="form-group mb-4">
|
||||
<label for="categories_id" id="categoryLabel">Categoría del negocio</label>
|
||||
<select name="categories_id" class="form-control @error('categories_id') is-invalid @enderror" id="categories_id">
|
||||
<option value="" {{ old('categories_id') == '' ? 'selected' : '' }}>Seleccione una categoría</option>
|
||||
<option value="" selected>Seleccione una categoría</option>
|
||||
@foreach ($categories as $category)
|
||||
<option value="{{ $category->value }}" {{ old('categories_id', optional($category->value)) == $category->value ? 'selected' : '' }}>{{ $category->name }}</option>
|
||||
<option value="{{ $category->id }}" {{old('categories_id') == $category->id ? 'selected' : ''}}>{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
@error('categories_id')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
@@ -274,14 +279,47 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group mb-4">
|
||||
{{-- <div class="form-group mb-4">
|
||||
<label for="address" id="addressLabel">Dirección</label>
|
||||
<input type="text" name="address" id="address" placeholder="Dirección" class="form-control address @error('address') is-invalid @enderror" value="{{ old('address') }}">
|
||||
|
||||
@error('address')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div> --}}
|
||||
|
||||
|
||||
|
||||
<div class="form-group mb-60">
|
||||
|
||||
<label for="address" id="addressLabel">Buscar dirección o selecciona en el Mapa</label>
|
||||
<input class="form-control" id="searchTextField" type="text" size="50" name="address" value="{{ old('address') }}">
|
||||
|
||||
|
||||
@if ($errors->has('address'))
|
||||
<p style="font-size: 80%;" class="text-danger">{{ $errors->first('address') }}</p>
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col" style="display: none;">
|
||||
<label for="latitude">Latitude</label>
|
||||
<input name="latitude" class="form-control MapLat" value="{{ old('latitude') }}" type="text" placeholder="Latitude">
|
||||
</div>
|
||||
<div class="col" style="display: none;">
|
||||
<label for="longitude">Longitude</label>
|
||||
<input name="longitude" class="form-control MapLon" value="{{ old('longitude') }}" type="text" placeholder="Longitude">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div id="map_canvas" style="height: 350px;width: 500px;margin: 0.6em;"></div>
|
||||
|
||||
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div class="form-group mb-4">
|
||||
<div class="form-check">
|
||||
@@ -291,10 +329,7 @@
|
||||
</label>
|
||||
</div>
|
||||
@if ($errors->has('terms'))
|
||||
|
||||
{{ $errors->first('terms') }}
|
||||
<p style="font-size: 80%;" class="text-danger">{{ $errors->first('terms') }}</p>
|
||||
|
||||
<p style="font-size: 80%;" class="text-danger">{{ $errors->first('terms') }}</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -385,8 +420,8 @@
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
{{-- <script src="{{ static_asset('assets/registrocomercio/registro-form/assets/js/jquery.min.js') }}"></script> --}}
|
||||
<script src="https://code.jquery.com/jquery-3.7.0.min.js"
|
||||
integrity="sha256-2Pmvv0kuTBOenSvLm6bvfBSSHrUJ+3A7x6P5Ebd07/g=" crossorigin="anonymous"></script>
|
||||
{{-- <script src="https://code.jquery.com/jquery-3.7.0.min.js"
|
||||
integrity="sha256-2Pmvv0kuTBOenSvLm6bvfBSSHrUJ+3A7x6P5Ebd07/g=" crossorigin="anonymous"></script> --}}
|
||||
<script src="{{ static_asset('assets/registrocomercio/registro-form/assets/js/popper.min.js') }}"></script>
|
||||
<script src="{{ static_asset('assets/registrocomercio/registro-form/assets/js/bootstrap.min.js') }}"></script>
|
||||
<script src="{{ static_asset('assets/registrocomercio/registro-form/assets/js/owl.carousel.min.js') }}"></script>
|
||||
@@ -419,3 +454,90 @@
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
var lat = 18.7009047,
|
||||
lng = -70.1654584,
|
||||
latlng = new google.maps.LatLng(lat, lng),
|
||||
image = 'https://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png';
|
||||
|
||||
//zoomControl: true,
|
||||
//zoomControlOptions: google.maps.ZoomControlStyle.LARGE,
|
||||
|
||||
var mapOptions = {
|
||||
center: new google.maps.LatLng(lat, lng),
|
||||
zoom: 10,
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||||
panControl: true,
|
||||
panControlOptions: {
|
||||
position: google.maps.ControlPosition.TOP_RIGHT
|
||||
},
|
||||
zoomControl: true,
|
||||
zoomControlOptions: {
|
||||
style: google.maps.ZoomControlStyle.LARGE,
|
||||
position: google.maps.ControlPosition.TOP_left
|
||||
}
|
||||
},
|
||||
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions),
|
||||
marker = new google.maps.Marker({
|
||||
position: latlng,
|
||||
map: map,
|
||||
icon: image
|
||||
});
|
||||
|
||||
var input = document.getElementById('searchTextField');
|
||||
var autocomplete = new google.maps.places.Autocomplete(input, {
|
||||
types: ["geocode"]
|
||||
});
|
||||
|
||||
autocomplete.bindTo('bounds', map);
|
||||
var infowindow = new google.maps.InfoWindow();
|
||||
|
||||
google.maps.event.addListener(autocomplete, 'place_changed', function (event) {
|
||||
infowindow.close();
|
||||
var place = autocomplete.getPlace();
|
||||
if (place.geometry.viewport) {
|
||||
map.fitBounds(place.geometry.viewport);
|
||||
} else {
|
||||
map.setCenter(place.geometry.location);
|
||||
map.setZoom(17);
|
||||
}
|
||||
|
||||
moveMarker(place.name, place.geometry.location);
|
||||
$('.MapLat').val(place.geometry.location.lat());
|
||||
$('.MapLon').val(place.geometry.location.lng());
|
||||
});
|
||||
google.maps.event.addListener(map, 'click', function (event) {
|
||||
$('.MapLat').val(event.latLng.lat());
|
||||
$('.MapLon').val(event.latLng.lng());
|
||||
infowindow.close();
|
||||
var geocoder = new google.maps.Geocoder();
|
||||
geocoder.geocode({
|
||||
"latLng":event.latLng
|
||||
}, function (results, status) {
|
||||
console.log(results, status);
|
||||
if (status == google.maps.GeocoderStatus.OK) {
|
||||
console.log(results);
|
||||
var lat = results[0].geometry.location.lat(),
|
||||
lng = results[0].geometry.location.lng(),
|
||||
placeName = results[0].address_components[0].long_name,
|
||||
latlng = new google.maps.LatLng(lat, lng);
|
||||
|
||||
moveMarker(placeName, latlng);
|
||||
$("#searchTextField").val(results[0].formatted_address);
|
||||
$("input[name='address']").val(results[0].formatted_address);
|
||||
$("input[name='latitude']").val(latlng.lat());
|
||||
$("input[name='longitude']").val(latlng.lng());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function moveMarker(placeName, latlng) {
|
||||
marker.setIcon(image);
|
||||
marker.setPosition(latlng);
|
||||
infowindow.setContent(placeName);
|
||||
//infowindow.open(map, marker);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -78,7 +78,7 @@
|
||||
Correo verificado correctamente.
|
||||
</div>
|
||||
|
||||
@if($user->user_type == 'customer')
|
||||
{{-- @if($user->user_type == 'customer')
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('dashboard') }}";
|
||||
@@ -87,16 +87,46 @@
|
||||
@elseif($user->user_type == 'seller')
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('register.business.business_complete_index') }}";
|
||||
window.location.href = "{{ route('seller.dashboard') }}";
|
||||
}, 3000); // Cambia el valor 3000 a la cantidad de milisegundos que deseas que se redirija automáticamente
|
||||
</script>
|
||||
@elseif($user->user_type == 'repair')
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('register.workshops.workshop_complete_index') }}";
|
||||
window.location.href = "{{ route('workshop.dashboard') }}";
|
||||
}, 3000); // Cambia el valor 3000 a la cantidad de milisegundos que deseas que se redirija automáticamente
|
||||
</script>
|
||||
@endif --}}
|
||||
|
||||
|
||||
@if(auth()->check()) // Verifica si el usuario está autenticado
|
||||
@if($user->user_type == 'customer')
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('dashboard') }}";
|
||||
}, 3000); // Cambia el valor 3000 a la cantidad de milisegundos que deseas que se redirija automáticamente
|
||||
</script>
|
||||
@elseif($user->user_type == 'seller')
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('seller.dashboard') }}";
|
||||
}, 3000); // Cambia el valor 3000 a la cantidad de milisegundos que deseas que se redirija automáticamente
|
||||
</script>
|
||||
@elseif($user->user_type == 'repair')
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('workshop.dashboard') }}";
|
||||
}, 3000); // Cambia el valor 3000 a la cantidad de milisegundos que deseas que se redirija automáticamente
|
||||
</script>
|
||||
@endif
|
||||
@else
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('home') }}";
|
||||
}, 3000); // Cambia el valor 3000 a la cantidad de milisegundos que deseas que se redirija automáticamente
|
||||
</script>
|
||||
@endif
|
||||
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
@@ -96,13 +96,13 @@
|
||||
@elseif($user->user_type == 'seller')
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('register.business.business_complete_index') }}";
|
||||
window.location.href = "{{ route('seller.dashboard') }}";
|
||||
}, 3000);
|
||||
</script>
|
||||
@elseif($user->user_type == 'repair')
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('register.workshop.workshop_complete_index') }}";
|
||||
window.location.href = "{{ route('workshop.dashboard') }}";
|
||||
}, 3000);
|
||||
</script>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user