master
parent
75fb350e2e
commit
07338e08f5
|
@ -96,8 +96,8 @@
|
|||
</table>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<a href="" id="cart-link" style="color: var(--bs-link-color);"></a>
|
||||
<button id="btn-share">Share</button>
|
||||
<a href="" class="cart-link text-primary"></a>
|
||||
<button class="btn-share">Share</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -170,8 +170,8 @@
|
|||
if(typeof updateProducts === "function") $('#list-products').html('');
|
||||
totalPrice = 0;
|
||||
if(objProducts.length > 0) {
|
||||
$('#cart-link').show();
|
||||
$("#btn-share").show();
|
||||
$('.cart-link').show();
|
||||
$(".btn-share").show();
|
||||
let ids = objProducts.map(obj => obj.id);
|
||||
$.get($('meta[name="get-contents"]').attr('content')+"/"+ids.join(","), function(response, status){
|
||||
response.contents.forEach(function(item){
|
||||
|
@ -225,8 +225,8 @@
|
|||
$('#total-checkout-price').parent().parent().parent().hide();
|
||||
$('#no-products-in-checkout').show();
|
||||
}
|
||||
$('#cart-link').hide();
|
||||
$("#btn-share").hide();
|
||||
$('.cart-link').hide();
|
||||
$(".btn-share").hide();
|
||||
}
|
||||
$('#total-price').text(formatter.format(totalPrice));
|
||||
let productId = $('meta[name="product-id"]').attr('content');
|
||||
|
@ -302,20 +302,20 @@
|
|||
let url = null;
|
||||
if(window.location.origin == 'http://localhost') url = window.location.origin+'/areya-energy/public/'+btoa(JSON.stringify(objProducts));
|
||||
else url = window.location.origin+'/'+btoa(JSON.stringify(objProducts));
|
||||
$('#cart-link').attr('href', url);
|
||||
$('#cart-link').text(url);
|
||||
$('.cart-link').attr('href', url);
|
||||
$('.cart-link').text(url);
|
||||
const shareData = {
|
||||
title: "Share cart list",
|
||||
text: 'share cart list',
|
||||
url: url,
|
||||
};
|
||||
$("#btn-share").click(async function() {
|
||||
$(".btn-share").click(async function() {
|
||||
if(navigator.share) { try { await navigator.share(shareData); } catch(err) { console.warn(err); } }
|
||||
else { console.warn('Native Web Sharing not supported'); }
|
||||
});
|
||||
}else{
|
||||
$('#cart-link').hide();
|
||||
$("#btn-share").hide();
|
||||
$('.cart-link').hide();
|
||||
$(".btn-share").hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue