diff --git a/app.py b/app.py index 07d9548..6f98418 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,6 @@ from flask import Flask, request, jsonify, render_template import json - +from pprint import pprint as pp app = Flask(__name__) tmp = '71386-10' @@ -13,7 +13,7 @@ def index(): inventory_file = json.loads(inventory.read()) with open('./info/'+tmp+'.json') as info: json_file = json.loads(info.read()) - + pp(json_file['unit'][0]['bricks']['missing']) return render_template('bootstrap_table.html', title=info_file['set_num']+" - "+info_file['name'], info_file=info_file,inventory_file=inventory_file,json_file=json_file) diff --git a/templates/base.html b/templates/base.html index a6eea5e..a429efc 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,6 +3,7 @@ {{ title }} +
diff --git a/templates/bootstrap_table.html b/templates/bootstrap_table.html index b052511..3975554 100644 --- a/templates/bootstrap_table.html +++ b/templates/bootstrap_table.html @@ -26,15 +26,22 @@ {{ brick.color.name }} {{ brick.quantity }} {{ brick.is_spare }} - -
- - - - - -
- + {% for i in json_file['unit'] %} + + {% set ns = namespace(count='') %} +
+ + + + {% for j in i['bricks']['missing'] %} + {% if j['brick']['ID'] == brick.part.part_num and j['brick']['color_name'] == brick.color.name %} + {% set ns.count = j['brick']['amount'] %} + {% endif %} + {% endfor %} + +
+ + {% endfor %} {% endfor %}