diff --git a/app/Filament/Resources/User/ExamUserResource.php b/app/Filament/Resources/User/ExamUserResource.php index 36cefed9..385febe2 100644 --- a/app/Filament/Resources/User/ExamUserResource.php +++ b/app/Filament/Resources/User/ExamUserResource.php @@ -60,6 +60,7 @@ public static function table(Table $table): Table ->formatStateUsing(fn ($record) => new HtmlString(get_username($record->uid, false, true, true, true))) , Tables\Columns\TextColumn::make('exam.name')->label(__('label.exam.label')), + Tables\Columns\TextColumn::make('exam.typeText')->label(__('exam.type')), Tables\Columns\TextColumn::make('begin')->label(__('label.begin'))->dateTime(), Tables\Columns\TextColumn::make('end')->label(__('label.end'))->dateTime(), Tables\Columns\BooleanColumn::make('is_done')->label(__('label.exam_user.is_done')), @@ -78,9 +79,20 @@ public static function table(Table $table): Table return $query->when($data['uid'], fn (Builder $query, $uid) => $query->where("uid", $uid)); }) , + Tables\Filters\SelectFilter::make('exam_type') + ->options(Exam::listTypeOptions()) + ->label(__('exam.type')) + ->query(function (Builder $query, array $data) { + $query->when($data['value'], function (Builder $query) use ($data) { + $query->whereHas("exam", function (Builder $query) use ($data) { + $query->where("type", $data['value']); + }); + }); + }) + , Tables\Filters\SelectFilter::make('exam_id') ->options(Exam::query()->pluck('name', 'id')->toArray()) - ->label(__('exam.label')) + ->label(__('label.exam.label')) , Tables\Filters\SelectFilter::make('status')->options(ExamUser::listStatus(true))->label(__("label.status")), Tables\Filters\SelectFilter::make('is_done')->options(['0' => 'No', '1' => 'yes'])->label(__('label.exam_user.is_done')), diff --git a/include/constants.php b/include/constants.php index be1aa4b8..4d9e4116 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ id, $claimBtnText, $claimDisabled ); $columns = []; - $columns[] = sprintf('