/*! we normal functions */ function refreshErrorMsg(){$(".notification-error").css("display","none")}function refreshSuccessMsg(){$(".notification-success").css("display","none")}function releaseErrorMsg(i){$(".notification-error").find("ul").html(""),$(".notification-error").css("display","block"),$.isArray(i)?$.each(i,function(i,n){$(".notification-error").find("ul").append('
  • '+n+"
  • ")}):$(".notification-error").find("ul").append('
  • '+i+"
  • ")}function releaseSuccessMsg(i){$(".notification-success").find("ul").html(""),$(".notification-success").css("display","block"),$.isArray(i)?$.each(i,function(i,n){$(".notification-success").find("ul").append('
  • '+n+"
  • ")}):$(".notification-success").find("ul").append('
  • '+i+"
  • ")}function formatDate(i){var n=new Date(i),r=n.getDate(),s=n.getMonth();s+=1;var a=n.getFullYear();r<10&&(r="0"+r),s<10&&(s="0"+s);var t=r+"/"+s+"/"+a;return"NaN/NaN/NaN"==t&&(t="Chưa x\xe1c định"),t}function formatCurrency(i){var n;return new Intl.NumberFormat("vi-VN",{style:"currency",currency:"VND",minimumFractionDigits:0,maximumFractionDigits:3}).format(i)}function formatQuantity(i){var n;return new Intl.NumberFormat("vi-VN",{minimumFractionDigits:0,maximumFractionDigits:3}).format(i)}function abbreviateNumber(i){if(i<1e3)return i;var n=Math.log10(Math.abs(i))/3|0;if(0==n)return i;var r=["","k","M","B","T","P","E"][n];return(i/Math.pow(10,3*n)).toFixed(1)+r} /*! weajax v6.1.2 */ $(document).ready(function(){var testimonialsWrap;if($(".nice-select").niceSelect(),$(document.body).on("change","#province",function(e){e.preventDefault();var t=$(this).val(),o={};o.id=t,$.ajax({method:"GET",url:"/get-district",data:o,success:function(e){var e=JSON.parse(e),t=e.html;e.provinceName,$("#district option").remove(),$("#district").append(t)}})}),$(document.body).on("change","#district",function(e){e.preventDefault();var t=$(this).val(),o={};o.id=t,$.ajax({method:"GET",url:"/get-ward",data:o,success:function(e){var e=JSON.parse(e),t=e.html;e.districtName,$("#ward option").remove(),$("#ward").append(t)}})}),$("#order_process_note").hide(),$(document.body).on("click",".quick-view",function(e){var t=$(this).data("id"),o={};o.id=t,$.ajax({method:"GET",url:"/xem-nhanh-san-pham/modal",data:o,success:function(e){var e=JSON.parse(e),t=e.html;$("#modalProduct .modal-content").empty(),$("#modalProduct .modal-content").append(t),preloader(),$(".product_navactive").owlCarousel({loop:!1,nav:!1,autoplay:!1,items:3,dots:!1,navText:['
    ','
    '],responsiveClass:!0,responsive:{0:{items:1},250:{items:2},480:{items:3},768:{items:3}}}),$(".product_navactive a").on("click",function(e){e.preventDefault();var t=$(this).attr("href");$(".product_navactive a").removeClass("active"),$(this).addClass("active"),$(".product-details-large .tab-pane").removeClass("active show"),$(".product-details-large "+t).addClass("active show")}),$("#modalProduct").modal("show")}})}),$(document.body).on("click",".size-guide",function(e){$("#sizeguideModal").modal("show")}),$(document.body).on("click",".shipping-guide",function(e){$("#shippingguideModal").modal("show")}),$(document.body).on("click","#order_paid",function(e){$(this).fadeOut(),$("#order_process_note").fadeIn()}),$(document.body).on("click","#order_button_payment",function(e){$("#pre-load-checkout").show()}),$(document.body).on("click","#btn_hm_searchbox",function(e){$("#pre-load-checkout").show()}),$(document.body).on("click","#copy_momo_note",function(e){var t=document.getElementById("momo_payment_message"),o=document.createElement("textarea");o.value=t.textContent,text=o.value,document.body.appendChild(o),o.select(),document.execCommand("Copy"),o.remove(),$.toast({heading:"Success",text:"Đ\xe3 copy nội dung thanh to\xe1n MoMo "+text,position:"top-right",icon:"success"})}),$(".filter__product__mobile").on("click",function(){$(".offcanvas-shopfilter-wrapper").addClass("active"),$(".offcanvas-shopfilter-overlay").addClass("active")}),$(".offcanvas-shopfilter-overlay, .filter__product__mobile__close").on("click",function(){$(".offcanvas-shopfilter-wrapper").removeClass("active"),$(".offcanvas-shopfilter-overlay").removeClass("active")}),$(document).on("wheel",function(e){"up"==(e.originalEvent.deltaY<0?"up":"down")?$(".mobile-bottom-nav").css("position","sticky"):$(".mobile-bottom-nav").css("position","fixed")}),$(".scroll-target").click(function(){$("html, body").animate({scrollTop:eval($("#"+$(this).attr("target")).offset().top-70)},1e3)}),null!==document.querySelector(".about-testimonials-wrapper")){let obTestimonials=new IntersectionObserver(e=>{e.forEach(e=>{let t=e.target.querySelector(".about-testimonials");if(e.isIntersecting){t.classList.add("animate__animated","animate__fadeInUp");return}t.classList.remove("animate__animated","animate__fadeInUp")})});obTestimonials.observe(document.querySelector(".about-testimonials-wrapper"))}}); /*! wefunc v6.1.2 */ function wishlistIsActive(){$("#wishlist_is_active")&&$("#wishlist_is_active").val("0")}function miniCartIsActive(){$("#minicart_is_active")&&$("#minicart_is_active").val("0")}function preloader(){$("#pre-load-checkout").show(),$("#pre-load-checkout").fadeOut(3e3)}function alertProductSize(){Swal.fire({icon:"error",title:"Oops...",text:"Vui l\xf2ng chọn k\xedch cỡ sản phẩm",footer:""})}function alertProductMofauto(){Swal.fire({icon:"error",title:"Oops...",text:"Vui l\xf2ng chọn h\xe3ng xe",footer:""})}function alertProductMotor(){Swal.fire({icon:"error",title:"Oops...",text:"Vui l\xf2ng chọn d\xf2ng xe",footer:""})}function alertProductBrand(){Swal.fire({icon:"error",title:"Oops...",text:"Vui l\xf2ng chọn thương hiệu",footer:""})}function alertProductAge(){Swal.fire({icon:"error",title:"Oops...",text:"Vui l\xf2ng chọn độ tuổi sản phẩm",footer:""})}function alertProductColor(){Swal.fire({icon:"error",title:"Oops...",text:"Vui l\xf2ng chọn m\xe0u sắc sản phẩm",footer:""})}function alertProductGender(){Swal.fire({icon:"error",title:"Oops...",text:"Vui l\xf2ng chọn giới t\xednh sản phẩm",footer:""})}function configFilterProduct(){Swal.fire({icon:"success",title:"Hooray...",text:"Lọc sản phẩm",showConfirmButton:!1,timer:1500,footer:""})}function alertChooseProvince(t){Swal.fire({icon:"success",title:"Hooray...",text:"Đ\xe3 chọn tỉnh/ th\xe0nh "+t,showConfirmButton:!1,timer:1500,footer:""})}function alertChooseDistrict(t){Swal.fire({icon:"success",title:"Hooray...",text:"Đ\xe3 chọn quận/ huyện "+t,showConfirmButton:!1,timer:1500,footer:""})}function alertIncQuantity(){Swal.fire({icon:"success",title:"Hooray...",text:"Đ\xe3 tăng số lượng sản phẩm",showConfirmButton:!1,timer:1200,footer:""})}function alertDescQuantity(){Swal.fire({icon:"warning",title:"Oops...",text:"Đ\xe3 giảm số lượng sản phẩm",showConfirmButton:!1,timer:1200,footer:""})}function confirmSwalToast(){return Swal.mixin({toast:!0,position:"top-end",showConfirmButton:!1,timer:3e3,timerProgressBar:!0,didOpen(t){t.addEventListener("mouseenter",Swal.stopTimer),t.addEventListener("mouseleave",Swal.resumeTimer)}})}function swalToast(t,o,i){confirmSwalToast().fire({icon:i,title:o})}function jsToast(t,o,i){$.toast({heading:t,text:o,position:"top-right",icon:i})}function confirmSwalPushNotification(t){return Swal.mixin({toast:!0,position:t,showConfirmButton:!1,timer:5e3,timerProgressBar:!0,didOpen(t){t.addEventListener("mouseenter",Swal.stopTimer),t.addEventListener("mouseleave",Swal.resumeTimer)}})}function swalPushNotification(t,o,i,e){confirmSwalPushNotification(e).fire({icon:i,title:o})}function scrollAtTop(){let t=document.documentElement;t.scrollTo({top:10,behavior:"smooth"})}function scrollAtShop(){document.querySelector("#shop__product__wrapper").scrollIntoView({behavior:"smooth"})}function scrollAtShopProductCat(){document.querySelector("#product__categories__accordion").scrollIntoView({behavior:"smooth"})}function scrollToProductDetail(){document.querySelector("#product__details__tab").scrollIntoView({block:"start",behavior:"smooth",inline:"start"})}function scrollAtBlog(){document.querySelector("#blog__area").scrollIntoView({block:"start",behavior:"smooth",inline:"start"})}function scrollAtAdmissionsForm(){document.querySelector("#admissionsregform_sending").scrollIntoView({block:"start",behavior:"smooth",inline:"start"})}function activeSetbg(){$(".set-bg").each(function(){var t=$(this).data("setbg");$(this).css("background-image","url("+t+")")})}function activeImagePopup(){$(".image-popup").magnificPopup({type:"image"})}function initSelect2(){$("#filter_manufacture").select2({width:"resolve",initSelection:function(t,o){}}),$("#filter_brand").select2({width:"resolve",initSelection:function(t,o){}}),$("#filter_origin").select2({width:"resolve",initSelection:function(t,o){}})}window.HTMLElement.prototype.scrollIntoView=function(){},wishlistIsActive(),miniCartIsActive(); /*! weform v6.1.2 */ jQuery(document).ready(function(e){e("#contact_phone_number").keypress(function(t){var n=t||window.event,a=n.keyCode||n.which;a=String.fromCharCode(a);var r=e("#contact_phone_number").val().length;r+1==1&&!/[0]/.test(a)&&(n.returnValue=!1,n.preventDefault&&n.preventDefault()),!/[0-9]/.test(a)&&(n.returnValue=!1,n.preventDefault&&n.preventDefault()),r+1>10&&(n.returnValue=!1,n.preventDefault&&n.preventDefault())}),e("#contact_sending").hide(),e("#submit_contact").click(function(t){var n=e("#contact_email").val();if(n&&!/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(n)){t.preventDefault(),alert("Email kh\xf4ng hợp lệ");return}e("#contact_form").hide(),e("#contact_sending").show()})}); /*! wearcuwidget v6.1.2 */ jQuery(document).ready(function(a){a("#wearcu_ribbon, #wearcu_viewapp").click(function(c){a("#wearcu_body").hasClass("wearcu-show")?(a("#wearcu_body").removeClass("wearcu-show",500),a("#wearcu_sayhi").addClass("wearcu-show",1e3),a("#wearcu_chatbot_body").removeClass("wearcu-show",500)):(a("#wearcu_body").addClass("wearcu-show",1e3),a("#wearcu_sayhi").removeClass("wearcu-show",500),a("#wearcu_chatbot_body").removeClass("wearcu-show",500))}),a(".wearcu-back-body").click(function(c){a("#wearcu_body").addClass("wearcu-show",1e3),a("#wearcu_chatbot_body").removeClass("wearcu-show",500),a("#wearcu_sayhi").removeClass("wearcu-show",500)}),a("#wearcu_close_body").click(function(c){a("#wearcu_body").hasClass("wearcu-show")&&a("#wearcu_body").removeClass("wearcu-show",1e3)}),a("#wearcu_close_sayhi").click(function(c){a("#wearcu_sayhi").hasClass("wearcu-show")&&a("#wearcu_sayhi").removeClass("wearcu-show",1e3)}),a("#wearcu_close_chatbot").click(function(c){a("#wearcu_chatbot_body").hasClass("wearcu-show")&&a("#wearcu_chatbot_body").removeClass("wearcu-show",1e3)}),a("#wearcu_open_chatbot").click(function(c){a("#wearcu_body").hasClass("wearcu-show")?(a("#wearcu_body").removeClass("wearcu-show",500),a("#wearcu_chatbot_body").addClass("wearcu-show",1e3)):(a("#wearcu_body").addClass("wearcu-show",1e3),a("#wearcu_chatbot_body").removeClass("wearcu-show",500))})}); /*! wechatbot v3.5 */ // document.addEventListener("DOMContentLoaded",e=>{document.getElementById("wearcu_userInputMsg").value=""}),$(document).ready(function(){async function e(){let e=document.getElementById("wearcu_userInputMsg").value;if(!e.trim()){alert("Vui l\xf2ng nhập nội dung tin nhắn.");return}$("#wearcu_userInputMsg").css("opacity","0.5"),$("#wearcu_chatbot_thinking_body").hasClass("d-none")&&$("#wearcu_chatbot_thinking_body").removeClass("d-none",1e3);var t={};t.userInputMsg=e,$.ajaxSetup({headers:{"X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr("content")}}),$.ajax({method:"POST",url:"/send-chatbot-message",data:t,success:function(e){var e=JSON.parse(e);e.textMessage;var t=e.htmlUserInput,n=e.htmlAssistantInput;$("#wearcu_chatbot_thinking_body").addClass("d-none",1e3),$("#wearcu_chatbot_msg_body").append(t),$("#wearcu_chatbot_msg_body").append(n);var a=$("#wearcu_chatbot_conversations");a.scrollTop(a.prop("scrollHeight")),$("#wearcu_userInputMsg").val(""),$("#wearcu_userInputMsg").css("opacity","1")},error:function(e,t,n){console.error(e)}})}$("#wearcu_chatsendbutton").click(function(t){e()}),$("#wearcu_userInputMsg").keydown(function(t){if(13==t.which){t.preventDefault(),e();var n=$("#wearcu_chatbot_conversations");n.scrollTop(n.prop("scrollHeight"))}})});