|
|
|
@ -39,7 +39,6 @@ class ApiPersonaController extends Controller |
|
|
|
if ($request->has('telefono')) { |
|
|
|
if ($request->has('telefono')) { |
|
|
|
|
|
|
|
|
|
|
|
$persona = UaderMapuchePersona::BuscarPersonaPorTelefono($request->get('telefono')); |
|
|
|
$persona = UaderMapuchePersona::BuscarPersonaPorTelefono($request->get('telefono')); |
|
|
|
|
|
|
|
|
|
|
|
if ($persona) { |
|
|
|
if ($persona) { |
|
|
|
return ApiPersonaController::extraerDatosJson($persona); |
|
|
|
return ApiPersonaController::extraerDatosJson($persona); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -376,8 +375,8 @@ class ApiPersonaController extends Controller |
|
|
|
return response()->json(['error' => trans('persona.DECLARACION_JURADA_NO_ENCONTRADA')], HttpStatus::NOT_FOUND); |
|
|
|
return response()->json(['error' => trans('persona.DECLARACION_JURADA_NO_ENCONTRADA')], HttpStatus::NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$designaciones = $declaracion_jurada->CargosGrupo()->where('estado', 'A')->get(); |
|
|
|
$cargos = $declaracion_jurada->CargosGrupo()->where('estado', 'A')->get(); |
|
|
|
if(empty($designaciones)){ |
|
|
|
if(empty($cargos)){ |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES')], HttpStatus::NOT_FOUND); |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES')], HttpStatus::NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -385,17 +384,17 @@ class ApiPersonaController extends Controller |
|
|
|
$aux_horario = null; |
|
|
|
$aux_horario = null; |
|
|
|
$unidadAcademica = null; |
|
|
|
$unidadAcademica = null; |
|
|
|
|
|
|
|
|
|
|
|
foreach ($designaciones as $designacion) { |
|
|
|
foreach ($cargos as $cargo) { |
|
|
|
|
|
|
|
|
|
|
|
if($unidadAcademica == null){ |
|
|
|
if($unidadAcademica == null){ |
|
|
|
$unidadAcademica = $designacion->Sede->ua_guarani; |
|
|
|
$unidadAcademica = $cargo->Sede->ua_guarani; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($designacion->id_funcion == $funcion && $designacion->Sede->uacad == $sede){ |
|
|
|
if($cargo->id_funcion == $funcion && $cargo->Sede->uacad == $sede){ |
|
|
|
|
|
|
|
|
|
|
|
# Si vino |
|
|
|
# Si vino |
|
|
|
|
|
|
|
|
|
|
|
foreach ($designacion->GrupoHorario as $grupo_horario) { |
|
|
|
foreach ($cargo->GrupoHorario as $grupo_horario) { |
|
|
|
|
|
|
|
|
|
|
|
foreach ($grupo_horario->Horarios as $horario) { |
|
|
|
foreach ($grupo_horario->Horarios as $horario) { |
|
|
|
|
|
|
|
|
|
|
|
@ -459,8 +458,8 @@ class ApiPersonaController extends Controller |
|
|
|
return response()->json(['error' => trans('persona.DECLARACION_JURADA_NO_ENCONTRADA')], HttpStatus::NOT_FOUND); |
|
|
|
return response()->json(['error' => trans('persona.DECLARACION_JURADA_NO_ENCONTRADA')], HttpStatus::NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$designaciones = $declaracion_jurada->CargosGrupo()->where('estado', 'A')->get(); |
|
|
|
$cargos = $declaracion_jurada->CargosGrupo()->where('estado', 'A')->get(); |
|
|
|
if(empty($designaciones)){ |
|
|
|
if(empty($cargos)){ |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES')], HttpStatus::NOT_FOUND); |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES')], HttpStatus::NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -468,17 +467,17 @@ class ApiPersonaController extends Controller |
|
|
|
$aux_horario = null; |
|
|
|
$aux_horario = null; |
|
|
|
$sede = null; |
|
|
|
$sede = null; |
|
|
|
|
|
|
|
|
|
|
|
foreach ($designaciones as $designacion) { |
|
|
|
foreach ($cargos as $cargo) { |
|
|
|
|
|
|
|
|
|
|
|
if($sede == null){ |
|
|
|
if($sede == null){ |
|
|
|
$sede = $designacion->Sede->uacad; |
|
|
|
$sede = $cargo->Sede->uacad; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if($designacion->id_funcion == $funcion && $designacion->Sede->ua_guarani == $unidadAcademica){ |
|
|
|
if($cargo->id_funcion == $funcion && $cargo->Sede->ua_guarani == $unidadAcademica){ |
|
|
|
|
|
|
|
|
|
|
|
# Si vino |
|
|
|
# Si vino |
|
|
|
|
|
|
|
|
|
|
|
foreach ($designacion->GrupoHorario as $grupo_horario) { |
|
|
|
foreach ($cargo->GrupoHorario as $grupo_horario) { |
|
|
|
|
|
|
|
|
|
|
|
foreach ($grupo_horario->Horarios as $horario) { |
|
|
|
foreach ($grupo_horario->Horarios as $horario) { |
|
|
|
|
|
|
|
|
|
|
|
@ -602,37 +601,37 @@ class ApiPersonaController extends Controller |
|
|
|
return response()->json(['error' => trans('persona.DECLARACION_JURADA_NO_ENCONTRADA')], HttpStatus::NOT_FOUND); |
|
|
|
return response()->json(['error' => trans('persona.DECLARACION_JURADA_NO_ENCONTRADA')], HttpStatus::NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$designaciones = $declaracion_jurada->CargosGrupo()->where('estado', 'A')->get(); |
|
|
|
$cargos = $declaracion_jurada->CargosGrupo()->where('estado', 'A')->get(); |
|
|
|
if(empty($designaciones)){ |
|
|
|
if(empty($cargos)){ |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES')], HttpStatus::NOT_FOUND); |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES')], HttpStatus::NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$designacionesUnidadAcademica = array(); |
|
|
|
$cargosUnidadAcademica = array(); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($designaciones as $designacion) { |
|
|
|
foreach ($cargos as $cargo) { |
|
|
|
|
|
|
|
|
|
|
|
if($designacion->Sede->ua_guarani == $unidadAcademica){ |
|
|
|
if($cargo->Sede->ua_guarani == $unidadAcademica){ |
|
|
|
|
|
|
|
|
|
|
|
$designacionesUnidadAcademica[] = $designacion; |
|
|
|
$cargosUnidadAcademica[] = $cargo; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(empty($designacionesUnidadAcademica)){ |
|
|
|
if(empty($cargosUnidadAcademica)){ |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES_UA')], HttpStatus::NOT_FOUND); |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES_UA')], HttpStatus::NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$funciones = array(); |
|
|
|
$funciones = array(); |
|
|
|
$funcion = null; |
|
|
|
$funcion = null; |
|
|
|
|
|
|
|
|
|
|
|
foreach ($designacionesUnidadAcademica as $designacionUA) { |
|
|
|
foreach ($cargosUnidadAcademica as $cargoUnidadAcademica) { |
|
|
|
|
|
|
|
|
|
|
|
$funcion = [ |
|
|
|
$funcion = [ |
|
|
|
'tipo' => $designacionUA->id_funcion, |
|
|
|
'tipo' => $cargoUnidadAcademica->id_funcion, |
|
|
|
'unidad_academica' => $unidadAcademica, |
|
|
|
'unidad_academica' => $unidadAcademica, |
|
|
|
'sede' => $designacionUA->Sede->uacad |
|
|
|
'sede' => $cargoUnidadAcademica->Sede->uacad |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
if(!in_array($funcion, $funciones)){ # para que no se repitan las funciones por tarea o designacion |
|
|
|
if(!in_array($funcion, $funciones)){ # para que no se repitan las funciones por cargo |
|
|
|
$funciones[] = $funcion; |
|
|
|
$funciones[] = $funcion; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -661,37 +660,37 @@ class ApiPersonaController extends Controller |
|
|
|
return response()->json(['error' => trans('persona.DECLARACION_JURADA_NO_ENCONTRADA')], HttpStatus::NOT_FOUND); |
|
|
|
return response()->json(['error' => trans('persona.DECLARACION_JURADA_NO_ENCONTRADA')], HttpStatus::NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$designaciones = $declaracion_jurada->CargosGrupo()->where('estado', 'A')->get(); |
|
|
|
$cargos = $declaracion_jurada->CargosGrupo()->where('estado', 'A')->get(); |
|
|
|
if(empty($designaciones)){ |
|
|
|
if(empty($cargos)){ |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES')], HttpStatus::NOT_FOUND); |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES')], HttpStatus::NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$designacionesSede = array(); |
|
|
|
$cargosSedes = array(); |
|
|
|
$unidadAcademica = null; |
|
|
|
$unidadAcademica = null; |
|
|
|
|
|
|
|
|
|
|
|
foreach ($designaciones as $designacion) { |
|
|
|
foreach ($cargos as $cargo) { |
|
|
|
|
|
|
|
|
|
|
|
if($designacion->Sede->uacad == $sede){ |
|
|
|
if($cargo->Sede->uacad == $sede){ |
|
|
|
|
|
|
|
|
|
|
|
$designacionesSede[] = $designacion; |
|
|
|
$cargosSedes[] = $cargo; |
|
|
|
|
|
|
|
|
|
|
|
if($unidadAcademica == null){ |
|
|
|
if($unidadAcademica == null){ |
|
|
|
$unidadAcademica = $designacion->Sede->ua_guarani; |
|
|
|
$unidadAcademica = $cargo->Sede->ua_guarani; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(empty($designacionesSede)){ |
|
|
|
if(empty($cargosSedes)){ |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES_SEDE')], HttpStatus::NOT_FOUND); |
|
|
|
return response()->json(['error' => trans('persona.NO_TIENE_DESIGNACIONES_SEDE')], HttpStatus::NOT_FOUND); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$funciones = array(); |
|
|
|
$funciones = array(); |
|
|
|
$funcion = null; |
|
|
|
$funcion = null; |
|
|
|
|
|
|
|
|
|
|
|
foreach ($designacionesSede as $designacionSede) { |
|
|
|
foreach ($cargosSedes as $cargoSede) { |
|
|
|
|
|
|
|
|
|
|
|
$funcion = [ |
|
|
|
$funcion = [ |
|
|
|
'tipo' => $designacionSede->id_funcion, |
|
|
|
'tipo' => $cargoSede->id_funcion, |
|
|
|
'unidad_academica' => $unidadAcademica, |
|
|
|
'unidad_academica' => $unidadAcademica, |
|
|
|
'sede' => $sede |
|
|
|
'sede' => $sede |
|
|
|
]; |
|
|
|
]; |
|
|
|
@ -710,7 +709,17 @@ class ApiPersonaController extends Controller |
|
|
|
return response()->json($datos, HttpStatus::OK); |
|
|
|
return response()->json($datos, HttpStatus::OK); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# FUNCION STANDALONE: |
|
|
|
# FUNCIONES STANDALONE: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Compara dos horarios por su hora de entrada. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* Utilizada para ordenar un arreglo de horarios. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param array $a El primer horario a comparar. |
|
|
|
|
|
|
|
* @param array $b El segundo horario a comparar. |
|
|
|
|
|
|
|
* @return int Un valor negativo si $a es menor que $b, cero si son iguales, o un valor positivo si $a es mayor que $b. |
|
|
|
|
|
|
|
*/ |
|
|
|
public static function compararHorarios($a, $b) { |
|
|
|
public static function compararHorarios($a, $b) { |
|
|
|
return strcmp($a['hora_entra'], $b['hora_entra']); |
|
|
|
return strcmp($a['hora_entra'], $b['hora_entra']); |
|
|
|
} |
|
|
|
} |
|
|
|
|