<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <title>Firmendaten</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
</head>
<body class="bg-light">

<div class="container mt-4">
    <h3 class="mb-4">🏢 Firmendaten</h3>

    <form method="POST" action="/admin/company-settings" enctype="multipart/form-data">

        <div class="row g-3">

            <div class="col-md-6">
                <label class="form-label">Firmenname</label>
                <input class="form-control" name="company_name"
                 value="<%= company.company_name || '' %>" required>
            </div>

            <div class="col-md-6">
                <label class="form-label">Rechtsform</label>
                <input class="form-control" name="company_legal_form"
                       value="<%= company.company_legal_form || '' %>">
            </div>

            <div class="col-md-6">
                <label class="form-label">Inhaber / Geschäftsführer</label>
                <input class="form-control" name="company_owner"
                       value="<%= company.company_owner || '' %>">
            </div>

            <div class="col-md-6">
                <label class="form-label">E-Mail</label>
                <input class="form-control" name="email"
                       value="<%= company.email || '' %>">
            </div>

            <div class="col-md-8">
                <label class="form-label">Straße</label>
                <input class="form-control" name="street"
                       value="<%= company.street || '' %>">
            </div>

            <div class="col-md-4">
                <label class="form-label">Hausnummer</label>
                <input class="form-control" name="house_number"
                       value="<%= company.house_number || '' %>">
            </div>

            <div class="col-md-4">
                <label class="form-label">PLZ</label>
                <input class="form-control" name="postal_code"
                       value="<%= company.postal_code || '' %>">
            </div>

            <div class="col-md-8">
                <label class="form-label">Ort</label>
                <input class="form-control" name="city"
                       value="<%= company.city || '' %>">
            </div>

            <div class="col-md-6">
                <label class="form-label">Land</label>
                <input class="form-control" name="country"
                       value="<%= company.country || 'Deutschland' %>">
            </div>

            <div class="col-md-6">
                <label class="form-label">USt-ID / Steuernummer</label>
                <input class="form-control" name="vat_id"
                       value="<%= company.vat_id || '' %>">
            </div>

            <div class="col-md-6">
                <label class="form-label">Bank</label>
                <input class="form-control" name="bank_name"
                       value="<%= company.bank_name || '' %>">
            </div>

            <div class="col-md-6">
                <label class="form-label">IBAN</label>
                <input class="form-control" name="iban"
                       value="<%= company.iban || '' %>">
            </div>

            <div class="col-md-6">
                <label class="form-label">BIC</label>
                <input class="form-control" name="bic"
                       value="<%= company.bic || '' %>">
            </div>

            <div class="col-12">
                <label class="form-label">Rechnungs-Footer</label>
                <textarea class="form-control" rows="3"
                          name="invoice_footer_text"><%= company.invoice_footer_text || '' %></textarea>
            </div>

            <div class="col-12">
                <label class="form-label">Firmenlogo</label>
                <input
                    type="file"
                    name="logo"
                    class="form-control"
                    accept="image/png, image/jpeg"
                >

                <% if (company.invoice_logo_path) { %>
                    <div class="mt-2">
                    <small class="text-muted">Aktuelles Logo:</small><br>
                    <img
                        src="<%= company.invoice_logo_path %>"
                        style="max-height:80px; border:1px solid #ccc; padding:4px;"
                    >
                    </div>
                <% } %>
                </div>

        </div>

        <div class="mt-4">
            <button class="btn btn-primary">💾 Speichern</button>
            <a href="/dashboard" class="btn btn-secondary">Zurück</a>
        </div>

    </form>
</div>

</body>
</html>
