fix render item in confirmation dialog

This commit is contained in:
RubenPX 2022-04-28 18:43:38 +02:00
parent 9cef5188db
commit 8d43128e68
1 changed files with 5 additions and 5 deletions

View File

@ -353,6 +353,7 @@ async function processSelectedDevices() {
if (eventClickActions) { if (eventClickActions) {
document.getElementById("ApplyDeviceLots").removeEventListener(eventClickActions); document.getElementById("ApplyDeviceLots").removeEventListener(eventClickActions);
} }
eventClickActions = document.getElementById("ApplyDeviceLots").addEventListener("click", () => { eventClickActions = document.getElementById("ApplyDeviceLots").addEventListener("click", () => {
const modal = $("#confirmLotsModal") const modal = $("#confirmLotsModal")
modal.modal({ keyboard: false }) modal.modal({ keyboard: false })
@ -364,10 +365,10 @@ async function processSelectedDevices() {
let devices; let devices;
if (action.type == "Add") { if (action.type == "Add") {
type = "success"; type = "success";
devices = action.devices.filter(dev => !action.lot.devices.includes(dev)) // Only show affected devices devices = action.devices.filter(dev => !action.lot.devices.includes(dev.id)) // Only show affected devices
} else { } else {
type = "danger"; type = "danger";
devices = action.devices.filter(dev => action.lot.devices.includes(dev)) // Only show affected devices devices = action.devices.filter(dev => action.lot.devices.includes(dev.id)) // Only show affected devices
} }
list_changes_html += ` list_changes_html += `
<div class="card border-primary mb-3 w-100"> <div class="card border-primary mb-3 w-100">
@ -375,9 +376,8 @@ async function processSelectedDevices() {
<div class="card-body pt-3"> <div class="card-body pt-3">
<p class="card-text"> <p class="card-text">
${devices.map(item => { ${devices.map(item => {
const dhid = $(".deviceSelect").filter(`[data=${item}]`)[0].attributes["data-device-dhid"].value; const name = `${item.type} ${item.manufacturer} ${item.model}`
const name = $(".deviceSelect").filter(`[data=${item}]`)[0].attributes["data-device-vname"].value; return `<span class="badge bg-${type}" title="${name}">${item.devicehubID}</span>`;
return `<span class="badge bg-${type}" title="${name}">${dhid}</span>`
}).join(" ")} }).join(" ")}
</p> </p>
</div> </div>