{% put scripts %}

<script>
    getWish();
    $('#pagination').hide();
    // console.log("qqq");
    function getWish() {

        oc.ajax('onGetWish', {
            beforeSend: function () {
                $('#products_{{id}}').html("");
                $('#products_list_{{id}}').html("");
                $('#pagination_numbers').html("");
                $('#detail_screen').hide();
                $('#products_{{id}}').hide();
                $('#loader_{{id}}').show();
            },
            success: function (data, textStatus, xhr) {
                $('#detail_screen').show();
                $('#loader_{{id}}').hide();
                $('#products_{{id}}').show();
                // $('#show_title').html(`<span>{{'all'|_}}` + data.meta.total + `, {{'per.page'|_}} ` + data.meta.to + `</span>`);

                console.log(data);

                var products = data.data;
                if (products.length > 0) {
                    for (var product of products) {
                        // console.log(product.name);
                        $('#products_{{id}}').append(productCard(product.product));
                        $('#products_list_{{id}}').append(productList(product.product));
                    }
                }else{
                    $('#products_{{id}}').html('<div>{{"no.product"|_}}</div>');
                }

            },
            error: function (xhr, textStatus, errorThrown) {
                console.log('Error in Operation');
            }
        });
    }

</script>
{% endput %}

{%partial 'scripts/setModal' %}
{%partial 'scripts/prodCard' %}
