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. |
95 type: 'POST', |
95 type: 'POST', |
96 success: function(data, status, xhr) { |
96 success: function(data, status, xhr) { |
97 commit(true); |
97 commit(true); |
98 location.reload(true); |
98 location.reload(true); |
99 }, |
99 }, |
100 error: function(jqXHR, textStatus, errorThrown) { |
100 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
101 commit(false); |
|
102 } |
|
103 }); |
101 }); |
104 }, |
102 }, |
105 addrow: function(rowid, rowdata, position, commit) { |
103 addrow: function(rowid, rowdata, position, commit) { |
106 var data = 'insert=true&' + $.param(rowdata); |
104 var data = 'insert=true&' + $.param(rowdata); |
107 $.ajax({ |
105 $.ajax({ |
112 type: 'POST', |
110 type: 'POST', |
113 success: function(data, status, xhr) { |
111 success: function(data, status, xhr) { |
114 commit(true); |
112 commit(true); |
115 location.reload(true); |
113 location.reload(true); |
116 }, |
114 }, |
117 error: function(jqXHR, textStatus, errorThrown) { |
115 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
118 commit(false); |
|
119 } |
|
120 }); |
116 }); |
121 }, |
117 }, |
122 updaterow: function(rowid, rowdata, commit) { |
118 updaterow: function(rowid, rowdata, commit) { |
123 var data = 'update=true&' + $.param(rowdata); |
119 var data = 'update=true&' + $.param(rowdata); |
124 $.ajax({ |
120 $.ajax({ |
129 type: 'POST', |
125 type: 'POST', |
130 success: function(data, status, xhr) { |
126 success: function(data, status, xhr) { |
131 commit(true); |
127 commit(true); |
132 location.reload(true); |
128 location.reload(true); |
133 }, |
129 }, |
134 error: function(jqXHR, textStatus, errorThrown) { |
130 error: function(jqXHR, textStatus, errorThrown) { commit(false); } |
135 commit(false); |
|
136 } |
|
137 }); |
131 }); |
138 } |
132 } |
139 }, |
133 }, |
140 dataAdapter = new $.jqx.dataAdapter(source), |
134 dataAdapter = new $.jqx.dataAdapter(source), |
141 editrow = -1; |
135 editrow = -1; |
164 theme: theme, |
158 theme: theme, |
165 showstatusbar: true, |
159 showstatusbar: true, |
166 renderstatusbar: function(statusbar) { |
160 renderstatusbar: function(statusbar) { |
167 var addButton, container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
161 var addButton, container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
168 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + |
162 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + |
169 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Nieuw</span></div>'); |
163 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Nieuw</span></div>'); |
170 expButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' + |
164 expButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' + |
171 'src="images/database.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Export</span></div>'); |
165 'src="images/database.png"/><span style="margin-left: 4px; position: relative; top: -10px;">Export</span></div>'); |
172 container.append(addButton); |
166 container.append(addButton); |
173 container.append(expButton); |
167 container.append(expButton); |
174 statusbar.append(container); |
168 statusbar.append(container); |
175 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
169 addButton.jqxButton({ theme: theme, width: 90, height: 17 }); |
176 expButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
170 expButton.jqxButton({ theme: theme, width: 90, height: 17 }); |
177 // add new row. |
171 // add new row. |
178 addButton.click(function(event) { |
172 addButton.click(function(event) { |
179 editrow = -1; |
173 editrow = -1; |
180 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } }); |
174 $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } }); |
181 $('#name').val('Nieuw brouwwater'); |
175 $('#name').val('Nieuw brouwwater'); |