{% sw_extends '@CrehlerMojeBambinoEngine/storefront/base.html.twig' %}
{% block base_script_router %}
{{ parent() }}
<script>
window.router['frontend.shopping-list.page.addItem'] = '{{ path('frontend.shopping-list.page.addItem') }}';
window.router['frontend.shopping-list.page.create'] = '{{ path('frontend.shopping-list.page.create') }}';
window.router['frontend.shopping-list.info'] = '{{ path('frontend.shopping-list.info') }}';
</script>
<script>
window.ShoppingListState = {};
window.ShoppingListState.list = {
{% for shoppingList in context.extensions.shoppingLists %}
{% set listCounter = 0 %}
{% for listItem in shoppingList.shoppingListItem %}
{% set listCounter = listCounter + listItem.quantity %}
{% endfor %}
'{{ loop.index0 }}' : {
'id': '{{ shoppingList.id }}',
'name': '{{ shoppingList.name }}',
'itemCount': {{ listCounter }},
'isCustomer': {% if shoppingList.customerId %}true{% else %}false{% endif %},
'productIds': '{{ shoppingList.getShoppingListProductIds()|raw}}',
'isNew': false
},
{% set isCustomer = (shoppingList.customerId is not null) %}
{% endfor %}
};
window.ShoppingListState.isCustomer = {% if isCustomer %}true{% else %}false{% endif %};
</script>
<script type="text/javascript">
let productIds = [];
{% for shoppingList in context.extensions.shoppingLists %}
{% for listItem in shoppingList.shoppingListItem %}
productIds.push('{{ listItem.productId }}')
{% endfor %}
{% endfor %}
window.ShoppingListState.productIds = productIds;
</script>
{% endblock %}
{% block base_pseudo_modal %}
{{ parent() }}
{% sw_include '@CrehlerShoppingList/storefront/component/shopping-list/shopping-list.html.twig' %}
{% endblock %}