appointment-initial-confirmed

et#23
Mahesh Sharma 2 years ago
parent 3f2850b8d1
commit 6023ac6817
  1. 278
      app/Http/Controllers/Admin/AccomodationController.php
  2. 9
      app/Http/Controllers/AppointmentController.php
  3. 33
      public/frontend/css/style.css
  4. 169
      resources/views/appointment.blade.php
  5. 2
      resources/views/study-abroad-detail.blade.php

@ -1,278 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Accomodation;
use App\Models\BlogPoint;
use App\Models\NewsAndUpdatePoint;
use App\Models\Setting;
use App\Models\User;
use App\Models\AccomodationFeature;
use App\Models\AccomodationInformation;
use App\Models\AccomodationSliderTitle;
use App\Models\AccomodationImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
// use function GuzzleHttp\Promise\all;
class AccomodationController extends Controller
{
protected $view = 'admin.accomodation.';
protected $redirect = 'admin/accomodations';
public function index()
{
$settings = Accomodation::orderBy('id','DESC');
if(\request('name')){
$key = \request('name');
$settings = $settings->where('title','like','%'.$key.'%');
}
if(\request('status')){
$key = \request('status');
$settings = $settings->where('status',$key);
}
$settings = $settings->paginate(config('custom.per_page'));
return view($this->view.'index',compact('settings'));
}
public function create()
{
return view($this->view . 'create');
}
public function store(Request $request)
{
$this->validate(\request(), [
'title' => 'required',
'phone' => 'required',
'address' => 'required',
'status' => 'required',
'images' => 'required',
'slider_image' => 'required|file|mimes:jpeg,png,jpg'
]);
if($request->has('slider_image')){
$extension = \request()->file('slider_image')->getClientOriginalExtension();
$image_folder_type = array_search('accomodation',config('custom.image_folders')); //for image saved in folder
$count = rand(100,999);
$out_put_path = User::save_image(\request()->file('slider_image'),$extension,$count,$image_folder_type);
$image_path1 = $out_put_path[0];
}
$requestData = $request->all();
if(isset($image_path1)){
$requestData['slider_image'] = $image_path1;
}
// $requestData['slug'] = Setting::create_slug($requestData['keyword']);
$accomodation = Accomodation::create($requestData);
if($request->hasFile('images')){
foreach($request->file('images') as $imagefile) {
$extension = $imagefile->getClientOriginalExtension();
$image_folder_type = array_search('accomodation',config('custom.image_folders')); //for image saved in folder
$count = rand(100,999);
$out_put_path = User::save_image($imagefile,$extension,$count,$image_folder_type);
$image_path1 = $out_put_path[0];
$accomodation_image = new AccomodationImage();
$accomodation_image->accomodation_id = $accomodation->id;
$accomodation_image->image = $image_path1;
$accomodation_image->save();
}
}
if(\request('feature_name')){
foreach (\request('feature_name') as $index => $value){
$setting_point = new AccomodationFeature();
$setting_point->accomodation_id = $accomodation->id;
$setting_point->feature_name = $value;
$setting_point->save();
}
}
if(\request('information_name')){
foreach (\request('information_name') as $index => $value){
$setting_point = new AccomodationInformation();
$setting_point->accomodation_id = $accomodation->id;
$setting_point->information_name = $value;
$setting_point->save();
}
}
if(\request('title_name')){
foreach (\request('title_name') as $index => $value){
$setting_point = new AccomodationSliderTitle();
$setting_point->accomodation_id = $accomodation->id;
$setting_point->title_name = $value;
$setting_point->save();
}
}
Session::flash('success','Accomodation successfully created');
return redirect($this->redirect);
}
public function show($id)
{
$setting =Accomodation::findorfail($id);
return view($this->view.'show',compact('setting'));
}
public function edit($id){
$setting =Accomodation::findorfail($id);
return view($this->view.'edit',compact('setting'));
}
public function update(Request $request, $id){
// dd(\request()->all());
$setting =Accomodation::findorfail($id);
$this->validate(\request(), [
'title' => 'required',
'phone' => 'required',
'address' => 'required',
'status' => 'required'
// 'images' => 'required',
// 'slider_image' => 'required|file|mimes:jpeg,png,jpg'
]);
if(\request('slider_image')){
$this->validate(\request(),[
'image' => 'file|mimes:jpeg,png,jpg'
]);
if($request->hasFile('slider_image')){
$extension = $request->file('slider_image')->getClientOriginalExtension();
$image_folder_type = array_search('accomodation',config('custom.image_folders')); //for image saved in folder
$count = rand(100,999);
$out_put_path = User::save_image($request->file('slider_image'),$extension,$count,$image_folder_type);
$image_path1 = $out_put_path[0];
if (is_file(public_path().'/'.$setting->slider_image) && file_exists(public_path().'/'.$setting->slider_image)){
unlink(public_path().'/'.$setting->slider_image);
}
}
}
$requestData = $request->all();
// $requestData['slug'] = Setting::create_slug($requestData['keyword']);
if(isset($image_path1)){
$requestData['slider_image'] = $image_path1;
}
$setting->fill($requestData);
if($setting->save()){
if($request->hasFile('images')){
$accommodation_image = $setting->accommodation_images();
$accommodation_image->delete();
foreach($request->file('images') as $imagefile) {
$extension = $imagefile->getClientOriginalExtension();
$image_folder_type = array_search('accomodation',config('custom.image_folders')); //for image saved in folder
$count = rand(100,999);
$out_put_path = User::save_image($imagefile,$extension,$count,$image_folder_type);
$image_path1 = $out_put_path[0];
// if (is_file(public_path().'/'.$setting->slider_image) && file_exists(public_path().'/'.$setting->slider_image)){
// unlink(public_path().'/'.$setting->slider_image);
// }
$accomodation_image = new AccomodationImage();
$accomodation_image->accomodation_id = $id;
$accomodation_image->image = $image_path1;
$accomodation_image->save();
}
}
if(\request('feature_name') ){
$accommodation_feature = $setting->accommodation_features();
$accommodation_feature->delete();
foreach (\request('feature_name') as $index => $value){
$setting_point = new AccomodationFeature();
$setting_point->accomodation_id = $id;
$setting_point->feature_name = $value;
$setting_point->save();
}
}
if(\request('information_name') ){
$accommodation_information = $setting->accommodation_informations();
$accommodation_information->delete();
foreach (\request('information_name') as $index => $value){
$setting_point = new AccomodationInformation();
$setting_point->accomodation_id = $id;
$setting_point->information_name = $value;
$setting_point->save();
}
}
if(\request('title_name') ){
$accommodation_title = $setting->accommodation_slider_titles();
$accommodation_title->delete();
foreach (\request('title_name') as $index => $value){
$setting_point = new AccomodationSlidertitle();
$setting_point->accomodation_id = $id;
$setting_point->title_name = $value;
$setting_point->save();
}
}
}
Session::flash('success','Accomodation succesffuly edited.');
return redirect($this->redirect);
}
public function delete($id){
$setting=Accomodation::findorfail($id);
// if($setting->accommodation_features->count() > 0){
// $setting->accommodation_features()->delete();
// }
// if($setting->accommodation_informations->count() > 0){
// $setting->accommodation_informations()->delete();
// }
// if($setting->accommodation_slider_titles->count() > 0){
// $setting->accommodation_informations()->delete();
// }
if($setting->delete()){
if (is_file(public_path().'/'.$setting->slider_image) && file_exists(public_path().'/'.$setting->slider_image)){
unlink(public_path().'/'.$setting->slider_image);
}
}
Session::flash('success','Accomodation successfully is deleted !');
return redirect($this->redirect);
}
public function points_remove($id)
{
if(Auth::user()){
$setting = AccomodationFeature::findorfail($id);
$setting->delete();
return response()->json(['point_id' => $id]);
}
}
public function information_points_remove($id)
{
if(Auth::user()){
$setting = AccomodationInformation::findorfail($id);
$setting->delete();
return response()->json(['point_id' => $id]);
}
}
public function slider_points_remove($id)
{
if(Auth::user()){
$setting = AccomodationSliderTitle::findorfail($id);
$setting->delete();
return response()->json(['point_id' => $id]);
}
}
}

