');
/*
$(document).on('click', 'a.sepet_montaj_ekle', function(e){
e.preventDefault();
var pid = $(this).data('productid');
var data = {
action: '',
pid: pid,
}
$.post(ajaxUrl, data, function(response){
});
return false;
});
*/
$(document).on('click', '.montaj_popup_kapat', function(e){
e.preventDefault();
$('span.lutfen_bekl')
$('#montaj_popup').hide();
$('.montaj_popup_inner > div').html('');
return false;
});
$(document).on('click', '.montaj_popup_overlay, .alisveris_devam', function(e){
e.preventDefault();
$('.montaj_popup_kapat').click();
return false;
});
$(document).on('click', '.montaj_noktasini_sec_index', function(e){
e.preventDefault();
$('.orion_body_loader_wrap').show();
var termid = $(this).data('termid');
var data = {
action: 'montaj_noktasi_sec_popup_doldur_ilk',
termid: termid,
}
$.post(ajaxUrl, data, function(response){
$('.orion_body_loader_wrap').hide();
$('.montaj_popup_inner > div').html(response);
$('#montaj_popup').fadeIn();
});
return false;
});
$(document).on('change', 'select.popup_adet_sec', function(e){
e.preventDefault();
const birimf = $(this).data('birimf');
const adet = $(this).val();
$(this).parent().parent().find('.service-price-amount span').html(parseInt(birimf) * parseInt(adet));
return false;
});
$(document).on('click', '.hizmetsec', function(e){
e.preventDefault();
const pid = $(this).data('pid');
const birimf = $(this).parent().parent().find('select.popup_adet_sec').data('birimf');
const adet = $(this).parent().parent().find('select.popup_adet_sec').val();
//$(this).hide();
//$(this).parent().find('.hizmetcikar').show();
$(this).parent().parent().parent().parent().attr('data-secili', 'evet');
return false;
});
$(document).on('click', '.hizmetcikar', function(e){
e.preventDefault();
const pid = $(this).data('pid');
const birimf = $(this).parent().parent().find('select.popup_adet_sec').data('birimf');
const adet = $(this).parent().parent().find('select.popup_adet_sec').val();
$(this).parent().parent().parent().parent().attr('data-secili', 'hayir');
//$(this).hide();
//$(this).parent().find('.hizmetsec').show();
$(this).parent().parent().find('select').val('1');
return false;
});
$(document).on('click', '.popup_degisiklikleri_uygula', function(e){
e.preventDefault();
var getPid = '';
var getKey = '';
if( getPid=='' || getKey=='' ){
alert('Lütfen önce bir ürünü sepetinize ekleyiniz ve sepet sayfasındaki MONTAJ EKLE butonuna tıklayınız!');
return false;
}
$('span.lutfen_bekl').css('display', 'flex');
var secililer = [];
var montaj_noktasi_termid = $(this).data('montaj_noktasi_termid');
var sepet_pid = '';
var cart_item_key = '';
if( $('[data-secili="evet"]').length > 0 ){
$('[data-secili="evet"]').each(function(ind){
var seciliWrap = $('[data-secili="evet"]').eq(ind);
var hizmet_pid = seciliWrap.data('pid');
var adet = seciliWrap.find('select').val();
var birimf = seciliWrap.find('select').data('birimf');
var ekle = {
hizmet_pid: hizmet_pid,
adet: adet,
birimf: birimf,
montaj_noktasi_termid: montaj_noktasi_termid,
}
secililer.push(ekle);
});
}
var data = {
action: 'secilileri_sessiona_at',
secililer: secililer,
sepet_pid: sepet_pid,
cart_item_key: cart_item_key,
}
$.post(ajaxUrl, data, function(response){
if(response && response==1){
window.location.href = 'https://superoto.com.tr/sepetim';
}
});
return false;
});
/************/
$(document).on('click', '.popup_degisiklikleri_uygula_sepet_gunc', function(e){
e.preventDefault();
$('span.lutfen_bekl').css('display', 'flex');
var secililer = [];
var montaj_noktasi_termid = $(this).data('montaj_noktasi_termid');
var sepet_pid = $(this).data('gelen_sepetteki_pid');
var cart_item_key = $(this).data('gelen_cart_item_key');
if( $('[data-secili="evet"]').length > 0 ){
$('[data-secili="evet"]').each(function(ind){
var seciliWrap = $('[data-secili="evet"]').eq(ind);
var hizmet_pid = seciliWrap.data('pid');
var adet = seciliWrap.find('select').val();
var birimf = seciliWrap.find('select').data('birimf');
var ekle = {
hizmet_pid: hizmet_pid,
adet: adet,
birimf: birimf,
montaj_noktasi_termid: montaj_noktasi_termid,
}
secililer.push(ekle);
});
}
var data = {
action: 'secilileri_sessiona_at',
secililer: secililer,
sepet_pid: sepet_pid,
cart_item_key: cart_item_key,
}
$.post(ajaxUrl, data, function(response){
if(response && response==1){
window.location.href = 'https://superoto.com.tr/sepetim';
}
});
return false;
});
/***************/
$(document).on('click', '.sepet_montaj_duzenle', function(e){
e.preventDefault();
$('.orion_body_loader_wrap').show();
var termid = $(this).data('termid');
var pid = $(this).data('pid');
var cart_item_key = $(this).data('cart_item_key');
var data = {
action: 'montaj_noktasi_duzenle_popup_doldur',
termid: termid,
pid: pid,
cart_item_key: cart_item_key,
}
$.post(ajaxUrl, data, function(response){
$('.orion_body_loader_wrap').hide();
$('.montaj_popup_inner > div').html(response);
$('#montaj_popup').fadeIn();
});
return false;
});
$(document).on('click', '.single_add_to_cart_button', function(e){
var front_pid = $(this).val();
setTimeout(function(){
var data = {
action: 'sepete_eklerken_action',
front_pid: front_pid,
}
$.post(ajaxUrl, data, function(response){
if( response ){
var res = JSON.parse(response);
var montURL = 'https://superoto.com.tr/montaj-noktalari?pid='+res.pid+'&cart_item_key='+res.cart_item_key;
var ekle = '';
$('.montaj_popup_inner > div').html(ekle);
$('#montaj_popup').fadeIn();
}
});
}, 700);
});
$(document).on('click', 'a.button.product_type_simple.add_to_cart_button.ajax_add_to_cart.add-to-cart-loop', function(e){
var front_pid = $(this).data('product_id');
setTimeout(function(){
var data = {
action: 'sepete_eklerken_action',
front_pid: front_pid,
}
$.post(ajaxUrl, data, function(response){
if( response ){
var res = JSON.parse(response);
var montURL = 'https://superoto.com.tr/montaj-noktalari?pid='+res.pid+'&cart_item_key='+res.cart_item_key;
var ekle = '';
$('.montaj_popup_inner > div').html(ekle);
$('#montaj_popup').fadeIn();
}
});
}, 700);
});
})(jQuery);