Endpoint lista de PM por usuario

This commit is contained in:
Christian Dacid Sullca Puma 2022-10-20 02:34:46 -05:00
parent 1d342997ca
commit 356126a4aa
4 changed files with 817 additions and 877 deletions

View File

@ -6,9 +6,12 @@
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Estandar; use App\Models\Estandar;
use App\Models\Narrativa; use App\Models\Narrativa;
//edita solo contenido //edita solo contenido
//eliminar //eliminar
// Cabecera endopoint unico // Cabecera endopoint unico
class NarrativasController extends Controller class NarrativasController extends Controller
{ {

View File

@ -17,218 +17,227 @@
use App\Models\Responsables; use App\Models\Responsables;
class PlanController extends Controller{ class PlanController extends Controller
public function update(Request $request,$id){ {
public function update(Request $request, $id)
{
$id_user = auth()->user()->id; $id_user = auth()->user()->id;
if(plan::where(["id_user"=>$id_user,"id"=>$id])->exists()){ if (plan::where(["id_user" => $id_user, "id" => $id])->exists()) {
//Actualizamos los atributos propios //Actualizamos los atributos propios
$plan = plan::find($id); $plan = plan::find($id);
$plan -> update([ $plan->update([
//"codigo" => $request->codigo, //"codigo" => $request->codigo,
"nombre" => $request->nombre, "nombre" => $request->nombre,
"oportunidad_plan" => $request->oportunidad_plan, "oportunidad_plan" => $request->oportunidad_plan,
"semestre_ejecucion" => $request->semestre_ejecucion, "semestre_ejecucion" => $request->semestre_ejecucion,
"duracion" => $request->duracion, "duracion" => $request->duracion,
"estado" => $request->estado, "estado" => $request->estado,
"evaluacion_eficacia" => $request->evaluacion_eficacia, "evaluacion_eficacia" => $request->evaluacion_eficacia,
"avance" => $request->avance, "avance" => $request->avance,
]); ]);
//Actualizar estandar //Actualizar estandar
/*$estandar = Estandar::find($request->id_estandar); /*$estandar = Estandar::find($request->id_estandar);
if(isset($estandar)){ if(isset($estandar)){
$plan->estandars()->associate($estandar); $plan->estandars()->associate($estandar);
}*/ }*/
/*-------------------------------Fuentes------------------------------*/ /*-------------------------------Fuentes------------------------------*/
$fuentes = $request->fuentes; $fuentes = $request->fuentes;
//Eliminar fuentes que no esten en el Request //Eliminar fuentes que no esten en el Request
$existingsIds = collect($fuentes)->pluck('id')->filter(); $existingsIds = collect($fuentes)->pluck('id')->filter();
$plan->fuentes()->whereNotIn('id', $existingsIds)->delete(); $plan->fuentes()->whereNotIn('id', $existingsIds)->delete();
//Actualizar fuentes de estandar //Actualizar fuentes de estandar
if(isset($fuentes)){ if (isset($fuentes)) {
foreach($fuentes as $fuente){ foreach ($fuentes as $fuente) {
$plan->fuentes()->updateOrCreate( $plan->fuentes()->updateOrCreate(
[ [
"id" => $fuente['id'] "id" => $fuente['id']
], ],
[ [
"descripcion" => $fuente['value'], "descripcion" => $fuente['value'],
"id_plan"=> $plan->id "id_plan" => $plan->id
]); ]
} );
} }
/*----------------------------Problemas-------------------------------*/ }
$problemas = $request->problemas; /*----------------------------Problemas-------------------------------*/
//Eliminar problemas que no esten en el Request $problemas = $request->problemas;
$existingsIds = collect($problemas)->pluck('id')->filter(); //Eliminar problemas que no esten en el Request
$plan->problemasOportunidade()->whereNotIn('id', $existingsIds)->delete(); $existingsIds = collect($problemas)->pluck('id')->filter();
//Actualizar problemas de estandar $plan->problemasOportunidade()->whereNotIn('id', $existingsIds)->delete();
if(isset($problemas)){ //Actualizar problemas de estandar
foreach($problemas as $problema){ if (isset($problemas)) {
$plan->problemasOportunidade()->updateOrCreate( foreach ($problemas as $problema) {
[ $plan->problemasOportunidade()->updateOrCreate(
"id" => $problema['id'] [
], "id" => $problema['id']
[ ],
"descripcion" => $problema['value'], [
"id_plan"=> $plan->id "descripcion" => $problema['value'],
]); "id_plan" => $plan->id
} ]
} );
/*--------------------------------Causas-------------------------------*/ }
$causas = $request->causas_raices; }
//Eliminar causas que no esten en el Request /*--------------------------------Causas-------------------------------*/
$existingsIds = collect($causas)->pluck('id')->filter(); $causas = $request->causas_raices;
$plan->causasRaices()->whereNotIn('id', $existingsIds)->delete(); //Eliminar causas que no esten en el Request
//Actualizar causas de estandar $existingsIds = collect($causas)->pluck('id')->filter();
if(isset($causas)){ $plan->causasRaices()->whereNotIn('id', $existingsIds)->delete();
foreach($causas as $causa){ //Actualizar causas de estandar
$plan->causasRaices()->updateOrCreate( if (isset($causas)) {
[ foreach ($causas as $causa) {
"id" => $causa['id'] $plan->causasRaices()->updateOrCreate(
], [
[ "id" => $causa['id']
"descripcion" => $causa['value'], ],
"id_plan"=> $plan->id [
]); "descripcion" => $causa['value'],
} "id_plan" => $plan->id
} ]
/*------------------------------Acciones-------------------------------*/ );
$acciones = $request->acciones; }
//Eliminar acciones que no esten en el Request }
$existingsIds = collect($acciones)->pluck('id')->filter(); /*------------------------------Acciones-------------------------------*/
$plan->accionesMejoras()->whereNotIn('id', $existingsIds)->delete(); $acciones = $request->acciones;
//Actualizar acciones de estandar //Eliminar acciones que no esten en el Request
if(isset($acciones)){ $existingsIds = collect($acciones)->pluck('id')->filter();
foreach($acciones as $accion){ $plan->accionesMejoras()->whereNotIn('id', $existingsIds)->delete();
$plan->accionesMejoras()->updateOrCreate( //Actualizar acciones de estandar
[ if (isset($acciones)) {
"id" => $accion['id'] foreach ($acciones as $accion) {
], $plan->accionesMejoras()->updateOrCreate(
[ [
"descripcion" => $accion['value'], "id" => $accion['id']
"id_plan"=> $plan->id ],
]); [
} "descripcion" => $accion['value'],
} "id_plan" => $plan->id
/*------------------------------Recursos-------------------------------*/ ]
$recursos = $request->recursos; );
//Eliminar recursos que no esten en el Request }
$existingsIds = collect($recursos)->pluck('id')->filter(); }
$plan->recursos()->whereNotIn('id', $existingsIds)->delete(); /*------------------------------Recursos-------------------------------*/
//Actualizar recursos de estandar $recursos = $request->recursos;
if(isset($recursos)){ //Eliminar recursos que no esten en el Request
foreach($recursos as $recurso){ $existingsIds = collect($recursos)->pluck('id')->filter();
$plan->recursos()->updateOrCreate( $plan->recursos()->whereNotIn('id', $existingsIds)->delete();
[ //Actualizar recursos de estandar
"id" => $recurso['id'] if (isset($recursos)) {
], foreach ($recursos as $recurso) {
[ $plan->recursos()->updateOrCreate(
"descripcion" => $recurso['value'], [
"id_plan"=> $plan->id "id" => $recurso['id']
]); ],
} [
} "descripcion" => $recurso['value'],
/*--------------------------------Metas-------------------------------*/ "id_plan" => $plan->id
$metas = $request->metas; ]
//Eliminar metas que no esten en el Request );
$existingsIds = collect($metas)->pluck('id')->filter(); }
$plan->metas()->whereNotIn('id', $existingsIds)->delete(); }
//Actualizar metas de estandar /*--------------------------------Metas-------------------------------*/
if(isset($metas)){ $metas = $request->metas;
foreach($metas as $meta){ //Eliminar metas que no esten en el Request
$plan->metas()->updateOrCreate( $existingsIds = collect($metas)->pluck('id')->filter();
[ $plan->metas()->whereNotIn('id', $existingsIds)->delete();
"id" => $meta['id'] //Actualizar metas de estandar
], if (isset($metas)) {
[ foreach ($metas as $meta) {
"descripcion" => $meta['value'], $plan->metas()->updateOrCreate(
"id_plan"=> $plan->id [
]); "id" => $meta['id']
} ],
} [
/*---------------------------Responsables-------------------------------*/ "descripcion" => $meta['value'],
$responsables = $request->responsables; "id_plan" => $plan->id
//Eliminar responsables que no esten en el Request ]
$existingsIds = collect($responsables)->pluck('id')->filter(); );
$plan->responsables()->whereNotIn('id', $existingsIds)->delete(); }
//Actualizar responsables de estandar }
if(isset($responsables)){ /*---------------------------Responsables-------------------------------*/
foreach($responsables as $responsable){ $responsables = $request->responsables;
$plan->responsables()->updateOrCreate( //Eliminar responsables que no esten en el Request
[ $existingsIds = collect($responsables)->pluck('id')->filter();
"id" => $responsable['id'] $plan->responsables()->whereNotIn('id', $existingsIds)->delete();
], //Actualizar responsables de estandar
[ if (isset($responsables)) {
"nombre" => $responsable['value'], foreach ($responsables as $responsable) {
"id_plan"=> $plan->id $plan->responsables()->updateOrCreate(
]); [
} "id" => $responsable['id']
} ],
/*--------------------------Observaciones-------------------------------*/ [
$observaciones = $request->observaciones; "nombre" => $responsable['value'],
//Eliminar observaciones que no esten en el Request "id_plan" => $plan->id
$existingsIds = collect($observaciones)->pluck('id')->filter(); ]
$plan->observaciones()->whereNotIn('id', $existingsIds)->delete(); );
//Actualizar observaciones de estandar }
if(isset($observaciones)){ }
foreach($observaciones as $observacion){ /*--------------------------Observaciones-------------------------------*/
$plan->observaciones()->updateOrCreate( $observaciones = $request->observaciones;
[ //Eliminar observaciones que no esten en el Request
"id" => $observacion['id'] $existingsIds = collect($observaciones)->pluck('id')->filter();
], $plan->observaciones()->whereNotIn('id', $existingsIds)->delete();
[ //Actualizar observaciones de estandar
"descripcion" => $observacion['value'], if (isset($observaciones)) {
"id_plan"=> $plan->id foreach ($observaciones as $observacion) {
]); $plan->observaciones()->updateOrCreate(
} [
} "id" => $observacion['id']
return response()->json($plan, 200); ],
} [
else{ "descripcion" => $observacion['value'],
"id_plan" => $plan->id
]
);
}
}
return response()->json($plan, 200);
} else {
return response([ return response([
"status" => 0, "status" => 0,
"message" => "!No se encontro el plan o no esta autorizado", "message" => "!No se encontro el plan o no esta autorizado",
],404); ], 404);
} }
}
} // Arreglar el formato de IDs
public function createPlan(Request $request)
// Arreglar el formato de IDs {
public function createPlan(Request $request){
$request->validate([ $request->validate([
"id_estandar"=> "required|integer", "id_estandar" => "required|integer",
"nombre"=>"present|max:255", "nombre" => "present|max:255",
/* "codigo"=> "required|unique_with:plans,id_estandar|max:11", */ /* "codigo"=> "required|unique_with:plans,id_estandar|max:11", */
'codigo' => [ 'codigo' => [
'required', 'required',
Rule::unique('plans', 'codigo')->where(function ($query) use ($request) { Rule::unique('plans', 'codigo')->where(function ($query) use ($request) {
return $query->where('id_estandar', $request->id_estandar); return $query->where('id_estandar', $request->id_estandar);
}), }),
], ],
"fuentes"=>"present", "fuentes" => "present",
"fuentes.*.value"=> "required", "fuentes.*.value" => "required",
"problemas_oportunidades"=>"present", "problemas_oportunidades" => "present",
"problemas_oportunidades.*.value"=> "required", "problemas_oportunidades.*.value" => "required",
"causas_raices"=>"present", "causas_raices" => "present",
"causas_raices.*.value"=> "required", "causas_raices.*.value" => "required",
"oportunidad_plan"=>"present|max:255", "oportunidad_plan" => "present|max:255",
"acciones_mejoras"=>"present", "acciones_mejoras" => "present",
"acciones_mejoras.*.value"=> "required", "acciones_mejoras.*.value" => "required",
"semestre_ejecucion"=>"present|max:8", //aaaa-A/B/C/AB "semestre_ejecucion" => "present|max:8", //aaaa-A/B/C/AB
"duracion"=> "present|integer", "duracion" => "present|integer",
"recursos"=>"present", "recursos" => "present",
"recursos.*.value"=> "required", "recursos.*.value" => "required",
"metas"=>"present", "metas" => "present",
"metas.*.value"=> "required", "metas.*.value" => "required",
"responsables"=>"present", "responsables" => "present",
"responsables.*.value"=> "required", "responsables.*.value" => "required",
"observaciones"=>"present", "observaciones" => "present",
"observaciones.*.value"=> "required", "observaciones.*.value" => "required",
"estado"=> "present|max:30", "estado" => "present|max:30",
"evaluacion_eficacia"=> "present|boolean", "evaluacion_eficacia" => "present|boolean",
"avance"=> "present|integer" "avance" => "present|integer"
]); ]);
$id_user = auth()->user()->id; $id_user = auth()->user()->id;
@ -250,60 +259,60 @@ public function createPlan(Request $request){
$id_plan = $plan->id; $id_plan = $plan->id;
foreach($request->fuentes as $fuente){ foreach ($request->fuentes as $fuente) {
$fuente_aux = new Fuentes(); $fuente_aux = new Fuentes();
$fuente_aux->descripcion = $fuente["value"]; $fuente_aux->descripcion = $fuente["value"];
$fuente_aux->id_plan = $id_plan; $fuente_aux->id_plan = $id_plan;
$fuente_aux->save(); $fuente_aux->save();
} }
foreach($request->problemas_oportunidades as $problema){ foreach ($request->problemas_oportunidades as $problema) {
$problema_oportunidad_aux = new ProblemasOportunidades(); $problema_oportunidad_aux = new ProblemasOportunidades();
$problema_oportunidad_aux->descripcion = $problema["value"]; $problema_oportunidad_aux->descripcion = $problema["value"];
$problema_oportunidad_aux->id_plan = $id_plan; $problema_oportunidad_aux->id_plan = $id_plan;
$problema_oportunidad_aux->save(); $problema_oportunidad_aux->save();
} }
foreach($request->causas_raices as $causa){ foreach ($request->causas_raices as $causa) {
$causa_raiz_aux = new CausasRaices(); $causa_raiz_aux = new CausasRaices();
$causa_raiz_aux->descripcion = $causa["value"]; $causa_raiz_aux->descripcion = $causa["value"];
$causa_raiz_aux->id_plan = $id_plan; $causa_raiz_aux->id_plan = $id_plan;
$causa_raiz_aux->save(); $causa_raiz_aux->save();
} }
foreach($request->acciones_mejoras as $accion){ foreach ($request->acciones_mejoras as $accion) {
$accion_mejora_aux = new AccionesMejoras(); $accion_mejora_aux = new AccionesMejoras();
$accion_mejora_aux->descripcion = $accion["value"]; $accion_mejora_aux->descripcion = $accion["value"];
$accion_mejora_aux->id_plan = $id_plan; $accion_mejora_aux->id_plan = $id_plan;
$accion_mejora_aux->save(); $accion_mejora_aux->save();
} }
foreach($request->recursos as $recurso){ foreach ($request->recursos as $recurso) {
$recurso_aux = new Recursos(); $recurso_aux = new Recursos();
$recurso_aux->descripcion = $recurso["value"]; $recurso_aux->descripcion = $recurso["value"];
$recurso_aux->id_plan = $id_plan; $recurso_aux->id_plan = $id_plan;
$recurso_aux->save(); $recurso_aux->save();
} }
foreach($request->metas as $meta){ foreach ($request->metas as $meta) {
$meta_aux = new Metas(); $meta_aux = new Metas();
$meta_aux->descripcion = $meta["value"]; $meta_aux->descripcion = $meta["value"];
$meta_aux->id_plan = $id_plan; $meta_aux->id_plan = $id_plan;
$meta_aux->save(); $meta_aux->save();
} }
foreach($request->observaciones as $observacion){ foreach ($request->observaciones as $observacion) {
$observacion_aux = new Observaciones(); $observacion_aux = new Observaciones();
$observacion_aux->descripcion = $observacion["value"]; $observacion_aux->descripcion = $observacion["value"];
$observacion_aux->id_plan = $id_plan; $observacion_aux->id_plan = $id_plan;
$observacion_aux->save(); $observacion_aux->save();
} }
foreach($request->responsables as $responsable){ foreach ($request->responsables as $responsable) {
$responsable_aux = new Responsables(); $responsable_aux = new Responsables();
$responsable_aux ->nombre = $responsable["value"]; $responsable_aux->nombre = $responsable["value"];
$responsable_aux ->id_plan = $id_plan; $responsable_aux->id_plan = $id_plan;
$responsable_aux ->save(); $responsable_aux->save();
} }
@ -314,17 +323,18 @@ public function createPlan(Request $request){
} }
public function listPlan(){ public function listPlan()
{
$id_user = auth()->user()->id; $id_user = auth()->user()->id;
$planAll = plan::select('plans.id','plans.nombre', 'plans.codigo','plans.avance','plans.estado','plans.id_user','estandars.name as estandar_name','users.name as user_name') $planAll = plan::select('plans.id', 'plans.nombre', 'plans.codigo', 'plans.avance', 'plans.estado', 'plans.id_user', 'estandars.name as estandar_name', 'users.name as user_name')
->join('estandars', 'plans.id_estandar', '=', 'estandars.id') ->join('estandars', 'plans.id_estandar', '=', 'estandars.id')
->join('users', 'plans.id_user', '=', 'users.id') ->join('users', 'plans.id_user', '=', 'users.id')
->orderBy('plans.id','asc') ->orderBy('plans.id', 'asc')
->get(); ->get();
foreach($planAll as $plan){ foreach ($planAll as $plan) {
$plan->esCreador = ($plan->id_user == $id_user)?true:false; $plan->esCreador = ($plan->id_user == $id_user) ? true : false;
unset($plan->id_user); unset($plan->id_user);
} }
@ -335,20 +345,21 @@ public function listPlan(){
]); ]);
} }
public function updatePlan(Request $request){ public function updatePlan(Request $request)
{
$request->validate([ $request->validate([
"id"=> "required|integer", "id" => "required|integer",
"nombre"=> "required|max:255", "nombre" => "required|max:255",
"oportunidad_plan"=> "required|max:255", "oportunidad_plan" => "required|max:255",
"semestre_ejecucion"=> "required|max:8", "semestre_ejecucion" => "required|max:8",
"duracion"=> "required|integer", "duracion" => "required|integer",
"estado"=> "required|max:30", "estado" => "required|max:30",
"evaluacion_eficacia"=> "required|boolean", "evaluacion_eficacia" => "required|boolean",
"avance"=> "required|integer", "avance" => "required|integer",
]); ]);
$id = $request->id; $id = $request->id;
$id_user = auth()->user()->id; $id_user = auth()->user()->id;
if(plan::where(["id_user"=>$id_user,"id"=>$id])->exists()){ if (plan::where(["id_user" => $id_user, "id" => $id])->exists()) {
$plan = plan::find($id); $plan = plan::find($id);
$plan->nombre = $request->nombre; $plan->nombre = $request->nombre;
$plan->oportunidad_plan = $request->oportunidad_plan; $plan->oportunidad_plan = $request->oportunidad_plan;
@ -363,58 +374,81 @@ public function updatePlan(Request $request){
"message" => "!Plan de mejora actualizado", "message" => "!Plan de mejora actualizado",
"data" => $plan, "data" => $plan,
]); ]);
} } else {
else{
return response([ return response([
"status" => 0, "status" => 0,
"message" => "!No se encontro el plan o no esta autorizado", "message" => "!No se encontro el plan o no esta autorizado",
],404); ], 404);
} }
} }
public function deletePlan($id){ public function deletePlan($id)
{
$id_user = auth()->user()->id; $id_user = auth()->user()->id;
if(plan::where(["id"=>$id,"id_user"=>$id_user])->exists()){ if (plan::where(["id" => $id, "id_user" => $id_user])->exists()) {
$plan = plan::where(["id"=>$id,"id_user"=>$id_user])->first(); $plan = plan::where(["id" => $id, "id_user" => $id_user])->first();
$plan->delete(); $plan->delete();
return response([ return response([
"status" => 1, "status" => 1,
"message" => "!Plan de mejora eliminado", "message" => "!Plan de mejora eliminado",
]); ]);
} } else {
else{
return response([ return response([
"status" => 0, "status" => 0,
"message" => "!No se encontro el plan de mejora o no esta autorizado", "message" => "!No se encontro el plan de mejora o no esta autorizado",
],404); ], 404);
} }
} }
//faltas completar //faltas completar
public function showPlan($id){ public function showPlan($id)
if(plan::where("id",$id)->exists()){ {
if (plan::where("id", $id)->exists()) {
$plan = plan::find($id); $plan = plan::find($id);
$plan->fuentes = Fuentes::where("id_plan",$id)->get(['id', 'descripcion as value']); $plan->fuentes = Fuentes::where("id_plan", $id)->get(['id', 'descripcion as value']);
$plan->problemas_oportunidades = ProblemasOportunidades::where("id_plan",$id)->get(['id', 'descripcion as value']); $plan->problemas_oportunidades = ProblemasOportunidades::where("id_plan", $id)->get(['id', 'descripcion as value']);
$plan->causas_raices = CausasRaices::where("id_plan",$id)->get(['id', 'descripcion as value']); $plan->causas_raices = CausasRaices::where("id_plan", $id)->get(['id', 'descripcion as value']);
$plan->acciones_mejoras = AccionesMejoras::where("id_plan",$id)->get(['id', 'descripcion as value']); $plan->acciones_mejoras = AccionesMejoras::where("id_plan", $id)->get(['id', 'descripcion as value']);
$plan->recursos = Recursos::where("id_plan",$id)->get(['id', 'descripcion as value']); $plan->recursos = Recursos::where("id_plan", $id)->get(['id', 'descripcion as value']);
$plan->metas = Metas::where("id_plan",$id)->get(['id', 'descripcion as value']); $plan->metas = Metas::where("id_plan", $id)->get(['id', 'descripcion as value']);
$plan->observaciones = Observaciones::where("id_plan",$id)->get(['id', 'descripcion as value']); $plan->observaciones = Observaciones::where("id_plan", $id)->get(['id', 'descripcion as value']);
$plan->responsables = Responsables::where("id_plan",$id)->get(['id', 'nombre as value']); $plan->responsables = Responsables::where("id_plan", $id)->get(['id', 'nombre as value']);
$plan->evidencias = Evidencias::where("id_plan",$id)->get(); $plan->evidencias = Evidencias::where("id_plan", $id)->get();
return response([ return response([
"status" => 1, "status" => 1,
"message" => "!Plan de mejora encontrado", "message" => "!Plan de mejora encontrado",
"data" => $plan, "data" => $plan,
]); ]);
} else {
return response([
"status" => 0,
"message" => "!No se encontro el plan de mejora",
], 404);
} }
else{ }
return response([
"status" => 0, public function listPlanUser()
"message" => "!No se encontro el plan de mejora", {
],404); $id_user = auth()->user()->id;
$planAll = plan::select('plans.id', 'plans.nombre', 'plans.codigo', 'plans.avance', 'plans.estado', 'plans.id_user', 'estandars.name as estandar_name', 'users.name as user_name')
->join('estandars', 'plans.id_estandar', '=', 'estandars.id')
->join('users', 'plans.id_user', '=', 'users.id')
->where("plans.id_user", $id_user)
->orderBy('plans.id', 'asc')
->get();
if ($planAll->count() > 0) {
return response([
"status" => 1,
"message" => "!Lista de planes de mejora",
"data" => $planAll,
]);
} else {
return response([
"status" => 0,
"message" => "!No tienes planes de mejora",
"data" => [],
], 404);
} }
} }
} }

1044
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -28,90 +28,91 @@
//Responsables Valores //Responsables Valores
Route::get('responsables',[ResponsablesValoresController::class,'listResponsablesValores']); Route::get('responsables', [ResponsablesValoresController::class, 'listResponsablesValores']);
//fuentes Valores //fuentes Valores
Route::get('fuentes',[FuentesValoresController::class,'listFuentesValores']); Route::get('fuentes', [FuentesValoresController::class, 'listFuentesValores']);
//Estados valores //Estados valores
Route::get('estados',[EstadosValoresController::class,'listEstadosValores']); Route::get('estados', [EstadosValoresController::class, 'listEstadosValores']);
//Estandares valores //Estandares valores
Route::get('estandares', [EstandarController::class,'listEstandarValores']); Route::get('estandares', [EstandarController::class, 'listEstandarValores']);
Route::middleware("auth:sanctum")->group (function(){ Route::middleware("auth:sanctum")->group(function () {
//rutas auth //rutas auth
Route::get('user-profile', [UserController::class,'userProfile']); Route::get('user-profile', [UserController::class, 'userProfile']);
Route::get('logout', [UserController::class, 'logout']); Route::get('logout', [UserController::class, 'logout']);
Route::post('register', [UserController::class, 'register']); Route::post('register', [UserController::class, 'register']);
//rutas estandar //rutas estandar
Route::post('estandar', [EstandarController::class,'createEstandar']); Route::post('estandar', [EstandarController::class, 'createEstandar']);
Route::get('estandar', [EstandarController::class,'listEstandar']); Route::get('estandar', [EstandarController::class, 'listEstandar']);
Route::get('estandar/{id}', [EstandarController::class,'showEstandar']); Route::get('estandar/{id}', [EstandarController::class, 'showEstandar']);
Route::put('estandar/{id}', [EstandarController::class,'updateEstandar']); Route::put('estandar/{id}', [EstandarController::class, 'updateEstandar']);
Route::delete('estandar/{id}', [EstandarController::class,'deleteEstandar']); Route::delete('estandar/{id}', [EstandarController::class, 'deleteEstandar']);
//rutas plan //rutas plan
Route::post('plan',[PlanController::class,'createPlan']); Route::post('plan', [PlanController::class, 'createPlan']);
Route::get('plan',[PlanController::class,'listPlan']); Route::get('plan', [PlanController::class, 'listPlan']);
Route::get('plan/{id}',[PlanController::class,'showPlan']); Route::get('plan/{id}', [PlanController::class, 'showPlan']);
Route::delete('plan/{id}',[PlanController::class,'deletePlan']); Route::delete('plan/{id}', [PlanController::class, 'deletePlan']);
Route::put('plan/{id}',[PlanController::class,'update']); Route::put('plan/{id}', [PlanController::class, 'update']);
Route::get('plans/user', [PlanController::class, 'listPlanUser']);
//Route::put('plan',[PlanController::class,'updatePlan']); //Route::put('plan',[PlanController::class,'updatePlan']);
//rutas metas //rutas metas
Route::post('meta',[MetasController::class,'create']); Route::post('meta', [MetasController::class, 'create']);
Route::put('meta',[MetasController::class,'update']); Route::put('meta', [MetasController::class, 'update']);
Route::delete('meta/{id}',[MetasController::class,'delete']); Route::delete('meta/{id}', [MetasController::class, 'delete']);
//rutas accionesmejoras //rutas accionesmejoras
Route::post('accionmejora',[AccionesMejorasController::class,'create']); Route::post('accionmejora', [AccionesMejorasController::class, 'create']);
Route::put('accionmejora',[AccionesMejorasController::class,'update']); Route::put('accionmejora', [AccionesMejorasController::class, 'update']);
Route::delete('accionmejora/{id}',[AccionesMejorasController::class,'delete']); Route::delete('accionmejora/{id}', [AccionesMejorasController::class, 'delete']);
//rutas fuentes //rutas fuentes
Route::post('fuente',[FuentesController::class,'create']); Route::post('fuente', [FuentesController::class, 'create']);
Route::put('fuente',[FuentesController::class,'update']); Route::put('fuente', [FuentesController::class, 'update']);
Route::delete('fuente/{id}',[FuentesController::class,'delete']); Route::delete('fuente/{id}', [FuentesController::class, 'delete']);
//rutas observaciones //rutas observaciones
Route::post('observacion',[ObservacionesController::class,'create']); Route::post('observacion', [ObservacionesController::class, 'create']);
Route::put('observacion',[ObservacionesController::class,'update']); Route::put('observacion', [ObservacionesController::class, 'update']);
Route::delete('observacion/{id}',[ObservacionesController::class,'delete']); Route::delete('observacion/{id}', [ObservacionesController::class, 'delete']);
//rutas problemas //rutas problemas
Route::post('problema',[ProblemasOportunidadesController::class,'create']); Route::post('problema', [ProblemasOportunidadesController::class, 'create']);
Route::put('problema',[ProblemasOportunidadesController::class,'update']); Route::put('problema', [ProblemasOportunidadesController::class, 'update']);
Route::delete('problema/{id}',[ProblemasOportunidadesController::class,'delete']); Route::delete('problema/{id}', [ProblemasOportunidadesController::class, 'delete']);
//rutas recursos //rutas recursos
Route::post('recurso',[RecursosController::class,'create']); Route::post('recurso', [RecursosController::class, 'create']);
Route::put('recurso',[RecursosController::class,'update']); Route::put('recurso', [RecursosController::class, 'update']);
Route::delete('recurso/{id}',[RecursosController::class,'delete']); Route::delete('recurso/{id}', [RecursosController::class, 'delete']);
//rutas casuasraiz //rutas casuasraiz
Route::post('causa',[CausasRaicesController::class,'create']); Route::post('causa', [CausasRaicesController::class, 'create']);
Route::put('causa',[CausasRaicesController::class,'update']); Route::put('causa', [CausasRaicesController::class, 'update']);
Route::delete('causa/{id}',[CausasRaicesController::class,'delete']); Route::delete('causa/{id}', [CausasRaicesController::class, 'delete']);
//ruta responsables //ruta responsables
Route::post('responsable',[ResponsablesController::class,'create']); Route::post('responsable', [ResponsablesController::class, 'create']);
Route::put('responsable',[ResponsablesController::class,'update']); Route::put('responsable', [ResponsablesController::class, 'update']);
Route::delete('responsable/{id}',[ResponsablesController::class,'delete']); Route::delete('responsable/{id}', [ResponsablesController::class, 'delete']);
//ruta evidencias //ruta evidencias
Route::post('evidencia',[EvidenciasController::class,'create']); Route::post('evidencia', [EvidenciasController::class, 'create']);
Route::get('evidencia/download/{id}', [EvidenciasController::class,'download']); Route::get('evidencia/download/{id}', [EvidenciasController::class, 'download']);
Route::get('evidencia/{id}', [EvidenciasController::class,'show']); Route::get('evidencia/{id}', [EvidenciasController::class, 'show']);
Route::put('evidencia',[EvidenciasController::class,'update']); Route::put('evidencia', [EvidenciasController::class, 'update']);
Route::delete('evidencia/{id}',[EvidenciasController::class,'delete']); Route::delete('evidencia/{id}', [EvidenciasController::class, 'delete']);
//ruta narrativas //ruta narrativas
Route::post('narrativa',[NarrativasController::class,'create']); Route::post('narrativa', [NarrativasController::class, 'create']);
Route::get('narrativa/{id}', [NarrativasController::class,'show']); Route::get('narrativa/{id}', [NarrativasController::class, 'show']);
Route::put('narrativa',[NarrativasController::class,'update']); Route::put('narrativa', [NarrativasController::class, 'update']);
Route::delete('narrativa/{id}',[NarrativasController::class,'delete']); Route::delete('narrativa/{id}', [NarrativasController::class, 'delete']);
Route::get('narrativa', [NarrativasController::class,'listNarrativas']); Route::get('narrativa', [NarrativasController::class, 'listNarrativas']);
}); });
Route::middleware('auth:sanctum')->get('/user', function (Request $request) { Route::middleware('auth:sanctum')->get('/user', function (Request $request) {