add component description
This commit is contained in:
parent
7fd3570bc5
commit
0ba7bead13
|
@ -43,7 +43,7 @@
|
||||||
</table>
|
</table>
|
||||||
<div class="hscroll" id="attachments"></div>
|
<div class="hscroll" id="attachments"></div>
|
||||||
<table>
|
<table>
|
||||||
<thead><tr><th>component</th><th>quantity</th></tr></thead>
|
<thead><tr><th>component</th><th>quantity</th><th>description</th></tr></thead>
|
||||||
<tbody id="components"></tbody>
|
<tbody id="components"></tbody>
|
||||||
</table>
|
</table>
|
||||||
<button type="button" onclick="delete_part()">delete part (including children)</button>
|
<button type="button" onclick="delete_part()">delete part (including children)</button>
|
||||||
|
|
|
@ -152,6 +152,11 @@ function select_part()
|
||||||
td.appendChild(input);
|
td.appendChild(input);
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
}
|
}
|
||||||
|
if (row.description) {
|
||||||
|
td = document.createElement('td');
|
||||||
|
td.innerText = row.description;
|
||||||
|
tr.appendChild(td);
|
||||||
|
}
|
||||||
if (row.url) {
|
if (row.url) {
|
||||||
td = document.createElement('td');
|
td = document.createElement('td');
|
||||||
td.innerHTML = "<a href='" + row.url + "'>link</a>";
|
td.innerHTML = "<a href='" + row.url + "'>link</a>";
|
||||||
|
|
|
@ -125,7 +125,7 @@ def get_part_by_id(id)
|
||||||
part["attachments"] += parent["attachments"] if parent
|
part["attachments"] += parent["attachments"] if parent
|
||||||
# add components for assembly
|
# add components for assembly
|
||||||
part["components"] = []
|
part["components"] = []
|
||||||
statement = @db.prepare("SELECT part.name AS name, assembly.quantity AS quantity FROM assembly JOIN part ON part.id = assembly.component WHERE assembly.assembled = ?")
|
statement = @db.prepare("SELECT part.name AS name, part.description AS description, assembly.quantity AS quantity FROM assembly JOIN part ON part.id = assembly.component WHERE assembly.assembled = ?")
|
||||||
statement.execute(id).each do |row|
|
statement.execute(id).each do |row|
|
||||||
part["components"] << row
|
part["components"] << row
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue