check the checkbox in a devices list when one form is invalid 2
This commit is contained in:
parent
a55944e379
commit
c340122d87
|
@ -45,6 +45,11 @@ class DeviceListMix(View):
|
||||||
form_new_action = NewActionForm()
|
form_new_action = NewActionForm()
|
||||||
form_new_allocate = AllocateForm()
|
form_new_allocate = AllocateForm()
|
||||||
|
|
||||||
|
action_devices = form_new_action.devices.data
|
||||||
|
list_devices = []
|
||||||
|
if action_devices:
|
||||||
|
list_devices.extend([int(x) for x in action_devices.split(",")])
|
||||||
|
|
||||||
self.context = {
|
self.context = {
|
||||||
'devices': devices,
|
'devices': devices,
|
||||||
'lots': lots,
|
'lots': lots,
|
||||||
|
@ -53,7 +58,8 @@ class DeviceListMix(View):
|
||||||
'form_new_action': form_new_action,
|
'form_new_action': form_new_action,
|
||||||
'form_new_allocate': form_new_allocate,
|
'form_new_allocate': form_new_allocate,
|
||||||
'lot': lot,
|
'lot': lot,
|
||||||
'tags': tags
|
'tags': tags,
|
||||||
|
'list_devices': list_devices
|
||||||
}
|
}
|
||||||
|
|
||||||
return self.context
|
return self.context
|
||||||
|
|
|
@ -12,34 +12,34 @@ $(document).ready(function() {
|
||||||
function deviceSelect() {
|
function deviceSelect() {
|
||||||
var devices_count = $(".deviceSelect").filter(':checked').length;
|
var devices_count = $(".deviceSelect").filter(':checked').length;
|
||||||
if (devices_count == 0) {
|
if (devices_count == 0) {
|
||||||
$("#addingLotModal .text-danger").show();
|
$("#addingLotModal .pol").show();
|
||||||
$("#addingLotModal .btn-primary").hide();
|
$("#addingLotModal .btn-primary").hide();
|
||||||
|
|
||||||
$("#removeLotModal .text-danger").show();
|
$("#removeLotModal .pol").show();
|
||||||
$("#removeLotModal .btn-primary").hide();
|
$("#removeLotModal .btn-primary").hide();
|
||||||
|
|
||||||
$("#addingTagModal .text-danger").show();
|
$("#addingTagModal .pol").show();
|
||||||
$("#addingTagModal .btn-primary").hide();
|
$("#addingTagModal .btn-primary").hide();
|
||||||
|
|
||||||
$("#actionModal .text-danger").show();
|
$("#actionModal .pol").show();
|
||||||
$("#actionModal .btn-primary").hide();
|
$("#actionModal .btn-primary").hide();
|
||||||
|
|
||||||
$("#allocateModal .text-danger").show();
|
$("#allocateModal .pol").show();
|
||||||
$("#allocateModal .btn-primary").hide();
|
$("#allocateModal .btn-primary").hide();
|
||||||
} else {
|
} else {
|
||||||
$("#addingLotModal .text-danger").hide();
|
$("#addingLotModal .pol").hide();
|
||||||
$("#addingLotModal .btn-primary").show();
|
$("#addingLotModal .btn-primary").show();
|
||||||
|
|
||||||
$("#removeLotModal .text-danger").hide();
|
$("#removeLotModal .pol").hide();
|
||||||
$("#removeLotModal .btn-primary").show();
|
$("#removeLotModal .btn-primary").show();
|
||||||
|
|
||||||
$("#actionModal .text-danger").hide();
|
$("#actionModal .pol").hide();
|
||||||
$("#actionModal .btn-primary").show();
|
$("#actionModal .btn-primary").show();
|
||||||
|
|
||||||
$("#allocateModal .text-danger").hide();
|
$("#allocateModal .pol").hide();
|
||||||
$("#allocateModal .btn-primary").show();
|
$("#allocateModal .btn-primary").show();
|
||||||
|
|
||||||
$("#addingTagModal .text-danger").hide();
|
$("#addingTagModal .pol").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ function newAction(action) {
|
||||||
$("#actionModal #type").val(action);
|
$("#actionModal #type").val(action);
|
||||||
$("#actionModal #title-action").html(action);
|
$("#actionModal #title-action").html(action);
|
||||||
get_device_list();
|
get_device_list();
|
||||||
|
deviceSelect();
|
||||||
$("#activeActionModal").click();
|
$("#activeActionModal").click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +65,7 @@ function newAllocate(action) {
|
||||||
$("#allocateModal #type").val(action);
|
$("#allocateModal #type").val(action);
|
||||||
$("#allocateModal #title-action").html(action);
|
$("#allocateModal #title-action").html(action);
|
||||||
get_device_list();
|
get_device_list();
|
||||||
|
deviceSelect();
|
||||||
$("#activeAllocateModal").click();
|
$("#activeAllocateModal").click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue