// ################################################################### // Powered by A&A Digital Agency (מקבוצת אלמיר מערכות תוכנה) // www.almir.co.il || info@almir.co.il // Developer : Albert Amir // Phone/Fax: +972 04-63-63-281 // Mobile: +972 0523731057 // ################################################################### var WebsiteDomain = "https://www.vahaba.co.il"; function CallClient_Add(GetFrm) { $.LoadingOverlay("show"); var Frm = document.getElementById(GetFrm); if(Frm.FullName.value==''){ alert("רשמו שם מלאה"); Frm.FullName.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.Mobile.value==''){ alert("רשמו טלפון נייד"); Frm.Mobile.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.Email.value==''){ alert("רשמו אימייל"); Frm.Email.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.Dob.value==''){ alert("בחרו תאריך לידה שלכם"); Frm.Dob.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.City.value==''){ alert("רשמו עיר מגורים"); Frm.City.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.Address.value==''){ alert("רשמו כתובת"); Frm.Address.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.Password.value==''){ alert("רשמו סיסמא"); Frm.Password.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.Re_Password.value==''){ alert("רשמו אימות סיסמא"); Frm.Re_Password.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.Password.value!=Frm.Re_Password.value){ alert("סיסמא ואימות סיסמא צריכים להיות זהים"); Frm.Re_Password.focus(); Frm.Re_Password.value = ""; $.LoadingOverlay("hide"); return false; } if(Frm.terms.checked==false){ alert("על מנת להמשיך, יש לאשר דיוור במייל"); /* Frm.terms.checked=true; */ $.LoadingOverlay("hide"); return false; } setTimeout(function(){ Frm.submit(); setTimeout(function(){ $.LoadingOverlay("hide"); //createCookie('PopUpBannerClose','CLOSE',1); //$('#PopupBanner').modal('hide'); }, 1000); }, 500); } function CallClient_NewEmail(GetFrm) { $.LoadingOverlay("show"); var Frm = document.getElementById(GetFrm); if(Frm.FullName.value==''){ alert("רשמו שם מלאה"); Frm.FullName.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.Mobile.value==''){ alert("רשמו טלפון נייד"); Frm.Mobile.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.Email.value==''){ alert("רשמו אימייל"); Frm.Email.focus(); $.LoadingOverlay("hide"); return false; } if(Frm.terms.checked==false){ alert("על מנת להמשיך, יש לאשר דיוור במייל"); /* Frm.terms.checked=true; */ $.LoadingOverlay("hide"); return false; } setTimeout(function(){ Frm.submit(); setTimeout(function(){ $.LoadingOverlay("hide"); createCookie('PopUpBannerClose','CLOSE',1); $('#PopupBanner').modal('hide'); }, 1000); }, 500); } function CallAnalyticsMessageCall(call_message,url) { var data = ""; data+= "task=CalculateTrafic"; data+= "&call_message="+encodeURIComponent(call_message); data+= "&url="+encodeURIComponent(url); $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.analytics-call-send-message.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , error: function() { return 'error'; }, success: function(Result) { return true; } }); } function CreateDeleteLocalPickupBasket() { $.LoadingOverlay("show"); setTimeout(function(){ var data = ""; data+= "task=CreateDeleteLocalPickupBasket"; $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , error: function() { return 'error'; }, success: function(Result) { $.LoadingOverlay("hide"); CallUpdateHTML(); CallHTMLBasketData(); return true; } }); }, 500); } function CreateLocalPickupBasket() { var ConfirmResult = confirm("האם אתם בטוחים שאתם מעוניינים לאסוף את המוצרים מהחנות ?"); if(ConfirmResult==true) { $.LoadingOverlay("show"); setTimeout(function(){ var data = ""; data+= "task=CreateLocalPickupBasket"; $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , error: function() { return 'error'; }, success: function(Result) { $.LoadingOverlay("hide"); CallUpdateHTML(); CallHTMLBasketData(); return true; } }); }, 500); } } function CreateCheckCouponBasket(GetCouponCode) { var CouponCode = document.getElementById(GetCouponCode); if(CouponCode.value==''){ alert("לא רשמתם קוד קופון!"); CouponCode.focus(); return false; } var CouponCodelength = CouponCode.value, MinCouponCodelength = 6; if(CouponCodelength.length < MinCouponCodelength) { alert("קופון לא תקין והינו קצר."+"\n"+"קוד קופון צריך להיות לפחות "+MinCouponCodelength+" תווים."); return false; } $.LoadingOverlay("show"); setTimeout(function(){ var data = ""; data+= "task=CreateCheckCouponBasket"; data+= "&CouponCode="+CouponCode.value; $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , error: function() { return 'error'; }, success: function(Result) { Result = trim(Result," "); $.LoadingOverlay("hide"); if(Result.search("{NoneCoupon}")>0) { alert("לא קיים קופון זה או שהקופון זה נועד רק למוצר ספציפי שבאתר"); return false; } if(Result.search("{CouponUsed}")>0) { alert("קופון זה כבר היה בשימוש, לא ניתן להשתמש בו שנית"); return false; } if(Result.search("{CouponExpire}")>0) { alert("קופון זה פג תודף"); return false; } if(Result.search("{CouponNotYou}")>0) { alert("אינך רשאי להשתמש בקופון שאינו שלך"); return false; } if(Result.search("{CouponMinimumBuy}")>0) { var CouponMinimumBuy = Result.split("_"); var MyMess = "על מנת להשתמש בקופון זה יש לעשות קניות בסכום של "+Number(CouponMinimumBuy[1])+" ₪ ומעלה"; alert(MyMess); return false; } if(Result.search("{OK}")>0) { CallUpdateHTML(); CallHTMLBasketData(); return true; } } }); }, 500); } function CreateSaveExtras(GetExtraA,GetExtraB,MustAddFile,MustAddText,GetStyle,GetCountField,GetId,GetPriceFor,BlockStyle) { if(document.getElementById(GetExtraA)) { if(document.getElementById(GetExtraA).value==''){ alert("נא לבחור אחת מהאפשרויות"); document.getElementById(GetExtraA).focus(); return false; } } if(document.getElementById(GetExtraB)) { if(document.getElementById(GetExtraB).value==''){ alert("נא לבחור אחת מהאפשרויות"); document.getElementById(GetExtraB).focus(); return false; } } var MyAddText = ""; if(document.getElementById(MustAddText)) { if(document.getElementById(MustAddText).value==''){ alert("כדי להמשיך, יש לרשום טקסט"); return false; } MyAddText = document.getElementById(MustAddText).value; } if(document.getElementById(MustAddFile)) { $.LoadingOverlay("show"); if(document.getElementById(MustAddFile).value==''){ alert("כדי להמשיך, יש לצרף קובץ"); $.LoadingOverlay("hide"); return false; } var UploadedFile = ""; var fd = new FormData(); var InputFileName = '#'+MustAddFile; var MyTempFile = $(InputFileName)[0].files[0]; fd.append('task',"CreateTempFile"); fd.append('file_path',MyTempFile); $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: fd, async: false, cache: false, timeout: 5000, dataType: 'text', contentType: false, processData: false, error: function() { $.LoadingOverlay("hide"); return 'error'; }, success: function(MyUploadedFile) { //alert(MyUploadedFile); MyUploadedFile = trim(MyUploadedFile," "); $.LoadingOverlay("hide"); if(MyUploadedFile.search("{bad_suffix}")>0) { alert("סיומת של הקובץ לא נתמכת. יש להעלות קובץ תמונה ו/או טקסט ו/או PDF"); return false; } ChangeBasket('SaveExtras',GetCountField,GetId,GetPriceFor,BlockStyle,MyAddText,MyUploadedFile); document.getElementById("count_"+GetId).value = document.getElementById("Extra_count_"+GetId).value; $("#"+BlockStyle).modal("hide"); } }); } else { ChangeBasket('SaveExtras',GetCountField,GetId,GetPriceFor,BlockStyle,MyAddText,""); document.getElementById("count_"+GetId).value = document.getElementById("Extra_count_"+GetId).value; $("#"+BlockStyle).modal("hide"); } } function ChangeBasket(GetStyle,GetCountField,GetId,GetPriceFor,BlockStyle,MyAddText,MyUploadedFile) { var quantity = document.getElementById(GetCountField); switch(GetStyle) { case "SaveExtras": if(document.getElementById("ModalExtras"+GetId) && (document.getElementById("ModalExtras"+GetId).style.display=='none' || document.getElementById("ModalExtras"+GetId).style.display=='')) { if( (document.getElementById("ExtraA_"+GetId) && document.getElementById("ExtraA_"+GetId).value=='') || (document.getElementById("ExtraB_"+GetId) && document.getElementById("ExtraB_"+GetId).value=='') ){ $("#ModalExtras"+GetId).modal("show"); return false; } $("#ModalExtras"+GetId).modal("show"); return false; } quantity.value = quantity.value; break; case "button": if(document.getElementById(BlockStyle) && (document.getElementById(BlockStyle).style.display=='none' || document.getElementById(BlockStyle).style.display=='')) { if( (document.getElementById("ExtraA_"+GetId) && document.getElementById("ExtraA_"+GetId).value=='') || (document.getElementById("ExtraB_"+GetId) && document.getElementById("ExtraB_"+GetId).value=='') ){ $("#"+BlockStyle).modal("show"); return false; } $("#"+BlockStyle).modal("show"); return false; } break; case "p": if(document.getElementById(BlockStyle) && (document.getElementById(BlockStyle).style.display=='none' || document.getElementById(BlockStyle).style.display=='')) { if( (document.getElementById("ExtraA_"+GetId) && document.getElementById("ExtraA_"+GetId).value=='') || (document.getElementById("ExtraB_"+GetId) && document.getElementById("ExtraB_"+GetId).value=='') ){ $("#"+BlockStyle).modal("show"); return false; } $("#"+BlockStyle).modal("show"); return false; } if(GetPriceFor=='kg'){ quantity.value = Number(quantity.value)+0.5; } else { quantity.value++; } break; case "m": if(quantity.value<=0) { quantity.value = 0; return false; } if(GetPriceFor=="kg"){ quantity.value = Number(quantity.value)-0.5; } else { quantity.value--; } break; } $.LoadingOverlay("show"); setTimeout(function(){ var data = ""; data+= "task=UpdateBasket"; data+= "&quantity="+quantity.value; data+= "&price_for="+GetPriceFor; data+= "&id="+GetId; if (document.getElementById("ExtraA_"+GetId) && document.getElementById("ExtraA_"+GetId).value!='') { data+= "&ExtraA="+document.getElementById("ExtraA_"+GetId).value; } if (document.getElementById("ExtraB_"+GetId) && document.getElementById("ExtraB_"+GetId).value!='') { data+= "&ExtraB="+document.getElementById("ExtraB_"+GetId).value; } if (MyAddText!='') { data+= "&MyAddText="+MyAddText; } if (MyUploadedFile!='') { data+= "&MyUploadedFile="+MyUploadedFile; } //document.write("https://clients.almir.co.il/BaseEcommerceAA/GlobalIncludes/_CLASS/class.basket.php?"+data); $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , error: function() { return 'error'; }, success: function(Result) { Result = trim(Result," "); $.LoadingOverlay("hide"); //alert(Result); if(Result.search("{success}")>0) { setTimeout(function(){ $(".bd-modal-finish").modal("show") }, 500); } if(Result.search("{error_empty}")>0) { alert("מוצר שביקשת אינו זמין במלאי"); return false; } if(Result.search("{quantity_limit}")>0) { alert("מלאי מוגבל של המוצר"); return false; } } }); }, 500); setTimeout(function(){ CallUpdateHTML(); }, 500); } function CallPlusMinusProductFromBasket(GetId,plus_minus,GetPriceFor) { var quantity = document.getElementById("MyQuantity_"+GetId); var data = ""; data+= "task=CallPlusMinusProductFromBasket"; data+= "&id="+GetId; if(plus_minus=='p'){ if(GetPriceFor=='kg'){ quantity.value = Number(quantity.value)+0.5; } else { quantity.value++; } } else if (plus_minus=='m') { if(quantity.value<=1) { quantity.value = 1; return false; } if(GetPriceFor=="kg"){ quantity.value = Number(quantity.value)-0.5; } else { quantity.value--; } } else if (plus_minus=='free_change_only') { if(quantity.value<=1) { quantity.value = 1; return false; } } data+= "&quantity="+quantity.value; $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , error: function() { return 'error'; }, success: function(Result) { Result = trim(Result," "); if(Result.search("{success}")>0) { } if(Result.search("{error_empty}")>0) { alert("מוצר שביקשת אינו זמין במלאי"); return false; } if(Result.search("{quantity_limit}")>0) { alert("מלאי מוגבל של המוצר"); return false; } } }); CallUpdateHTML(); CallHTMLBasketData(); } function CallDeleteProductFromBasket(GetId) { var ConfirmResult = confirm("להסיר מוצר מהעגלת הקניות?"); if(ConfirmResult==true) { var data = ""; data+= "task=CallDeleteProductFromBasket"; data+= "&id="+GetId; $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , error: function() { return 'error'; }, success: function(Result) { if(document.getElementById("count_"+GetId)){ document.getElementById("count_"+GetId).value = "0"; } } }); CallUpdateHTML(); CallHTMLBasketData(); } } function CallHTMLBasketData() { var data = ""; data+= "task=CallHTMLBasketData"; $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , /* (xml, json, script, text, html) */ error: function() { return 'error'; }, success: function(Result) { document.getElementById("HTMLBasketData").innerHTML = Result; } }); } $(window).on('shown.bs.modal', function() { CallHTMLBasketData(); }); function CallUpdateHTML() { var data = ""; data+= "task=CallUpdateHTML"; $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , error: function() { return 'error'; }, success: function(Result) { var str = Result , Data = str.split("_"); if(document.getElementById("BasketCounter")){ document.getElementById("BasketCounter").innerHTML = Data[0]; } if(document.getElementById("BasketPrice")){ document.getElementById("BasketPrice").innerHTML = Data[1]; } if(document.getElementById("h-BasketCounter")){ document.getElementById("h-BasketCounter").innerHTML = Data[0]; } if(document.getElementById("h-BasketCounter-mobile")){ document.getElementById("h-BasketCounter-mobile").innerHTML = Data[0]; } if(document.getElementById("h-BasketCounter-mobile-footer")){ document.getElementById("h-BasketCounter-mobile-footer").innerHTML = Data[0]; } } }); } function CreateOrderButton(GetFrm,PayBuy,PayAmount) { var Frm = document.getElementById(GetFrm); if(Frm.Fullname.value==''){ alert("הערה: חובה לרשום שם מלא"); Frm.Fullname.focus(); return false; } if(Frm.Mobile.value==''){ alert("הערה: חובה לרשום טלפון נייד"); Frm.Mobile.focus(); return false; } if(Frm.Mobile.value!='' && checkPhoneNumber(Frm.Mobile)==false){ alert("המספר אינו תקין"); Frm.Mobile.focus(); return false; } if(Frm.Email.value!='' && isValidEmailAddress(Frm.Email.value)==false){ alert("דואר אלקטרוני אינו תקין"); Frm.Email.focus(); return false; } if(Frm.ShippingStatus.value=='Shipping') { if(Frm.City.value==''){ alert("הערה: חובה לרשום עיר למשלוח"); Frm.City.focus(); return false; } if(Frm.Address.value==''){ alert("הערה: חובה לרשום כתובת מלאה למשלוח"); Frm.Address.focus(); return false; } } else if(Frm.ShippingStatus.value=='LocalPickup') { } if(PayBuy=='ccard' || PayBuy=='paypal'){ if(Frm.terms.checked==false){ alert("נא לאשר תקנון האתר"); return false; } } switch(PayBuy) { case "Regular": break; case "whatsapp": document.getElementById("payButtonWhatsApp").disabled = true; if(document.getElementById("payButtonPayPal")){ document.getElementById("payButtonPayPal").disabled = true; } if(document.getElementById("payButtonCreditCard")){ document.getElementById("payButtonCreditCard").disabled = true; } document.getElementById("payButtonWhatsApp").innerHTML = " מייצר הזמנה, אנה המתן..."; document.getElementById("payButtonWhatsAppBootstrap").className = "col-12"; if(document.getElementById("payButtonPayPalBootstrap")){ document.getElementById("payButtonPayPalBootstrap").style.display = 'none'; } if(document.getElementById("payButtonCreditCardBootstrap")){ document.getElementById("payButtonCreditCardBootstrap").style.display = 'none'; } break; case "paypal": if(document.getElementById("payButtonWhatsApp")){ document.getElementById("payButtonWhatsApp").disabled = true; } document.getElementById("payButtonPayPal").disabled = true; if(document.getElementById("payButtonCreditCard")){ document.getElementById("payButtonCreditCard").disabled = true; } document.getElementById("payButtonPayPal").innerHTML = " מייצר הזמנה, אנה המתן..."; if(document.getElementById("payButtonWhatsAppBootstrap")){ document.getElementById("payButtonWhatsAppBootstrap").style.display = 'none'; } document.getElementById("payButtonPayPalBootstrap").className = "col-12"; if(document.getElementById("payButtonCreditCardBootstrap")){ document.getElementById("payButtonCreditCardBootstrap").style.display = 'none'; } break; case "ccard": if(document.getElementById("payButtonWhatsApp")){ document.getElementById("payButtonWhatsApp").disabled = true; } if(document.getElementById("payButtonPayPal")){ document.getElementById("payButtonPayPal").disabled = true; } document.getElementById("payButtonCreditCard").disabled = true; document.getElementById("payButtonCreditCard").innerHTML = " מייצר הזמנה, אנה המתן..."; if(document.getElementById("payButtonWhatsAppBootstrap")){ document.getElementById("payButtonWhatsAppBootstrap").style.display = 'none'; } if(document.getElementById("payButtonPayPalBootstrap")){ document.getElementById("payButtonPayPalBootstrap").style.display = 'none'; } document.getElementById("payButtonCreditCardBootstrap").className = "col-12"; break; } var uniqNum = "88a5b197b63557796d"; var data = ""; data+= "task=CreateOrder"; data+= "&Fullname="+Frm.Fullname.value; data+= "&Mobile="+Frm.Mobile.value; data+= "&Email="+Frm.Email.value; data+= "&City="+Frm.City.value; data+= "&Address="+Frm.Address.value; data+= "&Remark="+Frm.Remark.value; data+= "&uniqNum="+encodeURIComponent(uniqNum); $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , error: function() { return 'error'; }, success: function(Result) { Result = trim(Result," "); switch(PayBuy) { case "Regular": alert("הזמנה נשלחה למערכת"); window.location.href = "index.php"; break case "whatsapp": //alert(Result); var whatsapp_phone = "972542499889"; var location_href = "https://api.whatsapp.com/send?phone="+whatsapp_phone+"&text="+Result+"&source=&data="; window.location.href = location_href; break; case "paypal": var paypal_email = ""; var btn_return = encodeURIComponent(WebsiteDomain+"/ThanksPage.php"); var btn_cancel_return = ""; encodeURIComponent(WebsiteDomain+'/CancelPage.php'); var cbt = ""; // חזרה לחנות"; var location_href = "https://www.paypal.com/cgi-bin/webscr/"; location_href+= "?business="+paypal_email; location_href+= "&cmd=_xclick"; location_href+= "&item_name=תשלום מ"+Frm.Fullname.value+" עבור מס "+uniqNum; location_href+= "&amount="+PayAmount; location_href+= "¤cy_code=ILS"; location_href+= "&return="+btn_return; location_href+= "&cancel_return="+btn_cancel_return; //location_href+= "&cbt="+cbt; window.location.href = location_href; break; case "ccard": var location_href = "PayPlusCreatePaymentPage.php"; location_href+= "?uniqNum="+uniqNum; location_href+= "&custom_invoice_name=תשלום מ"+Frm.Fullname.value+" עבור מס "+uniqNum; location_href+= "&amount="+PayAmount; location_href+= "&Fullname="+Frm.Fullname.value; location_href+= "&Email="+Frm.Email.value; location_href+= "&Mobile="+Frm.Mobile.value; location_href+= "&City="+Frm.City.value; location_href+= "&Address="+Frm.Address.value; window.location.href = location_href; break; } } }); } function UserLogin(GetFrm) { //$.LoadingOverlay("show"); setTimeout(function(){ var Frm = document.getElementById(GetFrm); var data = ""; data+= "task=UserLogin"; data+= "&LoginMobile="+Frm.LoginMobile.value; data+= "&LoginPassword="+Frm.LoginPassword.value; $.ajax({ type: "POST" , url: 'GlobalIncludes/_CLASS/class.basket.php' , data: data , async: false , cache: false , timeout: 5000 , dataType: 'text' , error: function() { return 'error'; }, success: function(Result) { //$.LoadingOverlay("hide"); if(Result.search("{success}")>0) { //alert("התחברת בהצלחה"); var htmlOutput = ""; htmlOutput+= '