diff --git a/ereuse_devicehub/static/js/main_inventory.build.js b/ereuse_devicehub/static/js/main_inventory.build.js
index 16bb720a..c6bbbfe9 100644
--- a/ereuse_devicehub/static/js/main_inventory.build.js
+++ b/ereuse_devicehub/static/js/main_inventory.build.js
@@ -681,17 +681,32 @@ async function processSelectedDevices() {
return lot;
});
- let lotsList = [];
- lotsList.push(lots.filter(lot => lot.state == "true").sort((a, b) => a.name.localeCompare(b.name)));
- lotsList.push(lots.filter(lot => lot.state == "indetermined").sort((a, b) => a.name.localeCompare(b.name)));
- lotsList.push(lots.filter(lot => lot.state == "false").sort((a, b) => a.name.localeCompare(b.name)));
- lotsList = lotsList.flat(); // flat array
listHTML.html("");
- lotsList.forEach(lot => templateLot(lot, selectedDevices, listHTML, actions));
+ let lot_temporary = lots.filter(lot => !lot.transfer);
+ appendMenu(lot_temporary, listHTML, templateLot, selectedDevices, actions, 'Temporary');
+
+ let lot_incoming = lots.filter(lot => lot.transfer && lot.transfer == 'Incoming');
+ appendMenu(lot_incoming, listHTML, templateLot, selectedDevices, actions, 'Incoming');
+
+ let lot_outgoing = lots.filter(lot => lot.transfer && lot.transfer == 'Outgoing');
+ appendMenu(lot_outgoing, listHTML, templateLot, selectedDevices, actions, 'Outgoing');
+
lotsSearcher.enable();
+
} catch (error) {
console.log(error);
listHTML.html("
Error feching devices and lots
(see console for more details)");
}
}
+
+function appendMenu(lots, listHTML, templateLot, selectedDevices, actions, title) {
+ let lotsList = [];
+ lotsList.push(lots.filter(lot => lot.state == "true").sort((a, b) => a.name.localeCompare(b.name)));
+ lotsList.push(lots.filter(lot => lot.state == "indetermined").sort((a, b) => a.name.localeCompare(b.name)));
+ lotsList.push(lots.filter(lot => lot.state == "false").sort((a, b) => a.name.localeCompare(b.name)));
+ lotsList = lotsList.flat(); // flat array
+
+ listHTML.append("" + title + "
");
+ lotsList.forEach(lot => templateLot(lot, selectedDevices, listHTML, actions));
+}
diff --git a/ereuse_devicehub/static/js/main_inventory.js b/ereuse_devicehub/static/js/main_inventory.js
index fd693d44..46b2f61f 100644
--- a/ereuse_devicehub/static/js/main_inventory.js
+++ b/ereuse_devicehub/static/js/main_inventory.js
@@ -646,17 +646,30 @@ async function processSelectedDevices() {
return lot;
})
- let lotsList = [];
- lotsList.push(lots.filter(lot => lot.state == "true").sort((a, b) => a.name.localeCompare(b.name)));
- lotsList.push(lots.filter(lot => lot.state == "indetermined").sort((a, b) => a.name.localeCompare(b.name)));
- lotsList.push(lots.filter(lot => lot.state == "false").sort((a, b) => a.name.localeCompare(b.name)));
- lotsList = lotsList.flat(); // flat array
-
listHTML.html("");
- lotsList.forEach(lot => templateLot(lot, selectedDevices, listHTML, actions));
+ let lot_temporary = lots.filter(lot => !lot.transfer);
+ appendMenu(lot_temporary, listHTML, templateLot, selectedDevices, actions, 'Temporary');
+
+ let lot_incoming = lots.filter(lot => lot.transfer && lot.transfer == 'Incoming');
+ appendMenu(lot_incoming, listHTML, templateLot, selectedDevices, actions, 'Incoming');
+
+ let lot_outgoing = lots.filter(lot => lot.transfer && lot.transfer == 'Outgoing');
+ appendMenu(lot_outgoing, listHTML, templateLot, selectedDevices, actions, 'Outgoing');
+
lotsSearcher.enable();
} catch (error) {
console.log(error);
listHTML.html("Error feching devices and lots
(see console for more details)");
}
}
+
+function appendMenu(lots, listHTML, templateLot, selectedDevices, actions, title) {
+ let lotsList = [];
+ lotsList.push(lots.filter(lot => lot.state == "true").sort((a, b) => a.name.localeCompare(b.name)));
+ lotsList.push(lots.filter(lot => lot.state == "indetermined").sort((a, b) => a.name.localeCompare(b.name)));
+ lotsList.push(lots.filter(lot => lot.state == "false").sort((a, b) => a.name.localeCompare(b.name)));
+ lotsList = lotsList.flat(); // flat array
+
+ listHTML.append("" + title + "
");
+ lotsList.forEach(lot => templateLot(lot, selectedDevices, listHTML, actions));
+}