Polish UI and billing flows: route fallback, searchable selectors, light-mode fixes
This commit is contained in:
@@ -549,6 +549,10 @@
|
||||
if (!buttons.length) return;
|
||||
const csrf = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
|
||||
const isAuthed = @json(auth()->check());
|
||||
const pakasirStatusUrl = @json(\Illuminate\Support\Facades\Route::has('billing.pakasir.status') ? route('billing.pakasir.status') : url('/billing/pakasir/status'));
|
||||
const pakasirCancelUrl = @json(\Illuminate\Support\Facades\Route::has('billing.pakasir.cancel') ? route('billing.pakasir.cancel') : url('/billing/pakasir/cancel'));
|
||||
const pakasirCreateUrl = @json(\Illuminate\Support\Facades\Route::has('billing.pakasir.create') ? route('billing.pakasir.create') : url('/billing/pakasir/create'));
|
||||
const billingSuccessUrl = @json(\Illuminate\Support\Facades\Route::has('dashboard.billing') ? route('dashboard.billing', ['status' => 'success']) : url('/dashboard/billing?status=success'));
|
||||
const modal = document.getElementById('qris-modal');
|
||||
const qrTarget = document.getElementById('qris-code');
|
||||
const qrText = document.getElementById('qris-text');
|
||||
@@ -584,7 +588,7 @@
|
||||
pollTimer = setInterval(async () => {
|
||||
if (!modalOpen || !currentOrderId) return;
|
||||
try {
|
||||
const res = await fetch("{{ route('billing.pakasir.status') }}", {
|
||||
const res = await fetch(pakasirStatusUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -596,7 +600,7 @@
|
||||
const data = await res.json().catch(() => null);
|
||||
if (res.ok && data?.paid) {
|
||||
closeModal();
|
||||
window.location.href = "{{ route('dashboard.billing', ['status' => 'success']) }}";
|
||||
window.location.href = billingSuccessUrl;
|
||||
}
|
||||
} catch (e) {
|
||||
// keep polling silently
|
||||
@@ -611,7 +615,7 @@
|
||||
});
|
||||
if (!ok) return;
|
||||
try {
|
||||
await fetch("{{ route('billing.pakasir.cancel') }}", {
|
||||
await fetch(pakasirCancelUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -657,7 +661,7 @@
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Generating QR...';
|
||||
try {
|
||||
const res = await fetch("{{ route('billing.pakasir.create') }}", {
|
||||
const res = await fetch(pakasirCreateUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user