Add membership fee system with disability discount and fix document permissions

Features:
- Implement two fee types: entrance fee and annual fee (both NT$1,000)
- Add 50% discount for disability certificate holders
- Add disability certificate upload in member profile
- Integrate disability verification into cashier approval workflow
- Add membership fee settings in system admin

Document permissions:
- Fix hard-coded role logic in Document model
- Use permission-based authorization instead of role checks

Additional features:
- Add announcements, general ledger, and trial balance modules
- Add income management and accounting entries
- Add comprehensive test suite with factories
- Update UI translations to Traditional Chinese

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-01 09:56:01 +08:00
parent 83ce1f7fc8
commit 642b879dd4
207 changed files with 19487 additions and 3048 deletions

View File

@@ -1,7 +1,7 @@
<x-app-layout>
<x-slot name="header">
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
{{ __('Payment Verification') }} - {{ $payment->member->full_name }}
付款驗證 - {{ $payment->member->full_name }}
</h2>
</x-slot>
@@ -9,32 +9,32 @@
<div class="mx-auto max-w-4xl sm:px-6 lg:px-8 space-y-6">
@if (session('status'))
<div class="rounded-md bg-green-50 p-4 dark:bg-green-900/30 border-l-4 border-green-400">
<div class="rounded-md bg-green-50 p-4 dark:bg-green-900/30 border-l-4 border-green-400 dark:border-green-500">
<p class="text-sm text-green-800 dark:text-green-200">{{ session('status') }}</p>
</div>
@endif
@if (session('error'))
<div class="rounded-md bg-red-50 p-4 dark:bg-red-900/30 border-l-4 border-red-400">
<div class="rounded-md bg-red-50 p-4 dark:bg-red-900/30 border-l-4 border-red-400 dark:border-red-500">
<p class="text-sm text-red-800 dark:text-red-200">{{ session('error') }}</p>
</div>
@endif
{{-- Payment Details --}}
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800 px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-4">{{ __('Payment Details') }}</h3>
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-4">付款詳情</h3>
<dl class="grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-2">
<div>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ __('Member') }}</dt>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">會員</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100">
{{ $payment->member->full_name }}<br>
<span class="text-gray-500">{{ $payment->member->email }}</span>
<span class="text-gray-500 dark:text-gray-400">{{ $payment->member->email }}</span>
</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ __('Status') }}</dt>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">狀態</dt>
<dd class="mt-1">
<span class="inline-flex items-center rounded-full px-2 py-1 text-xs font-medium
@if($payment->status === 'pending') bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200
@@ -48,27 +48,53 @@
</div>
<div>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ __('Amount') }}</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100">TWD {{ number_format($payment->amount, 0) }}</dd>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">會費類型</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100">{{ $payment->fee_type_label }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ __('Payment Date') }}</dt>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">繳納金額</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100">TWD {{ number_format($payment->amount, 0) }}</dd>
</div>
@if($payment->base_amount)
<div>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">原始金額</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100">TWD {{ number_format($payment->base_amount, 0) }}</dd>
</div>
@endif
@if($payment->disability_discount)
<div>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">身心障礙優惠</dt>
<dd class="mt-1 text-sm text-green-600 dark:text-green-400">-TWD {{ number_format($payment->discount_amount, 0) }}</dd>
</div>
@endif
@if($payment->final_amount)
<div>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">應繳金額</dt>
<dd class="mt-1 text-sm font-semibold text-indigo-600 dark:text-indigo-400">TWD {{ number_format($payment->final_amount, 0) }}</dd>
</div>
@endif
<div>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">付款日期</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100">{{ $payment->paid_at->format('Y-m-d') }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ __('Payment Method') }}</dt>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">付款方式</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100">{{ $payment->payment_method_label }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ __('Reference Number') }}</dt>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">參考編號</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100">{{ $payment->reference ?? '—' }}</dd>
</div>
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ __('Submitted By') }}</dt>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">提交者</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100">
{{ $payment->submittedBy->name }} on {{ $payment->created_at->format('Y-m-d H:i') }}
</dd>
@@ -76,21 +102,21 @@
@if($payment->notes)
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ __('Notes') }}</dt>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">備註</dt>
<dd class="mt-1 text-sm text-gray-900 dark:text-gray-100 whitespace-pre-line">{{ $payment->notes }}</dd>
</div>
@endif
@if($payment->receipt_path)
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ __('Payment Receipt') }}</dt>
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">付款收據</dt>
<dd class="mt-1">
<a href="{{ route('admin.payment-verifications.download-receipt', $payment) }}" target="_blank"
class="inline-flex items-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 dark:bg-gray-700 dark:text-gray-100 dark:ring-gray-600">
<svg class="-ml-0.5 mr-1.5 h-5 w-5 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
class="inline-flex items-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 dark:bg-gray-700 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-600">
<svg class="-ml-0.5 mr-1.5 h-5 w-5 text-gray-400 dark:text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
{{ __('Download Receipt') }}
下載收據
</a>
</dd>
</div>
@@ -100,7 +126,7 @@
{{-- Verification History --}}
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800 px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-4">{{ __('Verification History') }}</h3>
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-4">驗證歷史</h3>
<div class="flow-root">
<ul role="list" class="-mb-8">
@@ -112,7 +138,7 @@
<svg class="h-5 w-5 text-white" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" /></svg>
</span></div>
<div class="flex min-w-0 flex-1 justify-between space-x-4 pt-1.5">
<div><p class="text-sm text-gray-500 dark:text-gray-400">{{ __('Verified by Cashier') }}: <span class="font-medium text-gray-900 dark:text-gray-100">{{ $payment->verifiedByCashier->name }}</span></p></div>
<div><p class="text-sm text-gray-500 dark:text-gray-400">出納已驗證: <span class="font-medium text-gray-900 dark:text-gray-100">{{ $payment->verifiedByCashier->name }}</span></p></div>
<div class="whitespace-nowrap text-right text-sm text-gray-500 dark:text-gray-400">{{ $payment->cashier_verified_at->format('Y-m-d H:i') }}</div>
</div>
</div>
@@ -128,7 +154,7 @@
<svg class="h-5 w-5 text-white" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" /></svg>
</span></div>
<div class="flex min-w-0 flex-1 justify-between space-x-4 pt-1.5">
<div><p class="text-sm text-gray-500 dark:text-gray-400">{{ __('Verified by Accountant') }}: <span class="font-medium text-gray-900 dark:text-gray-100">{{ $payment->verifiedByAccountant->name }}</span></p></div>
<div><p class="text-sm text-gray-500 dark:text-gray-400">會計已驗證: <span class="font-medium text-gray-900 dark:text-gray-100">{{ $payment->verifiedByAccountant->name }}</span></p></div>
<div class="whitespace-nowrap text-right text-sm text-gray-500 dark:text-gray-400">{{ $payment->accountant_verified_at->format('Y-m-d H:i') }}</div>
</div>
</div>
@@ -144,7 +170,7 @@
<svg class="h-5 w-5 text-white" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" /></svg>
</span></div>
<div class="flex min-w-0 flex-1 justify-between space-x-4 pt-1.5">
<div><p class="text-sm text-gray-500 dark:text-gray-400">{{ __('Final Approval by Chair') }}: <span class="font-medium text-gray-900 dark:text-gray-100">{{ $payment->verifiedByChair->name }}</span></p></div>
<div><p class="text-sm text-gray-500 dark:text-gray-400">主席最終核准: <span class="font-medium text-gray-900 dark:text-gray-100">{{ $payment->verifiedByChair->name }}</span></p></div>
<div class="whitespace-nowrap text-right text-sm text-gray-500 dark:text-gray-400">{{ $payment->chair_verified_at->format('Y-m-d H:i') }}</div>
</div>
</div>
@@ -161,7 +187,7 @@
</span></div>
<div class="flex min-w-0 flex-1 justify-between space-x-4 pt-1.5">
<div>
<p class="text-sm text-gray-500 dark:text-gray-400">{{ __('Rejected by') }}: <span class="font-medium text-gray-900 dark:text-gray-100">{{ $payment->rejectedBy->name }}</span></p>
<p class="text-sm text-gray-500 dark:text-gray-400">拒絕者: <span class="font-medium text-gray-900 dark:text-gray-100">{{ $payment->rejectedBy->name }}</span></p>
@if($payment->rejection_reason)
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $payment->rejection_reason }}</p>
@endif
@@ -179,18 +205,56 @@
{{-- Verification Actions --}}
@if(!$payment->isRejected() && !$payment->isFullyApproved())
<div class="bg-white shadow sm:rounded-lg dark:bg-gray-800 px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-4">{{ __('Verification Actions') }}</h3>
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-4">驗證操作</h3>
<div class="space-y-4">
@if($payment->canBeApprovedByCashier() && Auth::user()->can('verify_payments_cashier'))
<form method="POST" action="{{ route('admin.payment-verifications.approve-cashier', $payment) }}" class="border-l-4 border-green-400 pl-4">
@csrf
{{-- Disability Certificate Verification (if applicable) --}}
@if($payment->member->hasDisabilityCertificate() && $payment->member->isDisabilityPending())
<div class="mb-6 p-4 bg-yellow-50 dark:bg-yellow-900/30 rounded-lg">
<h4 class="text-sm font-semibold text-yellow-800 dark:text-yellow-200 mb-3">身心障礙手冊審核</h4>
<p class="text-sm text-yellow-700 dark:text-yellow-300 mb-3">此會員已上傳身心障礙手冊,請一併審核:</p>
<a href="{{ route('admin.members.disability-certificate', $payment->member) }}" target="_blank"
class="inline-flex items-center mb-4 text-sm text-indigo-600 dark:text-indigo-400 hover:underline">
<svg class="w-4 h-4 mr-1" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
檢視身心障礙手冊
</a>
<div class="space-y-2">
<label class="flex items-center">
<input type="radio" name="disability_action" value="approve" class="h-4 w-4 text-green-600 focus:ring-green-500 border-gray-300 dark:border-gray-600">
<span class="ml-2 text-sm text-gray-700 dark:text-gray-300">通過 - 確認為有效身心障礙手冊</span>
</label>
<label class="flex items-center">
<input type="radio" name="disability_action" value="reject" class="h-4 w-4 text-red-600 focus:ring-red-500 border-gray-300 dark:border-gray-600">
<span class="ml-2 text-sm text-gray-700 dark:text-gray-300">駁回</span>
</label>
</div>
<div id="disability_rejection_reason_container" class="mt-3 hidden">
<label for="disability_rejection_reason" class="block text-sm font-medium text-gray-700 dark:text-gray-300">駁回原因</label>
<input type="text" name="disability_rejection_reason" id="disability_rejection_reason"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100"
placeholder="請說明駁回原因">
</div>
<p class="mt-3 text-xs text-yellow-600 dark:text-yellow-400">* 通過後,會員未來繳費將自動享有 50% 優惠</p>
</div>
@endif
<div class="mb-3">
<label for="cashier_notes" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Notes (Optional)') }}</label>
<label for="cashier_notes" class="block text-sm font-medium text-gray-700 dark:text-gray-300">備註(選填)</label>
<textarea name="notes" id="cashier_notes" rows="2" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100"></textarea>
</div>
<button type="submit" class="inline-flex justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-green-500">
{{ __('Approve as Cashier') }}
<button type="submit" class="inline-flex justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-green-500 dark:hover:bg-green-400">
出納核准
</button>
</form>
@endif
@@ -199,11 +263,11 @@
<form method="POST" action="{{ route('admin.payment-verifications.approve-accountant', $payment) }}" class="border-l-4 border-green-400 pl-4">
@csrf
<div class="mb-3">
<label for="accountant_notes" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Notes (Optional)') }}</label>
<label for="accountant_notes" class="block text-sm font-medium text-gray-700 dark:text-gray-300">備註(選填)</label>
<textarea name="notes" id="accountant_notes" rows="2" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100"></textarea>
</div>
<button type="submit" class="inline-flex justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-green-500">
{{ __('Approve as Accountant') }}
<button type="submit" class="inline-flex justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-green-500 dark:hover:bg-green-400">
會計核准
</button>
</form>
@endif
@@ -212,24 +276,24 @@
<form method="POST" action="{{ route('admin.payment-verifications.approve-chair', $payment) }}" class="border-l-4 border-green-400 pl-4">
@csrf
<div class="mb-3">
<label for="chair_notes" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Notes (Optional)') }}</label>
<label for="chair_notes" class="block text-sm font-medium text-gray-700 dark:text-gray-300">備註(選填)</label>
<textarea name="notes" id="chair_notes" rows="2" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100"></textarea>
</div>
<button type="submit" class="inline-flex justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-green-500">
{{ __('Final Approval as Chair') }}
<button type="submit" class="inline-flex justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-green-500 dark:hover:bg-green-400">
主席最終核准
</button>
</form>
@endif
{{-- Reject Form --}}
<form method="POST" action="{{ route('admin.payment-verifications.reject', $payment) }}" class="border-l-4 border-red-400 pl-4" onsubmit="return confirm('{{ __('Are you sure you want to reject this payment?') }}')">
<form method="POST" action="{{ route('admin.payment-verifications.reject', $payment) }}" class="border-l-4 border-red-400 pl-4" onsubmit="return confirm('您確定要拒絕此付款嗎?')">
@csrf
<div class="mb-3">
<label for="rejection_reason" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Rejection Reason') }} <span class="text-red-500">*</span></label>
<label for="rejection_reason" class="block text-sm font-medium text-gray-700 dark:text-gray-300">拒絕原因 <span class="text-red-500">*</span></label>
<textarea name="rejection_reason" id="rejection_reason" rows="3" 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 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100"></textarea>
</div>
<button type="submit" class="inline-flex justify-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500">
{{ __('Reject Payment') }}
<button type="submit" class="inline-flex justify-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 dark:hover:bg-red-400">
拒絕付款
</button>
</form>
</div>
@@ -238,10 +302,28 @@
{{-- Back Button --}}
<div>
<a href="{{ route('admin.payment-verifications.index') }}" class="inline-flex items-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 dark:bg-gray-700 dark:text-gray-100 dark:ring-gray-600">
{{ __('Back to List') }}
<a href="{{ route('admin.payment-verifications.index') }}" class="inline-flex items-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 dark:bg-gray-700 dark:text-gray-100 dark:ring-gray-600 dark:hover:bg-gray-600">
返回列表
</a>
</div>
</div>
</div>
</x-app-layout>
@push('scripts')
<script>
// Toggle disability rejection reason field
document.querySelectorAll('input[name="disability_action"]').forEach(function(radio) {
radio.addEventListener('change', function() {
const container = document.getElementById('disability_rejection_reason_container');
if (this.value === 'reject') {
container.classList.remove('hidden');
document.getElementById('disability_rejection_reason').required = true;
} else {
container.classList.add('hidden');
document.getElementById('disability_rejection_reason').required = false;
}
});
});
</script>
@endpush
</x-app-layout>