diff --git a/resources/views/hr/leave-promotions/index.blade.php b/resources/views/hr/leave-promotions/index.blade.php index b29a5175..8b28f8ed 100644 --- a/resources/views/hr/leave-promotions/index.blade.php +++ b/resources/views/hr/leave-promotions/index.blade.php @@ -149,18 +149,32 @@ class="employee-checkbox rounded border-gray-300 text-blue-600" @if ($candidate->first_notice) - - {{ $candidate->first_notice->created_at->format('m/d') }} - + @else - @endif @if ($candidate->second_notice) - - {{ $candidate->second_notice->created_at->format('m/d') }} - + @else - @endif @@ -237,6 +251,47 @@ class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm hover:bg-blue-700"> + +{{-- 통지서 미리보기 모달 --}} + @endsection @push('scripts') @@ -397,5 +452,149 @@ function submitBulkNotice() { btn.textContent = '발송'; }); } + + // ── 통지서 미리보기 ── + + function buildNotice1PreviewHtml(data) { + return '
' + + '

연차유급휴가 사용촉진 통지서 (1차)

' + + '
' + + '
' + + '
수신 : ' + (data.employee_name || '') + '
' + + '
부서 : ' + (data.department || '') + '
' + + '
직급 : ' + (data.position || '') + '
' + + '
' + + '
' + + '

근로기준법 제61조에 따라 귀하의 미사용 연차유급휴가 사용을 촉진하고자 아래와 같이 통지합니다.

' + + '
' + + '
' + + '
■ 연차 현황
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
발생연차' + (data.total_days || 0) + '일사용연차' + (data.used_days || 0) + '일잔여연차' + (data.remaining_days || 0) + '일
' + + '
' + + '
' + + '

위 잔여 연차휴가에 대하여 아래 기한까지 사용 시기를 지정하여 제출하여 주시기 바랍니다.

' + + '
' + + '
' + + '
■ 사용계획 제출기한 : ' + (data.deadline || '') + '
' + + '
' + + '
' + + '

기한 내 사용 시기를 제출하지 않을 경우 회사는 근로기준법 제61조에 따라 연차휴가 사용 시기를 지정할 수 있습니다.

' + + '

본 통지서는 연차 사용 촉진 절차에 따른 법적 통보 문서이며, 확인 시 수신 확인으로 간주됩니다.

' + + '
' + + '
' + + '' + (data.company_name || '') + '    ' + + '대표이사   ' + (data.ceo_name || '') + '  ' + + '[직인날인]' + + '
' + + '
' + + '
□ 본인은 위 내용을 확인하였으며 연차 사용 시기를 제출하겠습니다.
' + + '
서명: ________________________   일자: ____년 ____월 ____일
' + + '
'; + } + + function buildNotice2PreviewHtml(data) { + let datesHtml = ''; + if (data.designated_dates && data.designated_dates.length > 0) { + datesHtml = ''; + datesHtml += '' + + ''; + data.designated_dates.forEach(function(d, i) { + datesHtml += '' + + ''; + }); + datesHtml += '
순번지정 휴가일
' + (i + 1) + '' + d + '
'; + } + + return '
' + + '

연차유급휴가 사용촉진 통지서 (2차)

' + + '
' + + '
' + + '
수신 : ' + (data.employee_name || '') + '
' + + '
부서 : ' + (data.department || '') + '
' + + '
직급 : ' + (data.position || '') + '
' + + '
' + + '
' + + '

귀하는 연차 사용촉진 1차 통보 이후에도 연차 사용 시기를 제출하지 않아 근로기준법 제61조에 따라 회사가 다음과 같이 휴가 사용일을 지정합니다.

' + + '
' + + '
' + + '
■ 연차 현황 : 잔여 연차 ' + (data.remaining_days || 0) + '
' + + '
' + + '
' + + '
■ 회사 지정 휴가일
' + + datesHtml + + '
' + + '
' + + '

위 지정된 날짜에 연차휴가를 사용하여 주시기 바랍니다.

' + + '
' + + '
' + + '

본 통지서는 근로기준법 제61조에 따른 연차 사용촉진 절차에 의한 통보입니다.

' + + '
' + + '
' + + '' + (data.company_name || '') + '    ' + + '대표이사   ' + (data.ceo_name || '') + '  ' + + '[직인날인]' + + '
' + + '
' + + '
□ 본인은 위 내용을 확인하였습니다.
' + + '
서명: ________________________   일자: ____년 ____월 ____일
' + + '
'; + } + + const statusMap = { + draft: { label: '임시저장', bg: 'bg-gray-100', text: 'text-gray-600' }, + pending: { label: '결재중', bg: 'bg-blue-100', text: 'text-blue-700' }, + approved: { label: '승인', bg: 'bg-green-100', text: 'text-green-700' }, + rejected: { label: '반려', bg: 'bg-red-100', text: 'text-red-700' }, + cancelled: { label: '취소', bg: 'bg-gray-100', text: 'text-gray-500' }, + }; + + function openNoticePreview(id, type, content, status, createdAt) { + const data = typeof content === 'string' ? JSON.parse(content) : content; + const modal = document.getElementById('notice-preview-modal'); + const titleEl = document.getElementById('notice-preview-title'); + const statusEl = document.getElementById('notice-preview-status'); + const dateEl = document.getElementById('notice-preview-date'); + const contentEl = document.getElementById('notice-preview-content'); + const linkEl = document.getElementById('notice-preview-link'); + + // 제목 + titleEl.textContent = type === '1st' ? '1차 통지서 미리보기' : '2차 통지서 미리보기'; + + // 상태 뱃지 + const st = statusMap[status] || { label: status, bg: 'bg-gray-100', text: 'text-gray-600' }; + statusEl.textContent = st.label; + statusEl.className = 'inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ' + st.bg + ' ' + st.text; + + // 날짜 + dateEl.textContent = createdAt; + + // 결재문서 링크 + linkEl.href = '/approvals/' + id; + + // 문서 미리보기 HTML + contentEl.innerHTML = type === '1st' ? buildNotice1PreviewHtml(data) : buildNotice2PreviewHtml(data); + + modal.classList.remove('hidden'); + } + + function closeNoticePreview() { + document.getElementById('notice-preview-modal').classList.add('hidden'); + } + + function printNoticePreview() { + const content = document.getElementById('notice-preview-content').innerHTML; + const title = document.getElementById('notice-preview-title').textContent; + const win = window.open('', '_blank'); + win.document.write('' + title + '' + content + ''); + win.document.close(); + win.print(); + } @endpush