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,14 +17,16 @@
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,
@ -46,16 +48,17 @@ public function update(Request $request,$id){
$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-------------------------------*/
@ -64,16 +67,17 @@ public function update(Request $request,$id){
$existingsIds = collect($problemas)->pluck('id')->filter(); $existingsIds = collect($problemas)->pluck('id')->filter();
$plan->problemasOportunidade()->whereNotIn('id', $existingsIds)->delete(); $plan->problemasOportunidade()->whereNotIn('id', $existingsIds)->delete();
//Actualizar problemas de estandar //Actualizar problemas de estandar
if(isset($problemas)){ if (isset($problemas)) {
foreach($problemas as $problema){ foreach ($problemas as $problema) {
$plan->problemasOportunidade()->updateOrCreate( $plan->problemasOportunidade()->updateOrCreate(
[ [
"id" => $problema['id'] "id" => $problema['id']
], ],
[ [
"descripcion" => $problema['value'], "descripcion" => $problema['value'],
"id_plan"=> $plan->id "id_plan" => $plan->id
]); ]
);
} }
} }
/*--------------------------------Causas-------------------------------*/ /*--------------------------------Causas-------------------------------*/
@ -82,16 +86,17 @@ public function update(Request $request,$id){
$existingsIds = collect($causas)->pluck('id')->filter(); $existingsIds = collect($causas)->pluck('id')->filter();
$plan->causasRaices()->whereNotIn('id', $existingsIds)->delete(); $plan->causasRaices()->whereNotIn('id', $existingsIds)->delete();
//Actualizar causas de estandar //Actualizar causas de estandar
if(isset($causas)){ if (isset($causas)) {
foreach($causas as $causa){ foreach ($causas as $causa) {
$plan->causasRaices()->updateOrCreate( $plan->causasRaices()->updateOrCreate(
[ [
"id" => $causa['id'] "id" => $causa['id']
], ],
[ [
"descripcion" => $causa['value'], "descripcion" => $causa['value'],
"id_plan"=> $plan->id "id_plan" => $plan->id
]); ]
);
} }
} }
/*------------------------------Acciones-------------------------------*/ /*------------------------------Acciones-------------------------------*/
@ -100,16 +105,17 @@ public function update(Request $request,$id){
$existingsIds = collect($acciones)->pluck('id')->filter(); $existingsIds = collect($acciones)->pluck('id')->filter();
$plan->accionesMejoras()->whereNotIn('id', $existingsIds)->delete(); $plan->accionesMejoras()->whereNotIn('id', $existingsIds)->delete();
//Actualizar acciones de estandar //Actualizar acciones de estandar
if(isset($acciones)){ if (isset($acciones)) {
foreach($acciones as $accion){ foreach ($acciones as $accion) {
$plan->accionesMejoras()->updateOrCreate( $plan->accionesMejoras()->updateOrCreate(
[ [
"id" => $accion['id'] "id" => $accion['id']
], ],
[ [
"descripcion" => $accion['value'], "descripcion" => $accion['value'],
"id_plan"=> $plan->id "id_plan" => $plan->id
]); ]
);
} }
} }
/*------------------------------Recursos-------------------------------*/ /*------------------------------Recursos-------------------------------*/
@ -118,16 +124,17 @@ public function update(Request $request,$id){
$existingsIds = collect($recursos)->pluck('id')->filter(); $existingsIds = collect($recursos)->pluck('id')->filter();
$plan->recursos()->whereNotIn('id', $existingsIds)->delete(); $plan->recursos()->whereNotIn('id', $existingsIds)->delete();
//Actualizar recursos de estandar //Actualizar recursos de estandar
if(isset($recursos)){ if (isset($recursos)) {
foreach($recursos as $recurso){ foreach ($recursos as $recurso) {
$plan->recursos()->updateOrCreate( $plan->recursos()->updateOrCreate(
[ [
"id" => $recurso['id'] "id" => $recurso['id']
], ],
[ [
"descripcion" => $recurso['value'], "descripcion" => $recurso['value'],
"id_plan"=> $plan->id "id_plan" => $plan->id
]); ]
);
} }
} }
/*--------------------------------Metas-------------------------------*/ /*--------------------------------Metas-------------------------------*/
@ -136,16 +143,17 @@ public function update(Request $request,$id){
$existingsIds = collect($metas)->pluck('id')->filter(); $existingsIds = collect($metas)->pluck('id')->filter();
$plan->metas()->whereNotIn('id', $existingsIds)->delete(); $plan->metas()->whereNotIn('id', $existingsIds)->delete();
//Actualizar metas de estandar //Actualizar metas de estandar
if(isset($metas)){ if (isset($metas)) {
foreach($metas as $meta){ foreach ($metas as $meta) {
$plan->metas()->updateOrCreate( $plan->metas()->updateOrCreate(
[ [
"id" => $meta['id'] "id" => $meta['id']
], ],
[ [
"descripcion" => $meta['value'], "descripcion" => $meta['value'],
"id_plan"=> $plan->id "id_plan" => $plan->id
]); ]
);
} }
} }
/*---------------------------Responsables-------------------------------*/ /*---------------------------Responsables-------------------------------*/
@ -154,16 +162,17 @@ public function update(Request $request,$id){
$existingsIds = collect($responsables)->pluck('id')->filter(); $existingsIds = collect($responsables)->pluck('id')->filter();
$plan->responsables()->whereNotIn('id', $existingsIds)->delete(); $plan->responsables()->whereNotIn('id', $existingsIds)->delete();
//Actualizar responsables de estandar //Actualizar responsables de estandar
if(isset($responsables)){ if (isset($responsables)) {
foreach($responsables as $responsable){ foreach ($responsables as $responsable) {
$plan->responsables()->updateOrCreate( $plan->responsables()->updateOrCreate(
[ [
"id" => $responsable['id'] "id" => $responsable['id']
], ],
[ [
"nombre" => $responsable['value'], "nombre" => $responsable['value'],
"id_plan"=> $plan->id "id_plan" => $plan->id
]); ]
);
} }
} }
/*--------------------------Observaciones-------------------------------*/ /*--------------------------Observaciones-------------------------------*/
@ -172,34 +181,34 @@ public function update(Request $request,$id){
$existingsIds = collect($observaciones)->pluck('id')->filter(); $existingsIds = collect($observaciones)->pluck('id')->filter();
$plan->observaciones()->whereNotIn('id', $existingsIds)->delete(); $plan->observaciones()->whereNotIn('id', $existingsIds)->delete();
//Actualizar observaciones de estandar //Actualizar observaciones de estandar
if(isset($observaciones)){ if (isset($observaciones)) {
foreach($observaciones as $observacion){ foreach ($observaciones as $observacion) {
$plan->observaciones()->updateOrCreate( $plan->observaciones()->updateOrCreate(
[ [
"id" => $observacion['id'] "id" => $observacion['id']
], ],
[ [
"descripcion" => $observacion['value'], "descripcion" => $observacion['value'],
"id_plan"=> $plan->id "id_plan" => $plan->id
]); ]
);
} }
} }
return response()->json($plan, 200); return response()->json($plan, 200);
} } 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);
} }
} }
// Arreglar el formato de IDs // Arreglar el formato de IDs
public function createPlan(Request $request){ 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',
@ -207,28 +216,28 @@ public function createPlan(Request $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 {
else{
return response([ return response([
"status" => 0, "status" => 0,
"message" => "!No se encontro el plan de mejora", "message" => "!No se encontro el plan de mejora",
],404); ], 404);
}
}
public function listPlanUser()
{
$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) {