{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_scroll_up %}
{{parent()}}
{% sw_include '@Storefront/storefront/layout/whatsapp-chat.html.twig' %}
{% endblock %}
{% block base_body_script %}
{{ parent() }}
<script type='text/javascript'>
if( typeof($) == 'undefined' ) {
document.write('<scr'+'ipt type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></scr'+'ipt>');
}
</script>
<script>
$(document).on("click", "#send-it", function () {
var a = document.getElementById("chat-input");
if(a.value !== ""){
var b = $("#get-number").text();
var x = $("#get-country-code").text();
c = document.getElementById("chat-input").value;
d = "https://web.whatsapp.com/send",
e = b,
f = "&text=" + c;
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) var d = "whatsapp://send";
var g = d + "?phone=" + x + e + f;
$('#chat-input').val('');
window.open(g, '_blank')
}
}),
$(document).on("click", ".informasi", function () {
document.getElementById("get-number").innerHTML = $(this).children(".my-number").text();
document.getElementById("get-country-code").innerHTML = $(this).children(".country-code").val();
$(".start-chat,.get-new").addClass("bcshow").removeClass("bchide"),
$(".home-chat,.head-home").addClass("bchide").removeClass("bcshow"),
$(".back-chat").addClass("bcshow").removeClass("bchide"),
document.getElementById("get-nama").innerHTML = $(this).children(".info-chat").children(".chat-nama").text(),
document.getElementById("get-label").innerHTML = $(this).children(".info-chat").children(".chat-label").text(),
document.getElementById("get-avatar").src = $(this).children(".info-chat").children(".chat-avatar").val()
}),
$(document).on("click", ".close-chat", function () {
$("#whatsapp-chat").addClass("bchide").removeClass("bcshow")
}),
$(document).on("click", ".back-chat", function () {
$(".start-chat,.get-new").addClass("bchide").removeClass("bcshow"),
$(".home-chat,.head-home").addClass("bcshow").removeClass("bchide"),
$(".back-chat").addClass("bchide").removeClass("bcshow"),
$("#whatsapp-chat").addClass("bcshow").removeClass("bchide")
}),
$(document).on("click", ".notification", function () {
$("#whatsapp-chat").addClass("bcshow").removeClass("bchide")
});
</script>
{% endblock %}