Compare commits

...

3 Commits

Author SHA1 Message Date
King Kévin baa32c62c2 web: disable debug log 2023-01-30 12:30:37 +01:00
King Kévin 0ba7bead13 add component description 2023-01-30 12:30:11 +01:00
King Kévin 7fd3570bc5 doc: update distributor 2023-01-30 12:29:25 +01:00
4 changed files with 8 additions and 7 deletions

View File

@ -7,10 +7,6 @@ Once the service is installed, there is a single page to search, add, delete, or
The only aspect not handled by the web frontend is the attachments.
Just add the files directly on the server under `public/attachments/<part_name>/`.
Distributors also need to be managed directly in the database.
Since this does change very often, it isn't too much of a hassle.
An example is in `populate.sql`, also with some other entries.
To import an LCSC part, simply go to the `/import/lcsc/Cxxxx` page and the part will be added to the database.
goals

View File

@ -43,7 +43,7 @@
</table>
<div class="hscroll" id="attachments"></div>
<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>
</table>
<button type="button" onclick="delete_part()">delete part (including children)</button>

View File

@ -152,6 +152,11 @@ function select_part()
td.appendChild(input);
tr.appendChild(td);
}
if (row.description) {
td = document.createElement('td');
td.innerText = row.description;
tr.appendChild(td);
}
if (row.url) {
td = document.createElement('td');
td.innerHTML = "<a href='" + row.url + "'>link</a>";
@ -238,7 +243,7 @@ function update_part()
part.components.push({name: nam, quantity: parseInt(q)});
}
}
console.log(part);
//console.log(part);
var post = new XMLHttpRequest();
post.open("POST", "part");

View File

@ -125,7 +125,7 @@ def get_part_by_id(id)
part["attachments"] += parent["attachments"] if parent
# add components for assembly
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|
part["components"] << row
end