Hide latestTeamActivity for members with employee role

This commit is contained in:
Constantin Graf
2024-04-25 16:26:42 +02:00
parent 023f6b12b5
commit c194e3547b
3 changed files with 75 additions and 2 deletions

View File

@@ -7,12 +7,13 @@ namespace App\Http\Controllers\Web;
use App\Models\Organization;
use App\Models\User;
use App\Service\DashboardService;
use App\Service\PermissionStore;
use Inertia\Inertia;
use Inertia\Response;
class DashboardController extends Controller
{
public function dashboard(DashboardService $dashboardService): Response
public function dashboard(DashboardService $dashboardService, PermissionStore $permissionStore): Response
{
/** @var User $user */
$user = auth()->user();
@@ -24,10 +25,14 @@ class DashboardController extends Controller
$totalWeeklyBillableTime = $dashboardService->totalWeeklyBillableTime($user, $organization);
$totalWeeklyBillableAmount = $dashboardService->totalWeeklyBillableAmount($user, $organization);
$weeklyProjectOverview = $dashboardService->weeklyProjectOverview($user, $organization);
$latestTeamActivity = $dashboardService->latestTeamActivity($organization);
$latestTasks = $dashboardService->latestTasks($user, $organization);
$lastSevenDays = $dashboardService->lastSevenDays($user, $organization);
$latestTeamActivity = null;
if ($permissionStore->has($organization, 'time-entries:view:all')) {
$latestTeamActivity = $dashboardService->latestTeamActivity($organization);
}
return Inertia::render('Dashboard', [
'weeklyProjectOverview' => $weeklyProjectOverview,
'latestTasks' => $latestTasks,