Wedding Invitation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

emoney-modal.blade.php 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <dialog id="emoney" class="modal">
  2. <div class="modal-box w-11/12 max-w-5xl">
  3. <h3 class="text-lg font-bold">Hadiah</h3>
  4. <label class="form-control w-full max-w-xs">
  5. <div class="label">
  6. <span class="label-text">Nama Bank</span>
  7. </div>
  8. <p class="input input-bordered input-sm input-accent w-full max-w-xs">
  9. RHB Bank Berhad
  10. </p>
  11. </label>
  12. <label class="form-control w-full max-w-xs">
  13. <div class="label">
  14. <span class="label-text">No. Akaun</span>
  15. </div>
  16. <p class="input input-bordered input-sm input-accent w-full max-w-xs">
  17. 15601700275298
  18. <span id="copyText" class="copy-link cursor-pointer float-end">
  19. <i class="fa-regular fa-copy"></i>
  20. </span>
  21. </p>
  22. <p id="copyMessage" class="text-green-500" style="display:none;">Copied to clipboard!</p>
  23. </label>
  24. <label class="form-control w-full max-w-xs">
  25. <div class="label">
  26. <span class="label-text">Kod QR</span>
  27. </div>
  28. <img src="{{asset('assets/qr-bank.webp')}}" alt="">
  29. </label>
  30. <div class="modal-action">
  31. <form method="dialog">
  32. <button class="btn">Tutup</button>
  33. </form>
  34. </div>
  35. </div>
  36. </dialog>
  37. <script>
  38. document.getElementById('copyText').addEventListener('click', function() {
  39. var textToCopy = "15601700275298";
  40. if (navigator.clipboard && window.isSecureContext) {
  41. // navigator.clipboard API method
  42. navigator.clipboard.writeText(textToCopy).then(function() {
  43. var copyMessage = document.getElementById('copyMessage');
  44. copyMessage.style.display = 'block';
  45. setTimeout(function() {
  46. copyMessage.style.display = 'none';
  47. }, 2000);
  48. }).catch(function(error) {
  49. alert('Failed to copy text: ' + error);
  50. });
  51. } else {
  52. // Fallback method for older browsers or non-secure contexts
  53. // Create a temporary textarea element
  54. var tempTextArea = document.createElement('textarea');
  55. tempTextArea.value = textToCopy;
  56. document.body.appendChild(tempTextArea);
  57. // Select the text
  58. tempTextArea.select();
  59. tempTextArea.setSelectionRange(0, 99999); // For mobile devices
  60. try {
  61. document.execCommand('copy');
  62. var copyMessage = document.getElementById('copyMessage');
  63. copyMessage.style.display = 'block';
  64. setTimeout(function() {
  65. copyMessage.style.display = 'none';
  66. }, 2000);
  67. } catch (error) {
  68. alert('Failed to copy text: ' + error);
  69. }
  70. document.body.removeChild(tempTextArea);
  71. }
  72. });
  73. </script>