update: modification on index and assessment result on role teacher
This commit is contained in:
parent
73e9bd95ec
commit
b4c64c916a
|
|
@ -572,20 +572,20 @@ function showContent(contentId) {
|
||||||
"paging": true,
|
"paging": true,
|
||||||
"ordering": true,
|
"ordering": true,
|
||||||
"info": true,
|
"info": true,
|
||||||
dom: 'Bfrtip', // Needs to include 'B' for buttons
|
// dom: 'Bfrtip', // Needs to include 'B' for buttons
|
||||||
buttons: [
|
// buttons: [
|
||||||
{
|
// {
|
||||||
extend: 'excelHtml5',
|
// extend: 'excelHtml5',
|
||||||
text: 'Export to Excel',
|
// text: 'Export to Excel',
|
||||||
title: 'Data Export REACT',
|
// title: 'Data Export REACT',
|
||||||
filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
// filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
||||||
customize: function (xlsx) {
|
// customize: function (xlsx) {
|
||||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
// var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||||
// Customizations go here
|
// // Customizations go here
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
'pdf',
|
// 'pdf',
|
||||||
]
|
// ]
|
||||||
});
|
});
|
||||||
$('#studentSubmissionTable').DataTable({
|
$('#studentSubmissionTable').DataTable({
|
||||||
// Configuration options
|
// Configuration options
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@
|
||||||
<link rel="icon" href="./images/logo.png" type="image/png">
|
<link rel="icon" href="./images/logo.png" type="image/png">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body style="padding-bottom: 45px">
|
||||||
<!-- NAVBAR -->
|
<!-- NAVBAR -->
|
||||||
<nav class="navbar navbar-expand-lg" style="background-color: #FEFEFE;">
|
<nav class="navbar navbar-expand-lg" style="background-color: #FEFEFE;">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
@ -419,55 +419,106 @@
|
||||||
<!-- List Jawaban -->
|
<!-- List Jawaban -->
|
||||||
<ul class="list-group mt-4">
|
<ul class="list-group mt-4">
|
||||||
@foreach ($questions as $index => $question)
|
@foreach ($questions as $index => $question)
|
||||||
@php
|
@php
|
||||||
$answer = $question->answers->first();
|
$answer = $question->answers->first();
|
||||||
$isCorrect = false;
|
$isCorrect = false;
|
||||||
$similarityScore = null;
|
$similarityScore = null;
|
||||||
|
|
||||||
if ($question->type === 'multiple_choice' && $answer) {
|
$questionText = $question->question_text;
|
||||||
$isCorrect = optional($answer->option)->is_correct;
|
$kutipan = null;
|
||||||
} elseif ($question->type === 'essay' && $answer) {
|
$pertanyaanBersih = $questionText;
|
||||||
$userAnswer = $normalize($answer->answer_text ?? '');
|
|
||||||
$correctAnswers = explode("\n", $question->essay_answer ?? '');
|
if (Str::contains($questionText, 'Bacalah kutipan berikut:') || Str::contains($questionText, 'Bacalah paragraf berikut:')) {
|
||||||
$maxMatch = 0;
|
preg_match('/Bacalah (kutipan|paragraf) berikut:\s*"(.*?)"\s*(.*)/s', $questionText, $matches);
|
||||||
|
if (count($matches) >= 4) {
|
||||||
foreach ($correctAnswers as $correct) {
|
$kutipan = trim($matches[2]);
|
||||||
$correctNormalized = $normalize($correct);
|
$pertanyaanBersih = trim($matches[3]);
|
||||||
similar_text($userAnswer, $correctNormalized, $percent);
|
}
|
||||||
$maxMatch = max($maxMatch, $percent);
|
}
|
||||||
}
|
|
||||||
|
// Deteksi soal urutan (misal dari kata "Manakah urutan kalimat" atau pakai $question->type === 'ordering')
|
||||||
$similarityScore = $maxMatch;
|
$isOrdering = Str::contains($questionText, 'urutan kalimat');
|
||||||
$isCorrect = $maxMatch >= $essayThreshold;
|
|
||||||
}
|
// Penilaian
|
||||||
@endphp
|
if ($question->type === 'multiple_choice' && $answer) {
|
||||||
|
$isCorrect = optional($answer->option)->is_correct;
|
||||||
<li class="list-group-item d-flex flex-column">
|
} elseif ($question->type === 'essay' && $answer) {
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
$userAnswer = $normalize($answer->answer_text ?? '');
|
||||||
<strong>{{ $index + 1 }}. {{ $question->question_text }}</strong>
|
$correctAnswers = explode("\n", $question->essay_answer ?? '');
|
||||||
@if ($isCorrect)
|
$maxMatch = 0;
|
||||||
<span class="badge bg-success px-3 py-2">Benar ✅</span>
|
|
||||||
@else
|
foreach ($correctAnswers as $correct) {
|
||||||
<span class="badge bg-danger px-3 py-2">Salah ❌</span>
|
$correctNormalized = $normalize($correct);
|
||||||
@endif
|
similar_text($userAnswer, $correctNormalized, $percent);
|
||||||
</div>
|
$maxMatch = max($maxMatch, $percent);
|
||||||
|
}
|
||||||
<p class="mt-2">
|
|
||||||
<strong>Jawaban Siswa:</strong>
|
$similarityScore = $maxMatch;
|
||||||
@if ($question->type === 'multiple_choice')
|
$isCorrect = $maxMatch >= $essayThreshold;
|
||||||
{{ optional($answer)->option->option_text ?? 'Tidak Dijawab' }}
|
}
|
||||||
@else
|
|
||||||
{{ optional($answer)->answer_text ?? 'Tidak Dijawab' }}
|
// Pilihan kalimat untuk soal urutan
|
||||||
@endif
|
$choices = $question->choices ? explode("\n", $question->choices) : [];
|
||||||
</p>
|
@endphp
|
||||||
|
|
||||||
@if ($question->type === 'essay' && $similarityScore !== null)
|
<li class="list-group-item">
|
||||||
<p><strong>Skor Kemiripan:</strong> {{ number_format($similarityScore, 2) }}%</p>
|
<div class="row">
|
||||||
<p><strong>Feedback:</strong> {{ $answer->feedback ?? 'Tidak ada feedback' }}</p>
|
<!-- Nomor Soal -->
|
||||||
@endif
|
<div class="col-auto d-flex justify-content-start align-items-start pt-2">
|
||||||
</li>
|
<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
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@
|
||||||
<link rel="icon" href="./images/logo.png" type="image/png">
|
<link rel="icon" href="./images/logo.png" type="image/png">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body style="padding-bottom: 45px;">
|
||||||
<!-- NAVBAR -->
|
<!-- NAVBAR -->
|
||||||
<nav class="navbar navbar-expand-lg" style="background-color: #FEFEFE;">
|
<nav class="navbar navbar-expand-lg" style="background-color: #FEFEFE;">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
@ -372,7 +372,6 @@
|
||||||
<div id="multipleChoiceOptions" class="mb-3">
|
<div id="multipleChoiceOptions" class="mb-3">
|
||||||
<label class="form-label">Opsi Jawaban</label>
|
<label class="form-label">Opsi Jawaban</label>
|
||||||
<div id="answerOptions"></div>
|
<div id="answerOptions"></div>
|
||||||
<button type="button" class="btn btn-success btn-sm mt-2" id="addOption">+ Tambah Opsi</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Skor untuk pertanyaan Isian -->
|
<!-- Skor untuk pertanyaan Isian -->
|
||||||
|
|
@ -389,43 +388,12 @@
|
||||||
placeholder="Masukkan jawaban referensi"></textarea>
|
placeholder="Masukkan jawaban referensi"></textarea>
|
||||||
</div>
|
</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>
|
</form>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -542,7 +510,8 @@ function addNewOption() {
|
||||||
div.innerHTML = `
|
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="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="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>
|
<button type="button" class="btn btn-danger btn-sm ms-2 remove-option">X</button>
|
||||||
`;
|
`;
|
||||||
answerOptions.appendChild(div);
|
answerOptions.appendChild(div);
|
||||||
|
|
|
||||||
|
|
@ -336,9 +336,6 @@
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<p style="font-size: 24px; font-weight: 500; color: #34364A;">Manage Materials</p>
|
<p style="font-size: 24px; font-weight: 500; color: #34364A;">Manage Materials</p>
|
||||||
<div class="container mt-4">
|
<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">
|
<button class="btn btn-dark mb-3" data-toggle="modal" data-target="#modalTambahMateri">
|
||||||
+ Tambah Materi
|
+ Tambah Materi
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -612,20 +609,20 @@ function showContent(contentId) {
|
||||||
"paging": true,
|
"paging": true,
|
||||||
"ordering": true,
|
"ordering": true,
|
||||||
"info": true,
|
"info": true,
|
||||||
dom: 'Bfrtip', // Needs to include 'B' for buttons
|
// dom: 'Bfrtip', // Needs to include 'B' for buttons
|
||||||
buttons: [
|
// buttons: [
|
||||||
{
|
// {
|
||||||
extend: 'excelHtml5',
|
// extend: 'excelHtml5',
|
||||||
text: 'Export to Excel',
|
// text: 'Export to Excel',
|
||||||
title: 'Data Export REACT',
|
// title: 'Data Export REACT',
|
||||||
filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
// filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
||||||
customize: function (xlsx) {
|
// customize: function (xlsx) {
|
||||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
// var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||||
// Customizations go here
|
// // Customizations go here
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
'pdf',
|
// 'pdf',
|
||||||
]
|
// ]
|
||||||
});
|
});
|
||||||
$('#studentSubmissionTable').DataTable({
|
$('#studentSubmissionTable').DataTable({
|
||||||
// Configuration options
|
// Configuration options
|
||||||
|
|
|
||||||
|
|
@ -336,9 +336,6 @@
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<p style="font-size: 24px; font-weight: 500; color: #34364A;">Manage Users</p>
|
<p style="font-size: 24px; font-weight: 500; color: #34364A;">Manage Users</p>
|
||||||
<div class="container mt-4">
|
<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">
|
<button class="btn btn-dark mb-3" data-toggle="modal" data-target="#modalTambahUser">
|
||||||
+ Tambah User
|
+ Tambah User
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -615,20 +612,20 @@ function showContent(contentId) {
|
||||||
"paging": true,
|
"paging": true,
|
||||||
"ordering": true,
|
"ordering": true,
|
||||||
"info": true,
|
"info": true,
|
||||||
dom: 'Bfrtip', // Needs to include 'B' for buttons
|
// dom: 'Bfrtip', // Needs to include 'B' for buttons
|
||||||
buttons: [
|
// buttons: [
|
||||||
{
|
// {
|
||||||
extend: 'excelHtml5',
|
// extend: 'excelHtml5',
|
||||||
text: 'Export to Excel',
|
// //text: 'Export to Excel',
|
||||||
title: 'Data Export REACT',
|
// title: 'Data Export REACT',
|
||||||
filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
// filename: 'react_data_export_topic_finished_student_' + new Date().toLocaleDateString() + '_' + new Date().toLocaleTimeString(),
|
||||||
customize: function (xlsx) {
|
// customize: function (xlsx) {
|
||||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
// var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||||
// Customizations go here
|
// // Customizations go here
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
'pdf',
|
// 'pdf',
|
||||||
]
|
// ]
|
||||||
});
|
});
|
||||||
$('#studentSubmissionTable').DataTable({
|
$('#studentSubmissionTable').DataTable({
|
||||||
// Configuration options
|
// Configuration options
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user