5.0 KiB
5.0 KiB
HQLAND - HƯỚNG DẪN PHIÊN LÀM VIỆC TIẾP THEO
File này giúp AI Agent nhanh chóng bắt nhịp khi bạn chuyển sang máy tính khác.
Cập nhật: 24/04/2026
⚠️ THÔNG BÁO QUAN TRỌNG
Có 26 file thay đổi CHƯA COMMIT. Bạn cần commit hoặc stash trước khi chuyển máy, nếu không sẽ mất toàn bộ công việc vừa làm!
# Cách 1: Commit ngay (KHUYẾN NGHỊ)
git add -A
git commit -m "Hoan thien core finance v2"
# Cách 2: Hoặc stash để commit sau
git stash -u
1. NHỮNG GÌ VỪA HOÀN THÀNH (Phiên hiện tại)
✅ Fix lỗi quan trọng
- EditAction not found: Đã sửa namespace
Filament\Actions\EditAction(không phảiFilament\Tables\Actions\EditAction) - User quyền truy cập: Thêm
FilamentUserinterface vàoUser.php
✅ ContractForm + Tự động tạo lịch
- Migration mới:
payment_template_idtrong bảngcontracts payment_template_idđã lưu vào DB, không còndehydrated(false)- Tự động tạo lịch thanh toán khi tạo HĐ mới
✅ PaymentForm Validation
- Số tiền thu không vượt quá công nợ đợt TT / công nợ HĐ
- Helper text hiển thị công nợ còn lại
- Fix lỗi khi edit payment (kiểm tra
instanceof Payment)
✅ PaymentsTable
- Thêm cột: Loại đợt, Trạng thái đối soát (Đủ/Thiếu/Thừa), Còn thiếu
✅ ContractsTable
- Thêm cột:
paid_amount,remaining_amount ContractResourcegiờ delegate vềContractsTableSchemas
✅ Hiệu năng
- Fix N+1 query ở
PaymentScheduleItem::getPaidAmountAttribute()(kiểm trarelationLoaded)
✅ Command mới
php artisan contracts:generate-schedules {--force}- Tạo lịch hàng loạt cho 139 HĐ
✅ Resources mới
PaymentFineResource- Quản lý tiền phạtAppendixResource- Quản lý phụ lục HĐSettlementResource- Quản lý quyết toán & sổ đỏ
✅ Discount Engine
DiscountEngine::calculate()- Tính chiết khấu tự động- Accessor
final_valuetrong Contract model - Hiển thị giá trị sau chiết khấu cả khi create và edit
✅ Dashboard
ContractStatsOverview- 5 chỉ số tài chính tổng quanUpcomingPaymentsTable- Danh sách đợt TT sắp đến hạn (30 ngày)
2. CẤU HÌNH DATABASE (QUAN TRỌNG)
Database chính (Production)
- Connection: pgsql
- Host: 127.0.0.1 (từ host machine)
- Database: laravel
- Username/Password: sail / password
Database test
- Database: laravel_testing (đã tạo, migrations đã chạy)
- Chạy test:
DB_HOST=127.0.0.1 ./vendor/bin/pest
Lệnh chạy Artisan
DB_HOST=127.0.0.1 php artisan tinkerDB_HOST=127.0.0.1 php artisan migrate(KHÔNG dùngmigrate:fresh!)
3. CÁC FILE CHƯA COMMIT
Modified (17 file)
AGENTS.md
app/Console/Commands/ImportContractsComplex.php
app/Filament/Resources/Contracts/ContractResource.php
app/Filament/Resources/Contracts/Pages/CreateContract.php
app/Filament/Resources/Contracts/Schemas/ContractForm.php
app/Filament/Resources/Contracts/Tables/ContractsTable.php
app/Filament/Resources/Payments/PaymentResource.php
app/Filament/Resources/Payments/Schemas/PaymentForm.php
app/Filament/Resources/Payments/Tables/PaymentsTable.php
app/Models/Contract.php
app/Models/PaymentScheduleItem.php
app/Models/User.php
app/Providers/Filament/AdminPanelProvider.php
Untracked mới (9 file/folder)
app/Console/Commands/GenerateContractSchedules.php
app/Filament/Resources/Appendices/
app/Filament/Resources/PaymentFines/
app/Filament/Resources/Settlements/
app/Filament/Widgets/
app/Services/DiscountEngine.php
database/migrations/2026_04_24_083000_add_payment_template_id_to_contracts.php
tests/Feature/ContractResourceRenderTest.php
4. VIỆC CẦN LÀM TIẾP THEO (Checklist)
🟡 Trung bình ưu tiên
- Notification: Cảnh báo đợt thanh toán sắp đến hạn (30/7/3 ngày)
- Export Excel: Xuất báo cáo công nợ khách hàng
- Báo cáo theo Dự án: Thống kê bán hàng, thanh toán theo dự án
🟢 Thấp ưu tiên
- Audit Log: Lưu lịch sử sửa HĐ, thu tiền
- Queue: Generate schedules qua queue nếu >1000 HĐ
- Email/SMS: Tự động nhắc thanh toán
- Advanced Filter: Tìm HĐ theo khoảng giá trị, ngày ký
5. CÂU LỆNH TEST QUAN TRỌNG
# Test toàn bộ
DB_HOST=127.0.0.1 ./vendor/bin/pest
# Test cụ thể
DB_HOST=127.0.0.1 ./vendor/bin/pest --filter="ContractFinanceFlowTest"
# Test render (kiểm tra không bị lỗi class not found)
DB_HOST=127.0.0.1 ./vendor/bin/pest --filter="ContractResourceRenderTest"
Kết quả hiện tại: 9 tests passed, 0 failed.
6. TÀI KHOẢN ĐĂNG NHẬP
- Email: admin@phuongtc.com
- Password: 1Qazxsw2@!321
Lưu ý: Commit ngay lập tức trước khi tắt máy hoặc chuyển sang máy khác!