139 lines
5.2 KiB
JavaScript
139 lines
5.2 KiB
JavaScript
const bounds = [
|
|
[42.9130026312, 75.6166317076],
|
|
[20.5782370061, 30.5092252948],
|
|
];
|
|
var map = L.map("map", {
|
|
maxBounds: bounds,
|
|
minZoom: 9,
|
|
}).setView([35.5468992, 51.7300532], 5);
|
|
|
|
|
|
|
|
|
|
var url_root = "https://rms.rmto.ir/";
|
|
$(document).ready(function () {
|
|
L.tileLayer("https://rmsmap.rmto.ir/141map/{z}/{x}/{y}.png", {
|
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
|
}).addTo(map);
|
|
|
|
L.marker([35.7093552, 51.4049619])
|
|
.addTo(map)
|
|
.bindPopup("<b>سامانه جامع راهداری </b>")
|
|
.openPopup();
|
|
var popup = L.popup();
|
|
|
|
$(".btn-content-right").on("click", function () {
|
|
if ($(this).attr("set") == "send-btn") {
|
|
$(".track-messages").fadeOut(100);
|
|
$(".send-Message").fadeIn(100);
|
|
} else if ($(this).attr("set") == "follow-up-btn") {
|
|
$(".track-messages").fadeIn(100);
|
|
$(".send-Message").fadeOut(100);
|
|
}
|
|
setTimeout(() => {
|
|
if ($(".track-messages").css("display") == "none") {
|
|
$("#pooria2").addClass("active");
|
|
$("#pooria1").removeClass("active");
|
|
}
|
|
if ($(".send-Message").css("display") == "none") {
|
|
$("#pooria1").addClass("active");
|
|
$("#pooria2").removeClass("active");
|
|
}
|
|
}, 150);
|
|
});
|
|
$(".btn-handel-Follow ").on("click", function () {
|
|
$("[forse=true]").each(function (index, element) {
|
|
if ($(element).val().trim().length <= 0) {
|
|
$(element).addClass("is-invalid");
|
|
} else {
|
|
$(element).removeClass("is-invalid");
|
|
}
|
|
});
|
|
if (!$(".track-messages").find(".is-invalid").length) {
|
|
$.ajax({
|
|
url: url_root + "contactus-review",
|
|
type: "POST",
|
|
headers: {
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
|
},
|
|
data: {
|
|
id: $("input[name=code]").val(),
|
|
c_phone: $("input[name=phone]").val(),
|
|
},
|
|
success: function (data) {
|
|
console.log(data);
|
|
$("input[name=code]").val("");
|
|
$("input[name=phone]").val("");
|
|
$("input[name=captcha]").val("");
|
|
if (data.admin_response == 0) {
|
|
Swal.fire({
|
|
icon: "question",
|
|
text: `اطلاعات وارد شده یافت نشد`,
|
|
confirmButtonText: "بستن ",
|
|
});
|
|
}
|
|
else if (data.admin_response == null) {
|
|
Swal.fire({
|
|
icon: "question",
|
|
text: `پاسخی یافت نشد `,
|
|
confirmButtonText: "بستن ",
|
|
});
|
|
}
|
|
else {
|
|
Swal.fire({
|
|
icon: "success",
|
|
text: `${data.admin_response}`,
|
|
confirmButtonText: "بستن ",
|
|
});
|
|
}
|
|
},
|
|
error: function (er) {
|
|
console.log(er);
|
|
},
|
|
});
|
|
}
|
|
});
|
|
|
|
$(".btn-send").on("click", function () {
|
|
$("[forse-messege=true]").each(function (index, element) {
|
|
if ($(element).val().trim().length <= 0) {
|
|
$(element).addClass("is-invalid");
|
|
} else {
|
|
$(element).removeClass("is-invalid");
|
|
}
|
|
});
|
|
if (!$(".send-Message").find(".is-invalid").length) {
|
|
//ajax
|
|
$.ajax({
|
|
url: url_root + "contactus-submit",
|
|
type: "POST",
|
|
headers: {
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
|
},
|
|
data: {
|
|
c_name: $("input[name=username]").val(),
|
|
c_phone: $("input[name=phonenumber]").val(),
|
|
c_title: $("input[name=title]").val(),
|
|
c_describe: $("textarea[name=content]").val(),
|
|
},
|
|
success: function (data) {
|
|
console.log(data);
|
|
$("input[name=username]").val("");
|
|
$("input[name=phonenumber]").val("");
|
|
$("input[name=title]").val("");
|
|
$("textarea[name=content]").val("");
|
|
$("input[name=captcha]").val("");
|
|
Swal.fire({
|
|
icon: "success",
|
|
text: `کد پیگیری (${data.id})`,
|
|
confirmButtonText: "بستن ",
|
|
|
|
});
|
|
},
|
|
error: function (er) {
|
|
console.log(er);
|
|
},
|
|
});
|
|
}
|
|
});
|
|
}); |