{% extends "ui/templates/base/layout.html" %}
{% block content %}
  <h1 class="text-2xl font-semibold">Edit Financial Year</h1>
  <p class="mt-1 text-sm text-slate-600">{{ tenant.name if tenant else '' }} • {{ fy.year_code }}</p>

  <form class="mt-5 max-w-2xl rounded-2xl border bg-white p-5" method="post">
    <input type="hidden" name="csrf_token" value="{{ csrf_token }}" />
    <div class="grid gap-4">
      <label class="grid gap-1">
        <span class="text-sm font-medium text-slate-600">Financial Year Code</span>
        <input class="rounded-xl border bg-slate-100 px-3 py-2 text-slate-500" value="{{ fy.year_code }}" disabled />
      </label>

      <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
        <label class="grid gap-1">
          <span class="text-sm font-medium text-slate-600">Assessment Year</span>
          <input class="rounded-xl border px-3 py-2" name="assessment_year" value="{{ fy.assessment_year }}" required />
        </label>
        <label class="grid gap-1">
          <span class="text-sm font-medium text-slate-600">Status</span>
          <input class="rounded-xl border bg-slate-100 px-3 py-2 text-slate-500" value="{{ 'Locked' if fy.is_locked else 'Open' }}{% if fy.is_current %} / Current{% endif %}" disabled />
        </label>
        <label class="grid gap-1">
          <span class="text-sm font-medium text-slate-600">Start Date</span>
          <input type="date" class="rounded-xl border px-3 py-2" name="start_date" value="{{ fy.start_date }}" required />
        </label>
        <label class="grid gap-1">
          <span class="text-sm font-medium text-slate-600">End Date</span>
          <input type="date" class="rounded-xl border px-3 py-2" name="end_date" value="{{ fy.end_date }}" required />
        </label>
      </div>

      <div class="flex gap-3">
        <button class="rounded-xl bg-slate-900 px-4 py-2 text-sm font-medium text-white" type="submit">Save</button>
        <a class="rounded-xl border px-4 py-2 text-sm" href="/system-settings/financial-years?tenant_id={{ fy.tenant_id }}">Cancel</a>
      </div>
    </div>
  </form>
{% endblock %}
