Record used material on tasks and suggest workflow steps' default materials

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-26 16:28:16 +02:00
co-authored by Claude Sonnet 5.5
parent 30132deb0e
commit bca1eed166
41 changed files with 1521 additions and 19 deletions
@@ -0,0 +1,21 @@
<?php
namespace App\Modules\Inventory\Infrastructure\Adapters;
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockMovementModel;
use App\Modules\Jobs\Application\Contracts\TaskUsage;
/**
* A task with recorded material is kept like one with hours: the stock
* movements refer to it.
*/
class TaskUsageWithStock implements TaskUsage
{
public function __construct(private TaskUsage $inner) {}
public function hasTimeEntries(int $taskId): bool
{
return $this->inner->hasTimeEntries($taskId)
|| StockMovementModel::query()->where('task_id', $taskId)->exists();
}
}