From 9beda571a4fbc8d641309d7c1ecf60e99ab3331d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Wed, 4 Mar 2026 15:14:18 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[approval]=20=EC=A7=80=EC=B6=9C?= =?UTF-8?q?=EA=B2=B0=EC=9D=98=EC=84=9C=20=EC=A0=84=EC=9A=A9=20=ED=8F=BC=20?= =?UTF-8?q?UI=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Alpine.js 기반 지출결의서 전용 폼 컴포넌트 (_expense-form.blade.php) - 지출형식/세금계산서 라디오, 내역 테이블(동적 행 추가/삭제), 금액 자동합계 - 양식 code === 'expense' 시 Quill 대신 전용 폼 표시 (create/edit) - content JSON 구조화 저장, show 페이지 읽기전용 테이블 렌더링 - 기존 Quill 방식 하위 호환 유지 --- .../Api/Admin/ApprovalApiController.php | 2 + resources/views/approvals/create.blade.php | 52 +++- resources/views/approvals/edit.blade.php | 64 ++++- .../partials/_expense-form.blade.php | 254 ++++++++++++++++++ .../partials/_expense-show.blade.php | 99 +++++++ resources/views/approvals/show.blade.php | 4 +- 6 files changed, 465 insertions(+), 10 deletions(-) create mode 100644 resources/views/approvals/partials/_expense-form.blade.php create mode 100644 resources/views/approvals/partials/_expense-show.blade.php diff --git a/app/Http/Controllers/Api/Admin/ApprovalApiController.php b/app/Http/Controllers/Api/Admin/ApprovalApiController.php index b55c369f..06713e75 100644 --- a/app/Http/Controllers/Api/Admin/ApprovalApiController.php +++ b/app/Http/Controllers/Api/Admin/ApprovalApiController.php @@ -95,6 +95,7 @@ public function store(Request $request): JsonResponse 'form_id' => 'required|exists:approval_forms,id', 'title' => 'required|string|max:200', 'body' => 'nullable|string', + 'content' => 'nullable|array', 'is_urgent' => 'boolean', 'steps' => 'nullable|array', 'steps.*.user_id' => 'required_with:steps|exists:users,id', @@ -118,6 +119,7 @@ public function update(Request $request, int $id): JsonResponse $request->validate([ 'title' => 'sometimes|string|max:200', 'body' => 'nullable|string', + 'content' => 'nullable|array', 'is_urgent' => 'boolean', 'steps' => 'nullable|array', 'steps.*.user_id' => 'required_with:steps|exists:users,id', diff --git a/resources/views/approvals/create.blade.php b/resources/views/approvals/create.blade.php index a5564b6c..a308b058 100644 --- a/resources/views/approvals/create.blade.php +++ b/resources/views/approvals/create.blade.php @@ -65,8 +65,8 @@ class="px-3 py-1.5 bg-blue-50 text-blue-600 hover:bg-blue-100 rounded-lg text-xs - {{-- 본문 --}} -
+ {{-- 본문 (일반 양식) --}} +
+ {{-- 지출결의서 전용 폼 --}} + @include('approvals.partials._expense-form', ['initialData' => []]) + {{-- 액션 버튼 --}}
-
+ {{-- 본문 (일반 양식) --}} +
+ {{-- 지출결의서 전용 폼 --}} + @include('approvals.partials._expense-form', [ + 'initialData' => $approval->content ?? [], + ]) + {{-- 액션 버튼 --}}
+ + diff --git a/resources/views/approvals/partials/_expense-show.blade.php b/resources/views/approvals/partials/_expense-show.blade.php new file mode 100644 index 00000000..9f686f79 --- /dev/null +++ b/resources/views/approvals/partials/_expense-show.blade.php @@ -0,0 +1,99 @@ +{{-- + 지출결의서 읽기전용 렌더링 + Props: + $content (array) - approvals.content JSON +--}} +@php + $expenseTypeLabels = [ + 'corporate_card' => '법인카드', + 'transfer' => '송금', + 'cash_advance' => '현금/가지급정산', + 'welfare_card' => '복지카드', + ]; + $taxInvoiceLabels = [ + 'normal' => '일반', + 'deferred' => '이월발행', + ]; +@endphp + +
+ {{-- 기본 정보 --}} +
+
+ 지출형식 +
{{ $expenseTypeLabels[$content['expense_type'] ?? ''] ?? '-' }}
+
+
+ 세금계산서 +
{{ $taxInvoiceLabels[$content['tax_invoice'] ?? ''] ?? '-' }}
+
+
+ 작성일자 +
{{ $content['write_date'] ?? '-' }}
+
+
+ 지출부서 +
{{ $content['department'] ?? '-' }}
+
+
+ 이름 +
{{ $content['writer_name'] ?? '-' }}
+
+
+ + @if(!empty($content['subject'])) +
+ 제목 +
{{ $content['subject'] }}
+
+ @endif + + {{-- 내역 테이블 --}} + @if(!empty($content['items'])) +
+ + + + + + + + + + + + + + + @foreach($content['items'] as $item) + + + + + + + + + + + @endforeach + + + + + + + + +
년/월/일내용금액업체명지급은행계좌번호예금주비고
{{ $item['date'] ?? '' }}{{ $item['description'] ?? '' }}{{ number_format($item['amount'] ?? 0) }}{{ $item['vendor'] ?? '' }}{{ $item['bank'] ?? '' }}{{ $item['account_no'] ?? '' }}{{ $item['depositor'] ?? '' }}{{ $item['remark'] ?? '' }}
합계{{ number_format($content['total_amount'] ?? 0) }}
+
+ @endif + + {{-- 첨부서류 --}} + @if(!empty($content['attachment_memo'])) +
+ 첨부서류 +
{{ $content['attachment_memo'] }}
+
+ @endif +
diff --git a/resources/views/approvals/show.blade.php b/resources/views/approvals/show.blade.php index 82dce2fb..2f709d1f 100644 --- a/resources/views/approvals/show.blade.php +++ b/resources/views/approvals/show.blade.php @@ -73,7 +73,9 @@ class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg transition

{{ $approval->title }}

- @if($approval->body && preg_match('/<[a-z][\s\S]*>/i', $approval->body)) + @if(!empty($approval->content) && $approval->form?->code === 'expense') + @include('approvals.partials._expense-show', ['content' => $approval->content]) + @elseif($approval->body && preg_match('/<[a-z][\s\S]*>/i', $approval->body))
{!! strip_tags($approval->body, '