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('%s', $row->name); + $columns[] = sprintf('%s', $row->name); $columns[] = sprintf('%s', $row->indexFormatted); $columns[] = sprintf('%s', $row->getBeginForUser()); $columns[] = sprintf('%s', $row->getEndForUser()); diff --git a/resources/lang/en/label.php b/resources/lang/en/label.php index 9a694305..68c03dda 100644 --- a/resources/lang/en/label.php +++ b/resources/lang/en/label.php @@ -143,7 +143,7 @@ 'label' => 'User medal', ], 'exam' => [ - 'label' => 'Exam', + 'label' => 'Exam & Task', 'is_done' => 'Is done', 'is_discovered' => 'Discovered', 'register_time_range' => [ diff --git a/resources/lang/zh_CN/label.php b/resources/lang/zh_CN/label.php index 339faf3c..256e6f3a 100644 --- a/resources/lang/zh_CN/label.php +++ b/resources/lang/zh_CN/label.php @@ -145,7 +145,7 @@ 'label' => '用户勋章', ], 'exam' => [ - 'label' => '考核', + 'label' => '考核 & 任务', 'is_done' => '是否完成', 'is_discovered' => '自动发现', 'register_time_range' => [ diff --git a/resources/lang/zh_TW/label.php b/resources/lang/zh_TW/label.php index 663d26bf..8149527d 100644 --- a/resources/lang/zh_TW/label.php +++ b/resources/lang/zh_TW/label.php @@ -143,7 +143,7 @@ 'label' => '用戶勛章', ], 'exam' => [ - 'label' => '考核', + 'label' => '考核 & 任務', 'is_done' => '是否完成', 'is_discovered' => '自動發現', 'register_time_range' => [