mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-22 02:47:27 +08:00
improve exam trans
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\User\ExamUserResource\Pages;
|
||||
|
||||
use App\Filament\Resources\User\ExamUserResource;
|
||||
use App\Models\Exam;
|
||||
use App\Repositories\ExamRepository;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Pages\Actions;
|
||||
@@ -62,8 +63,12 @@ class ViewExamUser extends ViewRecord
|
||||
|
||||
protected function getViewData(): array
|
||||
{
|
||||
/** @var Exam $exam */
|
||||
$exam = $this->record->exam;
|
||||
return [
|
||||
'cardData' => $this->getDetailCardData(),
|
||||
'result_pass_trans_key' => $exam->getPassResultTransKey('pass'),
|
||||
'result_not_pass_trans_key' => $exam->getPassResultTransKey('not_pass'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -275,6 +275,15 @@ class Exam extends NexusModel
|
||||
};
|
||||
}
|
||||
|
||||
public function getPassResultTransKey(string $result): string
|
||||
{
|
||||
return match ($this->type) {
|
||||
self::TYPE_EXAM => "exam.result_{$result}_for_exam",
|
||||
self::TYPE_TASK => "exam.result_{$result}_for_task",
|
||||
default => throw new \RuntimeException("Invalid type: " . $this->type)
|
||||
};
|
||||
}
|
||||
|
||||
public function isTypeExam(): bool
|
||||
{
|
||||
return $this->type == self::TYPE_EXAM;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.12');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-06-24');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-06-27');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ class Exam
|
||||
if (empty($userExam)) {
|
||||
return '';
|
||||
}
|
||||
/** @var \App\Models\Exam $exam */
|
||||
$exam = $userExam->exam;
|
||||
$row = [];
|
||||
$row[] = sprintf('%s:%s', nexus_trans('exam.name'), $exam->name);
|
||||
@@ -26,7 +27,7 @@ class Exam
|
||||
nexus_trans('exam.require_value'), $index['require_value_formatted'],
|
||||
nexus_trans('exam.current_value'), $index['current_value_formatted'],
|
||||
nexus_trans('exam.result'),
|
||||
$index['passed'] ? nexus_trans('exam.result_pass') : nexus_trans('exam.result_not_pass')
|
||||
$index['passed'] ? nexus_trans($exam->getPassResultTransKey("pass")) : nexus_trans($exam->getPassResultTransKey("not_pass"))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,21 @@ return [
|
||||
'require_value' => 'Require',
|
||||
'current_value' => 'Current',
|
||||
'result' => 'Result',
|
||||
'result_pass' => 'Pass!',
|
||||
'result_not_pass' => '<span style="color: red">Not pass!</span>',
|
||||
'checkout_pass_message_subject' => 'Exam pass!',
|
||||
'checkout_pass_message_content' => 'Congratulation! You have complete the exam: :exam_name in time(:begin ~ :end)',
|
||||
'checkout_not_pass_message_subject' => 'Exam not pass, and account is banned!',
|
||||
'checkout_not_pass_message_content' => 'You did not complete the exam: :exam_name in time(:begin ~ :end), and your account has be banned!',
|
||||
|
||||
'result_pass_for_exam' => 'Passed!',
|
||||
'result_pass_for_task' => 'Completed!',
|
||||
'result_not_pass_for_exam' => '<span style="color: red">Not Passed!</span>',
|
||||
'result_not_pass_for_task' => '<span style="color: red">Not Completed!</span>',
|
||||
'checkout_pass_message_subject_for_exam' => 'Exam passed!',
|
||||
'checkout_pass_message_content_for_exam' => 'Congratulation! You have pass the exam: :exam_name in time(:begin ~ :end)',
|
||||
'checkout_not_pass_message_subject_for_exam' => 'Exam not pass, and account is banned!',
|
||||
'checkout_not_pass_message_content_for_exam' => 'You did not pass the exam: :exam_name in time(:begin ~ :end), and your account has be banned!',
|
||||
|
||||
'checkout_pass_message_subject_for_task' => 'Task completed!',
|
||||
'checkout_pass_message_content_for_task' => 'Congratulation! You have complete the task: :exam_name in time(:begin ~ :end), got bonus: :success_reward_bonus',
|
||||
'checkout_not_pass_message_subject_for_task' => 'Task not completed!',
|
||||
'checkout_not_pass_message_content_for_task' => 'You dit not complete the task: :exam_name in time (:begin ~ :end), deduct bonus: :fail_deduct_bonus.',
|
||||
|
||||
'ban_log_reason' => 'Not complete exam: :exam_name in time(:begin ~ :end)',
|
||||
'ban_user_modcomment' => 'Due to not complete exam: :exam_name(:begin ~ :end), ban by system.',
|
||||
'admin' => [
|
||||
|
||||
@@ -20,12 +20,21 @@ return [
|
||||
'require_value' => '要求',
|
||||
'current_value' => '當前',
|
||||
'result' => '結果',
|
||||
'result_pass' => '通過!',
|
||||
'result_not_pass' => '<span style="color: red">未通過!</span>',
|
||||
'checkout_pass_message_subject' => '考核通過!',
|
||||
'checkout_pass_message_content' => '恭喜!你在規定時間內(:begin ~ :end)順利完成了考核::exam_name。',
|
||||
'checkout_not_pass_message_subject' => '考核未通過,賬號被禁用!',
|
||||
'checkout_not_pass_message_content' => '你在規定時間內(:begin ~ :end)未完成考核::exam_name,賬號已被禁用。',
|
||||
|
||||
'result_pass_for_exam' => '通過!',
|
||||
'result_pass_for_task' => '完成!',
|
||||
'result_not_pass_for_exam' => '<span style="color: red">未通過!</span>',
|
||||
'result_not_pass_for_task' => '<span style="color: red">未完成!</span>',
|
||||
'checkout_pass_message_subject_for_exam' => '考核通過!',
|
||||
'checkout_pass_message_content_for_exam' => '恭喜!你在規定時間內(:begin ~ :end)順利完成了考核::exam_name。',
|
||||
'checkout_not_pass_message_subject_for_exam' => '考核未通過,賬號被禁用!',
|
||||
'checkout_not_pass_message_content_for_exam' => '你在規定時間內(:begin ~ :end)未完成考核::exam_name,賬號已被禁用。',
|
||||
|
||||
'checkout_pass_message_subject_for_task' => '任務完成!',
|
||||
'checkout_pass_message_content_for_task' => '恭喜!你在規定時間內(:begin ~ :end)順利完成了任務::exam_name,獲得獎勵魔力::success_reward_bonus',
|
||||
'checkout_not_pass_message_subject_for_task' => '任務未完成!',
|
||||
'checkout_not_pass_message_content_for_task' => '你在規定時間內(:begin ~ :end)未完成任務::exam_name,扣除魔力::fail_deduct_bonus。',
|
||||
|
||||
'ban_log_reason' => '未完成考核::exam_name(:begin ~ :end)',
|
||||
'ban_user_modcomment' => '未完成考核: :exam_name(:begin ~ :end), 被系統禁用.',
|
||||
'admin' => [
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<td>{{ $index['index_formatted'] }}</td>
|
||||
<td>{{ $index['require_value_formatted'] }}</td>
|
||||
<td>{{ $index['current_value_formatted'] }}</td>
|
||||
<td>{{ $index['passed'] ? __('admin.resources.exam_user.result_passed') : __('admin.resources.exam_user.result_not_passed') }}</td>
|
||||
<td>{!! $index['passed'] ? __($result_pass_trans_key) : __($result_not_pass_trans_key) !!}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user