mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
exam user detail
This commit is contained in:
@@ -10,4 +10,9 @@ class Permission
|
|||||||
{
|
{
|
||||||
return user_can(PermissionEnum::UPLOAD_TO_SPECIAL_SECTION->value);
|
return user_can(PermissionEnum::UPLOAD_TO_SPECIAL_SECTION->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function canBeAnonymous(): bool
|
||||||
|
{
|
||||||
|
return user_can(PermissionEnum::BE_ANONYMOUS->value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ namespace App\Enums;
|
|||||||
|
|
||||||
enum PermissionEnum: string {
|
enum PermissionEnum: string {
|
||||||
case UPLOAD_TO_SPECIAL_SECTION = 'uploadspecial';
|
case UPLOAD_TO_SPECIAL_SECTION = 'uploadspecial';
|
||||||
|
case BE_ANONYMOUS = 'beanonymous';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use App\Repositories\HitAndRunRepository;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Infolists\Components\ViewEntry;
|
||||||
use Filament\Infolists\Infolist;
|
use Filament\Infolists\Infolist;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
@@ -179,25 +180,9 @@ class ExamUserResource extends Resource
|
|||||||
->columns(2)
|
->columns(2)
|
||||||
,
|
,
|
||||||
Components\Group::make([
|
Components\Group::make([
|
||||||
Components\Grid::make(3) // 3 列的网格
|
ViewEntry::make('progressFormatted')
|
||||||
->schema([
|
->label('进度')
|
||||||
Infolists\Components\TextEntry::make('header1')->label('Header 1'),
|
->view('filament.resources.user.exam-user-resource.pages.detail-v3')
|
||||||
Infolists\Components\TextEntry::make('header2')->label('Header 2'),
|
|
||||||
Infolists\Components\TextEntry::make('header3')->label('Header 3'),
|
|
||||||
]),
|
|
||||||
Components\Grid::make(3) // 数据行
|
|
||||||
->schema([
|
|
||||||
Infolists\Components\TextEntry::make('data1')->getStateUsing(fn ($record) => $record->data1),
|
|
||||||
Infolists\Components\TextEntry::make('data2')->getStateUsing(fn ($record) => $record->data2),
|
|
||||||
Infolists\Components\TextEntry::make('data3')->getStateUsing(fn ($record) => $record->data3),
|
|
||||||
]),
|
|
||||||
// 更多数据行...
|
|
||||||
Components\Grid::make(3) // 数据行
|
|
||||||
->schema([
|
|
||||||
Infolists\Components\TextEntry::make('data1')->getStateUsing(fn ($record) => $record->data4),
|
|
||||||
Infolists\Components\TextEntry::make('data2')->getStateUsing(fn ($record) => $record->data5),
|
|
||||||
Infolists\Components\TextEntry::make('data3')->getStateUsing(fn ($record) => $record->data6),
|
|
||||||
]),
|
|
||||||
])->columnSpan(1),
|
])->columnSpan(1),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -283,8 +283,15 @@ class SearchBox extends NexusModel
|
|||||||
foreach (self::$taxonomies as $name => $info) {
|
foreach (self::$taxonomies as $name => $info) {
|
||||||
$relationName = "taxonomy_" . $name;
|
$relationName = "taxonomy_" . $name;
|
||||||
$show = "show" . $name;
|
$show = "show" . $name;
|
||||||
if ($this->{$show}) {
|
if ($this->{$show} && isset(self::$taxonomies[$name])) {
|
||||||
$this->setRelation($relationName, $this->{$relationName}()->orWhere('mode', 0)->get());
|
$modelName = self::$taxonomies[$name]['model'];
|
||||||
|
$this->setRelation(
|
||||||
|
$relationName,
|
||||||
|
$modelName::query()->whereIn('mode', [$this->getKey(), 0])
|
||||||
|
->orderBy('sort_index')
|
||||||
|
->orderBy('id')
|
||||||
|
->get()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -296,7 +303,7 @@ class SearchBox extends NexusModel
|
|||||||
|
|
||||||
public function loadTags(): void
|
public function loadTags(): void
|
||||||
{
|
{
|
||||||
$this->setRelation("tags", TagRepository::listAll($this->id));
|
$this->setRelation("tags", TagRepository::listAll($this->getKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDefaultSearchMode()
|
public static function getDefaultSearchMode()
|
||||||
|
|||||||
@@ -867,6 +867,7 @@ class ExamRepository extends BaseRepository
|
|||||||
$index['current_value'] = $currentValue;
|
$index['current_value'] = $currentValue;
|
||||||
$index['current_value_formatted'] = $currentValueFormatted;
|
$index['current_value_formatted'] = $currentValueFormatted;
|
||||||
$index['passed'] = $currentValue >= $requireValueAtomic;
|
$index['passed'] = $currentValue >= $requireValueAtomic;
|
||||||
|
$index['index_result'] = $index['passed'] ? nexus_trans($exam->getPassResultTransKey('pass')) : nexus_trans($exam->getPassResultTransKey('not_pass'));
|
||||||
$result[] = $index;
|
$result[] = $index;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class TagRepository extends BaseRepository
|
|||||||
|
|
||||||
public static function createBasicQuery()
|
public static function createBasicQuery()
|
||||||
{
|
{
|
||||||
return Tag::query()->orderBy('priority', 'desc')->orderBy('id', 'desc');
|
return Tag::query()->orderBy('priority', 'asc')->orderBy('id', 'asc');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderCheckbox(int $searchBoxId, array $checked = [], $ignorePermission = false): string
|
public function renderCheckbox(int $searchBoxId, array $checked = [], $ignorePermission = false): string
|
||||||
|
|||||||
@@ -21,11 +21,15 @@ class UploadRepository extends BaseRepository
|
|||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
];
|
];
|
||||||
$request->validate($rules);
|
$request->validate($rules);
|
||||||
$category = Category::query()->firstOrFail($request->type);
|
$category = Category::query()->findOrFail($request->type);
|
||||||
$mode = $category->mode;
|
$mode = $category->mode;
|
||||||
|
$searchBox = SearchBox::query()->findOrFail($mode);
|
||||||
|
$searchBox->loadSubCategories();
|
||||||
|
$searchBox->loadTags();
|
||||||
|
|
||||||
$anonymous = "no";
|
$anonymous = "no";
|
||||||
$uploaderUsername = $user->username;
|
$uploaderUsername = $user->username;
|
||||||
if ($request->uplver == 'yes' && user_can('beanonymous')) {
|
if ($request->uplver == 'yes' && Permission::canBeAnonymous()) {
|
||||||
$anonymous = "yes";
|
$anonymous = "yes";
|
||||||
$uploaderUsername = "Anonymous";
|
$uploaderUsername = "Anonymous";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<div class="fi-ta-content relative divide-y divide-gray-200 overflow-x-auto dark:divide-white/10 dark:border-t-white/10">
|
||||||
|
<table class="fi-ta-table w-full table-auto divide-y divide-gray-200 text-start dark:divide-white/5">
|
||||||
|
<thead class="divide-y divide-gray-200 dark:divide-white/5">
|
||||||
|
<tr class="bg-gray-50 dark:bg-white/5">
|
||||||
|
<th class="fi-ta-header-cell px-3 py-3.5 sm:first-of-type:ps-6 sm:last-of-type:pe-6 fi-table-header-cell-id">
|
||||||
|
<span class="group flex w-full items-center gap-x-1 whitespace-nowrap justify-start">
|
||||||
|
<span class="fi-ta-header-cell-label text-sm font-semibold text-gray-950 dark:text-white">
|
||||||
|
{{ __('label.exam.index_required_label') }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th class="fi-ta-header-cell px-3 py-3.5 sm:first-of-type:ps-6 sm:last-of-type:pe-6 fi-table-header-cell-id">
|
||||||
|
<span class="group flex w-full items-center gap-x-1 whitespace-nowrap justify-start">
|
||||||
|
<span class="fi-ta-header-cell-label text-sm font-semibold text-gray-950 dark:text-white">
|
||||||
|
{{ __('label.exam.index_required_value') }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th class="fi-ta-header-cell px-3 py-3.5 sm:first-of-type:ps-6 sm:last-of-type:pe-6 fi-table-header-cell-id">
|
||||||
|
<span class="group flex w-full items-center gap-x-1 whitespace-nowrap justify-start">
|
||||||
|
<span class="fi-ta-header-cell-label text-sm font-semibold text-gray-950 dark:text-white">
|
||||||
|
{{ __('label.exam.index_current_value') }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
<th class="fi-ta-header-cell px-3 py-3.5 sm:first-of-type:ps-6 sm:last-of-type:pe-6 fi-table-header-cell-id">
|
||||||
|
<span class="group flex w-full items-center gap-x-1 whitespace-nowrap justify-start">
|
||||||
|
<span class="fi-ta-header-cell-label text-sm font-semibold text-gray-950 dark:text-white">
|
||||||
|
{{ __('label.exam.index_result') }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
|
||||||
|
@foreach ($getState() as $index)
|
||||||
|
<tr class="dark:bg-gray-800">
|
||||||
|
<td class="fi-ta-cell p-0 first-of-type:ps-1 last-of-type:pe-1 sm:first-of-type:ps-3 sm:last-of-type:pe-3 fi-table-cell-id">{{ $index['index_formatted'] }}</td>
|
||||||
|
<td class="fi-ta-cell p-0 first-of-type:ps-1 last-of-type:pe-1 sm:first-of-type:ps-3 sm:last-of-type:pe-3 fi-table-cell-id">{{ $index['require_value_formatted'] }}</td>
|
||||||
|
<td class="fi-ta-cell p-0 first-of-type:ps-1 last-of-type:pe-1 sm:first-of-type:ps-3 sm:last-of-type:pe-3 fi-table-cell-id">{{ $index['current_value_formatted'] }}</td>
|
||||||
|
<td class="fi-ta-cell p-0 first-of-type:ps-1 last-of-type:pe-1 sm:first-of-type:ps-3 sm:last-of-type:pe-3 fi-table-cell-id">{!! $index['index_result'] !!}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user