<?php

namespace Modules\Hrm\Controllers;

use App\Controllers\BaseController;
use Modules\Hrm\Services\HrmDashboardService;

class HrmDashboardController extends BaseController
{
    protected HrmDashboardService $service;

    public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
    {
        parent::initController($request, $response, $logger);
        $this->service = new HrmDashboardService();
    }

    public function index()
    {
        $overview = $this->service->overview();

        return view('Modules\Hrm\Views\dashboard\index', array_merge($this->baseViewData(), [
            'title'    => 'HRM Dashboard',
            'overview' => $overview,
            'today'    => date('Y-m-d'),
        ]));
    }
}
