299 lines
19 KiB
PHP
299 lines
19 KiB
PHP
<x-app-layout>
|
||
<x-slot name="header">
|
||
<h2 class="text-xl font-semibold leading-tight text-gray-800">
|
||
付款單詳情: {{ $paymentOrder->payment_order_number }}
|
||
</h2>
|
||
</x-slot>
|
||
|
||
<div class="py-12">
|
||
<div class="mx-auto max-w-5xl sm:px-6 lg:px-8 space-y-4">
|
||
@if (session('status'))
|
||
<div class="rounded-md bg-green-50 p-4">
|
||
<p class="text-sm font-medium text-green-800">{{ session('status') }}</p>
|
||
</div>
|
||
@endif
|
||
|
||
@if (session('error'))
|
||
<div class="rounded-md bg-red-50 p-4">
|
||
<p class="text-sm font-medium text-red-800">{{ session('error') }}</p>
|
||
</div>
|
||
@endif
|
||
|
||
<!-- Payment Order Info -->
|
||
<div class="bg-white shadow sm:rounded-lg">
|
||
<div class="px-4 py-5 sm:p-6">
|
||
<div class="flex items-center justify-between mb-4">
|
||
<h3 class="text-lg font-medium leading-6 text-gray-900">付款單資訊</h3>
|
||
<span class="inline-flex rounded-full px-3 py-1 text-sm font-semibold
|
||
@if($paymentOrder->status === 'executed') bg-green-100 text-green-800
|
||
@elseif($paymentOrder->status === 'verified') bg-blue-100 text-blue-800
|
||
@elseif($paymentOrder->status === 'pending_verification') bg-yellow-100 text-yellow-800
|
||
@elseif($paymentOrder->status === 'cancelled') bg-red-100 text-red-800
|
||
@else bg-gray-100 text-gray-800
|
||
@endif">
|
||
{{ $paymentOrder->getStatusText() }}
|
||
</span>
|
||
</div>
|
||
|
||
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">付款單號</dt>
|
||
<dd class="mt-1 text-sm text-gray-900 font-mono">{{ $paymentOrder->payment_order_number }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">收款人</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->payee_name }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">付款金額</dt>
|
||
<dd class="mt-1 text-sm text-gray-900 font-semibold">NT$ {{ number_format($paymentOrder->payment_amount, 2) }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">付款方式</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->getPaymentMethodText() }}</dd>
|
||
</div>
|
||
|
||
@if($paymentOrder->payment_method === 'bank_transfer')
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">銀行名稱</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->payee_bank_name ?? 'N/A' }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">銀行代碼</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->payee_bank_code ?? 'N/A' }}</dd>
|
||
</div>
|
||
<div class="sm:col-span-2">
|
||
<dt class="text-sm font-medium text-gray-500">銀行帳號</dt>
|
||
<dd class="mt-1 text-sm text-gray-900 font-mono">{{ $paymentOrder->payee_account_number ?? 'N/A' }}</dd>
|
||
</div>
|
||
@endif
|
||
|
||
<div class="sm:col-span-2">
|
||
<dt class="text-sm font-medium text-gray-500">製單人(會計)</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">
|
||
{{ $paymentOrder->createdByAccountant->name }} - {{ $paymentOrder->created_at->format('Y-m-d H:i') }}
|
||
</dd>
|
||
</div>
|
||
|
||
@if($paymentOrder->notes)
|
||
<div class="sm:col-span-2">
|
||
<dt class="text-sm font-medium text-gray-500">備註</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->notes }}</dd>
|
||
</div>
|
||
@endif
|
||
</dl>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Verification Section -->
|
||
<div class="bg-white shadow sm:rounded-lg">
|
||
<div class="px-4 py-5 sm:p-6">
|
||
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">出納覆核</h3>
|
||
|
||
@if($paymentOrder->verified_at)
|
||
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">覆核人</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->verifiedByCashier->name }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">覆核時間</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->verified_at->format('Y-m-d H:i') }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">覆核狀態</dt>
|
||
<dd class="mt-1 text-sm">
|
||
<span class="inline-flex rounded-full px-2 text-xs font-semibold
|
||
@if($paymentOrder->verification_status === 'approved') bg-green-100 text-green-800
|
||
@elseif($paymentOrder->verification_status === 'rejected') bg-red-100 text-red-800
|
||
@else bg-yellow-100 text-yellow-800
|
||
@endif">
|
||
@if($paymentOrder->verification_status === 'approved') 通過
|
||
@elseif($paymentOrder->verification_status === 'rejected') 駁回
|
||
@else 待覆核
|
||
@endif
|
||
</span>
|
||
</dd>
|
||
</div>
|
||
@if($paymentOrder->verification_notes)
|
||
<div class="sm:col-span-2">
|
||
<dt class="text-sm font-medium text-gray-500">覆核備註</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->verification_notes }}</dd>
|
||
</div>
|
||
@endif
|
||
</dl>
|
||
@else
|
||
<p class="text-sm text-gray-500 mb-4">此付款單待出納覆核</p>
|
||
|
||
@can('verify_payment_order')
|
||
@if($paymentOrder->canBeVerifiedByCashier())
|
||
<form method="POST" action="{{ route('admin.payment-orders.verify', $paymentOrder) }}" class="space-y-4">
|
||
@csrf
|
||
<div>
|
||
<label for="verification_notes" class="block text-sm font-medium text-gray-700">覆核備註</label>
|
||
<textarea name="verification_notes" id="verification_notes" rows="3"
|
||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"></textarea>
|
||
</div>
|
||
<div class="flex space-x-3">
|
||
<button type="submit" name="action" value="approve"
|
||
class="inline-flex items-center rounded-md border border-transparent bg-green-600 px-4 py-2 text-sm font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2">
|
||
通過覆核
|
||
</button>
|
||
<button type="submit" name="action" value="reject"
|
||
class="inline-flex items-center rounded-md border border-transparent bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2">
|
||
駁回
|
||
</button>
|
||
</div>
|
||
</form>
|
||
@endif
|
||
@endcan
|
||
@endif
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Execution Section -->
|
||
<div class="bg-white shadow sm:rounded-lg">
|
||
<div class="px-4 py-5 sm:p-6">
|
||
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">付款執行</h3>
|
||
|
||
@if($paymentOrder->executed_at)
|
||
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">執行人</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->executedByCashier->name }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">執行時間</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->executed_at->format('Y-m-d H:i') }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">執行狀態</dt>
|
||
<dd class="mt-1 text-sm">
|
||
<span class="inline-flex rounded-full px-2 text-xs font-semibold
|
||
@if($paymentOrder->execution_status === 'completed') bg-green-100 text-green-800
|
||
@elseif($paymentOrder->execution_status === 'failed') bg-red-100 text-red-800
|
||
@else bg-yellow-100 text-yellow-800
|
||
@endif">
|
||
@if($paymentOrder->execution_status === 'completed') 已完成
|
||
@elseif($paymentOrder->execution_status === 'failed') 失敗
|
||
@else 待執行
|
||
@endif
|
||
</span>
|
||
</dd>
|
||
</div>
|
||
@if($paymentOrder->transaction_reference)
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">交易參考號</dt>
|
||
<dd class="mt-1 text-sm text-gray-900 font-mono">{{ $paymentOrder->transaction_reference }}</dd>
|
||
</div>
|
||
@endif
|
||
@if($paymentOrder->payment_receipt_path)
|
||
<div class="sm:col-span-2">
|
||
<dt class="text-sm font-medium text-gray-500">付款憑證</dt>
|
||
<dd class="mt-1">
|
||
<a href="{{ route('admin.payment-orders.download-receipt', $paymentOrder) }}" class="text-indigo-600 hover:text-indigo-900">
|
||
下載憑證
|
||
</a>
|
||
</dd>
|
||
</div>
|
||
@endif
|
||
</dl>
|
||
@else
|
||
<p class="text-sm text-gray-500 mb-4">此付款單待執行付款</p>
|
||
|
||
@can('execute_payment')
|
||
@if($paymentOrder->canBeExecuted())
|
||
<form method="POST" action="{{ route('admin.payment-orders.execute', $paymentOrder) }}" enctype="multipart/form-data" class="space-y-4">
|
||
@csrf
|
||
<div>
|
||
<label for="transaction_reference" class="block text-sm font-medium text-gray-700">
|
||
交易參考號 <span class="text-red-500">*</span>
|
||
</label>
|
||
<input type="text" name="transaction_reference" id="transaction_reference" required
|
||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
|
||
<p class="mt-1 text-xs text-gray-500">銀行交易編號或支票號碼</p>
|
||
</div>
|
||
<div>
|
||
<label for="payment_receipt" class="block text-sm font-medium text-gray-700">
|
||
付款憑證
|
||
</label>
|
||
<input type="file" name="payment_receipt" id="payment_receipt"
|
||
class="mt-1 block w-full text-sm text-gray-500
|
||
file:mr-4 file:py-2 file:px-4
|
||
file:rounded-md file:border-0
|
||
file:text-sm file:font-semibold
|
||
file:bg-indigo-50 file:text-indigo-700
|
||
hover:file:bg-indigo-100">
|
||
<p class="mt-1 text-xs text-gray-500">上傳轉帳收據或付款證明(最大 10MB)</p>
|
||
</div>
|
||
<div>
|
||
<label for="execution_notes" class="block text-sm font-medium text-gray-700">執行備註</label>
|
||
<textarea name="execution_notes" id="execution_notes" rows="3"
|
||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"></textarea>
|
||
</div>
|
||
<div>
|
||
<button type="submit"
|
||
class="inline-flex items-center rounded-md border border-transparent bg-green-600 px-4 py-2 text-sm font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2">
|
||
確認執行付款
|
||
</button>
|
||
</div>
|
||
</form>
|
||
@endif
|
||
@endcan
|
||
@endif
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Related Finance Document -->
|
||
<div class="bg-white shadow sm:rounded-lg">
|
||
<div class="px-4 py-5 sm:p-6">
|
||
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">關聯財務申請單</h3>
|
||
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">申請標題</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->financeDocument->title }}</dd>
|
||
</div>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">申請類型</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->financeDocument->getRequestTypeText() }}</dd>
|
||
</div>
|
||
@if($paymentOrder->financeDocument->member)
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">關聯會員</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->financeDocument->member->full_name }}</dd>
|
||
</div>
|
||
@endif
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">申請人</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">{{ $paymentOrder->financeDocument->submittedBy->name }}</dd>
|
||
</div>
|
||
</dl>
|
||
<div class="mt-4">
|
||
<a href="{{ route('admin.finance.show', $paymentOrder->financeDocument) }}" class="text-indigo-600 hover:text-indigo-900">
|
||
查看完整申請單 →
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Actions -->
|
||
<div class="flex justify-between">
|
||
<a href="{{ route('admin.payment-orders.index') }}" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
|
||
返回列表
|
||
</a>
|
||
|
||
@can('create_payment_order')
|
||
@if(!$paymentOrder->isExecuted() && $paymentOrder->status !== 'cancelled')
|
||
<form method="POST" action="{{ route('admin.payment-orders.cancel', $paymentOrder) }}" onsubmit="return confirm('確定要取消此付款單嗎?');">
|
||
@csrf
|
||
<button type="submit" class="inline-flex items-center rounded-md border border-transparent bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2">
|
||
取消付款單
|
||
</button>
|
||
</form>
|
||
@endif
|
||
@endcan
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</x-app-layout>
|