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
23 changed files
with
472 additions
and
67 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
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,52 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Models\Especialidad; | ||
|
||
class EspecialidadController extends Controller | ||
{ | ||
|
||
public function index() | ||
{ | ||
// | ||
$Especialidades = Especialidad::all(); | ||
return view('admin.Especialidades.index',compact('Especialidades')); | ||
} | ||
|
||
|
||
public function create() | ||
{ | ||
// | ||
} | ||
|
||
|
||
public function store(Request $request) | ||
{ | ||
// | ||
} | ||
|
||
|
||
public function show($id) | ||
{ | ||
// | ||
} | ||
|
||
|
||
public function edit($id) | ||
{ | ||
// | ||
} | ||
|
||
public function update(Request $request, $id) | ||
{ | ||
// | ||
} | ||
|
||
|
||
public function destroy($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,17 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Especialidad extends Model | ||
{ | ||
use HasFactory; | ||
protected $table = 'especialidades'; | ||
protected $primaryKey = 'id_especialidad'; | ||
protected $fillable = [ | ||
'nombre_especialidad', | ||
'descripcion_especialidad', | ||
]; | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Usario_has_especialidad extends Model | ||
{ | ||
use HasFactory; | ||
protected $table = 'medicos_has_especialidades'; | ||
|
||
protected $fillable = [ | ||
'id_medico', | ||
'id_especialidad', | ||
]; | ||
public function especialidad() | ||
{ | ||
return $this->hasOne(Especialidad::class,'id_especialidad','id_especialidad'); | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
database/migrations/2022_12_11_051408_create_especialidades.php
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,29 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
|
||
public function up() | ||
{ | ||
Schema::create('especialidades', function (Blueprint $table) { | ||
$table->increments('id_especialidad'); | ||
$table->string('nombre_especialidad')->unique(); | ||
$table->string('descripcion_especialidad'); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('especialidades'); | ||
} | ||
}; |
36 changes: 36 additions & 0 deletions
36
database/migrations/2022_12_11_051725_create_medicos_has_especialidades.php
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,36 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('medicos_has_especialidades', function (Blueprint $table) { | ||
$table->Integer('id_medico')->unsigned()->nullable(); | ||
$table->foreign('id_medico')->references('id')->on('users'); | ||
|
||
|
||
$table->Integer('id_especialidad')->unsigned()->nullable(); | ||
$table->foreign('id_especialidad')->references('id_especialidad')->on('especialidades'); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('medicos_has_especialidades'); | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,25 +1,91 @@ | ||
<x-layouts.app> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script> | ||
<div class="card"> | ||
<div class="card-header">Crear Cita</div> | ||
<div class="card-body"> | ||
|
||
<form action="{{ url('Citas') }}" method="post"> | ||
{!! csrf_field() !!} | ||
<div class="row"> | ||
<div class="col-6"> | ||
<label for="">Especialidad</label> | ||
|
||
<select name="especialidad" class="form-control" id="select1"> | ||
<option value="" selected>Selecione una especialidad</option> | ||
@foreach ($Especialidades as $Especialidad) | ||
<option value="{{$Especialidad->id_especialidad}}"> {{$Especialidad->nombre_especialidad}} </option> | ||
@endforeach | ||
|
||
|
||
</select> | ||
</div> | ||
|
||
<div class="col-6"> | ||
<label for="">Medico</label> | ||
|
||
<select name="id_medico" class="form-control" disabled id="select2"> | ||
@foreach ($Users as $User) | ||
@if ($User->rol == 1) | ||
<option value="" selected>Selecione un Medico</option> | ||
@foreach ($User->persona->has_especialidad as $has) | ||
<option data-name="{{$has->id_especialidad}}" value="{{$User->id}}"> {{$User->persona->nombre_per." ". $User->persona->apellido_pa_per ." ". $User->persona->apellido_ma_per}} </option> | ||
@endforeach | ||
@endif | ||
@endforeach | ||
|
||
|
||
</select> | ||
</div> | ||
</div> | ||
|
||
<label>Fecha</label></br> | ||
<input type="date" name="fecha_cita" id="fecha_cita" class="form-control"></br> | ||
<input type="datetime-local" name="fecha_cita" id="fecha_cita" class="form-control"></br> | ||
@error('fecha_cita') | ||
<small style="color: red">{{$message}}</small> | ||
@enderror | ||
|
||
|
||
<label>Detalles</label></br> | ||
<input value="{{old('detalles_cita')}}" type="text" name="detalles_cita" id="detalles_cita" class="form-control"></br> | ||
@error('detalles_cita') | ||
<small style="color: red">{{$message}}</small> | ||
@enderror | ||
<label>Paciente</label></br> | ||
|
||
|
||
{{-- <label>Paciente</label></br> | ||
<input value="{{old('id_secretarias')}}" type="text" name="id_secretaria" id="id_secretaria" class="form-control"></br> | ||
<input type="submit" value="Save" class="btn btn-success"></br> | ||
@error('detalles_cita') | ||
<small style="color: red">{{$message}}</small> | ||
@enderror --}} | ||
<input type="submit" value="Registrar Cita" class="btn btn-success"></br> | ||
</form> | ||
|
||
</div> | ||
</div> | ||
<script> | ||
$( function() { | ||
$("#select1").change( function() { | ||
if ($(this).val() === "") { | ||
$("#select2").prop("disabled", true); | ||
} else { | ||
$("#select2").prop("disabled", false); | ||
} | ||
}); | ||
}); | ||
$("#select1").change(function () { | ||
if ($(this).data('options') == undefined) { | ||
$(this).data('options', $('#select2 option').clone()); | ||
} | ||
var id = $(this).val(); | ||
if (id == "all") { | ||
var options = $(this).data('options'); | ||
$('#select2').html(options); | ||
} | ||
else { | ||
var options = $(this).data('options').filter('[data-name=' + id + ']'); | ||
$('#select2').html(options); | ||
} | ||
}); | ||
</script> | ||
</x-layouts.app> |
Oops, something went wrong.