add unconfirmed payment initial message

This commit is contained in:
cnohall 2024-09-07 08:52:30 +09:00
parent f1f64c277c
commit 2ac42b4caf

View File

@ -4,6 +4,10 @@
<div class="alert alert-failure mb-4" hidden id="errors"></div>
<div class="blockonomics-payment-wrapper">
<div class="progress-message">
The payment is unconfirmed but in progress, please stay tuned.
</div>
<div class="initial-state">
<div class="invoice-number">Invoice #{{$invoice_number}}</div>
<div>To pay, send exactly this BTC amount</div>
<div class="full-width-input" onclick='copyToClipboard("{{$btc_amount}}", this)'>
@ -17,6 +21,7 @@
</div>
<div id="countdown"></div>
</div>
</div>
<form action="{{ route('client.payments.response') }}" method="post" id="server-response">
@csrf
@ -94,7 +99,14 @@
ws.onmessage = function(event) {
const data = JSON.parse(event.data);
console.log('Payment status:', data.status);
const isPaymentConfirmed = data.status == 2;
const isPaymentUnconfirmed = data.status === 0;
const isPaymentConfirmed = data.status === 2;
if (isPaymentUnconfirmed) {
// Hide all existing content
document.querySelector('.initial-state').style.display = 'none';
document.querySelector('.progress-message').style.display = 'block';
return;
}
if (isPaymentConfirmed) {
document.querySelector('input[name="txid"]').value = data.txid || '';
document.getElementById('server-response').submit();
@ -120,6 +132,11 @@
margin-bottom: 20px;
}
.blockonomics-payment-wrapper {
padding: 12px;
display: flex;
justify-content: center;
}
.initial-state {
justify-content: center;
display: flex;
flex-direction: column;
@ -148,6 +165,12 @@
transform: translateY(-50%);
cursor: pointer;
}
.progress-message {
display: none;
margin: 120px 0;
font-weight: bold;
font-size: 18px;
}
</style>
<!-- @include('portal.ninja2020.gateways.includes.pay_now') -->