Simple sprit accounting module
[infodrom.org/service.infodrom.org] / src / InfoCon / sprit / index.wml
1 #include <infocon.style>
2
3 <future>
4 <page func=InfoCon title="Tankbuch">
5 <style type="text/css">
6 .jsaction {
7     color: #999;
8 }
9 label {
10     display: block;
11 }
12 </style>
13
14 <ul id="machines">
15 </ul>
16 <a class="jsaction" href="#" onclick="return machine_new()">Neues Fahrzeug</a>
17
18 <div id="details" style="margin-top: 5px;display:none;">
19 <input type="hidden" id="id" name="id" value="">
20 <label for="name">Name</label>
21 <input type="text" id="name" name="name" size="30">
22 <br>
23 <input type="submit" onclick="return machine_new_save()" value="Speichern">
24 &nbsp;&nbsp;&nbsp;
25 <input type="submit" onclick="$('#details').hide();return false" value="Abbrechen">
26 </div>
27
28 </page>
29 <protect>
30 <script type="text/javascript">
31 $(function(){
32     load_machines();
33 });
34
35 function load_machines()
36 {
37     ajax_request('machines', null,
38                  function(data){
39                      $('#machines').html(data.list);
40                  });
41 }
42
43 function machine_new()
44 {
45     $('#details input').not('input[type="submit"]').val('');
46     $('#details').show();
47     return false;
48 }
49
50 function machine_new_save()
51 {
52     ajax_request('savemachine', $('#details input').serialize(),
53            function(data){
54                load_machines();
55                $('#details').hide();
56            });
57     return false;
58 }
59
60 function machine_list(obj)
61 {
62     $(obj).parents('form:first').get(0).submit();
63 }
64
65 </script>
66 </protect>
67