You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
App/www/screens/inventory.html

39 lines
1.4 KiB
HTML

<div class="scrollable-box">
<div class="list-group" id="inventory-list">
<div class="list-group-item">
<i class="fa fa-spinner fa-pulse fa-fw"></i> Loading...
</div>
</div>
</div>
<script>
function getitemhtmlfromjson(item) {
return "\
<div class='list-group-item inventory-item' id='item-" + item.itemuuid + "'>\
<h4 class='itemname'>" + item.itemname + "</h4>\
<p class='itemdesc'>" + item.itemdesc + "</p>\
<span class='itemid' style='display: none;'>" + item.itemid + "</span>\
<span class='itemclassid' style='display: none;'>" + item.classid + "</span>\
<span class='itemjson' style='display: none;'>" + item.itemjson + "</span>\
</div>";
}
function loadinventory() {
$.getJSON(mkApiUrl('inventory'), {
user: username
}, function (data) {
var content = "";
if (data.status == 'OK') {
items = data.items;
items.forEach(function (item) {
content += getitemhtmlfromjson(item);
});
} else {
content = "<div class='list-group-item'>An error occurred.</div>";
}
$('#inventory-list').html(content);
});
}
loadinventory();
</script>