Skip to content

Commit

Permalink
Feat: Organizar las Citas en TABS
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenU21 committed May 27, 2023
1 parent 2396bcf commit c230fb9
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 57 deletions.
15 changes: 13 additions & 2 deletions app/Http/Controllers/AppointmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,19 @@ class AppointmentController extends Controller

public function index()
{
$appointments = Appointment::all();
return view('appointments.index', compact('appointments'));
$confirmedAppointments = Appointment::all()
->where('status', 'Confirmada')
->where('patient_id', auth()->id());

$pendingAppointments = Appointment::all()
->where('status', 'Reservada')
->where('patient_id', auth()->id());

$oldAppointments = Appointment::all()
->whereIn('status', ['Atendida', 'Cancelada'])
->where('patient_id', auth()->id());

return view('appointments.index', compact('confirmedAppointments', 'pendingAppointments', 'oldAppointments'));
}

public function create(HorarioServiceInterface $horarioServiceInterface)
Expand Down
53 changes: 53 additions & 0 deletions resources/views/appointments/confirmed-appointments.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<div class="table-responsive">
<!-- Projects table -->
<table class="table align-items-center table-flush">
<thead class="thead-light">
<tr>
<th scope="col">Descripción</th>
<th scope="col">Especialidad</th>
<th scope="col">Médico</th>
<th scope="col">Fecha</th>
<th scope="col">Hora</th>
<th scope="col">Tipo</th>
<th scope="col">Estado</th>
<th scope="col">Opciones</th>
</tr>
</thead>
<tbody>

@foreach ($confirmedAppointments as $cita)
<tr>
<th scope="row">
{{ $cita->description }}
</th>
<td>
{{ $cita->specialty->name }}
</td>
<td>
{{ $cita->doctor->name }}
</td>
<td>
{{ $cita->scheduled_date }}
</td>
<td>
{{ $cita->Scheduled_Time_12 }}
</td>
<td>
{{ $cita->type }}
</td>
<td>
{{ $cita->status }}
</td>
<td>
<form action="{{ url('miscitas/' . $cita->id) }}" method="POST">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sn btn-danger" title="Cancelar Cita">Cancelar</button>
</form>
</td>
</tr>
@endforeach

</tbody>
</table>
</div>
90 changes: 35 additions & 55 deletions resources/views/appointments/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,42 @@
{{ session('notification') }}
</div>
@endif
</div>
<div class="table-responsive">
<!-- Projects table -->
<table class="table align-items-center table-flush">
<thead class="thead-light">
<tr>
<th scope="col">Descripción</th>
<th scope="col">Especialidad</th>
<th scope="col">Médico</th>
<th scope="col">Fecha</th>
<th scope="col">Hora</th>
<th scope="col">Tipo</th>
<th scope="col">Estado</th>
<th scope="col">Opciones</th>
</tr>
</thead>
<tbody>

@foreach ($appointments as $cita)
<tr>
<th scope="row">
{{ $cita->description }}
</th>
<td>
{{ $cita->specialty->name }}
</td>
<td>
{{ $cita->doctor->name }}
</td>
<td>
{{ $cita->scheduled_date }}
</td>
<td>
{{ $cita->Scheduled_Time_12 }}
</td>
<td>
{{ $cita->type }}
</td>
<td>
{{ $cita->status }}
</td>
<td>
<form action="{{ url('miscitas/' . $cita->id) }}" method="POST">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sn btn-danger" title="Cancelar Cita">Cancelar</button>
</form>
</td>
</tr>
@endforeach
<div class="nav-wrapper">
<ul class="nav nav-pills nav-fill flex-column flex-md-row" id="tabs-icons-text" role="tablist">
<li class="nav-item">
<a class="nav-link mb-sm-3 mb-md-0 active" data-toggle="tab" href="#mis-citas" role="tab"
aria-selected="true"><i class="ni ni-calendar-grid-58 mr-2"></i>Mis Citas</a>
</li>
<li class="nav-item">
<a class="nav-link mb-sm-3 mb-md-0" data-toggle="tab" href="#citas-pendientes" role="tab"
aria-selected="false"><i class="ni ni-bell-55 mr-2"></i>Citas Pendientes</a>
</li>
<li class="nav-item">
<a class="nav-link mb-sm-3 mb-md-0" data-toggle="tab" href="#historial" role="tab"
aria-selected="false"><i class="ni ni-folder-17 mr-2"></i>Historial</a>
</li>
</ul>
</div>

</tbody>
</table>
</div>
{{-- <div class="card-body">
<div class="card shadow">
<div class="card">
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="mis-citas" role="tabpanel">
@include('appointments.confirmed-appointments')
</div>
<div class="tab-pane fade" id="citas-pendientes" role="tabpanel">
@include('appointments.pending-appointments')
</div>
<div class="tab-pane fade" id="historial" role="tabpanel">
@include('appointments.old-appointments')
</div>
</div>
</div>
</div>

{{-- <div class="card-body">
{{ $patients->links() }}
</div> --}}
</div>
@endsection
</div>
@endsection
53 changes: 53 additions & 0 deletions resources/views/appointments/old-appointments.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<div class="table-responsive">
<!-- Projects table -->
<table class="table align-items-center table-flush">
<thead class="thead-light">
<tr>
<th scope="col">Descripción</th>
<th scope="col">Especialidad</th>
<th scope="col">Médico</th>
<th scope="col">Fecha</th>
<th scope="col">Hora</th>
<th scope="col">Tipo</th>
<th scope="col">Estado</th>
<th scope="col">Opciones</th>
</tr>
</thead>
<tbody>

@foreach ($oldAppointments as $cita)
<tr>
<th scope="row">
{{ $cita->description }}
</th>
<td>
{{ $cita->specialty->name }}
</td>
<td>
{{ $cita->doctor->name }}
</td>
<td>
{{ $cita->scheduled_date }}
</td>
<td>
{{ $cita->Scheduled_Time_12 }}
</td>
<td>
{{ $cita->type }}
</td>
<td>
{{ $cita->status }}
</td>
<td>
<form action="{{ url('miscitas/' . $cita->id) }}" method="POST">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sn btn-danger" title="Cancelar Cita">Cancelar</button>
</form>
</td>
</tr>
@endforeach

</tbody>
</table>
</div>
48 changes: 48 additions & 0 deletions resources/views/appointments/pending-appointments.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<div class="table-responsive">
<!-- Projects table -->
<table class="table align-items-center table-flush">
<thead class="thead-light">
<tr>
<th scope="col">Descripción</th>
<th scope="col">Especialidad</th>
<th scope="col">Médico</th>
<th scope="col">Fecha</th>
<th scope="col">Hora</th>
<th scope="col">Tipo</th>
<th scope="col">Opciones</th>
</tr>
</thead>
<tbody>

@foreach ($pendingAppointments as $cita)
<tr>
<th scope="row">
{{ $cita->description }}
</th>
<td>
{{ $cita->specialty->name }}
</td>
<td>
{{ $cita->doctor->name }}
</td>
<td>
{{ $cita->scheduled_date }}
</td>
<td>
{{ $cita->Scheduled_Time_12 }}
</td>
<td>
{{ $cita->type }}
</td>
<td>
<form action="{{ url('miscitas/' . $cita->id) }}" method="POST">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sn btn-danger" title="Cancelar Cita">Cancelar</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>

0 comments on commit c230fb9

Please sign in to comment.