{% set row = forderungen_details[0] %}

<div class="row mb-3">
  <div>
    <table class="table table-sm">
      <tr>
        <th colspan="2">Grunddaten</th>
      </tr>
      <tr>
        <td><strong>Hauptbetrieb:</strong></td>
        <td>{{row.Hauptbetrieb_Name }}</td>
      </tr>

      <tr>
        <td><strong>Standort:</strong></td>
        <td>{{row.Standort_Name }}</td>
      </tr>
      <tr>
        <td><strong>Benutzer:</strong></td>
        <td>{{row.Benutzer_ID }}</td>
      </tr>

      <tr>
        <td><strong>Verursacher:</strong></td>
        <td>{{row.Verursacher_Text }}</td>
      </tr>

      <tr>
        <td><strong>Bereich:</strong></td>
        <td>{{row.Bereich }}</td>
      </tr>

    </table>
  </div>
  <div>
    <table class="table table-sm">
      <tr>
        <th colspan="2">Beleg</th>
      </tr>
      <tr>
        <td><strong>Belegart:</strong></td>
        <td>{{row.Rechnung_Gutschrift }}</td>
      </tr>
      <tr>
        <td><strong>Beleg-Nr:</strong></td>
        <td>{{row.Beleg_Nr }}</td>
      </tr>
      <tr>
        <td><strong>Betrag:</strong></td>
        <td>{{row.Beleg_offen|number_format }} &euro;</td>
      </tr>
      <tr>
        <td><strong>Rechnungsdatum:</strong></td>
        <td>{{row.Beleg_Datum|date_format }}</td>
      </tr>            
      <tr>
        <td><strong>Lieferdatum:</strong></td>
        <td>{{row.Beleg_Datum|date_format }}</td>
      </tr>
      <tr>
        <td><strong>Fälligkeitsdatum:</strong></td>
        <td>{{row.Beleg_Datum|date_format }}</td>
      </tr>



    </table>
  </div>
  <div>
    <table class="table table-sm">
      <tr>
        <th colspan="2">Forderung</th>
      </tr>
      <tr>
        <td><strong>offen:</strong></td>
        <td>{{row.Beleg_offen|number_format }} &euro;</td>
      </tr>

      <tr>
        <td><strong>offen (Kunde gesamt):</strong></td>
        <td>{{row.Kunde_offen_gesamt|number_format }} &euro;</td>
      </tr>

      <tr>
        <td><strong>Tage:</strong></td>
        <td>{{row.Beleg_Tage_offen }}</td>
      </tr>

      <tr>
        <td><strong>Staffel:</strong></td>
        <td>{{row.Staffel_Text }}</td>
      </tr>

      <tr>
        <td><strong>Mahnstufe:</strong></td>
        <td>{{row.Mahnstufe }}</td>
      </tr>
    </table>
  </div>


  <div>
    <table class="table table-sm">
      <tr>
        <th colspan="2">Kunde</th>
      </tr>

      <tr>
        <td><strong>Kunden-Nr:</strong></td>
        <td>{{row.Kunde_Nr }}</td>
      </tr>

      <tr>
        <td><strong>Name:</strong></td>
        <td>{{row.Kunde_Name }}</td>
      </tr>

      <tr>
        <td><strong>Adresse:</strong></td>
        <td>{{row.Kunde_Adresse }}</td>
      </tr>

      <tr>
        <td><strong>PLZ / Ort:</strong></td>
        <td>{{row.Kunde_PLZ }} {{row.Kunde_Ort }}</td>
      </tr>

      <tr>
        <td><strong>Land:</strong></td>
        <td>{{row.Kunde_Land }}</td>
      </tr>

      <tr>
        <td><strong>Telefon:</strong></td>
        <td>{{row.Kunde_Telefon }}</td>
      </tr>

      <tr>
        <td><strong>E-Mail:</strong></td>
        <td><a href="mailto:{{row.Kunde_Email }}?subject={{row.Beleg_Nr }}" hx-disable="true">{{row.Kunde_Email }}</a></td>
      </tr>

      <tr>
        <td><strong>Payment_Terms_Code:</strong></td>
        <td>{{row.Payment_Terms_Code }}</td>
      </tr>

      <tr>
        <td><strong>Kundengruppe:</strong></td>
        <td>{{row.Customer_Group_Description }}</td>
      </tr>

    </table>
  </div>
{% if row.Fahrzeug_Leasing == 'J' %}
<div>
    <table class="table table-sm">
      <tr>
        <th colspan="2">Leasing-Kunde</th>
      </tr>

      <tr>
        <td><strong>Kunden-Nr:</strong></td>
        <td>{{row.Leasing_Kunde_Nr }}</td>
      </tr>

      <tr>
        <td><strong>Name:</strong></td>
        <td>{{row.Leasing_Kunde_Name }}</td>
      </tr>

      <tr>
        <td><strong>Adresse:</strong></td>
        <td>{{row.Leasing_Kunde_Adresse }}</td>
      </tr>

      <tr>
        <td><strong>PLZ / Ort:</strong></td>
        <td>{{row.Leasing_Kunde_PLZ }} {{row.Leasing_Kunde_Ort }}</td>
      </tr>

      <tr>
        <td><strong>Land:</strong></td>
        <td>{{row.Leasing_Kunde_Land }}</td>
      </tr>

      <tr>
        <td><strong>Telefon:</strong></td>
        <td>{{row.Leasing_Kunde_Telefon }}</td>
      </tr>

      <tr>
        <td><strong>E-Mail:</strong></td>
        <td><a href="mailto:{{row.Leasing_Kunde_Email }}?subject={{row.Beleg_Nr }}" hx-disable="true">{{row.Leasing_Kunde_Email }}</a></td>
      </tr>
    </table>
  </div>
{% endif %}


