Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' of https://github.com/rats4final/citas
Browse files Browse the repository at this point in the history
  • Loading branch information
rats4final committed Nov 10, 2022
2 parents cae896f + 556d6ff commit 4bc228d
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 0 deletions.
76 changes: 76 additions & 0 deletions app/Http/Controllers/HistorialController.php
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');
}
}
15 changes: 15 additions & 0 deletions app/Models/Historial.php
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'];
}
39 changes: 39 additions & 0 deletions resources/views/admin/Historial/create.blade.php
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>
32 changes: 32 additions & 0 deletions resources/views/admin/Historial/edit.blade.php
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>
55 changes: 55 additions & 0 deletions resources/views/admin/Historial/index.blade.php
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(&quot;Confirm delete?&quot;)"><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>
18 changes: 18 additions & 0 deletions resources/views/admin/Historial/show.blade.php
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>
3 changes: 3 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Http\Controllers\PatologiaController;
use App\Http\Controllers\PersonaController;

use App\Http\Controllers\HistorialController;
/*
|--------------------------------------------------------------------------
| Web Routes
Expand Down Expand Up @@ -43,3 +44,5 @@
Route::resource('TipoPatologia', TipoPatologiaController::class);
Route::resource('Patologia', PatologiaController::class);
Route::resource('personas', PersonaController::class);
Route::resource('Historial', HistorialController::class);

0 comments on commit 4bc228d

Please sign in to comment.