mirror of
https://gitlab.aachen.ccc.de/inventory/in.git
synced 2024-11-25 16:53:59 +01:00
show known types in form
This commit is contained in:
parent
8e19a1dbad
commit
c763cdb23f
2 changed files with 13 additions and 0 deletions
|
@ -30,6 +30,7 @@
|
|||
|
||||
<label for="type">Type</label>
|
||||
<input id="type" type="text">
|
||||
<p id="knowntypes"></p>
|
||||
|
||||
<label for="name">Name / Label</label>
|
||||
<input id="name" type="text">
|
||||
|
|
|
@ -12,6 +12,7 @@ document.onreadystatechange = function() {
|
|||
|
||||
function fillForm() {
|
||||
const item = items[id];
|
||||
knownTypes();
|
||||
|
||||
const is_in = document.getElementById('is_in');
|
||||
|
||||
|
@ -52,6 +53,17 @@ function fillForm() {
|
|||
}
|
||||
}
|
||||
|
||||
function knownTypes() {
|
||||
let map = {};
|
||||
for (const i of Object.values(items)) {
|
||||
if (i.type) {
|
||||
map[i.type] = true;
|
||||
}
|
||||
}
|
||||
let types = Object.keys(map).sort().join(', ')
|
||||
document.getElementById('knowntypes').textContent = `Known types: ${types}.`;
|
||||
}
|
||||
|
||||
function save() {
|
||||
item = {
|
||||
id: document.getElementById('id').value || null,
|
||||
|
|
Loading…
Reference in a new issue