{% extends "/layouts/main.twig" %}
{% set active_menu = 'settings' %}

{% block title p__('title', 'Payment settings')|title %}

{% block template %}
<div>
  {% include "snippets/back.twig" with {link: 'admin/settings', label: 'Settings'} %}

  <h1 class="mt-4">{{ p__('title', 'Payments') }}</h1>
</div>

<div class="flex flex-col gap-4">
  <div class="grid gap-2 sm:gap-4 sm:grid-cols-2">
    {% for key, gateway in payment_gateways %}
    {% if key != "card" %}
    <a href="admin/settings/payments/{{ key }}"
      class="flex items-center justify-between box hover:border-line">
      <div>
        <div class="flex items-center gap-2">
          <h3>{{ gateway.name }}</h3>

          {% if gateway is not builtin %}
          <i class="text-lg cursor-auto ti ti-puzzle text-content-dimmed hover:text-content"
            x-tooltip.raw="{{ __('Plugin addition') }}"></i>
          {% endif %}
        </div>

        <p class="mt-1 text-sm text-content-dimmed">
          {{ gateway.enabled ? __('Gateway is enabled') : 'Gateway is disabled' }}
        </p>
      </div>

      <span
        class="relative w-6 h-6 rounded-full {{ gateway.enabled ? 'text-success' : 'text-content-dimmed' }}">
        <span
          class="absolute top-0 left-0 w-full h-full bg-current rounded-full opacity-20"></span>

        <span
          class="absolute w-3 h-3 -translate-x-1/2 -translate-y-1/2 bg-current rounded-full top-1/2 left-1/2"></span>
      </span>
    </a>
    {% endif %}
    {% endfor %}
  </div>
</div>
{% endblock %}