<script setup>
import AdminAppLayout from "../../../../resources/js/layouts/AdminAppLayout.vue";
import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
import TabbedPage from "../../../Views/Components/TabbedPage.vue";
import TenantContact from "./Partials/TenantContact.vue";
import TenantPayment from "./Partials/TenantPayment.vue";
import TenantImpress from "./Partials/TenantImpress.vue";
import TenantGdpr from "./Partials/TenantGdpr.vue";
import TenantPaymentMethods from "./Partials/TenantPaymentMethods.vue";
import TenantTaxInfo from "./Partials/TenantTaxInfo.vue";

const props = defineProps({
    tenant: Object,
})

const tabs = [
    {
        title: 'Kontaktdaten',
        component: TenantContact,
        endpoint: '/api/v1/admin/tenant/contact',
    },
    {
        title: 'IBAN-Informationen',
        component: TenantPayment,
        endpoint: '/api/v1/admin/tenant/payment',
    },
    {
        title: 'Zahlungsmodule',
        component: TenantPaymentMethods,
        endpoint: '/api/v1/admin/tenant/payment-methods',
    },
    {
        title: 'Steuerinformationen',
        component: TenantTaxInfo,
        endpoint: '/api/v1/admin/tenant/tax',
    },
    {
        title: 'Impressum',
        component: TenantImpress,
        endpoint: '/api/v1/admin/tenant/impress',
    },
    {
        title: 'Datenschutzerklärung',
        component: TenantGdpr,
        endpoint: '/api/v1/admin/tenant/gdpr',
    },
]
</script>

<template>
    <AdminAppLayout :title="props.tenant.slug === 'lv' ? 'LV-Daten' : 'Stammesdaten'">
        <shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
            <table class="tenant-header">
                <tr><th>Name</th><td>{{ props.tenant.name }}</td></tr>
                <tr><th>Slug</th><td>{{ props.tenant.slug }}</td></tr>
                <tr><th>mareike-URL:</th><td>{{ props.tenant.url }}</td></tr>
                <tr><th>Status</th><td>
                    <span :class="props.tenant.is_active_local_group ? 'badge-active' : 'badge-inactive'">
                        {{ props.tenant.is_active_local_group ? 'Aktiv' : 'Inaktiv' }}
                    </span>
                </td></tr>
            </table>

            <div style="margin-top: 30px;">
                <tabbed-page :tabs="tabs" />
            </div>
        </shadowed-box>
    </AdminAppLayout>
</template>

<style scoped>
.tenant-header {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
}

.tenant-header th {
    text-align: left;
    padding: 10px 16px;
    width: 200px;
    color: #374151;
    font-weight: bold;
    background-color: #f9fafb;
    border-bottom: 1px solid #d1d5db;
}

.tenant-header td {
    padding: 10px 16px;
    border-bottom: 1px solid #d1d5db;
}

.tenant-header tr:last-child th,
.tenant-header tr:last-child td {
    border-bottom: none;
}

.badge-active {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #166534;
    background-color: #dcfce7;
    border: 1px solid #22c55e;
}

.badge-inactive {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #991b1b;
    background-color: #fee2e2;
    border: 1px solid #ef4444;
}
</style>
