replace filament custom views

This commit is contained in:
NekoCH
2026-02-26 21:08:13 +08:00
parent 527a2d2162
commit d79031f24d
10 changed files with 25 additions and 309 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Filament\Resources\System\SettingResource\Pages;
use Filament\Actions\Action;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Schemas\Schema;
@@ -41,8 +42,6 @@ class EditSetting extends Page implements HasForms
protected static string $resource = SettingResource::class;
protected string $view = 'filament.resources.system.setting-resource.pages.edit-hit-and-run';
public ?array $data = [];
public function getTitle(): string
@@ -56,7 +55,7 @@ class EditSetting extends Page implements HasForms
$this->fillForm();
}
public function form(Schema $schema): Schema
public function content(Schema $schema): Schema
{
return $schema
->components($this->getFormSchema())
@@ -76,7 +75,7 @@ class EditSetting extends Page implements HasForms
}
Arr::set($settings, 'captcha.attendance.enabled', $normalized);
$this->form->fill($settings);
$this->content->fill($settings);
}
@@ -85,7 +84,10 @@ class EditSetting extends Page implements HasForms
{
return [
Tabs::make('Heading')
->tabs($this->getTabs())
->tabs($this->getTabs()),
Action::make('submit')
->label(__('label.save'))
->action(fn() => $this->submit()),
];
}
@@ -93,7 +95,7 @@ class EditSetting extends Page implements HasForms
{
static::authorizeResourceAccess();
$formData = $this->form->getState();
$formData = $this->content->getState();
$notAutoloadNames = ['donation_custom'];
$data = [];
foreach ($formData as $prefix => $parts) {

View File

@@ -2,6 +2,8 @@
namespace App\Filament\Resources\User;
use Filament\Infolists\Components\RepeatableEntry;
use Filament\Infolists\Components\RepeatableEntry\TableColumn;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\BooleanColumn;
@@ -193,10 +195,21 @@ class ExamUserResource extends Resource
->columns(2)
,
Group::make([
ViewEntry::make('progressFormatted')
->label('进度')
->view('filament.resources.user.exam-user-resource.pages.detail-v3')
])->columnSpan(1),
RepeatableEntry::make('progressFormatted')
->hiddenLabel()
->table([
TableColumn::make(__('label.exam.index_required_label')),
TableColumn::make(__('label.exam.index_required_value')),
TableColumn::make(__('label.exam.index_current_value')),
TableColumn::make(__('label.exam.index_result')),
])
->schema([
TextEntry::make('index_formatted'),
TextEntry::make('require_value_formatted'),
TextEntry::make('current_value_formatted'),
TextEntry::make('index_result')->html(),
])
])->columnSpan(1),
]),
]);

View File

@@ -1,17 +0,0 @@
<x-filament::page
:class="\Illuminate\Support\Arr::toCssClasses([
'filament-resources-create-record-page',
'filament-resources-' . str_replace('/', '-', $this->getResource()::getSlug()),
])"
>
<x-filament::form wire:submit.prevent="create">
<div style="margin-bottom: 40px;white-space: pre-wrap">{!! $desc !!}</div>
<hr/>
{{ $this->form }}
<x-filament::form.actions
:actions="$this->getCachedFormActions()"
:full-width="$this->hasFullWidthFormActions()"
/>
</x-filament::form>
</x-filament::page>

View File

@@ -1,49 +0,0 @@
<x-filament::page
:widget-data="['record' => $record]"
:class="\Illuminate\Support\Arr::toCssClasses([
'filament-resources-edit-record-page',
'filament-resources-' . str_replace('/', '-', $this->getResource()::getSlug()),
'filament-resources-record-' . $record->getKey(),
])"
>
@capture($form)
<x-filament::form wire:submit.prevent="save">
<div style="margin-bottom: 40px;white-space: pre-wrap">{!! $desc !!}</div>
<hr/>
{{ $this->form }}
<x-filament::form.actions
:actions="$this->getCachedFormActions()"
:full-width="$this->hasFullWidthFormActions()"
/>
</x-filament::form>
@endcapture
@php
$relationManagers = $this->getRelationManagers();
@endphp
@if ((! $this->hasCombinedRelationManagerTabsWithForm()) || (! count($relationManagers)))
{{ $form() }}
@endif
@if (count($relationManagers))
@if (! $this->hasCombinedRelationManagerTabsWithForm())
<x-filament::hr />
@endif
<x-filament::resources.relation-managers
:active-manager="$activeRelationManager"
:form-tab-label="$this->getFormTabLabel()"
:managers="$relationManagers"
:owner-record="$record"
:page-class="static::class"
>
@if ($this->hasCombinedRelationManagerTabsWithForm())
<x-slot name="form">
{{ $form() }}
</x-slot>
@endif
</x-filament::resources.relation-managers>
@endif
</x-filament::page>

View File

@@ -1,3 +0,0 @@
<x-filament::page>
</x-filament::page>

View File

@@ -1,10 +0,0 @@
<x-filament::page>
<form wire:submit.prevent="submit" class="fi-sc fi-sc-has-gap fi-grid">
{{ $this->form }}
<x-filament::actions>
<x-filament::button type="submit">
{{__('filament-actions::edit.single.modal.actions.save.label')}}
</x-filament::button>
</x-filament::actions>
</form>
</x-filament::page>

View File

@@ -1,3 +0,0 @@
<x-filament::page>
{{ $this->form }}
</x-filament::page>

View File

