<?php

namespace App\Modules\Dashboard_v2\controllers;

use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Auth;
use App\Modules\Bookings\Repair as Repair;
use App\Modules\Bookings\Support as Support;
use App\Modules\Bookings\Onsite as Onsite;
use App\Http\Controllers\BaseController;
use App\Modules\Admin\DashboardTabSetting;

class DashboardController extends BaseController
{
    public function getIndex()
    {
        Log::info('=== DASHBOARD ACCESS ===', [
            'user_id' => Auth::check() ? Auth::user()->id : 'not_authenticated',
            'user_authenticated' => Auth::check(),
            'session_id' => session()->getId(),
            'ip' => request()->ip()
        ]);

        // Get visible dashboard tabs ordered by order_index
        $dashboardTabs = DashboardTabSetting::getVisibleTabs();

        // Modern Laravel approach - return view directly instead of legacy layout pattern
        return view('dashboard_v2::index', compact('dashboardTabs'));
    }
}
