1 /***************************************************************************** |
1 /***************************************************************************** |
2 * Copyright (C) 2014-2020 |
2 * Copyright (C) 2014-2020 |
3 * |
3 * |
4 * Michiel Broek <mbroek at mbse dot eu> |
4 * Michiel Broek <mbroek at mbse dot eu> |
5 * |
5 * |
6 * This file is part of BrewCloud |
6 * This file is part of Brewery Management System |
7 * |
7 * |
8 * This is free software; you can redistribute it and/or modify it |
8 * This is free software; you can redistribute it and/or modify it |
9 * under the terms of the GNU General Public License as published by the |
9 * under the terms of the GNU General Public License as published by the |
10 * Free Software Foundation; either version 2, or (at your option) any |
10 * Free Software Foundation; either version 2, or (at your option) any |
11 * later version. |
11 * later version. |
75 type: 'POST', |
75 type: 'POST', |
76 success: function(data, status, xhr) { |
76 success: function(data, status, xhr) { |
77 commit(true); |
77 commit(true); |
78 location.reload(true); |
78 location.reload(true); |
79 }, |
79 }, |
80 error: function(jqXHR, textStatus, errorThrown) { |
80 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
81 commit(false); |
|
82 } |
|
83 }); |
81 }); |
84 }, |
82 }, |
85 addrow: function(rowid, rowdata, position, commit) { |
83 addrow: function(rowid, rowdata, position, commit) { |
86 var data = 'insert=true&' + $.param(rowdata); |
84 var data = 'insert=true&' + $.param(rowdata); |
87 $.ajax({ |
85 $.ajax({ |
92 type: 'POST', |
90 type: 'POST', |
93 success: function(data, status, xhr) { |
91 success: function(data, status, xhr) { |
94 commit(true); |
92 commit(true); |
95 location.reload(true); |
93 location.reload(true); |
96 }, |
94 }, |
97 error: function(jqXHR, textStatus, errorThrown) { |
95 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
98 commit(false); |
|
99 } |
|
100 }); |
96 }); |
101 }, |
97 }, |
102 updaterow: function(rowid, rowdata, commit) { |
98 updaterow: function(rowid, rowdata, commit) { |
103 var data = 'update=true&' + $.param(rowdata); |
99 var data = 'update=true&' + $.param(rowdata); |
104 $.ajax({ |
100 $.ajax({ |
109 type: 'POST', |
105 type: 'POST', |
110 success: function(data, status, xhr) { |
106 success: function(data, status, xhr) { |
111 commit(true); |
107 commit(true); |
112 location.reload(true); |
108 location.reload(true); |
113 }, |
109 }, |
114 error: function(jqXHR, textStatus, errorThrown) { |
110 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
115 commit(false); |
|
116 } |
|
117 }); |
111 }); |
118 } |
112 } |
119 }, |
113 }, |
120 dataAdapter = new $.jqx.dataAdapter(source), |
114 dataAdapter = new $.jqx.dataAdapter(source), |
121 editrow = -1; |
115 editrow = -1; |
154 theme: theme, |
148 theme: theme, |
155 showstatusbar: true, |
149 showstatusbar: true, |
156 renderstatusbar: function(statusbar) { |
150 renderstatusbar: function(statusbar) { |
157 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'), |
151 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'), |
158 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + |
152 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + |
159 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Nieuw</span></div>'); |
153 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Nieuw</span></div>'); |
160 container.append(addButton); |
154 container.append(addButton); |
161 statusbar.append(container); |
155 statusbar.append(container); |
162 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
156 addButton.jqxButton({ theme: theme, width: 90, height: 17 }); |
163 // add new row. |
157 // add new row. |
164 addButton.click(function(event) { |
158 addButton.click(function(event) { |
165 editrow = -1; |
159 editrow = -1; |
166 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } }); |
160 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } }); |
167 $('#name').val(''); |
161 $('#name').val(''); |