next step
This commit is contained in:
parent
e8697ffceb
commit
f1f656a066
Binary file not shown.
45
static/itemHandler.js
Normal file
45
static/itemHandler.js
Normal file
@ -0,0 +1,45 @@
|
||||
async function addLink(){
|
||||
event.preventDefault()
|
||||
let key = document.getElementById('link_name').value;
|
||||
let link = document.getElementById('link').value;
|
||||
links[key] = link;
|
||||
console.log(links)
|
||||
await propagateLinks()
|
||||
};
|
||||
|
||||
function updatePackaging(){
|
||||
let packaging = document.getElementById('packaging').value;
|
||||
item_info['packaging'] = packaging;
|
||||
console.log(item_info)
|
||||
};
|
||||
|
||||
function updateUOM(){
|
||||
let uom = document.getElementById('uom').value;
|
||||
item_info['uom'] = uom;
|
||||
console.log(item_info)
|
||||
};
|
||||
|
||||
function updateCost(){
|
||||
let cost = document.getElementById('cost').value;
|
||||
item_info['cost'] = parseFloat(cost);
|
||||
console.log(item_info)
|
||||
};
|
||||
|
||||
function updateSafetyStock(){
|
||||
let safety_stock = document.getElementById('safety_stock').value;
|
||||
item_info['safety_stock'] = parseFloat(safety_stock);
|
||||
console.log(item_info)
|
||||
};
|
||||
|
||||
function updateLeadTimeDays(){
|
||||
let lead_time_days = document.getElementById('lead_time_days').value;
|
||||
item_info['lead_time_days'] = parseFloat(lead_time_days);
|
||||
console.log(item_info)
|
||||
};
|
||||
|
||||
function updateAiPickable(){
|
||||
let ai_pick = document.getElementById('ai_pickable');
|
||||
item_info['ai_pick'] = ai_pick.checked;
|
||||
console.log(item_info)
|
||||
};
|
||||
|
||||
@ -105,6 +105,36 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div id="item_info" class="col s12">
|
||||
<div class="row" style="gap: 10px; padding-top: 10px;">
|
||||
<div class="col s6 m4 input-field outlined item_info_target">
|
||||
<input onchange="updatePackaging()" id="packaging" type="text" placeholder=" " maxlength="32">
|
||||
<label for="packaging">Packaging</label>
|
||||
</div>
|
||||
<div class="col s6 m4 input-field outlined item_info_target">
|
||||
<input onchange="updateUOM()" id="uom" type="text" placeholder=" " maxlength="32">
|
||||
<label for="uom">Unit of Measure</label>
|
||||
</div>
|
||||
<div class="col s6 m4 input-field outlined item_info_target">
|
||||
<input onchange="updateCost()" id="cost" type="number" placeholder=" " maxlength="32">
|
||||
<label for="cost">Cost</label>
|
||||
</div>
|
||||
<div class="col s6 m4 input-field outlined item_info_target">
|
||||
<input onchange="updateSafetyStock()" id="safety_stock" type="number" placeholder=" " maxlength="32">
|
||||
<label for="safety_stock">Safety Stock</label>
|
||||
</div>
|
||||
<div class="col s6 m4 input-field outlined item_info_target">
|
||||
<input onchange="updateLeadTimeDays()" id="lead_time_days" type="number" placeholder=" " maxlength="32">
|
||||
<label for="lead_time_days">Leadtime (Days)</label>
|
||||
</div>
|
||||
<div class="col s6 m4 center">
|
||||
<p>
|
||||
<label>
|
||||
<input onclick="updateAiPickable()" id="ai_pickable" type="checkbox" />
|
||||
<span>AI Pickable</span>
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<table class="" id="reference_table">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -153,10 +183,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="{{ url_for('static', filename='itemHandler.js') }}"></script>
|
||||
<script>
|
||||
const item = {{ item|tojson }}
|
||||
var reference_state = 1
|
||||
let links = {};
|
||||
let updated = {};
|
||||
let item_info = {};
|
||||
let food_info = {};
|
||||
let logistics_info = {};
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async function() {
|
||||
document.getElementById("title").innerHTML = String(item[2])
|
||||
@ -177,6 +213,7 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
async function propagateInfo(){
|
||||
const entryType = document.getElementById('entry_type');
|
||||
entryType.value = item[10];
|
||||
|
||||
@ -228,6 +228,7 @@
|
||||
}
|
||||
|
||||
async function populateReferences(){
|
||||
console.log(shoppingList[4])
|
||||
var table_div = document.getElementById('table_div')
|
||||
table_div.innerHTML = ""
|
||||
|
||||
@ -263,12 +264,13 @@
|
||||
name_cell.innerHTML = `${inventory_items[i][2]}`
|
||||
}
|
||||
let qty_uom_cell = document.createElement('td')
|
||||
console.log(shoppingList[10])
|
||||
console.log(shoppingList[7])
|
||||
if(shoppingList[10] == 'calculated'){
|
||||
qty_uom_cell.innerHTML = `
|
||||
<input class="item_qty" id="${inventory_items[i][0]}@item" value='0.00' type="text" placeholder=" " style="width: 60px; height: 30px;" disabled>
|
||||
<input class="item_uom" id="${inventory_items[i][0]}@item" value='' type="text" placeholder=" " style="width: 60px; height: 30px;" disabled>`
|
||||
} else {
|
||||
console.log(inventory_items[i][0])
|
||||
qty = quantities[`${inventory_items[i][0]}@item`]['qty']
|
||||
uom = quantities[`${inventory_items[i][0]}@item`]['uom']
|
||||
qty_uom_cell.innerHTML = `
|
||||
@ -353,6 +355,7 @@
|
||||
|
||||
async function save_quantities(){
|
||||
let x = document.querySelectorAll(".item_qty")
|
||||
console.log(x)
|
||||
for(let i=0; i<x.length; i++){
|
||||
if(shoppingList[10]== 'calculated'){
|
||||
quantities[`${x[i].id}`] = {qty: Number(x[i].value)}
|
||||
|
||||
@ -42,6 +42,7 @@ def items():
|
||||
@app.route("/")
|
||||
def home():
|
||||
session['selected_site'] = 'main'
|
||||
return render_template("items/index.html")
|
||||
sites = config.sites_config()
|
||||
return render_template("items/index.html", current_site=session['selected_site'], sites=sites['sites'])
|
||||
|
||||
app.run(host="0.0.0.0", port=5002, debug=True)
|
||||
Loading…
x
Reference in New Issue
Block a user