Compare commits

...

2 Commits

Author SHA1 Message Date
King Kévin f8af750f02 web: fix adding line to table 2023-01-30 23:52:27 +01:00
King Kévin 682e0cd9aa web: fix url clearing 2023-01-30 23:51:41 +01:00
1 changed files with 5 additions and 4 deletions

View File

@ -100,7 +100,7 @@ function select_part()
const span = document.getElementById('url_' + field);
const text = span.innerText;
span.innerHTML = null;
if (undefined === part[field] || null == part[field]) {
if (undefined === part[field] || null == part[field] || 0 == part[field].length) {
span.innerHTML = text;
} else {
const a = document.createElement('a');
@ -113,12 +113,13 @@ function select_part()
for (const table of tables) {
const tbody = document.getElementById(table);
tbody.innerHTML = null;
const content = part[table].slice();
if ("components" == table) {
part[table].push({name: "", quantity: ""}); // empty field to add
content.push({name: "", quantity: ""}); // empty field to add
} else {
part[table].push({name: "", value: ""}); // empty field to add
content.push({name: "", value: ""}); // empty field to add
}
for (const row of part[table]) {
for (const row of content) {
const tr = document.createElement('tr');
let td = document.createElement('td');
let input = document.createElement('input');