Untitled
unknown
plain_text
a year ago
6.9 kB
1
Indexable
Never
@extends('layouts.app') @section('content') <div class="container"> <div class="row justify-content-center"> <div class="col-md-8"> <div class="card"> <div class="card-header">{{ __('Register') }}</div> <div class="card-body"> <form method="POST" action="{{ route('register') }}" enctype="multipart/form-data"> @csrf <input type="hidden" id="lat" name="lat" value=""> <input type="hidden" id="lng" name="lng" value=""> <div class="row mb-3"> <label for="image" class="col-md-4 col-form-label text-md-end">{{ __('Image') }}</label> <div class="col-md-6"> <input id="image" type="file" class="form-control @error('image') is-invalid @enderror" name="image" value="{{ old('image') }}" required autocomplete="image" autofocus> @error('image') <span class="invalid-feedback" role="alert"> <strong>{{ $message }}</strong> </span> @enderror </div> </div> <div class="row mb-3"> <label for="name" class="col-md-4 col-form-label text-md-end">{{ __('Name') }}</label> <div class="col-md-6"> <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus> @error('name') <span class="invalid-feedback" role="alert"> <strong>{{ $message }}</strong> </span> @enderror </div> </div> <div class="row mb-3"> <label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label> <div class="col-md-6"> <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email"> @error('email') <span class="invalid-feedback" role="alert"> <strong>{{ $message }}</strong> </span> @enderror </div> </div> <div class="row mb-3"> <label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label> <div class="col-md-6"> <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password"> @error('password') <span class="invalid-feedback" role="alert"> <strong>{{ $message }}</strong> </span> @enderror </div> </div> <div class="row mb-3"> <label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label> <div class="col-md-6"> <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password"> </div> </div> <div style="height: 350px; background: #eee; border: 2px solid #aaa;" id="map"></div> <div class="row mb-0"> <div class="col-md-6 offset-md-4"> <button type="submit" class="btn btn-primary"> {{ __('Register') }} </button> </div> </div> </form> </div> </div> </div> </div> </div> <script src="https://unpkg.com/axios/dist/axios.min.js"></script> <script type="text/javascript"> var lat=35.699739; var lng=51.338097; console.log(document.getElementById("lat").value); if(document.getElementById("lat").value) lat=document.getElementById("lat").value; if(document.getElementById("lng").value) lng=document.getElementById("lng").value; // neshan map var myMap = new L.Map('map', { key: 'web.ef4fdf1743b2482da33dd3f5945a18b0', maptype: 'dreamy', poi: true, traffic: false, center: [lat, lng], zoom: 14 }); //add marker var stuSplit = L.latLng(lat, lng); var myMarker = new L.Marker(stuSplit, { title: 'unselected' , draggable : true, clickable: true, }) .addTo(myMap).on('dragend', (e)=>{ document.getElementById("lat").value = e.target.getLatLng().lat; document.getElementById("lng").value = e.target.getLatLng().lng; }); function geocoding() { var log = document.getElementById("log"); //getting adrress value from input tag var address = document.getElementById("address").value; //making url var url = `https://api.neshan.org/v4/geocoding?address=${address}`; console.log(url); //add your api key var params = { headers: { 'Api-Key': 'web.ef4fdf1743b2482da33dd3f5945a18b0' }, }; //sending get request axios.get(url, params) .then(data => { //using the data var lat = data.data.location.y; var lng = data.data.location.x; //logging the location document.getElementById("lat").value = lat; document.getElementById("lng").value = lng; //update marker location to address myMarker.setLatLng([lat, lng]); myMarker.bindPopup(address).openPopup(); //set map center to address myMap.flyTo([lat, lng], 15); }).catch(err => { console.log("error = " + err); log.textContent = "Nothing found"; }); } </script> @endsection