\/td>
<\/i><\/a><\/td><\/tr>'}),$("div.cart-data .divCartTable table tbody").html(n),$("div.cart-data .divCartTable").removeClass("d-none"))}function removeProduct(n){if(n<=0){Swal.fire({title:"Error",text:"The product cannot be deleted!",icon:"error"});return}Swal.fire({title:"Warning",text:"Are you sure you want to delete the product from your cart?",showCancelButton:!0,cancelButtonText:"Cancel",confirmButtonText:"Yes"}).then(t=>{if(t.isConfirmed){var i=JSON.parse(localStorage.getItem("cart-data")??"[]");if(i.length==0){Swal.fire({title:"Error",text:"The item in your cart was not found!",icon:"error"});return}i=i.filter(t=>t.id!=n);localStorage.setItem("cart-data",JSON.stringify(i));Swal.fire({title:"Information",text:"The product has been deleted from your cart.",icon:"success"});getCartData()}})}function clearCartData(){Swal.fire({title:"Warning",text:"All items in your cart will be deleted, are you sure you want to continue?",showCancelButton:!0,cancelButtonText:"Cancel",confirmButtonText:"Yes"}).then(n=>{n.isConfirmed&&(localStorage.removeItem("cart-data"),getCartData())})}$(function(){getCartData();$(document).on("click",".divCartTable table tbody .btnProcess",function(n){n.preventDefault();removeProduct(parseInt($(this).attr("data-id")||0))});$(document).on("change keyup",".divCartTable table tbody .input-count",function(n){var i,u,t,r;n.preventDefault();i=$(this).attr("data-id");i>0&&(u=parseInt($(this).val()),t=JSON.parse(localStorage.getItem("cart-data")??"[]"),t.length>0&&(r=t.filter(n=>n.id==i),r.length>0&&(r[0].adet=u,localStorage.setItem("cart-data",JSON.stringify(t)))))})})
|