Merge pull request #40 from arieeefajar/fix/assessment-history

fix(assessment-history): fix func detail
This commit is contained in:
Arie Fajar Bachtiar 2025-05-03 02:46:16 +07:00 committed by GitHub
commit ed1b9ec4dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 39 deletions

View File

@ -1,30 +1,32 @@
function detailData(data) { function detailData(data) {
let tbody = document.querySelector("#detailTable tbody"); const detailBody = document.querySelector("#detail-body");
detailBody.innerHTML = "";
tbody.innerHTML = ""; data.forEach((item) => {
const parameterTypes = item.indicator.rules
if (Array.isArray(data)) { .map((rule) => rule.parameter_type)
data.forEach((item) => { .join(", ");
const parameterTypes = item.indicator.rules
.map((rule) => rule.parameter_type)
.join(", ");
let row = `
<tr>
<td>${item.indicator.name}</td>
<td>${parameterTypes}</td>
</tr>
`;
tbody.innerHTML += row;
});
} else {
let row = ` let row = `
<tr> <div class="mb-3">
<td>${data.indicator.name}</td> <label for="indicator-${
<td>${parameterTypes}</td> item.indicator.id
</tr> }" class="form-label">${item.indicator.name}</label>
<select name="indicator" class="form-control" id="indicator-${
item.indicator.id
}" disabled>
<option value="" disabled selected>Pilih Jawaban</option>
${item.indicator.rules
.map((rule) => {
return `<option value="${rule.cf}" ${
item.cf_e == rule.cf ? "selected" : ""
}>${rule.parameter_type}</option>`;
})
.join("")}
</select>
</div>
`; `;
tbody.innerHTML += row; detailBody.innerHTML += row;
} });
} }
var perPage = 10, var perPage = 10,

View File

@ -194,26 +194,12 @@ class="fw-medium link-primary">#VZ2101</a>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"
id="close-modal"></button> id="close-modal"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body" id="detail-body">
<table class="table align-middle table-nowrap" id="detailTable">
<thead>
<tr>
<th>Indikator</th>
<th>Nilai</th>
</tr>
</thead>
<tbody>
<tr>
<td>pH</td>
<td>0.8</td>
</tr>
</tbody>
</table>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<div class="hstack gap-2 justify-content-end"> <div class="hstack gap-2 justify-content-end">
<button type="button" class="btn btn-light" data-bs-dismiss="modal"> <button type="button" class="btn btn-light" data-bs-dismiss="modal">
Close Tutup
</button> </button>
</div> </div>
</div> </div>