{{ 'section-footer-v4.css' | asset_url | stylesheet_tag }}

{% comment %} Add padding bottom for toolbar mobile {% endcomment %}
{% liquid
  assign placeholder = 'newsletter.email' | t
  assign template = template | split: '.' | first
  if template != 'product'
    assign pb_mobile = '--pb-mobile: 53px'
  else
    assign pb_mobile = ''
  endif
%}

{% comment %} Sticky add cart is hidden when reach here {% endcomment %}
<xo-sticky-hidden xo-name='sticky-addcart'></xo-sticky-hidden>
<footer {% render 'section-attr', style: pb_mobile %}>
  <div class='footer-v19__top'>
    <xo-container {% render 'section-layout' %}>
      <xo-grid>
        {% for block in section.blocks %}
          {% case block.type %}
            {% when 'information' %}
              <xo-animate xo-cascade style='--xs: 12; --md: 6; --lg: 3'>
                {%- if block.settings.logo != blank -%}
                  <a href='/' class='footer-v19__logo'>
                    {%- assign logo_alt = block.settings.logo.alt | default: shop.name | escape -%}
                    {%- assign width = block.settings.logo_width %}
                    {%- assign height = block.settings.logo_width | divided_by: block.settings.logo.aspect_ratio %}
                    <img
                      src='{{ block.settings.logo | image_url }}'
                      alt='{{ logo_alt }}'
                      style='width: {{ width }}px; height: {{ height }}px'
                      loading='lazy'
                      height='auto'
                      width='auto'
                    >
                  </a>
                {%- endif -%}
                <div class='footer-v19__address'>{{ block.settings.address }}</div>
                <ul class='footer-v19__information list-unstyled'>
                  <li>{{ block.settings.phone }}</li>
                  <li>{{ block.settings.email }}</li>
                </ul>
              </xo-animate>
            {% when 'menu' %}
              <xo-animate xo-cascade style='--xs: 12; --md: 6; --lg: 3'>
                {%- if block.settings.heading != blank -%}
                  <h2 class='footer-v19__heading'>{{- block.settings.heading -}}</h2>
                {%- endif -%}
                {%- if block.settings.menu != blank -%}
                  <ul class='list-unstyled'>
                    {%- for link in block.settings.menu.links -%}
                      <li class='footer-v19__list-item'>
                        <a
                          href='{{ link.url }}'
                        >
                          {{ link.title }}
                        </a>
                      </li>
                    {%- endfor -%}
                  </ul>
                {%- endif -%}
              </xo-animate>
            {% else %}
              <xo-animate xo-cascade style='--xs: 12; --md: 6; --lg: 3'>
                {%- if block.settings.heading != blank -%}
                  <h2 class='footer-v19__heading'>{{- block.settings.heading -}}</h2>
                {%- endif -%}
                <div class='footer-v19__map'>
                  {%- if block.settings.map_style == 'iframe' -%}
                    {{ block.settings.map_iframe }}
                  {%- else -%}
                    <a href='{{ block.settings.map_link }}'>
                      {% render 'image', image: block.settings.map_image %}
                    </a>
                  {%- endif -%}
                </div>
              </xo-animate>
          {% endcase %}
        {% endfor %}
      </xo-grid>
    </xo-container>
  </div>
  <xo-container {% render 'section-layout' %}>
    <div class='footer-v19__bottom'>
      <div class='footer-v19__copyright'>
        {% if section.settings.copyright != blank %}
          {{- section.settings.copyright -}}
        {% else %}
          <small class='footer-v19__copyright-content'>&copy; Copyright {{ 'now' | date: '%Y' }} | {{ shop.name | link_to: routes.root_url -}}</small>
          <small class='footer-v19__copyright-content'> By <a class='footer-v19__copyright-shopilaunch' href='https://shopilaunch.com/'> ShopiLaunch.</a> </small>
          <small class='footer-v19__copyright-content footer-v19__copyright-content--black'>{{ powered_by_link }}.</small>
        {% endif %}
      </div>
      <div class='footer-v19__payment'>
        {% if section.settings.image_payment != blank %}
          {% render 'image', image: section.settings.image_payment %}
        {% endif %}
      </div>
    </div>
  </xo-container>
</footer>

