update layout success salin dengan swal alert #5

Merged
Joko merged 1 commits from development into production 2025-08-20 03:51:29 +00:00
2 changed files with 47 additions and 14 deletions

View File

@ -745,23 +745,45 @@ function hitungTotalHarga(){
}
function copyNoRek() {
const text = document.getElementById('noRekText').innerText;
navigator.clipboard.writeText(text).then(() => {
alert("Nomor rekening berhasil disalin: " + text);
}).catch(err => {
console.error('Gagal menyalin: ', err);
alert("Gagal menyalin teks.");
});
}
function copyNoRek() {
const text = document.getElementById('noRekText').innerText;
navigator.clipboard.writeText(text).then(() => {
Swal.fire({
icon: 'success',
title: 'Disalin!',
text: 'Nomor rekening berhasil disalin: ' + text,
showConfirmButton: false,
timer: 1500
});
}).catch(err => {
console.error('Gagal menyalin: ', err);
Swal.fire({
icon: 'warning',
text: 'Gagal menyalin teks: ' + text,
showConfirmButton: false,
timer: 2000
});
});
}
function copyNoOrder() {
const text = document.getElementById('no_order_display').innerText;
navigator.clipboard.writeText(text).then(() => {
alert("Nomor order berhasil disalin: " + text);
Swal.fire({
icon: 'success',
title: 'Disalin!',
text: 'Nomor order berhasil disalin: ' + text,
showConfirmButton: false,
timer: 1500
});
}).catch(err => {
console.error('Gagal menyalin: ', err);
alert("Gagal menyalin teks.");
Swal.fire({
icon: 'warning',
text: 'Gagal menyalin teks: ' + text,
showConfirmButton: false,
timer: 2000
});
});
}

View File

@ -10,7 +10,7 @@
<p class="lead">Terima kasih atas pesanan Anda. Kami akan segera menyiapkannya dan menghubungi Anda jika diperlukan.</p>
<hr class="my-4">
<p class="text-muted">Simpan Nomor Order Anda untuk memantau status pesanan secara berkala. Hubungi kami jika ada pertanyaan.</p>
<p>No Order : <strong>{{ $no_order }}</strong>
<p>No Order : <strong id="noOrderText">{{ $no_order }}</strong>
<button class="btn btn-sm btn-outline-secondary ms-2" onclick="copyNoOrder()">
<i class="fa fa-copy"></i> Salin
</button>
@ -27,10 +27,21 @@
function copyNoOrder() {
const text = document.getElementById('noOrderText').innerText;
navigator.clipboard.writeText(text).then(() => {
alert("Nomor order berhasil disalin: " + text);
Swal.fire({
icon: 'success',
title: 'Disalin!',
text: 'Nomor order berhasil disalin: ' + text,
showConfirmButton: false,
timer: 1500
});
}).catch(err => {
console.error('Gagal menyalin: ', err);
alert("Gagal menyalin teks.");
Swal.fire({
icon: 'warning',
text: 'Gagal menyalin teks: ' + text,
showConfirmButton: false,
timer: 2000
});
});
}
</script>