fix: [approvals] 사직서 레이아웃 개선 - A4 용지 내 안정된 수직 배분
- HTML: @page A4 설정, cert-page wrapper(padding 100px), th/td 16px 18px, font 16px - PDF: 상단여백 40mm+Ln20, rowHeight 8→12, 본문 10→12pt, 문구 12→14pt, 회사 14→16pt - 섹션 간격 대폭 확대 (테이블↔문구 30mm, 신청인↔회사 30mm) - create/show 동일 적용
This commit is contained in:
@@ -77,17 +77,20 @@ public function generatePdfResponse(array $content): \Illuminate\Http\Response
|
||||
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
$pdf->SetMargins(20, 20, 20);
|
||||
$pdf->SetMargins(20, 40, 20);
|
||||
$pdf->SetAutoPageBreak(true, 20);
|
||||
|
||||
$font = $this->getKoreanFont();
|
||||
|
||||
$pdf->AddPage();
|
||||
|
||||
// 상단 여백
|
||||
$pdf->Ln(20);
|
||||
|
||||
// 제목
|
||||
$pdf->SetFont($font, 'B', 22);
|
||||
$pdf->SetFont($font, 'B', 24);
|
||||
$pdf->Cell(0, 20, '사 직 서', 0, 1, 'C');
|
||||
$pdf->Ln(8);
|
||||
$pdf->Ln(20);
|
||||
|
||||
// 테이블
|
||||
$this->addTableRow($pdf, $font, [
|
||||
@@ -108,29 +111,29 @@ public function generatePdfResponse(array $content): \Illuminate\Http\Response
|
||||
$this->addTableRow($pdf, $font, [
|
||||
['사 유', $content['reason'] ?? '-', 0],
|
||||
]);
|
||||
$pdf->Ln(12);
|
||||
$pdf->Ln(30);
|
||||
|
||||
// 증명 문구
|
||||
$pdf->SetFont($font, '', 12);
|
||||
$pdf->MultiCell(0, 8, '상기 본인은 위 사유로 인하여 사직하고자'."\n".'이에 사직서를 제출하오니 허가하여 주시기 바랍니다.', 0, 'C');
|
||||
$pdf->Ln(6);
|
||||
$pdf->SetFont($font, '', 14);
|
||||
$pdf->MultiCell(0, 10, '상기 본인은 위 사유로 인하여 사직하고자'."\n".'이에 사직서를 제출하오니 허가하여 주시기 바랍니다.', 0, 'C');
|
||||
$pdf->Ln(20);
|
||||
|
||||
// 날짜
|
||||
$issueDate = $content['issue_date'] ?? date('Y-m-d');
|
||||
$issueDateFormatted = $this->formatDate($issueDate);
|
||||
$pdf->SetFont($font, 'B', 12);
|
||||
$pdf->Cell(0, 10, $issueDateFormatted, 0, 1, 'C');
|
||||
$pdf->Ln(6);
|
||||
$pdf->SetFont($font, 'B', 14);
|
||||
$pdf->Cell(0, 12, $issueDateFormatted, 0, 1, 'C');
|
||||
$pdf->Ln(10);
|
||||
|
||||
// 신청인
|
||||
$pdf->SetFont($font, '', 12);
|
||||
$pdf->Cell(0, 10, '신청인 '.($content['name'] ?? '').' (인)', 0, 1, 'C');
|
||||
$pdf->Ln(12);
|
||||
$pdf->SetFont($font, '', 14);
|
||||
$pdf->Cell(0, 12, '신청인 '.($content['name'] ?? '').' (인)', 0, 1, 'C');
|
||||
$pdf->Ln(30);
|
||||
|
||||
// 회사명 + 대표이사 귀하
|
||||
$ceoName = $content['ceo_name'] ?? '';
|
||||
$pdf->SetFont($font, 'B', 14);
|
||||
$pdf->Cell(0, 10, ($content['company_name'] ?? '').' 대표이사 귀하', 0, 1, 'C');
|
||||
$pdf->SetFont($font, 'B', 16);
|
||||
$pdf->Cell(0, 12, ($content['company_name'] ?? '').' 대표이사 귀하', 0, 1, 'C');
|
||||
|
||||
$pdfContent = $pdf->Output('', 'S');
|
||||
$fileName = '사직서_'.($content['name'] ?? '').'.pdf';
|
||||
@@ -144,22 +147,22 @@ public function generatePdfResponse(array $content): \Illuminate\Http\Response
|
||||
private function addTableRow(\TCPDF $pdf, string $font, array $cells): void
|
||||
{
|
||||
$pageWidth = $pdf->getPageWidth() - 40;
|
||||
$rowHeight = 8;
|
||||
$rowHeight = 12;
|
||||
$thWidth = 30;
|
||||
|
||||
if (count($cells) === 1) {
|
||||
$pdf->SetFont($font, 'B', 10);
|
||||
$pdf->SetFont($font, 'B', 12);
|
||||
$pdf->SetFillColor(248, 249, 250);
|
||||
$pdf->Cell($thWidth, $rowHeight, $cells[0][0], 1, 0, 'L', true);
|
||||
$pdf->SetFont($font, '', 10);
|
||||
$pdf->SetFont($font, '', 12);
|
||||
$pdf->Cell($pageWidth - $thWidth, $rowHeight, $cells[0][1], 1, 1, 'L');
|
||||
} else {
|
||||
$tdWidth = ($pageWidth - $thWidth * 2) / 2;
|
||||
foreach ($cells as $cell) {
|
||||
$pdf->SetFont($font, 'B', 10);
|
||||
$pdf->SetFont($font, 'B', 12);
|
||||
$pdf->SetFillColor(248, 249, 250);
|
||||
$pdf->Cell($thWidth, $rowHeight, $cell[0], 1, 0, 'L', true);
|
||||
$pdf->SetFont($font, '', 10);
|
||||
$pdf->SetFont($font, '', 12);
|
||||
$pdf->Cell($tdWidth, $rowHeight, $cell[1], 1, 0, 'L');
|
||||
}
|
||||
$pdf->Ln();
|
||||
|
||||
@@ -1420,23 +1420,23 @@ function printResignationPreview() {
|
||||
const content = document.getElementById('resignation-preview-content').innerHTML;
|
||||
const win = window.open('', '_blank', 'width=800,height=1000');
|
||||
win.document.write('<html><head><title>사직서</title>');
|
||||
win.document.write('<style>body{font-family:"Pretendard","Malgun Gothic",sans-serif;padding:48px 56px;margin:0;} table{border-collapse:collapse;width:100%;} th,td{border:1px solid #333;padding:10px 14px;font-size:14px;} th{background:#f8f9fa;font-weight:600;text-align:left;white-space:nowrap;width:120px;} @media print{body{padding:40px 48px;}}</style>');
|
||||
win.document.write('</head><body>');
|
||||
win.document.write('<style>@page{size:A4;margin:0;} body{font-family:"Pretendard","Malgun Gothic",sans-serif;margin:0;padding:0;} .cert-page{padding:100px 56px 60px;box-sizing:border-box;} table{border-collapse:collapse;width:100%;} th,td{border:1px solid #333;padding:16px 18px;font-size:16px;} th{background:#f8f9fa;font-weight:600;text-align:left;white-space:nowrap;width:140px;}</style>');
|
||||
win.document.write('</head><body><div class="cert-page">');
|
||||
win.document.write(content);
|
||||
win.document.write('</body></html>');
|
||||
win.document.write('</div></body></html>');
|
||||
win.document.close();
|
||||
win.onload = function() { win.print(); };
|
||||
}
|
||||
|
||||
function buildResignationPreviewHtml(d) {
|
||||
const e = (s) => { const div = document.createElement('div'); div.textContent = s; return div.innerHTML; };
|
||||
const thStyle = 'border:1px solid #333; padding:10px 14px; background:#f8f9fa; font-weight:600; text-align:left; white-space:nowrap; width:120px; font-size:14px;';
|
||||
const tdStyle = 'border:1px solid #333; padding:10px 14px; font-size:14px;';
|
||||
const thStyle = 'border:1px solid #333; padding:16px 18px; background:#f8f9fa; font-weight:600; text-align:left; white-space:nowrap; width:140px; font-size:16px;';
|
||||
const tdStyle = 'border:1px solid #333; padding:16px 18px; font-size:16px;';
|
||||
|
||||
return `
|
||||
<h1 style="text-align:center; font-size:28px; font-weight:700; letter-spacing:12px; margin-bottom:40px;">사 직 서</h1>
|
||||
<h1 style="text-align:center; font-size:30px; font-weight:700; letter-spacing:14px; margin-bottom:60px;">사 직 서</h1>
|
||||
|
||||
<table style="border-collapse:collapse; width:100%; margin-bottom:20px;">
|
||||
<table style="border-collapse:collapse; width:100%; margin-bottom:60px;">
|
||||
<tr>
|
||||
<th style="${thStyle}">소 속</th>
|
||||
<td style="${tdStyle}">${e(d.department)}</td>
|
||||
@@ -1465,21 +1465,21 @@ function buildResignationPreviewHtml(d) {
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p style="text-align:center; font-size:15px; line-height:1.8; margin:36px 0;">
|
||||
<p style="text-align:center; font-size:16px; line-height:2; margin:80px 0;">
|
||||
상기 본인은 위 사유로 인하여 사직하고자<br>
|
||||
이에 사직서를 제출하오니 허가하여 주시기 바랍니다.
|
||||
</p>
|
||||
|
||||
<p style="text-align:center; font-size:15px; font-weight:500; margin-bottom:24px;">
|
||||
<p style="text-align:center; font-size:16px; font-weight:500; margin-bottom:40px;">
|
||||
${e(d.issueDateFormatted)}
|
||||
</p>
|
||||
|
||||
<p style="text-align:center; font-size:14px; margin-bottom:48px;">
|
||||
<p style="text-align:center; font-size:15px; margin-bottom:80px;">
|
||||
신청인 ${e(d.name)} (인)
|
||||
</p>
|
||||
|
||||
<div style="text-align:center; margin-top:32px;">
|
||||
<p style="font-size:16px; font-weight:600;">${e(d.company)} 대표이사 귀하</p>
|
||||
<div style="text-align:center; margin-top:60px;">
|
||||
<p style="font-size:18px; font-weight:600;">${e(d.company)} 대표이사 귀하</p>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -531,33 +531,33 @@ function printResignationShowPreview() {
|
||||
const content = document.getElementById('resignation-show-preview-content').innerHTML;
|
||||
const win = window.open('', '_blank', 'width=800,height=1000');
|
||||
win.document.write('<html><head><title>사직서</title>');
|
||||
win.document.write('<style>body{font-family:"Pretendard","Malgun Gothic",sans-serif;padding:48px 56px;margin:0;} table{border-collapse:collapse;width:100%;} th,td{border:1px solid #333;padding:10px 14px;font-size:14px;} th{background:#f8f9fa;font-weight:600;text-align:left;white-space:nowrap;width:120px;} @media print{body{padding:40px 48px;}}</style>');
|
||||
win.document.write('</head><body>');
|
||||
win.document.write('<style>@page{size:A4;margin:0;} body{font-family:"Pretendard","Malgun Gothic",sans-serif;margin:0;padding:0;} .cert-page{padding:100px 56px 60px;box-sizing:border-box;} table{border-collapse:collapse;width:100%;} th,td{border:1px solid #333;padding:16px 18px;font-size:16px;} th{background:#f8f9fa;font-weight:600;text-align:left;white-space:nowrap;width:140px;}</style>');
|
||||
win.document.write('</head><body><div class="cert-page">');
|
||||
win.document.write(content);
|
||||
win.document.write('</body></html>');
|
||||
win.document.write('</div></body></html>');
|
||||
win.document.close();
|
||||
win.onload = function() { win.print(); };
|
||||
}
|
||||
|
||||
function _buildResignationHtml(d) {
|
||||
const e = (s) => { const div = document.createElement('div'); div.textContent = s; return div.innerHTML; };
|
||||
const thStyle = 'border:1px solid #333; padding:10px 14px; background:#f8f9fa; font-weight:600; text-align:left; white-space:nowrap; width:120px; font-size:14px;';
|
||||
const tdStyle = 'border:1px solid #333; padding:10px 14px; font-size:14px;';
|
||||
const thStyle = 'border:1px solid #333; padding:16px 18px; background:#f8f9fa; font-weight:600; text-align:left; white-space:nowrap; width:140px; font-size:16px;';
|
||||
const tdStyle = 'border:1px solid #333; padding:16px 18px; font-size:16px;';
|
||||
|
||||
return `
|
||||
<h1 style="text-align:center; font-size:28px; font-weight:700; letter-spacing:12px; margin-bottom:40px;">사 직 서</h1>
|
||||
<table style="border-collapse:collapse; width:100%; margin-bottom:20px;">
|
||||
<h1 style="text-align:center; font-size:30px; font-weight:700; letter-spacing:14px; margin-bottom:60px;">사 직 서</h1>
|
||||
<table style="border-collapse:collapse; width:100%; margin-bottom:60px;">
|
||||
<tr><th style="${thStyle}">소 속</th><td style="${tdStyle}">${e(d.department)}</td><th style="${thStyle}">직 위</th><td style="${tdStyle}">${e(d.position)}</td></tr>
|
||||
<tr><th style="${thStyle}">성 명</th><td style="${tdStyle}">${e(d.name)}</td><th style="${thStyle}">주민등록번호</th><td style="${tdStyle}">${e(d.resident)}</td></tr>
|
||||
<tr><th style="${thStyle}">입사일</th><td style="${tdStyle}">${e(d.hireDate)}</td><th style="${thStyle}">퇴사(예정)일</th><td style="${tdStyle}">${e(d.resignDate)}</td></tr>
|
||||
<tr><th style="${thStyle}">주 소</th><td style="${tdStyle}" colspan="3">${e(d.address)}</td></tr>
|
||||
<tr><th style="${thStyle}">사 유</th><td style="${tdStyle}" colspan="3">${e(d.reason)}</td></tr>
|
||||
</table>
|
||||
<p style="text-align:center; font-size:15px; line-height:1.8; margin:36px 0;">상기 본인은 위 사유로 인하여 사직하고자<br>이에 사직서를 제출하오니 허가하여 주시기 바랍니다.</p>
|
||||
<p style="text-align:center; font-size:15px; font-weight:500; margin-bottom:24px;">${e(d.issueDateFormatted)}</p>
|
||||
<p style="text-align:center; font-size:14px; margin-bottom:48px;">신청인 ${e(d.name)} (인)</p>
|
||||
<div style="text-align:center; margin-top:32px;">
|
||||
<p style="font-size:16px; font-weight:600;">${e(d.company)} 대표이사 귀하</p>
|
||||
<p style="text-align:center; font-size:16px; line-height:2; margin:80px 0;">상기 본인은 위 사유로 인하여 사직하고자<br>이에 사직서를 제출하오니 허가하여 주시기 바랍니다.</p>
|
||||
<p style="text-align:center; font-size:16px; font-weight:500; margin-bottom:40px;">${e(d.issueDateFormatted)}</p>
|
||||
<p style="text-align:center; font-size:15px; margin-bottom:80px;">신청인 ${e(d.name)} (인)</p>
|
||||
<div style="text-align:center; margin-top:60px;">
|
||||
<p style="font-size:18px; font-weight:600;">${e(d.company)} 대표이사 귀하</p>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user