Files
sam-manage/resources/views/approvals/partials/_certificate-show.blade.php
김보곤 7f73c054d5 refactor: [approval] 재직증명서 DOCX 생성을 제거하고 content JSON 저장 + PDF 다운로드 방식으로 변경
- 상신 시 DOCX 생성 API 호출 제거, content JSON만 저장
- show 페이지에 PDF 다운로드 버튼 추가
- TCPDF 기반 PDF 생성 (기존 Pretendard 한글 폰트 활용)
- EmploymentCertService에서 generateDocx/createFileRecord 제거
2026-03-05 19:29:38 +09:00

152 lines
8.3 KiB
PHP

{{--
재직증명서 읽기전용 렌더링
Props:
$content (array) - approvals.content JSON
--}}
<div class="space-y-4">
{{-- 미리보기 / PDF 다운로드 버튼 --}}
<div class="flex justify-end gap-2">
<button type="button" onclick="openCertShowPreview()"
class="px-3 py-1.5 bg-indigo-50 text-indigo-600 hover:bg-indigo-100 border border-indigo-200 rounded-lg text-sm font-medium transition inline-flex items-center gap-1">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/>
</svg>
증명서 미리보기
</button>
<a href="{{ route('api.admin.approvals.cert-pdf', $approval->id) }}" target="_blank"
class="px-3 py-1.5 bg-green-50 text-green-600 hover:bg-green-100 border border-green-200 rounded-lg text-sm font-medium transition inline-flex items-center gap-1">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
PDF 다운로드
</a>
</div>
{{-- 인적사항 --}}
<div class="border border-gray-200 rounded-lg overflow-hidden">
<div class="bg-gray-50 px-4 py-2 border-b border-gray-200">
<h3 class="text-sm font-semibold text-gray-700">1. 인적사항</h3>
</div>
<div class="p-4">
<div class="grid gap-3" style="grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));">
<div>
<span class="text-xs text-gray-500">성명</span>
<div class="text-sm font-medium mt-0.5">{{ $content['name'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">주민등록번호</span>
<div class="text-sm font-medium mt-0.5">{{ $content['resident_number'] ?? '-' }}</div>
</div>
<div style="grid-column: 1 / -1;">
<span class="text-xs text-gray-500">주소</span>
<div class="text-sm font-medium mt-0.5">{{ $content['address'] ?? '-' }}</div>
</div>
</div>
</div>
</div>
{{-- 재직사항 --}}
<div class="border border-gray-200 rounded-lg overflow-hidden">
<div class="bg-gray-50 px-4 py-2 border-b border-gray-200">
<h3 class="text-sm font-semibold text-gray-700">2. 재직사항</h3>
</div>
<div class="p-4">
<div class="grid gap-3" style="grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));">
<div>
<span class="text-xs text-gray-500">회사명</span>
<div class="text-sm font-medium mt-0.5">{{ $content['company_name'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">사업자번호</span>
<div class="text-sm font-medium mt-0.5">{{ $content['business_num'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">근무부서</span>
<div class="text-sm font-medium mt-0.5">{{ $content['department'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">직급</span>
<div class="text-sm font-medium mt-0.5">{{ $content['position'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">재직기간</span>
<div class="text-sm font-medium mt-0.5">{{ $content['hire_date'] ?? '-' }}</div>
</div>
</div>
</div>
</div>
{{-- 발급정보 --}}
<div class="border border-gray-200 rounded-lg overflow-hidden">
<div class="bg-gray-50 px-4 py-2 border-b border-gray-200">
<h3 class="text-sm font-semibold text-gray-700">3. 발급정보</h3>
</div>
<div class="p-4">
<div class="grid gap-3" style="grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));">
<div>
<span class="text-xs text-gray-500">사용용도</span>
<div class="text-sm font-medium mt-0.5">{{ $content['purpose'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">발급일</span>
<div class="text-sm font-medium mt-0.5">{{ $content['issue_date'] ?? '-' }}</div>
</div>
</div>
</div>
</div>
{{-- 첨부파일 --}}
@if(!empty($approval->attachments))
<div>
<span class="text-xs text-gray-500">첨부파일</span>
<div class="mt-1 space-y-1">
@foreach($approval->attachments as $file)
<div class="flex items-center gap-2 text-sm">
<svg class="w-4 h-4 text-gray-400 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"/>
</svg>
<a href="{{ route('api.admin.approvals.download-file', $file['id']) }}" class="text-blue-600 hover:underline" target="_blank">
{{ $file['name'] ?? '파일' }}
</a>
<span class="text-xs text-gray-400">
{{ isset($file['size']) ? number_format($file['size'] / 1024, 1) . 'KB' : '' }}
</span>
</div>
@endforeach
</div>
</div>
@endif
</div>
{{-- 미리보기 모달 --}}
<div id="cert-show-preview-modal" style="display: none;" class="fixed inset-0 z-50">
<div class="absolute inset-0 bg-black/50" onclick="closeCertShowPreview()"></div>
<div class="relative flex items-center justify-center min-h-full p-4">
<div class="bg-white rounded-xl shadow-2xl w-full overflow-hidden relative" style="max-width: 700px;">
<div class="flex items-center justify-between px-5 py-3 border-b border-gray-200 bg-gray-50">
<h3 class="text-base font-semibold text-gray-800">재직증명서 미리보기</h3>
<div class="flex items-center gap-2">
<button type="button" onclick="printCertShowPreview()"
class="px-3 py-1.5 bg-white border border-gray-300 hover:bg-gray-50 rounded-lg text-xs font-medium transition inline-flex items-center gap-1">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"/>
</svg>
인쇄
</button>
<button type="button" onclick="closeCertShowPreview()"
class="p-1 text-gray-400 hover:text-gray-600 transition">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
</div>
<div class="overflow-y-auto" style="max-height: 80vh;">
<div id="cert-show-preview-content" style="padding: 48px 56px; font-family: 'Pretendard', 'Malgun Gothic', sans-serif;">
</div>
</div>
</div>
</div>
</div>