function hemen_basla() {
var a = $("#vasita").val();
0 == $(".select-index li").hasClass("cs-selected") ? sweet_alert("Uyarı", "Lütfen vasıta seçiniz.", "error") : (location.href = "parca-talebi/?vasita=" + a);
}
function hemen_basla_2() {
var a = $("#vasita_2").val();
0 == $(".select-index li").hasClass("cs-selected") ? sweet_alert("Uyarı", "Lütfen vasıta seçiniz.", "error") : (location.href = "lastik-talebi/?vasita=" + a);
}
function parca_talep_vasita_marka_getir(a, e) {
$.post("ajax/ajax.php", { islem: "parca_talep_vasita_marka_getir", p_vasita_id: a, p_marka_id: e }, function (a) {
$("#marka-load").html(a), $(".selectpicker").selectpicker();
});
}
function talep_model_getir(a) {
$.post("ajax/ajax.php", { islem: "talep_model_getir", p_marka_id: a }, function (a) {
$(".model-ss").val(""), $(".model-ss").addClass("display-none-1"), $("#model-load").html(a), $(".selectpicker").selectpicker();
});
}
function talep_ilce_getir(a, e) {
$.post("ajax/ajax.php", { islem: "talep_ilce_getir", p_il_id: a, p_ilce_id: e }, function (a) {
$("#ilce-load").html(a), $(".selectpicker").selectpicker();
});
}
function talep_olustur() {
$("#button").css("pointer-events", "none"),
$("#button").attr("disabled", !0),
$("#button-text").html("Lütfen bekleyiniz..."),
$.ajax({
type: "POST",
url: "ajax/ajax.php",
data: $("#request-form").serialize() + "&islem=talep_olustur",
dataType: "HTML",
success: function (a) {
if (($("#button").css("pointer-events", "auto"), $("#button").attr("disabled", !1), $("#button-text").html("Talep Oluştur"), 1 == a))
sweet_alert("Uyarı", "T.C. kimlik numaranızı eksik girdiniz.", "error"), $("#tc-kimlik-no").css("border-color", "#f00");
else if (2 == a) sweet_alert("Uyarı", "T.C. kimlik numaranızı hatalı girdiniz.", "error"), $("#tc-kimlik-no").css("border-color", "#f00");
else if (3 == a) sweet_alert("Uyarı", "E-Posta adresinizi hatalı girdiniz.", "error"), $("#tc-kimlik-no").removeAttr("style"), $("#e-posta-adres").css("border-color", "#f00");
else if (4 == a) sweet_alert("Uyarı", "Cep telefon numaranızı eksik girdiniz.", "error"), $("#tc-kimlik-no").removeAttr("style"), $("#e-posta-adres").removeAttr("style"), $("#cep-telefon-no").css("border-color", "#f00");
else if (5 == a)
sweet_alert("Uyarı", "Sabit telefon numaranızı eksik girdiniz.", "error"),
$("#tc-kimlik-no").removeAttr("style"),
$("#e-posta-adres").removeAttr("style"),
$("#cep-telefon-no").removeAttr("style"),
$("#sabit-telefon-no").css("border-color", "#f00");
else if (6 == a) sweet_alert("Uyarı", 'Girdiğiniz bilgilere ait üyelik kaydı bulundu.
Lütfen önce üye girişi yapın daha sonra
parça talebinde bulunun.', "error");
else {
$("#tc-kimlik-no").removeAttr("style"),
$("#e-posta-adres").removeAttr("style"),
$("#cep-telefon-no").removeAttr("style"),
$("#sabit-telefon-no").removeAttr("style"),
$("#button").css("pointer-events", "none"),
$("#button").attr("disabled", !0),
$("#button-text").html("Lütfen bekleyiniz...");
var e = new FormData();
"" != $("#urun-resmi-1").val() && e.append("resim_0", document.getElementById("urun-resmi-1").files[0]),
"" != $("#urun-resmi-2").val() && e.append("resim_1", document.getElementById("urun-resmi-2").files[0]),
e.append("islem", "talep_resim_ekle"),
e.append("talep", a),
$.ajax({ url: "ajax/ajax.php", type: "POST", data: e, contentType: !1, cache: !1, processData: !1, mimeType: "multipart/form-data" }).done(function (a) {
1 == a
? ($("#button").css("pointer-events", "auto"), $("#button").attr("disabled", !1), $("#button-text").html("Talep Oluştur"), sweet_alert("Uyarı", "Resim ekleme işleminizde hata oluştu.", "error"))
: $.post("ajax/ajax.php", { islem: "parca_talep_e_posta_gonder" }, function (a) {
swal({
title: "Başarılı!",
html: "Talep oluşturma işleminiz başarılı bir şekilde gerçekleşmiştir. Parça satan firmalar talebinize teklif te bulunabileceklerdir.!",
type: "success",
allowOutsideClick: !1,
allowEscapeKey: !1,
showCancelButton: !1,
confirmButtonColor: "#3085d6",
confirmButtonText: "Tamam",
cancelButtonText: "Giriş Yap"
}).then(function () {
location.reload();
});
});
});
console.log(a);
}
},
});
}
function lastik_talep_olustur() {
$("#button").css("pointer-events", "none"),
$("#button").attr("disabled", !0),
$("#button-text").html("Lütfen bekleyiniz..."),
$.ajax({
type: "POST",
url: "ajax/ajax.php",
data: $("#request-form").serialize() + "&islem=lastik_talep_olustur",
dataType: "HTML",
success: function (a) {
$("#button").css("pointer-events", "auto"),
$("#button").attr("disabled", !1),
$("#button-text").html("Talep Oluştur"),
1 == a
? (sweet_alert("Uyarı", "T.C. kimlik numaranızı eksik girdiniz.", "error"), $("#tc-kimlik-no").css("border-color", "#f00"))
: 2 == a
? (sweet_alert("Uyarı", "T.C. kimlik numaranızı hatalı girdiniz.", "error"), $("#tc-kimlik-no").css("border-color", "#f00"))
: 3 == a
? (sweet_alert("Uyarı", "E-Posta adresinizi hatalı girdiniz.", "error"), $("#tc-kimlik-no").removeAttr("style"), $("#e-posta-adres").css("border-color", "#f00"))
: 4 == a
? (sweet_alert("Uyarı", "Cep telefon numaranızı eksik girdiniz.", "error"), $("#tc-kimlik-no").removeAttr("style"), $("#e-posta-adres").removeAttr("style"), $("#cep-telefon-no").css("border-color", "#f00"))
: 5 == a
? (sweet_alert("Uyarı", "Sabit telefon numaranızı eksik girdiniz.", "error"),
$("#tc-kimlik-no").removeAttr("style"),
$("#e-posta-adres").removeAttr("style"),
$("#cep-telefon-no").removeAttr("style"),
$("#sabit-telefon-no").css("border-color", "#f00"))
: 6 == a
? sweet_alert("Uyarı", 'Girdiğiniz bilgilere ait üyelik kaydı bulundu.
Lütfen önce üye girişi yapın daha sonra lastik talebinde bulunun.', "error")
: ($("#tc-kimlik-no").removeAttr("style"),
$("#e-posta-adres").removeAttr("style"),
$("#cep-telefon-no").removeAttr("style"),
$("#sabit-telefon-no").removeAttr("style"),
$("#button").css("pointer-events", "none"),
$("#button").attr("disabled", !0),
$("#button-text").html("Lütfen bekleyiniz..."),
$.post("ajax/ajax.php", { islem: "lastik_talep_e_posta_gonder" }, function (a) {
swal({
title: "Başarılı!",
html: "Talep oluşturma işleminiz başarılı bir şekilde gerçekleşmiştir.Lastik satan firmalar talebinize teklif te bulunabileceklerdir.!",
type: "success",
allowOutsideClick: !1,
allowEscapeKey: !1,
showCancelButton: !1,
confirmButtonColor: "#3085d6",
confirmButtonText: "Tamam",
}).then(function () {
location.reload();
});
}));
},
});
}
function arac_ilce_getir(a, e) {
$.post("ajax/ajax.php", { islem: "arac_ilce_getir", p_il_id: a, p_ilce_id: e }, function (a) {
$("#ilce-load").html(a);
});
}
function arac_arama_filtre_degistir(a) {
var e = $("#page-url").val(),
i = $("#get-filitre").val();
$.post("ajax/ajax.php", { islem: "arac_arama_filtre_degistir", p_page_url: e, p_filitre_id: a, p_filitre: i }, function (a) {
location.href = a;
});
}
function firma_ilce_getir(a, e) {
$.post("ajax/ajax.php", { islem: "firma_ilce_getir", p_il_id: a, p_ilce_id: e }, function (a) {
$("#ilce-load").html(a), $(".selectpicker").selectpicker();
});
}
function yorum_gonder() {
var a = "",
e = "",
i = "";
$("#button").attr("disabled", !0),
$("#message-load").html(
'
Uyarı! İşlem yapılıyor, lütfen bekleyiniz.
'
),
setTimeout(function () {
$.ajax({
type: "POST",
url: "ajax/ajax.php",
data: $("#comment-form").serialize() + "&islem=yorum_yap",
dataType: "HTML",
success: function (t) {
(a = 1 == t ? "Lütfen zorunlu (*) alanları doldurunuz." : 2 == t ? "E-Posta adresinizi hatalı girdiniz." : "Görüşleriniz alınmıştır, teşekkür ederiz."),
0 != t ? ($("#button").attr("disabled", !1), (e = "danger"), (i = "Uyarı")) : ($(".form-control").attr("readonly", !0), $(".check").attr("disabled", !0), (e = "success"), (i = "Başarılı")),
$("#message-load").html(
'"
),
0 == t &&
setTimeout(function () {
location.reload();
}, 2e3);
},
});
}, 1e3);
}
function iletisim_formu_gonder() {
var a = "",
e = "",
i = "";
$("#button").attr("disabled", !0),
$("#message-load").html(
'
Uyarı! İşlem yapılıyor, lütfen bekleyiniz.
'
),
setTimeout(function () {
$.ajax({
type: "POST",
url: "ajax/ajax.php",
data: $("#contact-form").serialize() + "&islem=iletisim_formu_gonder",
dataType: "HTML",
success: function (t) {
(a = 1 == t ? "Lütfen zorunlu (*) alanları doldurunuz." : 2 == t ? "E-Posta adresinizi hatalı girdiniz." : "Görüşleriniz alınmıştır, teşekkür ederiz."),
0 != t ? ($("#button").attr("disabled", !1), (e = "danger"), (i = "Uyarı")) : ($(".form-control").attr("readonly", !0), $(".check").attr("disabled", !0), (e = "success"), (i = "Başarılı")),
$("#message-load").html(
'"
),
0 == t &&
setTimeout(function () {
location.reload();
}, 2e3);
},
});
}, 1e3);
}
function parca_talep_kontrol() {
$.post("ajax/ajax.php", { islem: "parca_talep_kontrol" }, function (a) {
if (0 != a) {
$("#parca_sayisi").html(a);
var e = setInterval(function () {
$("#parca").hasClass("aktif") ? $("#parca").removeClass("aktif") : ($("#parca").addClass("aktif"), $("audio")[0].play());
}, 700);
setInterval(function () {
clearInterval(e);
}, 5e3);
}
});
}
function lastik_talep_kontrol() {
$.post("ajax/ajax.php", { islem: "lastik_talep_kontrol" }, function (a) {
if (0 != a) {
$("#lastik_sayisi").html(a);
var e = setInterval(function () {
$("#lastik").hasClass("aktif-1") ? $("#lastik").removeClass("aktif-1") : ($("#lastik").addClass("aktif-1"), $("audio")[0].play());
}, 700);
setInterval(function () {
clearInterval(e);
}, 5e3);
}
});
}
function giris_yap() {
var a = "",
e = "",
i = "";
$("#button").attr("disabled", !0);
var t = $("#yonlendir").val();
$.ajax({
type: "POST",
url: "ajax/ajax.php",
data: $("#login-form").serialize() + "&islem=giris_yap",
dataType: "HTML",
success: function (l) {
(a =
1 == l
? "Lütfen zorunlu (*) alanları doldurunuz."
: 2 == l
? "E-Posta adresinizi hatalı girdiniz."
: 3 == l
? "Lütfen girdiğiniz bilgileri kontrol ediniz."
: 4 == l
? "Üyeliğiniz onaylanmadı, lütfen e-posta adresinize gelen onay linkine tıklayınız."
: 5 == l
? "Üyeliğiniz onaylanmadı, yöneticilerimiz bilgilerinizi doğruladıktan sonra sisteme giriş yapabileceksiniz."
: "Lütfen bekleyiniz, yönlendiriliyorsunuz."),
0 != l ? ($("#button").attr("disabled", !1), (e = "danger"), (i = "Uyarı")) : ($(".form-control").attr("readonly", !0), $(".check").attr("disabled", !0), (e = "success"), (i = "Başarılı")),
$("#message-load").html(
'"
),
0 == l &&
setTimeout(function () {
location.href = "" != t ? t : "panelim/talep-bilgileri/";
}, 1e3);
},
});
}
function sifremi_unuttum() {
var a = "",
e = "",
i = "";
$("#button").attr("disabled", !0),
$("#message-load").html(
'
Uyarı! İşlem yapılıyor, lütfen bekleyiniz.
'
),
setTimeout(function () {
$.ajax({
type: "POST",
url: "ajax/ajax.php",
data: $("#change-password-form").serialize() + "&islem=sifremi_unuttum",
dataType: "HTML",
success: function (t) {
(a =
1 == t
? "Lütfen zorunlu (*) alanları doldurunuz."
: 2 == t
? "E-Posta adresinizi hatalı girdiniz."
: 3 == t
? "Lütfen girdiğiniz bilgileri kontrol ediniz."
: "Şifreniz sıfırlanmıştır, yeni şifreniz e-posta adresinize gönderilmiştir."),
0 != t ? ($("#button").attr("disabled", !1), (e = "danger"), (i = "Uyarı")) : ($(".form-control").attr("readonly", !0), $(".check").attr("disabled", !0), (e = "success"), (i = "Başarılı")),
$("#message-load").html(
'"
);
},
});
}, 1e3);
}
function uye_ol_ilce_getir(a) {
$.post("ajax/ajax.php", { islem: "uye_ol_ilce_getir", p_il_id: a }, function (a) {
$("#ilce-load").html(a);
});
}
function sozlesme_load(a) {
$.post("ajax/ajax.php", { islem: "sozlesme_load", p_sozlesme: a }, function (a) {
$("#modal-load").html(a), $("#sozlesmeModal").modal({ show: !0 });
});
}
function uye_ol(a) {
var e = "",
i = "",
t = "",
l = "";
$("#button").attr("disabled", !0),
$("#message-load").html(
'
Uyarı! İşlem yapılıyor, lütfen bekleyiniz.
'
),
setTimeout(function () {
let tur = $('input[name=uyelik_tur]:checked', '#sign-up-form').val();
if(tur==1) {
let uyari = "Üyelik başvurunuz onaylanmıştır, lütfen giriş yapmak için tıklayınız... Giriş Yap.";
}else{
let uyari = "Üyelik başvurunuz alınmıştır.Onaylandıktan sonra giriş yapabilirsiniz.";
}
$.ajax({
type: "POST",
url: "ajax/ajax.php",
data: $("#sign-up-form").serialize() + "&islem=uye_ol",
dataType: "HTML",
success: function (a) {
(e =
1 == a
? "Lütfen zorunlu (*) alanları doldurunuz."
: 2 == a
? "T.C. kimlik numaranızı eksik girdiniz."
: 3 == a
? "T.C. kimlik numaranızı hatalı girdiniz."
: 4 == a
? "E-Posta adresinizi hatalı girdiniz."
: 5 == a
? "Cep telefon numaranızı eksik girdiniz."
: 6 == a
? "Sabit telefon numaranızı eksik girdiniz."
: 7 == a
? "Lütfen sözleşmeyi okuyup onaylayınız."
: 8 == a
? "T.C. kimlik numarası kullanımda."
: 9 == a
? "Cep telefon numarası kullanımda."
: 10 == a
? "E-Posta adresi kullanımda."
: 11 == a
? "Üyelik türünü seçiniz."
: 1 == $("input[name=uyelik_tur]:checked", "#sign-up-form").val()
//? "Üyelik başvurunuz alınmıştır, lütfen e-posta adresinize gelen onay linkine tıklayınız."
? "Üyelik başvurunuz onaylanmıştır, lütfen giriş yapmak için tıklayınız... Giriş Yap."
//: "Üyelik başvurunuz alınmıştır, yöneticilerimiz bilgilerinizi doğruladıktan sonra sisteme giriş yapabileceksiniz."),
: "Üyelik başvurunuz alınmıştır.Onaylandıktan sonra giriş yapabilirsiniz. Giriş Yap."),
0 != a
? ($("#button").attr("disabled", !1), (i = "danger"), (t = "Uyarı"))
: ($("#hide-visible").css("display", "none"), $(".form-control").attr("readonly", !0), $(".check").attr("disabled", !0), (i = "success"), (t = "Başarılı"), (l = " welcome")),
$("#message-load").html(
'"
);
},
});
}, 1e3);
}
function uye_bilgileri_ilce_getir(a, e) {
$.post("ajax/ajax.php", { islem: "uye_bilgileri_ilce_getir", p_il_id: a, p_ilce_id: e }, function (a) {
$("#ilce-load").html(a);
});
}
function parca_vasita_marka_getir(a) {
var e = "";
$("input[name='parca-vasita[]']:checked").each(function () {
e += "," + $(this).val() + ",";
}),
$.post("ajax/ajax.php", { islem: "parca_vasita_marka_getir", p_vasita_id: e, p_marka_id: a }, function (a) {
"" != a ? ($("#parca-vasita-marka-load").css("display", "block"), $("#parca-vasita-marka-load").html(a)) : $("#parca-vasita-marka-load").css("display", "none");
});
}
function firma_resim_sil(a) {
swal({
title: "Uyarı !",
html: "Resmi silmek istediğinizden emin misiniz?.
Bunu geri alamazsınız!.",
type: "warning",
allowOutsideClick: !1,
allowEscapeKey: !1,
showCancelButton: !0,
confirmButtonColor: "#d33",
cancelButtonColor: "#3085d6",
cancelButtonText: "Hayır, silme !",
confirmButtonText: "Evet, sil !",
})
.then(function () {
$.post("ajax/ajax.php", { islem: "firma_resim_sil", p_id: a }, function (a) {
1 == a
? swal({ title: "Başarılı", text: "Resim silindi.", type: "success", allowOutsideClick: !1, allowEscapeKey: !1, showCancelButton: !1, confirmButtonColor: "#3085d6", confirmButtonText: "Tamam" }).then(function () {
location.reload();
})
: sweet_alert("Uyarı", "Resim silinemedi.", "error");
});
})
.catch(swal.noop);
}
function vasita_marka_getir(a, e, i) {
model_getir(e, i),
$.post("ajax/ajax.php", { islem: "vasita_marka_getir", p_vasita_id: a, p_marka_id: e }, function (a) {
$("#vasita-marka-load").html(a);
});
}
function model_getir(a, e) {
$.post("ajax/ajax.php", { islem: "model_getir", p_marka_id: a, p_model_id: e }, function (a) {
$("#model-load").html(a);
});
}
function ilan_ver() {
var a = "#button",
e = "#save-message",
i = ["image/png", "image/gif", "image/jpeg"],
t = !0,
l = [],
n = 0;
if (!window.File && window.FileReader && window.FileList && window.Blob) l.push("Tarayıcınız eski, lütfen yükseltin.");
else {
var s = $("#resim")[0].files.length;
s > 10 && (l.push("Toplam " + s + ' dosya seçtiniz, maksimum 10 dosya seçiniz.!'), (t = !1)),
$.each($("#resim")[0].files, function (a, e) {
"" !== e.value &&
(-1 === i.indexOf(e.type) && (l.push('Yüklemek istediğiniz "' + e.name + '" dosyası desteklenmeyen formattadır.!'), (t = !1)),
e.size > 5242880 &&
(l.push('Yüklemek istediğiniz resmin boyutu "' + formatSizeUnits(e.size) + '", izin verilen boyut ' + formatSizeUnits(5242880) + ", tekrar seçerken küçük dosya seçiniz.!"),
(t = !1)),
(n += e.size));
}),
n > 52428800 &&
(l.push("Toplam " + s + " dosya, boyutu " + formatSizeUnits(n) + ". İzin verilen boyut " + formatSizeUnits(52428800) + ", tekrar seçerken küçük dosya seçiniz.!"), (t = !1)),
t &&
($(a).text("Lütfen bekleyiniz...").attr("disabled", !0),
$.ajax({
type: "POST",
url: "ajax/ajax.php",
data: $("#advertise-form").serialize() + "&islem=ilan_ver",
dataType: "HTML",
success: function (i) {
if (($(a).text("İlan Ver").attr("disabled", !1), 1 == i))
$(e).html(
'
Uyarı! Lütfen zorunlu (*) alanları doldurunuz.
'
);
else if (2 == i)
$(e).html(
'
Uyarı! Model yılını hatalı girdiniz.
'
);
else if (3 == i)
$(e).html(
'
Uyarı! Lütfen sözleşmeyi okuyup onaylayınız.
'
);
else {
$(a).text("Lütfen bekleyiniz...").attr("disabled", !0);
var t = new FormData();
$.each($("#resim")[0].files, function (a, e) {
t.append("file" + a, e);
}),
t.append("islem", "ilan_resim_ekle"),
t.append("ilan", i),
$.ajax({ url: "ajax/ajax.php", type: "POST", data: t, contentType: !1, cache: !1, processData: !1, mimeType: "multipart/form-data" }).done(function (i) {
$(a).text("İlan Ver"),
1 == i
? ($(a).attr("disabled", !1),
$(e).html(
'
Uyarı! Resim ekleme işleminizde hata oluştu.
'
))
: ($("#advertise-form")[0].reset(),
$(".note-editable").empty(),
$(e).html(
'
Başarılı! İlan verme işleminiz başarılı bir şekilde gerçekleşmiştir. İlanınız onaylandıktan sonra yayına alınacaktır.
'
)),
setTimeout(function () {
location.href = "panelim/hos-geldin/";
}, 3500);
});
}
},
}));
}
$(e).html(""),
$(l).each(function (a) {
$(e).append('");
});
}
function ilan_bilgileri_model_getir(a, e) {
$.post("ajax/ajax.php", { islem: "ilan_bilgileri_model_getir", p_marka_id: a, p_model_id: e }, function (a) {
$("#model-load").html(a);
});
}
function ilan_sil(a) {
swal({
title: "Uyarı !",
html: "İlanı silmek istediğinizden emin misiniz?.
Bunu geri alamazsınız!.",
type: "warning",
allowOutsideClick: !1,
allowEscapeKey: !1,
showCancelButton: !0,
confirmButtonColor: "#d33",
cancelButtonColor: "#3085d6",
cancelButtonText: "Hayır, silme !",
confirmButtonText: "Evet, sil !",
})
.then(function () {
$.post("ajax/ajax.php", { islem: "ilan_sil", p_id: a }, function (a) {
1 == a
? swal({ title: "Başarılı", text: "İlan silindi.", type: "success", allowOutsideClick: !1, allowEscapeKey: !1, showCancelButton: !1, confirmButtonColor: "#3085d6", confirmButtonText: "Tamam" }).then(function () {
location.reload();
})
: sweet_alert("Uyarı", "İlan silinemedi.", "error");
});
})
.catch(swal.noop);
}
function ilan_resimleri(a, e) {
$.post("ajax/ajax.php", { islem: "ilan_resimleri", p_id: a, p_no: e }, function (a) {
$("#advertise-images").html(a),
$(".nav-advertise-images")
.sortable()
.bind("sortupdate", function () {
var a = "";
$(".nav-advertise-images li").each(function () {
a += this.id + ",";
}),
$.post("ajax/ajax.php", { islem: "ilan_resim_sira_duzenle", p_id: a });
});
});
}
function ilan_resim_sil(a, e, i) {
swal({
title: "Uyarı !",
html: "Resmi silmek istediğinizden emin misiniz?.
Bunu geri alamazsınız!.",
type: "warning",
allowOutsideClick: !1,
allowEscapeKey: !1,
showCancelButton: !0,
confirmButtonColor: "#d33",
cancelButtonColor: "#3085d6",
cancelButtonText: "Hayır, silme !",
confirmButtonText: "Evet, sil !",
})
.then(function () {
$.post("ajax/ajax.php", { islem: "ilan_resim_sil", p_id: a, p_no: i }, function (a) {
1 == a
? swal({ title: "Başarılı", text: "Resim silindi.", type: "success", allowOutsideClick: !1, allowEscapeKey: !1, showCancelButton: !1, confirmButtonColor: "#3085d6", confirmButtonText: "Tamam" }).then(function () {
ilan_resimleri(e, i);
})
: sweet_alert("Uyarı", "Resim silinemedi.", "error");
});
})
.catch(swal.noop);
}
function ilan_guncelle(a) {
var e = "#button",
i = "#save-message",
t = ["image/png", "image/gif", "image/jpeg"],
l = $("#resim-sayisi").val(),
n = !0,
s = [],
r = 0;
if (!window.File && window.FileReader && window.FileList && window.Blob) s.push("Tarayıcınız eski, lütfen yükseltin.");
else {
var o = $("#resim")[0].files.length;
o > 0 && 0 == l
? (s.push("Resim ekleme limitinizi doldurdunuz.!"), (n = !1))
: o > l
? (s.push("Toplam " + o + ' dosya seçtiniz, maksimum ' + l + " dosya seçiniz.!"), (n = !1))
: (o > 10 && (s.push("Toplam " + o + ' dosya seçtiniz, maksimum 10 dosya seçiniz.!'), (n = !1)),
$.each($("#resim")[0].files, function (a, e) {
"" !== e.value &&
(-1 === t.indexOf(e.type) && (s.push('Yüklemek istediğiniz "' + e.name + '" dosyası desteklenmeyen formattadır.!'), (n = !1)),
e.size > 5242880 &&
(s.push('Yüklemek istediğiniz resmin boyutu "' + formatSizeUnits(e.size) + '", izin verilen boyut ' + formatSizeUnits(5242880) + ", tekrar seçerken küçük dosya seçiniz.!"),
(n = !1)),
(r += e.size));
}),
r > 52428800 &&
(s.push("Toplam " + o + " dosya, boyutu " + formatSizeUnits(r) + ". İzin verilen boyut " + formatSizeUnits(52428800) + ", tekrar seçerken küçük dosya seçiniz.!"),
(n = !1)),
n &&
($(e).text("Lütfen bekleyiniz...").attr("disabled", !0),
$.ajax({
type: "POST",
url: "ajax/ajax.php",
data: $("#advertise-form").serialize() + "&islem=ilan_guncelle",
dataType: "HTML",
success: function (t) {
if (($(e).text("İlanı Güncelle").attr("disabled", !1), 1 == t))
$(i).html(
'
Uyarı! Lütfen zorunlu (*) alanları doldurunuz.
'
);
else if (2 == t)
$(i).html(
'
Uyarı! Model yılını hatalı girdiniz.
'
);
else if (3 == t)
$(i).html(
'
Uyarı! Lütfen sözleşmeyi okuyup onaylayınız.
'
);
else {
$(e).text("Lütfen bekleyiniz...").attr("disabled", !0);
var l = new FormData();
$.each($("#resim")[0].files, function (a, e) {
l.append("file" + a, e);
}),
l.append("islem", "ilan_guncelle_resim_ekle"),
l.append("ilan_id", $("#ilan-id").val()),
l.append("ilan_no", $("#ilan-no").val()),
$.ajax({ url: "ajax/ajax.php", type: "POST", data: l, contentType: !1, cache: !1, processData: !1, mimeType: "multipart/form-data" }).done(function (t) {
$(e).text("İlanı Güncelle"),
1 == t
? ($(e).attr("disabled", !1),
$(i).html(
'
Uyarı! Resim ekleme limitinizi aştınız veya doldurdunuz.
'
))
: ($(i).html(
'
Başarılı! İlan güncelleme işleminiz başarılı bir şekilde gerçekleşmiştir. İlanınız onaylandıktan sonra yayına alınacaktır.
'
),
setTimeout(function () {
location.href = "panelim/" + a;
}, 3500));
});
}
},
})));
}
$(i).html(""),
$(s).each(function (a) {
$(i).append('");
});
}
function talep_ac_kapat(a, e) {
$.post("ajax/ajax.php", { islem: "talep_ac_kapat", p_islem: a, p_talep_id: e }, function (a) {
location.reload();
});
}
function parca_talep_gizle(a) {
swal({
title: "Uyarı !",
html: "Talebi silmek istediğinizden emin misiniz?.
Bunu geri alamazsınız!.",
type: "warning",
allowOutsideClick: !1,
allowEscapeKey: !1,
showCancelButton: !0,
confirmButtonColor: "#d33",
cancelButtonColor: "#3085d6",
cancelButtonText: "Hayır, silme !",
confirmButtonText: "Evet, sil !",
})
.then(function () {
$.post("ajax/ajax.php", { islem: "parca_talep_gizle", p_talep_id: a }, function (a) {
1 == a
? swal({ title: "Başarılı", text: "Talep silindi.", type: "success", allowOutsideClick: !1, allowEscapeKey: !1, showCancelButton: !1, confirmButtonColor: "#3085d6", confirmButtonText: "Tamam" }).then(function () {
location.reload();
})
: sweet_alert("Uyarı", "Talep silinemedi.", "error");
});
})
.catch(swal.noop);
}
function talep_sil(a) {
swal({
title: "Uyarı !",
html: "Talebi silmek istediğinizden emin misiniz?.
Bunu geri alamazsınız!.",
type: "warning",
allowOutsideClick: !1,
allowEscapeKey: !1,
showCancelButton: !0,
confirmButtonColor: "#d33",
cancelButtonColor: "#3085d6",
cancelButtonText: "Hayır, silme !",
confirmButtonText: "Evet, sil !",
})
.then(function () {
$.post("ajax/ajax.php", { islem: "talep_sil", p_talep_id: a }, function (a) {
1 == a
? swal({ title: "Başarılı", text: "Talep silindi.", type: "success", allowOutsideClick: !1, allowEscapeKey: !1, showCancelButton: !1, confirmButtonColor: "#3085d6", confirmButtonText: "Tamam" }).then(function () {
location.reload();
})
: sweet_alert("Uyarı", "Talep silinemedi.", "error");
});
})
.catch(swal.noop);
}
function teklif_sil(a) {
$("#button").attr("disabled", !0),
$.post("ajax/ajax.php", { islem: "teklif_sil", p_teklif_id: a }, function (a) {
0 == a
? ($("#button").attr("disabled", !0), sweet_alert("Uyarı", "Teklif silinemedi.", "error"))
: swal({ title: "Başarılı", text: "Teklif silindi.", type: "success", allowOutsideClick: !1, allowEscapeKey: !1, showCancelButton: !1, confirmButtonColor: "#3085d6", confirmButtonText: "Tamam" }).then(function () {
location.reload();
});
});
}
function lastik_talep_ac_kapat(a, e) {
$.post("ajax/ajax.php", { islem: "lastik_talep_ac_kapat", p_islem: a, p_talep_id: e }, function (a) {
location.reload();
});
}
function lastik_talep_gizle(a) {
swal({
title: "Uyarı !",
html: "Talebi silmek istediğinizden emin misiniz?.
Bunu geri alamazsınız!.",
type: "warning",
allowOutsideClick: !1,
allowEscapeKey: !1,
showCancelButton: !0,
confirmButtonColor: "#d33",
cancelButtonColor: "#3085d6",
cancelButtonText: "Hayır, silme !",
confirmButtonText: "Evet, sil !",
})
.then(function () {
$.post("ajax/ajax.php", { islem: "lastik_talep_gizle", p_talep_id: a }, function (a) {
1 == a
? swal({ title: "Başarılı", text: "Talep silindi.", type: "success", allowOutsideClick: !1, allowEscapeKey: !1, showCancelButton: !1, confirmButtonColor: "#3085d6", confirmButtonText: "Tamam" }).then(function () {
location.reload();
})
: sweet_alert("Uyarı", "Talep silinemedi.", "error");
});
})
.catch(swal.noop);
}
function lastik_talep_sil(a) {
swal({
title: "Uyarı !",
html: "Talebi silmek istediğinizden emin misiniz?.
Bunu geri alamazsınız!.",
type: "warning",
allowOutsideClick: !1,
allowEscapeKey: !1,
showCancelButton: !0,
confirmButtonColor: "#d33",
cancelButtonColor: "#3085d6",
cancelButtonText: "Hayır, silme !",
confirmButtonText: "Evet, sil !",
})
.then(function () {
$.post("ajax/ajax.php", { islem: "lastik_talep_sil", p_talep_id: a }, function (a) {
1 == a
? swal({ title: "Başarılı", text: "Talep silindi.", type: "success", allowOutsideClick: !1, allowEscapeKey: !1, showCancelButton: !1, confirmButtonColor: "#3085d6", confirmButtonText: "Tamam" }).then(function () {
location.reload();
})
: sweet_alert("Uyarı", "Talep silinemedi.", "error");
});
})
.catch(swal.noop);
}
function lastik_teklif_sil(a) {
$("#button").attr("disabled", !0),
$.post("ajax/ajax.php", { islem: "lastik_teklif_sil", p_teklif_id: a }, function (a) {
0 == a
? ($("#button").attr("disabled", !0), sweet_alert("Uyarı", "Teklif silinemedi.", "error"))
: swal({ title: "Başarılı", text: "Teklif silindi.", type: "success", allowOutsideClick: !1, allowEscapeKey: !1, showCancelButton: !1, confirmButtonColor: "#3085d6", confirmButtonText: "Tamam" }).then(function () {
location.reload();
});
});
}
function uye_gelen_mesajlar(a, e, i, t, l) {
if (1 == i || !1 === $("#list-item-" + a + "-" + e).hasClass("active")) {
0 == i &&
($("#message_load").css("display", "table-cell").html(''),
$(".list-group-item").removeClass("active"),
$("#list-item-" + a + "-" + e).addClass("active"),
$("#request-no-load").html('' + $("#list-item-" + a + "-" + e).data("request-no") + ""));
var n = "";
(n = 1 == l ? "uye_gelen_mesajlar" : "firma_gelen_mesajlar"),
setTimeout(function () {
$.post("ajax/ajax.php", { islem: n, p_talep_id: a, p_uye_id: e, p_talep_turu: t }, function (i) {
$("#message_load").css("display", "block").html(i),
$(".scroll-list").niceScroll({ cursorcolor: "#9c9c9c", cursorwidth: "10px" }),
uye_mesaj_okunmayana_git(".scroll-list"),
$("#request-id").val(a),
$("#user-id").val(e),
$(".scroll-list").scroll(function () {
1 == l ? uye_okunmayan_mesaj_bul($(this).scrollTop()) : firma_okunmayan_mesaj_bul($(this).scrollTop());
}),
0 == $(".scroll-list").scrollTop() && (1 == l ? uye_okunmayan_mesaj_bul(1e3) : firma_okunmayan_mesaj_bul(1e3));
});
}, 1e3);
}
}
function uye_mesaj_gonder() {
$("#btn-send").attr("disabled", !0),
$.ajax({
type: "POST",
url: "ajax/ajax.php",
data: $("#message-form").serialize(),
dataType: "HTML",
success: function (a) {
$("#btn-send").attr("disabled", !1),
0 == a
? sweet_alert("Uyarı", "Mesaj alanını doldurunuz.", "error")
: 1 == a
? ($("#message-text").val(""),
$("#message-send-load").css("margin-top", "10px").html("Gönderiliyor.."),
uye_mesaj_okunmayana_git(".scroll-list"),
uye_gelen_mesajlar($("#request-id").val(), $("#user-id").val(), 1, $("#demand-type").val(), $("#membership-type").val()))
: sweet_alert("Uyarı", "Mesaj gönderilemedi.", "error");
},
});
}
function uye_mesaj_okunmayana_git(a) {
var e = "";
if (
($(".messages-list li").each(function () {
if ("0" == $(this).data("okuma-id")) return (e = (e = $("#hizala-" + $(this).data("id")).position()).top - 20), $(a).scrollTop(e), !1;
}),
"" == e)
) {
var i = $(a),
t = i[0].scrollHeight;
i.scrollTop(t);
}
}
function uye_okunmayan_mesaj_bul(a) {
var e = $("#request-id").val(),
i = $("#user-id").val(),
t = $("#demand-type").val();
$(".messages-list li").each(function () {
if ("0" == $(this).data("okuma-id")) {
var l = $("#hizala-" + $(this).data("id")).position();
null != (l = l.top - a) && a >= l && ($(this).data("okuma-id", 1), $.post("ajax/ajax.php", { islem: "uye_mesaj_okundu", p_talep_id: e, p_uye_id: i, p_konusma_id: $(this).data("id"), p_talep_turu: t }));
}
});
}
function firma_okunmayan_mesaj_bul(a) {
var e = $("#request-id").val(),
i = $("#demand-type").val();
$(".messages-list li").each(function () {
if ("0" == $(this).data("okuma-id")) {
var t = $("#hizala-" + $(this).data("id")).position();
null != (t = t.top - a) && a >= t && ($(this).data("okuma-id", 1), $.post("ajax/ajax.php", { islem: "firma_mesaj_okundu", p_talep_id: e, p_konusma_id: $(this).data("id"), p_talep_turu: i }));
}
});
}
function goBack() {
window.history.back();
}
$(window).scroll(function () {
$(window).scrollTop() >= 115 ? $(".geri-don-buton").addClass("fixed-geridon") : $(".geri-don-buton").removeClass("fixed-geridon");
})