{% schema %}
{
  "name": "t:sections.footer_v4.name",
  "class": "section-footer",
  "settings": [
    {
      "type": "select",
      "id": "width",
      "label": "t:sections.all.width.label",
      "default": "box",
      "options": [
        {
          "value": "box",
          "label": "t:sections.all.width.options__1.label"
        },
        {
          "value": "wide",
          "label": "t:sections.all.width.options__2.label"
        },
        {
          "value": "fullwidth",
          "label": "t:sections.all.width.options__3.label"
        }
      ]
    },
    {
      "type": "liquid",
      "id": "copyright",
      "label": "t:sections.footer_v4.settings.copyright.label",
      "default": " © Copyright {{ 'now' | date: '%Y' }} | <a href='http://engotheme.com' rel='nofollow' target='_blank' class='footer-v19__theme-name'>Engo-theme</a> By <a href='https://shopilaunch.com/' rel='nofollow' target='_blank' class='footer-v19__shop-name'> ShopiLaunch.</a><a href='https://shopify.pxf.io/9gPaY0' rel='nofollow' target='_blank' class='footer-v19__powered-shopify'> Powered by Shopify.</a>"
    },
    {
      "type": "image_picker",
      "id": "image_payment",
      "label": "t:sections.footer_v4.settings.image_payment.label",
      "info": "t:sections.footer_v4.settings.image_payment.info"
    },
    {
      "type": "header",
      "content": "t:sections.all.heading.content"
    },
    {
      "type": "color_scheme",
      "id": "color_scheme",
      "label": "t:sections.all.color_scheme.label"
    },
    {
      "type": "color",
      "id": "background_color",
      "label": "t:sections.all.bg_color.label"
    },
    {
      "type": "color_background",
      "id": "background_gradient",
      "label": "t:sections.all.bg_gradient.label"
    },
    {
      "type": "number",
      "id": "padding_top",
      "label": "t:sections.all.padding_top.label",
      "default": 50
    },
    {
      "type": "number",
      "id": "padding_bottom",
      "label": "t:sections.all.padding_bottom.label",
      "default": 50
    }
  ],
  "blocks": [
    {
      "type": "information",
      "name": "t:sections.footer_v4.blocks.information.name",
      "settings": [
        {
          "type": "image_picker",
          "id": "logo",
          "label": "t:sections.footer_v4.blocks.information.settings.logo.label",
          "info": "t:sections.footer_v4.blocks.information.settings.logo.info"
        },
        {
          "type": "range",
          "id": "logo_width",
          "min": 50,
          "max": 550,
          "step": 5,
          "unit": "px",
          "label": "t:sections.footer_v4.blocks.information.settings.logo_width.label",
          "default": 80
        },
        {
          "type": "text",
          "id": "address",
          "default": "Address: 1234 Heaven Stress,USA.",
          "label": "t:sections.footer_v4.blocks.information.settings.address.label"
        },
        {
          "type": "text",
          "id": "phone",
          "default": "Phone: <span>(+84) 1800 68 68</span>",
          "label": "t:sections.footer_v4.blocks.information.settings.phone.label",
          "info": "t:sections.footer_v4.blocks.information.settings.phone.info"
        },
        {
          "type": "text",
          "id": "email",
          "default": "Email: <span>hello@domain.com</span>",
          "label": "t:sections.footer_v4.blocks.information.settings.email.label",
          "info": "t:sections.footer_v4.blocks.information.settings.email.info"
        }
      ]
    },
    {
      "type": "menu",
      "name": "t:sections.footer_v4.blocks.menu.name",
      "settings": [
        {
          "type": "text",
          "id": "heading",
          "default": "Quick links",
          "label": "t:sections.footer_v4.blocks.menu.settings.heading.label"
        },
        {
          "type": "link_list",
          "id": "menu",
          "label": "t:sections.footer_v4.blocks.menu.settings.menu.label"
        }
      ]
    },
    {
      "type": "location",
      "name": "t:sections.footer_v4.blocks.location.name",
      "settings": [
        {
          "type": "text",
          "id": "heading",
          "default": "Heading",
          "label": "t:sections.footer_v4.blocks.location.settings.heading.label"
        },
        {
          "type": "select",
          "id": "map_style",
          "label": "t:sections.footer_v4.blocks.location.settings.map_style.label",
          "options": [
            {
              "value": "iframe",
              "label": "t:sections.footer_v4.blocks.location.settings.map_style.option_1.label"
            },
            {
              "value": "image",
              "label": "t:sections.footer_v4.blocks.location.settings.map_style.option_2.label"
            }
          ],
          "default": "image"
        },
        {
          "type": "html",
          "id": "map_iframe",
          "label": "t:sections.footer_v4.blocks.location.settings.map_iframe.label"
        },
        {
          "type": "image_picker",
          "id": "map_image",
          "label": "t:sections.footer_v4.blocks.location.settings.map_image.label",
          "info": "t:sections.footer_v4.blocks.location.settings.map_image.info"
        },
        {
          "type": "url",
          "id": "map_link",
          "label": "t:sections.footer_v4.blocks.location.settings.map_link.label"
        }
      ]
    }
  ],
  "default": {
    "blocks": [
      {
        "type": "information"
      },
      {
        "type": "location"
      }
    ]
  }
}
{% endschema %}
