Skip to content
Snippets Groups Projects
Commit 52ae3a04 authored by sebastien dupuy's avatar sebastien dupuy
Browse files

pdf plan d'action wip

parent 0e66c8a0
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Models\Evaluation;
use App\Models\Organization;
use App\Models\User;
use Dompdf\Dompdf;
......@@ -12,17 +13,24 @@
class PdfController extends Controller
{
public function ActionPlanPdf(){
$ActionPlan_id = request()->route()->parameters['plan_action_id'];
$organization_id = request()->route()->parameters['organization_id'];
$authUser = Auth::user();
$isAdmin = $authUser && (User::ROLE_ADMIN === $authUser->role);
$organization_id = 1;
$organization = Organization::where('id',$organization_id)
->first();
$evaluation = Evaluation::where('organization_id',$organization_id)
->with('dangerLevels')
->with('evaluationMeasures')
->with('organization')
->latest()
->first();
$data = ['plan_name' => 'Test plan',
'organization' => $organization,
'evaluation' => $evaluation,
'elu'=> 'test elu',
'agent'=> 'test agent',
'referentiel' => 'v1.0',
......
......@@ -25,7 +25,7 @@
Route::get('/newpassword/{id}/{reset_token}', [UsersController::class, 'createPassword'])->name('password_reset');
Route::middleware('auth:sanctum')->prefix('/pdf')->group(function () {
Route::get('/planAction/{plan_action_id}', [PdfController::class, 'ActionPlanPdf'])->name('pdf.plan_action');
Route::get('/planAction/{organization_id}', [PdfController::class, 'ActionPlanPdf'])->name('pdf.plan_action');
});
Route::middleware('auth:sanctum')->get('/{any}', function () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment