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

@@ -2,6 +2,7 @@
namespace Tests\Feature\Auth;
use App\Http\Middleware\VerifyCsrfToken;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -22,10 +23,11 @@ class AuthenticationTest extends TestCase
{
$user = User::factory()->create();
$response = $this->post('/login', [
'email' => $user->email,
'password' => 'password',
]);
$response = $this->withoutMiddleware(VerifyCsrfToken::class)
->post('/login', [
'email' => $user->email,
'password' => 'password',
]);
$this->assertAuthenticated();
$response->assertRedirect(RouteServiceProvider::HOME);
@@ -35,10 +37,11 @@ class AuthenticationTest extends TestCase
{
$user = User::factory()->create();
$this->post('/login', [
'email' => $user->email,
'password' => 'wrong-password',
]);
$this->withoutMiddleware(VerifyCsrfToken::class)
->post('/login', [
'email' => $user->email,
'password' => 'wrong-password',
]);
$this->assertGuest();
}
@@ -47,7 +50,9 @@ class AuthenticationTest extends TestCase
{
$user = User::factory()->create();
$response = $this->actingAs($user)->post('/logout');
$response = $this->withoutMiddleware(VerifyCsrfToken::class)
->actingAs($user)
->post('/logout');
$this->assertGuest();
$response->assertRedirect('/');

View File

@@ -2,6 +2,7 @@
namespace Tests\Feature\Auth;
use App\Http\Middleware\VerifyCsrfToken;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
@@ -23,9 +24,11 @@ class PasswordConfirmationTest extends TestCase
{
$user = User::factory()->create();
$response = $this->actingAs($user)->post('/confirm-password', [
'password' => 'password',
]);
$response = $this->withoutMiddleware(VerifyCsrfToken::class)
->actingAs($user)
->post('/confirm-password', [
'password' => 'password',
]);
$response->assertRedirect();
$response->assertSessionHasNoErrors();
@@ -35,9 +38,11 @@ class PasswordConfirmationTest extends TestCase
{
$user = User::factory()->create();
$response = $this->actingAs($user)->post('/confirm-password', [
'password' => 'wrong-password',
]);
$response = $this->withoutMiddleware(VerifyCsrfToken::class)
->actingAs($user)
->post('/confirm-password', [
'password' => 'wrong-password',
]);
$response->assertSessionHasErrors();
}

View File

@@ -2,6 +2,7 @@
namespace Tests\Feature\Auth;
use App\Http\Middleware\VerifyCsrfToken;
use App\Models\User;
use Illuminate\Auth\Notifications\ResetPassword;
use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -25,7 +26,8 @@ class PasswordResetTest extends TestCase
$user = User::factory()->create();
$this->post('/forgot-password', ['email' => $user->email]);
$this->withoutMiddleware(VerifyCsrfToken::class)
->post('/forgot-password', ['email' => $user->email]);
Notification::assertSentTo($user, ResetPassword::class);
}
@@ -36,7 +38,8 @@ class PasswordResetTest extends TestCase
$user = User::factory()->create();
$this->post('/forgot-password', ['email' => $user->email]);
$this->withoutMiddleware(VerifyCsrfToken::class)
->post('/forgot-password', ['email' => $user->email]);
Notification::assertSentTo($user, ResetPassword::class, function ($notification) {
$response = $this->get('/reset-password/'.$notification->token);
@@ -53,15 +56,17 @@ class PasswordResetTest extends TestCase
$user = User::factory()->create();
$this->post('/forgot-password', ['email' => $user->email]);
$this->withoutMiddleware(VerifyCsrfToken::class)
->post('/forgot-password', ['email' => $user->email]);
Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) {
$response = $this->post('/reset-password', [
'token' => $notification->token,
'email' => $user->email,
'password' => 'password',
'password_confirmation' => 'password',
]);
$response = $this->withoutMiddleware(VerifyCsrfToken::class)
->post('/reset-password', [
'token' => $notification->token,
'email' => $user->email,
'password' => 'password',
'password_confirmation' => 'password',
]);
$response
->assertSessionHasNoErrors()

View File

@@ -2,6 +2,7 @@
namespace Tests\Feature\Auth;
use App\Http\Middleware\VerifyCsrfToken;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Hash;
@@ -15,7 +16,7 @@ class PasswordUpdateTest extends TestCase
{
$user = User::factory()->create();
$response = $this
$response = $this->withoutMiddleware(VerifyCsrfToken::class)
->actingAs($user)
->from('/profile')
->put('/password', [
@@ -35,7 +36,7 @@ class PasswordUpdateTest extends TestCase
{
$user = User::factory()->create();
$response = $this
$response = $this->withoutMiddleware(VerifyCsrfToken::class)
->actingAs($user)
->from('/profile')
->put('/password', [

View File

@@ -2,6 +2,7 @@
namespace Tests\Feature\Auth;
use App\Http\Middleware\VerifyCsrfToken;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
@@ -19,12 +20,13 @@ class RegistrationTest extends TestCase
public function test_new_users_can_register(): void
{
$response = $this->post('/register', [
'name' => 'Test User',
'email' => 'test@example.com',
'password' => 'password',
'password_confirmation' => 'password',
]);
$response = $this->withoutMiddleware(VerifyCsrfToken::class)
->post('/register', [
'name' => 'Test User',
'email' => 'test@example.com',
'password' => 'password',
'password_confirmation' => 'password',
]);
$this->assertAuthenticated();
$response->assertRedirect(RouteServiceProvider::HOME);