 {# TODO: List total withdrawal value? Or just current value of withdrawn utxos? #}

{% extends "swan/components/swan_tab.jinja" %}
{% set tab = 'withdrawals' %}
{% block content %}
    {% if wallet %}
        <div class="mt-8 grid grid-cols-2 gap-2">
            <div class="flex gap-2 items-center bg-dark-700 p-4 rounded-lg">
                Linked wallet:<a class="btn hover:border-dark-600" href="{{ url_for('wallets_endpoint.addresses', wallet_alias=wallet.alias) }}">{{ wallet.name }}</a>
            </div>
            <div class="flex gap-2 items-center bg-dark-700 p-4 rounded-lg">
                {% if autowithdrawal_threshold %}
                    Auto-withdrawal threshold: {% if autowithdrawal_threshold == "0" %}{{ _("Weekly") }}{% else %}{{ autowithdrawal_threshold }} btc{% endif %}
                {% endif %}
            </div>
        </div>
        <div class="table-holder">
            {% include "includes/services-data.html" %}
            {% include "includes/address-label.html" %}
            {% include "includes/tx-row.html" %}
            {% include "includes/tx-data.html" %}
            {% include "includes/explorer-link.html" %}
            {% include "includes/tx-table.html" %}
            <tx-table
                {% if specter.price_check and (specter.alt_rate and specter.alt_symbol) %}
                    price="{{ specter.alt_rate }}"
                    symbol="{{ specter.alt_symbol }}"
                {% endif %}
                btc-unit="{{ specter.unit }}"
                hide-sensitive-info="{{ specter.hide_sensitive_info | lower }}"
                wallet="{{ wallet.alias }}"
                service-id="{{ swan_id }}"
                type="txlist"
                hide-switcher="true"
            />
        </div>
        <div id="tx-popup" class="hidden"></div>
    {% else %}
        <div class="flex items-center p-4 mt-6 mb-4 bg-dark-600 rounded-lg">
            <p class="text-white">
                {{ _("No Auto-withdrawal Plan!") }}<br>
                {{ _("Go to Settings to set up auto-withdrawal to one of your Specter wallets.") }}
            </p>
        </div>
    {% endif %}
{% endblock %}