Add an editable menu name and reserve billing material numbers on creation

- Company details get an optional "Valikon nimi", shown at the left of the
  main menu; it falls back to the application name when empty.
- A billing material gets its running number (billing_exports.number) only
  when it is created, so discarded drafts leave no gaps. Drafts have no
  number; existing created materials are numbered by the migration, and the
  CSV file name uses the number.
- TaskAssigneeMigrationTest rolls back from its own migration onward instead
  of assuming it is the last one.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-24 19:41:57 +02:00
co-authored by Claude Sonnet 5.5
parent 48030e7689
commit 7d7b72989d
25 changed files with 195 additions and 23 deletions
@@ -295,3 +295,31 @@ it('does not bill a monthly fee job without a monthly fee', function () {
->call('add', $job->id)
->assertSet('errorMessage', fn (string $message) => str_contains($message, 'kuukausihinta'));
});
it('numbers created materials without gaps: a draft has no number and a discarded one uses none', function () {
$first = doneJob(['name' => 'Esite'], [$this->layout->id => 1]);
$second = doneJob(['name' => 'Juliste'], [$this->layout->id => 1]);
$discarded = openDraft();
Livewire::test('billing::export', ['export' => $discarded])
->assertSee('Laskuaineiston luonnos')
->call('add', $first->id)
->call('discard');
$exportId = openDraft();
expect(BillingExportModel::query()->findOrFail($exportId)->number)->toBeNull();
Livewire::test('billing::export', ['export' => $exportId])
->call('add', $first->id)
->call('finalize')
->assertSee('Laskuaineisto 1');
$next = openDraft();
Livewire::test('billing::export', ['export' => $next])
->call('add', $second->id)
->call('finalize')
->assertSee('Laskuaineisto 2');
expect(BillingExportModel::query()->orderBy('id')->pluck('number')->all())->toBe([1, 2])
->and($next)->toBeGreaterThan($exportId);
});