appointment

et#23
Mahesh Sharma 2 years ago
parent 25a9be6e1c
commit 3f2850b8d1
  1. 82
      app/Http/Controllers/Admin/ServiceSectionController.php
  2. 5
      app/Http/Controllers/AppointmentController.php
  3. 4
      resources/views/admin/appointment/index.blade.php
  4. 20
      resources/views/appointment.blade.php
  5. 36
      resources/views/study-abroad-detail.blade.php

@ -209,49 +209,59 @@ class ServiceSectionController extends Controller
$point_descriptions = $request->point_descriptions ?? [];
$icons = $request->icons ?? [];
if($points != null && $point_ids != null){
foreach($request['point_ids'] as $key => $pid){
if((!empty($points)) && ($points[0] != null)){
$service_section_point = $service_section->service_section_point();
$service_section_point->delete();
foreach($points as $point){
$service_section_point = new ServiceSectionPoint();
$service_section_point = $service_section_point->findorfail($pid);
// $service_section_point = ServiceSectionPoint::find($id);
if(array_key_exists($key,$point_descriptions)){
$service_section_point->point_description = $point_descriptions[$key];
$service_section_point->service_section_id = $service_section->id;
$service_section_point->point = $point;
$service_section_point->save();
}
}
if(array_key_exists($key,$icons)){
$extension = $icons[$key]->getClientOriginalExtension();
$image_folder_type = array_search('service',config('custom.image_folders')); //for image saved in folder
$count = rand(100,999);
// if($points != null && $point_ids != null){
// foreach($request['point_ids'] as $key => $pid){
// $service_section_point = new ServiceSectionPoint();
// $service_section_point = $service_section_point->findorfail($pid);
// // $service_section_point = ServiceSectionPoint::find($id);
$out_put_path = User::save_image($icons[$key],$extension,$count,$image_folder_type);
is_array($out_put_path) ? $service_section_point->icon = $out_put_path[0] : $service_section_point->icon = $out_put_path;
// $service_section_point->icon = $points_descriptions[$key];
}
$service_section_point->point = $points[$key];
$service_section_point->update();
// if(array_key_exists($key,$point_descriptions)){
// $service_section_point->point_description = $point_descriptions[$key];
// }
// if(array_key_exists($key,$icons)){
// $extension = $icons[$key]->getClientOriginalExtension();
// $image_folder_type = array_search('service',config('custom.image_folders')); //for image saved in folder
}
}
else{
foreach($points as $key => $point){
$service_section_point = new ServiceSectionPoint();
$service_section_point->service_section_id = $service_section->id;
$service_section_point->point = $point;
if(array_key_exists($key,$icons)){
$extension = $icons[$key]->getClientOriginalExtension();
$image_folder_type = array_search('service',config('custom.image_folders')); //for image saved in folder
// $count = rand(100,999);
$count = rand(100,999);
// $out_put_path = User::save_image($icons[$key],$extension,$count,$image_folder_type);
// is_array($out_put_path) ? $service_section_point->icon = $out_put_path[0] : $service_section_point->icon = $out_put_path;
// // $service_section_point->icon = $points_descriptions[$key];
// }
// $service_section_point->point = $points[$key];
// $service_section_point->update();
$out_put_path = User::save_image($icons[$key],$extension,$count,$image_folder_type);
is_array($out_put_path) ? $service_section_point->icon = $out_put_path[0] : $service_section_point->icon = $out_put_path;
// $service_section_point->icon = $points_descriptions[$key];
}
$service_section_point->save();
}
}
// }
// }
// else{
// foreach($points as $key => $point){
// $service_section_point = new ServiceSectionPoint();
// $service_section_point->service_section_id = $service_section->id;
// $service_section_point->point = $point;
// if(array_key_exists($key,$icons)){
// $extension = $icons[$key]->getClientOriginalExtension();
// $image_folder_type = array_search('service',config('custom.image_folders')); //for image saved in folder
// $count = rand(100,999);
// $out_put_path = User::save_image($icons[$key],$extension,$count,$image_folder_type);
// is_array($out_put_path) ? $service_section_point->icon = $out_put_path[0] : $service_section_point->icon = $out_put_path;
// // $service_section_point->icon = $points_descriptions[$key];
// }
// $service_section_point->save();
// }
// }
// $service_point = $service_section->service_section_point();
// $service_point->delete();
// foreach($points as $key => $point){

@ -57,11 +57,14 @@ class AppointmentController extends Controller
if($appointment_detail->save()){
$appointment = Appointment::findorfail($appointment_id);
$date = Carbon::createFromFormat('Y-m-d', $appointment->date);
$formated_date = $date->format('M d, Y');
// $isAm = ($appointment['start_time'] < '12:00:00') ? 'AM' :'PM';
$appointment->is_booked = true;
$appointment->save();
}
return response()->json(['appointment' => $appointment_detail],200);
return response()->json(['appointment_detail' => $appointment_detail,'appointment' => $appointment,'formated_date' => $formated_date],200);

@ -58,6 +58,7 @@
<th class="text-center">Date</th>
<th class="text-center">Start Time</th>
<th class="text-center">End Time</th>
<th class="text-center">Booking Status</th>
<th class="text-center">Action</th>
</tr>
</thead>
@ -68,8 +69,7 @@
<td class="text-center">{{$setting->date}}</td>
<td class="text-center">{{$setting->start_time}}</td>
<td class="text-center">{{$setting->end_time}}</td>
<td class="text-center">{{$setting->is_booked ? 'Booked' : 'Not Booked'}}</td>
<td class="d-flex justify-content-center action-icons">
<a href="{{url('admin/appointments/'.$setting->id.'/edit')}}" class="btn btn-sm" data-bs-toggle="tooltip" data-bs-placement="top" title="edit">

@ -82,7 +82,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-dismiss="modal">Close</button> -->
<button type="button" onclick = "submitAppointment(event)" class="btn btn-primary">Book Appointment</button>
</div>
</div>
@ -136,6 +136,7 @@
@endsection
@section('script')
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
$.ajaxSetup({
headers: {
@ -208,8 +209,9 @@
for (var i = 0; i < appointments.length; i++) {
var appointment = appointments[i];
var isAm = appointment.start_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 + ' - ' + appointment.end_time +' ' + (isAm ? 'AM' : 'PM') + '</button>';
var isAmStart = appointment.start_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>';
}
$('#available-dates').html(timeSlots);
@ -258,7 +260,17 @@
data: $("form").serialize(),
success: function(response) {
$("#modal").modal("hide");
alert('Appointment successfuuly booked');
var isAmStart = response.appointment.start_time < '12:00:00';
var isAmEnd = response.appointment.end_time < '12:00:00';
Swal.fire({
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') +')',
icon: 'success'
}).then(function(){
location.reload();
}
)
// Handle the success response
// e.g. close the modal, show a success message, etc.
}

@ -36,26 +36,34 @@
<h5>The popular universities in NSW</h5>
</div>
<div class="row">
<!-- @foreach($second_section->service_section_point as $point) -->
@php $universities = $second_section->service_section_point; @endphp
<div class="col-md-3">
<div class="universities-card">
<!-- <img src="{{url($point->icon ?? '')}}" class="w-100" alt=""> -->
<!-- <h5>{{$point->point}}</h5> -->
<ul>
<li>University of Sydney</li>
<li>UNSW Sydney</li>
<li>University of Technology Sydney</li>
<li>Charles Sturt University</li>
<li>Southern Cross University</li>
<li>University of New England</li>
<li>University Wollongong</li>
@foreach($universities->take(3) as $point)
<li>{{$point->point}}</li>
@endforeach
</ul>
</div>
</div>
<div class="col-md-3">
<div class="universities-card">
<ul>
@foreach($universities->skip(3)->take(3) as $point)
<li>{{$point->point}}</li>
@endforeach
</ul>
</div>
</div>
<div class="col-md-3">
<div class="universities-card">
<ul>
@foreach($universities->skip(3)->take(3) as $point)
<li>{{$point->point}}</li>
@endforeach
</ul>
</div>
</div>
<!-- @endforeach -->
{!!$second_section->sub_description!!}
</div>
</section>

Loading…
Cancel
Save