From 54e496355b86218977daa20d3ae5035dd19bda0a Mon Sep 17 00:00:00 2001 From: percyfikri Date: Wed, 23 Oct 2024 15:31:13 +0700 Subject: [PATCH] Update : fixed position on the left and right sides, can only scroll for the middle --- .../assessment/index.lazy.tsx | 267 +++++++++--------- 1 file changed, 138 insertions(+), 129 deletions(-) diff --git a/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx b/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx index 66ec9d0..5dd6794 100644 --- a/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx +++ b/apps/frontend/src/routes/_assessmentLayout/assessment/index.lazy.tsx @@ -23,7 +23,7 @@ import { getQuestionsAllQueryOptions, toggleFlagAnswer, } from "@/modules/assessmentManagement/queries/assessmentQueries"; -import { TbFlagFilled, TbUpload, TbChevronRight, TbChevronUp } from "react-icons/tb"; +import { TbFlagFilled, TbUpload, TbChevronRight, TbChevronDown } from "react-icons/tb"; import FinishAssessmentModal from "@/modules/assessmentManagement/modals/ConfirmModal"; import ValidationModal from "@/modules/assessmentManagement/modals/ValidationModal"; import { useState, useRef, useEffect } from "react"; @@ -505,58 +505,63 @@ export default function AssessmentPage() { {/* LEFT-SIDE */} {/* Aspek dan Sub-Aspek */} - -
- {/* Aspek */} - {aspectsQuery.data?.data - .filter((aspect) => - aspect.subAspects.some((subAspect) => - data?.data.some((question) => question.subAspectId === subAspect.id) +
+ +
+ {/* Aspek */} + {aspectsQuery.data?.data + .filter((aspect) => + aspect.subAspects.some((subAspect) => + data?.data.some((question) => question.subAspectId === subAspect.id) + ) ) - ) - .map((aspect) => ( -
+ .map((aspect) => (
toggleAspect(aspect.id)} + key={aspect.id} + className="p-2 " > -
{aspect.name}
-
- {openAspects[aspect.id] ? ( - - ) : ( - - )} +
toggleAspect(aspect.id)} + > +
{aspect.name}
+
+ {openAspects[aspect.id] ? ( + + ) : ( + + )} +
-
- {/* Sub-Aspek */} - {openAspects[aspect.id] && ( -
- {aspect.subAspects - .filter((subAspect) => - data?.data.some((question) => question.subAspectId === subAspect.id) - ) - .map((subAspect) => ( -
setSelectedSubAspectId(subAspect.id)} - > -
{subAspect.name}
-
- ))} -
- )} -
- ))} -
- + {/* Sub-Aspek */} + {openAspects[aspect.id] && ( +
+ {aspect.subAspects + .filter((subAspect) => + data?.data.some((question) => question.subAspectId === subAspect.id) + ) + .map((subAspect) => ( +
setSelectedSubAspectId(subAspect.id)} + > +
{subAspect.name}
+
+ ))} +
+ )} +
+ ))} +
+ +
+ {/* MIDDLE */} {/* Pertanyaan */} + {/*
*/} +
Harap menjawab semua pertanyaan yang tersedia @@ -580,9 +585,9 @@ export default function AssessmentPage() { {/* Question */} - {startIndex + index + 1}. + {startIndex + index + 1}.
- + {question.questionText}
@@ -703,7 +708,7 @@ export default function AssessmentPage() { )}
-
+
{uploadedFiles[question.questionId] && ( File yang diunggah: @@ -728,93 +733,96 @@ export default function AssessmentPage() { }) )} +
+ {/* RIGHT-SIDE */} {/* Navigasi dan Pagination */} - +
+ - {/* Navigasi (Number of Questions) */} -
- {filteredQuestions.map((question, index) => { - const questionId = question.questionId; - if (!questionId) return null; + {/* Navigasi (Number of Questions) */} +
+ {filteredQuestions.map((question, index) => { + const questionId = question.questionId; + if (!questionId) return null; - // Menentukan nomor soal berdasarkan indeks pertanyaan yang difilter - const questionNumber = index + 1; // Nomor pertanyaan dimulai dari 1 + // Menentukan nomor soal berdasarkan indeks pertanyaan yang difilter + const questionNumber = index + 1; // Nomor pertanyaan dimulai dari 1 - return ( -
- + + {flaggedQuestions[questionId] && ( +
+ )} +
+ ); + })} +
+ +
+ +
+ + {/* Skor Aspek dan Sub-Aspek */} +
+ + + {/* Skor Aspek */} +
+ {filteredAspects.length > 0 ? ( + filteredAspects.map((aspect) => ( +
+ {aspect.aspectName} + + {parseFloat(aspect.averageScore).toFixed(2)} + +
+ )) + ) : ( + Data aspek kosong + )} +
+ + {/* Garis pembatas */} +
+
+
+ + {/* Skor Sub-Aspek */} +
+ {filteredSubAspects.length > 0 ? ( + filteredSubAspects.map((subAspect) => ( +
{/* Change key to 'id' */} + {subAspect.subAspectName} {/* Change to 'name' */} + + {parseFloat(subAspect.averageScore).toFixed(2)} + +
+ )) + ) : ( + Data sub-aspek kosong + )} +
+
+ + {/* Tombol Selesai */} +
+ - - {flaggedQuestions[questionId] && ( -
- )}
- ); - })} -
- -
- -
- - {/* Skor Aspek dan Sub-Aspek */} -
- - - {/* Skor Aspek */} -
- {filteredAspects.length > 0 ? ( - filteredAspects.map((aspect) => ( -
- {aspect.aspectName} - - {parseFloat(aspect.averageScore).toFixed(2)} - -
- )) - ) : ( - Data aspek kosong - )} -
- - {/* Garis pembatas */} -
-
-
- - {/* Skor Sub-Aspek */} -
- {filteredSubAspects.length > 0 ? ( - filteredSubAspects.map((subAspect) => ( -
{/* Change key to 'id' */} - {subAspect.subAspectName} {/* Change to 'name' */} - - {parseFloat(subAspect.averageScore).toFixed(2)} - -
- )) - ) : ( - Data sub-aspek kosong - )} -
-
- - {/* Tombol Selesai */} -
- -
{/* Modal untuk konfirmasi selesai asesmen */}
+