Wedding Invitation
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

guestbook-modal.blade.php 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. $('#speechForm')[0].reset();
  42. var alertContainer = $('.alert-info');
  43. alertContainer.find('span').text(response.message); // Set message text
  44. alertContainer.fadeIn().removeClass('hidden'); // Show the alert
  45. setTimeout(function() {
  46. alertContainer.fadeOut().addClass('hidden'); // Hide the alert after 5 seconds
  47. }, 3000);
  48. },
  49. error: function(xhr, status, error) {
  50. console.error('Error submitting form:', error);
  51. }
  52. });
  53. });
  54. });
  55. </script>
  56. @endpush