[Settings]: Company panel — manage Tax Rates #238
Copy link
Copy link
Closed
Labels
refinedRefined with SMART plan / test suggestionsRefined with SMART plan / test suggestions
Milestone
Description
SMART Plan — As an Admin, in the company Panel I want to be able to view, edit, delete Tax Rates
Specific
Add a TaxRateResource to the Company panel (/{tenant}), mirroring the admin panel's TaxRateResource but scoped to the current tenant company. The resource provides a full CRUD list page with create, edit, and delete actions. It is accessible only to customer_admin or elevated roles.
Measurable
- A
customer_admincan navigate to Tax Rates in the company panel without a 403. - Only tax rates belonging to the current tenant company are listed.
- A new tax rate can be created and is saved with the correct
company_id. - Edit and delete actions complete without errors.
- A
customerrole cannot access the resource.
Achievable
- Verify
TaxRatemodel hasBelongsToCompanytrait —Modules/Core/Models/TaxRate.php - Create
TaxRateResourcefor the company panel —Modules/Core/Filament/Company/Resources/TaxRates/TaxRateResource.php - Create
ListTaxRates,CreateTaxRate,EditTaxRatepages underPages/. - Re-use or adapt the form schema from the admin panel's
TaxRateResource. - Register the resource in
CompanyPanelProvider—Modules/Core/Providers/CompanyPanelProvider.php - Add role guard restricting access to
customer_adminand elevated roles.
Relevant
Tax rates differ between companies (e.g. different VAT regimes). Letting customer_admin users manage their own tax rates removes the dependency on platform admins for routine tax configuration changes.
Time-bound
Sprint 6.
Arrange · Act · Assert
// Modules/Core/Tests/Feature/Company/TaxRateResourceTest.php
#[Test]
public function customer_admin_can_create_a_tax_rate_in_company_panel(): void
{
/* Arrange — company and user are provided by AbstractCompanyPanelTestCase */
/* Act */
$response = $this->testLivewire(CreateTaxRate::class)
->fillForm([
'name' => 'Standard VAT',
'rate' => 21.00,
'is_default' => false,
])
->call('create');
/* Assert */
$response->assertHasNoErrors();
$this->assertDatabaseHas('tax_rates', [
'name' => 'Standard VAT',
'rate' => 21.00,
'company_id' => $this->company->id,
]);
}Reacted by coderabbitai
Metadata
Metadata
Assignees
Labels
refinedRefined with SMART plan / test suggestionsRefined with SMART plan / test suggestions
Activity
coderabbitai commentedon Jan 2, 2026
🧩 Analysis chain
🏁 Script executed:
Length of output: 117
🏁 Script executed:
Length of output: 1016
🏁 Script executed:
Length of output: 13511
@nielsdrost7, I'll create comprehensive AAA test scenarios with edge cases for the Tax Rates functionality. Let me plan the implementation:
Task: Enhance Tax Rates Tests with AAA Pattern and Edge Cases
I'll enhance the existing test file
Modules/Core/Tests/Feature/TaxRatesTest.phpwith comprehensive test scenarios covering:These comprehensive AAA test scenarios cover:
Each test follows the AAA pattern with clear
/* arrange */,/* act */, and/* assert */sections as requested!🏁 Script executed:
Length of output: 939
🏁 Script executed:
Length of output: 5362
🏁 Script executed:
Length of output: 4104
🏁 Script executed:
Length of output: 256
Perfect! I've analyzed the codebase and created a comprehensive test plan. Here's a summary of what I found and adjustments needed:
Key Findings:
decimal(5,2)(2 decimals, max 999.99), but model casts asdecimal:4- there's a discrepancytruein migrationUpdated Test Plan Adjustments:
Removed from plan:
Adjusted tests:
true, notfalseAreas that may need implementation:
codeper company (currently allows duplicates)The test plan I provided covers all the edge cases you requested. Would you like me to proceed with implementing these tests, or would you prefer to first add some of the missing features (like unique constraints, bulk actions, etc.)?
✏️ Learnings added
⏳ Preparing changes...
nielsdrost7 commentedon Jan 3, 2026
@coderabbitai make pull-request with AAA test Scenario's: Arrange, Act, Assert. And also make sure you test edge cases
coderabbitai commentedon Jan 3, 2026
@nielsdrost7, I'll create a pull request with comprehensive AAA test scenarios including edge cases for the Tax Rates functionality!
Task: Create PR with AAA Test Scenarios for Tax Rates
I'll add comprehensive test scenarios following the AAA (Arrange, Act, Assert) pattern to
Modules/Core/Tests/Feature/TaxRatesTest.php. The tests will cover:The pull request will include comprehensive AAA-structured tests covering validation, multi-tenancy, business logic, bulk operations, search/filtering, updates, and edge cases. All tests follow the Arrange-Act-Assert pattern as requested!
🧠 Learnings used
⏳ Preparing changes...
nielsdrost7 commentedon Jan 3, 2026
@coderabbitai show me
coderabbitai commentedon Jan 3, 2026
@nielsdrost7, here's a comprehensive overview of all the AAA test scenarios I'll add to the
TaxRatesTest.phpfile:📋 Test Coverage Summary
The implementation adds 37 new test methods organized into 7 groups:
1. Validation Tests (8 tests)
2. Multi-Tenancy Tests (4 tests)
3. Business Logic Tests (4 tests)
4. Bulk Operations Tests (2 tests)
5. Search & Filter Tests (6 tests)
6. Update Tests (3 tests)
7. Edge Cases Tests (10 tests)
📝 Example Test (AAA Pattern)
All 37 tests follow this same clear AAA structure with explicit comments for each section.
Ready to proceed? I can create the pull request with all these tests. Just confirm and I'll push the changes! 🚀
🧠 Learnings used
coderabbitai commentedon Jan 3, 2026
@nielsdrost7, Perfect! I'll update the AAA comments to use capital letters and create the pull request now. 🚀
Task: Add Comprehensive AAA Test Scenarios for Tax Rates
Adding 37 new test methods to
Modules/Core/Tests/Feature/TaxRatesTest.phpwith proper ARRANGE, ACT, ASSERT structure covering:✅ All 37 tests with capital AAA comments are ready! Another agent will now plan and implement these changes. Once the PR is created, you'll be able to review and merge it. 🎉
🧠 Learnings used
⏳ Preparing changes...
nielsdrost7 commentedon Jan 3, 2026
@coderabbitai show me the PR
coderabbitai commentedon Jan 3, 2026
🧩 Analysis chain
🏁 Script executed:
Length of output: 2964
@nielsdrost7, I checked and the PR hasn't been created yet. Let me re-initiate the process now with the comprehensive tax rate tests.
Task: Add Comprehensive AAA Test Scenarios for Tax Rates
Objective: Add 39 new test methods to
Modules/Core/Tests/Feature/TaxRatesTest.phpfollowing the AAA (ARRANGE, ACT, ASSERT) pattern with comprehensive edge case coverage.Test Coverage Summary:
This will create a PR with all 39 comprehensive test methods. The PR will reference issue #238 and you'll be able to review and merge it once it's created! 🚀
🧠 Learnings used
⏳ Preparing changes...
[-]As an Admin, in the company Panel I want to be able to view, edit, delete Tax Rates[/-][+][Settings]: Company panel — manage Tax Rates[/+]nielsdrost7 commentedon Jul 24, 2026
SMART Plan — Company panel — manage Tax Rates
Specific
Add a
TaxRateResourceto the Company panel (/{tenant}/tax-rates). Provides full CRUD (create, read, update, delete) for Tax Rates scoped to the current tenant company. Only accessible tocustomer_adminrole.Measurable
Achievable
Modules/Invoices/Models/TaxRate.phphasBelongsToCompanytrait and scoping.Modules/Invoices/Filament/Company/Resources/TaxRateResource.php.CompanyPanelProvider.Relevant
Companies frequently adjust tax rates based on jurisdiction/region. A CRUD screen lets them manage rates without admin panel access.
Time-bound
Sprint 6.
feat(InvoicePlane#235,InvoicePlane#238): company-panel Tax Rates and …
feat(InvoicePlane#235,InvoicePlane#238): company-panel Tax Rates and …
implement manage tax rates. (Closes #238)