update: modification on index and assessment result on role teacher
This commit is contained in:
parent
f521c68b34
commit
99d4160813
|
|
@ -572,20 +572,20 @@ function showContent(contentId) {
|
|||
"paging": true,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
dom: 'Bfrtip', // Needs to include 'B' for buttons
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: 'Export to Excel',
|
||||
title: 'Data Export REACT',
|
||||
filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
||||
customize: function (xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
// Customizations go here
|
||||
}
|
||||
},
|
||||
'pdf',
|
||||
]
|
||||
// dom: 'Bfrtip', // Needs to include 'B' for buttons
|
||||
// buttons: [
|
||||
// {
|
||||
// extend: 'excelHtml5',
|
||||
// text: 'Export to Excel',
|
||||
// title: 'Data Export REACT',
|
||||
// filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
||||
// customize: function (xlsx) {
|
||||
// var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
// // Customizations go here
|
||||
// }
|
||||
// },
|
||||
// 'pdf',
|
||||
// ]
|
||||
});
|
||||
$('#studentSubmissionTable').DataTable({
|
||||
// Configuration options
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@
|
|||
<link rel="icon" href="./images/logo.png" type="image/png">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body style="padding-bottom: 45px">
|
||||
<!-- NAVBAR -->
|
||||
<nav class="navbar navbar-expand-lg" style="background-color: #FEFEFE;">
|
||||
<div class="container-fluid">
|
||||
|
|
@ -419,53 +419,104 @@
|
|||
<!-- List Jawaban -->
|
||||
<ul class="list-group mt-4">
|
||||
@foreach ($questions as $index => $question)
|
||||
@php
|
||||
$answer = $question->answers->first();
|
||||
$isCorrect = false;
|
||||
$similarityScore = null;
|
||||
@php
|
||||
$answer = $question->answers->first();
|
||||
$isCorrect = false;
|
||||
$similarityScore = null;
|
||||
|
||||
if ($question->type === 'multiple_choice' && $answer) {
|
||||
$isCorrect = optional($answer->option)->is_correct;
|
||||
} elseif ($question->type === 'essay' && $answer) {
|
||||
$userAnswer = $normalize($answer->answer_text ?? '');
|
||||
$correctAnswers = explode("\n", $question->essay_answer ?? '');
|
||||
$maxMatch = 0;
|
||||
$questionText = $question->question_text;
|
||||
$kutipan = null;
|
||||
$pertanyaanBersih = $questionText;
|
||||
|
||||
foreach ($correctAnswers as $correct) {
|
||||
$correctNormalized = $normalize($correct);
|
||||
similar_text($userAnswer, $correctNormalized, $percent);
|
||||
$maxMatch = max($maxMatch, $percent);
|
||||
}
|
||||
if (Str::contains($questionText, 'Bacalah kutipan berikut:') || Str::contains($questionText, 'Bacalah paragraf berikut:')) {
|
||||
preg_match('/Bacalah (kutipan|paragraf) berikut:\s*"(.*?)"\s*(.*)/s', $questionText, $matches);
|
||||
if (count($matches) >= 4) {
|
||||
$kutipan = trim($matches[2]);
|
||||
$pertanyaanBersih = trim($matches[3]);
|
||||
}
|
||||
}
|
||||
|
||||
$similarityScore = $maxMatch;
|
||||
$isCorrect = $maxMatch >= $essayThreshold;
|
||||
}
|
||||
@endphp
|
||||
// Deteksi soal urutan (misal dari kata "Manakah urutan kalimat" atau pakai $question->type === 'ordering')
|
||||
$isOrdering = Str::contains($questionText, 'urutan kalimat');
|
||||
|
||||
<li class="list-group-item d-flex flex-column">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<strong>{{ $index + 1 }}. {{ $question->question_text }}</strong>
|
||||
@if ($isCorrect)
|
||||
<span class="badge bg-success px-3 py-2">Benar ✅</span>
|
||||
@else
|
||||
<span class="badge bg-danger px-3 py-2">Salah ❌</span>
|
||||
@endif
|
||||
</div>
|
||||
// Penilaian
|
||||
if ($question->type === 'multiple_choice' && $answer) {
|
||||
$isCorrect = optional($answer->option)->is_correct;
|
||||
} elseif ($question->type === 'essay' && $answer) {
|
||||
$userAnswer = $normalize($answer->answer_text ?? '');
|
||||
$correctAnswers = explode("\n", $question->essay_answer ?? '');
|
||||
$maxMatch = 0;
|
||||
|
||||
<p class="mt-2">
|
||||
<strong>Jawaban Siswa:</strong>
|
||||
@if ($question->type === 'multiple_choice')
|
||||
{{ optional($answer)->option->option_text ?? 'Tidak Dijawab' }}
|
||||
@else
|
||||
{{ optional($answer)->answer_text ?? 'Tidak Dijawab' }}
|
||||
@endif
|
||||
</p>
|
||||
foreach ($correctAnswers as $correct) {
|
||||
$correctNormalized = $normalize($correct);
|
||||
similar_text($userAnswer, $correctNormalized, $percent);
|
||||
$maxMatch = max($maxMatch, $percent);
|
||||
}
|
||||
|
||||
@if ($question->type === 'essay' && $similarityScore !== null)
|
||||
<p><strong>Skor Kemiripan:</strong> {{ number_format($similarityScore, 2) }}%</p>
|
||||
<p><strong>Feedback:</strong> {{ $answer->feedback ?? 'Tidak ada feedback' }}</p>
|
||||
@endif
|
||||
</li>
|
||||
$similarityScore = $maxMatch;
|
||||
$isCorrect = $maxMatch >= $essayThreshold;
|
||||
}
|
||||
|
||||
// Pilihan kalimat untuk soal urutan
|
||||
$choices = $question->choices ? explode("\n", $question->choices) : [];
|
||||
@endphp
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<!-- Nomor Soal -->
|
||||
<div class="col-auto d-flex justify-content-start align-items-start pt-2">
|
||||
<strong>{{ $index + 1 }}.</strong>
|
||||
</div>
|
||||
|
||||
<!-- Isi Soal dan Jawaban -->
|
||||
<div class="col">
|
||||
{{-- Tampilkan kutipan atau paragraf jika ada --}}
|
||||
@if ($kutipan)
|
||||
<p class="pt-2"><strong>Bacalah kutipan berikut:</strong></p>
|
||||
<div class="ps-3 pe-3"><em>"{{ $kutipan }}"</em></div>
|
||||
@endif
|
||||
|
||||
{{-- Pertanyaan --}}
|
||||
<p class="mt-2">{{ $pertanyaanBersih }}</p>
|
||||
|
||||
{{-- Tampilan pilihan jika soal urutan --}}
|
||||
@if ($isOrdering && count($choices) > 0)
|
||||
<div class="ps-3">
|
||||
@foreach ($choices as $i => $kalimat)
|
||||
<div>{{ $i + 1 }}. {{ $kalimat }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@elseif (count($choices) > 0)
|
||||
<div class="ps-3">
|
||||
@foreach ($choices as $i => $opsi)
|
||||
<div>{{ chr(65 + $i) }}. {{ $opsi }}</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Jawaban siswa --}}
|
||||
<p class="mt-3">
|
||||
<strong>Jawaban Siswa:</strong>
|
||||
{{ $question->type === 'multiple_choice'
|
||||
? optional($answer)->option->option_text ?? 'Tidak Dijawab'
|
||||
: optional($answer)->answer_text ?? 'Tidak Dijawab' }}
|
||||
</p>
|
||||
|
||||
{{-- Skor dan feedback (untuk essay) --}}
|
||||
@if ($question->type === 'essay' && $similarityScore !== null)
|
||||
<p><strong>Skor Kemiripan:</strong> {{ number_format($similarityScore, 2) }}%</p>
|
||||
<p><strong>Feedback:</strong> {{ $answer->feedback ?? 'Tidak ada feedback' }}</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- Status benar/salah -->
|
||||
<div class="col-auto d-flex align-items-start pt-2">
|
||||
<span class="badge {{ $isCorrect ? 'bg-success' : 'bg-danger' }} px-3 py-2">
|
||||
{{ $isCorrect ? 'Benar ✅' : 'Salah ❌' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@
|
|||
<link rel="icon" href="./images/logo.png" type="image/png">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body style="padding-bottom: 45px;">
|
||||
<!-- NAVBAR -->
|
||||
<nav class="navbar navbar-expand-lg" style="background-color: #FEFEFE;">
|
||||
<div class="container-fluid">
|
||||
|
|
@ -372,7 +372,6 @@
|
|||
<div id="multipleChoiceOptions" class="mb-3">
|
||||
<label class="form-label">Opsi Jawaban</label>
|
||||
<div id="answerOptions"></div>
|
||||
<button type="button" class="btn btn-success btn-sm mt-2" id="addOption">+ Tambah Opsi</button>
|
||||
</div>
|
||||
|
||||
<!-- Skor untuk pertanyaan Isian -->
|
||||
|
|
@ -389,44 +388,13 @@
|
|||
placeholder="Masukkan jawaban referensi"></textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary" id="saveButton" disabled>Simpan</button>
|
||||
<div class="d-flex justify-content-between align-items-center gap-2 mt-3">
|
||||
<button type="button" class="btn btn-success btn-sm" id="addOption">+ Tambah Opsi</button>
|
||||
<button type="submit" class="btn btn-primary" id="saveButton" disabled>Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="settings" class="content" style="display: none;">
|
||||
<h1>Settings</h1>
|
||||
<p>Possible account settings
|
||||
needed<br>during the learning process</p>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="custom-card">
|
||||
<img src="./images/profile.png" alt="Image 1" class="circle-image">
|
||||
<h2 class="custom-title">My Profile</h2>
|
||||
<p class="custom-subtitle">Ubah data diri kamu</p>
|
||||
{{-- <button type="button" class="btn btn-primary custom-button">
|
||||
<p class="button-text">Edit Now</p>
|
||||
</button> --}}
|
||||
<div class="custom-button">
|
||||
<p class="button-text">Edit Now</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="custom-card">
|
||||
<img src="./images/my-password.png" alt="Image 2" class="circle-image">
|
||||
<h2 class="custom-title">My Password</h2>
|
||||
<p class="custom-subtitle">Ganti kata sandimu</p>
|
||||
<div class="custom-button">
|
||||
<p class="button-text">Change Now</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -542,7 +510,8 @@ function addNewOption() {
|
|||
div.innerHTML = `
|
||||
<input type="text" name="options[${optionsCount}][text]" class="form-control me-2 option-text" style="width: 40%;" placeholder="Opsi ${optionsCount + 1}" required>
|
||||
<input type="number" name="options[${optionsCount}][score]" class="form-control me-2 option-score" style="width: 20%;" placeholder="Skor" min="0" max="100" required>
|
||||
<input type="checkbox" name="options[${optionsCount}][is_correct]" value="1" class="ms-2 correct-answer"> Jawaban Benar
|
||||
<input type="checkbox" name="options[${optionsCount}][is_correct]" value="1" class="ms-2 correct-answer">
|
||||
<span class="ms-1">Jawaban Benar</span>
|
||||
<button type="button" class="btn btn-danger btn-sm ms-2 remove-option">X</button>
|
||||
`;
|
||||
answerOptions.appendChild(div);
|
||||
|
|
|
|||
|
|
@ -336,9 +336,6 @@
|
|||
<div class="content">
|
||||
<p style="font-size: 24px; font-weight: 500; color: #34364A;">Manage Materials</p>
|
||||
<div class="container mt-4">
|
||||
<h3>Manage Material</h3>
|
||||
<p>This is the content for the Manage Material of Literacy.</p>
|
||||
|
||||
<button class="btn btn-dark mb-3" data-toggle="modal" data-target="#modalTambahMateri">
|
||||
+ Tambah Materi
|
||||
</button>
|
||||
|
|
@ -612,20 +609,20 @@ function showContent(contentId) {
|
|||
"paging": true,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
dom: 'Bfrtip', // Needs to include 'B' for buttons
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: 'Export to Excel',
|
||||
title: 'Data Export REACT',
|
||||
filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
||||
customize: function (xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
// Customizations go here
|
||||
}
|
||||
},
|
||||
'pdf',
|
||||
]
|
||||
// dom: 'Bfrtip', // Needs to include 'B' for buttons
|
||||
// buttons: [
|
||||
// {
|
||||
// extend: 'excelHtml5',
|
||||
// text: 'Export to Excel',
|
||||
// title: 'Data Export REACT',
|
||||
// filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
||||
// customize: function (xlsx) {
|
||||
// var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
// // Customizations go here
|
||||
// }
|
||||
// },
|
||||
// 'pdf',
|
||||
// ]
|
||||
});
|
||||
$('#studentSubmissionTable').DataTable({
|
||||
// Configuration options
|
||||
|
|
|
|||
|
|
@ -336,9 +336,6 @@
|
|||
<div class="content">
|
||||
<p style="font-size: 24px; font-weight: 500; color: #34364A;">Manage Users</p>
|
||||
<div class="container mt-4">
|
||||
<h3>Manage Users</h3>
|
||||
<p>This is the content for the Manage Users of Literacy.</p>
|
||||
|
||||
<button class="btn btn-dark mb-3" data-toggle="modal" data-target="#modalTambahUser">
|
||||
+ Tambah User
|
||||
</button>
|
||||
|
|
@ -615,20 +612,20 @@ function showContent(contentId) {
|
|||
"paging": true,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
dom: 'Bfrtip', // Needs to include 'B' for buttons
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: 'Export to Excel',
|
||||
title: 'Data Export REACT',
|
||||
filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
||||
customize: function (xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
// Customizations go here
|
||||
}
|
||||
},
|
||||
'pdf',
|
||||
]
|
||||
// dom: 'Bfrtip', // Needs to include 'B' for buttons
|
||||
// buttons: [
|
||||
// {
|
||||
// extend: 'excelHtml5',
|
||||
// //text: 'Export to Excel',
|
||||
// title: 'Data Export REACT',
|
||||
// filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
||||
// customize: function (xlsx) {
|
||||
// var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
// // Customizations go here
|
||||
// }
|
||||
// },
|
||||
// 'pdf',
|
||||
// ]
|
||||
});
|
||||
$('#studentSubmissionTable').DataTable({
|
||||
// Configuration options
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user