vendor/crehler/shopping-list/Resources/views/storefront/base.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@CrehlerMojeBambinoEngine/storefront/base.html.twig' %}
  2.     {% block base_script_router %}
  3.         {{ parent() }}
  4.         <script>
  5.             window.router['frontend.shopping-list.page.addItem'] = '{{ path('frontend.shopping-list.page.addItem') }}';
  6.             window.router['frontend.shopping-list.page.create'] = '{{ path('frontend.shopping-list.page.create') }}';
  7.             window.router['frontend.shopping-list.info'] = '{{ path('frontend.shopping-list.info') }}';
  8.         </script>
  9.         <script>
  10.             window.ShoppingListState = {};
  11.             window.ShoppingListState.list = {
  12.                 {% for shoppingList in context.extensions.shoppingLists %}
  13.                     {% set listCounter = 0 %}
  14.                     {% for listItem in shoppingList.shoppingListItem %}
  15.                         {% set listCounter = listCounter + listItem.quantity %}
  16.                     {% endfor %}
  17.                     '{{ loop.index0 }}' : {
  18.                         'id': '{{ shoppingList.id }}',
  19.                         'name': '{{ shoppingList.name }}',
  20.                         'itemCount': {{ listCounter }},
  21.                         'isCustomer': {% if shoppingList.customerId %}true{% else %}false{% endif %},
  22.                         'productIds': '{{ shoppingList.getShoppingListProductIds()|raw}}',
  23.                         'isNew': false
  24.                     },
  25.                     {% set isCustomer = (shoppingList.customerId is not null) %}
  26.                 {% endfor %}
  27.             };
  28.             window.ShoppingListState.isCustomer = {% if isCustomer %}true{% else %}false{% endif %};
  29.         </script>
  30.         <script type="text/javascript">
  31.             let productIds = [];
  32.             {% for shoppingList in context.extensions.shoppingLists %}
  33.             {% for listItem in shoppingList.shoppingListItem %}
  34.                 productIds.push('{{ listItem.productId }}')
  35.             {% endfor %}
  36.             {% endfor %}
  37.             window.ShoppingListState.productIds = productIds;
  38.         </script>
  39.     {% endblock %}
  40. {% block base_pseudo_modal %}
  41.     {{ parent() }}
  42.     {% sw_include '@CrehlerShoppingList/storefront/component/shopping-list/shopping-list.html.twig' %}
  43. {% endblock %}