<tr>
  <td>
    <div class="gc-title">{{ row.Standort_Name }}</div>
    <div class="gc-subtitle">{{ row.Bereich }}</div>
  </td>

  <td class="gc-main-cell">
    <a class="gc-title text-decoration-none" href="/app/forderungen/liste?Kunde={{ row.Kunde_Text|urlencode }}">
      {{ row.Kunde_Text }}
    </a>
    <div class="gc-subtitle">
      {{ row.Besitzer_Kunde_Text or '' }}
      {% if row.Kunde_Email %}
      · <a href="mailto:{{ row.Kunde_Email }}?subject={{ row.Beleg_Nr }}" hx-disable="true">E-Mail</a>
      {% endif %}
    </div>
  </td>

  <td>
    <a href="/app/forderungen/liste?Verursacher={{ row.Verursacher_Text|urlencode }}"
      class="text-decoration-none fw-semibold">
      {{ row.Verursacher_Text }}
    </a>
    {% if row.Verursacher_Text == 'N.N.' %}
    <span class="gc-badge gc-badge-warning ms-1">offen</span>
    {% endif %}
  </td>

  <td>
    <a href="#" data-coreui-toggle="modal" data-coreui-target="#exampleModal">
      <span class="gc-badge gc-badge-info">{{ row.Beleg_Nr }}</span>
    </a>
  </td>

  <td>
    <div>{{ row.Beleg_Datum|date_format }}</div>
    <div class="gc-subtitle">fällig {{ row.Fällig_Datum|date_format }}</div>
  </td>

  <td class="text-end align-top">
    <div class="gc-money">{{ row.Beleg_Betrag|number_format }} €</div>
  </td>

  <td class="text-end">
    <div class="gc-money">{{ row.Beleg_offen|number_format }} €</div>
    <div class="gc-subtitle">{{ row.Kunde_gesamt_Bezug }} {{ row.Kunde_offen_gesamt|number_format }} €</div>
  </td>

  <td class="text-end">
    {% set mahnstufe = row.Mahnstufe or '0' %}

    {% if mahnstufe and mahnstufe|string != '0' %}
    <span class="gc-badge gc-badge-danger gc-mahnstufe-{{ mahnstufe }}">
      M{{ mahnstufe }}
    </span>
    {% endif %}
    <div class="gc-subtitle">{{ row.Beleg_Tage_offen }} Tage</div>
  </td>

  <td class="text-end">
    {% if row.Abwarten %}
    <span class="gc-badge gc-badge-warning">{{ row.Abwarten }}</span>
    {% endif %}
  </td>

  <td>
    <div class="gc-subtitle">{{ row.Kommentar_Fibu or '' }}</div>
  </td>

  <td>
    <div class="gc-subtitle">{{ row.Kommentar_Abteilung or '' }}</div>
  </td>

  <td class="text-end">
    {% if row.Wiedervorlage %}
    <span class="gc-badge gc-badge-success">{{ row.Wiedervorlage|date_format }}</span>
    {% endif %}
  </td>

  <td>
    <a href="/app/forderungen/details/{{ row.Client_DB }}_{{ row.Beleg_Nr }}"
      class="btn btn-sm btn-primary gc-action-btn">
      <i class="icon cil-pencil"></i>
    </a>
  </td>
</tr>