Modify Objects

+ sort the object list
+ alter objects
+ delete objects
This commit is contained in:
Clemens-Dautermann 2018-12-26 23:41:37 +01:00
parent 32d60f51ac
commit 51c942746b
6 changed files with 249 additions and 27 deletions

View file

@ -100,19 +100,53 @@
}
.objecttable-data, .objecttable-head {
border: 1px solid #dddddd;
border-bottom: 1px solid #dddddd;
text-align: center;
padding: 0.4em;
}
.objecttable-row:nth-child(even) {
background-color: #dddddd;
.objecttable-row:hover {
background-color: #f8f8f8;
}
.objecttable-row:hover {
-webkit-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
border-radius: 10px;
transition: 0.1s;
.cattable {
border-collapse: collapse;
width: 50%;
margin-top: 2em;
margin-bottom: 2em;
}
.cattable * {
text-align: left;
}
.lower-box {
margin-top: 2em;
width: 50%;
}
.celllink, .celllink:hover, .celllink:visited, .celllink:active {
width: 100%;
height: 100%;
display: block;
padding: 0.4em;
text-decoration: none;
color: #333333;
cursor: default;
}
.alert {
margin-top: 1em;
}
.nodisplay {
display: none;
}
.delaleret {
display: none;
}
.delbtn{
margin-bottom: 1em !important;
}

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
object {{ uuid }} deleted
</body>
</html>

View file

@ -0,0 +1,76 @@
{% extends 'bases/navbar.html' %}
<html>
{% block content %}
<div class="container shadow">
{% if not message is None %}
<div class="alert alert-info alert-dismissible">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
Das Objekt <strong>{{ obj.title }}</strong> wurde verändert.
</div>
{% endif %}
<div class="alert alert-danger alert-dismissible nodisplay" id="abortalert">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
Abbruch.
</div>
<form method="POST" class="post-form invform">
{% csrf_token %}
<div class="ammout-wrapper">
{{ form.ammout.errors }}
<label for="{{ form.ammout.id_for_lable }}">Anzahl:</label>
{{ form.ammout }}
</div>
<div class="title-wrapper">
{{ form.title.errors }}
<label for="{{ form.title.id_for_lable }}">Objekt:</label>
{{ form.title }}
</div>
<div class="category-wrapper">
{{ form.category.errors }}
<label for="{{ form.category.id_for_lable }}">Kategorie:</label>
{{ form.category }}
</div>
<div class="img-wrapper">
{{ form.img.errors }}
<label for="{{ form.img.id_for_lable }}">Bild:</label>
{{ form.img }}
</div>
<div class="description-wrapper">
{{ form.description.errors }}
<label for="{{ form.description.id_for_lable }}">Beschreibung:</label>
{{ form.description }}
</div>
<div class="btnwrapper">
<button type="submit" class="save btn btn-primary">speichern</button>
</div>
</form>
<button type="button" class="delbtn btn btn-danger" onclick="del()">Objekt löschen</button>
</div>
<script>
function del() {
if (confirm('Möchten sie das Objekt {{ obj.title }} wirklich löschen?')) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
window.location.href = "./"
}
};
xhttp.open("GET", './{{ obj.uuid }}/delete', true);
xhttp.send();
} else {
abox = document.getElementById('abortalert');
abox.style.display = "block";
}
}
</script>
{% endblock %}
</html>

View file

@ -4,24 +4,57 @@
<body>
<div class="container shadow">
<table class="objecttable">
<tr class="objecttable-row">
<th class="objecttable-head">Name</th>
<th class="objecttable-head">Anzahl</th>
<form>
{% csrf_token %}
<table class="objecttable">
<tr>
<th class="objecttable-head"><a href="./0">Name</a></th>
<th class="objecttable-head"><a href="./1">Anzahl</a></th>
<th class="objecttable-head"><a href="./2">Kategorie</a></th>
<th class="objecttable-head"><a href="./3">Inventarisierungsdatum</a></th>
<th class="objecttable-head"><a href="./4">Hinzugefügt von</a></th>
</tr>
{% for object in objects %}
<tr class="objecttable-row">
<td class="objecttable-data">
<a class="celllink" href="./{{ object.uuid }}">{{ object.title }}</a>
</td>
<td class="objecttable-data">
<a class="celllink" href="./{{ object.uuid }}">{{ object.ammout }}</a>
</td>
{% if object.category is not None %}
<td class="objecttable-data">
<a class="celllink" href="./{{ object.uuid }}">{{ object.category }}</a>
</td>
{% else %}
<td class="objecttable-data">
<a class="celllink" href="./{{ object.uuid }}">-------</a>
</td>
{% endif %}
<td class="objecttable-data">
<a class="celllink" href="./{{ object.uuid }}">{{ object.inventarized_date }}</a>
</td>
<td class="objecttable-data">
<a class="celllink" href="./{{ object.uuid }}">{{ object.user_added }}</a>
</td>
</tr>
{% endfor %}
</table>
<p>{{ objammout }} Objekte insgesamt</p>
</form>
</div>
<div class="container shadow lower-box">
<table class="cattable">
<tr>
<th class="objecttable-head">Kategorie</th>
<th class="objecttable-head">Inventarisierungsdatum</th>
<th class="objecttable-head">Hinzugefügt von</th>
</tr>
{% for object in objects %}
{% for category in categories %}
<tr class="objecttable-row">
<td class="objecttable-data">{{ object.title }}</td>
<td class="objecttable-data">{{ object.ammout }}</td>
<td class="objecttable-data">{{ object.category }}</td>
<td class="objecttable-data">{{ object.inventarized_date }}</td>
<td class="objecttable-data">{{ object.user_added }}</td>
<td class="objecttable-data">{{ category.name }}</td>
</tr>
{% endfor %}
</table>
<p>{{ ncats }} Kategorien insgesamt</p>
</div>
</body>
{% endblock %}