Anons79 Mini Shell

Directory : /home/aplikasiposinfo/.trash/resources/views/lokasi-kerja/
Upload File :
Current File : /home/aplikasiposinfo/.trash/resources/views/lokasi-kerja/form.blade.php

<div class="form-group">
    <label for="nama_lokasi">Nama</label>
    <input type="text" class="form-control" placeholder="Nama..." name="nama_lokasi" id="nama_lokasi" value="{{ old('nama_lokasi',@$data->nama_lokasi) }}" required>
    @error('nama_lokasi')
        <div class="invalid-feedback show" role="alert">
            {{ $message }}
        </div>
    @enderror
</div>


<div class="form-group">
    <label for="keterangan_lokasi">Keterangan Lokasi</label>
    <textarea name="keterangan_lokasi" id="keterangan_lokasi" class="form-control" cols="30" rows="10" placeholder="Keterangan Lokasi">{{ old('keterangan_lokasi',@$data->keterangan_lokasi) }}</textarea>
    @error('keterangan_lokasi')
        <div class="invalid-feedback show" role="alert">
            {{ $message }}
        </div>
    @enderror
</div>



<div class="form-group">
    <input type="text" name="latitude" id="latitude" value="{{ @$data->latitude }}" class="form-control" placeholder="Latitude" required>
    @error('latitude')
        <div class="invalid-feedback show" role="alert">
            {{ $message }}
        </div>
    @enderror
    <input type="text" name="longitude" id="longitude" value="{{ @$data->longitude }}" class="form-control" placeholder="Longitude" required>
    @error('longitude')
        <div class="invalid-feedback show" role="alert">
            {{ $message }}
        </div>
    @enderror
    <label for="map">Koordinat Lokasi</label>
    <div id="map"></div>
    
    
</div>





@push('styles')
    <link href="https://api.mapbox.com/mapbox-gl-js/v2.7.0/mapbox-gl.css" rel="stylesheet">
    <link rel="stylesheet" href="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v5.0.0/mapbox-gl-geocoder.css" type="text/css">
    <style>
        #map { 
            width: 100%; 
            height: 500px;
        }
    </style>
@endpush

@push('scripts')
    <script src="https://api.mapbox.com/mapbox-gl-js/v2.7.0/mapbox-gl.js"></script>
    <script src="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v5.0.0/mapbox-gl-geocoder.min.js"></script>
    <script src='https://unpkg.com/@turf/turf@6/turf.min.js'></script>
    <script>
        let coordinate = [117.13849920377697,-0.49960603702142237];
        var radius = $('#radius').val();
        var options = {steps: 50, units: 'meters'};

        mapboxgl.accessToken = 'pk.eyJ1IjoiYmFndXNpbmRyYXlhbmEiLCJhIjoiY2p0dHMxN2ZhMWV5bjRlbnNwdGY4MHFuNSJ9.0j5UAU7dprNjZrouWnoJyg';
            const map = new mapboxgl.Map({
            container: 'map',
            style: 'mapbox://styles/mapbox/streets-v11',
            center: coordinate,
            zoom: 13
        });

        

        // Add the control to the map.
        map.addControl(
            new MapboxGeocoder({
                accessToken: mapboxgl.accessToken,
                mapboxgl: mapboxgl
            })
        );

        let marker = null;
        map.on('click',(e) => {
            coordinate = [e.lngLat.lng, e.lngLat.lat];
            if(marker){
                marker.setLngLat(e.lngLat);
            } else {
                marker = new mapboxgl.Marker();
                marker.setLngLat(e.lngLat).addTo(map);
            }

            $("#latitude").val(e.lngLat.lat);
            $("#longitude").val(e.lngLat.lng);

            
        });

    


        $(document).ready(function(){
            cekWaktuKerja();
            $(document).on('change','#waktu-kerja',function(){
                cekWaktuKerja();
            });

            function cekWaktuKerja(){
                if($('#waktu-kerja').is(':checked')){
                    $('.waktu-kerja').removeAttr('disabled');
                }else{
                    $('.waktu-kerja').attr('disabled',true);
                }
            }
        });
    </script>
    
    @php
        $latitude = old('latitude',@$data->latitude);
        $longitude = old('longitude',@$data->longitude);
    @endphp
    @if ($latitude && $longitude)
        <script>
            coordinate = [{{ $longitude }},{{ $latitude }}];
            map.on('load', function(){
                map.setZoom(15);
                map.setCenter(coordinate);
                marker = new mapboxgl.Marker();
                marker.setLngLat(coordinate).addTo(map);
  
            });
            
        </script>
    @endif
@endpush

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]