public function table(Table $table): Table
{
return $table
->query(
$this->sql()
)
->striped()
->heading('Missing Co-Loader')
->columns([
TextColumn::make('job_operator_name')->label('Job Operator Name'),
TextColumn::make('num_jobs')->label('Total Jobs')->alignCenter()->action(
ViewAction::make('test')
->modalContent(fn (Model $model): View => view(
'filament.app.widgets.pegasus.commercial.top-stats-widget',
[
'model' => $model,
],
))
)
]);
}
protected function sql()
{
return ReportShipment::query()
->select(
DB::raw('ROW_NUMBER() OVER (ORDER BY COUNT(id) DESC) as id'),
'job_operator_name',
DB::raw('COUNT(id) as num_jobs')
)
->where('consol_type', 'CLD')
->whereNull('consol_co_loaded_with_code')
->groupBy('job_operator_name')
->orderByDesc('num_jobs');
}
public function getTableRecordKey($record): string
{
$name = str_replace(' ', '_', $record->job_operator_name);
return 'missing_co_loader_widget_'.$name;
}
public function table(Table $table): Table
{
return $table
->query(
$this->sql()
)
->striped()
->heading('Missing Co-Loader')
->columns([
TextColumn::make('job_operator_name')->label('Job Operator Name'),
TextColumn::make('num_jobs')->label('Total Jobs')->alignCenter()->action(
ViewAction::make('test')
->modalContent(fn (Model $model): View => view(
'filament.app.widgets.pegasus.commercial.top-stats-widget',
[
'model' => $model,
],
))
)
]);
}
protected function sql()
{
return ReportShipment::query()
->select(
DB::raw('ROW_NUMBER() OVER (ORDER BY COUNT(id) DESC) as id'),
'job_operator_name',
DB::raw('COUNT(id) as num_jobs')
)
->where('consol_type', 'CLD')
->whereNull('consol_co_loaded_with_code')
->groupBy('job_operator_name')
->orderByDesc('num_jobs');
}
public function getTableRecordKey($record): string
{
$name = str_replace(' ', '_', $record->job_operator_name);
return 'missing_co_loader_widget_'.$name;
}