Wedding Invitation
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

rsvp-modal.blade.php 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <dialog id="rsvp" class="modal">
  2. <div class="modal-box w-11/12 max-w-5xl">
  3. <h3 class="text-lg font-bold">RSVP</h3>
  4. <form id="rsvpForm">
  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. @if ($host == 'aliffayuna.com')
  13. <label class="form-control w-full max-w-xs">
  14. <div class="label">
  15. <span class="label-text">Bilangan</span>
  16. </div>
  17. <input type="number" name="member" placeholder="Taip disini" class="input input-bordered input-sm input-accent w-full max-w-xs" />
  18. </label>
  19. @else
  20. <label class="form-control w-full max-w-xs">
  21. <div class="label">
  22. <span class="label-text">Bilangan</span>
  23. </div>
  24. <select name="member" class="select select-bordered select-sm select-accent w-full max-w-xs">
  25. <option disabled selected>Pilih satu pilihan</option>
  26. <option value="1">1</option>
  27. <option value="2">2</option>
  28. </select>
  29. </label>
  30. @endif
  31. <label class="form-control w-full max-w-xs">
  32. <div class="label">
  33. <span class="label-text">No. Tel</span>
  34. </div>
  35. <input type="number" name="phone" placeholder="Taip disini" class="input input-bordered input-sm input-accent w-full max-w-xs" />
  36. </label>
  37. </form>
  38. <div class="modal-action">
  39. <form method="dialog" id="closeRsvpForm"></form>
  40. <button type="button" class="btn bg-babybluedark" id="submitRsvpForm">Hantar</button>
  41. <button type="button" class="btn" id="submitCloseRsvpForm">Tutup</button>
  42. </div>
  43. </div>
  44. </dialog>
  45. @push('script')
  46. <script>
  47. $(document).ready(function() {
  48. $('#submitCloseRsvpForm').click(function(e) {
  49. $('#closeRsvpForm').submit();
  50. });
  51. $('#submitRsvpForm').click(function(e) {
  52. e.preventDefault();
  53. var formData = $('#rsvpForm').serialize();
  54. $.ajax({
  55. url: '{{ route('rsvp.save') }}',
  56. type: 'POST',
  57. data: formData,
  58. success: function(response) {
  59. $('#closeRsvpForm').submit();
  60. $('#rsvpForm')[0].reset();
  61. var alertContainer = $('.alert-info');
  62. alertContainer.find('span').text(response.message); // Set message text
  63. alertContainer.fadeIn().removeClass('hidden'); // Show the alert
  64. setTimeout(function() {
  65. alertContainer.fadeOut().addClass('hidden'); // Hide the alert after 5 seconds
  66. }, 3000);
  67. },
  68. error: function(xhr, status, error) {
  69. console.error('Error submitting form:', error);
  70. }
  71. });
  72. });
  73. });
  74. </script>
  75. @endpush