{% extends "admin/base.html" %}
{% import "macros/ui.html" as ui %}

{% block title %}{{ t(key="admin-payments", lang=lang | default(value='sk')) }}{% endblock title %}
{% block crumb %}{{ t(key="admin-payments", lang=lang | default(value='sk')) }}{% endblock crumb %}

{% block content %}
<header class="space-y-1">
  <h1 class="text-2xl font-bold text-on-surface-strong dark:text-on-surface-dark-strong">{{ t(key="admin-payments", lang=lang | default(value='sk')) }}</h1>
  <p class="text-sm text-on-surface/70 dark:text-on-surface-dark/70">{{ t(key="admin-payments-desc", lang=lang | default(value='sk')) }}</p>
</header>

<section class="mt-6 space-y-4">
  <h2 class="text-lg font-semibold text-on-surface-strong dark:text-on-surface-dark-strong">{{ t(key="payment-methods", lang=lang | default(value='sk')) }}</h2>
  {% for method in methods %}
  <form method="post" action="/admin/payments/methods/{{ method.id }}"
    class="flex flex-wrap items-center gap-4 rounded-radius border border-outline bg-surface p-5 dark:border-outline-dark dark:bg-surface-dark-alt">
  {{ ui::csrf_field() }}
    <div class="min-w-40">
      <p class="font-semibold text-on-surface-strong dark:text-on-surface-dark-strong">{{ t(key=method.label_key, lang=lang | default(value='sk')) }}</p>
      <p class="text-xs text-on-surface/60 dark:text-on-surface-dark/60">{{ method.code }}</p>
    </div>
    <div class="pb-1">{{ ui::checkbox(name="enabled", label=t(key="payment-enabled", lang=lang | default(value='sk')), checked=method.enabled) }}</div>
    {{ ui::button(label=t(key="save", lang=lang | default(value='sk')), type="submit", extra="ml-auto") }}
  </form>
  {% endfor %}
</section>

<section class="mt-8 space-y-4">
  <h2 class="text-lg font-semibold text-on-surface-strong dark:text-on-surface-dark-strong">{{ t(key="payment-bank-settings", lang=lang | default(value='sk')) }}</h2>
  <form method="post" action="/admin/payments/bank"
    class="space-y-4 rounded-radius border border-outline bg-surface p-5 dark:border-outline-dark dark:bg-surface-dark-alt">
  {{ ui::csrf_field() }}
    <div class="space-y-1.5">
      <label for="bank_account_name" class="text-sm font-medium text-on-surface-strong dark:text-on-surface-dark-strong">{{ t(key="bank-account-name", lang=lang | default(value='sk')) }}</label>
      {{ ui::input(name="bank_account_name", id="bank_account_name", value=bank_account_name) }}
    </div>
    <div class="space-y-1.5">
      <label for="bank_iban" class="text-sm font-medium text-on-surface-strong dark:text-on-surface-dark-strong">IBAN</label>
      {{ ui::input(name="bank_iban", id="bank_iban", value=bank_iban) }}
    </div>
    <div class="flex justify-end">
      {{ ui::button(label=t(key="save", lang=lang | default(value='sk')), type="submit") }}
    </div>
  </form>
</section>
{% endblock content %}
