Skip to content

Commit

Permalink
unify sub category sort
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Apr 20, 2023
1 parent e5c91d4 commit 10cd698
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 75 deletions.
6 changes: 3 additions & 3 deletions app/Filament/Resources/Section/CategoryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ function () {
,
Forms\Components\TextInput::make('sort_index')
->default(0)
->label(__('label.search_box.taxonomy.sort_index'))
->helperText(__('label.search_box.taxonomy.sort_index_help'))
->label(__('label.priority'))
->helperText(__('label.priority_help'))
,

]);
Expand All @@ -97,7 +97,7 @@ public static function table(Table $table): Table
Tables\Columns\TextColumn::make('class_name')->label(__('label.search_box.taxonomy.class_name')),
Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(),
])
->defaultSort('sort_index', 'asc')
->defaultSort('sort_index', 'desc')
->filters([
Tables\Filters\SelectFilter::make('mode')
->options(SearchBox::query()->pluck('name', 'id')->toArray())
Expand Down
6 changes: 3 additions & 3 deletions app/Filament/Resources/Section/CodecResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public static function form(Form $form): Form
Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name'))->required(),
Forms\Components\TextInput::make('sort_index')
->default(0)
->label(__('label.search_box.taxonomy.sort_index'))
->helperText(__('label.search_box.taxonomy.sort_index_help'))
->label(__('label.priority'))
->helperText(__('label.priority_help'))
,
Forms\Components\Select::make('mode')
->options(SearchBox::query()->pluck('name', 'id')->toArray())
Expand All @@ -55,7 +55,7 @@ public static function table(Table $table): Table
Tables\Columns\TextColumn::make('name')->label(__('label.search_box.taxonomy.name'))->searchable(),
Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(),
])
->defaultSort('sort_index', 'asc')
->defaultSort('sort_index', 'desc')
->filters([
Tables\Filters\SelectFilter::make('mode')
->options(SearchBox::query()->pluck('name', 'id')->toArray())
Expand Down
2 changes: 1 addition & 1 deletion app/Repositories/SearchBoxRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private function buildTaxonomySelect(SearchBox $searchBox, $torrentField, array
$select .= sprintf('<option value="%s">%s</option>', 0, nexus_trans('nexus.select_one_please'));
$list = NexusDB::table($table)->where(function (Builder $query) use ($searchBox) {
return $query->where('mode', $searchBox->id)->orWhere('mode', 0);
})->get();
})->orderBy('sort_index', 'desc')->get();
foreach ($list as $item) {
$selected = '';
if (isset($torrentInfo[$torrentField]) && $torrentInfo[$torrentField] == $item->id) {
Expand Down
Loading

0 comments on commit 10cd698

Please sign in to comment.