{% trans_default_domain 'products' %}
<div {{ attributes }}>
   <twig:block name="content">
      <p class="delivery delivery-{{ this.index }}">
         <a role="button"
                 title="{{ 'delivery.options.title'|trans }}"
                 aria-label="{{ 'delivery.options.title'|trans }}"
                 data-wpj-modal="{{ path('kupshop_components_modal_modal', {template: 'deliveries', id_product: this.id_product, id_variation: this.id_variation}) }}">
            {% if this.show_delivery_text or (this.piecesInStore <= 0 and this.show_delivery_text_not_instore) %}
               {{ this.text }}
            {% endif %}
            {% if this.piecesInStore <= 0 and this.show_number_not_instore %}
               {{ this.piecesInStore }}&nbsp;{{ this.unitShortcut|lower }}
            {% endif %}
            {% if this.show_in_store %}
               {% if this.maxVisibleInStore and this.piecesInStore > this.maxVisibleInStore %}
                  >&nbsp;{{ this.maxVisibleInStore }}&nbsp;{{ this.unitShortcut|lower }}
               {% elseif this.piecesInStore > 0 %}
                  {{ this.piecesInStore }}&nbsp;{{ this.unitShortcut|lower }}
               {% endif %}
            {% endif %}
            {% if this.piecesInStore and this.show_description_inStore %}
               {{ 'delivery.inStore.description'|trans }}
            {% endif %}
         </a>
         {% if this.piecesInStore <= 0 and this.getOnTheWay and this.getOnTheWay.quantity > 0 %}
            <small class="future-delivery">
               ({{ this.getOnTheWay.quantity }} ks na cestě - očekáváme {{ this.getOnTheWay.dateObject|formatDate('d.M.') }})
            </small>
         {% endif %}
         {% if not this.getInStoreSuppliers and this.piecesInStore <= 0 and this.forecastedDate and this.show_forecasted_delivery %}
            <small class="forecasted-delivery">
               {{ 'forecasted.delivery.to_shop'|trans({'%date%': this.forecastedDate|formatDate('d.M.')}) }}
            </small>
         {% endif %}

         <twig:block name="tooltip"></twig:block>
      </p>
      {% if this.piecesInStore > 0 and this.show_deliveries_info and this.minPrice and this.minTime %}
         <div class="delivery-info">
            <p>
               {% if not this.minPrice.value.printFloatValue %}
                  {{ 'delivery.info.date.free'|trans({'%time%': this.minTime|formatDate('d.M')}) }}
               {% else %}
                  {{ 'delivery.info.date'|trans({'%price%': this.minPrice|formatPrice(withVat: true, ceil: true), '%time%': this.minTime|formatDate('d.M')}) }}
               {% endif %}
            </p>
            <button type="button"
                    title="{{ 'delivery.options.title'|trans }}"
                    aria-label="{{ 'delivery.options.title'|trans }}"
                    data-wpj-modal="{{ path('kupshop_components_modal_modal', {template: 'deliveries', id_product: this.id_product, id_variation: this.id_variation}) }}">{{ 'delivery.options'|trans }}</button>
         </div>
      {% endif %}
   </twig:block>
</div>
