
    <style>
        .dfvu_rates {
            text-align: center;
        }
        .content-area h1.entry-title {
            display: none;
        }
        .content-area#primary {
            margin: 0!important;
        }
        .dfvu_rates-main {
            font-size: 18px;
            margin-bottom: 40px;
        }
        .dfvu_rates-main-title {

            font-size: 24px;
            font-weight: bold;
            margin-bottom: 10px;

        }
        .dfvu_rates-rating {
            display: flex;
            flex-direction: row;
            justify-content: center;
            margin: 20px 0 40px;
        }
        #rate-customer_email,
        .dfvu_rates-question textarea {
            outline: none;
            resize: none;
            border-radius: 6px;
            font-family: 'Montserrat', sans-serif !important;
            height: 150px;
            max-width: 500px;
            width: 100%;
            border: 1px solid transparent;
        }
        #rate-customer_email {
            height: auto;
        }
        #rate-customer_email.err {
            border-color: red!important;
            transition: all 0.3s ease-in-out;
        }
        .dfvu_rates-question span {
            font-size: 14px;
        }
        .dfvu_rates-send {
            
            margin-top: 30px;
            
        }
        .dfvu_rates-send span {
            
            padding: 10px 20px;
            border-radius: 6px;
            background-color: #8dbccc;
            color: #fff;
            font-size: 20px;
            cursor: pointer;

        }
        .dfvu_rates-rating img {
            display: inline-block;
            max-height: 75px;
            width: auto;
            vertical-align: middle;
        }
        .dfvu_rates-rating input[type="radio"] {
            display: none;
            outline: none;
        }
        .dfvu_rates-rating input[type="radio"] + label {
            
            margin: 0 10px;
            padding: 3px;
            border: 4px solid transparent;
            border-radius: 50%;
            cursor: pointer;
            
        }
        .dfvu_rates-rating input[type="radio"] + label.active {
            
            filter: grayscale(100%);
            transition: all 0.3s ease-in-out;
        }
        .dfvu_rates-rating input[type="radio"]:checked + label.active {
            
            filter: none;
            
        }
        .dfvu_rates-rating input[type="radio"]:checked + label {
            
            transition: all 0.3s ease-in-out;
            border-color: #8dbccc;

        }
        .dfvu_rates.dis {
            pointer-events: none;
        }
        .dfvu_rates-thankyou {

            font-size: 20px;
            font-weight: bold;
            color: #8dbccc;
            display: none;

        }
        @media only screen and (max-width: 767px) {

            .dfvu_rates-main-title {

                font-size: 20px;
                line-height: 28px;
                margin-bottom: 20px;

            }

            .dfvu_rates-main {

                margin-bottom: 20px;
                font-size: 16px;

            }

            .dfvu_rates-rating {

                margin: 10px 0;

            }

            .dfvu_rates-rating input[type="radio"] + label {

                margin: 0 2px;

            }

            .dfvu_rates-send span {

                display: block;
                width: 100%;
                padding: 5px 0;

            }

            article.page {

                margin-bottom: 0;

            }

            .mazzaci_header_submenu_space {

                margin-bottom: 20px!important;

            }

            .dfvu_rates-thankyou {

                font-size: 16px;
                line-height: 22px;

            }

        }
            </style>

    <div class="dfvu_rates">

        <div class="dfvu_rates-main"><div class="dfvu_rates-main-title">Trebam tvoju pomoć. 💪</div> Reci mi što misliš o svojoj zadnjoj kupnji u našoj trgovini MAZZACI:</div>
        <div class="dfvu_rates-rating">
            <input type="radio" name="dfvu-rate" value="1" id="dfvu-rate-1">
            <label for="dfvu-rate-1">
                <img src="https://mazzaci.com/assets/img/rate/1.png?v=2" alt="">
            </label>
            <input type="radio" name="dfvu-rate" value="2" id="dfvu-rate-2">
            <label for="dfvu-rate-2">
                <img src="https://mazzaci.com/assets/img/rate/2.png?v=2" alt="">
            </label>
            <input type="radio" name="dfvu-rate" value="3" id="dfvu-rate-3">
            <label for="dfvu-rate-3">
                <img src="https://mazzaci.com/assets/img/rate/3.png?v=2" alt="">
            </label>
            <input type="radio" name="dfvu-rate" value="4" id="dfvu-rate-4">
            <label for="dfvu-rate-4">
                <img src="https://mazzaci.com/assets/img/rate/4.png?v=2" alt="">
            </label>
            <input type="radio" name="dfvu-rate" value="5" id="dfvu-rate-5">
            <label for="dfvu-rate-5">
                <img src="https://mazzaci.com/assets/img/rate/5.png?v=2" alt="">
            </label>
        </div>
        <div class="dfvu_rates-question">
            <span>Želiš li mi još nešto reći?</span>
            <br>
            <input placeholder="Adresa e-pošte" type="text" id="rate-customer_email">
            <br><br>
            <textarea placeholder="Poruka"></textarea>
        </div>
        <div class="dfvu_rates-send">
            <span>Pošalji</span>
        </div>
        <div class="dfvu_rates-thankyou">
            HVALA TI NA RECENZIJI! 👍🏻
        </div>

    </div>

    <script>

        $(document).ready(function(){

            setTimeout(function() {
                
                dfvu_check_rated();

            }, 1);

            var dfvu_rate_init = false;
            $('input[type="radio"][name="dfvu-rate"]').on('change', function(){

                if(dfvu_rate_init) return;
                dfvu_rate_init = true;

                $(this).parents('.dfvu_rates').find('label').addClass('active');

            });

            $('.dfvu_rates-send > span').on('click', function(){

                $('#rate-customer_email').removeClass('err');

                let rate = $('input[type="radio"][name="dfvu-rate"]:checked').val();
                
                if(!rate || !['1','2','3','4','5'].includes(rate)) return false;

                let comment = $('.dfvu_rates-question textarea').val();
                comment = comment.trim().length > 0 ? comment : false;

                let email_val = $('#rate-customer_email').val();
                let email = email_val.length && dfvu_kontakt_validate_email(email_val) ? email_val : false;

                if((email_val.length || comment) && !email) {

                    $('#rate-customer_email').addClass('err');
                    console.log('nono');
                    return false;

                }

                $.post('https://v15.dfvu.org/brand-rate/', {country:'HR', rating:rate, comment:comment, email:email});
                
                $('.dfvu_rates').addClass('dis');
                $('.dfvu_rates-send, .dfvu_rates-question').hide();
                $('.dfvu_rates-thankyou').fadeIn();

                dfvu_rate_restriction(rate);

                if(['4','5'].includes(rate)) {

                    setTimeout(function() {
                        
                        window.open('https://www.google.com/maps/place//data=!4m3!3m2!1s0x84ca260bb5515f53:0xcf2c99961b4ede19!12e1?source=g.page.m.kd._&laa=lu-desktop-review-solicitation');

                    }, 1500);

                }

            });

        });

        function dfvu_rate_restriction(rate) {

            var now = new Date();
            var expires = new Date();
            expires.setTime(now.getTime() + 2 * 24 * 60 * 60 * 1000);

            document.cookie = "dfvu_rate="+rate+"; expires=" + expires.toUTCString() + "; path=/";

        }

        function dfvu_check_rated() {

            let rate = getCookie('dfvu_rate');

            if (!rate) return false;
            
            $('.dfvu_rates').addClass('dis');
            $('.dfvu_rates-send, .dfvu_rates-question').hide();
            $('.dfvu_rates-thankyou').fadeIn();

            $('.dfvu_rates #dfvu-rate-'+rate).prop('checked', true);
            $('.dfvu_rates input[name="dfvu-rate"] + label').addClass('active');

            
        }

        function getCookie(name) {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = cookies[i].trim();
                if (cookie.indexOf(name + '=') === 0) {
                    return cookie.substring(name.length + 1);
                }
            }
            return null;
        }

        function dfvu_kontakt_validate_email(email) {

            return email.match(/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/);

        }

    </script>
    
    {"id":29488,"date":"2023-07-11T06:36:42","date_gmt":"2023-07-11T04:36:42","guid":{"rendered":"https:\/\/mazzaci.com\/hr\/?page_id=29488"},"modified":"2023-07-11T06:36:43","modified_gmt":"2023-07-11T04:36:43","slug":"rate","status":"publish","type":"page","link":"https:\/\/mazzaci.com\/hr\/rate\/","title":{"rendered":"rate"},"content":{"rendered":"\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/mazzaci.com\/hr\/wp-json\/wp\/v2\/pages\/29488"}],"collection":[{"href":"https:\/\/mazzaci.com\/hr\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mazzaci.com\/hr\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mazzaci.com\/hr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mazzaci.com\/hr\/wp-json\/wp\/v2\/comments?post=29488"}],"version-history":[{"count":1,"href":"https:\/\/mazzaci.com\/hr\/wp-json\/wp\/v2\/pages\/29488\/revisions"}],"predecessor-version":[{"id":29489,"href":"https:\/\/mazzaci.com\/hr\/wp-json\/wp\/v2\/pages\/29488\/revisions\/29489"}],"wp:attachment":[{"href":"https:\/\/mazzaci.com\/hr\/wp-json\/wp\/v2\/media?parent=29488"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mazzaci.com\/hr\/wp-json\/wp\/v2\/tags?post=29488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}