Skip to content

[Settings]: Number Format (Decimal/Thousands Separator) #794

Description

@nielsdrost7

SMART Plan — Number Format (Decimal/Thousands Separator)

Specific

A Select field labelled "Number Format" in the Amounts tab of the Company Settings page (Modules/Core/Filament/Company/Pages/CompanySettings.php). Reuses the exact same 6 options and translation keys as the existing global admin setting. Stores the selected value as a string under Setting::KEY_NUMBER_FORMAT = 'number_format', scoped to the current company (overriding, not replacing, the global admin default).

The 6 format options are:

  • US/UK: 1,000,000.00
  • European: 1.000.000,00
  • ISO 80K1 Point: 1000000.00
  • ISO 80K1 Comma: 1000000,00
  • Compact Point: 1,000,000.00 (compact style)
  • Compact Comma: 1,000,000.00 (compact style)

Measurable

  • The field appears in the Company Settings page with all 6 existing format options
  • Saving persists the value to settings with key number_format and company_id scope
  • The value is read back correctly on page reload
  • Falls back to the global admin settings.number_format value when the company hasn't set an override

Achievable

  1. Add public const KEY_NUMBER_FORMAT = 'number_format'; to Modules/Core/Models/Setting.php
  2. Add the Select field to CompanySettings.php, reusing the existing 6 number_format_* translation keys already in resources/lang/en/ip.php (don't duplicate them)
  3. Add Setting::KEY_NUMBER_FORMAT to CompanySettings::allKeys()

Relevant

Companies operating in different locales expect amounts formatted the way their customers read them; this is the direct company-level counterpart to the already-existing global admin setting.

Time-bound

Small — same shape as date_format/time_format: 1 field + 1 constant, reusing existing translations. No number-rendering-pipeline work in scope.

Test Plan

  • CompanySettingsTest: save-then-reload round trip for number_format
  • CompanySettingsTest: multi-tenancy — company A's setting doesn't leak into company B
  • CompanySettingsTest: unset company setting falls back to the global admin default

Implementation Notes

Scope note: This plan covers persisting the per-company override. Actually applying it (making every number_format() call site — invoice PDFs, item tables, dashboard totals — read the resolved company/global setting instead of hardcoding separators) is comparable-sized follow-on work spanning multiple modules (Invoices, Quotes, Core) and is better tracked as its own issue.

Code references:

  • Existing global admin setting: Modules/Core/Filament/Admin/Pages/Settings.php:188-198
  • Translation keys: resources/lang/en/ip.php (number_format_us_uk, number_format_european, etc.)
  • Company settings page: Modules/Core/Filament/Company/Pages/CompanySettings.php

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions