Show a monthly fee job's billed periods on a page of its own

The new billing::job-months page lists the months that created billing
materials have billed for a monthly fee job, with links to the materials
and the total, and the months still to bill up to the current month,
counted the same way as a new material counts them. The job page links
to it next to the payment basis for those who manage billing.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-25 15:56:15 +02:00
co-authored by Claude Sonnet 5.5
parent e817cca329
commit bc3dbf16a4
16 changed files with 470 additions and 3 deletions
+21 -1
View File
@@ -1,6 +1,7 @@
<?php
use App\Models\User;
use App\Modules\Billing\Application\UseCases\FinalizeBillingExport;
use App\Modules\Billing\Application\UseCases\OpenBillingDraft;
use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\WorkTypeModel;
use App\Modules\Customers\Infrastructure\Persistence\Eloquent\CustomerModel;
@@ -31,7 +32,7 @@ beforeEach(function () {
ExpenseModel::factory()->create(['customer_job_id' => $this->jobs[0]->id, 'description' => 'Paperi']);
CustomerJobModel::factory()->create([
$this->monthly = CustomerJobModel::factory()->create([
'name' => 'Ylläpito',
'customer_id' => $customer->id,
'status' => JobStatus::InProduction,
@@ -61,6 +62,25 @@ it('has no accessibility issues on the billing pages', function (string $page, s
'mobile, dark' => ['mobile', 'dark'],
]);
it('has no accessibility issues on the billed periods page', function (string $device, string $colorScheme) {
// The draft holds only the monthly fee job, so creating it bills the job's months up to now.
app(FinalizeBillingExport::class)->execute($this->exportId, $this->manager->id);
$visit = visit(route('billing.job-months', $this->monthly->id));
$visit = $device === 'mobile' ? $visit->on()->mobile() : $visit->on()->desktop();
$visit = $colorScheme === 'dark' ? $visit->inDarkMode() : $visit->inLightMode();
$visit->assertSee('Laskutetut kuukaudet (3)')
->assertSee('Aineisto 1')
->assertNoJavaScriptErrors()
->assertNoAccessibilityIssues(level: 2);
})->with([
'desktop, light' => ['desktop', 'light'],
'desktop, dark' => ['desktop', 'dark'],
'mobile, light' => ['mobile', 'light'],
'mobile, dark' => ['mobile', 'dark'],
]);
it('adds and combines jobs and creates the material', function () {
[$first, $second] = $this->jobs;