Files
sam-manage/resources/views/approvals/partials/_expense-show.blade.php

163 lines
8.5 KiB
PHP

{{--
지출결의서 읽기전용 렌더링
Props:
$content (array) - approvals.content JSON
--}}
@php
$expenseTypeLabels = [
'corporate_card' => '법인카드',
'transfer' => '송금',
'auto_transfer' => '자동이체 출금',
'cash_advance' => '현금/가지급정산',
];
$taxInvoiceLabels = [
'normal' => '일반',
'deferred' => '이월발행',
'none' => '없음',
];
@endphp
<div class="space-y-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">{{ $expenseTypeLabels[$content['expense_type'] ?? ''] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">세금계산서</span>
<div class="text-sm font-medium mt-0.5">{{ $taxInvoiceLabels[$content['tax_invoice'] ?? ''] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">작성일자</span>
<div class="text-sm font-medium mt-0.5">{{ $content['write_date'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">결재일자</span>
<div class="text-sm font-medium mt-0.5">{{ $content['approval_date'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">지출부서</span>
<div class="text-sm font-medium mt-0.5">{{ $content['department'] ?? '-' }}</div>
</div>
<div>
<span class="text-xs text-gray-500">이름</span>
<div class="text-sm font-medium mt-0.5">{{ $content['writer_name'] ?? '-' }}</div>
</div>
</div>
{{-- 선택된 법인카드 --}}
@if(($content['expense_type'] ?? '') === 'corporate_card' && !empty($content['selected_card']))
@php $card = $content['selected_card']; @endphp
<div class="flex items-center gap-3 p-3 bg-blue-50 border border-blue-200 rounded-lg">
<svg class="w-5 h-5 text-blue-500 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"/>
</svg>
<div>
<span class="text-xs text-gray-500">결제 카드</span>
<div class="text-sm font-medium text-gray-800">
{{ $card['card_company'] ?? '' }} {{ $card['card_name'] ?? '' }}
<span class="text-gray-500 font-mono">**** {{ $card['card_number_last4'] ?? '' }}</span>
<span class="text-gray-400 ml-1">({{ $card['card_holder_name'] ?? '' }})</span>
</div>
</div>
</div>
@endif
{{-- 선택된 출금 계좌 --}}
@if(in_array($content['expense_type'] ?? '', ['transfer', 'auto_transfer']) && !empty($content['selected_account']))
@php $account = $content['selected_account']; @endphp
<div class="flex items-center gap-3 p-3 bg-green-50 border border-green-200 rounded-lg">
<svg class="w-5 h-5 text-green-500 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/>
</svg>
<div>
<span class="text-xs text-gray-500">출금 계좌</span>
<div class="text-sm font-medium text-gray-800">
{{ $account['bank_name'] ?? '' }}
<span class="text-gray-600 font-mono">{{ $account['account_number'] ?? '' }}</span>
<span class="text-gray-400 ml-1">({{ $account['account_holder'] ?? '' }})</span>
</div>
</div>
</div>
@endif
@if(!empty($content['subject']))
<div>
<span class="text-xs text-gray-500">제목</span>
<div class="text-sm font-medium mt-0.5">{{ $content['subject'] }}</div>
</div>
@endif
{{-- 내역 테이블 --}}
@if(!empty($content['items']))
<div class="overflow-x-auto border border-gray-200 rounded-lg">
<table class="w-full text-sm">
<thead class="bg-gray-50">
<tr>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-600">//</th>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-600">내용</th>
<th class="px-3 py-2 text-right text-xs font-medium text-gray-600">금액</th>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-600">업체명</th>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-600">지급은행</th>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-600">계좌번호</th>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-600">예금주</th>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-600">비고</th>
</tr>
</thead>
<tbody>
@foreach($content['items'] as $item)
<tr class="border-t border-gray-100">
<td class="px-3 py-2 text-xs text-gray-700 whitespace-nowrap">{{ $item['date'] ?? '' }}</td>
<td class="px-3 py-2 text-xs text-gray-700">{{ $item['description'] ?? '' }}</td>
<td class="px-3 py-2 text-xs text-gray-700 text-right font-medium whitespace-nowrap">{{ number_format($item['amount'] ?? 0) }}</td>
<td class="px-3 py-2 text-xs text-gray-700">{{ $item['vendor'] ?? '' }}</td>
<td class="px-3 py-2 text-xs text-gray-700">{{ $item['bank'] ?? '' }}</td>
<td class="px-3 py-2 text-xs text-gray-700">{{ $item['account_no'] ?? '' }}</td>
<td class="px-3 py-2 text-xs text-gray-700">{{ $item['depositor'] ?? '' }}</td>
<td class="px-3 py-2 text-xs text-gray-700">{{ $item['remark'] ?? '' }}</td>
</tr>
@endforeach
</tbody>
<tfoot class="bg-gray-50 border-t border-gray-200">
<tr>
<td class="px-3 py-2 text-xs font-semibold text-gray-700 text-right" colspan="2">합계</td>
<td class="px-3 py-2 text-xs font-bold text-blue-700 text-right whitespace-nowrap">{{ number_format($content['total_amount'] ?? 0) }}</td>
<td colspan="5"></td>
</tr>
</tfoot>
</table>
</div>
@endif
{{-- 첨부서류 --}}
@if(!empty($content['attachment_memo']))
<div>
<span class="text-xs text-gray-500">첨부서류</span>
<div class="text-sm text-gray-700 mt-0.5 whitespace-pre-wrap">{{ $content['attachment_memo'] }}</div>
</div>
@endif
{{-- 첨부파일 --}}
@if(!empty($approval->attachments))
<div>
<span class="text-xs text-gray-500">첨부파일</span>
<div class="mt-1 space-y-1">
@foreach($approval->attachments as $file)
<div class="flex items-center gap-2 text-sm">
<svg class="w-4 h-4 text-gray-400 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"/>
</svg>
<a href="{{ route('api.admin.approvals.download-file', $file['id']) }}" class="text-blue-600 hover:underline" target="_blank">
{{ $file['name'] ?? '파일' }}
</a>
<span class="text-xs text-gray-400">
{{ isset($file['size']) ? number_format($file['size'] / 1024, 1) . 'KB' : '' }}
</span>
</div>
@endforeach
</div>
</div>
@endif
</div>