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.
- Loading branch information
Showing
7 changed files
with
174 additions
and
1 deletion.
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,58 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Models\Citas; | ||
use App\Models\User; | ||
|
||
class CitasController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
//$User =User::get(); | ||
$Citas =Citas::with('users')->get(); | ||
|
||
//return $Citas; | ||
return view ('admin.Citas.index',compact('Citas')); | ||
} | ||
|
||
public function create() | ||
{ | ||
$User =User::get(); | ||
return view('admin.Citas.create'); | ||
} | ||
|
||
public function store(Request $request) | ||
{ | ||
$input = $request->all(); | ||
Citas::create($input); | ||
return redirect('Citas')->with('flash_message', 'Citas Addedd!'); | ||
} | ||
|
||
public function show($id) | ||
{ | ||
$Citas =Citas::find($id); | ||
return view('admin.Citas.show')->with('Citas', $Citas); | ||
} | ||
|
||
public function edit($id) | ||
{ | ||
$Citas =Citas::find($id); | ||
return view('admin.Citas.edit')->with('Citas', $Citas); | ||
} | ||
|
||
public function update(Request $request, $id) | ||
{ | ||
$Citas =Citas::find($id); | ||
$input = $request->all(); | ||
$Citas->update($input); | ||
return redirect('Citas')->with('flash_message', 'Citas Updated!'); | ||
} | ||
|
||
public function destroy($id) | ||
{ | ||
Citas::destroy($id); | ||
return redirect('Citas')->with('flash_message', 'Citas deleted!'); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Citas extends Model | ||
{ | ||
use HasFactory; | ||
protected $table = 'citas'; | ||
protected $primaryKey = 'id_cita'; | ||
protected $fillable = ['fecha_cita','detalles_cita','id_secretaria ','id_paciente ']; | ||
|
||
public function users() | ||
{ | ||
return $this->belongsTo(User::class,'id'); | ||
} | ||
} |
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
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,19 @@ | ||
<x-layouts.app> | ||
<div class="card"> | ||
<div class="card-header">Crear Cita</div> | ||
<div class="card-body"> | ||
|
||
<form action="{{ url('Citas') }}" method="post"> | ||
{!! csrf_field() !!} | ||
<label>Fecha</label></br> | ||
<input type="date" name="fecha_cita" id="fecha_cita" class="form-control"></br> | ||
<label>Detalles</label></br> | ||
<input type="text" name="detalles_cita" id="detalles_cita" class="form-control"></br> | ||
<label>Paciente</label></br> | ||
<input type="text" name="id_secretaria" id="id_secretaria" class="form-control"></br> | ||
<input type="submit" value="Save" 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,22 @@ | ||
<x-layouts.app> | ||
<div class="card"> | ||
<div class="card-header">Editar tipo de Patologia</div> | ||
<div class="card-body"> | ||
|
||
<form action="{{ url('Citas/' .$Citas->id_cita) }}" method="post"> | ||
{!! csrf_field() !!} | ||
@method("PATCH") | ||
<input type="hidden" name="id_cita" id="id_cita" value="{{$Citas->id_cita}}" id="id_cita" /> | ||
<label>Fecha</label></br> | ||
<input type="date" name="fecha_cita" id="fecha_cita" value="{{$Citas->fecha_cita}}" class="form-control"></br> | ||
<label>Descripcion</label></br> | ||
<input type="text" name="detalles_cita" id="detalles_cita" value="{{$Citas->detalles_cita}}" class="form-control"></br> | ||
<label>Paciente</label></br> | ||
<input type="text" name="id_secretaria " id="id_secretaria " value="{{$Citas->id_secretaria }}" 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,51 @@ | ||
<x-layouts.app> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-9"> | ||
<div class="card"> | ||
<div class="card-header"> | ||
<h2>Citas</h2> | ||
</div> | ||
<div class="card-body"> | ||
<a href="{{ url('/Citas/create') }}" class="btn btn-success btn-sm" title="Agregar"> | ||
<i class="fa fa-plus" aria-hid_tip_Citasden="true"></i> Add New | ||
</a> | ||
<br/> | ||
<br/> | ||
<div class="table-responsive"> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>#</th> | ||
<th>Fecha</th> | ||
<th>Descripcion</th> | ||
<th>Paciente</th> | ||
<th>Acciones</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach($Citas as $item) | ||
<tr> | ||
<td>{{ $loop->iteration }}</td> | ||
<td>{{ $item->fecha_cita }}</td> | ||
<td>{{ $item->detalles_cita }}</td> | ||
<td>{{ $item->id_secretaria->name}}</td> | ||
<td> | ||
<a href="{{ url('/Citas/' . $item->id_citas . '/edit') }}" title="Edit Citas"><button class="btn btn-primary btn-sm"><i class="fa fa-pencil-square-o" aria-hid_tip_Citasden="true"></i> Edit</button></a> | ||
<form method="POST" action="{{ url('/Citas' . '/' . $item->id_citas) }}" accept-charset="UTF-8" style="display:inline"> | ||
@method('DELETE') | ||
{{ csrf_field() }} | ||
<button type="submit" class="btn btn-danger btn-sm" title="Delete Citas" onclick="return confirm("Confirm delete?")"><i class="fa fa-trash-o" aria-hid_tip_Citasden="true"></i> Delete</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