diff --git a/app.py b/app.py index 581ba32..ea24953 100644 --- a/app.py +++ b/app.py @@ -58,7 +58,7 @@ def save_number(tmp): elif number == '0': for idx,i in enumerate(json_file['unit'][int(index)]['bricks']['missing']): if i['brick']['ID'] == part_num and i['brick']['is_spare'] == is_spare and i['brick']['color_name'] == color: - json_file['unit'][int(index)]['bricks']['missing'].pop(0) + json_file['unit'][int(index)]['bricks']['missing'].pop(idx) else: found = False diff --git a/templates/bootstrap_table.html b/templates/bootstrap_table.html index 4bce6d6..b190785 100644 --- a/templates/bootstrap_table.html +++ b/templates/bootstrap_table.html @@ -67,17 +67,17 @@

Spares

- +
+
- - - - - - + + + + + {% for i in json_file['unit'] %} - + {% endfor %} @@ -85,41 +85,55 @@ {% for brick in inventory_file.results %} {% if brick.is_spare == True %} - {% if brick.element_id == None %} - - {% else %} - - {% endif %} - - - + {% if brick.element_id == None %} + + {% else %} + + {% endif %} + + - - {% for i in json_file['unit'] %} + + {% for i in json_file['unit'] %} - - {% endfor %} - - {% endif %} + + {% for j in json_file['unit'][loop.index0]['bricks']['missing'] %} + {% if j['brick']['ID'] == brick.part.part_num and j['brick']['color_name'] == brick.color.name %} + {% if j['brick']['is_spare']|lower == brick.is_spare|lower %} + + {% set ns.count = j['brick']['amount'] %} + {% endif %} + {% endif %} + {% endfor %} +
+ + +
+ + + + {% endfor %} + + {% endif %} {% endfor %}
imgelement_idpart_numnamecolorqtyIDNameColorQtyMissing ({{ loop.index }})Missing ({{ loop.index }})
{{ brick.element_id }}{{ brick.part.part_num }}{{ brick.part.name }}{{ brick.part.part_num }}{{ brick.part.name }} {{ brick.color.name }}{{ brick.quantity }}{{ brick.quantity }} - {% set ns = namespace(count='') %} -
- - +
+
+ {% set ns = namespace(count='') %} + + + - - {% for j in json_file['unit'][loop.index0]['bricks']['missing'] %} - {% if j['brick']['ID'] == brick.part.part_num and j['brick']['color_name'] == brick.color.name and j['brick']['is_spare']|lower == brick.is_spare|lower %} - {% set ns.count = j['brick']['amount'] %} - {% endif %} - {% endfor %} - - -
+ + + + +