213 lines
14 KiB
PHP
213 lines
14 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
|
|
|
|
<!-- Related Finance Document Info (if applicable) -->
|
|
@if($financeDocument)
|
|
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4">
|
|
<h3 class="text-sm font-medium text-blue-900 mb-2">關聯財務申請單</h3>
|
|
<dl class="grid grid-cols-1 gap-x-4 gap-y-2 sm:grid-cols-2 text-sm">
|
|
<div>
|
|
<dt class="font-medium text-blue-700">標題</dt>
|
|
<dd class="text-blue-900">{{ $financeDocument->title }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="font-medium text-blue-700">金額</dt>
|
|
<dd class="text-blue-900">NT$ {{ number_format($financeDocument->amount, 2) }}</dd>
|
|
</div>
|
|
@if($financeDocument->paymentOrder)
|
|
<div>
|
|
<dt class="font-medium text-blue-700">付款單號</dt>
|
|
<dd class="text-blue-900 font-mono">{{ $financeDocument->paymentOrder->payment_order_number }}</dd>
|
|
</div>
|
|
<div>
|
|
<dt class="font-medium text-blue-700">付款方式</dt>
|
|
<dd class="text-blue-900">{{ $financeDocument->paymentOrder->getPaymentMethodText() }}</dd>
|
|
</div>
|
|
@endif
|
|
</dl>
|
|
</div>
|
|
@endif
|
|
|
|
<!-- Ledger Entry Form -->
|
|
<form method="POST" action="{{ route('admin.cashier-ledger.store') }}" class="space-y-4">
|
|
@csrf
|
|
|
|
@if($financeDocument)
|
|
<input type="hidden" name="finance_document_id" value="{{ $financeDocument->id }}">
|
|
@endif
|
|
|
|
<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">
|
|
<!-- Entry Date -->
|
|
<div>
|
|
<label for="entry_date" class="block text-sm font-medium text-gray-700">
|
|
記帳日期 <span class="text-red-500">*</span>
|
|
</label>
|
|
<input type="date" name="entry_date" id="entry_date" required
|
|
value="{{ old('entry_date', now()->format('Y-m-d')) }}"
|
|
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('entry_date') border-red-300 @enderror">
|
|
@error('entry_date')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Entry Type -->
|
|
<div>
|
|
<label for="entry_type" class="block text-sm font-medium text-gray-700">
|
|
類型 <span class="text-red-500">*</span>
|
|
</label>
|
|
<select name="entry_type" id="entry_type" 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('entry_type') border-red-300 @enderror">
|
|
<option value="">請選擇類型</option>
|
|
<option value="receipt" {{ old('entry_type') == 'receipt' ? 'selected' : '' }}>收入</option>
|
|
<option value="payment" {{ old('entry_type', $financeDocument ? 'payment' : '') == 'payment' ? 'selected' : '' }}>支出</option>
|
|
</select>
|
|
@error('entry_type')
|
|
<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', $financeDocument && $financeDocument->paymentOrder ? $financeDocument->paymentOrder->payment_method : '') == 'bank_transfer' ? 'selected' : '' }}>銀行轉帳</option>
|
|
<option value="check" {{ old('payment_method', $financeDocument && $financeDocument->paymentOrder ? $financeDocument->paymentOrder->payment_method : '') == 'check' ? 'selected' : '' }}>支票</option>
|
|
<option value="cash" {{ old('payment_method', $financeDocument && $financeDocument->paymentOrder ? $financeDocument->paymentOrder->payment_method : '') == 'cash' ? 'selected' : '' }}>現金</option>
|
|
</select>
|
|
@error('payment_method')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Bank Account -->
|
|
<div>
|
|
<label for="bank_account" class="block text-sm font-medium text-gray-700">
|
|
銀行帳戶
|
|
</label>
|
|
<input type="text" name="bank_account" id="bank_account"
|
|
value="{{ old('bank_account', 'Main Account') }}"
|
|
placeholder="例如: Main Account, Petty Cash"
|
|
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('bank_account') border-red-300 @enderror">
|
|
<p class="mt-1 text-xs text-gray-500">用於區分不同的現金/銀行帳戶</p>
|
|
@error('bank_account')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Amount -->
|
|
<div>
|
|
<label for="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="amount" id="amount" step="0.01" min="0.01" required
|
|
value="{{ old('amount', $financeDocument && $financeDocument->paymentOrder ? $financeDocument->paymentOrder->payment_amount : '') }}"
|
|
class="block w-full rounded-md border-gray-300 pl-12 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm @error('amount') border-red-300 @enderror">
|
|
</div>
|
|
@error('amount')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Receipt Number -->
|
|
<div>
|
|
<label for="receipt_number" class="block text-sm font-medium text-gray-700">
|
|
收據/憑證編號
|
|
</label>
|
|
<input type="text" name="receipt_number" id="receipt_number"
|
|
value="{{ old('receipt_number') }}"
|
|
placeholder="例如: RCP-2025-001"
|
|
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('receipt_number') border-red-300 @enderror">
|
|
@error('receipt_number')
|
|
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<!-- Transaction Reference -->
|
|
<div>
|
|
<label for="transaction_reference" class="block text-sm font-medium text-gray-700">
|
|
交易參考號
|
|
</label>
|
|
<input type="text" name="transaction_reference" id="transaction_reference"
|
|
value="{{ old('transaction_reference', $financeDocument && $financeDocument->paymentOrder ? $financeDocument->paymentOrder->transaction_reference : '') }}"
|
|
placeholder="銀行交易編號或支票號碼"
|
|
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('transaction_reference') border-red-300 @enderror">
|
|
@error('transaction_reference')
|
|
<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>
|
|
|
|
<!-- Help Text -->
|
|
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-4">
|
|
<div class="flex">
|
|
<div class="flex-shrink-0">
|
|
<svg class="h-5 w-5 text-yellow-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
</svg>
|
|
</div>
|
|
<div class="ml-3">
|
|
<h3 class="text-sm font-medium text-yellow-800">注意事項</h3>
|
|
<div class="mt-2 text-sm text-yellow-700">
|
|
<ul class="list-disc pl-5 space-y-1">
|
|
<li>提交後將自動計算交易前後餘額</li>
|
|
<li>請確認金額和類型(收入/支出)正確</li>
|
|
<li>銀行帳戶用於區分不同帳戶的餘額</li>
|
|
<li>記錄後無法修改,請仔細確認</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Form Actions -->
|
|
<div class="flex justify-end space-x-3">
|
|
<a href="{{ route('admin.cashier-ledger.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>
|
|
<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>
|
|
</x-app-layout>
|