1
0
forked from poc/pds

Merge pull request 'removed manual trigger of invoice data report button from alert mail resource' (#155) from ranjith-dev into master

Reviewed-on: poc/pds#155
This commit is contained in:
2026-01-03 11:13:49 +00:00

View File

@@ -118,31 +118,31 @@ class AlertMailRuleResource extends Resource
->label('All Plants Reports') ->label('All Plants Reports')
->afterStateUpdated(fn ($state, callable $set) => $state ? $set('plant', null) : null) ->afterStateUpdated(fn ($state, callable $set) => $state ? $set('plant', null) : null)
->reactive(), ->reactive(),
Forms\Components\Actions::make([ // Forms\Components\Actions::make([
Action::make('sendInvoiceData') // Action::make('sendInvoiceData')
->label('Invoice Data Report') // ->label('Invoice Data Report')
->action(function ($get) { // ->action(function ($get) {
$plantIds = AlertMailRule::where('module', 'InvoiceDataReport') // $plantIds = AlertMailRule::where('module', 'InvoiceDataReport')
->orderBy('plant') // ->orderBy('plant')
->pluck('plant') // ->pluck('plant')
->toArray(); // ->toArray();
foreach ($plantIds as $plantId) { // foreach ($plantIds as $plantId) {
Artisan::call('send:invoice-data-report', [ // Artisan::call('send:invoice-data-report', [
'schedule_type' => 'Daily', // 'schedule_type' => 'Daily',
'plant' => $plantId, // 'plant' => $plantId,
]); // ]);
} // }
// Notify user in Filament // // Notify user in Filament
Notification::make() // Notification::make()
->title('Invoice data report sent successfully!') // ->title('Invoice data report sent successfully!')
->success() // ->success()
->send(); // ->send();
}), // }),
]), // ]),
Forms\Components\Hidden::make('created_by') Forms\Components\Hidden::make('created_by')
->default(fn () => Filament::auth()->user()?->name), ->default(fn () => Filament::auth()->user()?->name),
Forms\Components\Hidden::make('updated_by') Forms\Components\Hidden::make('updated_by')