This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/rats4final/citas
- Loading branch information
Showing
7 changed files
with
238 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Historial; | ||
use Illuminate\Http\Request; | ||
|
||
class HistorialController extends Controller | ||
{ | ||
|
||
public function index() | ||
{ | ||
// | ||
$Historias = Historial::all(); | ||
return view('admin.Historial.index',compact('Historias')); | ||
} | ||
|
||
public function create() | ||
{ | ||
// | ||
return view('admin.Historial.create'); | ||
} | ||
|
||
public function store(Request $request) | ||
{ | ||
// | ||
$Datos_Historia=request()->except('_token'); | ||
|
||
Historial::create($Datos_Historia); | ||
|
||
return redirect('/Historial'); | ||
} | ||
|
||
|
||
public function show(Historial $Historial) | ||
{ | ||
|
||
// $Historia= Historial::find($Historial); | ||
return View ('admin.Historial.show',compact('Historial')); | ||
|
||
} | ||
|
||
|
||
public function edit($historial) | ||
{ | ||
// | ||
$Historia= Historial::find($historial); | ||
return View ('admin.Historial.edit',compact('Historia')); | ||
} | ||
|
||
|
||
public function update(Request $request, $historial) | ||
{ | ||
// | ||
$input = $request->all(); | ||
|
||
$Historia = Historial::find($historial); | ||
|
||
$Historia->update($input); | ||
|
||
//Redirecionas para no bugear el jalar de datos con reddirect para recargar la vista totalmente | ||
return redirect('/Historial'); | ||
|
||
} | ||
|
||
|
||
public function destroy( $Historial) | ||
{ | ||
// | ||
Historial::destroy($Historial); | ||
|
||
// $Historial->delete(); | ||
|
||
return redirect('/Historial'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Historial extends Model | ||
{ | ||
use HasFactory; | ||
|
||
protected $table = 'historial'; | ||
protected $primaryKey = 'id_historial'; | ||
protected $fillable = ['id_persona','id_sede','id_medico','fecha_historial','detalles_historial']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<x-layouts.app> | ||
|
||
<div class="col-md-9"> | ||
<div class="card"> | ||
<div class="card-header">Registro de Historias</div> | ||
<div class="card-body"> | ||
|
||
<form action="{{ url('Historial') }}" method="post"> | ||
{!! csrf_field() !!} | ||
<label>Persona</label></br> | ||
<input type="text" name="id_persona" id="id_persona" class="form-control"></br> | ||
<label>Sede</label></br> | ||
<input type="text" name="id_sede" id="id_sede" class="form-control"></br> | ||
<label>Medico</label></br> | ||
<input type="text" name="id_medico" id="id_medico" class="form-control"></br> | ||
|
||
<label>Fecha de la historia</label></br> | ||
<input type="date" name="fecha_historial" id="fecha_historial" class="form-control"></br> | ||
|
||
<label>Detalles de la historia</label></br> | ||
<input type="text" name="detalles_historial" id="detalles_historial" class="form-control"></br> | ||
|
||
|
||
{{-- <label>Ciudad Sede</label></br> | ||
<select class="form-select" name="ciudad_sede" id="ciudad_sede" aria-label="Default select example"> | ||
<option selected>Selecione la ciudad</option> | ||
<option value="La Paz">La Paz</option> | ||
<option value="Santa Cruz">Santa cruz</option> | ||
<option value="Cochabamba">Cochabamba</option> | ||
</select> --}} | ||
|
||
<input type="submit" value="Save" class="btn btn-success"></br> | ||
</form> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</x-layouts.app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<x-layouts.app> | ||
|
||
<div class="card"> | ||
<div class="card-header">Editar Sede</div> | ||
<div class="card-body"> | ||
|
||
<form action="{{ url('Historial/' .$Historia->id_historial) }}" method="post"> | ||
{!! csrf_field() !!} | ||
@method("PATCH") | ||
<input type="hidden" name="Id_Sede" id="Id_Sede" value="{{$Historia->id_historial}}" /> | ||
|
||
<label>Persona</label></br> | ||
<input type="text" name="id_persona" id="id_persona" value="{{$Historia->id_persona}}" class="form-control"></br> | ||
<label>Sede</label></br> | ||
<input type="text" name="id_sede" id="id_sede" value="{{$Historia->id_sede}}" class="form-control"></br> | ||
<label>Medico</label></br> | ||
<input type="text" name="id_medico" id="id_medico" value="{{$Historia->id_medico}}" class="form-control"></br> | ||
|
||
<label>Fecha de la historia</label></br> | ||
<input type="date" name="fecha_historial" id="fecha_historial" value="{{$Historia->fecha_historial}}" class="form-control"></br> | ||
|
||
<label>Detalles de la historia</label></br> | ||
<input type="text" name="detalles_historial" id="detalles_historial" value="{{$Historia->detalles_historial}}" class="form-control"></br> | ||
|
||
|
||
|
||
<input type="submit" value="Update" class="btn btn-success"></br> | ||
</form> | ||
|
||
</div> | ||
</div> | ||
</x-layouts.app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<x-layouts.app> | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-9"> | ||
<div class="card"> | ||
<div class="card-header"> | ||
<h2>Historias</h2> | ||
</div> | ||
<div class="card-body"> | ||
<a href="{{ url('/Historial/create') }}" class="btn btn-success btn-sm" title="Add New Student"> | ||
<i class="fa fa-plus" aria-hidden="true"></i> Nueva Historia | ||
</a> | ||
<br/> | ||
<br/> | ||
<div class="table-responsive"> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Persona</th> | ||
<th>Sede</th> | ||
<th>Medico</th> | ||
<th>Fecha del Historial</th> | ||
<th>Detalles de la Historia </th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach ($Historias as $Historia) | ||
<tr> | ||
|
||
<td>{{ $Historia['id_persona'] }}</td> | ||
<td>{{ $Historia['id_sede'] }}</td> | ||
<td>{{ $Historia['id_medico'] }}</td> | ||
<td>{{ $Historia['fecha_historial'] }}</td> | ||
<td>{{ $Historia['detalles_historial'] }}</td> | ||
<td> | ||
<a href="{{ url('/Historial' . '/' . $Historia['id_historial']) }}" title="View Student"><button class="btn btn-info btn-sm"><i class="fa fa-eye" aria-hidden="true"></i> Mostrar</button></a> <a href="{{ url('/Historial' . '/' . $Historia->id_historial . '/edit') }}" title="Edit Student"><button class="btn btn-primary btn-sm"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Editar</button></a> | ||
<form method="POST" action="{{ url('/Historial' . '/' . $Historia->id_historial) }}" accept-charset="UTF-8" style="display:inline"> | ||
{{ method_field('DELETE') }} | ||
{{ csrf_field() }} | ||
<button type="submit" class="btn btn-danger btn-sm" title="Delete Student" onclick="return confirm("Confirm delete?")"><i class="fa fa-trash-o" aria-hidden="true"></i> Borrar</button> | ||
</form> | ||
</td> | ||
</tr> | ||
@endforeach | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</x-layouts.app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<x-layouts.app> | ||
<div class="card"> | ||
<div class="card-header">Datos de la Historia</div> | ||
<div class="card-body"> | ||
|
||
<div class="card-body"> | ||
<h5 class="card-title">Nombre de la Persona: {{ $Historial->id_persona }}</h5> | ||
<p class="card-text">Nombre de la Sede : {{ $Historial->id_sede }}</p> | ||
<p class="card-text">Nombre del Medico : {{ $Historial->id_medico }}</p> | ||
<p class="card-text">Fecha del Historial: {{ $Historial->fecha_historial }}</p> | ||
<p class="card-text">Detalles de la Historia: {{ $Historial->detalles_historial }}</p> | ||
</div> | ||
|
||
</hr> | ||
|
||
</div> | ||
</div> | ||
</x-layouts.app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters