fix
This commit is contained in:
parent
acc5f6ed78
commit
906dceed56
|
@ -1014,7 +1014,6 @@ class ExportsView(View):
|
||||||
return export_ids[export_id]()
|
return export_ids[export_id]()
|
||||||
|
|
||||||
def find_devices(self):
|
def find_devices(self):
|
||||||
# import pdb; pdb.set_trace()
|
|
||||||
sql = """
|
sql = """
|
||||||
select lot_device.device_id as id from {schema}.share_lot as share
|
select lot_device.device_id as id from {schema}.share_lot as share
|
||||||
inner join {schema}.lot_device as lot_device
|
inner join {schema}.lot_device as lot_device
|
||||||
|
|
|
@ -30,6 +30,7 @@ $(document).ready(() => {
|
||||||
|
|
||||||
;
|
;
|
||||||
select_shift(); // $('#selectLot').selectpicker();
|
select_shift(); // $('#selectLot').selectpicker();
|
||||||
|
|
||||||
$("#filter").on("change", () => {
|
$("#filter").on("change", () => {
|
||||||
$("#submit_filter").click();
|
$("#submit_filter").click();
|
||||||
});
|
});
|
||||||
|
@ -214,8 +215,8 @@ function removeLot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function select_shift() {
|
function select_shift() {
|
||||||
const chkboxes = $('.deviceSelect');
|
const chkboxes = $(".deviceSelect");
|
||||||
var lastChecked = null;
|
let lastChecked = null;
|
||||||
chkboxes.click(function (e) {
|
chkboxes.click(function (e) {
|
||||||
if (!lastChecked) {
|
if (!lastChecked) {
|
||||||
lastChecked = this;
|
lastChecked = this;
|
||||||
|
@ -327,17 +328,16 @@ function export_file(type_file) {
|
||||||
|
|
||||||
function export_actions_erasure(type_file) {
|
function export_actions_erasure(type_file) {
|
||||||
const actions = TableController.getSelectedDevices();
|
const actions = TableController.getSelectedDevices();
|
||||||
const actions_id = $.map(actions, (x) => $(x).attr("data-action-erasure")).join(",");
|
const actions_id = $.map(actions, x => $(x).attr("data-action-erasure")).join(",");
|
||||||
|
|
||||||
if (actions_id) {
|
if (actions_id) {
|
||||||
const url = `/inventory/export/${type_file}/?ids=${actions_id}`;
|
const url = "/inventory/export/".concat(type_file, "/?ids=").concat(actions_id);
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
} else {
|
} else {
|
||||||
$("#exportAlertModal").click();
|
$("#exportAlertModal").click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class lotsSearcher {
|
class lotsSearcher {
|
||||||
static enable() {
|
static enable() {
|
||||||
if (this.lotsSearchElement) this.lotsSearchElement.disabled = false;
|
if (this.lotsSearchElement) this.lotsSearchElement.disabled = false;
|
||||||
|
@ -666,19 +666,14 @@ async function processSelectedDevices() {
|
||||||
|
|
||||||
return lot;
|
return lot;
|
||||||
});
|
});
|
||||||
|
|
||||||
listHTML.html("");
|
listHTML.html("");
|
||||||
const lot_temporary = lots.filter(lot => !lot.transfer && !lot.trade);
|
const lot_temporary = lots.filter(lot => !lot.transfer && !lot.trade);
|
||||||
appendMenu(lot_temporary, listHTML, templateLot, selectedDevices, actions, "Temporary");
|
appendMenu(lot_temporary, listHTML, templateLot, selectedDevices, actions, "Temporary");
|
||||||
|
|
||||||
const lot_incoming = lots.filter(lot => lot.transfer && lot.transfer == "Incoming");
|
const lot_incoming = lots.filter(lot => lot.transfer && lot.transfer == "Incoming");
|
||||||
appendMenu(lot_incoming, listHTML, templateLot, selectedDevices, actions, "Incoming");
|
appendMenu(lot_incoming, listHTML, templateLot, selectedDevices, actions, "Incoming");
|
||||||
|
|
||||||
const lot_outgoing = lots.filter(lot => lot.transfer && lot.transfer == "Outgoing");
|
const lot_outgoing = lots.filter(lot => lot.transfer && lot.transfer == "Outgoing");
|
||||||
appendMenu(lot_outgoing, listHTML, templateLot, selectedDevices, actions, "Outgoing");
|
appendMenu(lot_outgoing, listHTML, templateLot, selectedDevices, actions, "Outgoing");
|
||||||
|
|
||||||
lotsSearcher.enable();
|
lotsSearcher.enable();
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
listHTML.html("<li style=\"color: red; text-align: center\">Error feching devices and lots<br>(see console for more details)</li>");
|
listHTML.html("<li style=\"color: red; text-align: center\">Error feching devices and lots<br>(see console for more details)</li>");
|
||||||
|
@ -692,6 +687,6 @@ function appendMenu(lots, listHTML, templateLot, selectedDevices, actions, title
|
||||||
lotsList.push(lots.filter(lot => lot.state == "false").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
|
lotsList = lotsList.flat(); // flat array
|
||||||
|
|
||||||
listHTML.append(`<li style="color: black; text-align: center">${ title }<hr /></li>`);
|
listHTML.append("<li style=\"color: black; text-align: center\">".concat(title, "<hr /></li>"));
|
||||||
lotsList.forEach(lot => templateLot(lot, selectedDevices, listHTML, actions));
|
lotsList.forEach(lot => templateLot(lot, selectedDevices, listHTML, actions));
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue