Skip to content

Commit

Permalink
reverse print
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiritin committed Sep 12, 2024
1 parent f9dd210 commit 5b9064b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Filament/Resources/BadgeResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public static function table(Table $table): Table
Tables\Actions\BulkAction::make('printBadgeBulk')
->label('Print Badge')
->requiresConfirmation()
->action(fn(Collection $records) => $records->each(fn(Badge $record, $index) => static::printBadge($record,$index))),
->action(function (Collection $records) {
return $records->reverse()->each(fn(Badge $record, $index) => static::printBadge($record, $index));
}),
])
->selectCurrentPageOnly()
->paginationPageOptions([10, 25, 50, 100])
Expand All @@ -120,7 +122,7 @@ public static function printBadge(Badge $badge,$mass = 0): Badge
$badge->status->transitionTo(Printed::class);
}
// Add delay for mass printing so they are generated in order
PrintBadgeJob::dispatch($badge, Machine::first())->delay(now()->addSeconds($mass * 5));
PrintBadgeJob::dispatch($badge, Machine::first())->delay(now()->addSeconds($mass * 15));
return $badge;
}

Expand Down

0 comments on commit 5b9064b

Please sign in to comment.