feat: add issue management status tracking to media monitoring table, export, and fix sub-classification form relationship query
This commit is contained in:
parent
75bd1ad3e6
commit
562c07fead
@ -53,6 +53,10 @@ public function setUp()
|
||||
|
||||
Column::make('release_date')
|
||||
->heading('Tgl Rilis'),
|
||||
|
||||
Column::make('issue_management_status')
|
||||
->heading('Status Isu')
|
||||
->getStateUsing(fn ($record) => $record->issueManagement ? 'Sudah Input' : 'Belum Input'),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -83,7 +87,7 @@ public function registerEvents(): array
|
||||
return [
|
||||
AfterSheet::class => function (AfterSheet $event) {
|
||||
$sheet = $event->sheet->getDelegate();
|
||||
$lastColumn = 'K'; // Based on column count (A-K)
|
||||
$lastColumn = 'L'; // Based on column count (A-L)
|
||||
|
||||
$sheet->mergeCells("A1:{$lastColumn}1");
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ public static function configure(Schema $schema): Schema
|
||||
|
||||
Select::make('sub_classification_id')
|
||||
->label('Subklasifikasi')
|
||||
->relationship('subClassification', 'name', fn (Builder $query, Get $get): Builder => $query->where('classification_id', $get('location_id'))->active())
|
||||
->relationship('subClassification', 'name', fn (Builder $query, Get $get): Builder => $query->where('classification_id', $get('classification_id'))->active())
|
||||
->searchable()
|
||||
->preload()
|
||||
->required(),
|
||||
|
||||
@ -52,6 +52,13 @@ public static function getPages(): array
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->with(['issueManagement', 'themes'])
|
||||
->withExists('issueManagement');
|
||||
}
|
||||
|
||||
public static function getRecordRouteBindingEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getRecordRouteBindingEloquentQuery()
|
||||
|
||||
@ -96,6 +96,13 @@ public static function configure(Table $table): Table
|
||||
->sortable()
|
||||
->date('l, d F Y'),
|
||||
|
||||
TextColumn::make('issue_management_exists')
|
||||
->label('Status Isu')
|
||||
->formatStateUsing(fn ($state) => $state ? 'Sudah Input' : 'Belum Input')
|
||||
->badge()
|
||||
->color(fn ($state) => $state ? 'success' : 'gray')
|
||||
->sortable(),
|
||||
|
||||
...TimestampColumns::make(),
|
||||
])
|
||||
->filters([
|
||||
@ -115,6 +122,23 @@ public static function configure(Table $table): Table
|
||||
->options(Channel::class)
|
||||
->native(false),
|
||||
|
||||
SelectFilter::make('issueManagementStatus')
|
||||
->label('Status Isu')
|
||||
->options([
|
||||
'sudah' => 'Sudah Input',
|
||||
'belum' => 'Belum Input',
|
||||
])
|
||||
->query(function (Builder $query, array $data) {
|
||||
if ($data['value'] === 'sudah') {
|
||||
return $query->has('issueManagement');
|
||||
} elseif ($data['value'] === 'belum') {
|
||||
return $query->doesntHave('issueManagement');
|
||||
}
|
||||
|
||||
return $query;
|
||||
})
|
||||
->native(false),
|
||||
|
||||
Filter::make('date_filter')
|
||||
->schema([
|
||||
Select::make('date_type')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user