www/js/inv_hops.js

changeset 19
057a6256bd7b
parent 18
395833e20f88
child 30
f5ab22446aa5
equal deleted inserted replaced
18:395833e20f88 19:057a6256bd7b
56 { name: 'humulene', type: 'float' }, 56 { name: 'humulene', type: 'float' },
57 { name: 'caryophyllene', type: 'float' }, 57 { name: 'caryophyllene', type: 'float' },
58 { name: 'cohumulone', type: 'float' }, 58 { name: 'cohumulone', type: 'float' },
59 { name: 'myrcene', type: 'float' }, 59 { name: 'myrcene', type: 'float' },
60 { name: 'hsi', type: 'float' }, 60 { name: 'hsi', type: 'float' },
61 { name: 'useat', type: 'string' },
62 { name: 'type', type: 'string' }, 61 { name: 'type', type: 'string' },
63 { name: 'form', type: 'string' }, 62 { name: 'form', type: 'string' },
64 { name: 'notes', type: 'string' }, 63 { name: 'notes', type: 'string' },
65 { name: 'origin', type: 'string' }, 64 { name: 'origin', type: 'string' },
66 { name: 'substitutes', type: 'string' }, 65 { name: 'substitutes', type: 'string' },
67 { name: 'always_on_stock', type: 'bool' }, 66 { name: 'always_on_stock', type: 'bool' },
68 { name: 'inventory', type: 'float' }, 67 { name: 'inventory', type: 'float' },
69 { name: 'cost', type: 'float' }, 68 { name: 'cost', type: 'float' },
70 { name: 'production_date', type: 'string' }, 69 { name: 'production_date', type: 'string' },
71 { name: 'tht_date', type: 'string' }, 70 { name: 'tht_date', type: 'string' },
72 { name: 'supplier_rec', type: 'number' },
73 { name: 'total_oil', type: 'float' } 71 { name: 'total_oil', type: 'float' }
74 ], 72 ],
75 id: 'record', 73 id: 'record',
76 url: url, 74 url: url,
77 deleterow: function (rowid, commit) { 75 deleterow: function (rowid, commit) {
134 $("#caryophyllene").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 132 $("#caryophyllene").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true });
135 $("#cohumulone").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 133 $("#cohumulone").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true });
136 $("#myrcene").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 134 $("#myrcene").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true });
137 $("#hsi").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 135 $("#hsi").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true });
138 136
139 // $("#useat").jqxDropDownList({ theme: theme, source: srcUse, width: 90, height: 23, dropDownHeight: 130 }); // Only in recipes
140 $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 95 }); 137 $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 95 });
141 $("#form").jqxDropDownList({ theme: theme, source: srcForm, width: 90, height: 23, dropDownHeight: 95 }); 138 $("#form").jqxDropDownList({ theme: theme, source: srcForm, width: 90, height: 23, dropDownHeight: 95 });
142 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); 139 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 });
143 $("#origin").jqxInput({ theme: theme, width: 250, height: 23 }); 140 $("#origin").jqxInput({ theme: theme, width: 250, height: 23 });
144 $("#substitutes").jqxInput({ theme: theme, width: 250, height: 23 }); 141 $("#substitutes").jqxInput({ theme: theme, width: 250, height: 23 });
145 $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 }); 142 $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 });
146 $("#inventory").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 143 $("#inventory").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true });
147 $("#production_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); 144 $("#production_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' });
148 $("#cost").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); 145 $("#cost").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 2, spinButtons: true });
149 $("#tht_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); 146 $("#tht_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' });
150 // $("#supplier_rec").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); // Implement later.
151 $("#total_oil").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); 147 $("#total_oil").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true });
152 var dataAdapter = new $.jqx.dataAdapter(source); 148 var dataAdapter = new $.jqx.dataAdapter(source);
153 var editrow = -1; 149 var editrow = -1;
154 // initialize jqxGrid 150 // initialize jqxGrid
155 $("#jqxgrid").jqxGrid({ 151 $("#jqxgrid").jqxGrid({
175 $("#humulene").val(''); 171 $("#humulene").val('');
176 $("#caryophyllene").val(''); 172 $("#caryophyllene").val('');
177 $("#cohumulone").val(''); 173 $("#cohumulone").val('');
178 $("#myrcene").val(''); 174 $("#myrcene").val('');
179 $("#hsi").val(''); 175 $("#hsi").val('');
180 //$("#useat").val('Boil');
181 $("#type").val('Bittering'); 176 $("#type").val('Bittering');
182 $("#form").val('Pellet'); 177 $("#form").val('Pellet');
183 $("#notes").val(''); 178 $("#notes").val('');
184 $("#origin").val(''); 179 $("#origin").val('');
185 $("#substitutes").val(''); 180 $("#substitutes").val('');
186 $("#always_on_stock").val(''); 181 $("#always_on_stock").val('');
187 $("#inventory").val(''); 182 $("#inventory").val('');
188 $("#cost").val(''); 183 $("#cost").val('');
189 $("#production_date").val(''); 184 $("#production_date").val('');
190 $("#tht_date").val(''); 185 $("#tht_date").val('');
191 //$("#supplier_rec").val('');
192 $("#total_oil").val(''); 186 $("#total_oil").val('');
193 $("#popupWindow").jqxWindow('open'); 187 $("#popupWindow").jqxWindow('open');
194 }); 188 });
195 }, 189 },
196 filterable: true, 190 filterable: true,
221 $("#humulene").val(dataRecord.humulene); 215 $("#humulene").val(dataRecord.humulene);
222 $("#caryophyllene").val(dataRecord.caryophyllene); 216 $("#caryophyllene").val(dataRecord.caryophyllene);
223 $("#cohumulone").val(dataRecord.cohumulone); 217 $("#cohumulone").val(dataRecord.cohumulone);
224 $("#myrcene").val(dataRecord.myrcene); 218 $("#myrcene").val(dataRecord.myrcene);
225 $("#hsi").val(dataRecord.hsi); 219 $("#hsi").val(dataRecord.hsi);
226 //$("#useat").val(dataRecord.useat);
227 $("#type").val(dataRecord.type); 220 $("#type").val(dataRecord.type);
228 $("#form").val(dataRecord.form); 221 $("#form").val(dataRecord.form);
229 $("#notes").val(dataRecord.notes); 222 $("#notes").val(dataRecord.notes);
230 $("#origin").val(dataRecord.origin); 223 $("#origin").val(dataRecord.origin);
231 $("#substitutes").val(dataRecord.substitutes); 224 $("#substitutes").val(dataRecord.substitutes);
232 $("#always_on_stock").val(dataRecord.always_on_stock); 225 $("#always_on_stock").val(dataRecord.always_on_stock);
233 $("#inventory").val(dataRecord.inventory); 226 $("#inventory").val(dataRecord.inventory);
234 $("#cost").val(dataRecord.cost); 227 $("#cost").val(dataRecord.cost);
235 $("#production_date").val(dataRecord.production_date); 228 $("#production_date").val(dataRecord.production_date);
236 $("#tht_date").val(dataRecord.tht_date); 229 $("#tht_date").val(dataRecord.tht_date);
237 //$("#supplier_rec").val(dataRecord.supplier_rec);
238 $("#total_oil").val(dataRecord.total_oil); 230 $("#total_oil").val(dataRecord.total_oil);
239 // show the popup window. 231 // show the popup window.
240 $("#popupWindow").jqxWindow('open'); 232 $("#popupWindow").jqxWindow('open');
241 } 233 }
242 } 234 }
275 humulene: parseFloat($("#humulene").jqxNumberInput('decimal')), 267 humulene: parseFloat($("#humulene").jqxNumberInput('decimal')),
276 caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')), 268 caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')),
277 cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')), 269 cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')),
278 myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')), 270 myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')),
279 hsi: parseFloat($("#hsi").jqxNumberInput('decimal')), 271 hsi: parseFloat($("#hsi").jqxNumberInput('decimal')),
280 //useat: $("#useat").val(),
281 type: $("#type").val(), 272 type: $("#type").val(),
282 form: $("#form").val(), 273 form: $("#form").val(),
283 notes: $("#notes").val(), 274 notes: $("#notes").val(),
284 origin: $("#origin").val(), 275 origin: $("#origin").val(),
285 substitutes: $("#substitutes").val(), 276 substitutes: $("#substitutes").val(),
286 always_on_stock: $("#always_on_stock").val(), 277 always_on_stock: $("#always_on_stock").val(),
287 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')), 278 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')),
288 cost: parseFloat($("#cost").jqxNumberInput('decimal')), 279 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
289 production_date: $("#production_date").val(), 280 production_date: $("#production_date").val(),
290 tht_date: $("#tht_date").val(), 281 tht_date: $("#tht_date").val(),
291 //supplier_rec: parseFloat($("#supplier_rec").jqxNumberInput('decimal')),
292 total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal')) 282 total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal'))
293 }; 283 };
294 $('#jqxgrid').jqxGrid('updaterow', rowID, row); 284 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
295 $("#popupWindow").jqxWindow('hide'); 285 $("#popupWindow").jqxWindow('hide');
296 } else { 286 } else {
303 humulene: parseFloat($("#humulene").jqxNumberInput('decimal')), 293 humulene: parseFloat($("#humulene").jqxNumberInput('decimal')),
304 caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')), 294 caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')),
305 cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')), 295 cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')),
306 myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')), 296 myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')),
307 hsi: parseFloat($("#hsi").jqxNumberInput('decimal')), 297 hsi: parseFloat($("#hsi").jqxNumberInput('decimal')),
308 //useat: $("#useat").val(),
309 type: $("#type").val(), 298 type: $("#type").val(),
310 form: $("#form").val(), 299 form: $("#form").val(),
311 notes: $("#notes").val(), 300 notes: $("#notes").val(),
312 origin: $("#origin").val(), 301 origin: $("#origin").val(),
313 substitutes: $("#substitutes").val(), 302 substitutes: $("#substitutes").val(),
314 always_on_stock: $("#always_on_stock").val(), 303 always_on_stock: $("#always_on_stock").val(),
315 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')), 304 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')),
316 cost: parseFloat($("#cost").jqxNumberInput('decimal')), 305 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
317 production_date: $("#production_date").val(), 306 production_date: $("#production_date").val(),
318 tht_date: $("#tht_date").val(), 307 tht_date: $("#tht_date").val(),
319 //supplier_rec: parseFloat($("#supplier_rec").jqxNumberInput('decimal')),
320 total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal')) 308 total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal'))
321 }; 309 };
322 $('#jqxgrid').jqxGrid('addrow', null, newrow); 310 $('#jqxgrid').jqxGrid('addrow', null, newrow);
323 $("#popupWindow").jqxWindow('hide'); 311 $("#popupWindow").jqxWindow('hide');
324 } 312 }

mercurial