Track machine counters and maintenance with counter and time intervals
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Notifications\Presentation\Console;
|
||||
|
||||
use App\Modules\Notifications\Application\UseCases\NotifyMaintenanceDue;
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
#[Signature('notifications:maintenance-due')]
|
||||
#[Description('Notify the responsible persons of machines whose maintenance is coming up or late (run daily at 7.00)')]
|
||||
class NotifyMaintenanceDueCommand extends Command
|
||||
{
|
||||
public function handle(NotifyMaintenanceDue $notify): int
|
||||
{
|
||||
$added = $notify->execute();
|
||||
|
||||
$this->components->info("{$added} notifications added.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,10 @@ new class extends Component
|
||||
'job' => (string) $notification->params['job_name'],
|
||||
'roles' => $this->roleList((string) $notification->params['roles']),
|
||||
]),
|
||||
NotificationType::MaintenanceDue => __('notifications.types.maintenance_due.'.$notification->params['level'], [
|
||||
'machine' => (string) $notification->params['machine'],
|
||||
'item' => (string) $notification->params['item'],
|
||||
]),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,6 +88,7 @@ new class extends Component
|
||||
return match ($notification->type) {
|
||||
NotificationType::TaskStartsSoon, NotificationType::TaskAssigned => route('jobs.show', (int) $notification->params['job_id']).'#task-'.$notification->params['task_id'],
|
||||
NotificationType::JobAssigned => route('jobs.show', (int) $notification->params['job_id']),
|
||||
NotificationType::MaintenanceDue => route('machines.show', (int) $notification->params['machine_id']).'#maintenance-heading',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user