|
|
@ -184,21 +184,24 @@ |
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < appointments.length; i++) { |
|
|
|
for (var i = 0; i < appointments.length; i++) { |
|
|
|
var appointment = appointments[i]; |
|
|
|
var appointment = appointments[i]; |
|
|
|
var isAmStart = appointment.start_time < '12:00:00'; |
|
|
|
// var isAmStart = appointment.start_time < '12:00:00'; |
|
|
|
var isAmEnd = appointment.end_time < '12:00:00'; |
|
|
|
// var isAmEnd = appointment.end_time < '12:00:00'; |
|
|
|
timeSlots += '<button type="button" class="time-slot" data-toggle="modal" data-target="#appointmentModal" data-appointment-id="' + appointment.id + '">' + appointment.start_time +' '+ (isAmEnd ? 'AM' : 'PM')+ ' - ' + appointment.end_time +' ' + (isAmEnd ? 'AM' : 'PM') + '</button>'; |
|
|
|
var isAmStart = ''; |
|
|
|
|
|
|
|
var isAmEnd = ''; |
|
|
|
|
|
|
|
timeSlots += '<button type="button" class="time-slot" data-toggle="modal" data-target="#appointmentModal" data-appointment-id="' + appointment.id + '" data-start-time="'+appointment.start_time+'" + data-end-time="'+appointment.end_time+'" >' + appointment.start_time +' - ' + appointment.end_time +'</button>'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$('#'+id+'-available-dates').html(timeSlots); |
|
|
|
$('#'+id+'-available-dates').html(timeSlots); |
|
|
|
|
|
|
|
|
|
|
|
$('.time-slot').click(function (e) { |
|
|
|
$('.time-slot').click(function (e) { |
|
|
|
|
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
var appointmentId = $(this).data("appointment-id"); |
|
|
|
var appointmentId = $(this).data("appointment-id"); |
|
|
|
|
|
|
|
var startTime = $(this).data("start-time"); |
|
|
|
|
|
|
|
var endTime = $(this).data("end-time"); |
|
|
|
$('#appointment-form input[name="appointment_id"]').val(appointmentId); |
|
|
|
$('#appointment-form input[name="appointment_id"]').val(appointmentId); |
|
|
|
$('#booking_date').html(formated_date); |
|
|
|
$('#booking_date').html(formated_date); |
|
|
|
$('#start_time').html(' <b>('+appointment.start_time+'</b>'); |
|
|
|
$('#start_time').html(' <b>('+startTime+'</b>'); |
|
|
|
$('#end_time').html('<b>'+appointment.end_time+')</b>'); |
|
|
|
$('#end_time').html('<b>'+endTime+')</b>'); |
|
|
|
$("#modal").modal("show"); |
|
|
|
$("#modal").modal("show"); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
@ -218,12 +221,12 @@ |
|
|
|
data: $("form").serialize(), |
|
|
|
data: $("form").serialize(), |
|
|
|
success: function(response) { |
|
|
|
success: function(response) { |
|
|
|
$("#modal").modal("hide"); |
|
|
|
$("#modal").modal("hide"); |
|
|
|
var isAmStart = response.appointment.start_time < '12:00:00'; |
|
|
|
// var isAmStart = response.appointment.start_time < '12:00:00'; |
|
|
|
var isAmEnd = response.appointment.end_time < '12:00:00'; |
|
|
|
// var isAmEnd = response.appointment.end_time < '12:00:00'; |
|
|
|
|
|
|
|
|
|
|
|
Swal.fire({ |
|
|
|
Swal.fire({ |
|
|
|
title: 'Booked!!', |
|
|
|
title: 'Booked!!', |
|
|
|
text: 'Appointment Successfully Booked for '+response.appointment_detail['name']+' at '+response.formated_date +'('+response.appointment['start_time']+' '+(isAmStart ? 'AM' : 'PM')+ ' - ' + response.appointment['end_time']+' '+ (isAmEnd ? 'AM' : 'PM') +')', |
|
|
|
text: 'Appointment Successfully Booked for '+response.appointment_detail['name']+' at '+response.formated_date +'('+response.appointment['start_time']+' - ' + response.appointment['end_time']+' )', |
|
|
|
icon: 'success' |
|
|
|
icon: 'success' |
|
|
|
}).then(function(){ |
|
|
|
}).then(function(){ |
|
|
|
location.reload(); |
|
|
|
location.reload(); |
|
|
|