- 근태현황(/hr/attendances): 조회 전용 (목록/캘린더/요약) - 근태관리(/hr/attendances/manage): CRUD + 승인 관리 - table-manage.blade.php: 관리용 테이블 (체크박스/수정/삭제) - table.blade.php: 조회용 테이블 (GPS 포함, CRUD 제거) - API 컨트롤러 view 파라미터로 테이블 분기
54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\HR;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\HR\Attendance;
|
|
use App\Services\HR\AttendanceService;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
|
|
class AttendanceController extends Controller
|
|
{
|
|
public function __construct(
|
|
private AttendanceService $attendanceService
|
|
) {}
|
|
|
|
/**
|
|
* 근태현황 목록 페이지 (조회 전용)
|
|
*/
|
|
public function index(): View
|
|
{
|
|
$stats = $this->attendanceService->getMonthlyStats();
|
|
$departments = $this->attendanceService->getDepartments();
|
|
$statusMap = Attendance::STATUS_MAP;
|
|
|
|
return view('hr.attendances.index', [
|
|
'stats' => $stats,
|
|
'departments' => $departments,
|
|
'statusMap' => $statusMap,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 근태관리 페이지 (등록/수정/삭제/승인)
|
|
*/
|
|
public function manage(Request $request): View|Response
|
|
{
|
|
if ($request->header('HX-Request')) {
|
|
return response('', 200)->header('HX-Redirect', route('hr.attendances.manage'));
|
|
}
|
|
|
|
$departments = $this->attendanceService->getDepartments();
|
|
$employees = $this->attendanceService->getActiveEmployees();
|
|
$statusMap = Attendance::STATUS_MAP;
|
|
|
|
return view('hr.attendances.manage', [
|
|
'departments' => $departments,
|
|
'employees' => $employees,
|
|
'statusMap' => $statusMap,
|
|
]);
|
|
}
|
|
}
|