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

@ -57,11 +57,14 @@ class AppointmentController extends Controller
if($appointment_detail->save()){ if($appointment_detail->save()){
$appointment = Appointment::findorfail($appointment_id); $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->is_booked = true;
$appointment->save(); $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">Date</th>
<th class="text-center">Start Time</th> <th class="text-center">Start Time</th>
<th class="text-center">End Time</th> <th class="text-center">End Time</th>
<th class="text-center">Booking Status</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@ -68,8 +69,7 @@
<td class="text-center">{{$setting->date}}</td> <td class="text-center">{{$setting->date}}</td>
<td class="text-center">{{$setting->start_time}}</td> <td class="text-center">{{$setting->start_time}}</td>
<td class="text-center">{{$setting->end_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"> <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"> <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> </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" onclick = "submitAppointment(event)" class="btn btn-primary">Book Appointment</button> <button type="button" onclick = "submitAppointment(event)" class="btn btn-primary">Book Appointment</button>
</div> </div>
</div> </div>
@ -136,6 +136,7 @@
@endsection @endsection
@section('script') @section('script')
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script> <script>
$.ajaxSetup({ $.ajaxSetup({
headers: { headers: {
@ -208,8 +209,9 @@
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 isAm = appointment.start_time < '12:00:00'; var isAmStart = 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 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); $('#available-dates').html(timeSlots);
@ -258,7 +260,17 @@
data: $("form").serialize(), data: $("form").serialize(),
success: function(response) { success: function(response) {
$("#modal").modal("hide"); $("#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 // Handle the success response
// e.g. close the modal, show a success message, etc. // e.g. close the modal, show a success message, etc.
} }

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

Loading…
Cancel
Save