
jQuery(document).ready(function ($) {
    var map = L.map('osm-map').setView([35.6892, 51.3890], 13); // Tehran coordinates
    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        maxZoom: 19,
    }).addTo(map);
    var marker;

    map.on('click', function (e) {
        if (marker) {
            map.removeLayer(marker);
        }
        marker = L.marker(e.latlng).addTo(map);
        $('#osm_location').val(e.latlng.lat + ',' + e.latlng.lng);
    });
});
