public function generarTurnos($agenda_id = NULL)
 {
     $errores = true;
     if (empty($agenda_id)) {
         $agendas = Agenda::whereNotIn('id', function ($query) {
             $query->select('agenda_id')->from('turnos');
         })->where('habilitado_turnos', '=', 1)->get();
     } else {
         $agendas = Agenda::where('id', $agenda_id)->get();
     }
     foreach ($agendas as $agenda) {
         $coe = $agenda->centroOdontologoEspecialidad;
         $horario_desde = date('H:i', strtotime(substr_replace($coe->horario_desde, ':', 2, 0)));
         $horario_hasta = date('H:i', strtotime(substr_replace($coe->horario_hasta, ':', 2, 0)));
         $duracion = $coe->duracion_turno;
         $hora = $horario_desde;
         $hora_hasta = date('H:i', strtotime("+" . $duracion . " minutes", strtotime($hora)));
         $turnos = array();
         while (strtotime($hora) < strtotime($horario_hasta)) {
             $turno = array();
             $turno["agenda_id"] = $agenda->id;
             $turno["hora_desde"] = str_replace(":", "", $hora);
             $turno["hora_hasta"] = str_replace(":", "", $hora_hasta);
             $turno["tipo_turno"] = 'T';
             // turno
             $turno["estado"] = 'L';
             // libre
             $turno["created_at"] = date("Y-m-d H:i:s");
             $turno["updated_at"] = date("Y-m-d H:i:s");
             $turnos[] = $turno;
             $hora = $hora_hasta;
             $hora_hasta = date('H:i', strtotime("+" . $duracion . " minutes", strtotime($hora)));
         }
         $e = Turno::insert($turnos);
         if (!$e) {
             $errores = false;
         }
     }
     return $errores;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function show($id)
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $agenda = Agenda::where('doctor_id', $id)->first();
     $CustomDay = CustomDay::where('agenda_id', $agenda->id)->get();
     return View::make('clinic.doctors.customDay')->with('customddays', $CustomDay)->with('agendaID', $agenda->id);
 }
Пример #3
0
 public function update($id)
 {
     $data = array("first_name" => Input::get("first_name"), "last_name" => Input::get("last_name"), "email" => Input::get("email"), "phone" => Input::get("phone"), "picture" => Input::file("picture"), "specialty_id" => Input::get("specialty_id"), "dating_duration" => Input::get("dating_duration"));
     $rules = array("first_name" => 'required|min:1|max:255', "last_name" => 'required|min:1|max:100', "email" => 'required|min:1', "phone" => 'required|min:1|max:100', "specialty_id" => 'required|min:3|max:255', "dating_duration" => 'required|min:1|max:3', "picture" => 'mimes:jpeg,gif,png');
     $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'numeric' => 'El campo :attribute debe contener solo numeros', 'mimes' => 'El formato de la imagen logo debe ser jpg, git, png');
     $validation = Validator::make(Input::all(), $rules, $messages);
     //si la validación falla redirigimos al formulario de registro con los errores
     //y con los campos que nos habia llenado el usuario
     if ($validation->fails()) {
         return Redirect::to('/doctor/profile')->withErrors($validation)->withInput();
     } else {
         $doctor = Doctor::find($id);
         $agenda = Agenda::where('doctor_id', $doctor->id)->first();
         $agenda->dating_duration = Input::get("dating_duration");
         $agenda->save();
         $espes = explode(',', Input::get("specialty_id"));
         $espeuok = '';
         foreach ($espes as $espe) {
             $very = Specialty::where('name_es', $espe)->first();
             if ($very) {
                 $espeuok = $espeuok . ',' . $very->id;
             }
         }
         $doctor->specialty_id = $espeuok;
         $doctor->save();
         $user = User::find($doctor->user_id);
         $user->first_name = $data['first_name'];
         $user->last_name = $data['last_name'];
         $user->save();
         $profile = Profile::where('user_id', $doctor->user_id)->first();
         if (Input::file('picture') != NULL) {
             //agrega imagen de logo
             $file_logo = Input::file('picture');
             $ext = Input::file('picture')->getClientOriginalExtension();
             $nameIMG = date('YmdHis');
             $logo = $nameIMG . '.' . $ext;
             $logo = 'assets/doctor/images/profile_pic/profile_' . $logo;
             $profile->picture = $logo;
         }
         $profile->phone = Input::get("phone");
         $profile->save();
         if ($profile) {
             if (Input::file('picture') != NULL) {
                 $file_logo->move("assets/doctor/images/profile_pic/", $logo);
             }
             return Redirect::to('/doctor/profile')->withFlash_message("Guardado Exitosamente");
         } else {
             return Redirect::to('/doctor/profile')->withErrors("Error")->withInput();
         }
     }
 }
 public function getConfigDay()
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $doctor = Doctor::doctorLogin();
     $agenda = Agenda::where('doctor_id', $doctor)->first()->id;
     $configDay = Configday::where('agenda_id', $agenda)->get();
     if ($configDay->isEmpty()) {
         return View::make('clinic.doctor.config.ConfigDay')->with('agenda', $agenda);
     } else {
         return View::make('clinic.doctor.config.ConfigDay')->with('agenda', $agenda)->with('configDay', $configDay);
     }
 }
 public function getPatientAppointmentsHistory($doctor, $patient)
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $Agenda = Agenda::where('doctor_id', $doctor)->first();
     $Appointment = Appointment::where('patient_id', $patient)->where('agenda_id', $Agenda->id)->get();
     return View::make('clinic.doctors.history')->with('Appointment', $Appointment);
 }
