$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
}
});
$(document).on("click", ".map-item.active", function (e) {
e.preventDefault();
let _that = $(this),
map = $(".map-section__main svg"),
map_text = $(".map-section__main__text"),
_this_left = _that.position().left - map.position().left - map_text.width() / 2 + 50,
_this_top = _that.position().top - map.position().top - map_text.height() - 10;
if (_this_left > 230 && $(window).width() < 500) {
_this_left = 220
}
$.ajax({
url: "https://arggroup.az/search-region",
type: 'POST',
data: {slug: _that.attr('id')},
success: function (res) {
let _this_data = res.html;
map_text.removeClass('show');
map_text.html(_this_data);
map_text.addClass("show").css("left", _this_left + "px").css("top", _this_top + "px");
$(".map-item").removeClass("selected");
_that.addClass("selected");
}
});
});
$(".region-input").on('change', function (e) {
e.preventDefault();
var _that = $(this);
});
$(document).on('keyup', '#shops_search', function (e) {
e.preventDefault();
var _that = $(this);
if (_that.val().length > 2) {
$('.shops__result__list__clickable').each(function () {
var _shop = $(this)
if (!$(this).text().toLowerCase().includes(_that.val().toLowerCase())) {
_shop.addClass('d-none');
} else {
_shop.removeClass('d-none');
}
});
}
});
setTimeout(function () {
$('html').removeClass('no-smooth');
}, 2000);