feat: [approval] 위촉증명서 기안/조회/PDF 기능 추가

- AppointmentCertService: 사원 위촉정보 조회 + TCPDF PDF 생성
- 기안 작성 폼: 사원 선택, 인적/위촉/발급 정보, 미리보기
- 상세 조회: 읽기전용 렌더링 + 미리보기/PDF 다운로드
- API: appointment-cert-info, appointment-cert-pdf 엔드포인트
This commit is contained in:
김보곤
2026-03-05 23:57:42 +09:00
parent 1fef5f16d9
commit 0445748b32
7 changed files with 780 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
use App\Http\Controllers\Controller;
use App\Models\Boards\File;
use App\Services\AppointmentCertService;
use App\Services\ApprovalService;
use App\Services\CareerCertService;
use App\Services\EmploymentCertService;
@@ -330,6 +331,43 @@ public function careerCertPdf(int $id)
return $service->generatePdfResponse($content);
}
// =========================================================================
// 위촉증명서
// =========================================================================
/**
* 사원 위촉증명서 정보 조회
*/
public function appointmentCertInfo(int $userId): JsonResponse
{
try {
$tenantId = session('selected_tenant_id');
$service = app(AppointmentCertService::class);
$data = $service->getCertInfo($userId, $tenantId);
return response()->json(['success' => true, 'data' => $data]);
} catch (\Throwable $e) {
return response()->json([
'success' => false,
'message' => '사원 정보를 불러올 수 없습니다.',
], 400);
}
}
/**
* 위촉증명서 PDF 다운로드
*/
public function appointmentCertPdf(int $id)
{
$approval = \App\Models\Approvals\Approval::where('tenant_id', session('selected_tenant_id'))
->findOrFail($id);
$content = $approval->content ?? [];
$service = app(AppointmentCertService::class);
return $service->generatePdfResponse($content);
}
// =========================================================================
// 워크플로우
// =========================================================================