aapointment-navigation-for-admin

et#38
Mahesh Sharma 2 years ago
parent 7f836f06c2
commit f2d67186be
  1. 55
      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

@ -13,19 +13,53 @@ 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'); {
$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')) { if (\request('date')) {
$key = \request('date'); $date = \request('date');
$appointments = $appointments->whereDate('date',$key); $appointments = $appointments->whereDate('date', $date);
} }
if (\request('status')) { if (\request('status')) {
$key = \request('status'); $status = \request('status');
$appointments = $appointments->where('status',$key); $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(30); $appointments = $appointments->paginate(20);
return view($this->view.'index',compact('appointments')); $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()
@ -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');
} }
} }

@ -21,7 +21,7 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Appointments</h3> <h3 class="card-title">{{ $service }} Appointments</h3>
<div class="card-tools"> <div class="card-tools">
<a class="btn btn-green" href="{{url('admin/appointments/create')}}" role="button">Create</a> <a class="btn btn-green" href="{{url('admin/appointments/create')}}" role="button">Create</a>
</div> </div>
@ -35,19 +35,29 @@
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<div class="input-group input-group-sm mb-3 table-search w-100"> <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> </div>
<div class="col-md-4"> <div class="col-md-4">
<div class="input-group input-group-sm mb-3 table-search w-100"> <div class="input-group input-group-sm mb-3 table-search w-100">
<select name="status" class="form-control ds-input" onchange="filterList()"> <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) @foreach(config('custom.status') as $in => $val)
<option value="{{$in}}">{{$val}}</option> <option value="{{$in}}" {{($status ==$in) ? 'selected':''}} >{{$val}}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
@ -74,7 +84,7 @@
@if($setting->is_booked) @if($setting->is_booked)
<td class="text-center"><span class="badge booked text-bg-secondary">Booked</span></td> <td class="text-center"><span class="badge booked text-bg-secondary">Booked</span></td>
@else @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 @endif
<td class="d-flex justify-content-center action-icons"> <td class="d-flex justify-content-center action-icons">

@ -129,7 +129,7 @@
</a> </a>
</li> </li>
<li class="nav-item"> <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"> <div class="sidebar-icon w-100" id="myAppointmentBtn">
<i class="fa-regular fa-calendar-check"></i> <i class="fa-regular fa-calendar-check"></i>
<span class="menu-title w-100"> <span class="menu-title w-100">
@ -140,12 +140,12 @@
<div class="collapse" id="myAppointment"> <div class="collapse" id="myAppointment">
<ul class="nav flex-column sub-menu"> <ul class="nav flex-column sub-menu">
<li class="nav-item"> <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> <i class="fa-solid fa-book-open-reader"></i> <p>Education Services</p>
</a> </a>
</li> </li>
<li class="nav-item"> <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> <i class="fa-brands fa-cc-visa"></i> <p>Visa Services</p>
</a> </a>
</li> </li>

@ -272,7 +272,8 @@ Route::group(['middleware' => ['auth']], function () {
Route::post('careers/{id}', [CareerController::class, 'update']); Route::post('careers/{id}', [CareerController::class, 'update']);
Route::get('careers/{id}', [CareerController::class, 'show']); 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::get('appointments/create', [AppointmentController::class, 'create']);
Route::post('appointments', [AppointmentController::class, 'store']); Route::post('appointments', [AppointmentController::class, 'store']);
Route::get('appointments/{id}/edit', [AppointmentController::class, 'edit']); Route::get('appointments/{id}/edit', [AppointmentController::class, 'edit']);

Loading…
Cancel
Save