Simple sprit accounting module
[infodrom.org/service.infodrom.org] / src / InfoCon / sprit / index.wml
diff --git a/src/InfoCon/sprit/index.wml b/src/InfoCon/sprit/index.wml
new file mode 100644 (file)
index 0000000..8c00f34
--- /dev/null
@@ -0,0 +1,67 @@
+#include <infocon.style>
+
+<future>
+<page func=InfoCon title="Tankbuch">
+<style type="text/css">
+.jsaction {
+    color: #999;
+}
+label {
+    display: block;
+}
+</style>
+
+<ul id="machines">
+</ul>
+<a class="jsaction" href="#" onclick="return machine_new()">Neues Fahrzeug</a>
+
+<div id="details" style="margin-top: 5px;display:none;">
+<input type="hidden" id="id" name="id" value="">
+<label for="name">Name</label>
+<input type="text" id="name" name="name" size="30">
+<br>
+<input type="submit" onclick="return machine_new_save()" value="Speichern">
+&nbsp;&nbsp;&nbsp;
+<input type="submit" onclick="$('#details').hide();return false" value="Abbrechen">
+</div>
+
+</page>
+<protect>
+<script type="text/javascript">
+$(function(){
+    load_machines();
+});
+
+function load_machines()
+{
+    ajax_request('machines', null,
+                function(data){
+                    $('#machines').html(data.list);
+                });
+}
+
+function machine_new()
+{
+    $('#details input').not('input[type="submit"]').val('');
+    $('#details').show();
+    return false;
+}
+
+function machine_new_save()
+{
+    ajax_request('savemachine', $('#details input').serialize(),
+          function(data){
+              load_machines();
+              $('#details').hide();
+          });
+    return false;
+}
+
+function machine_list(obj)
+{
+    $(obj).parents('form:first').get(0).submit();
+}
+
+</script>
+</protect>
+