2026-02-26 22:49:44 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\HR;
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Models\HR\Payroll;
|
|
|
|
|
use App\Services\HR\PayrollService;
|
|
|
|
|
use Illuminate\Contracts\View\View;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Http\Response;
|
|
|
|
|
|
|
|
|
|
class PayrollController extends Controller
|
|
|
|
|
{
|
2026-02-27 17:59:50 +09:00
|
|
|
private const ALLOWED_PAYROLL_USERS = ['이경호', '전진선', '김보곤'];
|
|
|
|
|
|
2026-02-26 22:49:44 +09:00
|
|
|
public function __construct(
|
|
|
|
|
private PayrollService $payrollService
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 급여관리 페이지
|
|
|
|
|
*/
|
|
|
|
|
public function index(Request $request): View|Response
|
|
|
|
|
{
|
|
|
|
|
if ($request->header('HX-Request')) {
|
|
|
|
|
return response('', 200)->header('HX-Redirect', route('hr.payrolls.index'));
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-27 17:59:50 +09:00
|
|
|
if (! in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS)) {
|
|
|
|
|
return view('hr.payrolls.restricted');
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-26 22:49:44 +09:00
|
|
|
$stats = $this->payrollService->getMonthlyStats();
|
|
|
|
|
$departments = $this->payrollService->getDepartments();
|
|
|
|
|
$employees = $this->payrollService->getActiveEmployees();
|
|
|
|
|
$settings = $this->payrollService->getSettings();
|
|
|
|
|
$statusMap = Payroll::STATUS_MAP;
|
|
|
|
|
|
|
|
|
|
return view('hr.payrolls.index', [
|
|
|
|
|
'stats' => $stats,
|
|
|
|
|
'departments' => $departments,
|
|
|
|
|
'employees' => $employees,
|
|
|
|
|
'settings' => $settings,
|
|
|
|
|
'statusMap' => $statusMap,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|