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. |
130 type: 'POST', |
130 type: 'POST', |
131 success: function(data, status, xhr) { |
131 success: function(data, status, xhr) { |
132 commit(true); |
132 commit(true); |
133 location.reload(true); |
133 location.reload(true); |
134 }, |
134 }, |
135 error: function(jqXHR, textStatus, errorThrown) { |
135 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
136 commit(false); |
|
137 } |
|
138 }); |
136 }); |
139 }, |
137 }, |
140 addrow: function(rowid, rowdata, position, commit) { |
138 addrow: function(rowid, rowdata, position, commit) { |
141 var data = 'insert=true&' + $.param(rowdata); |
139 var data = 'insert=true&' + $.param(rowdata); |
142 $.ajax({ |
140 $.ajax({ |
147 type: 'POST', |
145 type: 'POST', |
148 success: function(data, status, xhr) { |
146 success: function(data, status, xhr) { |
149 commit(true); |
147 commit(true); |
150 location.reload(true); |
148 location.reload(true); |
151 }, |
149 }, |
152 error: function(jqXHR, textStatus, errorThrown) { |
150 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
153 commit(false); |
|
154 } |
|
155 }); |
151 }); |
156 }, |
152 }, |
157 updaterow: function(rowid, rowdata, commit) { |
153 updaterow: function(rowid, rowdata, commit) { |
158 var data = 'update=true&' + $.param(rowdata); |
154 var data = 'update=true&' + $.param(rowdata); |
159 $.ajax({ |
155 $.ajax({ |
164 type: 'POST', |
160 type: 'POST', |
165 success: function(data, status, xhr) { |
161 success: function(data, status, xhr) { |
166 commit(true); |
162 commit(true); |
167 location.reload(true); |
163 location.reload(true); |
168 }, |
164 }, |
169 error: function(jqXHR, textStatus, errorThrown) { |
165 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
170 commit(false); |
|
171 } |
|
172 }); |
166 }); |
173 } |
167 } |
174 }, |
168 }, |
175 dataAdapter = new $.jqx.dataAdapter(source), |
169 dataAdapter = new $.jqx.dataAdapter(source), |
176 editrow = -1; |
170 editrow = -1; |
227 theme: theme, |
221 theme: theme, |
228 showstatusbar: true, |
222 showstatusbar: true, |
229 renderstatusbar: function(statusbar) { |
223 renderstatusbar: function(statusbar) { |
230 var addButton, container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
224 var addButton, container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
231 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + |
225 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + |
232 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Nieuw</span></div>'); |
226 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Nieuw</span></div>'); |
233 expButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' + |
227 expButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' + |
234 'src="images/database.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Export</span></div>'); |
228 'src="images/database.png"/><span style="margin-left: 4px; position: relative; top: -10px;">Export</span></div>'); |
235 container.append(addButton); |
229 container.append(addButton); |
236 container.append(expButton); |
230 container.append(expButton); |
237 statusbar.append(container); |
231 statusbar.append(container); |
238 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
232 addButton.jqxButton({ theme: theme, width: 90, height: 17 }); |
239 expButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
233 expButton.jqxButton({ theme: theme, width: 90, height: 17 }); |
240 // add new row. |
234 // add new row. |
241 addButton.click(function(event) { |
235 addButton.click(function(event) { |
242 editrow = -1; |
236 editrow = -1; |
243 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } }); |
237 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } }); |
244 $('#name').val('Nieuwe brouwset'); |
238 $('#name').val('Nieuwe brouwset'); |