{% if row.Versicherung == 'J' and row.Vers_Adresse_ID != '' %}
  <div>
    <table class="table table-sm">
      <tr>
        <th colspan="2">Versicherung</th>
      </tr>
      <tr>
        <td><strong>Name:</strong></td>
        <td>{{row.Vers_Name }}</td>
      </tr>

      <tr>
        <td><strong>Adresse:</strong></td>
        <td>{{row.Vers_Adresse }}</td>
      </tr>

      <tr>
        <td><strong>PLZ / Ort:</strong></td>
        <td>{{row.Vers_PLZ }} {{row.Vers_Ort }}</td>
      </tr>

      <tr>
        <td><strong>Telefon:</strong></td>
        <td>{{row.Vers_Telefon }}</td>
      </tr>

      <tr>
        <td><strong>Telefax:</strong></td>
        <td>{{row.Vers_Telefax }}</td>
      </tr>

      <tr>
        <td><strong>Webseite:</strong></td>
        <td><a href="{{row.Vers_Web }}" hx-disable="true" target="_blank">{{row.Vers_Web }}</a></td>
      </tr>

      <tr>
        <td><strong>Vers_Email:</strong></td>
        <td><a href="mailto:{{row.Vers_Email }}?subject={{row.Beleg_Nr }}" hx-disable="true">{{row.Vers_Email }}</a></td>
      </tr>
    </table>
  </div>
{% endif %}


  <div>
    <table class="table table-sm">
      <tr>
        <th colspan="2">Fahrzeug</th>
      </tr>
      <tr>
        <td><strong>VIN:</strong></td>
        <td>{{row.Fahrzeug_VIN }}</td>
      </tr>

      <tr>
        <td><strong>Marke:</strong></td>
        <td>{{row.Fahrzeug_Marke_Nr }}</td>
      </tr>

      <tr>
        <td><strong>Modell:</strong></td>
        <td>{{row.Fahrzeug_Modell_Nr }}</td>
      </tr>

      <tr>
        <td><strong>Modell Name:</strong></td>
        <td>{{row.Fahrzeug_Modell_Name }}</td>
      </tr>

      <tr>
        <td><strong>Kategoriecode:</strong></td>
        <td>{{row.Fahrzeug_Kategoriecode }}</td>
      </tr>

      <tr>
        <td><strong>Halter:</strong></td>
        <td>{{row.Fahrzeug_Kunde_Nr }}</td>
      </tr>

      <tr>
        <td><strong>Kennzeichen:</strong></td>
        <td>{{row.Fahrzeug_Kennzeichen }}</td>
      </tr>

      <tr>
        <td><strong>KM-Stand:</strong></td>
        <td>{{row.Fahrzeug_Kmstand }}</td>
      </tr>

      <tr>
        <td><strong>Antriebsart:</strong></td>
        <td>{{row.Fahrzeug_Antriebsart }}</td>
      </tr>

      <tr>
        <td><strong>Erstzulassung:</strong></td>
        <td>{{row.Fahrzeug_Erstzulassung|date_format }}</td>
      </tr>

      <tr>
        <td><strong>Kaufdatum:</strong></td>
        <td>{{row.Fahrzeug_Kaufdatum|date_format }}</td>
      </tr>

      <tr>
        <td><strong>Anzahl Vorbesitzer:</strong></td>
        <td>{{row.Fahrzeug_Vorbesitzer_Anzahl }}</td>
      </tr>

      <tr>
        <td><strong>Vorbesitzer:</strong></td>
        <td>{{row.Fahrzeug_Vorbesitzer_Kunde_Nr }}</td>
      </tr>
    </table>
  </div>
</div>