www/js/inv_waters.js

changeset 99
f433193f7bb6
parent 47
94cd5ac04b6a
child 205
08488ac3bbb1
equal deleted inserted replaced
98:92d6bc8a4cdd 99:f433193f7bb6
54 $("#chloride").jqxTooltip({ content: 'Chloride (Cl).' }); 54 $("#chloride").jqxTooltip({ content: 'Chloride (Cl).' });
55 $("#sodium").jqxTooltip({ content: 'Natrium, oftewel keukenzout (Na). In berekeningen ook vaak als Sodium.' }); 55 $("#sodium").jqxTooltip({ content: 'Natrium, oftewel keukenzout (Na). In berekeningen ook vaak als Sodium.' });
56 $("#magnesium").jqxTooltip({ content: 'Magnesium (Mg).' }); 56 $("#magnesium").jqxTooltip({ content: 'Magnesium (Mg).' });
57 $("#ph").jqxTooltip({ content: 'De zuurgraad (pH).' }); 57 $("#ph").jqxTooltip({ content: 'De zuurgraad (pH).' });
58 $("#total_alkalinity").jqxTooltip({ content: 'Totale alkaliniteit.' }); 58 $("#total_alkalinity").jqxTooltip({ content: 'Totale alkaliniteit.' });
59 $("#default_water").jqxTooltip({ content: 'Is dit het standaard water voor de meeste bieren.' });
60 $("#inventory").jqxTooltip({ content: 'Voorraad in liters.' }); 59 $("#inventory").jqxTooltip({ content: 'Voorraad in liters.' });
61 $("#cost").jqxTooltip({ content: 'Kostprijs per liter. 5 cijfers achter de comma zodat het kraanwater er ook in kan.' }); 60 $("#cost").jqxTooltip({ content: 'Kostprijs per liter. 5 cijfers achter de comma zodat het kraanwater er ook in kan.' });
62 // prepare the data 61 // prepare the data
63 var source = { 62 var source = {
64 datatype: "json", 63 datatype: "json",
74 { name: 'sodium', type: 'float' }, 73 { name: 'sodium', type: 'float' },
75 { name: 'magnesium', type: 'float' }, 74 { name: 'magnesium', type: 'float' },
76 { name: 'ph', type: 'float' }, 75 { name: 'ph', type: 'float' },
77 { name: 'notes', type: 'string' }, 76 { name: 'notes', type: 'string' },
78 { name: 'total_alkalinity', type: 'float' }, 77 { name: 'total_alkalinity', type: 'float' },
79 { name: 'default_water', type: 'bool' },
80 { name: 'inventory', type: 'float' }, 78 { name: 'inventory', type: 'float' },
81 { name: 'cost', type: 'float' } 79 { name: 'cost', type: 'float' }
82 ], 80 ],
83 id: 'record', 81 id: 'record',
84 url: url, 82 url: url,
142 $("#magnesium").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 140 $("#magnesium").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true });
143 $("#ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 141 $("#ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true });
144 142
145 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); 143 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 });
146 $("#total_alkalinity").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 144 $("#total_alkalinity").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true });
147 $("#default_water").jqxCheckBox({ theme: theme, width: 120, height: 23 });
148 $("#inventory").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 145 $("#inventory").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true });
149 $("#cost").jqxNumberInput({inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 5, spinButtons: true }); 146 $("#cost").jqxNumberInput({inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 5, spinButtons: true });
150 var dataAdapter = new $.jqx.dataAdapter(source); 147 var dataAdapter = new $.jqx.dataAdapter(source);
151 var editrow = -1; 148 var editrow = -1;
152 // initialize jqxGrid 149 // initialize jqxGrid
176 $("#sodium").val(''); 173 $("#sodium").val('');
177 $("#magnesium").val(''); 174 $("#magnesium").val('');
178 $("#ph").val(''); 175 $("#ph").val('');
179 $("#notes").val(''); 176 $("#notes").val('');
180 $("#total_alkalinity").val(''); 177 $("#total_alkalinity").val('');
181 $("#default_water").val('');
182 $("#inventory").val(''); 178 $("#inventory").val('');
183 $("#cost").val(''); 179 $("#cost").val('');
184 $("#popupWindow").jqxWindow('open'); 180 $("#popupWindow").jqxWindow('open');
185 }); 181 });
186 }, 182 },
187 filterable: true, 183 filterable: true,
188 filtermode: 'excel', 184 filtermode: 'excel',
189 columns: [ 185 columns: [
190 { text: 'Water leverancier', datafield: 'name', width: 225 }, 186 { text: 'Water leverancier', datafield: 'name', width: 225 },
191 { text: 'Opmerkingen', datafield: 'notes' }, 187 { text: 'Opmerkingen', datafield: 'notes' },
192 { text: 'Standaard', datafield: 'default_water', columntype: 'checkbox', width: 80 },
193 { text: 'Onbeperkt', datafield: 'unlimited_stock', columntype: 'checkbox', width: 80 }, 188 { text: 'Onbeperkt', datafield: 'unlimited_stock', columntype: 'checkbox', width: 80 },
194 { text: 'Liters', datafield: 'inventory', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, 189 { text: 'Liters', datafield: 'inventory', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
195 { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { 190 { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () {
196 return "Wijzig"; 191 return "Wijzig";
197 }, buttonclick: function (row) { 192 }, buttonclick: function (row) {
209 $("#sodium").val(dataRecord.sodium); 204 $("#sodium").val(dataRecord.sodium);
210 $("#magnesium").val(dataRecord.magnesium); 205 $("#magnesium").val(dataRecord.magnesium);
211 $("#ph").val(dataRecord.ph); 206 $("#ph").val(dataRecord.ph);
212 $("#notes").val(dataRecord.notes); 207 $("#notes").val(dataRecord.notes);
213 $("#total_alkalinity").val(dataRecord.total_alkalinity); 208 $("#total_alkalinity").val(dataRecord.total_alkalinity);
214 $("#default_water").val(dataRecord.default_water);
215 $("#inventory").val(dataRecord.inventory); 209 $("#inventory").val(dataRecord.inventory);
216 $("#cost").val(dataRecord.cost); 210 $("#cost").val(dataRecord.cost);
217 // show the popup window. 211 // show the popup window.
218 $("#popupWindow").jqxWindow('open'); 212 $("#popupWindow").jqxWindow('open');
219 } 213 }
256 sodium: parseFloat($("#sodium").jqxNumberInput('decimal')), 250 sodium: parseFloat($("#sodium").jqxNumberInput('decimal')),
257 magnesium: parseFloat($("#magnesium").jqxNumberInput('decimal')), 251 magnesium: parseFloat($("#magnesium").jqxNumberInput('decimal')),
258 ph: parseFloat($("#ph").jqxNumberInput('decimal')), 252 ph: parseFloat($("#ph").jqxNumberInput('decimal')),
259 notes: $("#notes").val(), 253 notes: $("#notes").val(),
260 total_alkalinity: parseFloat($("#total_alkalinity").jqxNumberInput('decimal')), 254 total_alkalinity: parseFloat($("#total_alkalinity").jqxNumberInput('decimal')),
261 default_water: $("#default_water").val(),
262 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')), 255 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')),
263 cost: parseFloat($("#cost").jqxNumberInput('decimal')) 256 cost: parseFloat($("#cost").jqxNumberInput('decimal'))
264 }; 257 };
265 $('#jqxgrid').jqxGrid('updaterow', rowID, row); 258 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
266 $("#popupWindow").jqxWindow('hide'); 259 $("#popupWindow").jqxWindow('hide');
277 sodium: parseFloat($("#sodium").jqxNumberInput('decimal')), 270 sodium: parseFloat($("#sodium").jqxNumberInput('decimal')),
278 magnesium: parseFloat($("#magnesium").jqxNumberInput('decimal')), 271 magnesium: parseFloat($("#magnesium").jqxNumberInput('decimal')),
279 ph: parseFloat($("#ph").jqxNumberInput('decimal')), 272 ph: parseFloat($("#ph").jqxNumberInput('decimal')),
280 notes: $("#notes").val(), 273 notes: $("#notes").val(),
281 total_alkalinity: parseFloat($("#total_alkalinity").jqxNumberInput('decimal')), 274 total_alkalinity: parseFloat($("#total_alkalinity").jqxNumberInput('decimal')),
282 default_water: $("#default_water").val(),
283 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')), 275 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')),
284 cost: parseFloat($("#cost").jqxNumberInput('decimal')) 276 cost: parseFloat($("#cost").jqxNumberInput('decimal'))
285 }; 277 };
286 $('#jqxgrid').jqxGrid('addrow', null, newrow); 278 $('#jqxgrid').jqxGrid('addrow', null, newrow);
287 $("#popupWindow").jqxWindow('hide'); 279 $("#popupWindow").jqxWindow('hide');

mercurial