mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-21 14:04:12 +01:00
Toast messages in payment request (#2010)
* Hide toast messages in print Fixes #2009. * Optimize payment request toast messages
This commit is contained in:
parent
da864f4c6c
commit
b1b3ce48ee
2 changed files with 20 additions and 39 deletions
|
@ -304,6 +304,9 @@ html[data-devenv]:before {
|
||||||
a {
|
a {
|
||||||
text-decoration: none !important;
|
text-decoration: none !important;
|
||||||
}
|
}
|
||||||
|
.toasted-container {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Richtext editor */
|
/* Richtext editor */
|
||||||
|
|
|
@ -135,30 +135,27 @@ addLoadEvent(function (ev) {
|
||||||
this.customAmount = (this.srvModel.amountDue || 0).noExponents();
|
this.customAmount = (this.srvModel.amountDue || 0).noExponents();
|
||||||
hubListener.connect();
|
hubListener.connect();
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var toastOptions = {
|
||||||
|
iconPack: "fontawesome",
|
||||||
|
theme: "bubble",
|
||||||
|
duration: 10000
|
||||||
|
};
|
||||||
|
|
||||||
eventAggregator.$on("invoice-created", function (invoiceId) {
|
eventAggregator.$on("invoice-created", function (invoiceId) {
|
||||||
self.setLoading(false);
|
self.setLoading(false);
|
||||||
btcpay.showInvoice(invoiceId);
|
btcpay.showInvoice(invoiceId);
|
||||||
btcpay.showFrame();
|
btcpay.showFrame();
|
||||||
});
|
});
|
||||||
eventAggregator.$on("invoice-cancelled", function(){
|
eventAggregator.$on("invoice-cancelled", function (){
|
||||||
self.setLoading(false);
|
self.setLoading(false);
|
||||||
Vue.toasted.show('Payment cancelled', {
|
Vue.toasted.info('Payment cancelled', Object.assign({}, toastOptions), {
|
||||||
iconPack: "fontawesome",
|
icon: "check"
|
||||||
icon: "check",
|
|
||||||
duration: 10000
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
eventAggregator.$on("cancel-invoice-error", function (error) {
|
eventAggregator.$on("cancel-invoice-error", function () {
|
||||||
self.setLoading(false);
|
self.setLoading(false);
|
||||||
Vue.toasted.show("Error cancelling payment", {
|
Vue.toasted.error("Error cancelling payment", Object.assign({}, toastOptions), {
|
||||||
iconPack: "fontawesome",
|
icon: "exclamation-triangle"
|
||||||
icon: "exclamation-triangle",
|
|
||||||
fullWidth: false,
|
|
||||||
theme: "bubble",
|
|
||||||
type: "error",
|
|
||||||
position: "top-center",
|
|
||||||
duration: 10000
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
eventAggregator.$on("invoice-error", function (error) {
|
eventAggregator.$on("invoice-error", function (error) {
|
||||||
|
@ -171,35 +168,16 @@ addLoadEvent(function (ev) {
|
||||||
} else {
|
} else {
|
||||||
msg = JSON.stringify(error);
|
msg = JSON.stringify(error);
|
||||||
}
|
}
|
||||||
|
Vue.toasted.error("Error creating invoice: " + msg, Object.assign({}, toastOptions), {
|
||||||
Vue.toasted.show("Error creating invoice: " + msg, {
|
icon: "exclamation-triangle"
|
||||||
iconPack: "fontawesome",
|
|
||||||
icon: "exclamation-triangle",
|
|
||||||
fullWidth: false,
|
|
||||||
theme: "bubble",
|
|
||||||
type: "error",
|
|
||||||
position: "top-center",
|
|
||||||
duration: 10000
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
eventAggregator.$on("payment-received", function (amount, cryptoCode, type) {
|
eventAggregator.$on("payment-received", function (amount, cryptoCode, type) {
|
||||||
var onChain = type.toLowerCase() === "btclike";
|
var onChain = type.toLowerCase() === "btclike";
|
||||||
amount = parseFloat(amount).noExponents();
|
var amountFormatted = parseFloat(amount).noExponents();
|
||||||
if (onChain) {
|
var icon = onChain ? "plus" : "bolt";
|
||||||
Vue.toasted.show('New payment of ' + amount + " " + cryptoCode + " " + (onChain ? "On Chain" : "LN "), {
|
var title = "New payment of " + amountFormatted + " " + cryptoCode + " " + (onChain ? "On Chain" : "LN");
|
||||||
iconPack: "fontawesome",
|
Vue.toasted.success(title, Object.assign({}, toastOptions), { icon });
|
||||||
icon: "plus",
|
|
||||||
duration: 10000
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Vue.toasted.show('New payment of ' + amount + " " + cryptoCode + " " + (onChain ? "On Chain" : "LN "), {
|
|
||||||
iconPack: "fontawesome",
|
|
||||||
icon: "bolt",
|
|
||||||
duration: 10000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
eventAggregator.$on("info-updated", function (model) {
|
eventAggregator.$on("info-updated", function (model) {
|
||||||
console.warn("UPDATED", self.srvModel, arguments);
|
console.warn("UPDATED", self.srvModel, arguments);
|
||||||
|
|
Loading…
Add table
Reference in a new issue