Compare commits
3 Commits
6a626282cd
...
baa32c62c2
Author | SHA1 | Date |
---|---|---|
King Kévin | baa32c62c2 | |
King Kévin | 0ba7bead13 | |
King Kévin | 7fd3570bc5 |
|
@ -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.
|
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>/`.
|
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.
|
To import an LCSC part, simply go to the `/import/lcsc/Cxxxx` page and the part will be added to the database.
|
||||||
|
|
||||||
goals
|
goals
|
||||||
|
|
|
@ -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>";
|
||||||
|
@ -238,7 +243,7 @@ function update_part()
|
||||||
part.components.push({name: nam, quantity: parseInt(q)});
|
part.components.push({name: nam, quantity: parseInt(q)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(part);
|
//console.log(part);
|
||||||
|
|
||||||
var post = new XMLHttpRequest();
|
var post = new XMLHttpRequest();
|
||||||
post.open("POST", "part");
|
post.open("POST", "part");
|
||||||
|
|
|
@ -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