function isEmail(email) {var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;return regex.test(email);}function updateCartCount() {$.ajax({ method: "POST", url: "/ar_ma/cart-count", cache: false}).done(function( data ) {$('.cart-box #lblCartCount').html(data.count);if (data.count > 0) {$('.shopping-button').removeClass('d-none');/*$('.shopping-button').addClass('d-block');*/}console.log( data );});}function updateCartTotalItem(item_id) {$.ajax({ method: "POST", url: "/ar_ma/cart-total-item", data: { item_id: item_id }, cache: false}).done(function( data ) {console.log(data);$('.total-price-item-'+item_id).html(data.html);updateCartTotal();});}function updateCartTotal() {$.ajax({ method: "POST", url: "/ar_ma/cart-total", cache: false}).done(function( data ) {$('h3.total-cart').html(data.html);if (data.total == 0) {location.reload();}console.log(data);});}function updateCart(product_type, item_id, product_id, quantity, url) { $.ajax({ method: "POST", url: "/ar_ma/cart-update", data: { item_id: item_id, product_type: product_type, product_id: product_id, quantity: quantity, url: url }, cache: false}).done(function( data ) {if (quantity == -1) {$('.ibox-content-' + product_id).addClass('d-none');}$('#toast-success .toast-header .small').html("قبل بضع ثوان");$('#toast-success .toast-header .me-auto').html("سلتك");$('#toast-success .toast-body .fw-semibold').html("تم تحديث سلة التسوق الخاصة بك");$('#toast-success').toast('show');if (item_id > 0)updateCartTotalItem(item_id); updateCartCount();});}