From ad9a8a04bdb6d07c4ec2e30d3068ead23b191f71 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 26 Apr 2022 12:55:01 +0200 Subject: [PATCH] Revert "drop commits 04063db 022d40e c8aefc6" This reverts commit 9dbebed9d5da32c3558269b8ea35a7f604f7422e. --- ereuse_devicehub/labels/forms.py | 4 ++-- ereuse_devicehub/static/js/main_inventory.js | 8 ++++++-- ereuse_devicehub/templates/inventory/device_list.html | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ereuse_devicehub/labels/forms.py b/ereuse_devicehub/labels/forms.py index cd4b5bec..0c118c4c 100644 --- a/ereuse_devicehub/labels/forms.py +++ b/ereuse_devicehub/labels/forms.py @@ -1,6 +1,6 @@ from flask import g from flask_wtf import FlaskForm -from wtforms import IntegerField, StringField, validators +from wtforms import HiddenField, IntegerField, StringField, validators from ereuse_devicehub.db import db from ereuse_devicehub.resources.device.models import Device @@ -48,7 +48,7 @@ class TagUnnamedForm(FlaskForm): class PrintLabelsForm(FlaskForm): - devices = StringField(render_kw={'class': "devicesList d-none"}) + devices = HiddenField(render_kw={'class': "devicesList"}) def validate(self, extra_validators=None): is_valid = super().validate(extra_validators) diff --git a/ereuse_devicehub/static/js/main_inventory.js b/ereuse_devicehub/static/js/main_inventory.js index bf2fdf43..03073192 100644 --- a/ereuse_devicehub/static/js/main_inventory.js +++ b/ereuse_devicehub/static/js/main_inventory.js @@ -1,4 +1,5 @@ $(document).ready(function() { + $(".deviceSelect").on("change", deviceSelect); var show_allocate_form = $("#allocateModal").data('show-action-form'); var show_datawipe_form = $("#datawipeModal").data('show-action-form'); var show_trade_form = $("#tradeLotModal").data('show-action-form'); @@ -11,8 +12,6 @@ $(document).ready(function() { } else if (show_trade_form != "None") { $("#tradeLotModal .btn-primary").show(); newTrade(show_trade_form); - } else { - $(".deviceSelect").on("change", deviceSelect); } // $('#selectLot').selectpicker(); }) @@ -181,6 +180,11 @@ function export_file(type_file) { } } +function print_labels() { + deviceSelect(); + $('#print_labels').submit(); +} + /** * Reactive lots button diff --git a/ereuse_devicehub/templates/inventory/device_list.html b/ereuse_devicehub/templates/inventory/device_list.html index 10305ac4..312ebede 100644 --- a/ereuse_devicehub/templates/inventory/device_list.html +++ b/ereuse_devicehub/templates/inventory/device_list.html @@ -237,7 +237,7 @@ {% for f in form_print_labels %} {{ f }} {% endfor %} - + Print labels