Пример #6
0
																						<th class="text-center">Imagen</th>
																						<th class="text-center">Name</th>
																						<th class="text-center">Email</th>
																						<th class="text-center">Phone</th>
																						<th class="text-center">Status</th>
                                            <th class="text-center">Confirmacion Automatica</th>
																						<th class="text-center">Horarios/Calendario</th>
                                            <th class="text-center">Editar/Eliminar</th>
																				</tr>
																		</thead>
																		<tbody align="center"> 																				
																				@foreach($doctors as $d)
																					<?php 
$doc = User::find($d->user_id);
$profile = Profile::where('user_id', $d->user_id)->first();
$age = Agenda::where('doctor_id', $d->id)->first();
?>
																					<tr class="odd gradeX">	
																						<td><img class="circle profile-table" src="@if($profile->picture!="") {{url($profile->picture)}} @else http://agenda.dev/assets/doctor/images/profile_pic/default.png @endif" alt=""></td>																					
																						<td>{{$doc->getFullName()}}</td>																					
																						<td>{{$doc->email}}</td>																					
																						<td>{{$profile->phone}}</td>																					
																						<td>
																							@if($d->state!=0)
								                              <div class="col-sm-4 iSwitch flat-switch">
																								<div class="switch switch-small">
																									<input type="checkbox" class="checkAjax" data-toggle="tooltip" data-placement="left"  title="Activado" state="{{$d->id}}" checked>
																								</div>																												
																							</div><!-- //col-sm-4 -->
																							@else
												                      <div class="col-sm-4 iSwitch flat-switch">
 public function getAgendaDay()
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $id = Doctor::doctorLogin();
     $agenda = Agenda::where('doctor_id', $id)->first();
     $dt = Carbon::now();
     $bussi = Business::where('agenda_id', $agenda->id)->first()->id;
     if ($dt->dayOfWeek == 0) {
         $dia = 'Sunday';
     } elseif ($dt->dayOfWeek == 1) {
         $dia = 'Monday';
     } elseif ($dt->dayOfWeek == 2) {
         $dia = 'Tuesday';
     } elseif ($dt->dayOfWeek == 3) {
         $dia = 'Wednesday';
     } elseif ($dt->dayOfWeek == 4) {
         $dia = 'Thursday';
     } elseif ($dt->dayOfWeek == 5) {
         $dia = 'Friday';
     } else {
         $dia = 'Saturday';
     }
     $CustomDay = CustomDay::where('agenda_id', $agenda->id)->get();
     $Configday = Configday::where('day', $dia)->where('agenda_id', $agenda->id)->first();
     $AgendaAppo = Appointment::where('agenda_id', $agenda->id)->get();
     return View::make('clinic.doctor.Appointments.AppointmentsDay')->with('agendaAppo', $AgendaAppo)->with('configday', $Configday)->with('customddays', $CustomDay)->with('bussi', $bussi)->with('agenda', $agenda);
 }
 public function existeAgenda($fecha)
 {
     $agenda = Agenda::where('centro_odontologo_especialidad_id', '=', $this->id)->where('fecha', '=', $fecha)->get()->toArray();
     return count($agenda);
 }