@model WalletModel
@{
    Layout = "../Shared/_NavLayout.cshtml";
    ViewData["Title"] = "Manage wallet";
}

<h4>@ViewData["Title"]</h4>
<div class="alert alert-danger alert-dismissible" style="display:none;" role="alert">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <span id="alertMessage"></span>
</div>
<div class="row">
    <div class="col-md-10">
        <p>
            You can send money received by this store to an address with the help of your Ledger Wallet. <br />
            If you don't have a Ledger Wallet, use Electrum with your favorite hardware wallet to transfer crypto. <br />
            If your Ledger wallet is not detected:
        </p>
        <ul>
            <li>Make sure you are running the Ledger app with version superior or equal to 1.2.4</li>
            <li>Use a browser supporting the <a href="https://www.yubico.com/support/knowledge-base/categories/articles/browsers-support-u2f/">U2F protocol</a></li>
        </ul>
        <p id="hw-loading"><span class="fa fa-question-circle" style="color:orange"></span> <span>Detecting hardware wallet...</span></p>
        <p id="hw-error" style="display:none;"><span class="fa fa-times-circle" style="color:red;"></span> <span class="hw-label">An error happened</span></p>
        <p id="hw-success" style="display:none;"><span class="fa fa-check-circle" style="color:green;"></span> <span class="hw-label">Detecting hardware wallet...</span></p>

        <p id="check-loading" style="display:none;"><span class="fa fa-question-circle" style="color:orange"></span> <span class="check-label">Detecting hardware wallet...</span></p>
        <p id="check-error" style="display:none;"><span class="fa fa-times-circle" style="color:red;"></span> <span class="check-label">An error happened</span></p>
        <p id="check-success" style="display:none;"><span class="fa fa-check-circle" style="color:green;"></span> <span class="check-label">Detecting hardware wallet...</span></p>
    </div>
</div>
<div class="row">
    <div class="col-md-6">
        <form id="sendform" style="display:none;">
            <input type="hidden" id="cryptoCode" asp-for="CryptoCurrency" />
            <div class="form-group">
                <label>Destination</label>
                <input id="destination-textbox" name="Destination" class="form-control" type="text" />
                <span id="Destination-Error" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label>Amount</label>
                <input id="amount-textbox" name="Amount" class="form-control" type="text" />
                <span id="Amount-Error" class="text-danger"></span>
                <p class="form-text text-muted crypto-info" style="display: none;">
                    Your current balance is <a id="crypto-balance-link" href="#"><span id="crypto-balance"></span></a> <span id="crypto-code"></span>.
                </p>
            </div>
            <div class="form-group">
                <label>Fee rate (satoshi per byte)</label>
                <input id="fee-textbox" name="FeeRate" class="form-control" type="text" />
                <span id="FeeRate-Error" class="text-danger"></span>
                <p class="form-text text-muted crypto-info" style="display: none;">
                    The recommended value is <a id="crypto-fee-link" href="#"><span id="crypto-fee"></span></a> satoshi per byte.
                </p>
            </div>
            <div class="form-group">
                <label>Subtract fees from amount</label>
                <input id="substract-checkbox" name="SubstractFees" class="form-check" type="checkbox" />
            </div>
            <button id="confirm-button" name="command" type="submit" class="btn btn-primary">Confirm</button>
        </form>
    </div>
</div>
    @section Scripts
        {
        <script type="text/javascript">
		    var srvModel = @Html.Raw(Json.Serialize(Model));
        </script>
        <script src="~/js/ledgerwebsocket.js" type="text/javascript" defer="defer"></script>
        <script src="~/js/StoreWallet.js" type="text/javascript" defer="defer"></script>
    }
