From c10a5f24b42ff3f0c7ea283fadb5af0b48a58204 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 3 Feb 2022 14:05:15 +0100 Subject: [PATCH] add count to allocate action --- ereuse_devicehub/static/js/main_inventory.js | 6 +++--- ereuse_devicehub/templates/inventory/actions.html | 3 +-- ereuse_devicehub/templates/inventory/allocate.html | 9 ++++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ereuse_devicehub/static/js/main_inventory.js b/ereuse_devicehub/static/js/main_inventory.js index 2478a420..48834647 100644 --- a/ereuse_devicehub/static/js/main_inventory.js +++ b/ereuse_devicehub/static/js/main_inventory.js @@ -61,7 +61,7 @@ function removeTag() { function newAction(action) { $("#actionModal #type").val(action); $("#actionModal #title-action").html(action); - devices_count = $(".deviceSelect").filter(':checked').length; + var devices_count = $(".deviceSelect").filter(':checked').length; $("#actionModal .devices-count").html(devices_count); $("#activeActionModal").click(); } @@ -69,7 +69,7 @@ function newAction(action) { function newAllocate(action) { $("#allocateModal #type").val(action); $("#allocateModal #title-action").html(action); - devices_count = $(".deviceSelect").filter(':checked').length; - $("#actionModal .devices-count").html(devices_count); + var devices_count = $(".deviceSelect").filter(':checked').length; + $("#allocateModal .devices-count").html(devices_count); $("#activeAllocateModal").click(); } diff --git a/ereuse_devicehub/templates/inventory/actions.html b/ereuse_devicehub/templates/inventory/actions.html index c74afa41..e66d46cc 100644 --- a/ereuse_devicehub/templates/inventory/actions.html +++ b/ereuse_devicehub/templates/inventory/actions.html @@ -15,13 +15,12 @@ {% if field == form_new_action.devices %}
{{ field.label(class_="form-label") }}: - {{ field(class_="form-control") }} + {{ field(class_="devicesList") }}

You need select first some device before to do one action

- {{ field(class_="devicesList") }} {% elif field == form_new_action.type %} {{ field(class_="form-control") }} {% else %} diff --git a/ereuse_devicehub/templates/inventory/allocate.html b/ereuse_devicehub/templates/inventory/allocate.html index 69cce7e0..a51c3d6a 100644 --- a/ereuse_devicehub/templates/inventory/allocate.html +++ b/ereuse_devicehub/templates/inventory/allocate.html @@ -22,7 +22,14 @@ {% for field in form_new_allocate %} {% if field != form_new_allocate.csrf_token %} {% if field == form_new_allocate.devices %} - {{ field(class_="devicesList") }} +
+ {{ field.label(class_="form-label") }}: + {{ field(class_="devicesList") }} +

+ You need select first some device before to do one action +

+

+
{% elif field == form_new_allocate.type %} {{ field(class_="form-control") }} {% else %}