Gustavo Luigi 2022-09-01 20:02:36 +02:00
parent 5f79d45b5b
commit b8e77ca5f4
1 changed files with 19 additions and 14 deletions

View File

@ -294,20 +294,25 @@
objProducts[index].quantity = quantity; objProducts[index].quantity = quantity;
updateProductsInLocalStorage(); updateProductsInLocalStorage();
}); });
let url = null; if(objProducts.length > 0) {
if(window.location.origin == 'http://localhost') url = window.location.origin+'/areya-energy/public/'+btoa(JSON.stringify(objProducts)); let url = null;
else url = window.location.origin+'/'+btoa(JSON.stringify(objProducts)); if(window.location.origin == 'http://localhost') url = window.location.origin+'/areya-energy/public/'+btoa(JSON.stringify(objProducts));
$('#cart-link').attr('href', url); else url = window.location.origin+'/'+btoa(JSON.stringify(objProducts));
$('#cart-link').text(url); $('#cart-link').attr('href', url);
const shareData = { $('#cart-link').text(url);
title: "Share cart list", const shareData = {
text: 'share cart list', title: "Share cart list",
url: url, text: 'share cart list',
}; url: url,
$("#btn-share").click(async function() { };
if(navigator.share) { try { await navigator.share(shareData); } catch(err) { console.warn(err); } } $("#btn-share").click(async function() {
else { console.warn('Native Web Sharing not supported'); } 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();
}
}); });
</script> </script>
@yield('scripts') @yield('scripts')