⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
cms-1.dev-unit.com
/
core
/
assets
/
front
/
js
/
View File Name :
cart.js
!function(t){"use strict";jQuery(document).ready(function(t){t(".cart-link").click(function(){let e=t(this).attr("data-href");console.log(e);let a=t(".cart-amount").val();a>1?t.get(e+",,,"+a,function(e){e.message?(toastr.success(e.message),t(".cart-amount").val(1),t("#cartIconWrapper").load(location.href+" #cartIconWrapper")):(toastr.error(e.error),t(".cart-amount").val(1),t("#cartIconWrapper").load(location.href+" #cartIconWrapper"))}):t.get(e,function(e){e.message?(toastr.success(e.message),t("#cartIconWrapper").load(location.href+" #cartIconWrapper")):(toastr.error(e.error),t("#cartIconWrapper").load(location.href+" #cartIconWrapper"))})}),t(document).on("click","#cartUpdate",function(){let e=[],a=[],r=[],o=t(this).attr("data-href");t(".cart_qty").each(function(){e.push(t(this).val())}),t(".cart_price span").each(function(){a.push(parseFloat(t(this).text()))}),t(".product_id").each(function(){r.push(t(this).val())});let c=new FormData,n=0;for(n=0;n<e.length;n++)c.append("qty[]",e[n]),c.append("cartprice[]",a[n]),c.append("product_id[]",r[n]);t.ajaxSetup({headers:{"X-CSRF-TOKEN":t('meta[name="csrf-token"]').attr("content")}}),t.ajax({type:"POST",url:o,data:c,processData:!1,contentType:!1,success:function(a){if(console.log(a),a.message){let r=[];t(".cart_price span").each(function(){r.push(parseFloat(t(this).text()))}),t(".sub-total span").each(function(a,o){t(this).text(r[a]*e[a])}),t(".cart-total-view").text(a.total),toastr.success(a.message),a.count&&(t(".cart-item-view").text(a.count),t(".cart-total-view").text(("left"==position?symbol+" ":"")+a.total+("right"==position?" "+symbol:""))),t("#cartIconWrapper").load(location.href+" #cartIconWrapper")}else toastr.error(a.error)}})}),t(document).on("click",".item-remove",function(){let e=t(this).attr("rel"),a=t(this).attr("data-href");t.get(a,function(a){a.message?(toastr.success(a.message),0==a.count&&(t(".total-item-info").remove(),t(".cart-table").remove(),t(".cart-middle").remove(),t(".table-outer").html('\n <div class="bg-light py-5 text-center">\n <h3 class="text-uppercase">Cart is empty!</h3>\n </div>')),t(".cart-item-view").text(a.count),t(".cart-total-view").text(("left"==position?symbol+" ":"")+a.total+("right"==position?" "+symbol:"")),t(".remove"+e).remove(),t("#cartIconWrapper").load(location.href+" #cartIconWrapper")):toastr.error(a.error)})})}),t(document).on("click",".addclick",function(){let e=t(".cart-amount").val();t("#order_click_with_qty").val(e)}),t(document).on("click",".subclick",function(){let e=t(".cart-amount").val();t("#order_click_with_qty").val(e)})}(jQuery);