Skip to content

[Settings]: Admin panel — assign Invoice Groups to companies #231

Closed

Description

@nielsdrost7

SMART Plan — As an Admin, in the admin Panel I want to be able to assign Invoice Groups to multiple companies

Specific

In the Admin panel (/admin), the CompanyResource table view gains a bulk action called "Assign Invoice Group". When one or more companies are selected and the action is triggered, a modal opens with a searchable select of all Numbering records. On confirmation, the selected Numbering is attached to every selected company via a company_numbering pivot table.

Measurable

  • Selecting 2+ companies and triggering the bulk action opens a modal with a Numbering select.
  • After confirmation, a company_numbering row exists for each selected company.
  • A Filament success notification confirms how many companies were updated.

Achievable

  1. Create migration add_company_numbering_pivot_table — Modules/Core/Database/Migrations/
  2. Add numberings() BelongsToMany on Company model — Modules/Core/Models/Company.php
  3. Add companies() BelongsToMany on Numbering model — Modules/Core/Models/Numbering.php
  4. Create AssignInvoiceGroupBulkAction Filament bulk action class — Modules/Core/Filament/Admin/Resources/Companies/Tables/Actions/AssignInvoiceGroupBulkAction.php
  5. Register the bulk action on CompanyResource table — Modules/Core/Filament/Admin/Resources/Companies/Tables/CompanyTable.php

Relevant

Invoice Groups (Numberings) define the sequential numbering scheme for invoices, quotes, and other documents. Assigning a shared numbering scheme to multiple companies at once is essential when onboarding a batch of new tenants that follow the same document format.

Time-bound

Sprint 6.


Arrange · Act · Assert

// Modules/Core/Tests/Feature/Admin/CompanyInvoiceGroupBulkActionTest.php

#[Test]
public function it_assigns_invoice_group_to_multiple_companies(): void
{
    /* Arrange */
    $companies = Company::factory()->count(2)->create();
    $numbering = Numbering::factory()->create();
    $ids       = $companies->pluck('id')->all();

    /* Act */
    Livewire::actingAs($this->superAdmin())
        ->test(ListCompanies::class)
        ->callBulkAction('assignInvoiceGroup', $ids, ['numbering_id' => $numbering->id])
        ->assertHasNoErrors();

    /* Assert */
    foreach ($companies as $company) {
        $this->assertDatabaseHas('company_numbering', [
            'company_id'   => $company->id,
            'numbering_id' => $numbering->id,
        ]);
    }
}

Activity

  1. coderabbitai commented on Dec 28, 2025

    @coderabbitai
    Contributor

    📝 CodeRabbit Plan Mode

    Generate an implementation plan and prompts that you can use with your favorite coding agent.

    • Create Plan
    Examples

    🔗 Similar Issues

    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:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added this to the v2.0.0-alpha milestone on Dec 28, 2025
  3. nielsdrost7 commented on Jan 2, 2026

    @nielsdrost7
    CollaboratorAuthor

    @coderabbitai make pull-request with AAA test Scenario's: Arrange, Act, Assert. And also make sure you test edge cases

  4. coderabbitai commented on Jan 2, 2026

    @coderabbitai
    Contributor

    Rate Limit Exceeded

    @nielsdrost7 have exceeded the limit for the number of chat messages per hour. Please wait 1 minutes and 3 seconds before sending another message.

  5. changed the title [-]As an Admin, in the admin Panel I want to be able to assign Invoice Groups to multiple companies[/-] [+][Settings]: Admin panel — assign Invoice Groups to companies[/+] on Jun 13, 2026
  6. nielsdrost7 commented on Jul 24, 2026

    @nielsdrost7
    CollaboratorAuthor

    SMART Plan — Admin Bulk Action: Assign Invoice Groups (Numbering) to Companies

    Scope

    In the Admin panel (/admin), add a bulk action to CompanyResource list that assigns Numbering (Invoice Group) records to multiple companies at once via company_numbering pivot.

    Implementation

    1. Migration: Create add_company_numbering_pivot_table → Modules/Core/Database/Migrations/

      • Table: company_numbering (company_id, numbering_id)
    2. Model relationships:

      • Company::numberings() → BelongsToMany
      • Numbering::companies() → BelongsToMany
    3. Bulk action class: Create Modules/Core/Filament/Admin/Resources/Companies/Actions/AssignInvoiceGroupBulkAction.php

      class AssignInvoiceGroupBulkAction extends BulkAction
      {
          public static function getDefaultName(): ?string { return 'assignInvoiceGroup'; }
          protected function setUp(): void {
              $this->action(function() { /* sync pivot */ })
                  ->form([Numbering select])
                  ->successNotificationTitle('Invoice groups assigned');
          }
      }
    4. Register: In Modules/Core/Filament/Admin/Resources/CompaniesResource.php, add to table:

      ->bulkActions([AssignInvoiceGroupBulkAction::make()])

    Test

    • Select 2+ companies → trigger bulk action → confirm Numbering
    • Assert company_numbering rows created for each company

    Processed by IP2 batch refine workflow

  7. added a commit that references this issue on Sep 17, 2026
    1f61cb2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

refinedRefined with SMART plan / test suggestions

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions