feat: enhance exam result details and display comprehensive report information commit

This commit is contained in:
mengstabketemaw
2026-06-27 11:53:15 +03:00
parent 0b9322f016
commit 2b2ae71a8f
4 changed files with 268 additions and 80 deletions

View File

@@ -39,8 +39,9 @@ import {
IconX,
} from '@tabler/icons-react';
import { notify } from '@ema-platform/ui';
import { useApiQuery, useApiMutation } from '@ema-platform/api';
import { useApiQuery } from '@ema-platform/api';
import { useGetExamQuery, useUpdateExamMutation } from '../api/exam-api';
import { useCreateResultMutation } from '../../result/api/result-api';
import type { Exam, ExamStatus } from '../types/exam';
const STATUS_COLOR: Record<string, string> = {
@@ -80,7 +81,7 @@ function RecordResultModal({
url: '/profiles',
params: { q: 'w=type:=:SEAFARER' },
});
const [createResult, { isLoading: isSaving }] = useApiMutation();
const [createResult, { isLoading: isSaving }] = useCreateResultMutation();
const seafarers = profilesRes?.items ?? [];
const questions = exam.questions ?? [];
@@ -113,15 +114,11 @@ function RecordResultModal({
remark: '',
}));
await createResult({
url: '/results',
method: 'POST',
body: {
seafarerId: selectedSeafarerId,
examId: exam.id,
resultBreakdowns: breakdowns,
totalScore,
remark: remark ? { en: remark, am: '' } : undefined,
},
seafarerId: selectedSeafarerId,
examId: exam.id,
resultBreakdowns: breakdowns,
totalScore,
remark: remark ? { en: remark, am: '' } : undefined,
}).unwrap();
notify.success(`Result recorded — ${passed ? 'PASSED' : 'FAILED'} (${totalScore}/${exam.cuttingPoint})`);
setSelectedSeafarerId(null);