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, '