Repository navigation
[Settings]: Company panel — manage Invoice Groups #236
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 Invoice Groups
Specific
Ensure a NumberingResource exists in the Company panel (/{tenant}) that is fully functional for view, edit, and delete operations scoped to the current tenant. The context notes that this resource may already exist at Modules/Core/Filament/Company/Resources/Numberings/NumberingResource.php — if so, verify it exposes edit and delete. If absent, create it.
Measurable
- A
customer_admincan navigate to Invoice Groups in the company panel. - The list page shows only
Numberingrecords belonging to the current tenant company. - Edit saves changes correctly; delete removes the record; create adds a new scoped record.
- A
customerrole cannot access the resource.
Achievable
- Check if
NumberingResourceexists atModules/Core/Filament/Company/Resources/Numberings/NumberingResource.php; if not, create it following the admin panel version as a template. - Ensure
EditNumberingandDeleteActionare included in the resource pages / table actions. - Scope all queries via
BelongsToCompanyglobal scope on theNumberingmodel. - Register the resource in
CompanyPanelProviderif not already registered —Modules/Core/Providers/CompanyPanelProvider.php - Add role guard so only
customer_admin/ elevated roles can access.
Relevant
Invoice Groups define the numbering format for a company's documents (e.g. INV-2026-0001). Company admins must be able to manage these independently to meet their own document numbering requirements without raising a support ticket to the platform admin.
Time-bound
Sprint 6.
Arrange · Act · Assert
// Modules/Core/Tests/Feature/Company/NumberingResourceTest.php
#[Test]
public function customer_admin_can_edit_a_numbering_in_company_panel(): void
{
/* Arrange */
$numbering = Numbering::factory()->for($this->company)->create(['prefix' => 'INV-']);
/* Act */
$response = $this->testLivewire(EditNumbering::class, ['record' => $numbering->id])
->fillForm(['prefix' => 'BILL-'])
->call('save');
/* Assert */
$response->assertHasNoErrors();
$this->assertDatabaseHas('numberings', ['id' => $numbering->id, 'prefix' => 'BILL-']);
}
#[Test]
public function customer_admin_can_delete_a_numbering_in_company_panel(): void
{
/* Arrange */
$numbering = Numbering::factory()->for($this->company)->create();
/* Act */
$this->testLivewire(ListNumberings::class)
->callTableAction(DeleteAction::class, $numbering)
->assertHasNoErrors();
/* Assert */
$this->assertDatabaseMissing('numberings', ['id' => $numbering->id]);
}Reacted by coderabbitai
Metadata
Metadata
Assignees
Labels
refinedRefined with SMART plan / test suggestionsRefined with SMART plan / test suggestions
Activity
coderabbitai commentedon Dec 28, 2025
📝 CodeRabbit Plan Mode
Generate an implementation plan and prompts that you can use with your favorite coding agent.
Examples
🔗 Similar Issues
Possible Duplicates
Related Issues
👤 Suggested Assignees
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
nielsdrost7 commentedon Jan 2, 2026
@coderabbitai make pull-request with AAA test Scenario's: Arrange, Act, Assert. And also make sure you test edge cases
coderabbitai commentedon Jan 2, 2026
Coding Plan
Approach
Implement complete CRUD functionality for Invoice Groups in the Company Panel, allowing company administrators to organize and manage groups of invoices. Create comprehensive test coverage using AAA pattern to verify all operations and edge cases.
Observations
This is a multi-tenant Laravel application using Filament for admin panels. The Company Panel serves as the primary tenant-scoped interface where company users manage their invoices and related entities. The codebase follows a modular structure with modules in
Modules/{Module}/containing Models, Migrations, Filament Resources, and Tests. All company-scoped entities use theBelongsToCompanytrait for automatic query scoping. Tests follow the AAA (Arrange-Act-Assert) pattern with explicit comments, extend fromAbstractCompanyPanelTestCase, and use factories inheriting fromAbstractFactoryfor test data generation. Authorization is enforced through middleware and the multi-tenant Filament panel configuration.Assumptions
Assumption 1: Invoice Group Purpose and Structure
Options Considered:
Chosen Option: 2
Rationale: Keep invoice groups simple and lightweight - a name, optional description, and optional relationship to invoices. This aligns with the "sub page" designation in the checklist and follows the principle of building only what's needed.
Assumption 2: Invoice Group Deletion Behavior
Options Considered:
Chosen Option: 2
Rationale: Soft delete the group and set invoice_group_id to NULL for associated invoices. This is the safest approach that preserves invoice data while allowing flexible reorganization, consistent with the soft delete pattern used elsewhere in the codebase.
Assumption 3: Create Operation Inclusion
Options Considered:
Chosen Option: 2
Rationale: Include create operation. Standard Filament resource patterns include full CRUD, and users need a way to create groups to then edit/delete them.
💡 User Tips
Regenerate the plan with different choices with
@coderabbitai <feedback>.Implementation Steps
Phase 1: Database Schema and Model Layer
Establish the foundational data structures for invoice groups with proper multi-tenant scoping and relationships.
Task 1: Create Invoice Groups Table Migration
Modules/Invoices/Database/Migrations/following the timestamp naming conventionTask 2: Add Invoice Group Foreign Key to Invoices Table
Modules/Invoices/Database/Migrations/to alter invoices tableTask 3: Create InvoiceGroup Model
Modules/Invoices/Models/BelongsToCompany,SoftDeletestraitsinvoices()returning hasMany relationship to Invoice modelcompany()returning belongsTo relationship to Company modelTask 4: Update Invoice Model with Group Relationship
invoice_group_idto the @Property docblock inModules/Invoices/Models/Invoice.phpinvoiceGroup()method returning belongsTo relationship to InvoiceGroup modelinvoice_group_idto fillable array if not already included🤖 Prompt for AI agents
Phase 2: Filament Resource for Company Panel
Build the admin interface for invoice group management in the company-scoped panel following established Filament resource patterns.
Task 1: Create InvoiceGroupResource
Modules/Invoices/Filament/Company/Resources/InvoiceGroups/Task 2: Create Form Schema
Modules/Invoices/Filament/Company/Resources/InvoiceGroups/Schemas/Task 3: Create Resource Pages
Modules/Invoices/Filament/Company/Resources/InvoiceGroups/Pages/Task 4: Add Invoice Group Selection to Invoice Forms
Modules/Invoices/Filament/Company/Resources/Invoices/Schemas/InvoiceForm.php🤖 Prompt for AI agents
Phase 3: Comprehensive Test Suite
Create thorough test coverage for all invoice group operations following AAA pattern and testing edge cases.
Task 1: Create InvoiceGroupFactory
Modules/Invoices/Database/Factories/withInvoices()that creates related invoices in the afterCreating callbackTask 2: Test List and View Operations
Modules/Invoices/Tests/Feature/InvoiceGroupsTest.phpTask 3: Test Create Operation
InvoiceGroupsTest.phpTask 4: Test Edit Operation
InvoiceGroupsTest.phpTask 5: Test Delete Operation
InvoiceGroupsTest.phpTask 6: Test Edge Cases
InvoiceGroupsTest.phpwith group names containing special characters (quotes, apostrophes, Unicode)🤖 Prompt for AI agents
🚀 Next Steps
🤖 All AI agent prompts combined
💡 Iterate on the plan with:
@coderabbitai <feedback>💬 Have feedback or questions? Drop into our discord!
[-]As an Admin, in the company Panel I want to be able to view, edit, delete Invoice Groups[/-][+][Settings]: Company panel — manage Invoice Groups[/+]nielsdrost7 commentedon Jul 24, 2026
SMART Plan — Company panel — manage Invoice Groups (Numbering)
Specific
Add a
NumberingResourceto the Company panel (/{tenant}/invoice-groups). Provides full CRUD for Numbering (Invoice Group) series scoped to the current tenant company. Only accessible tocustomer_adminrole.Measurable
Achievable
Modules/Core/Models/Numbering.phphasBelongsToCompanytrait.Modules/Core/Filament/Company/Resources/NumberingResource.php.CompanyPanelProvider.Relevant
Multi-entity companies often need separate invoice numbering series per division/brand. A CRUD screen lets them manage without admin panel access.
Time-bound
Sprint 6.
nielsdrost7 commentedon Jul 24, 2026
Already satisfied.
Modules/Core/Filament/Company/Resources/Numberings/NumberingResource.phpalready provides view + edit for a company's own numbering schemes (canViewAny/canView/canEditgated onPermission::MANAGE_COMPANY_SETTINGS), scoped correctly (confirmed viaNumberingTest::it_filters_numberings_by_current_company_id,NumberingPanelAccessTest::it_allows_company_user_to_edit_their_numbering_format— both passing).canCreate/canDeleteare deliberately hardcodedfalse, with an explicit docblock: "Company users cannot: Create new numbering schemes (only admins can) ... " — this looks like an intentional design decision (numbering schemes affect invoice/quote numbering integrity in ways that probably warrant admin oversight), not an oversight. Closing as satisfied by existing behavior; reopen if the intent was specifically to open up create/delete tocustomer_admin.