@if(inject('setting')->config('is_cookie'))
<div class="privacyPopup">
  <p>{{ inject('setting')->langs('system', 'cookie_txt') }}</p>
  <div class="buttons">
    <a class="agreeButton btn" onclick="agreePrivacyPolicy()">{{ inject('setting')->langs('system', 'accept') }}</a>
    <a class="disagreeButton btn" onclick="disagreePrivacyPolicy()">{{ inject('setting')->langs('system', 'reject') }}</a>
  </div>
</div>

<script>
    $(document).ready(function () {
        if (getCookie('privacy_cookie')) {
            document.querySelector('.privacyPopup').style.display = 'none';
        } else {
            document.querySelector('.privacyPopup').style.display = 'flex';
        }
    })

    function agreePrivacyPolicy() {
        setCookie("privacy_cookie", "1", 1)
        document.querySelector('.privacyPopup').style.display = 'none';
    }

    function disagreePrivacyPolicy() {
        setCookie("privacy_cookie", "2", 1)
        document.querySelector('.privacyPopup').style.display = 'none';
    }
</script>
@endif