www/js/profile_styles.js

changeset 701
3ce3df681be0
parent 563
acdd54144838
child 702
f0896a6f9b64
equal deleted inserted replaced
700:89b7449d1fd9 701:3ce3df681be0
1 /***************************************************************************** 1 /*****************************************************************************
2 * Copyright (C) 2014-2019 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.
87 type: 'POST', 87 type: 'POST',
88 success: function(data, status, xhr) { 88 success: function(data, status, xhr) {
89 commit(true); 89 commit(true);
90 location.reload(true); 90 location.reload(true);
91 }, 91 },
92 error: function(jqXHR, textStatus, errorThrown) { 92 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
93 commit(false);
94 }
95 }); 93 });
96 }, 94 },
97 addrow: function(rowid, rowdata, position, commit) { 95 addrow: function(rowid, rowdata, position, commit) {
98 var data = 'insert=true&' + $.param(rowdata); 96 var data = 'insert=true&' + $.param(rowdata);
99 $.ajax({ 97 $.ajax({
104 type: 'POST', 102 type: 'POST',
105 success: function(data, status, xhr) { 103 success: function(data, status, xhr) {
106 commit(true); 104 commit(true);
107 location.reload(true); 105 location.reload(true);
108 }, 106 },
109 error: function(jqXHR, textStatus, errorThrown) { 107 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
110 commit(false);
111 }
112 }); 108 });
113 }, 109 },
114 updaterow: function(rowid, rowdata, commit) { 110 updaterow: function(rowid, rowdata, commit) {
115 var data = 'update=true&' + $.param(rowdata); 111 var data = 'update=true&' + $.param(rowdata);
116 $.ajax({ 112 $.ajax({
121 type: 'POST', 117 type: 'POST',
122 success: function(data, status, xhr) { 118 success: function(data, status, xhr) {
123 commit(true); 119 commit(true);
124 location.reload(true); 120 location.reload(true);
125 }, 121 },
126 error: function(jqXHR, textStatus, errorThrown) { 122 error: function(jqXHR, textStatus, errorThrown) { commit(false); }
127 commit(false);
128 }
129 }); 123 });
130 } 124 }
131 }, 125 },
132 dataAdapter = new $.jqx.dataAdapter(source), 126 dataAdapter = new $.jqx.dataAdapter(source),
133 editrow = -1; 127 editrow = -1;
134 128
135 // initialize the input fields. 129 // initialize the input fields.
136 $('#name').jqxInput({ theme: theme, width: 320, height: 23 }); 130 $('#name').jqxInput({ theme: theme, width: 320, height: 23 });
137 $('#category').jqxInput({ theme: theme, width: 320, height: 23 }); 131 $('#category').jqxInput({ theme: theme, width: 320, height: 23 });
138 $('#category_number').jqxNumberInput(PosInt); 132 $('#category_number').jqxNumberInput(PosInt);
170 $('#notes').jqxInput({ theme: theme, width: 800, height: 100 }); 164 $('#notes').jqxInput({ theme: theme, width: 800, height: 100 });
171 $('#profile').jqxInput({ theme: theme, width: 800, height: 48 }); 165 $('#profile').jqxInput({ theme: theme, width: 800, height: 48 });
172 $('#ingredients').jqxInput({ theme: theme, width: 800, height: 23 }); 166 $('#ingredients').jqxInput({ theme: theme, width: 800, height: 23 });
173 $('#examples').jqxInput({ theme: theme, width: 800, height: 48 }); 167 $('#examples').jqxInput({ theme: theme, width: 800, height: 48 });
174 168
169 var localizationobj = {};
170 localizationobj.filterchoosestring= "Keuze:";
171
175 // initialize jqxGrid 172 // initialize jqxGrid
176 $('#jqxgrid').jqxGrid({ 173 $('#jqxgrid').jqxGrid({
177 width: 1280, 174 width: 1280,
178 height: 630, 175 height: 630,
179 source: dataAdapter, 176 source: dataAdapter,
181 showstatusbar: true, 178 showstatusbar: true,
182 renderstatusbar: function(statusbar) { 179 renderstatusbar: function(statusbar) {
183 var container, addButton, impButton; 180 var container, addButton, impButton;
184 container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); 181 container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
185 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + 182 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' +
186 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Nieuw</span></div>'); 183 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Nieuw</span></div>');
187 impButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' + 184 impButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' +
188 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Import</span></div>'); 185 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Import</span></div>');
189 expButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' + 186 expButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' +
190 'src="images/database.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Export</span></div>'); 187 'src="images/database.png"/><span style="margin-left: 4px; position: relative; top: -10px;">Export</span></div>');
191 container.append(addButton); 188 container.append(addButton);
192 container.append(impButton); 189 container.append(impButton);
193 container.append(expButton); 190 container.append(expButton);
194 statusbar.append(container); 191 statusbar.append(container);
195 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); 192 addButton.jqxButton({ theme: theme, width: 90, height: 17 });
196 impButton.jqxButton({ theme: theme, width: 90, height: 20 }); 193 impButton.jqxButton({ theme: theme, width: 90, height: 17 });
197 expButton.jqxButton({ theme: theme, width: 90, height: 20 }); 194 expButton.jqxButton({ theme: theme, width: 90, height: 17 });
198 // add new row. 195 // add new row.
199 addButton.click(function(event) { 196 addButton.click(function(event) {
200 editrow = -1; 197 editrow = -1;
201 $('#name').val('Nieuwe stijl'); 198 $('#name').val('Nieuwe stijl');
202 $('#category').val(''); 199 $('#category').val('');
227 }); 224 });
228 expButton.click(function(event) { 225 expButton.click(function(event) {
229 window.open('export_styles.php'); 226 window.open('export_styles.php');
230 }); 227 });
231 }, 228 },
229 ready: function () {
230 $("#jqxgrid").jqxGrid('localizestrings', localizationobj);
231 },
232 filterable: true, 232 filterable: true,
233 filtermode: 'excel', 233 showfilterrow: true,
234 columns: [ 234 columns: [
235 { text: 'Gids', datafield: 'style_guide', width: 100 }, 235 { text: 'Gids', datafield: 'style_guide', width: 100, filtertype: 'list' },
236 { text: 'Groep', datafield: 'style_letter', width: 30 }, 236 { text: 'Groep', datafield: 'style_letter', width: 30, filtertype: 'list' },
237 { text: 'Style Name', menu: false, datafield: 'name' }, 237 { text: 'Style Name', menu: false, datafield: 'name', filtertype: 'textbox' },
238 { text: 'OG', menu: false, datafield: 'og_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, 238 { text: 'OG', menu: false, datafield: 'og_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3', filterable: false },
239 { text: 'OG', menu: false, datafield: 'og_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, 239 { text: 'OG', menu: false, datafield: 'og_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3', filterable: false },
240 { text: 'FG', menu: false, datafield: 'fg_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, 240 { text: 'FG', menu: false, datafield: 'fg_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3', filterable: false },
241 { text: 'FG', menu: false, datafield: 'fg_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, 241 { text: 'FG', menu: false, datafield: 'fg_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3', filterable: false },
242 { text: 'IBU', menu: false, datafield: 'ibu_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, 242 { text: 'IBU', menu: false, datafield: 'ibu_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0', filterable: false },
243 { text: 'IBU', menu: false, datafield: 'ibu_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, 243 { text: 'IBU', menu: false, datafield: 'ibu_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0', filterable: false },
244 { text: 'EBC', menu: false, datafield: 'color_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, 244 { text: 'EBC', menu: false, datafield: 'color_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0', filterable: false },
245 { text: 'EBC', menu: false, datafield: 'color_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0' }, 245 { text: 'EBC', menu: false, datafield: 'color_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0', filterable: false },
246 { text: 'Co2', menu: false, datafield: 'carb_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, 246 { text: 'Co2', menu: false, datafield: 'carb_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1', filterable: false },
247 { text: 'Co2', menu: false, datafield: 'carb_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, 247 { text: 'Co2', menu: false, datafield: 'carb_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1', filterable: false },
248 { text: 'ABV', menu: false, datafield: 'abv_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, 248 { text: 'ABV', menu: false, datafield: 'abv_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1', filterable: false },
249 { text: 'ABV', menu: false, datafield: 'abv_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, 249 { text: 'ABV', menu: false, datafield: 'abv_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1', filterable: false },
250 { text: '', menu: false, datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function() { 250 { text: '', menu: false, datafield: 'Edit', width: 100, align: 'center', columntype: 'button', filterable: false, cellsrenderer: function() {
251 return 'Wijzig'; 251 return 'Wijzig';
252 }, buttonclick: function(row) { 252 }, buttonclick: function(row) {
253 // open the popup window when the user clicks a button. 253 // open the popup window when the user clicks a button.
254 editrow = row; 254 editrow = row;
255 // get the clicked row's data and initialize the input fields. 255 // get the clicked row's data and initialize the input fields.

mercurial