Skip to content

[Settings]: Company panel — assign Tax Rates #242

Closed

Description

@nielsdrost7

SMART Plan — As an Admin, in the company Panel I want to be able to assign Tax Rates to that single company

Specific

Within the Company panel (/{tenant}) — either on the TaxRate resource list page or the Settings page — add a mechanism for the customer_admin to associate specific TaxRate records with their company. The association is stored via a company_tax_rate pivot table and causes those tax rates to appear in the invoice item tax rate dropdowns for that company only.

Measurable

  • The company panel exposes a way to attach/detach tax rates (e.g. a CheckboxList, toggle column, or dedicated assign action).
  • After associating a tax rate, it appears in the invoice item's tax rate select for that company.
  • Tax rates not associated with the company do not appear in the invoice item dropdown.
  • Only customer_admin and elevated roles can manage associations.

Achievable

  1. Create migration add_company_tax_rate_pivot_table if not created by issue [Settings]: Admin panel — assign Tax Rates to companies #233 — Modules/Core/Database/Migrations/
  2. Add taxRates() BelongsToMany on Company — Modules/Core/Models/Company.php
  3. Add companies() BelongsToMany on TaxRate — Modules/Core/Models/TaxRate.php
  4. Add an "Assign to Company" toggle action on the company panel's TaxRateResource table — Modules/Core/Filament/Company/Resources/TaxRates/TaxRateResource.php
  5. Update the invoice item form's TaxRate select to query Filament::getTenant()->taxRates() instead of all tax rates — Modules/Invoices/Filament/Company/Resources/Invoices/Schemas/InvoiceItemSchema.php

Relevant

Tax rates must be configured per company to comply with local tax legislation. Restricting the tax rate dropdown on invoice items to only the rates the company has set up prevents accidental application of the wrong rate across different jurisdictions.

Time-bound

Sprint 6.


Arrange · Act · Assert

// Modules/Core/Tests/Feature/Company/CompanyTaxRateAssignmentTest.php

#[Test]
public function it_associates_tax_rate_with_company_and_makes_it_available_on_invoice_items(): void
{
    /* Arrange */
    $taxRate = TaxRate::factory()->create(['company_id' => null]); // global tax rate
    $this->company->taxRates()->attach($taxRate->id);

    /* Act */
    $response = $this->testLivewire(CreateInvoice::class);

    /* Assert */
    $response->assertSuccessful();
    // The tax rate select options for invoice items should include the associated rate.
    $response->assertSee($taxRate->name);
}

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. changed the title [-]As an Admin, in the company Panel I want to be able to assign Tax Rates to that single company[/-] [+][Settings]: Company panel — assign Tax Rates[/+] on Jun 13, 2026
  4. nielsdrost7 commented on Jul 24, 2026

    @nielsdrost7
    CollaboratorAuthor

    SMART Plan — Company panel — assign Tax Rates

    Specific

    Within the Company panel Settings page, add a multi-select field or table to assign available Tax Rates to the company. Stores the relationship (pivot or scoped select) so the company can only use tax rates assigned to it when creating invoices/quotes.

    Measurable

    • Tax rates searchable/selectable.
    • Selecting rates adds rows to a pivot table (or updates a JSON settings column).
    • When creating an invoice, only assigned tax rates appear in the dropdown.
    • Success message confirms count assigned.

    Achievable

    1. Define Company::taxRates() as a BelongsToMany if not already present.
    2. Create a multi-select field in CompanySettings that syncs selections to the pivot.
    3. Update invoice/quote forms to filter by $company->taxRates().

    Relevant

    Different companies use different tax jurisdictions. Assigning rates per company keeps the UI clean and prevents wrong tax application.

    Time-bound

    Sprint 6.

  5. nielsdrost7 commented on Jul 24, 2026

    @nielsdrost7
    CollaboratorAuthor

    Already satisfied — CompanySettings.php's Taxes tab has Select::make(Setting::KEY_DEFAULT_INVOICE_TAX_RATE_ID) and Select::make(Setting::KEY_DEFAULT_QUOTE_TAX_RATE_ID), both scoped to TaxRate::query()->where('company_id', $this->getCompanyId()), persisted via Setting::saveForCompany(). Since TaxRate is already strictly one-per-company owned (via BelongsToCompany), every company's tax rates already only ever appear in that company's own dropdowns — there's no separate 'assignment' step needed beyond picking the default(s), which this already does. Added a targeted test proving both the scoping and persistence for both defaults: CompanySettingsTest::it_offers_and_persists_default_tax_rates_scoped_to_the_company on feature/235-243-company-settings-cluster.

  6. added a commit that references this issue on Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refinedRefined with SMART plan / test suggestions

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions