|
|
@ -11,26 +11,60 @@ use Carbon\Carbon; |
|
|
|
|
|
|
|
|
|
|
|
class AppointmentController extends Controller |
|
|
|
class AppointmentController extends Controller |
|
|
|
{ |
|
|
|
{ |
|
|
|
protected $view= 'admin.appointment.'; |
|
|
|
protected $view = 'admin.appointment.'; |
|
|
|
protected $redirect = 'admin/appointments'; |
|
|
|
protected $redirect = 'admin/appointments'; |
|
|
|
|
|
|
|
// protected $service; |
|
|
|
|
|
|
|
|
|
|
|
public function index(){ |
|
|
|
public function education_appointments() |
|
|
|
$appointments = Appointment::orderBy('id','DESC'); |
|
|
|
{ |
|
|
|
if(\request('date')){ |
|
|
|
$appointments = Appointment::where('service_type', '1')->orderBy('id', 'DESC'); |
|
|
|
$key = \request('date'); |
|
|
|
if (\request('date')) { |
|
|
|
$appointments = $appointments->whereDate('date',$key); |
|
|
|
$date = \request('date'); |
|
|
|
|
|
|
|
$appointments = $appointments->whereDate('date', $date); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (\request('status')) { |
|
|
|
|
|
|
|
$status = \request('status'); |
|
|
|
|
|
|
|
$appointments = $appointments->where('status', $status); |
|
|
|
} |
|
|
|
} |
|
|
|
if(\request('status')){ |
|
|
|
if (\request('is_booked')) { |
|
|
|
$key = \request('status'); |
|
|
|
$is_booked = (\request('is_booked')) == '1' ? true : false; |
|
|
|
$appointments = $appointments->where('status',$key); |
|
|
|
$appointments = $appointments->where('is_booked', $is_booked); |
|
|
|
} |
|
|
|
} |
|
|
|
$appointments = $appointments->paginate(30); |
|
|
|
$appointments = $appointments->paginate(20); |
|
|
|
return view($this->view.'index',compact('appointments')); |
|
|
|
$service = 'Education'; |
|
|
|
|
|
|
|
$is_booked = $is_booked ?? null; |
|
|
|
|
|
|
|
$date = $date ?? null; |
|
|
|
|
|
|
|
$status = $status ?? null; |
|
|
|
|
|
|
|
return view($this->view . 'index', compact('appointments', 'service', 'is_booked', 'date', 'status')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function visa_appointments() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$appointments = Appointment::where('service_type', '2')->orderBy('id', 'DESC'); |
|
|
|
|
|
|
|
if (\request('date')) { |
|
|
|
|
|
|
|
$date = \request('date'); |
|
|
|
|
|
|
|
$appointments = $appointments->whereDate('date', $date); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (\request('status')) { |
|
|
|
|
|
|
|
$status = \request('status'); |
|
|
|
|
|
|
|
$appointments = $appointments->where('status', $status); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (\request('is_booked')) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$is_booked = (\request('is_booked')) == '1' ? true : false; |
|
|
|
|
|
|
|
$appointments = $appointments->where('is_booked', $is_booked); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$appointments = $appointments->paginate(20); |
|
|
|
|
|
|
|
$is_booked = $is_booked ?? null; |
|
|
|
|
|
|
|
$date = $date ?? null; |
|
|
|
|
|
|
|
$status = $status ?? null; |
|
|
|
|
|
|
|
$service = 'Migration|Visa'; |
|
|
|
|
|
|
|
return view($this->view . 'index', compact('appointments', 'service', 'is_booked', 'date', 'status')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function create() |
|
|
|
public function create() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return view($this->view.'create'); |
|
|
|
return view($this->view . 'create'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function store(Request $request) |
|
|
|
public function store(Request $request) |
|
|
@ -68,7 +102,7 @@ class AppointmentController extends Controller |
|
|
|
$end_time = $end_time[0]; |
|
|
|
$end_time = $end_time[0]; |
|
|
|
$appointment['start_time'] = $start_time; |
|
|
|
$appointment['start_time'] = $start_time; |
|
|
|
$appointment['end_time'] = $end_time; |
|
|
|
$appointment['end_time'] = $end_time; |
|
|
|
return view($this->view.'edit', compact('appointment')); |
|
|
|
return view($this->view . 'edit', compact('appointment')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function update(Request $request, $id) |
|
|
|
public function update(Request $request, $id) |
|
|
@ -96,11 +130,11 @@ class AppointmentController extends Controller |
|
|
|
return redirect($this->redirect)->with('success', 'Appointment has been updated'); |
|
|
|
return redirect($this->redirect)->with('success', 'Appointment has been updated'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function show($id){ |
|
|
|
public function show($id) |
|
|
|
|
|
|
|
{ |
|
|
|
$appointment = Appointment::with('appointment_booking_detail')->findorfail($id); |
|
|
|
$appointment = Appointment::with('appointment_booking_detail')->findorfail($id); |
|
|
|
|
|
|
|
|
|
|
|
return view($this->view.'show', compact('appointment')); |
|
|
|
return view($this->view . 'show', compact('appointment')); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function destroy($id) |
|
|
|
public function destroy($id) |
|
|
@ -111,4 +145,3 @@ class AppointmentController extends Controller |
|
|
|
return redirect($this->redirect)->with('success', 'Appointment has been deleted'); |
|
|
|
return redirect($this->redirect)->with('success', 'Appointment has been deleted'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|