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">
{{ __('Record Transaction') }} (¤)
記錄交易
</h2>
</x-slot>
@@ -14,13 +14,13 @@
<!-- Transaction Type -->
<div>
<label for="transaction_type" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Transaction Type') }} <span class="text-red-500">*</span>
交易類型 <span class="text-red-500">*</span>
</label>
<select name="transaction_type" id="transaction_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 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100 @error('transaction_type') border-red-300 @enderror">
<option value="">{{ __('Select type...') }}</option>
<option value="income" @selected(old('transaction_type') === 'income')>{{ __('Income') }} (6e)</option>
<option value="expense" @selected(old('transaction_type') === 'expense')>{{ __('Expense') }} (/ú)</option>
<option value="">選擇類型...</option>
<option value="income" @selected(old('transaction_type') === 'income')>收入</option>
<option value="expense" @selected(old('transaction_type') === 'expense')>支出</option>
</select>
@error('transaction_type')<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>@enderror
</div>
@@ -28,19 +28,19 @@
<!-- Account -->
<div>
<label for="chart_of_account_id" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Account') }} <span class="text-red-500">*</span>
帳戶 <span class="text-red-500">*</span>
</label>
<select name="chart_of_account_id" id="chart_of_account_id" 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 @error('chart_of_account_id') border-red-300 @enderror">
<option value="">{{ __('Select account...') }}</option>
<optgroup label="{{ __('Income Accounts') }}">
<option value="">選擇帳戶...</option>
<optgroup label="收入帳戶">
@foreach($incomeAccounts as $account)
<option value="{{ $account->id }}" @selected(old('chart_of_account_id') == $account->id)>
{{ $account->account_code }} - {{ $account->account_name_zh }}
</option>
@endforeach
</optgroup>
<optgroup label="{{ __('Expense Accounts') }}">
<optgroup label="支出帳戶">
@foreach($expenseAccounts as $account)
<option value="{{ $account->id }}" @selected(old('chart_of_account_id') == $account->id)>
{{ $account->account_code }} - {{ $account->account_name_zh }}
@@ -54,7 +54,7 @@
<!-- Transaction Date -->
<div>
<label for="transaction_date" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Transaction Date') }} <span class="text-red-500">*</span>
交易日期 <span class="text-red-500">*</span>
</label>
<input type="date" name="transaction_date" id="transaction_date" value="{{ old('transaction_date', now()->format('Y-m-d')) }}" 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 @error('transaction_date') border-red-300 @enderror">
@@ -64,7 +64,7 @@
<!-- Amount -->
<div>
<label for="amount" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Amount') }} (NT$) <span class="text-red-500">*</span>
金額 (NT$) <span class="text-red-500">*</span>
</label>
<input type="number" name="amount" id="amount" value="{{ old('amount') }}" step="0.01" min="0.01" 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 @error('amount') border-red-300 @enderror"
@@ -75,33 +75,33 @@
<!-- Description -->
<div>
<label for="description" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Description') }} <span class="text-red-500">*</span>
描述 <span class="text-red-500">*</span>
</label>
<input type="text" name="description" id="description" value="{{ old('description') }}" required maxlength="255"
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 @error('description') border-red-300 @enderror"
placeholder="{{ __('Brief description of the transaction') }}">
placeholder="交易的簡要描述">
@error('description')<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>@enderror
</div>
<!-- Reference Number -->
<div>
<label for="reference_number" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Reference Number') }}
參考編號
</label>
<input type="text" name="reference_number" id="reference_number" value="{{ old('reference_number') }}" maxlength="255"
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="{{ __('Receipt or invoice number (optional)') }}">
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">{{ __('Optional reference or receipt number') }}</p>
placeholder="收據或發票號碼(選填)">
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">選填參考編號或收據號碼</p>
</div>
<!-- Budget Item (Optional) -->
<div>
<label for="budget_item_id" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Link to Budget') }}
連結至預算
</label>
<select name="budget_item_id" id="budget_item_id"
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">
<option value="">{{ __('No budget link (standalone transaction)') }}</option>
<option value="">不連結預算(獨立交易)</option>
@foreach($budgets as $budget)
<optgroup label="{{ $budget->name }} ({{ $budget->fiscal_year }})">
@foreach($budget->budgetItems as $item)
@@ -112,28 +112,28 @@
</optgroup>
@endforeach
</select>
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">{{ __('Link this transaction to a budget item to track actual vs budgeted amounts') }}</p>
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">將此交易連結至預算項目以追蹤實際與預算金額</p>
</div>
<!-- Notes -->
<div>
<label for="notes" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ __('Notes') }}
備註
</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 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100"
placeholder="{{ __('Additional notes (optional)') }}">{{ old('notes') }}</textarea>
placeholder="額外備註(選填)">{{ old('notes') }}</textarea>
</div>
<!-- Actions -->
<div class="flex items-center justify-end gap-x-4 border-t border-gray-200 pt-6 dark:border-gray-700">
<a href="{{ route('admin.transactions.index') }}"
class="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">
{{ __('Cancel') }}
取消
</a>
<button type="submit"
class="inline-flex justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:bg-indigo-500 dark:hover:bg-indigo-400 dark:focus:ring-offset-gray-800">
{{ __('Record Transaction') }}
記錄交易
</button>
</div>
</form>
@@ -148,13 +148,13 @@
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-blue-800 dark:text-blue-200">{{ __('Recording Transactions') }}</h3>
<h3 class="text-sm font-medium text-blue-800 dark:text-blue-200">記錄交易</h3>
<div class="mt-2 text-sm text-blue-700 dark:text-blue-300">
<ul class="list-disc pl-5 space-y-1">
<li>{{ __('Choose income or expense type based on money flow') }}</li>
<li>{{ __('Select the appropriate chart of account for categorization') }}</li>
<li>{{ __('Link to a budget item to automatically update budget vs actual tracking') }}</li>
<li>{{ __('Add reference numbers for audit trails and reconciliation') }}</li>
<li>根據資金流向選擇收入或支出類型</li>
<li>選擇適當的會計科目進行分類</li>
<li>連結至預算項目以自動更新預算與實際追蹤</li>
<li>新增參考編號以供稽核追蹤和對帳</li>
</ul>
</div>
</div>
@@ -162,4 +162,4 @@
</div>
</div>
</div>
</x-app-layout>
</x-app-layout>

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">
{{ __('Transactions') }} (¤)
收支記錄 (收支記錄)
</h2>
</x-slot>
@@ -17,13 +17,13 @@
<!-- Header -->
<div class="sm:flex sm:items-center sm:justify-between mb-6">
<div>
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">{{ __('Transaction List') }}</h3>
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">{{ __('Track all income and expense transactions') }}</p>
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">交易列表</h3>
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">追蹤所有收入和支出交易</p>
</div>
<div class="mt-4 sm:mt-0">
<a href="{{ route('admin.transactions.create') }}" class="inline-flex items-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:bg-indigo-500 dark:hover:bg-indigo-400 dark:focus:ring-offset-gray-800">
<svg class="-ml-0.5 mr-1.5 h-5 w-5" fill="currentColor" viewBox="0 0 20 20"><path d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z"/></svg>
{{ __('Record Transaction') }}
記錄交易
</a>
</div>
</div>
@@ -31,11 +31,11 @@
<!-- Summary Cards -->
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 mb-6">
<div class="bg-green-50 dark:bg-green-900/30 rounded-lg p-4 border-l-4 border-green-400">
<dt class="text-sm font-medium text-green-800 dark:text-green-200">{{ __('Total Income') }}</dt>
<dt class="text-sm font-medium text-green-800 dark:text-green-200">總收入</dt>
<dd class="mt-1 text-2xl font-semibold text-green-900 dark:text-green-100">NT$ {{ number_format($totalIncome, 2) }}</dd>
</div>
<div class="bg-red-50 dark:bg-red-900/30 rounded-lg p-4 border-l-4 border-red-400">
<dt class="text-sm font-medium text-red-800 dark:text-red-200">{{ __('Total Expense') }}</dt>
<dt class="text-sm font-medium text-red-800 dark:text-red-200">總支出</dt>
<dd class="mt-1 text-2xl font-semibold text-red-900 dark:text-red-100">NT$ {{ number_format($totalExpense, 2) }}</dd>
</div>
</div>
@@ -44,38 +44,38 @@
<form method="GET" class="mb-6 space-y-4" role="search">
<div class="grid grid-cols-1 gap-4 sm:grid-cols-4">
<div>
<label for="transaction_type" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Type') }}</label>
<label for="transaction_type" class="block text-sm font-medium text-gray-700 dark:text-gray-300">類型</label>
<select name="transaction_type" id="transaction_type" 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">
<option value="">{{ __('All') }}</option>
<option value="income" @selected(request('transaction_type') === 'income')>{{ __('Income') }}</option>
<option value="expense" @selected(request('transaction_type') === 'expense')>{{ __('Expense') }}</option>
<option value="">所有</option>
<option value="income" @selected(request('transaction_type') === 'income')>收入</option>
<option value="expense" @selected(request('transaction_type') === 'expense')>支出</option>
</select>
</div>
<div>
<label for="chart_of_account_id" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Account') }}</label>
<label for="chart_of_account_id" class="block text-sm font-medium text-gray-700 dark:text-gray-300">帳戶</label>
<select name="chart_of_account_id" id="chart_of_account_id" 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">
<option value="">{{ __('All Accounts') }}</option>
<option value="">所有帳戶</option>
@foreach($accounts as $account)
<option value="{{ $account->id }}" @selected(request('chart_of_account_id') == $account->id)>{{ $account->account_code }} - {{ $account->account_name_zh }}</option>
@endforeach
</select>
</div>
<div>
<label for="start_date" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Start Date') }}</label>
<label for="start_date" class="block text-sm font-medium text-gray-700 dark:text-gray-300">開始日期</label>
<input type="date" name="start_date" id="start_date" value="{{ request('start_date') }}" 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">
</div>
<div>
<label for="end_date" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('End Date') }}</label>
<label for="end_date" class="block text-sm font-medium text-gray-700 dark:text-gray-300">結束日期</label>
<input type="date" name="end_date" id="end_date" value="{{ request('end_date') }}" 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">
</div>
</div>
<div class="flex gap-4">
<div class="flex-1">
<label for="search" class="block text-sm font-medium text-gray-700 dark:text-gray-300">{{ __('Search') }}</label>
<input type="text" name="search" id="search" value="{{ request('search') }}" placeholder="{{ __('Description or reference 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 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
<label for="search" class="block text-sm font-medium text-gray-700 dark:text-gray-300">搜尋</label>
<input type="text" name="search" id="search" value="{{ request('search') }}" 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 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-100">
</div>
<div class="flex items-end">
<button type="submit" class="inline-flex justify-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">{{ __('Filter') }}</button>
<button type="submit" class="inline-flex justify-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">篩選</button>
</div>
</div>
</form>
@@ -83,15 +83,15 @@
<!-- Transactions Table -->
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg dark:ring-gray-700">
<table class="min-w-full divide-y divide-gray-300 dark:divide-gray-600">
<caption class="sr-only">{{ __('List of transactions') }}</caption>
<caption class="sr-only">交易列表</caption>
<thead class="bg-gray-50 dark:bg-gray-900">
<tr>
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Date') }}</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Type') }}</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Account') }}</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Description') }}</th>
<th scope="col" class="px-3 py-3.5 text-right text-sm font-semibold text-gray-900 dark:text-gray-100">{{ __('Amount') }}</th>
<th scope="col" class="relative py-3.5 pl-3 pr-4"><span class="sr-only">{{ __('Actions') }}</span></th>
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">日期</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">類型</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">帳戶</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-gray-100">描述</th>
<th scope="col" class="px-3 py-3.5 text-right text-sm font-semibold text-gray-900 dark:text-gray-100">金額</th>
<th scope="col" class="relative py-3.5 pl-3 pr-4"><span class="sr-only">操作</span></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-800">
@@ -102,9 +102,9 @@
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
@if($transaction->transaction_type === 'income')
<span class="inline-flex items-center rounded-full bg-green-100 px-2 py-1 text-xs font-medium text-green-800 dark:bg-green-900 dark:text-green-200">{{ __('Income') }}</span>
<span class="inline-flex items-center rounded-full bg-green-100 px-2 py-1 text-xs font-medium text-green-800 dark:bg-green-900 dark:text-green-200">收入</span>
@else
<span class="inline-flex items-center rounded-full bg-red-100 px-2 py-1 text-xs font-medium text-red-800 dark:bg-red-900 dark:text-red-200">{{ __('Expense') }}</span>
<span class="inline-flex items-center rounded-full bg-red-100 px-2 py-1 text-xs font-medium text-red-800 dark:bg-red-900 dark:text-red-200">支出</span>
@endif
</td>
<td class="px-3 py-4 text-sm text-gray-900 dark:text-gray-100">
@@ -116,16 +116,16 @@
{{ $transaction->transaction_type === 'income' ? '+' : '-' }}NT$ {{ number_format($transaction->amount, 2) }}
</td>
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium">
<a href="{{ route('admin.transactions.show', $transaction) }}" class="text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300">{{ __('View') }}</a>
<a href="{{ route('admin.transactions.show', $transaction) }}" class="text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300">檢視</a>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-3 py-8 text-center text-sm text-gray-500 dark:text-gray-400">
<p>{{ __('No transactions found') }}</p>
<p>找不到交易記錄</p>
<div class="mt-4">
<a href="{{ route('admin.transactions.create') }}" class="inline-flex items-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 dark:bg-indigo-500 dark:hover:bg-indigo-400">
+ {{ __('Record First Transaction') }}
+ 記錄第一筆交易
</a>
</div>
</td>
@@ -142,4 +142,4 @@
</div>
</div>
</div>
</x-app-layout>
</x-app-layout>