{#**
 * Copyright since 2025 InPost S.A.
 *
 * For the full license information, please view the LICENSE file bundled with the module.
 *
 * @author InPost S.A.
 * @copyright since 2025 InPost S.A.
 * @license MIT
 *#}
{% extends '@Modules/inpostinternational/views/templates/admin/layout/layout.html.twig' %}

{% set layoutHeaderToolbarBtn = layoutHeaderToolbarBtn|default({})|merge({
  config: {
    href: path('admin_inpost_intl_config_api'),
    desc: 'Configuration'|trans({}, 'Admin.Global'),
    icon: 'settings',
    class: 'btn-outline-secondary',
  },
}) %}

{% form_theme pickup_time_form 'bootstrap_4_layout.html.twig' %}

{% block content %}
  <div class="row">
    <div class="col">
      <div class="card">
        <div class="card-header">
          <h3 class="d-inline-block card-header-title">{{ 'Check cutoff pickup time'|trans({}, 'Modules.Inpostinternational.Pickup') }}</h3>
        </div>

        {{ form_start(pickup_time_form) }}
        <div class="card-body card-block">
          <div class="form-wrapper card-text row">
            {{ form_errors(pickup_time_form) }}

            <div class="col-3">
              {{ form_row(pickup_time_form.address) }}
            </div>
            <div class="col-3">
              {{ form_row(pickup_time_form.countryCode) }}
            </div>
            <div class="col-3">
              {{ form_row(pickup_time_form.postalCode) }}
            </div>

            <div class="col-3 mt-auto">
              <div class="form-group">
                <button type="submit" class="btn btn-primary">{{ 'Submit'|trans({}, 'Modules.Inpostinternational.Admin') }}</button>
              </div>
            </div>

            <input type="hidden" name="_token" value="{{ user_token }}">
          </div>
        </div>
        {{ form_end(pickup_time_form) }}

      </div>

      {% include '@PrestaShop/Admin/Common/Grid/grid_panel.html.twig' %}
    </div>
  </div>

  {% if is_granted('create', constant('InPost\\International\\Controller\\Admin\\PickupOrderController::TAB_NAME')) %}
    {% include '@Modules/inpostinternational/views/templates/admin/pickup_order/_modal.html.twig' %}
  {% endif %}
{% endblock %}

{% block javascripts %}
  {{ parent() }}

  <script src="{{ asset('themes/default/js/bundle/pagination.js') }}"></script>
  <script src="{{ asset('js/admin/shipment/index.js', 'InPostInternational') }}"></script>
{% endblock %}
