Skip to content

Commit

Permalink
Feat: Listar Cita Medica para el Admin
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenU21 committed May 27, 2023
1 parent 715f45c commit f148bd9
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 22 deletions.
11 changes: 10 additions & 1 deletion app/Http/Controllers/AppointmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ public function index()
{

$role = auth()->user()->role;
if ($role == 'doctor'){

if ($role == 'admin'){
//Administrador
$confirmedAppointments = Appointment::all()
->where('status', 'Confirmada');
$pendingAppointments = Appointment::all()
->where('status', 'Reservada');
$oldAppointments = Appointment::all()
->whereIn('status', ['Atendida', 'Cancelada']);
}elseif ($role == 'doctor'){
//Medicos
$confirmedAppointments = Appointment::all()
->where('status', 'Confirmada')
Expand Down
3 changes: 3 additions & 0 deletions resources/views/appointments/confirmed-appointments.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
{{ $cita->status }}
</td>
<td>
@if ($role == 'admin')
<a href="{{ url('/miscitas/'.$cita->id)}}" class="btn btn-sn btn-info" title="Ver Cita">Ver</a>
@endif
<a href="{{ url('/miscitas/'.$cita->id.'/cancel')}}" class="btn btn-sn btn-danger" title="Cancelar Cita">Cancelar</a>
</td>
</tr>
Expand Down
23 changes: 15 additions & 8 deletions resources/views/appointments/pending-appointments.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,23 @@
{{ $cita->type }}
</td>
<td>
@if ($role == 'doctor')
<form action="{{ url('miscitas/' . $cita->id. '/confirm' ) }}" method="POST" class="d-inline-block">
@csrf
<button type="submit" class="btn btn-sn btn-success" title="Confirmar Cita">
<i class="ni ni-check-bold"></i>
</button>
</form>
@if ($role == 'admin')
<a href="{{ url('/miscitas/' . $cita->id) }}" class="btn btn-sn btn-info" title="Ver Cita">
<i class="ni far fa-eye"></i>
</a>
@endif
@if ($role == 'doctor' || $role == 'admin')
<form action="{{ url('miscitas/' . $cita->id . '/confirm') }}" method="POST"
class="d-inline-block">
@csrf
<button type="submit" class="btn btn-sn btn-success" title="Confirmar Cita">
<i class="ni ni-check-bold"></i>
</button>
</form>
@endif

<form action="{{ url('miscitas/' . $cita->id. '/cancel' ) }}" method="POST" class="d-inline-block">
<form action="{{ url('miscitas/' . $cita->id . '/cancel') }}" method="POST"
class="d-inline-block">
@csrf
<button type="submit" class="btn btn-sn btn-danger" title="Cancelar Cita">
<i class="ni ni-fat-delete"></i>
Expand Down
34 changes: 23 additions & 11 deletions resources/views/appointments/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,28 @@
</li>
<li class="list-group-item">
<i class="fas fa-clock"></i>
<strong>Hora de Atención:</strong> {{ $appointments->scheduled_time }}
<strong>Hora de Atención:</strong> {{ $appointments->scheduled_time_12 }}
</li>
@if ($role == 'paciente')
<li class="list-group-item">
<i class="fas fa-user-md"></i>
<strong>Doctor:</strong> {{ $appointments->doctor->name }}
</li>
@elseif ($role == 'doctor')
<li class="list-group-item">
<i class="fas fa-user"></i>
<strong>Paciente:</strong> {{ $appointments->patient->name }}
</li>
@endif
<li class="list-group-item">
<i class="fas fa-user-md"></i>
<strong>Doctor:</strong> {{ $appointments->doctor->name }}
</li>
@elseif ($role == 'doctor')
<li class="list-group-item">
<i class="fas fa-user"></i>
<strong>Paciente:</strong> {{ $appointments->patient->name }}
</li>
@elseif ($role == 'admin')
<li class="list-group-item">
<i class="fas fa-user-md"></i>
<strong>Doctor:</strong> {{ $appointments->doctor->name }}
</li>
<li class="list-group-item">
<i class="fas fa-user"></i>
<strong>Paciente:</strong> {{ $appointments->patient->name }}
</li>
@endif

<li class="list-group-item">
<i class="fas fa-stethoscope"></i>
Expand All @@ -59,6 +68,8 @@
<strong>Síntomas:</strong> {{ $appointments->description }}
</li>
</ul>

@if ($appointments->status == 'Cancelada')
<div class="alert bg-light text-dark mt-4">
<h3 class="text-primary"><i class="fas fa-exclamation-circle"></i> Detalles de la Cancelación</h3>
@if ($appointments->cancellation)
Expand All @@ -83,6 +94,7 @@
</ul>
@endif
</div>
@endif
</div>
</div>
@endsection
5 changes: 5 additions & 0 deletions resources/views/includes/panel/menu.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
<i class="fas fa-bed text-warning"></i> Pacientes
</a>
</li>
<li class="nav-item">
<a class="nav-link " href="/miscitas">
<i class="fas fa-clock text-info"></i> Citas Médicas
</a>
</li>
@elseif (auth()->user()->role == 'doctor')
<li class="nav-item">
<a class="nav-link " href="/horario">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/patients/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
a@extends('layouts.panel')
@extends('layouts.panel')

@section('content')
<div class="card shadow">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/specialties/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
a@extends('layouts.panel')
@extends('layouts.panel')

@section('content')
<div class="card shadow">
Expand Down

0 comments on commit f148bd9

Please sign in to comment.