diff --git a/app/Http/Controllers/Api/PlanController.php b/app/Http/Controllers/Api/PlanController.php index 9f4a3d1..394fe8f 100644 --- a/app/Http/Controllers/Api/PlanController.php +++ b/app/Http/Controllers/Api/PlanController.php @@ -535,6 +535,7 @@ public function exportPlan($id) foreach ($plan->fuentes as $fuente) { $content_fuentes .= "- " . $fuente->value . ""; } + $content_fuentes = rtrim($content_fuentes, ""); $template->setValue('fuentes', $content_fuentes); //3 @@ -542,6 +543,7 @@ public function exportPlan($id) foreach ($plan->problemas_oportunidades as $problema_oportunidad) { $content_problemas_oportunidades .= "- " . $problema_oportunidad->value . ""; } + $content_problemas_oportunidades = rtrim($content_problemas_oportunidades, ""); $template->setValue('problema_oportunidad', $content_problemas_oportunidades); //4 @@ -549,6 +551,7 @@ public function exportPlan($id) foreach ($plan->causas_raices as $causa_raiz) { $content_causas_raices .= "- " . $causa_raiz->value . ""; } + $content_causas_raices = rtrim($content_causas_raices, ""); $template->setValue('causa', $content_causas_raices); //5 @@ -559,6 +562,7 @@ public function exportPlan($id) foreach ($plan->acciones_mejoras as $accion_mejora) { $content_acciones_mejoras .= "- " . $accion_mejora->value . ""; } + $content_acciones_mejoras = rtrim($content_acciones_mejoras, ""); $template->setValue('acciones', $content_acciones_mejoras); //7 @@ -572,6 +576,7 @@ public function exportPlan($id) foreach ($plan->recursos as $recurso) { $content_recursos .= "- " . $recurso->value . ""; } + $content_recursos = rtrim($content_recursos, ""); $template->setValue('recursos', $content_recursos); //10 @@ -579,6 +584,7 @@ public function exportPlan($id) foreach ($plan->metas as $meta) { $content_metas .= "- " . $meta->value . ""; } + $content_metas = rtrim($content_metas, ""); $template->setValue('metas', $content_metas); //11 @@ -586,6 +592,7 @@ public function exportPlan($id) foreach ($plan->responsables as $responsable) { $content_responsables .= "- " . $responsable->value . ""; } + $content_responsables = rtrim($content_responsables, ""); $template->setValue('responsables', $content_responsables); //12 @@ -593,6 +600,7 @@ public function exportPlan($id) foreach ($plan->observaciones as $observacion) { $content_observaciones .= "- " . $observacion->value . ""; } + $content_observaciones = rtrim($content_observaciones, ""); $template->setValue('observaciones', $content_observaciones); //13 @@ -603,6 +611,7 @@ public function exportPlan($id) foreach ($plan->evidencias as $evidencia) { $content_evidencias .= "- " . $evidencia->codigo . ""; } + $content_evidencias = rtrim($content_evidencias, ""); $template->setValue('evidencias', $content_evidencias); //15 @@ -629,7 +638,7 @@ public function exportPlan($id) 'Content-Type' => 'application/msword', 'Content-Disposition' => 'attachment;filename="plan.docx"', ]; - return response()->download($tempfiledocx, 'plan.docx', $headers)->deleteFileAfterSend(true); + return response()->download($tempfiledocx, $plan->codigo . '_plan.docx', $headers); } catch (\PhpOffice\PhpWord\Exception\Exception $e) { return response([ "status" => 0,