{# 
    pending_psbt_item - Pending PSBT table row.
    Parameters:
    - pending_psbt: PSBT to show in this row.
    - wallet_alias: Active wallet alias.
    - wallet: Wallet object.
    - specter: Specter object.
 #}
{% macro pending_psbt_item(pending_psbt, wallet_alias, wallet, specter) -%}
    {% from 'wallet/components/explorer_link.jinja' import explorer_link %}
    <tr>
        <td></td>
        <td class="tx scroll">
            {% if pending_psbt['address']|length == 1 %}
                {{ explorer_link('address', pending_psbt['address'][0], wallet.get_address_name(pending_psbt['address'][0], -1), specter.explorer) }}
            {% else %}
                {{ pending_psbt['address']|length }} Recipients
            {% endif %}
        </td>
        <td>
            {{ (pending_psbt['amount'] | sum) | btcunitamount }}{% if specter.price_check %}<span class="note">&nbsp;({{ (pending_psbt['amount'] | sum) | altunit }})</span>{% endif %}
        </td>
        <td>
            {{ pending_psbt['time'] | datetime }}
        </td>
        <td>
            {{ '{}/{}'.format(pending_psbt['sigs_count'], wallet.sigs_required) }}
        </td>
        <td width="170px">
            <div class="row">
                <form action="{{ url_for('wallet_sendnew',wallet_alias=wallet_alias) }}" method="POST">
                    <input type="hidden" name="pending_psbt" value='{{ pending_psbt|tojson|safe }}'>
                    <button type="submit" name="action" value="openpsbt" class="btn" style="margin-right: 5px;">Open</button>
                </form>

                <form action="{{ url_for('wallet_sendpending',wallet_alias=wallet_alias) }}" method="POST">
                    <input type="hidden" name="pending_psbt" value='{{ pending_psbt|tojson|safe }}'>
                    <button type="submit" name="action" value="deletepsbt" class="btn danger" style="margin-left: 5px;" onclick="javascript: form.action='./?pending=True';">Delete</button>
                </form>
            </div>
        </td>
    </tr>
{%- endmacro %}
