<section class="flex flex-col gap-4">
    {% include 'lib/alert.twig' %}
    <a href="/admin/transactions/add">
        {% include 'lib/buttons/submit.twig' with { 
            label: 'Create a New Transaction', 
        } %}
    </a>
    <h3 class="text-2xl font-semibold">
        Liabilities
    </h3>
    <table class="min-w-full">
        <thead>
            <tr>
                <th class="py-2">
                    Currency
                </th>
                <th class="py-2">
                    Total Liability
                </th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="border px-4 py-2">
                    Sats
                </td>
                <td class="border px-4 py-2">
                    {{ sats_liability }}
                </td>
            </tr>
            <tr>
                <td class="border px-4 py-2">
                    Cents
                </td>
                <td class="border px-4 py-2">
                    {{ cents_liability }}
                </td>
            </tr>
        </tbody>
    </table>
    <h3 class="text-2xl font-semibold">
        Sats Transactions
    </h3>
    <table class="min-w-full">
        <thead>
            <tr>
                <th class="py-2">
                    Type
                </th>
                <th class="py-2">
                    Amount (Sats)
                </th>
                <th class="py-2">
                    Date
                </th>
            </tr>
        </thead>
        <tbody>
            {% if recent_sats is not empty %}
                {% for transaction in recent_sats %}
                    <tr>
                        <td class="border px-4 py-2">
                            {{ transaction.type }}
                        </td>
                        <td class="border px-4 py-2">
                            {{ transaction.sats }}
                        </td>
                        <td class="border px-4 py-2">
                            {{ transaction.date }}
                        </td>
                    </tr>
                {% endfor %}
            {% else %}
                <tr>
                    <td class="border px-4 py-2" colspan="3">
                        No Sats transactions available.
                    </td>
                </tr>
            {% endif %}
        </tbody>
    </table>

    <h3 class="text-2xl font-semibold">
        Cents Transactions
    </h3>
    <table class="min-w-full">
        <thead>
            <tr>
                <th class="py-2">
                    Type
                </th>
                <th class="py-2">
                    Amount (Cents)
                </th>
                <th class="py-2">
                    Date
                </th>
            </tr>
        </thead>
        <tbody>
            {% if recent_cents is not empty %}
                {% for transaction in recent_cents %}
                    <tr>
                        <td class="border px-4 py-2">
                            {{ transaction.type }}
                        </td>
                        <td class="border px-4 py-2">
                            {{ transaction.cents }}
                        </td>
                        <td class="border px-4 py-2">
                            {{ transaction.date }}
                        </td>
                    </tr>
                {% endfor %}
            {% else %}
                <tr>
                    <td class="border px-4 py-2" colspan="3">
                        No Cents transactions available.
                    </td>
                </tr>
            {% endif %}
        </tbody>
    </table>

    <h3 class="text-2xl font-semibold">
        Whales Sats
    </h3>
    <table class="min-w-full">
        <thead>
            <tr>
                <th class="py-2">
                    User ID
                </th>
                <th class="py-2">
                    Total Sats
                </th>
            </tr>
        </thead>
        <tbody>
            {% if whales_sats is not empty %}
                {% for whale in whales_sats %}
                    <tr>
                        <td class="border px-4 py-2">
                            {{ whale.user_id }}
                        </td>
                        <td class="border px-4 py-2">
                            {{ whale.total }}
                        </td>
                    </tr>
                {% endfor %}
            {% else %}
                <tr>
                    <td class="border px-4 py-2" colspan="2">
                        No Sats whales available.
                    </td>
                </tr>
            {% endif %}
        </tbody>
    </table>

    <h3 class="text-2xl font-semibold">
        Whales Cents
    </h3>
    <table class="min-w-full">
        <thead>
            <tr>
                <th class="py-2">
                    User ID
                </th>
                <th class="py-2">
                    Total Cents
                </th>
            </tr>
        </thead>
        <tbody>
            {% if whales_cents is not empty %}
                {% for whale in whales_cents %}
                    <tr>
                        <td class="border px-4 py-2">
                            {{ whale.user_id }}
                        </td>
                        <td class="border px-4 py-2">
                            {{ whale.total }}
                        </td>
                    </tr>
                {% endfor %}
            {% else %}
                <tr>
                    <td class="border px-4 py-2" colspan="2">
                        No Cents whales available.
                    </td>
                </tr>
            {% endif %}
        </tbody>
    </table>
</section>
