feat: [approval] 위임장 양식 추가

- 위임장 전용 폼(_delegation-form.blade.php) 생성
- 위임장 읽기전용 뷰(_delegation-show.blade.php) 생성
- create/edit/show 페이지에 위임장 통합
- 미리보기/인쇄 기능 포함
- 인사/근태 카테고리에 배치
This commit is contained in:
김보곤
2026-03-06 22:25:00 +09:00
parent 810c1f67dd
commit 1ccf97ce6b
5 changed files with 709 additions and 5 deletions

View File

@@ -135,6 +135,11 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-
'tenantInfo' => $tenantInfo ?? [],
])
{{-- 위임장 전용 --}}
@include('approvals.partials._delegation-form', [
'tenantInfo' => $tenantInfo ?? [],
])
{{-- 지출결의서 전용 --}}
@include('approvals.partials._expense-form', [
'initialData' => [],
@@ -314,6 +319,11 @@ class="p-1 text-gray-400 hover:text-gray-600 transition">
color: 'border-rose-200 bg-rose-50', titleColor: 'text-rose-800', textColor: 'text-rose-600',
text: '법인인감, 사용인감 등 회사 인감의 사용을 신청하는 문서입니다. 인감 종류, 용도, 제출처를 기재하며, 승인 후 인감을 사용할 수 있습니다.',
},
delegation: {
title: '위임장', icon: '📜',
color: 'border-amber-200 bg-amber-50', titleColor: 'text-amber-800', textColor: 'text-amber-600',
text: '법인의 업무를 대리인에게 위임하는 문서입니다. 위임인(회사), 수임인(대리인), 위임사항, 위임기간을 기재하며, 승인 후 위임장으로 사용할 수 있습니다.',
},
pr_expense: {
title: '지출품의서', icon: '📋',
color: 'border-orange-200 bg-orange-50', titleColor: 'text-orange-800', textColor: 'text-orange-700',
@@ -344,7 +354,7 @@ class="p-1 text-gray-400 hover:text-gray-600 transition">
// 2단계 분류 정의 (코드 → 카테고리)
const formCategoryMap = {
BUSINESS_DRAFT: '일반',
leave: '인사/근태', attendance_request: '인사/근태', resignation: '인사/근태', reason_report: '인사/근태',
leave: '인사/근태', attendance_request: '인사/근태', resignation: '인사/근태', reason_report: '인사/근태', delegation: '인사/근태',
employment_cert: '증명서', career_cert: '증명서', appointment_cert: '증명서', seal_usage: '증명서',
pr_expense: '품의', pr_contract: '품의', pr_purchase: '품의', pr_trip: '품의', pr_settlement: '품의',
expense: '재무',
@@ -432,6 +442,7 @@ function updateFormDescription(formId) {
let isAppointmentCertForm = false;
let isResignationForm = false;
let isSealUsageForm = false;
let isDelegationForm = false;
// 양식코드별 표시할 유형 목록
const leaveTypesByFormCode = {
@@ -681,6 +692,7 @@ function switchFormMode(formId) {
const appointmentCertContainer = document.getElementById('appointment-cert-form-container');
const resignationContainer = document.getElementById('resignation-form-container');
const sealUsageContainer = document.getElementById('seal-usage-form-container');
const delegationContainer = document.getElementById('delegation-form-container');
const bodyArea = document.getElementById('body-area');
const expenseLoadBtn = document.getElementById('expense-load-btn');
@@ -695,6 +707,7 @@ function switchFormMode(formId) {
appointmentCertContainer.style.display = 'none';
resignationContainer.style.display = 'none';
sealUsageContainer.style.display = 'none';
delegationContainer.style.display = 'none';
expenseLoadBtn.style.display = 'none';
bodyArea.style.display = 'none';
isExpenseForm = false;
@@ -705,6 +718,7 @@ function switchFormMode(formId) {
isAppointmentCertForm = false;
isResignationForm = false;
isSealUsageForm = false;
isDelegationForm = false;
if (code === 'expense') {
isExpenseForm = true;
@@ -767,6 +781,9 @@ function switchFormMode(formId) {
} else if (code === 'seal_usage') {
isSealUsageForm = true;
sealUsageContainer.style.display = '';
} else if (code === 'delegation') {
isDelegationForm = true;
delegationContainer.style.display = '';
} else {
bodyArea.style.display = '';
}
@@ -777,7 +794,7 @@ function applyBodyTemplate(formId) {
switchFormMode(formId);
// 전용 폼이면 제목을 양식명으로 설정하고 body template 적용 건너뜀
if (isExpenseForm || isPurchaseRequestForm || isLeaveForm || isCertForm || isCareerCertForm || isAppointmentCertForm || isResignationForm || isSealUsageForm) {
if (isExpenseForm || isPurchaseRequestForm || isLeaveForm || isCertForm || isCareerCertForm || isAppointmentCertForm || isResignationForm || isSealUsageForm || isDelegationForm) {
const titleEl = document.getElementById('title');
const formSelect = document.getElementById('form_id');
titleEl.value = formSelect.options[formSelect.selectedIndex].text;
@@ -994,6 +1011,29 @@ function applyBodyTemplate(formId) {
company_address: document.getElementById('su-company-address').value,
};
formBody = null;
} else if (isDelegationForm) {
const dlAgentName = document.getElementById('dl-agent-name').value.trim();
if (!dlAgentName) {
showToast('수임인(대리인) 성명을 입력해주세요.', 'warning');
return;
}
formContent = {
company_name: document.getElementById('dl-company-name').value,
business_num: document.getElementById('dl-business-num').value,
ceo_name: document.getElementById('dl-ceo-name').value,
company_address: document.getElementById('dl-company-address').value,
agent_name: dlAgentName,
agent_birth: document.getElementById('dl-agent-birth').value,
agent_address: document.getElementById('dl-agent-address').value.trim(),
agent_phone: document.getElementById('dl-agent-phone').value.trim(),
agent_department: document.getElementById('dl-agent-department').value.trim(),
delegation_detail: document.getElementById('dl-delegation-detail').value.trim(),
period_start: document.getElementById('dl-period-start').value,
period_end: document.getElementById('dl-period-end').value,
attachments_desc: document.getElementById('dl-attachments-desc').value.trim(),
};
formBody = null;
} else if (isResignationForm) {
const reason = getResignationReason();
if (!reason) {
@@ -1919,5 +1959,110 @@ function printSealUsagePreview() {
win.document.close();
win.print();
}
// ── 위임장 미리보기 ──
function buildDelegationPreviewHtml(data) {
return `
<div style="text-align: center; margin-bottom: 36px;">
<h1 style="font-size: 28px; font-weight: 800; letter-spacing: 8px;">위 임 장</h1>
</div>
<table style="width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 24px;">
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; width: 100px; text-align: center;" rowspan="4">위임인</td>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; width: 100px; text-align: center;">법인명</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.company_name || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">사업자등록번호</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.business_num || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">주소</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.company_address || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">대표자</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.ceo_name || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;" rowspan="5">수임인</td>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">성명</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_name || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">생년월일</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_birth || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">주소</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_address || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">연락처</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_phone || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">소속</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_department || ''}</td>
</tr>
</table>
<div style="margin-bottom: 20px;">
<div style="font-weight: 600; font-size: 14px; margin-bottom: 8px; border-bottom: 2px solid #333; padding-bottom: 4px;">위임사항</div>
<div style="font-size: 13px; line-height: 1.8; white-space: pre-wrap; padding: 8px 4px;">${data.delegation_detail || ''}</div>
</div>
<div style="margin-bottom: 20px;">
<div style="font-weight: 600; font-size: 14px; margin-bottom: 8px; border-bottom: 2px solid #333; padding-bottom: 4px;">위임기간</div>
<div style="font-size: 13px; padding: 8px 4px;">${data.period_start || ''} ~ ${data.period_end || ''}</div>
</div>
${data.attachments_desc ? `
<div style="margin-bottom: 20px;">
<div style="font-weight: 600; font-size: 14px; margin-bottom: 8px; border-bottom: 2px solid #333; padding-bottom: 4px;">첨부서류</div>
<div style="font-size: 13px; line-height: 1.8; white-space: pre-wrap; padding: 8px 4px;">${data.attachments_desc}</div>
</div>` : ''}
<div style="text-align: center; margin-top: 40px; font-size: 13px;">
<p>위와 같이 권한을 위임합니다.</p>
<p style="margin-top: 24px; font-size: 14px; font-weight: 600;">${data.company_name || ''}</p>
<p style="margin-top: 4px;">대표이사 ${data.ceo_name || ''} (인)</p>
</div>
`;
}
function openDelegationPreview() {
const data = {
company_name: document.getElementById('dl-company-name').value,
business_num: document.getElementById('dl-business-num').value,
ceo_name: document.getElementById('dl-ceo-name').value,
company_address: document.getElementById('dl-company-address').value,
agent_name: document.getElementById('dl-agent-name').value,
agent_birth: document.getElementById('dl-agent-birth').value,
agent_address: document.getElementById('dl-agent-address').value,
agent_phone: document.getElementById('dl-agent-phone').value,
agent_department: document.getElementById('dl-agent-department').value,
delegation_detail: document.getElementById('dl-delegation-detail').value,
period_start: document.getElementById('dl-period-start').value,
period_end: document.getElementById('dl-period-end').value,
attachments_desc: document.getElementById('dl-attachments-desc').value,
};
document.getElementById('delegation-preview-content').innerHTML = buildDelegationPreviewHtml(data);
document.getElementById('delegation-preview-modal').style.display = '';
document.body.style.overflow = 'hidden';
}
function closeDelegationPreview() {
document.getElementById('delegation-preview-modal').style.display = 'none';
document.body.style.overflow = '';
}
function printDelegationPreview() {
const content = document.getElementById('delegation-preview-content').innerHTML;
const win = window.open('', '_blank');
win.document.write('<html><head><title>위임장</title>');
win.document.write('<style>body{font-family:"Pretendard","Malgun Gothic",sans-serif;padding:48px 56px;margin:0;}@media print{body{padding:40px 48px;}}</style>');
win.document.write('</head><body>');
win.document.write(content);
win.document.write('</body></html>');
win.document.close();
win.print();
}
</script>
@endpush

View File

@@ -153,6 +153,11 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-
'tenantInfo' => $tenantInfo ?? [],
])
{{-- 위임장 전용 --}}
@include('approvals.partials._delegation-form', [
'tenantInfo' => $tenantInfo ?? [],
])
{{-- 지출결의서 전용 --}}
@php
$existingFiles = [];
@@ -290,6 +295,7 @@ class="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm fon
let isPurchaseRequestForm = false;
let isCertForm = false;
let isSealUsageForm = false;
let isDelegationForm = false;
const formDescriptions = {
BUSINESS_DRAFT: {
@@ -342,6 +348,11 @@ class="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm fon
color: 'border-rose-200 bg-rose-50', titleColor: 'text-rose-800', textColor: 'text-rose-600',
text: '법인인감, 사용인감 등 회사 인감의 사용을 신청하는 문서입니다. 인감 종류, 용도, 제출처를 기재하며, 승인 후 인감을 사용할 수 있습니다.',
},
delegation: {
title: '위임장', icon: '📜',
color: 'border-amber-200 bg-amber-50', titleColor: 'text-amber-800', textColor: 'text-amber-600',
text: '법인의 업무를 대리인에게 위임하는 문서입니다. 위임인(회사), 수임인(대리인), 위임사항, 위임기간을 기재하며, 승인 후 위임장으로 사용할 수 있습니다.',
},
pr_expense: {
title: '지출품의서', icon: '📋',
color: 'border-orange-200 bg-orange-50', titleColor: 'text-orange-800', textColor: 'text-orange-700',
@@ -372,7 +383,7 @@ class="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm fon
// 2단계 분류 정의
const formCategoryMap = {
BUSINESS_DRAFT: '일반',
leave: '인사/근태', attendance_request: '인사/근태', resignation: '인사/근태', reason_report: '인사/근태',
leave: '인사/근태', attendance_request: '인사/근태', resignation: '인사/근태', reason_report: '인사/근태', delegation: '인사/근태',
employment_cert: '증명서', career_cert: '증명서', appointment_cert: '증명서', seal_usage: '증명서',
pr_expense: '품의', pr_contract: '품의', pr_purchase: '품의', pr_trip: '품의', pr_settlement: '품의',
expense: '재무',
@@ -613,17 +624,20 @@ function switchFormMode(formId) {
const purchaseRequestContainer = document.getElementById('purchase-request-form-container');
const certContainer = document.getElementById('cert-form-container');
const sealUsageContainer = document.getElementById('seal-usage-form-container');
const delegationContainer = document.getElementById('delegation-form-container');
const bodyArea = document.getElementById('body-area');
expenseContainer.style.display = 'none';
purchaseRequestContainer.style.display = 'none';
certContainer.style.display = 'none';
sealUsageContainer.style.display = 'none';
delegationContainer.style.display = 'none';
bodyArea.style.display = 'none';
isExpenseForm = false;
isPurchaseRequestForm = false;
isCertForm = false;
isSealUsageForm = false;
isDelegationForm = false;
if (code === 'expense') {
isExpenseForm = true;
@@ -643,6 +657,9 @@ function switchFormMode(formId) {
} else if (code === 'seal_usage') {
isSealUsageForm = true;
sealUsageContainer.style.display = '';
} else if (code === 'delegation') {
isDelegationForm = true;
delegationContainer.style.display = '';
} else {
bodyArea.style.display = '';
}
@@ -653,7 +670,7 @@ function applyBodyTemplate(formId) {
switchFormMode(formId);
// 전용 폼이면 제목만 자동 설정하고 body template 적용 건너뜀
if (isExpenseForm || isPurchaseRequestForm || isCertForm || isSealUsageForm) {
if (isExpenseForm || isPurchaseRequestForm || isCertForm || isSealUsageForm || isDelegationForm) {
const titleEl = document.getElementById('title');
if (!titleEl.value.trim()) {
const formSelect = document.getElementById('form_id');
@@ -759,8 +776,24 @@ function applyBodyTemplate(formId) {
}
}
// 위임장 기존 데이터 복원
if (isDelegationForm) {
const dlContent = @json($approval->content ?? []);
if (dlContent.agent_name) {
document.getElementById('dl-agent-name').value = dlContent.agent_name || '';
document.getElementById('dl-agent-birth').value = dlContent.agent_birth || '';
document.getElementById('dl-agent-address').value = dlContent.agent_address || '';
document.getElementById('dl-agent-phone').value = dlContent.agent_phone || '';
document.getElementById('dl-agent-department').value = dlContent.agent_department || '';
document.getElementById('dl-delegation-detail').value = dlContent.delegation_detail || '';
document.getElementById('dl-period-start').value = dlContent.period_start || '';
document.getElementById('dl-period-end').value = dlContent.period_end || '';
document.getElementById('dl-attachments-desc').value = dlContent.attachments_desc || '';
}
}
// 전용 폼이 아닌 경우에만 Quill 편집기 자동 활성화
if (!isExpenseForm && !isPurchaseRequestForm && !isCertForm && !isSealUsageForm) {
if (!isExpenseForm && !isPurchaseRequestForm && !isCertForm && !isSealUsageForm && !isDelegationForm) {
const existingBody = document.getElementById('body').value;
if (/<[a-z][\s\S]*>/i.test(existingBody)) {
document.getElementById('useEditor').checked = true;
@@ -857,6 +890,29 @@ function applyBodyTemplate(formId) {
company_address: document.getElementById('su-company-address').value,
};
formBody = null;
} else if (isDelegationForm) {
const dlAgentName = document.getElementById('dl-agent-name').value.trim();
if (!dlAgentName) {
showToast('수임인(대리인) 성명을 입력해주세요.', 'warning');
return;
}
formContent = {
company_name: document.getElementById('dl-company-name').value,
business_num: document.getElementById('dl-business-num').value,
ceo_name: document.getElementById('dl-ceo-name').value,
company_address: document.getElementById('dl-company-address').value,
agent_name: dlAgentName,
agent_birth: document.getElementById('dl-agent-birth').value,
agent_address: document.getElementById('dl-agent-address').value.trim(),
agent_phone: document.getElementById('dl-agent-phone').value.trim(),
agent_department: document.getElementById('dl-agent-department').value.trim(),
delegation_detail: document.getElementById('dl-delegation-detail').value.trim(),
period_start: document.getElementById('dl-period-start').value,
period_end: document.getElementById('dl-period-end').value,
attachments_desc: document.getElementById('dl-attachments-desc').value.trim(),
};
formBody = null;
}
const payload = {
@@ -1189,5 +1245,110 @@ function printSealUsagePreview() {
win.document.close();
win.print();
}
// ── 위임장 미리보기 ──
function buildDelegationPreviewHtml(data) {
return `
<div style="text-align: center; margin-bottom: 36px;">
<h1 style="font-size: 28px; font-weight: 800; letter-spacing: 8px;">위 임 장</h1>
</div>
<table style="width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 24px;">
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; width: 100px; text-align: center;" rowspan="4">위임인</td>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; width: 100px; text-align: center;">법인명</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.company_name || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">사업자등록번호</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.business_num || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">주소</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.company_address || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">대표자</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.ceo_name || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;" rowspan="5">수임인</td>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">성명</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_name || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">생년월일</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_birth || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">주소</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_address || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">연락처</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_phone || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">소속</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_department || ''}</td>
</tr>
</table>
<div style="margin-bottom: 20px;">
<div style="font-weight: 600; font-size: 14px; margin-bottom: 8px; border-bottom: 2px solid #333; padding-bottom: 4px;">위임사항</div>
<div style="font-size: 13px; line-height: 1.8; white-space: pre-wrap; padding: 8px 4px;">${data.delegation_detail || ''}</div>
</div>
<div style="margin-bottom: 20px;">
<div style="font-weight: 600; font-size: 14px; margin-bottom: 8px; border-bottom: 2px solid #333; padding-bottom: 4px;">위임기간</div>
<div style="font-size: 13px; padding: 8px 4px;">${data.period_start || ''} ~ ${data.period_end || ''}</div>
</div>
${data.attachments_desc ? `
<div style="margin-bottom: 20px;">
<div style="font-weight: 600; font-size: 14px; margin-bottom: 8px; border-bottom: 2px solid #333; padding-bottom: 4px;">첨부서류</div>
<div style="font-size: 13px; line-height: 1.8; white-space: pre-wrap; padding: 8px 4px;">${data.attachments_desc}</div>
</div>` : ''}
<div style="text-align: center; margin-top: 40px; font-size: 13px;">
<p>위와 같이 권한을 위임합니다.</p>
<p style="margin-top: 24px; font-size: 14px; font-weight: 600;">${data.company_name || ''}</p>
<p style="margin-top: 4px;">대표이사 ${data.ceo_name || ''} (인)</p>
</div>
`;
}
function openDelegationPreview() {
const data = {
company_name: document.getElementById('dl-company-name').value,
business_num: document.getElementById('dl-business-num').value,
ceo_name: document.getElementById('dl-ceo-name').value,
company_address: document.getElementById('dl-company-address').value,
agent_name: document.getElementById('dl-agent-name').value,
agent_birth: document.getElementById('dl-agent-birth').value,
agent_address: document.getElementById('dl-agent-address').value,
agent_phone: document.getElementById('dl-agent-phone').value,
agent_department: document.getElementById('dl-agent-department').value,
delegation_detail: document.getElementById('dl-delegation-detail').value,
period_start: document.getElementById('dl-period-start').value,
period_end: document.getElementById('dl-period-end').value,
attachments_desc: document.getElementById('dl-attachments-desc').value,
};
document.getElementById('delegation-preview-content').innerHTML = buildDelegationPreviewHtml(data);
document.getElementById('delegation-preview-modal').style.display = '';
document.body.style.overflow = 'hidden';
}
function closeDelegationPreview() {
document.getElementById('delegation-preview-modal').style.display = 'none';
document.body.style.overflow = '';
}
function printDelegationPreview() {
const content = document.getElementById('delegation-preview-content').innerHTML;
const win = window.open('', '_blank');
win.document.write('<html><head><title>위임장</title>');
win.document.write('<style>body{font-family:"Pretendard","Malgun Gothic",sans-serif;padding:48px 56px;margin:0;}@media print{body{padding:40px 48px;}}</style>');
win.document.write('</head><body>');
win.document.write(content);
win.document.write('</body></html>');
win.document.close();
win.print();
}
</script>
@endpush

View File

@@ -0,0 +1,171 @@
{{--
위임장 전용
Props:
$tenantInfo (array) - 테넌트(회사) 정보
--}}
@php
$tenantInfo = $tenantInfo ?? [];
@endphp
<div id="delegation-form-container" style="display: none;" class="mb-4">
<input type="hidden" id="dl-company-name" value="{{ $tenantInfo['company_name'] ?? '' }}">
<input type="hidden" id="dl-business-num" value="{{ $tenantInfo['business_num'] ?? '' }}">
<input type="hidden" id="dl-ceo-name" value="{{ $tenantInfo['ceo_name'] ?? '' }}">
<input type="hidden" id="dl-company-address" value="{{ $tenantInfo['address'] ?? '' }}">
<div class="space-y-4">
{{-- 1. 위임인 (회사 정보 - 읽기전용) --}}
<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 space-y-3">
<div class="flex gap-4 flex-wrap">
<div style="flex: 1 1 250px;">
<label class="block text-xs font-medium text-gray-500 mb-1">법인명</label>
<input type="text" id="dl-company-display" readonly value="{{ $tenantInfo['company_name'] ?? '' }}"
class="w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-gray-50 text-gray-700">
</div>
<div style="flex: 1 1 200px; max-width: 250px;">
<label class="block text-xs font-medium text-gray-500 mb-1">사업자등록번호</label>
<input type="text" id="dl-business-display" readonly value="{{ $tenantInfo['business_num'] ?? '' }}"
class="w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-gray-50 text-gray-700">
</div>
</div>
<div>
<label class="block text-xs font-medium text-gray-500 mb-1">주소</label>
<input type="text" id="dl-address-display" readonly value="{{ $tenantInfo['address'] ?? '' }}"
class="w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-gray-50 text-gray-700">
</div>
<div style="max-width: 250px;">
<label class="block text-xs font-medium text-gray-500 mb-1">대표자</label>
<input type="text" id="dl-ceo-display" readonly value="{{ $tenantInfo['ceo_name'] ?? '' }}"
class="w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-gray-50 text-gray-700">
</div>
</div>
</div>
{{-- 2. 수임인 (대리인 정보 - 입력) --}}
<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 space-y-3">
<div class="flex gap-4 flex-wrap">
<div style="flex: 1 1 200px; max-width: 250px;">
<label class="block text-xs font-medium text-gray-500 mb-1">성명 <span class="text-red-500">*</span></label>
<input type="text" id="dl-agent-name" placeholder="대리인 성명"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div style="flex: 1 1 200px; max-width: 250px;">
<label class="block text-xs font-medium text-gray-500 mb-1">생년월일</label>
<input type="date" id="dl-agent-birth"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
</div>
<div>
<label class="block text-xs font-medium text-gray-500 mb-1">주소</label>
<input type="text" id="dl-agent-address" placeholder="대리인 주소"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div class="flex gap-4 flex-wrap">
<div style="flex: 1 1 200px; max-width: 250px;">
<label class="block text-xs font-medium text-gray-500 mb-1">연락처</label>
<input type="text" id="dl-agent-phone" placeholder="010-0000-0000"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div style="flex: 1 1 200px; max-width: 250px;">
<label class="block text-xs font-medium text-gray-500 mb-1">소속</label>
<input type="text" id="dl-agent-department" placeholder="소속 부서"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
</div>
</div>
</div>
{{-- 3. 위임사항 --}}
<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">
<textarea id="dl-delegation-detail" rows="3" placeholder="예: 법인 휴대폰 개통 및 변경 업무에 대하여 상기 대리인에게 권한을 위임합니다."
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>
</div>
</div>
{{-- 4. 위임기간 --}}
<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">4. 위임기간</h3>
</div>
<div class="p-4">
<div class="flex gap-3 items-center flex-wrap">
<div style="flex: 1 1 180px; max-width: 200px;">
<input type="date" id="dl-period-start" value="{{ now()->format('Y-m-d') }}"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<span class="text-gray-400 text-sm">~</span>
<div style="flex: 1 1 180px; max-width: 200px;">
<input type="date" id="dl-period-end" value="{{ now()->format('Y-m-d') }}"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
</div>
</div>
</div>
{{-- 5. 첨부서류 --}}
<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">5. 첨부서류</h3>
</div>
<div class="p-4">
<textarea id="dl-attachments-desc" rows="3" placeholder="예:&#10;- 인감증명서 1부&#10;- 대리인 신분증 1부&#10;- 재직증명서 1부"
class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>
</div>
</div>
{{-- 미리보기 버튼 --}}
<div class="flex justify-end">
<button type="button" onclick="openDelegationPreview()"
class="px-3 py-2 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>
</div>
</div>
</div>
{{-- 위임장 미리보기 모달 --}}
<div id="delegation-preview-modal" style="display: none;" class="fixed inset-0 z-50">
<div class="absolute inset-0 bg-black/50" onclick="closeDelegationPreview()"></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="printDelegationPreview()"
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="closeDelegationPreview()"
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="delegation-preview-content" style="padding: 48px 56px; font-family: 'Pretendard', 'Malgun Gothic', sans-serif;">
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,225 @@
{{--
위임장 읽기전용 렌더링
Props:
$content (array) - approvals.content JSON
--}}
<div class="space-y-4">
{{-- 미리보기 버튼 --}}
<div class="flex justify-end gap-2">
<button type="button" onclick="openDelegationShowPreview()"
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>
</div>
{{-- 1. 위임인 --}}
<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['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 style="grid-column: 1 / -1;">
<span class="text-xs text-gray-500">주소</span>
<div class="text-sm font-medium mt-0.5">{{ $content['company_address'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">대표자</span>
<div class="text-sm font-medium mt-0.5">{{ $content['ceo_name'] ?? '-' }}</div>
</div>
</div>
</div>
</div>
{{-- 2. 수임인 (대리인) --}}
<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['agent_name'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">생년월일</span>
<div class="text-sm font-medium mt-0.5">{{ $content['agent_birth'] ?? '-' }}</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['agent_address'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">연락처</span>
<div class="text-sm font-medium mt-0.5">{{ $content['agent_phone'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">소속</span>
<div class="text-sm font-medium mt-0.5">{{ $content['agent_department'] ?? '-' }}</div>
</div>
</div>
</div>
</div>
{{-- 3. 위임사항 --}}
<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="text-sm text-gray-700 whitespace-pre-wrap">{{ $content['delegation_detail'] ?? '-' }}</div>
</div>
</div>
{{-- 4. 위임기간 --}}
<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">4. 위임기간</h3>
</div>
<div class="p-4">
<div class="text-sm font-medium">{{ $content['period_start'] ?? '-' }} ~ {{ $content['period_end'] ?? '-' }}</div>
</div>
</div>
{{-- 5. 첨부서류 --}}
@if(!empty($content['attachments_desc']))
<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">5. 첨부서류</h3>
</div>
<div class="p-4">
<div class="text-sm text-gray-700 whitespace-pre-wrap">{{ $content['attachments_desc'] }}</div>
</div>
</div>
@endif
</div>
{{-- 미리보기 모달 --}}
<div id="delegation-show-preview-modal" style="display: none;" class="fixed inset-0 z-50">
<div class="absolute inset-0 bg-black/50" onclick="closeDelegationShowPreview()"></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="printDelegationShowPreview()"
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="closeDelegationShowPreview()"
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="delegation-show-preview-content" style="padding: 48px 56px; font-family: 'Pretendard', 'Malgun Gothic', sans-serif;">
</div>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
function buildDelegationShowPreviewHtml() {
const data = @json($content);
return `
<div style="text-align: center; margin-bottom: 36px;">
<h1 style="font-size: 28px; font-weight: 800; letter-spacing: 8px;">위 임 장</h1>
</div>
<table style="width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 24px;">
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; width: 100px; text-align: center;" rowspan="4">위임인</td>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; width: 100px; text-align: center;">법인명</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.company_name || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">사업자등록번호</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.business_num || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">주소</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.company_address || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">대표자</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.ceo_name || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;" rowspan="5">수임인</td>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">성명</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_name || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">생년월일</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_birth || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">주소</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_address || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">연락처</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_phone || ''}</td>
</tr>
<tr>
<td style="border: 1px solid #333; background: #f5f5f5; padding: 8px 12px; font-weight: 600; text-align: center;">소속</td>
<td style="border: 1px solid #333; padding: 8px 12px;" colspan="3">${data.agent_department || ''}</td>
</tr>
</table>
<div style="margin-bottom: 20px;">
<div style="font-weight: 600; font-size: 14px; margin-bottom: 8px; border-bottom: 2px solid #333; padding-bottom: 4px;">위임사항</div>
<div style="font-size: 13px; line-height: 1.8; white-space: pre-wrap; padding: 8px 4px;">${data.delegation_detail || ''}</div>
</div>
<div style="margin-bottom: 20px;">
<div style="font-weight: 600; font-size: 14px; margin-bottom: 8px; border-bottom: 2px solid #333; padding-bottom: 4px;">위임기간</div>
<div style="font-size: 13px; padding: 8px 4px;">${data.period_start || ''} ~ ${data.period_end || ''}</div>
</div>
${data.attachments_desc ? `
<div style="margin-bottom: 20px;">
<div style="font-weight: 600; font-size: 14px; margin-bottom: 8px; border-bottom: 2px solid #333; padding-bottom: 4px;">첨부서류</div>
<div style="font-size: 13px; line-height: 1.8; white-space: pre-wrap; padding: 8px 4px;">${data.attachments_desc}</div>
</div>` : ''}
<div style="text-align: center; margin-top: 40px; font-size: 13px;">
<p>위와 같이 권한을 위임합니다.</p>
<p style="margin-top: 24px; font-size: 14px; font-weight: 600;">${data.company_name || ''}</p>
<p style="margin-top: 4px;">대표이사 ${data.ceo_name || ''} (인)</p>
</div>
`;
}
function openDelegationShowPreview() {
document.getElementById('delegation-show-preview-content').innerHTML = buildDelegationShowPreviewHtml();
document.getElementById('delegation-show-preview-modal').style.display = '';
}
function closeDelegationShowPreview() {
document.getElementById('delegation-show-preview-modal').style.display = 'none';
}
function printDelegationShowPreview() {
const content = document.getElementById('delegation-show-preview-content').innerHTML;
const win = window.open('', '_blank');
win.document.write('<html><head><title>위임장</title><style>body{font-family:"Pretendard","Malgun Gothic",sans-serif;padding:48px 56px;}@media print{body{padding:20px 30px;}}</style></head><body>' + content + '</body></html>');
win.document.close();
win.print();
}
</script>
@endpush

View File

@@ -115,6 +115,8 @@ class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg transition
@include('approvals.partials._resignation-show', ['content' => $approval->content])
@elseif(!empty($approval->content) && $approval->form?->code === 'seal_usage')
@include('approvals.partials._seal-usage-show', ['content' => $approval->content])
@elseif(!empty($approval->content) && $approval->form?->code === 'delegation')
@include('approvals.partials._delegation-show', ['content' => $approval->content])
@elseif($approval->body && preg_match('/<[a-z][\s\S]*>/i', $approval->body))
<div class="prose prose-sm max-w-none text-gray-700">
{!! strip_tags($approval->body, '<p><br><strong><b><em><i><u><s><del><h1><h2><h3><h4><h5><h6><ul><ol><li><blockquote><pre><code><a><span><div><table><thead><tbody><tr><th><td>') !!}