Skip to content

[Settings]: System — Timezone #252

Description

@nielsdrost7

SMART Plan — Set cron/scheduled task frequency in System Settings

Specific

A Select field labelled "Recurring Invoice Frequency" in the System tab of the Company Settings page. Options: daily, weekly, monthly. Stores the selected value as a string under the key cron_frequency, scoped to the current company. Controls how often the Laravel scheduler runs the recurring invoice generation job for this company.

Measurable

  • The field appears in the System section of the Company Settings page
  • Saving the form persists the value to the settings table with key cron_frequency and company_id scope
  • The value is read back correctly on page reload
  • The scheduler reads this setting to determine the recurrence interval for this company's recurring invoices

Achievable

  1. Create/extend Modules/Core/Filament/Company/Pages/CompanySettings.php (Filament page with tabs)
  2. Add a Select::make('cron_frequency')->label('Recurring Invoice Frequency')->options(['daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly']) field to the System tab section
  3. Add const CRON_FREQUENCY = 'cron_frequency'; to Modules/Core/Models/Setting.php constants
  4. Register the page in CompanyPanelProvider

Relevant

Different companies have different invoicing cadences. A weekly-billing agency and a monthly-subscription SaaS both need recurring invoices, but at different intervals. Per-company control avoids running unnecessary jobs and prevents over- or under-billing.

Time-bound

Sprint 6.


Arrange · Act · Assert

// Modules/Core/Tests/Feature/CompanySettingsTest.php

#[Test]
public function it_saves_cron_frequency_setting(): void
{
    /* Arrange */
    $page = Livewire::actingAs($this->user)
        ->test(\Modules\Core\Filament\Company\Pages\CompanySettings::class);

    /* Act */
    $page->set('data.cron_frequency', 'weekly')
         ->call('save');

    /* Assert */
    $page->assertSuccessful();
    $this->assertDatabaseHas('settings', [
        'company_id' => $this->company->id,
        'key'        => 'cron_frequency',
        'value'      => 'weekly',
    ]);
}

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

    refinedRefined with SMART plan / test suggestions

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions