Added work center in alert mail resource page
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 27s

This commit is contained in:
dhanabalan
2026-08-18 12:45:40 +05:30
parent 39d65afcfe
commit bfcb5f9f0c

View File

@@ -8,6 +8,7 @@ use App\Filament\Resources\AlertMailRuleResource\Pages;
use App\Models\AlertMailRule; use App\Models\AlertMailRule;
use App\Models\InvoiceMaster; use App\Models\InvoiceMaster;
use App\Models\Plant; use App\Models\Plant;
use App\Models\Machine;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Filament\Forms; use Filament\Forms;
use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\Actions\Action;
@@ -49,6 +50,25 @@ class AlertMailRuleResource extends Resource
->required(fn ($get) => ! $get('is_active')) ->required(fn ($get) => ! $get('is_active'))
->afterStateUpdated(fn ($state, callable $set) => $state ? $set('is_active', false) : null), ->afterStateUpdated(fn ($state, callable $set) => $state ? $set('is_active', false) : null),
// ->options(fn () => Plant::pluck('id', 'name')->toArray()), // ->options(fn () => Plant::pluck('id', 'name')->toArray()),
Forms\Components\Select::make('machine_id')
->label('Work Center')
->options(function (callable $get) {
$plantId = $get('plant');
if (!$plantId) {
return [];
}
return Machine::where('plant_id', $plantId)
->whereNotNull('work_center')
->pluck('work_center', 'id')
->toArray();
})
->searchable()
->reactive()
->afterStateUpdated(function (callable $set) {
$set('module', null);
}),
Forms\Components\Select::make('module') Forms\Components\Select::make('module')
->label('Module') ->label('Module')
->required() ->required()
@@ -187,6 +207,11 @@ class AlertMailRuleResource extends Resource
return $plants[$state] ?? 'All Plants'; return $plants[$state] ?? 'All Plants';
}), }),
Tables\Columns\TextColumn::make('machine.work_center')
->label('Work Center')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('module') Tables\Columns\TextColumn::make('module')
->label('Module Name') ->label('Module Name')
->alignCenter() ->alignCenter()
@@ -197,14 +222,14 @@ class AlertMailRuleResource extends Resource
->alignCenter() ->alignCenter()
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('invoiceMaster.receiving_plant_name') // Tables\Columns\TextColumn::make('invoiceMaster.receiving_plant_name')
->label('Receiving Plant') // ->label('Receiving Plant')
->alignCenter() // ->alignCenter()
->sortable(), // ->sortable(),
Tables\Columns\TextColumn::make('invoiceMaster.transport_name') // Tables\Columns\TextColumn::make('invoiceMaster.transport_name')
->label('Transporter') // ->label('Transporter')
->alignCenter() // ->alignCenter()
->sortable(), // ->sortable(),
Tables\Columns\TextColumn::make('email') Tables\Columns\TextColumn::make('email')
->label('TO Emails') ->label('TO Emails')
->searchable() ->searchable()