Saving missing files
This commit is contained in:
parent
afe52011e4
commit
ff1c7e2ca1
4
app.py
4
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)
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<title>{{ title }}</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
@ -26,15 +26,22 @@
|
||||
<td>{{ brick.color.name }}</td>
|
||||
<td>{{ brick.quantity }}</td>
|
||||
<td>{{ brick.is_spare }}</td>
|
||||
<td>
|
||||
<form action="/saveNumber" method="post">
|
||||
<input type="hidden" name="brick.part.part_num" value="{{ brick.part.part_num }}">
|
||||
<input type="hidden" name="brick.color.name" value="{{ brick.color.name }}">
|
||||
<label for="numberInput">Number:</label>
|
||||
<input type="text" id="numberInput" name="numberInput">
|
||||
<button type="submit">Save Number</button>
|
||||
</form>
|
||||
</td>
|
||||
{% for i in json_file['unit'] %}
|
||||
<td>
|
||||
{% set ns = namespace(count='') %}
|
||||
<form action="/saveNumber" method="post">
|
||||
<input type="hidden" name="brick.part.part_num" value="{{ brick.part.part_num }}">
|
||||
<input type="hidden" name="count" value="{{ i }}">
|
||||
<input type="hidden" name="brick.color.name" value="{{ brick.color.name }}">
|
||||
{% 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 %}
|
||||
<input type="text" style="height:auto;width:20px" id="numberInput" name="numberInput" value={{ ns.count }}><button type="submit"><i class="fa fa-save"></i></button>
|
||||
</form>
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
Loading…
Reference in New Issue
Block a user