Merge pull request #40 from arieeefajar/fix/assessment-history
fix(assessment-history): fix func detail
This commit is contained in:
commit
ed1b9ec4dc
|
@ -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 = "";
|
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
const parameterTypes = item.indicator.rules
|
const parameterTypes = item.indicator.rules
|
||||||
.map((rule) => rule.parameter_type)
|
.map((rule) => rule.parameter_type)
|
||||||
.join(", ");
|
.join(", ");
|
||||||
let row = `
|
let row = `
|
||||||
<tr>
|
<div class="mb-3">
|
||||||
<td>${item.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;
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
let row = `
|
|
||||||
<tr>
|
|
||||||
<td>${data.indicator.name}</td>
|
|
||||||
<td>${parameterTypes}</td>
|
|
||||||
</tr>
|
|
||||||
`;
|
|
||||||
tbody.innerHTML += row;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var perPage = 10,
|
var perPage = 10,
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue