fix readonly and deviceslist

This commit is contained in:
Cayo Puigdefabregas 2022-02-17 13:51:27 +01:00
parent 5e46141622
commit 403717ccf2

View file

@ -15,6 +15,7 @@ $(document).ready(function() {
function deviceSelect() { function deviceSelect() {
var devices_count = $(".deviceSelect").filter(':checked').length; var devices_count = $(".deviceSelect").filter(':checked').length;
get_device_list();
if (devices_count == 0) { if (devices_count == 0) {
$("#addingLotModal .pol").show(); $("#addingLotModal .pol").show();
$("#addingLotModal .btn-primary").hide(); $("#addingLotModal .btn-primary").hide();
@ -69,14 +70,14 @@ function newTrade(action) {
var supplier = $("#supplier").data("email"); var supplier = $("#supplier").data("email");
if (action == 'supplier') { if (action == 'supplier') {
title = 'Trade Incoming'; title = 'Trade Incoming';
$("#receiver").attr('disabled', 'disabled'); $("#receiver").attr('readonly', 'readonly');
$("#supplier").prop('disabled', false); $("#supplier").prop('readonly', false);
$("#supplier").val(''); $("#supplier").val('');
$("#receiver").val(receiver); $("#receiver").val(receiver);
} else if (action == 'receiver') { } else if (action == 'receiver') {
title = 'Trade Outgoing'; title = 'Trade Outgoing';
$("#supplier").attr('disabled', 'disabled'); $("#supplier").attr('readonly', 'readonly');
$("#receiver").prop('disabled', false); $("#receiver").prop('readonly', false);
$("#receiver").val(''); $("#receiver").val('');
$("#supplier").val(supplier); $("#supplier").val(supplier);
} }
@ -87,7 +88,6 @@ function newTrade(action) {
function newAction(action) { function newAction(action) {
$("#actionModal #type").val(action); $("#actionModal #type").val(action);
$("#actionModal #title-action").html(action); $("#actionModal #title-action").html(action);
get_device_list();
deviceSelect(); deviceSelect();
$("#activeActionModal").click(); $("#activeActionModal").click();
} }
@ -95,7 +95,6 @@ function newAction(action) {
function newAllocate(action) { function newAllocate(action) {
$("#allocateModal #type").val(action); $("#allocateModal #type").val(action);
$("#allocateModal #title-action").html(action); $("#allocateModal #title-action").html(action);
get_device_list();
deviceSelect(); deviceSelect();
$("#activeAllocateModal").click(); $("#activeAllocateModal").click();
} }
@ -103,7 +102,6 @@ function newAllocate(action) {
function newDataWipe(action) { function newDataWipe(action) {
$("#datawipeModal #type").val(action); $("#datawipeModal #type").val(action);
$("#datawipeModal #title-action").html(action); $("#datawipeModal #title-action").html(action);
get_device_list();
deviceSelect(); deviceSelect();
$("#activeDatawipeModal").click(); $("#activeDatawipeModal").click();
} }