Wedding Invitation
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

guestbook-modal.blade.php 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <dialog id="guestbook" class="modal">
  2. <div class="modal-box w-11/12 max-w-5xl">
  3. <h3 class="text-lg font-bold">Ucapan</h3>
  4. <form id="speechForm">
  5. @csrf
  6. <label class="form-control w-full max-w-xs">
  7. <div class="label">
  8. <span class="label-text">Nama</span>
  9. </div>
  10. <input type="text" name="name" placeholder="Taip disini" class="input input-bordered input-sm input-accent w-full max-w-xs" />
  11. </label>
  12. <label class="form-control w-full max-w-xs">
  13. <div class="label">
  14. <span class="label-text">Ucapan anda</span>
  15. </div>
  16. <textarea class="textarea textarea-accent" name="speech" placeholder="Taip disini"></textarea>
  17. </label>
  18. </form>
  19. <div class="modal-action">
  20. <form method="dialog" id="closeSpeechForm"></form>
  21. <button type="button" class="btn bg-babybluedark" id="submitSpeechForm">Hantar</button>
  22. <button type="button" class="btn" id="submitCloseSpeechForm">Tutup</button>
  23. </div>
  24. </div>
  25. </dialog>
  26. @push('script')
  27. <script>
  28. $(document).ready(function() {
  29. $('#submitCloseSpeechForm').click(function(e) {
  30. $('#closeSpeechForm').submit();
  31. });
  32. $('#submitSpeechForm').click(function(e) {
  33. e.preventDefault();
  34. var formData = $('#speechForm').serialize();
  35. $.ajax({
  36. url: '{{ route('speech.save') }}',
  37. type: 'POST',
  38. data: formData,
  39. success: function(response) {
  40. $('#closeSpeechForm').submit();
  41. var alertContainer = $('.alert-info');
  42. alertContainer.find('span').text(response.message); // Set message text
  43. alertContainer.fadeIn().removeClass('hidden'); // Show the alert
  44. setTimeout(function() {
  45. alertContainer.fadeOut().addClass('hidden'); // Hide the alert after 5 seconds
  46. }, 3000);
  47. },
  48. error: function(xhr, status, error) {
  49. console.error('Error submitting form:', error);
  50. }
  51. });
  52. });
  53. });
  54. </script>
  55. @endpush