Count stock and correct the differences on confirmation

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-26 16:34:08 +02:00
co-authored by Claude Sonnet 5.5
parent bca1eed166
commit 0de0e332b2
27 changed files with 1568 additions and 0 deletions
@@ -3,6 +3,7 @@
use App\Models\User;
use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\ServiceUnitModel;
use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\WorkTypeModel;
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\InventoryCountModel;
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockItemGroupModel;
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockItemModel;
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockMovementModel;
@@ -94,3 +95,28 @@ it('records material on a task card with the keyboard and without accessibility
'desktop, light' => ['desktop', 'light'],
'mobile, dark' => ['mobile', 'dark'],
]);
it('has no accessibility issues on the stock count pages and saves a counted quantity', function (string $device, string $colorScheme) {
$count = InventoryCountModel::query()->create([
'counted_on' => now()->toDateString(), 'status' => 'open', 'started_by' => $this->user->id,
]);
foreach ([route('inventory.counts'), route('inventory.counts.show', $count->id)] as $url) {
$visit = visit($url);
$visit = $device === 'mobile' ? $visit->on()->mobile() : $visit->on()->desktop();
$visit = $colorScheme === 'dark' ? $visit->inDarkMode() : $visit->inLightMode();
$visit->assertSee(__('inventory.counts.title'))->assertNoJavaScriptErrors()->assertNoAccessibilityIssues(level: 2);
}
visit(route('inventory.counts.show', $count->id))
->fill('#counted-'.$this->item->id, '38')
->keys('#counted-'.$this->item->id, 'Tab')
->assertSee('Valokuvapaperi: laskettu 38')
->click(__('inventory.counts.confirm'))
->assertSee(__('inventory.counts.confirm_title'))
->assertNoAccessibilityIssues(level: 2);
})->with([
'desktop, light' => ['desktop', 'light'],
'mobile, dark' => ['mobile', 'dark'],
]);