appointment-booked

et#20
Mahesh Sharma 2 years ago
parent 7952068dad
commit 637e49f574
  1. 31
      resources/views/appointment.blade.php

@ -61,28 +61,29 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<!-- Form with the fields name, email, phone, and notes --> <!-- Form with the fields name, email, phone, and notes -->
<form> <form id ="appointment-form">
<input type="hidden" name="appointment_id" id="appointment_id">
<div class="form-group mb-2"> <div class="form-group mb-2">
<label for="name">Name</label> <label for="name">Name</label>
<input type="text" class="form-control mt-1" id="name" required> <input type="text" class="form-control mt-1" id="name" name="name" required>
</div> </div>
<div class="form-group mb-2"> <div class="form-group mb-2">
<label for="email">Email</label> <label for="email">Email</label>
<input type="email" class="form-control mt-1" id="email" required> <input type="email" class="form-control mt-1" id="email" name="email" required>
</div> </div>
<div class="form-group mb-2"> <div class="form-group mb-2">
<label for="phone">Phone</label> <label for="phone">Phone</label>
<input type="tel" class="form-control mt-1" id="phone" required> <input type="tel" class="form-control mt-1" id="phone" name="phone" required>
</div> </div>
<div class="form-group mb-2"> <div class="form-group mb-2">
<label for="notes">Notes</label> <label for="notes">Notes</label>
<textarea class="form-control mt-1" id="notes"></textarea> <textarea class="form-control mt-1" id="notes" name="notes"></textarea>
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Book Appointment</button> <button type="button" onclick = "submitAppointment(event)" class="btn btn-primary">Book Appointment</button>
</div> </div>
</div> </div>
</div> </div>
@ -92,7 +93,7 @@
<!-- Modal --> <!-- Modal -->
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="appointmentModalLabel" aria-hidden="true"> <!-- <div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="appointmentModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -102,8 +103,7 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<!-- Form with the fields name, email, phone, and notes --> <form id = "appointment-form" onsubmit="submitAppointment(event)">
<form id = "appointment-form">
<input type="hidden" name="appointment_id" id="appointment_id"> <input type="hidden" name="appointment_id" id="appointment_id">
<div class="form-group"> <div class="form-group">
<label for="name">Name</label> <label for="name">Name</label>
@ -125,11 +125,11 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" onclick = "submitAppointment(event) " class="btn btn-primary">Book Appointment</button> <button type="submit" class="btn btn-primary">Book Appointment</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> -->
@ -218,9 +218,11 @@
e.preventDefault(); e.preventDefault();
var appointmentId = $(this).data("appointment-id"); var appointmentId = $(this).data("appointment-id");
$("#modal").attr("id", "modal-" + appointmentId); // $("#modal").attr("id", "modal-" + appointmentId);
$('#appointment-form input[name="appointment_id"]').val(appointmentId); $('#appointment-form input[name="appointment_id"]').val(appointmentId);
$("#modal-" + appointmentId).modal("show"); // $("#modal-" + appointmentId).modal("show");
$("#modal").modal("show");
// showAppointmentForm(appointmentId); // showAppointmentForm(appointmentId);
}); });
@ -254,7 +256,8 @@
type: "post", type: "post",
data: $("form").serialize(), data: $("form").serialize(),
success: function(response) { success: function(response) {
console.log(response.appointment_detail); $("#modal").modal("hide");
alert('Appointment successfuuly booked');
// Handle the success response // Handle the success response
// e.g. close the modal, show a success message, etc. // e.g. close the modal, show a success message, etc.
} }

Loading…
Cancel
Save