/** * 2007-2020 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2020 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ function isNormalInteger(e){return/^\+?(0|[0-9]\d*)$/.test(e)}function RegexEmail(e){return/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test(e)}function validate(e,a){return""==document.notify_sms_mail_form.sendin_notify_email.value||0==RegexEmail(document.notify_sms_mail_form.sendin_notify_email.value)?(alert(e),document.notify_sms_mail_form.sendin_notify_email.focus(),!1):!(document.notify_sms_mail_form.sendin_notify_value.value<=0||0==isNormalInteger(document.notify_sms_mail_form.sendin_notify_value.value))||(alert(a),document.notify_sms_mail_form.sendin_notify_value.focus(),!1)}function isInteger(e){return!!/^[+-]?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(e)}$(document).ready(function(){var e=jQuery("#customtoken").val(),a=jQuery("#id_shop_group").val(),t=jQuery("#id_shop").val();jQuery("#iso_code").val();if(!$("#apikeybox").is(":hidden")){$("#sender_order").keyup(function(){var e=$(this).val();isInteger(e)||e.length,$("#sender_order").attr("maxlength","11"),$("#sender_order_text").text(11-e.length)}),$(".manage_subscribe_block input[name=subscribe_confirm_type]").click(function(){$(".manage_subscribe_block .inner_manage_box").slideUp(),$(this).parents(".manage_subscribe_block").find(".inner_manage_box").slideDown()}),$(".openCollapse").click(function(){$(this).is(":checked")?$(this).parent(".form-group").find(".collapse").slideDown():$(this).parent(".form-group").find(".collapse").slideUp()}),$("#template_doubleoptin").bind("change",function(){if(-1===$(this).find("option:selected").text().toLowerCase().indexOf("double optin")){alert("You must select a template with the tag [DOUBLEOPTIN]");var e=$("#template_doubleoptin option").filter(function(){return-1!==$(this).text().toLowerCase().indexOf("double optin")});e.attr("selected",!0),$(this).val(e.val())}}),window.onload=function(){var e=$("#newsletter").val();$("#newsletter").append('')},$("#sender_order").keyup(function(e){var a=$(this).val();a=a.replace(/[^a-zA-Z 0-9]+/g,""),$("#sender_order").val(a)}),$("#sender_shipment").keyup(function(e){var a=$(this).val();a=a.replace(/[^a-zA-Z 0-9]+/g,""),$("#sender_shipment").val(a)}),$("#sender_campaign").keyup(function(e){var a=$(this).val();a=a.replace(/[^a-zA-Z 0-9]+/g,""),$("#sender_campaign").val(a)});var s,n=$("#sender_order").val();if(n&&(isInteger(n)||n.length,$("#sender_order").attr("maxlength","11"),$("#sender_order_text").text(11-n.length)),$("#sender_order").keydown(function(e){32==e.keyCode&&e.preventDefault()}),$("#sender_order_message").keyup(function(){var e=this.value.length,a=Math.ceil(e/160),t=160*a-(e%(160*a)||160*a);0==t&&(t=160),$("#sender_order_message_text").text(t),$("#sender_order_message_text_count").text(a)}),void 0!==$("#sender_order_message").val()){var i=$("#sender_order_message").val().length,r=160*(o=Math.ceil(i/160))-(i%(160*o)||160*o);$("#sender_order_message_text").text(r),$("#sender_order_message_text_count").text(o)}if($("#sender_shipment").keyup(function(){var e=$(this).val();isInteger(e)||e.length,$("#sender_shipment").attr("maxlength","11"),$("#sender_shipment_text").text(11-e.length)}),(s=$("#sender_campaign").val())&&(isInteger(s)||s.length,$("#sender_campaign").attr("maxlength","11"),$("#sender_campaign_text").text(11-s.length)),$("#sender_campaign").keydown(function(e){32==e.keyCode&&e.preventDefault()}),$("#sender_shipment_message").keyup(function(){var e=this.value.length,a=Math.ceil(e/160),t=160*a-(e%(160*a)||160*a);0==t&&(t=160),$("#sender_shipment_message_text").text(t),$("#sender_shipment_message_text_count").text(a)}),void 0!==$("#sender_shipment_message").val()){i=$("#sender_shipment_message").val().length,r=160*(o=Math.ceil(i/160))-(i%(160*o)||160*o);$("#sender_shipment_message_text").text(r),$("#sender_shipment_message_text_count").text(o)}if($("#sender_campaign").keyup(function(){var e=$(this).val();isInteger(e)||e.length,$("#sender_campaign").attr("maxlength","11"),$("#sender_campaign_text").text(11-e.length)}),(s=$("#sender_campaign").val())&&(isInteger(s)||s.length,$("#sender_campaign").attr("maxlength","11"),$("#sender_campaign_text").text(11-s.length)),$("#sender_campaign").keydown(function(e){32==e.keyCode&&e.preventDefault()}),$("#sender_campaign_message").keyup(function(){var e=this.value.length,a=Math.ceil(e/160),t=160*a-(e%(160*a)||160*a);0==t&&(t=160),$("#sender_campaign_message_text").text(t),$("#sender_campaign_message_text_count").text(a)}),void 0!==$("#sender_campaign_message").val()){var o;i=$("#sender_campaign_message").val().length,r=160*(o=Math.ceil(i/160))-(i%(160*o)||160*o);$("#sender_campaign_message_text").text(r),$("#sender_campaign_message_text_count").text(o)}$(".sms_order_setting_cls").click(function(){var s=$("input:radio[name=sms_order_setting]:checked").val();$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxOrderSetting.php",data:"orderSetting="+s+"&token="+e+"&type=Order&id_shop_group="+a+"&id_shop="+t,beforeSend:function(){$("#ajax-busy").show()},success:function(e){$("#ajax-busy").hide(),1==s?jQuery(".hideOrder").show():jQuery(".hideOrder").hide(),c(e),$("html, body").animate({scrollTop:0},"slow")}})}),$(".sms_shiping_setting_cls").click(function(){var s=$("input:radio[name=sms_shiping_setting]:checked").val();$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxOrderSetting.php",data:"shipingSetting="+s+"&token="+e+"&type=shiping&id_shop_group="+a+"&id_shop="+t,beforeSend:function(){$("#ajax-busy").show()},success:function(e){$("#ajax-busy").hide(),1==s?jQuery(".hideShiping").show():jQuery(".hideShiping").hide(),c(e),$("html, body").animate({scrollTop:0},"slow")}})}),$(".sms_campaign_setting_cls").click(function(){var s=$("input:radio[name=sms_campaign_setting]:checked").val();$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxOrderSetting.php",data:"campaignSetting="+s+"&token="+e+"&type=campaign&id_shop_group="+a+"&id_shop="+t,beforeSend:function(){$("#ajax-busy").show()},success:function(e){$("#ajax-busy").hide(),1==s?jQuery(".hideCampaign").show():jQuery(".hideCampaign").hide(),c(e),$("html, body").animate({scrollTop:0},"slow")}})}),0==$("input:radio[name=sms_order_setting]:checked").val()?$(".hideOrder").hide():$(".hideOrder").show(),$(".Sendin_Sms_Choice").click(function(){1==jQuery(this).val()?(jQuery(".multiplechoice").hide(),jQuery(".singlechoice").show()):(jQuery(".multiplechoice").show(),jQuery(".singlechoice").hide())}),$("#sib_datetimepicker").datepicker({dateFormat:"yy-mm-dd"}),$(".sms_shiping_setting_cls").click(function(){1==$("input:radio[name=sms_shiping_setting]:checked").val()?jQuery(".hideShiping").show():jQuery(".hideShiping").hide()}),jQuery("input:radio[name=Sendin_Sms_Choice]").click(function(){var e=jQuery(this).val();0==e?(jQuery(".multiplechoice").show(),jQuery(".singlechoice").hide(),jQuery(".sib_datepicker").hide()):2==e?(jQuery(".multiplechoice").show(),jQuery(".singlechoice").hide(),jQuery(".sib_datepicker").show()):(jQuery(".singlechoice").show(),jQuery(".multiplechoice").hide(),jQuery(".sib_datepicker").hide())}),$(".sms_shiping_setting_cls").click(function(){1==$("input:radio[name=sms_shiping_setting]:checked").val()?jQuery(".hideShiping").show():jQuery(".hideShiping").hide()}),jQuery("#r1_Sendin_Sms_Choice").attr("checked",!0),0==$("input:radio[name=sms_credit]:checked").val()?jQuery(".hideCredit").hide():jQuery(".hideCredit").show(),$(".sms_credit_cls").click(function(){var s=jQuery("input:radio[name=sms_credit]:checked").val();$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxOrderSetting.php",data:"sms_credit="+s+"&token="+e+"&type=sms_credit&id_shop_group="+a+"&id_shop="+t,beforeSend:function(){$("#ajax-busy").show()},success:function(e){$("#ajax-busy").hide(),1==s?jQuery(".hideCredit").show():jQuery(".hideCredit").hide(),c(e),$("html, body").animate({scrollTop:0},"slow")}})}),0==$("input:radio[name=sms_shiping_setting]:checked").val()?$(".hideShiping").hide():$(".hideShiping").show(),$(".sms_campaign_setting_cls").click(function(){1==$("input:radio[name=sms_shiping_setting]:checked").val()?jQuery(".hideCampaign").show():jQuery(".hideCampaign").hide()}),0==$("input:radio[name=sms_campaign_setting]:checked").val()?$(".hideCampaign").hide():$(".hideCampaign").show(),$("#selectSmsList").multiselect({header:!1,checkall:!1}),$("#tabs li").click(function(){$("#tabs li").removeClass("active"),$(this).addClass("active"),$(".tab_content").hide();var e=$(this).find("a").attr("href");return $(e).fadeIn(),!1})}$("#showUserlist").click(function(){$("#userDetails").is(":hidden")?$(".midleft tr").length<=0?l(1,e)&&($("#Spantextless").show(),$("#Spantextmore").hide()):($("#Spantextless").show(),$("#Spantextmore").hide()):($("#Spantextmore").show(),$("#Spantextless").hide());$("#userDetails").slideToggle()}),$("#select").multiselect({header:!1,checkall:!1}),$(".keyyes").click(function(){1==jQuery(this).val()?(jQuery("#apikeybox").show(),jQuery(".hidetableblock").show(),jQuery(".unsubscription").show(),jQuery(".listData").show()):(jQuery("#apikeybox").hide(),jQuery(".hidetableblock").hide(),jQuery(".unsubscription").hide(),jQuery(".listData").hide())}),$(".scriptcls").click(function(){var s=$("input:radio[name=script]:checked").val();$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajax.php",data:{script:s,token:e,id_shop_group:a,id_shop:t},beforeSend:function(){$("#ajax-busy").show()},success:function(e){$("#ajax-busy").hide(),c(e)}})}),$(".smtptestclickcls").click(function(){var e=$("input:radio[name=smtpmail]:checked").val(),s=jQuery("#customtoken").val();0==e&&$("#smtptest").hide(),1==e&&$("#smtptest").show(),$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxsmtpconfig.php",data:{smtptest:e,token:s,id_shop_group:a,id_shop:t},beforeSend:function(){$("#ajax-busy").show()},success:function(e){$("#ajax-busy").hide(),c(e)}})}),0==$("input:radio[name=managesubscribe]:checked").val()?$(".managesubscribeBlock").hide():$(".managesubscribeBlock").show(),$(".managesubscribecls").click(function(){var e=$("input:radio[name=managesubscribe]:checked").val(),s=jQuery("#customtoken").val(),n=jQuery("#defaultnlmsg").val();0==e&&$(".managesubscribeBlock").hide(),1==e&&$(".managesubscribeBlock").show(),$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxsubscribeconfig.php",data:{managesubscribe:e,token:s,id_shop_group:a,id_shop:t},beforeSend:function(){$("#ajax-busy").show()},success:function(e){var a;"error"==e?(a=n,$(".msgclear").hide(),$(".header").before('
'+a+"
")):c(e),$("#ajax-busy").hide()}})});e=jQuery("#customtoken").val();$('
loading..').css({opacity:.5,position:"fixed",top:0,left:0,width:"100%",height:$(window).height()+"px",background:"white url("+base_url+"modules/sendinblue/views/img/loader.gif) no-repeat center"}).hide().appendTo("body"),$(".clssubmitautomation").click(function(){var s=$("input:radio[name=automation_radio]:checked").val(),n=$("#automsg").val();if(0==s&&!1===confirm(n))return;$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxAutomation.php",data:{automation_radio:s,token:e,id_shop_group:a,id_shop:t},beforeSend:function(){$("#ajax-busy").show()},success:function(e){$("#ajax-busy").hide()}})}),$(".clssubmitabandoned").click(function(){var s=$("input:radio[name=abandoned_radio]:checked").val(),n=$("#abanmsg").val();if(0==s&&!1===confirm(n))return;$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxAbandoned.php",data:{abandoned_radio:s,token:e,id_shop_group:a,id_shop:t},beforeSend:function(){$("#ajax-busy").show()},success:function(e){$("#ajax-busy").hide()}})});var d=window.location.href.split("#");function c(e){$(".msgclear").hide(),$(".header").before('
'+e+"
")}function l(e,s){$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxemailresult.php",data:{page:e,token:s,id_shop_group:a,id_shop:t},beforeSend:function(){$("#ajax-busy").show()},success:function(e){return $("#ajax-busy").hide(),$(".midleft").html(e),$(".midleft").ajaxComplete(function(a,t,s){$(".midleft").html(e)}),!0}})}d[1]?($(".main-tabs-content").find(".tab-pane").removeClass("active"),$(".main-tabs-content").find("#"+d[1]).addClass("active"),$(".main-tabs a").removeClass("active"),$(".main-tabs a#"+d[1]).addClass("active"),$("#tabs a").click(function(){var e=$(this).attr("href");$("#tabs li").removeClass("active"),$(this).parent("li").addClass("active"),$("#tab1, #tab2, #tab3").css("display","none"),$(e).css("display","block"),$("#tabs_content_container .tab_content").fadeOut(),$("#tabs_content_container "+e).fadeIn()})):($(".main-tabs-content").find("#about-sendinblue").addClass("active"),$(".main-tabs a#about-sendinblue").addClass("active")),$(document).on("click",".ajax_contacts_href",function(e){var s=$(this).attr("email"),n=$(this).attr("status"),i=jQuery("#customtoken").val();$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxcall.php",data:{email_value:s,newsletter_value:n,token:i,id_shop_group:a,id_shop:t},beforeSend:function(){$("#ajax-busy").show()},success:function(e){$("#ajax-busy").hide()}}),l($("#page_no").val(),i)}),$(document).on("click",".ajax_sms_href",function(e){var s=$(this).attr("email"),n=jQuery("#customtoken").val(),i=$(this).parent("td").find("#sms_status_val").val();$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxSmsStatus.php",data:{email:s,sms_blacklist_status:i,token:n,id_shop_group:a,id_shop:t},beforeSend:function(){$("#ajax-busy").show()},success:function(e){$("#ajax-busy").hide()}}),l($("#page_no").val(),n)}),$("#oem_list").change(function(){var e="",a=$("#oem_list option:selected").length-1;$("#oem_list option:selected").each(function(t,s){e+=$(this).text(),t'+a+"
");var s=$("#tipkk").height()+25;$("#tipkk").css("top",t.top-s+"px")}else"mouseout"==e.type&&$("#tipkk").remove()}),1==$("input[name=status]:checked").val()&&""!=$("input#apikeys").val()?($("#left-part").addClass("right-opened"),$("#right-part").show()):($("#left-part").removeClass("right-opened"),$("#right-part").hide()),$("input[name=status]#n").click(function(){setTimeout(function(){$("#left-part").removeClass("right-opened")},500),$("#right-part").hide()}),$("input[name=status]#y").click(function(){setTimeout(function(){$("#left-part").addClass("right-opened")},500),$("#right-part").show(),$(".tableblock").show()}),$(".main-tabs a").click(function(){var e=$(this).attr("data-id");$(".main-tabs-content .tab-pane.active").removeClass("active"),$(".main-tabs-content "+e).addClass("active"),$(".main-tabs a.active").removeClass("active"),$(this).addClass("active")})}),$(document).on("click",".testOrdersmssend",function(){var e=$(this).attr("successmsg"),a=$(this).attr("failmsg"),t=$("#customtoken").val(),s=$("#langvalue").val(),n=$("#sender_order").val(),i=$("#sender_order_message").val(),r=$("#sender_order_number").val(),o=$("#id_shop_group").val(),d=$("#id_shop").val(),c=$("#iso_code").val();return $.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxtestsms.php",data:{sender:n,message:i,number:r,langvalue:s,token:t,id_shop_group:o,id_shop:d,iso_code:c},beforeSend:function(){$("#ajax-busy").show()},success:function(t){$("#ajax-busy").hide(),1==$.parseJSON(t).result?alert(e):alert(a)}}),!1}),$(document).on("click",".testSmsShipped",function(){var e=$(this).attr("successmsg"),a=$(this).attr("failmsg"),t=$("#customtoken").val(),s=$("#langvalue").val(),n=$("#sender_shipment").val(),i=$("#sender_shipment_message").val(),r=$("#sender_shipment_number").val(),o=$("#id_shop_group").val(),d=$("#id_shop").val(),c=$("#iso_code").val();return $.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxTestSmsShipped.php",data:{sender:n,message:i,number:r,langvalue:s,token:t,id_shop_group:o,id_shop:d,iso_code:c},beforeSend:function(){$("#ajax-busy").show()},success:function(t){$("#ajax-busy").hide(),1==$.parseJSON(t).result?alert(e):alert(a)}}),!1}),$(document).on("click",".testSmsCampaignsend",function(){var e=$(this).attr("successmsg"),a=$(this).attr("failmsg"),t=$(this).attr("sendererr"),s=$(this).attr("mobileerr"),n=$(this).attr("messageerr"),i=$("#customtoken").val(),r=$("#langvalue").val(),o=$("#sender_campaign").val(),d=$("#sender_campaign_message").val(),c=$("#sender_campaign_number_test").val(),l=$("#id_shop_group").val(),u=$("#id_shop").val();return""==o?alert(t):""==d?alert(n):""==c?alert(s):$.ajax({type:"POST",async:!1,url:base_url+"modules/sendinblue/ajaxCampaignSmsTest.php",data:{sender:o,message:d,number:c,langvalue:r,token:i,id_shop_group:l,id_shop:u},beforeSend:function(){$("#ajax-busy").show()},success:function(t){$("#ajax-busy").hide(),1==$.parseJSON(t).result?alert(e):alert(a)}}),!1}),$(document).on("click",".sender_order_save",function(){var e=$(this).attr("senderfield"),a=$(this).attr("messagefield"),t=$("#sender_order").val(),s=$("#sender_order_message").val();return""==t?(alert(e),document.getElementById("sender_order").focus(),!1):""==s?(alert(a),document.getElementById("sender_order_message").focus(),!1):void 0}),$(document).on("click",".sender_shipment_save",function(){var e=$(this).attr("senderfield"),a=$(this).attr("messagefield"),t=$("#sender_shipment").val(),s=$("#sender_shipment_message").val();return""==t?(alert(e),document.getElementById("sender_shipment").focus(),!1):""==s?(alert(a),document.getElementById("sender_shipment_message").focus(),!1):void 0}),$(document).on("click",".sender_campaign_save",function(){var e=$(this).attr("senderfield"),a=$(this).attr("messagefield"),t=$("#sender_campaign").val(),s=$("#sender_campaign_message").val();return""==t?(alert(e),document.getElementById("sender_campaign").focus(),!1):""==s?(alert(a),document.getElementById("sender_campaign_message").focus(),!1):void 0});