aapointment-navigation-for-admin

et#38
Mahesh Sharma 2 years ago
parent 7f836f06c2
commit f2d67186be
  1. 67
      app/Http/Controllers/Admin/AppointmentController.php
  2. 20
      resources/views/admin/appointment/index.blade.php
  3. 6
      resources/views/admin/layouts/menubar.blade.php
  4. 3
      routes/web.php

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

@ -21,7 +21,7 @@
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Appointments</h3>
<h3 class="card-title">{{ $service }} Appointments</h3>
<div class="card-tools">
<a class="btn btn-green" href="{{url('admin/appointments/create')}}" role="button">Create</a>
</div>
@ -35,19 +35,29 @@
<div class="row">
<div class="col-md-4">
<div class="input-group input-group-sm mb-3 table-search w-100">
<input type="date" name="date" class="form-control ds-input" placeholder="Date" aria-label="Small" aria-describedby="inputGroup-sizing-sm" onchange="filterList()">
<input type="date" name="date" value = "{{ $date ?? null }}" class="form-control ds-input" placeholder="Date" aria-label="Small" aria-describedby="inputGroup-sizing-sm" onchange="filterList()">
</div>
</div>
<div class="col-md-4">
<div class="input-group input-group-sm mb-3 table-search w-100">
<select name="is_booked" class="form-control ds-input" onchange="filterList()">
<option value="" {{ is_null($is_booked) ? 'selected' : '' }} disabled >Filter By Booking Status</option>
<option {{ $is_booked ? 'selected' : '' }} value="1">Booked</option>
<option {{ (!is_null($is_booked) && !$is_booked) ? 'selected' : '' }} value="2">Open</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="input-group input-group-sm mb-3 table-search w-100">
<select name="status" class="form-control ds-input" onchange="filterList()">
<option value="" disabled selected>Search By Status</option>
<option value="" disabled selected>Filter By Status</option>
@foreach(config('custom.status') as $in => $val)
<option value="{{$in}}">{{$val}}</option>
<option value="{{$in}}" {{($status ==$in) ? 'selected':''}} >{{$val}}</option>
@endforeach
</select>
</div>
</div>
</div>
</form>
@ -74,7 +84,7 @@
@if($setting->is_booked)
<td class="text-center"><span class="badge booked text-bg-secondary">Booked</span></td>
@else
<td class="text-center"><span class="badge notbooked text-bg-secondary">Available</span></td>
<td class="text-center"><span class="badge notbooked text-bg-secondary">Open</span></td>
@endif
<td class="d-flex justify-content-center action-icons">

@ -129,7 +129,7 @@
</a>
</li>
<li class="nav-item">
<a class="nav-link {{(Request::segment(2) == 'appointments') ? 'active' : ''}}">
<a class="nav-link ">
<div class="sidebar-icon w-100" id="myAppointmentBtn">
<i class="fa-regular fa-calendar-check"></i>
<span class="menu-title w-100">
@ -140,12 +140,12 @@
<div class="collapse" id="myAppointment">
<ul class="nav flex-column sub-menu">
<li class="nav-item">
<a class="nav-link" href="{{url('admin/appointments')}}">
<a class="nav-link {{(Request::segment(2) == 'education') ? 'active' : ''}}" href="{{url('admin/appointments/education')}}">
<i class="fa-solid fa-book-open-reader"></i> <p>Education Services</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{url('admin/appointments')}}">
<a class="nav-link" href="{{url('admin/appointments/visa')}}">
<i class="fa-brands fa-cc-visa"></i> <p>Visa Services</p>
</a>
</li>

@ -272,7 +272,8 @@ Route::group(['middleware' => ['auth']], function () {
Route::post('careers/{id}', [CareerController::class, 'update']);
Route::get('careers/{id}', [CareerController::class, 'show']);
Route::get('appointments', [AppointmentController::class, 'index']);
Route::get('appointments/education', [AppointmentController::class, 'education_appointments']);
Route::get('appointments/visa', [AppointmentController::class, 'visa_appointments']);
Route::get('appointments/create', [AppointmentController::class, 'create']);
Route::post('appointments', [AppointmentController::class, 'store']);
Route::get('appointments/{id}/edit', [AppointmentController::class, 'edit']);

Loading…
Cancel
Save