@ -23,21 +23,26 @@ class AppointmentController extends Controller
}
public function get_appointment_by_date(Request $request){
$dateTime = $request->date;
$date_parts = explode(" ", $dateTime);
$month_number = date_parse($date_parts[1])['month'];
$carbon = Carbon::createFromDate($date_parts[3], $month_number, $date_parts[2]);
$date = $carbon->format('Y-m-d');
$type_id = $request->id;
$appointments = Appointment::whereDate('date',$date)->where(['service_type' => $type_id,'is_booked' => false,'status' => 1])->get();
$appointments = Appointment::whereDate('date',$date)->where(['status' => 1, 'is_booked' => false])->get();
$old_date = Carbon::createFromFormat('Y-m-d', $date);
$formated_date = $old_date->format('M d, Y');
// $users = DB::table('appointments')->whereDate('created_at', '2022-12-01')->get();
// $time = [];
// foreach($appointments as $appointment){
// array_push($time, [$appointment->start_time, $appointment->id]);
// }
// dd($time);
return response()->json(['appointment' => $appointments]);
return response()->json(['appointment' => $appointments,'formated_date' => $formated_date]);
}
public function form_submit(Request $request){

@ -1513,7 +1513,7 @@ Responsive Codes
flex-direction: column;
gap: 20px;
}
.appointment-card{
/* .appointment-card{
background-color: #E5F0FF;
display: flex;
align-items: center;
@ -1523,10 +1523,34 @@ Responsive Codes
padding: 10px 15px;
border-radius: 12px;
width: 360px;
} */
.appointment-section .btn-appointment{
background-color: #E5F0FF;
text-decoration: none;
color: #000000;
padding: 10px 15px;
border-radius: 8px;
margin-bottom: 15px;
text-align: left;
font-size:20px;
font-weight:bold;
}
.appointment-section .appointment-pills .active{
background-color: #326cbf!important;
color: #fff!important;;
}
.appointment-card-img{
width: 40px;
padding:5px;
display: inline-block;
margin-right:8px;
}
.book-modal-info p{
color: #808080;
}
.appointment-section .nav-pills{
width:82%;
}
.appointment-card h3{
font-weight: bold;
@ -1578,7 +1602,6 @@ table.lightgrey-weekends tbody td:nth-child(n+6) {
}
.appointment-section h1{
color: #296AC7;
margin-bottom: 2rem;
}
.calender-section h3{
font-size: 18px;
@ -2074,6 +2097,12 @@ table.lightgrey-weekends tbody td:nth-child(n+6) {
.faq-section .accordion-button, .accordion-body{
line-height: 27px;
}
.appointment-section{
padding:2rem;
}
.appointment-section .nav-pills {
width: 96%;
}
}
/* mobile view css end */
/* ipad, tablets screen css */

@ -11,42 +11,54 @@
@section('content')
<section class="appointment-section">
<div class="row">
<div class="col-md-5">
<div class="col-md-12 mb-3">
<h1>Book an Appointment</h1>
<div class="appointment-cards">
<a href="" class="appointment-card">
<div class="appointment-card-img">
<img src="{{url('frontend/icons/visa-approved.svg')}}" class="img-fluid" alt="">
<p>Please select the service and available date to book</p>
</div>
<div>
<h3>Education Services</h3>
<!-- 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>Education Services</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>Visa Services</button>
</div>
</a>
<a href="" class="appointment-card">
<div class="appointment-card-img">
<img src="{{url('frontend/icons/visa-approved.svg')}}" class="img-fluid" alt="">
</div>
<div>
<h3>Visa Services</h3>
<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>
</a>
<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>
<div class="col-md-7">
<!-- 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>Education services | 30 mins</h3>
<div id="demo-calendar-apppearance"></div>
<div id='available-dates' class="available-dates">
<!-- <h5 id='available-dates'></h5> -->
<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">
@ -55,11 +67,11 @@
<div class="modal-header">
<h3 class="modal-title" id="appointmentModalLabel">Book Appointment</h3>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button> -->
</div>
<div class="modal-body">
<div class="book-modal-info">
<p>Book your appointment for &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">
@ -82,7 +94,7 @@
</form>
</div>
<div class="modal-footer">
<!-- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> -->
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" onclick = "submitAppointment(event)" class="btn btn-primary">Book Appointment</button>
</div>
</div>
@ -91,60 +103,37 @@
</section>
<!-- 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">
<h5 class="modal-title" id="appointmentModalLabel">Book Appointment</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id = "appointment-form" onsubmit="submitAppointment(event)">
<input type="hidden" name="appointment_id" id="appointment_id">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="form-group">
<label for="phone">Phone</label>
<input type="tel" class="form-control" id="phone" name="phone" required>
</div>
<div class="form-group">
<label for="notes">Notes</label>
<textarea class="form-control" id="notes" name = "notes"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Book Appointment</button>
</div>
</div>
</div>
</div> -->
@endsection
@section('script')
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
var $calender = $("#demo-calendar-apppearance");
$('#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;
$calender.zabuto_calendar({
data: [
@foreach($educationAppointments as $appointment)
@ -174,25 +163,22 @@
});
var availableDates = document.getElementById('available-dates')
$calender.on('zabuto:calendar:day', function (e) {
var date = e.date;
//get available time for selected date
$.ajax({
url: "/appointments_by_date",
type:"POST",
data:{
date:date,
date:date,id:id
},
success:function(response){
if (response) {
var appointments = response.appointment;
dispalyAppointments(appointments,date);
formated_date = response.formated_date
dispalyAppointments(appointments,formated_date,id);
}
},
error: function(response) {
@ -200,8 +186,8 @@
}
});
})
});
function dispalyAppointments(appointments,date) {
}
function dispalyAppointments(appointments,formated_date,id) {
//display available appointments in timeslot
if (appointments.length > 0) {
@ -214,42 +200,25 @@
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>';
}
$('#available-dates').html(timeSlots);
$('#'+id+'-available-dates').html(timeSlots);
$('.time-slot').click(function (e) {
e.preventDefault();
var appointmentId = $(this).data("appointment-id");
// $("#modal").attr("id", "modal-" + appointmentId);
$('#appointment-form input[name="appointment_id"]').val(appointmentId);
// $("#modal-" + appointmentId).modal("show");
$('#booking_date').html(formated_date);
$('#start_time').html('&nbsp;<b>('+appointment.start_time+'</b>');
$('#end_time').html('<b>'+appointment.end_time+')</b>');
$("#modal").modal("show");
// showAppointmentForm(appointmentId);
});
}
else{
$('#available-dates').html("No appointments available for " + date);
}
$('#'+id+'-available-dates').html("No appointments available for " + "<b>"+formated_date+"</b>");
}
function showAppointmentForm(appointmentId){
// $("#appointmentModal").modal();
// show Appointment booking form
// Reset the form
// $('#appointment-form')[0].reset();
// Store the appointment ID in a hidden field
// $('#appointment-form input[name="appointment_id"]').val(appointmentId);
// Show the form
// $('#appointment-form').show();
}
function submitAppointment(event){
@ -271,14 +240,10 @@
location.reload();
}
)
// Handle the success response
// e.g. close the modal, show a success message, etc.
}
});
}
</script>
@endsection

@ -58,7 +58,7 @@
<div class="col-md-3">
<div class="universities-card">
<ul>
@foreach($universities->skip(3)->take(3) as $point)
@foreach($universities->skip(6)->take(3) as $point)
<li>{{$point->point}}</li>
@endforeach
</ul>

Loading…
Cancel
Save