{% put scripts %}

<script>
    function setModal(product) {


        $('#modal_img').html(`<img src="` + product.images[0].original_image_url + `" alt="Nurgul ` + product.name + `">`);
        $('#modal_name').html(product.name);
        $('#modal_price').html(product.formatted_price);
        $('#modal_desc').html(product.description);

        $('#modal_add_btn').html(`
        <a ` + ("{{nurgulToken}}" == "" ? `href='/login'` : `href="javascrip:;" data-request="onAddCart" data-request-data="product_id: `+ product.id +`, quantity: `+ 1 +`"`) + `
            class="theme-btn-1 btn btn-effect-1 d-add-to-cart"
            title="{{add}}" data-bs-toggle="modal"
            data-bs-target="#add_to_cart_modal">
            <span id="modal_add">{{add}}</span>
        </a>
        `);

        $('#modal_wish').html(`
        <a ` + ("{{nurgulToken}}" == "" ? `href='/login'` : `href="javascript:;" data-request="onSaveWishlist" data-request-data="product_id: `+ product.id +`" `) + ` class="btn btn-effect-1 d-add-to-wishlist"
            title="Add to Cart" data-bs-toggle="modal"
            data-bs-target="#liton_wishlist_modal">
            <i class="icon-heart"></i>
        </a>
        `);
        if (product.hasOwnProperty('special_price')) {
            $('#modal_discount').show();
            $('#modal_discount').html(product.formatted_regular_price);
        } else {
            $('#modal_discount').hide();
        }
    }

</script>

{% endput %}
