@using BTCPayServer.Components
@using BTCPayServer
@using BTCPayServer.Abstractions.Extensions
@using BTCPayServer.Client
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using BTCPayServer.Components.QRCode
@using BTCPayServer.Components.TruncateCenter
@model BTCPayServer.Plugins.Breez.PaymentsViewModel
@{
    var storeId = Context.GetCurrentStoreId();

    ViewData.SetActivePage("Breez", "Payments", "Payments");
    TempData.TryGetValue("bolt11", out var bolt11);
}

<div class="row mb-4">
    <div class="col-12">
        <div class="d-flex align-items-center justify-content-between mb-3">
            <h3 class="mb-0">
                <span>@ViewData["Title"]</span>
            </h3>
            <div class="d-flex gap-3 mt-3 mt-sm-0">

                <a  permission="@Policies.CanModifyStoreSettings" asp-action="Send" asp-controller="Breez" asp-route-storeId="@storeId" type="submit" class="btn btn-primary">Send</a>
                <a permission="@Policies.CanCreateInvoice" asp-action="Receive" asp-controller="Breez" asp-route-storeId="@storeId" type="submit" class="btn btn-primary">Receive</a>
            </div>
        </div>

        @if (bolt11 is string bolt11s)
        {
            <div class="payment-box">
                <div class="qr-container" data-clipboard="@bolt11s">
                    <vc:qr-code data="@bolt11s"/>
                </div>
                <div class="input-group mt-3">
                    <div class="form-floating">
                        <vc:truncate-center text="@bolt11s" padding="15" elastic="true" classes="form-control-plaintext" id="Address"/>
                        <label for="Address">BOLT11 Invoice</label>
                    </div>


                </div>
            </div>
        }

        <partial name="Breez/BreezPaymentsTable" model="Model.Payments"/>
        <vc:pager view-model="Model"></vc:pager>
    </div>
</div>