mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 10:40:29 +01:00
175 lines
7.4 KiB
Plaintext
175 lines
7.4 KiB
Plaintext
@model BTCPayServer.Models.InvoicingModels.PaymentModel
|
|
<script type="text/x-template" id="lightning-method-checkout-template">
|
|
<div>
|
|
<div class="bp-view payment scan" id="scan" v-bind:class="{ 'active': currentTab == 'scan'}">
|
|
<div class="wrapBtnGroup" v-bind:class="{ invisible: !scanDisplayQr }">
|
|
<div class="btnGroupLnd"
|
|
v-if="srvModel.peerInfo" >
|
|
<button
|
|
v-on:click="toggleLightningData('bolt11')"
|
|
v-bind:class="{ active: currentLightningDisplay === 'bolt11' }"
|
|
v-bind:title="$t(srvModel.paymentMethodId.endsWith('LNURLPAY')? 'LNURL': 'BOLT 11 Invoice')">
|
|
{{$t(srvModel.paymentMethodId.endsWith('LNURLPAY')? "LNURL": "BOLT 11 Invoice")}}
|
|
</button>
|
|
<button
|
|
v-on:click="toggleLightningData('node')"
|
|
v-bind:class="{ active: currentLightningDisplay === 'node' }"
|
|
v-bind:title="$t('Node Info')">
|
|
{{$t("Node Info")}}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="payment__scan">
|
|
<img v-bind:src="srvModel.cryptoImage" class="qr_currency_icon" v-if="scanDisplayQr"/>
|
|
<qrcode v-bind:value="scanDisplayQr" :options="{ width: 256, margin: 1, color: {dark:'#000', light:'#f5f5f7'} }" tag="svg" v-if="scanDisplayQr"></qrcode>
|
|
<div class="payment__spinner qr_currency_icon" style="padding-right: 20px;">
|
|
<partial name="Checkout-Spinner"/>
|
|
</div>
|
|
</div>
|
|
<div class="payment__details__instruction__open-wallet" v-if="srvModel.invoiceBitcoinUrl">
|
|
<a class="payment__details__instruction__open-wallet__btn action-button" target="_top" v-bind:href="srvModel.invoiceBitcoinUrl">
|
|
<span>{{$t("Open in wallet")}}</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<div class="bp-view payment manual-flow" id="copy" v-bind:class="{ 'active': currentTab == 'copy'}">
|
|
<div class="manual__step-two__instructions">
|
|
<span v-html="$t('CompletePay_Body', srvModel)"></span>
|
|
</div>
|
|
<div class="copyLabelPopup">
|
|
<span>{{$t("Copied")}}</span>
|
|
</div>
|
|
<nav class="copyBox">
|
|
<div class="copySectionBox bottomBorder">
|
|
<label>{{$t(srvModel.paymentMethodId.endsWith('LNURLPAY')? "LNURL": "BOLT 11 Invoice")}}</label>
|
|
<div class="inputWithIcon _copyInput">
|
|
<input type="text" class="checkoutTextbox" v-bind:value="srvModel.btcAddress" readonly="readonly"/>
|
|
<img v-bind:src="srvModel.cryptoImage"/>
|
|
</div>
|
|
</div>
|
|
<div class="separatorGem" v-if="srvModel.peerInfo" ></div>
|
|
<div class="copySectionBox" v-if="srvModel.peerInfo">
|
|
<label>{{$t("Node Info")}}</label>
|
|
<div class="inputWithIcon _copyInput">
|
|
<input type="text" class="checkoutTextbox" v-bind:value="srvModel.peerInfo" readonly="readonly"/>
|
|
<img v-bind:src="srvModel.cryptoImage"/>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
@await Component.InvokeAsync("UiExtensionPoint" , new { location="checkout-lightning-post-content", model = Model})
|
|
</div>
|
|
</script>
|
|
|
|
<script type="text/x-template" id="lightning-method-checkout-header-template">
|
|
<div class="payment-tabs">
|
|
<div class="payment-tabs__tab " id="scan-tab" v-on:click="switchTab('scan')" v-bind:class="{ 'active': currentTab == 'scan'}" >
|
|
<span>{{$t("Scan")}}</span>
|
|
</div>
|
|
<div class="payment-tabs__tab" id="copy-tab" v-on:click="switchTab('copy')" v-bind:class="{ 'active': currentTab == 'copy'}" >
|
|
<span>{{$t("Copy")}}</span>
|
|
</div>
|
|
@await Component.InvokeAsync("UiExtensionPoint" , new { location="checkout-lightning-post-tabs", model = Model})
|
|
</div>
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
Vue.component('LightningLikeMethodCheckout',
|
|
{
|
|
props: ["srvModel"],
|
|
template: "#lightning-method-checkout-template",
|
|
components: {
|
|
qrcode: VueQrcode
|
|
},
|
|
data: function() {
|
|
return {
|
|
currentLightningDisplay: "bolt11",
|
|
selectedThirdPartyProcessor: "",
|
|
currentTab: "scan"
|
|
}
|
|
},
|
|
computed: {
|
|
scanDisplayQr: function() {
|
|
if (this.currentLightningDisplay === "node") {
|
|
return this.srvModel.peerInfo;
|
|
}
|
|
return this.srvModel.invoiceBitcoinUrlQR;
|
|
}
|
|
},
|
|
methods: {
|
|
toggleLightningData: function(display) {
|
|
this.currentLightningDisplay = display;
|
|
}
|
|
},
|
|
mounted: function() {
|
|
var self = this;
|
|
eventBus.$on("tab-switched",
|
|
function(tab) {
|
|
self.currentTab = tab;
|
|
});
|
|
}
|
|
});
|
|
|
|
Vue.component('LightningLikeMethodCheckoutHeader', {
|
|
props: ["srvModel"],
|
|
template: "#lightning-method-checkout-header-template",
|
|
data: function() {
|
|
return {
|
|
currentTab: "scan"
|
|
};
|
|
},
|
|
methods: {
|
|
switchTab: function(tab) {
|
|
this.currentTab = tab;
|
|
eventBus.$emit("tab-switched", tab);
|
|
}
|
|
}
|
|
});
|
|
|
|
$(document).ready(function() {
|
|
// Clipboard Copy
|
|
var copySpan = new ClipboardJS('._copySpan', {
|
|
target: function(trigger) {
|
|
return copyElement(trigger, 0, 65).firstChild;
|
|
}
|
|
});
|
|
var copyInput = new ClipboardJS('._copyInput', {
|
|
target: function(trigger) {
|
|
return copyElement(trigger, 4, 65).firstChild;
|
|
}
|
|
});
|
|
|
|
function copyElement(trigger, popupLeftModifier, popupTopModifier) {
|
|
var elm = $(trigger);
|
|
var position = elm.offset();
|
|
position.top -= popupLeftModifier + $(window).scrollTop();
|
|
position.left += (elm.width() / 2) - popupTopModifier;
|
|
$(".copyLabelPopup").css(position).addClass("copied");
|
|
elm.removeClass("copy-cursor").addClass("clipboardCopied");
|
|
setTimeout(clearSelection, 100);
|
|
setTimeout(function() {
|
|
elm.removeClass("clipboardCopied").addClass("copy-cursor");
|
|
$(".copyLabelPopup").removeClass("copied");
|
|
},
|
|
1000);
|
|
return trigger;
|
|
}
|
|
|
|
function clearSelection() {
|
|
if (window.getSelection) {
|
|
window.getSelection().removeAllRanges();
|
|
} else if (document.selection) {
|
|
document.selection.empty();
|
|
}
|
|
}
|
|
// Disable enter key
|
|
$(document).keypress(
|
|
function(event) {
|
|
if (event.which === '13') {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
);
|
|
});
|
|
</script>
|