feat: Implement initial agent integration management system with role-based dashboards, status tracking, and activity timelines.
This commit is contained in:
@@ -43,10 +43,23 @@ class IntegrationController extends Controller
|
||||
|
||||
public function show(IntegrationRequest $integration)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$serviceTaskConstraint = function ($query) use ($user) {
|
||||
// Admin, RH, and Prescripteur can see all tasks (global progress)
|
||||
if (!$user->hasRole(['Admin', 'RH', 'Prescripteur'])) {
|
||||
$query->whereHas('service', function ($q) use ($user) {
|
||||
$q->whereIn('name', $user->getRoleNames());
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$integration->load([
|
||||
'agent',
|
||||
'template',
|
||||
'serviceTasks.service',
|
||||
'serviceTasks' => $serviceTaskConstraint,
|
||||
'serviceTasks.service',
|
||||
'serviceTasks.integrationRequest',
|
||||
'serviceTasks.taskItems',
|
||||
'serviceTasks.comments.user',
|
||||
'serviceTasks.attachments',
|
||||
@@ -77,6 +90,10 @@ class IntegrationController extends Controller
|
||||
|
||||
public function downloadPdf(IntegrationRequest $integration)
|
||||
{
|
||||
if ($integration->status !== \App\Enums\IntegrationStatus::Completed) {
|
||||
abort(403, 'Le téléchargement de la fiche agent n\'est possible que lorsque le processus est terminé.');
|
||||
}
|
||||
|
||||
// Load relationships needed for the PDF
|
||||
$integration->load([
|
||||
'agent',
|
||||
|
||||
Reference in New Issue
Block a user