You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

326 lines
14 KiB

@extends('layout.app')
@section('title')
<title>Book an Appointment</title>
<meta name="description" content="ET Education and Visa Services, presented by Extratech, is an adept provider of excellent education consultation, information, and visa guidance solution to students seeking schooling abroad.">
<meta name="robots" content="index, follow" />
<meta property="og:url" content="" />
<meta property="og:image" content="{{url('frontend/images/banner.png')}}"/>
<meta property="og:title" content="ET-Visas"/>
<meta property="og:description" content="ET Education and Visa Services, presented by Extratech, is an adept provider of excellent education consultation, information, and visa guidance solution to students seeking schooling abroad."/>
@endsection
@section('content')
<section class="appointment-section">
<div class="row">
<div class="col-md-12 mb-3">
<h1>Book an Appointment</h1>
<p>Please select the service and available date to book</p>
</div>
<!-- Start of Tab -->
<div class="row">
<div class="col-sm-12 col-md-4 d-flex align-items-start">
<div class="nav appointment-pills flex-column nav-pills me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<button class="btn-appointment nav-link active" id="v-pills-education-tab" data-type = "1" data-bs-toggle="pill" data-bs-target="#v-pills-education" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">
<i class="appointment-card-img"><img src="{{url('frontend/icons/visa-approved.svg')}}" class="img-fluid" alt=""></i>
<h2>Education Services</h2>
</button>
<button class="btn-appointment nav-link" id="v-pills-visa-tab" data-type = "2" data-bs-toggle="pill" data-bs-target="#v-pills-visa" type="button" role="tab" aria-controls="v-pills-visa" aria-selected="false">
<i class="appointment-card-img"><img src="{{url('frontend/icons/visa-approved.svg')}}" class="img-fluid" alt=""></i>
<h2>Migration | Visa Services</h2>
</button>
</div>
</div>
<div class="col-sm-12 col-md-8">
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-education" role="tabpanel" aria-labelledby="v-pills-education-tab" tabindex="0">
<div class="calender-section">
<div class="calendar-top">
<h5>Time Zone:</h5>
<h5>Australia | Sydney</h5>
</div>
<h2>Select Available Date</h2>
<h3>Education services | 30 mins</h3>
<div id="1-calendar-apppearance"></div>
<div id='1-available-dates' class="available-dates"></div>
</div>
</div>
<!-- Start of Visa Block -->
<div class="tab-pane fade" id="v-pills-visa" role="tabpanel" aria-labelledby="v-pills-visa-tab" tabindex="0">
<div class="calender-section">
<div class="calendar-top">
<h5>Time Zone:</h5>
<h5>Australia | Sydney</h5>
</div>
<h2>Select Available Date</h2>
<h3>Visa services | 30 mins</h3>
<div id="2-calendar-apppearance"></div>
<div id='2-available-dates' class="available-dates"></div>
</div>
</div>
<!-- End of Visa Block -->
</div>
</div>
</div>
<!-- End of Tab -->
<!-- Appointment Modal -->
<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-content">
<div class="modal-header">
<h3 class="modal-title" id="appointmentModalLabel">Book Appointment</span></h3>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="book-modal-info">
<p>You are about to book appointment for <span id = "booking_service"></span> at date &nbsp;<span id = "booking_date"></span><span class="time" id = "start_time"></span> to <span id = "end_time"></span></p>
</div>
<!-- Form with the fields name, email, phone, and notes -->
<form id ="appointment-form">
<input type="hidden" name="appointment_id" id="appointment_id">
<div class="form-group mb-2">
<label for="name">Name</label>
<input type="text" class="form-control mt-1" id="app-name" name="name" onkeyup="validateAppName()">
<span class="error" id="app-name-error"></span>
</div>
<div class="form-group mb-2">
<label for="email">Email</label>
<input type="email" class="form-control mt-1" id="app-email" name="email" onkeyup="validateAppEmail()">
<span class="error" id="app-email-error"></span>
</div>
<div class="form-group mb-2">
<label for="phone">Phone</label>
<input type="tel" class="form-control mt-1" id="app-phone" name="phone" onkeyup="validateAppPhone()">
<span class="error" id="app-phone-error"></span>
</div>
<div class="form-group mb-2">
<label for="notes">Notes</label>
<textarea class="form-control mt-1" id="notes" name="notes"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" onclick = "submitAppointment()" class="btn btn-primary" id="appointmentbtn">Book Appointment</button>
<button class="buttonload btn btn-primary" id="buttonenqload" disabled>
<i class="fas fa-spinner fa-pulse"></i> Submiting
</button>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('script')
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$('#v-pills-education-tab').click(function (e) {
var id = $(this).data("type");
var $calender = $("#"+id+"-calendar-apppearance");
displayCalendar($calender,id);
});
$('#v-pills-visa-tab').click(function (e) {
var id = $(this).data("type");
var $calender = $("#"+id+"-calendar-apppearance");
displayCalendar($calender,id);
});
$(document).ready(function () {
var $calender = $("#1-calendar-apppearance");
var id = 1;
displayCalendar($calender,id);
});
function displayCalendar($calender,id){
var id = id;
var now = new Date();
var appointments_list = id == 1 ? {!! json_encode($educationAppointments) !!} : {!! json_encode($visaAppointments) !!};
var events = [];
appointments_list.forEach(function(list) {
events.push({
date: list.date,
classname: "clickable event-clickable"
});
});
$calender.zabuto_calendar({
classname: 'table event-colourful table-bordered lightgrey-weekends',
week_starts: 'monday',
show_days: true,
cell_border: true,
weekstartson: 0,
navigation_markup: {
prev: '<i class="fas fa-chevron-circle-left"></i>',
next: '<i class="fas fa-chevron-circle-right"></i>'
},
events:events
});
let allBtns = document.querySelectorAll("td")
$calender.on('zabuto:calendar:day', function (e) {
var now = new Date();
var date = e.date;
//get available time for selected date
$.ajax({
url: "/appointments_by_date",
type:"POST",
data:{
date:date,id:id
},
success:function(response){
if (response) {
var appointments = response.appointment;
formated_date = response.formated_date
dispalyAppointments(appointments,formated_date,id);
}
},
error: function(response) {
}
});
// On click, remove the MyClass on ALL td
allBtns.forEach(function(el){
el.classList.remove("active");
});
// Add the class on clicked one
e.target.classList.add("active");
})
}
function dispalyAppointments(appointments,formated_date,id) {
//display available appointments in timeslot
if (appointments.length > 0) {
var timeSlots = '';
for (var i = 0; i < appointments.length; i++) {
var appointment = appointments[i];
// var isAmStart = appointment.start_time < '12:00:00';
// var isAmEnd = appointment.end_time < '12:00:00';
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);
$('.time-slot').click(function (e) {
e.preventDefault();
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);
$('#booking_date').html('<b>'+formated_date+'</b>');
if(id == 1){
$('#booking_service').html('<b>Education Service</b>');
}
if(id == 2){
$('#booking_service').html('<b>Migration/Visa Service</b>');
}
$('#start_time').html('&nbsp;<b>('+startTime+'</b>');
$('#end_time').html('<b>'+endTime+')</b>');
$("#modal").modal("show");
});
}
else{
$('#'+id+'-available-dates').html("No appointments available for " + "<b>"+formated_date+"</b>");
}
}
appNameError = document.getElementById('app-name-error');
appEmailError = document.getElementById('app-email-error');
appPhoneError = document.getElementById('app-phone-error');
loaderenqBtn = document.getElementById('buttonenqload');
appointmentBtn = document.getElementById('appointmentbtn');
function validateAppName(){
var appName = document.getElementById('app-name').value;
if(appName.length == 0){
$('#name-email').focus();
appNameError.innerHTML = "Name Field is required !";
return false;
}
appNameError.innerHTML = '';
return true;
}
function validateAppEmail(){
var appEmail = document.getElementById('app-email').value;
if(appEmail.length == 0){
$('#name-email').focus();
appEmailError.innerHTML = "Email Field is required !";
return false;
}
if(!appEmail.match(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(.\w{2,3})+$/)){
appEmailError.innerHTML = "Invalid email address";
return false;
}
appEmailError.innerHTML = '';
return true;
}
function validateAppPhone(){
var appPhone = document.getElementById('app-phone').value;
if(appPhone.length == 0){
$('#app-phone').focus();
appPhoneError.innerHTML = "Phone Field is required !";
return false;
}
if(!appPhone.match(/^\d{10}$/)){
appPhoneError.innerHTML = "Invalid mobile number";
return false;
}
appPhoneError.innerHTML = '';
return true;
}
function submitAppointment(){
if(!validateAppName() || !validateAppEmail() || !validateAppPhone()){
return false;
}else{
loaderenqBtn.classList.add('displayBtn')
appointmentBtn.classList.add('buttonload')
$.ajax({
url: "/appointment_submit",
type: "post",
data: $("form").serialize(),
success: function(response) {
$("#modal").modal("hide");
// var isAmStart = response.appointment.start_time < '12:00:00';
// var isAmEnd = response.appointment.end_time < '12:00:00';
loaderenqBtn.classList.remove('displayBtn');
Swal.fire({
title: 'Booked!!',
text: 'Appointment Successfully Booked for '+response.appointment_detail['name']+' at '+response.formated_date +'('+response.appointment['start_time']+' - ' + response.appointment['end_time']+' )',
icon: 'success'
}).then(function(){
location.reload();
}
)
}
});
}
}
</script>
@endsection