185 lines
11 KiB
PHP
185 lines
11 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<h2 class="text-xl font-semibold leading-tight text-gray-800">
|
|
製作付款單
|
|
</h2>
|
|
</x-slot>
|
|
|
|
<div class="py-12">
|
|
<div class="mx-auto max-w-4xl sm:px-6 lg:px-8 space-y-4">
|
|
@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
|
|
|
|
<!-- Finance Document Info -->
|
|
<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">{{ $financeDocument->title }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">申請金額</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">NT$ {{ number_format($financeDocument->amount, 2) }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">申請類型</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ $financeDocument->getRequestTypeText() }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">金額級別</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ $financeDocument->getAmountTierText() }}</dd>
|
|
</div>
|
|
@if($financeDocument->member)
|
|
<div>
|
|
<dt class="text-sm font-medium text-gray-500">關聯會員</dt>
|
|
<dd class="mt-1 text-sm text-gray-900">{{ $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">{{ $financeDocument->submittedBy->name }}</dd>
|
|
</div>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Payment Order Form -->
|
|
<form method="POST" action="{{ route('admin.payment-orders.store', $financeDocument) }}" class="space-y-4">
|
|
@csrf
|
|
|
|
<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>
|
|
|
|
<div class="grid grid-cols-1 gap-6">
|
|
<!-- Payee Name -->
|
|
<div>
|
|
<label for="payee_name" class="block text-sm font-medium text-gray-700">
|
|
收款人姓名 <span class="text-red-500">*</span>
|
|
</label>
|
|
<input type="text" name="payee_name" id="payee_name" required
|
|
value="{{ old('payee_name', $financeDocument->member->full_name ?? '') }}"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm @error('payee_name') border-red-300 @enderror">
|
|
@error('payee_name')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Payment Method -->
|
|
<div>
|
|
<label for="payment_method" class="block text-sm font-medium text-gray-700">
|
|
付款方式 <span class="text-red-500">*</span>
|
|
</label>
|
|
<select name="payment_method" id="payment_method" 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 @error('payment_method') border-red-300 @enderror">
|
|
<option value="">請選擇付款方式</option>
|
|
<option value="bank_transfer" {{ old('payment_method') == 'bank_transfer' ? 'selected' : '' }}>銀行轉帳</option>
|
|
<option value="check" {{ old('payment_method') == 'check' ? 'selected' : '' }}>支票</option>
|
|
<option value="cash" {{ old('payment_method') == 'cash' ? 'selected' : '' }}>現金</option>
|
|
</select>
|
|
@error('payment_method')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Bank Information (shown when bank_transfer is selected) -->
|
|
<div id="bank_info" class="space-y-4" style="display: none;">
|
|
<div>
|
|
<label for="payee_bank_name" class="block text-sm font-medium text-gray-700">
|
|
銀行名稱
|
|
</label>
|
|
<input type="text" name="payee_bank_name" id="payee_bank_name"
|
|
value="{{ old('payee_bank_name') }}"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="payee_bank_code" class="block text-sm font-medium text-gray-700">
|
|
銀行代碼
|
|
</label>
|
|
<input type="text" name="payee_bank_code" id="payee_bank_code" maxlength="10"
|
|
value="{{ old('payee_bank_code') }}"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="payee_account_number" class="block text-sm font-medium text-gray-700">
|
|
銀行帳號
|
|
</label>
|
|
<input type="text" name="payee_account_number" id="payee_account_number" maxlength="30"
|
|
value="{{ old('payee_account_number') }}"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Payment Amount -->
|
|
<div>
|
|
<label for="payment_amount" class="block text-sm font-medium text-gray-700">
|
|
付款金額 <span class="text-red-500">*</span>
|
|
</label>
|
|
<div class="relative mt-1 rounded-md shadow-sm">
|
|
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
|
<span class="text-gray-500 sm:text-sm">NT$</span>
|
|
</div>
|
|
<input type="number" name="payment_amount" id="payment_amount" step="0.01" min="0" required
|
|
value="{{ old('payment_amount', $financeDocument->amount) }}"
|
|
class="block w-full rounded-md border-gray-300 pl-12 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm @error('payment_amount') border-red-300 @enderror">
|
|
</div>
|
|
@error('payment_amount')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Notes -->
|
|
<div>
|
|
<label for="notes" class="block text-sm font-medium text-gray-700">
|
|
備註
|
|
</label>
|
|
<textarea name="notes" id="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">{{ old('notes') }}</textarea>
|
|
@error('notes')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Form Actions -->
|
|
<div class="flex justify-end space-x-3">
|
|
<a href="{{ route('admin.finance.show', $financeDocument) }}" 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>
|
|
<button type="submit" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
|
|
製作付款單
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
@push('scripts')
|
|
<script>
|
|
// Show/hide bank information based on payment method
|
|
document.getElementById('payment_method').addEventListener('change', function() {
|
|
const bankInfo = document.getElementById('bank_info');
|
|
if (this.value === 'bank_transfer') {
|
|
bankInfo.style.display = 'block';
|
|
} else {
|
|
bankInfo.style.display = 'none';
|
|
}
|
|
});
|
|
|
|
// Trigger on page load to handle old input
|
|
if (document.getElementById('payment_method').value === 'bank_transfer') {
|
|
document.getElementById('bank_info').style.display = 'block';
|
|
}
|
|
</script>
|
|
@endpush
|
|
</x-app-layout>
|