From 3f2850b8d17b9744684aea0c4bd9b5045fc06252 Mon Sep 17 00:00:00 2001 From: Mahesh Sharma Date: Thu, 9 Feb 2023 16:03:52 +0545 Subject: [PATCH] appointment --- .../Admin/ServiceSectionController.php | 84 +++++++++++-------- .../Controllers/AppointmentController.php | 5 +- .../views/admin/appointment/index.blade.php | 4 +- resources/views/appointment.blade.php | 20 ++++- resources/views/study-abroad-detail.blade.php | 36 ++++---- 5 files changed, 91 insertions(+), 58 deletions(-) diff --git a/app/Http/Controllers/Admin/ServiceSectionController.php b/app/Http/Controllers/Admin/ServiceSectionController.php index f8a7205..e138f59 100644 --- a/app/Http/Controllers/Admin/ServiceSectionController.php +++ b/app/Http/Controllers/Admin/ServiceSectionController.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){ - $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]; - } - 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(); - - } - } - else{ - foreach($points as $key => $point){ + 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_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(); } } + + // 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); + + // 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); + + // $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(); + + // } + // } + // 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){ diff --git a/app/Http/Controllers/AppointmentController.php b/app/Http/Controllers/AppointmentController.php index 296a50d..b71da32 100644 --- a/app/Http/Controllers/AppointmentController.php +++ b/app/Http/Controllers/AppointmentController.php @@ -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); diff --git a/resources/views/admin/appointment/index.blade.php b/resources/views/admin/appointment/index.blade.php index 3e324e4..39f0aa0 100644 --- a/resources/views/admin/appointment/index.blade.php +++ b/resources/views/admin/appointment/index.blade.php @@ -58,6 +58,7 @@ Date Start Time End Time + Booking Status Action @@ -68,8 +69,7 @@ {{$setting->date}} {{$setting->start_time}} {{$setting->end_time}} - - + {{$setting->is_booked ? 'Booked' : 'Not Booked'}} diff --git a/resources/views/appointment.blade.php b/resources/views/appointment.blade.php index 14b5bb1..3e670b2 100644 --- a/resources/views/appointment.blade.php +++ b/resources/views/appointment.blade.php @@ -82,7 +82,7 @@ @@ -136,6 +136,7 @@ @endsection @section('script') +