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')
|
Column::make('release_date')
|
||||||
->heading('Tgl Rilis'),
|
->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 [
|
return [
|
||||||
AfterSheet::class => function (AfterSheet $event) {
|
AfterSheet::class => function (AfterSheet $event) {
|
||||||
$sheet = $event->sheet->getDelegate();
|
$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");
|
$sheet->mergeCells("A1:{$lastColumn}1");
|
||||||
|
|
||||||
|
|||||||
@ -104,7 +104,7 @@ public static function configure(Schema $schema): Schema
|
|||||||
|
|
||||||
Select::make('sub_classification_id')
|
Select::make('sub_classification_id')
|
||||||
->label('Subklasifikasi')
|
->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()
|
->searchable()
|
||||||
->preload()
|
->preload()
|
||||||
->required(),
|
->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
|
public static function getRecordRouteBindingEloquentQuery(): Builder
|
||||||
{
|
{
|
||||||
return parent::getRecordRouteBindingEloquentQuery()
|
return parent::getRecordRouteBindingEloquentQuery()
|
||||||
|
|||||||
@ -96,6 +96,13 @@ public static function configure(Table $table): Table
|
|||||||
->sortable()
|
->sortable()
|
||||||
->date('l, d F Y'),
|
->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(),
|
...TimestampColumns::make(),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
@ -115,6 +122,23 @@ public static function configure(Table $table): Table
|
|||||||
->options(Channel::class)
|
->options(Channel::class)
|
||||||
->native(false),
|
->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')
|
Filter::make('date_filter')
|
||||||
->schema([
|
->schema([
|
||||||
Select::make('date_type')
|
Select::make('date_type')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user