@@ -1,55 +0,0 @@
<div class="fi-ta-ctn">
<div class="fi-ta-main">
<div class="fi-ta-content-ctn">
<table class="fi-ta-table">
<thead>
<tr>
<th class="fi-ta-header-cell fi-ta-header-cell-id">
{{ __('label.exam.index_required_label') }}
</th>
<th class="fi-ta-header-cell fi-ta-header-cell-id">
{{ __('label.exam.index_required_value') }}
</th>
<th class="fi-ta-header-cell fi-ta-header-cell-id">
{{ __('label.exam.index_current_value') }}
</th>
<th class="fi-ta-header-cell fi-ta-header-cell-id">
{{ __('label.exam.index_result') }}
</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
@foreach ($getState() as $index)
<tr class="fi-ta-row">
<td class="fi-ta-cell fi-ta-cell-id">
<div class="fi-ta-col">
<div
class="fi-size-sm fi-ta-text-item fi-ta-text">{{ $index['index_formatted'] }}</div>
</div>
</td>
<td class="fi-ta-cell fi-ta-cell-id">
<div class="fi-ta-col">
<div
class="fi-size-sm fi-ta-text-item fi-ta-text">{{ $index['require_value_formatted'] }}</div>
</div>
</td>
<td class="fi-ta-cell fi-ta-cell-id">
<div class="fi-ta-col">
<div
class="fi-size-sm fi-ta-text-item fi-ta-text">{{ $index['current_value_formatted'] }}</div>
</div>
</td>
<td class="fi-ta-cell fi-ta-cell-id">
<div class="fi-ta-col">
<div
class="fi-size-sm fi-ta-text-item fi-ta-text">{!! $index['index_result'] !!}</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -1,40 +0,0 @@
<x-filament::page :widget-data="['record' => $record]" class="filament-resources-view-record-page">
<div class="flex flex-col md:flex-row justify-between">
<table class="table text-left border-spacing-y-2 border-collapse divide-y w-full">
<tbody>
@foreach($cardData as $value)
<tr class="">
<th class="border-spacing-3">{{ $value['label'] }}</th>
<td class="border-spacing-3">{!! $value['value'] !!}</td>
</tr>
@endforeach
</tbody>
</table>
<table class="table text-left border-spacing-y-2 border-collapse divide-y w-full">
<thead>
<tr>
<th>{{ __('label.exam.index_required_label') }}</th>
<th>{{ __('label.exam.index_required_value') }}</th>
<th>{{ __('label.exam.index_current_value') }}</th>
<th>{{ __('label.exam.index_result') }}</th>
</tr>
</thead>
<tbody>
@foreach($record->progressFormatted as $index)
<tr>
<td>{{ $index['index_formatted'] }}</td>
<td>{{ $index['require_value_formatted'] }}</td>
<td>{{ $index['current_value_formatted'] }}</td>
<td>{!! $index['passed'] ? __($result_pass_trans_key) : __($result_not_pass_trans_key) !!}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@if (count($relationManagers = $this->getRelationManagers()))
<x-filament::hr />
<x-filament::resources.relation-managers :active-manager="$activeRelationManager" :managers="$relationManagers" :owner-record="$record" />
@endif
</x-filament::page>

View File

@@ -1,122 +0,0 @@
<x-filament::page>
<div class="flex">
<table class="table w-full text-left border-spacing-y-2 border-collapse divide-y w-full">
<tbody>
<tr>
<th>UID</th>
<td>{{$record->id}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.user.username')}}</th>
<td>{!! get_username($record->id, false, true, true, true) !!}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.email')}}</th>
<td>{{$record->email}}</td>
<td></td>
</tr>
<tr>
<th>Passkey</th>
<td>{{$record->passkey}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.status')}}</th>
<td>{{$record->status}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.enabled')}}</th>
<td>{{$record->enabled}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.added')}}</th>
<td>{{$record->added}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.last_access')}}</th>
<td>{{$record->last_access}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.user.class')}}</th>
<td>{{$record->classText}}</td>
<td></td>
</tr>
@if($props)
<tr>
<th>{{__('user.labels.props')}}</th>
<td><div style="display: flex">{!! implode('&nbsp;|&nbsp;', $props) !!}</div></td>
<td></td>
</tr>
@endif
{!! do_action('user_detail_rows', $record->id, 'admin') !!}
<tr>
<th>{{__('label.user.invite_by')}}</th>
<td>{{$record->inviter->username ?? ''}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.user.two_step_authentication')}}</th>
<td>{{$record->two_step_secret ? 'Enabled' : 'Disabled'}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.user.downloadpos')}}</th>
<td>{{$record->downloadpos}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.user.parked')}}</th>
<td>{{$record->parked}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.user.offer_allowed_count')}}</th>
<td>{{$record->offer_allowed_count}}</td>
<td></td>
</tr>
<tr>
<th>{{__('label.user.seed_points')}}</th>
<td>{{$record->seed_points}}</td>
<td></td>
</tr>
<tr>
<th>{{ __('label.user.attendance_card') }}</th>
<td>{{$record->attendance_card}}</td>
<td></td>
</tr>
<tr>
<th>{{ __('label.user.invites') }}</th>
<td>{{sprintf('%s(%s)', $record->invites, $temporary_invite_count)}}</td>
<td></td>
</tr>
<tr>
<th>{{ __('label.uploaded') }}</th>
<td>{{$record->uploadedText}}</td>
<td></td>
</tr>
<tr>
<th>{{ __('label.downloaded') }}</th>
<td>{{$record->downloadedText}}</td>
<td></td>
</tr>
<tr>
<th>{{ __('label.user.seedbonus') }}</th>
<td>{{$record->seedbonus}}</td>
<td></td>
</tr>
</tbody>
</table>
</div>
@if (count($relationManagers = $this->getRelationManagers()))
<x-filament::hr />
<x-filament::resources.relation-managers :active-manager="$activeRelationManager" :managers="$relationManagers" :owner-record="$record" />
@endif
</x-filament::page>