mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 20:17:24 +08:00
show approval only when not review visible is no
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Filament\Resources\Torrent;
|
|||||||
|
|
||||||
use App\Filament\Resources\Torrent\TorrentResource\Pages;
|
use App\Filament\Resources\Torrent\TorrentResource\Pages;
|
||||||
use App\Filament\Resources\Torrent\TorrentResource\RelationManagers;
|
use App\Filament\Resources\Torrent\TorrentResource\RelationManagers;
|
||||||
|
use App\Models\Setting;
|
||||||
use App\Models\Tag;
|
use App\Models\Tag;
|
||||||
use App\Models\Torrent;
|
use App\Models\Torrent;
|
||||||
use App\Models\TorrentTag;
|
use App\Models\TorrentTag;
|
||||||
@@ -52,6 +53,7 @@ class TorrentResource extends Resource
|
|||||||
|
|
||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
|
$showApproval = Setting::get('torrent.approval_status_none_visible') == 'no';
|
||||||
return $table
|
return $table
|
||||||
->columns([
|
->columns([
|
||||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||||
@@ -72,6 +74,7 @@ class TorrentResource extends Resource
|
|||||||
Tables\Columns\TextColumn::make('leechers')->label(__('label.torrent.leechers')),
|
Tables\Columns\TextColumn::make('leechers')->label(__('label.torrent.leechers')),
|
||||||
// Tables\Columns\TextColumn::make('times_completed')->label(__('label.torrent.times_completed')),
|
// Tables\Columns\TextColumn::make('times_completed')->label(__('label.torrent.times_completed')),
|
||||||
Tables\Columns\BadgeColumn::make('approval_status')
|
Tables\Columns\BadgeColumn::make('approval_status')
|
||||||
|
->visible($showApproval)
|
||||||
->label(__('label.torrent.approval_status'))
|
->label(__('label.torrent.approval_status'))
|
||||||
->colors(array_flip(Torrent::listApprovalStatus(true, 'badge_color')))
|
->colors(array_flip(Torrent::listApprovalStatus(true, 'badge_color')))
|
||||||
->formatStateUsing(fn ($record) => $record->approvalStatusText),
|
->formatStateUsing(fn ($record) => $record->approvalStatusText),
|
||||||
@@ -100,6 +103,7 @@ class TorrentResource extends Resource
|
|||||||
// Tables\Actions\EditAction::make(),
|
// Tables\Actions\EditAction::make(),
|
||||||
Tables\Actions\Action::make('approval')
|
Tables\Actions\Action::make('approval')
|
||||||
->label(__('admin.resources.torrent.action_approval'))
|
->label(__('admin.resources.torrent.action_approval'))
|
||||||
|
->visible($showApproval)
|
||||||
->form([
|
->form([
|
||||||
Forms\Components\Radio::make('approval_status')
|
Forms\Components\Radio::make('approval_status')
|
||||||
->label(__('label.torrent.approval_status'))
|
->label(__('label.torrent.approval_status'))
|
||||||
@@ -176,6 +180,7 @@ class TorrentResource extends Resource
|
|||||||
})
|
})
|
||||||
->deselectRecordsAfterCompletion(),
|
->deselectRecordsAfterCompletion(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getEloquentQuery(): Builder
|
public static function getEloquentQuery(): Builder
|
||||||
|
|||||||
+1
-1
@@ -156,7 +156,7 @@ if (!$row) {
|
|||||||
if (get_user_class() >= $askreseed_class && $row['seeders'] == 0) {
|
if (get_user_class() >= $askreseed_class && $row['seeders'] == 0) {
|
||||||
$actions[] = "<a title=\"".$lang_details['title_ask_for_reseed']."\" href=\"takereseed.php?reseedid=$id\"><img class=\"dt_reseed\" src=\"pic/trans.gif\" alt=\"reseed\"> <b><font class=\"small\">".$lang_details['text_ask_for_reseed'] ."</font></b></a>";
|
$actions[] = "<a title=\"".$lang_details['title_ask_for_reseed']."\" href=\"takereseed.php?reseedid=$id\"><img class=\"dt_reseed\" src=\"pic/trans.gif\" alt=\"reseed\"> <b><font class=\"small\">".$lang_details['text_ask_for_reseed'] ."</font></b></a>";
|
||||||
}
|
}
|
||||||
if (get_user_class() >= $torrentmanage_class) {
|
if (get_user_class() >= $torrentmanage_class && get_setting('torrent.approval_status_none_visible') == 'no') {
|
||||||
$approvalIcon = '<svg t="1655224943277" class="icon" viewBox="0 0 1397 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="45530" width="16" height="16"><path d="M1396.363636 121.018182c0 0-223.418182 74.472727-484.072727 372.363636-242.036364 269.963636-297.890909 381.672727-390.981818 530.618182C512 1014.690909 372.363636 744.727273 0 549.236364l195.490909-186.181818c0 0 176.872727 121.018182 297.890909 344.436364 0 0 307.2-474.763636 902.981818-707.490909L1396.363636 121.018182 1396.363636 121.018182zM1396.363636 121.018182" p-id="45531" fill="#e78d0f"></path></svg>';
|
$approvalIcon = '<svg t="1655224943277" class="icon" viewBox="0 0 1397 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="45530" width="16" height="16"><path d="M1396.363636 121.018182c0 0-223.418182 74.472727-484.072727 372.363636-242.036364 269.963636-297.890909 381.672727-390.981818 530.618182C512 1014.690909 372.363636 744.727273 0 549.236364l195.490909-186.181818c0 0 176.872727 121.018182 297.890909 344.436364 0 0 307.2-474.763636 902.981818-707.490909L1396.363636 121.018182 1396.363636 121.018182zM1396.363636 121.018182" p-id="45531" fill="#e78d0f"></path></svg>';
|
||||||
$actions[] = sprintf(
|
$actions[] = sprintf(
|
||||||
'<a href="javascript:;"><b><font id="approval" class="small approval" data-torrent_id="%s">%s %s</font></b></a>',
|
'<a href="javascript:;"><b><font id="approval" class="small approval" data-torrent_id="%s">%s %s</font></b></a>',
|
||||||
|
|||||||
+2
-2
@@ -811,8 +811,8 @@ $approvalStatusNoneVisible = get_setting('torrent.approval_status_none_visible')
|
|||||||
$approvalStatusIconEnabled = get_setting('torrent.approval_status_icon_enabled');
|
$approvalStatusIconEnabled = get_setting('torrent.approval_status_icon_enabled');
|
||||||
$approvalStatus = null;
|
$approvalStatus = null;
|
||||||
$showApprovalStatusFilter = false;
|
$showApprovalStatusFilter = false;
|
||||||
//when enable approval status icon, all user can use this filter, otherwise only staff member can use
|
//when enable approval status icon, all user can use this filter, otherwise only staff member and approval none visible is 'no' can use
|
||||||
if ($approvalStatusIconEnabled == 'yes' || get_user_class() >= $staffmem_class) {
|
if ($approvalStatusIconEnabled == 'yes' || (get_user_class() >= $staffmem_class && $approvalStatusNoneVisible == 'no')) {
|
||||||
$showApprovalStatusFilter = true;
|
$showApprovalStatusFilter = true;
|
||||||
}
|
}
|
||||||
//when user can use approval status filter, and pass `approval_status` parameter, will affect
|
//when user can use approval status filter, and pass `approval_status` parameter, will affect
|
||||||
|
|||||||
Reference in New Issue
Block a user