mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 13:32:41 +08:00
exam fixed after assign
This commit is contained in:
@@ -4,9 +4,11 @@ namespace App\Filament\Resources\User\ExamUserResource\Pages;
|
||||
|
||||
use App\Filament\Resources\User\ExamUserResource;
|
||||
use App\Repositories\ExamRepository;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Forms;
|
||||
|
||||
class ViewExamUser extends ViewRecord
|
||||
{
|
||||
@@ -16,7 +18,7 @@ class ViewExamUser extends ViewRecord
|
||||
|
||||
private function getDetailCardData(): array
|
||||
{
|
||||
// dd($this->record->progressFormatted);
|
||||
// dd($this->record);
|
||||
$data = [];
|
||||
$record = $this->record;
|
||||
$data[] = [
|
||||
@@ -82,6 +84,31 @@ class ViewExamUser extends ViewRecord
|
||||
})
|
||||
->label(__('admin.resources.exam_user.action_avoid')),
|
||||
|
||||
Actions\Action::make('UpdateEnd')
|
||||
->mountUsing(fn (Forms\ComponentContainer $form) => $form->fill([
|
||||
'end' => $this->record->end,
|
||||
]))
|
||||
->form([
|
||||
Forms\Components\DateTimePicker::make('end')
|
||||
->required()
|
||||
->label(__('label.end'))
|
||||
,
|
||||
Forms\Components\Textarea::make('reason')
|
||||
->label(__('label.reason'))
|
||||
,
|
||||
])
|
||||
->action(function (array $data) {
|
||||
$examRep = new ExamRepository();
|
||||
try {
|
||||
$examRep->updateExamUserEnd($this->record, Carbon::parse($data['end']), $data['reason'] ?? "");
|
||||
$this->notify('success', 'Success !');
|
||||
$this->record = $this->resolveRecord($this->record->id);
|
||||
} catch (\Exception $exception) {
|
||||
$this->notify('danger', $exception->getMessage());
|
||||
}
|
||||
})
|
||||
->label(__('admin.resources.exam_user.action_update_end')),
|
||||
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user