+
문서 내용
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+ {{-- 결재선 요약 바 --}}
+
+
+ 결재선
+
+
+
+ 결재선이 설정되지 않았습니다.
-
- {{-- 우측: 결재선 --}}
-
- @php
- $initialSteps = $approval->steps->map(fn($s) => [
- 'user_id' => $s->approver_id,
- 'user_name' => $s->approver_name ?? ($s->approver?->name ?? ''),
- 'department' => $s->approver_department ?? '',
- 'position' => $s->approver_position ?? '',
- 'step_type' => $s->step_type,
- ])->toArray();
- @endphp
- @include('approvals.partials._approval-line-editor', [
- 'lines' => $lines,
- 'initialSteps' => $initialSteps,
- 'selectedLineId' => $approval->line_id ?? '',
- ])
-
-
+ {{-- 액션 버튼 --}}
+
@if($approval->isDeletable())
@endif
+
+ {{-- 결재선 모달 --}}
+
+
+
+
+
+
+ @php
+ $initialSteps = $approval->steps->map(fn($s) => [
+ 'user_id' => $s->approver_id,
+ 'user_name' => $s->approver_name ?? ($s->approver?->name ?? ''),
+ 'department' => $s->approver_department ?? '',
+ 'position' => $s->approver_position ?? '',
+ 'step_type' => $s->step_type,
+ ])->toArray();
+ @endphp
+ @include('approvals.partials._approval-line-editor', [
+ 'lines' => $lines,
+ 'initialSteps' => $initialSteps,
+ 'selectedLineId' => $approval->line_id ?? '',
+ ])
+
+
+
+
+
+
+
@endsection
@push('styles')
@@ -185,13 +216,58 @@ function getBodyContent() {
return document.getElementById('body').value;
}
-// 기존 HTML body 자동 감지 → 편집기 자동 활성화
+function openApprovalLineModal() {
+ document.getElementById('approval-line-modal').style.display = '';
+ document.body.style.overflow = 'hidden';
+}
+
+function closeApprovalLineModal() {
+ document.getElementById('approval-line-modal').style.display = 'none';
+ document.body.style.overflow = '';
+ updateApprovalLineSummary();
+}
+
+function updateApprovalLineSummary() {
+ const editorEl = document.getElementById('approval-line-editor');
+ if (!editorEl || !editorEl._x_dataStack) return;
+
+ const steps = editorEl._x_dataStack[0].steps;
+ const summaryEl = document.getElementById('approval-line-summary');
+
+ if (!steps || steps.length === 0) {
+ summaryEl.innerHTML = '
결재선이 설정되지 않았습니다.';
+ return;
+ }
+
+ const typeLabels = { approval: '결재', agreement: '합의', reference: '참조' };
+ const parts = steps.map(s => {
+ const label = typeLabels[s.step_type] || s.step_type;
+ return '
' + s.user_name + ' (' + label + ')';
+ });
+
+ summaryEl.innerHTML = '
' +
+ parts.join('→') + '
';
+}
+
+document.addEventListener('keydown', function(e) {
+ if (e.key === 'Escape') {
+ const modal = document.getElementById('approval-line-modal');
+ if (modal && modal.style.display !== 'none') {
+ closeApprovalLineModal();
+ }
+ }
+});
+
+// 기존 HTML body 자동 감지 → 편집기 자동 활성화 + 결재선 요약 초기화
document.addEventListener('DOMContentLoaded', function () {
const existingBody = document.getElementById('body').value;
if (/<[a-z][\s\S]*>/i.test(existingBody)) {
document.getElementById('useEditor').checked = true;
toggleEditor();
}
+
+ // Alpine 초기화 후 기존 결재선 요약 표시
+ setTimeout(updateApprovalLineSummary, 200);
});
async function updateApproval(action) {