119 commit(false); |
121 commit(false); |
120 } |
122 } |
121 }); |
123 }); |
122 } |
124 } |
123 }; |
125 }; |
124 var srcUse = [ "Boil", "Dry Hop", "Mash", "First Wort", "Aroma" ]; |
126 // var srcUse = [ "Boil", "Dry Hop", "Mash", "First Wort", "Aroma" ]; // Only in recipes |
125 var srcType = [ "Bittering", "Aroma", "Both" ]; |
127 var srcType = [ "Bittering", "Aroma", "Both" ]; |
126 var srcForm = [ "Pellet", "Plug", "Leaf" ]; |
128 var srcForm = [ "Pellet", "Plug", "Leaf" ]; |
127 // initialize the input fields. |
129 // initialize the input fields. |
128 $("#name").jqxInput({ theme: theme, width: 250, height: 23 }); |
130 $("#name").jqxInput({ theme: theme, width: 250, height: 23 }); |
129 $("#alpha").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
131 $("#alpha").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
130 $("#beta").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
132 $("#beta").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
131 $("#humulene").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
133 $("#humulene").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 }); |
134 $("#caryophyllene").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 }); |
135 $("#cohumulone").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 }); |
136 $("#myrcene").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
135 |
137 $("#hsi").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
136 $("#useat").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 130 }); |
138 |
137 $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 130 }); |
139 // $("#useat").jqxDropDownList({ theme: theme, source: srcUse, width: 90, height: 23, dropDownHeight: 130 }); // Only in recipes |
138 $("#form").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 130 }); |
140 $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 95 }); |
139 $("#notes").jqxInput({ theme: theme, width: 640, height: 48 }); |
141 $("#form").jqxDropDownList({ theme: theme, source: srcForm, width: 90, height: 23, dropDownHeight: 95 }); |
|
142 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); |
140 $("#origin").jqxInput({ theme: theme, width: 250, height: 23 }); |
143 $("#origin").jqxInput({ theme: theme, width: 250, height: 23 }); |
141 $("#substitutes").jqxInput({ theme: theme, width: 250, height: 23 }); |
144 $("#substitutes").jqxInput({ theme: theme, width: 250, height: 23 }); |
142 $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
145 $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
143 $("#inventory").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
146 $("#inventory").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
144 $("#production_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); |
147 $("#production_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); |
145 $("#cost").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); |
148 $("#cost").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); |
146 $("#tht_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); |
149 $("#tht_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); |
147 $("#supplier_rec").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
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 }); |
148 var dataAdapter = new $.jqx.dataAdapter(source); |
152 var dataAdapter = new $.jqx.dataAdapter(source); |
149 var editrow = -1; |
153 var editrow = -1; |
150 // initialize jqxGrid |
154 // initialize jqxGrid |
151 $("#jqxgrid").jqxGrid({ |
155 $("#jqxgrid").jqxGrid({ |
152 width: 1280, |
156 width: 1280, |
153 height: 630, |
157 height: 630, |
154 source: dataAdapter, |
158 source: dataAdapter, |
155 theme: theme, |
159 theme: theme, |
|
160 //altrows: true, |
156 showstatusbar: true, |
161 showstatusbar: true, |
|
162 localization: getLocalization(), |
157 renderstatusbar: function (statusbar) { |
163 renderstatusbar: function (statusbar) { |
158 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
164 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
159 var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Add</span></div>"); |
165 var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Add</span></div>"); |
160 container.append(addButton); |
166 container.append(addButton); |
161 statusbar.append(container); |
167 statusbar.append(container); |
162 addButton.jqxButton({ width: 60, height: 20 }); |
168 addButton.jqxButton({ width: 60, height: 20 }); |
163 // add new row. |
169 // add new row. |
164 addButton.click(function (event) { |
170 addButton.click(function (event) { |
165 editrow = -1; |
171 editrow = -1; |
166 $("#popupWindow").jqxWindow({ position: { x: 80, y: 10 } }); |
172 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); |
167 $("#name").val(''); |
173 $("#name").val(''); |
168 $("#alpha").val(''); |
174 $("#alpha").val(''); |
169 $("#beta").val(''); |
175 $("#beta").val(''); |
170 $("#humulene").val(''); |
176 $("#humulene").val(''); |
171 $("#caryophyllene").val(''); |
177 $("#caryophyllene").val(''); |
172 $("#cohumulone").val(''); |
178 $("#cohumulone").val(''); |
173 $("#myrcene").val(''); |
179 $("#myrcene").val(''); |
|
180 $("#hsi").val(''); |
174 $("#useat").val('Boil'); |
181 $("#useat").val('Boil'); |
175 $("#type").val('Bittering'); |
182 $("#type").val('Bittering'); |
176 $("#form").val('Pellet'); |
183 $("#form").val('Pellet'); |
177 $("#notes").val(''); |
184 $("#notes").val(''); |
178 $("#origin").val(''); |
185 $("#origin").val(''); |
181 $("#inventory").val(''); |
188 $("#inventory").val(''); |
182 $("#cost").val(''); |
189 $("#cost").val(''); |
183 $("#production_date").val(''); |
190 $("#production_date").val(''); |
184 $("#tht_date").val(''); |
191 $("#tht_date").val(''); |
185 $("#supplier_rec").val(''); |
192 $("#supplier_rec").val(''); |
|
193 $("#total_oil").val(''); |
186 $("#popupWindow").jqxWindow('open'); |
194 $("#popupWindow").jqxWindow('open'); |
187 }); |
195 }); |
188 }, |
196 }, |
189 filterable: true, |
197 filterable: true, |
190 filtermode: 'excel', |
198 filtermode: 'excel', |
191 columns: [ |
199 columns: [ |
192 { text: 'Hop Name', datafield: 'name', width: 250 }, |
200 { text: 'Hop Naam', datafield: 'name', width: 250 }, |
193 { text: 'Type', datafield: 'type', width: 90 }, |
201 { text: 'Soort', datafield: 'type', width: 90 }, |
194 { text: 'Alpha', datafield: 'alpha', width: 70, cellsalign: 'right', cellsformat: 'c2' }, |
202 { text: 'Vorm', datafield: 'form', width: 90 }, |
195 { text: 'Origin', datafield: 'origin', width: 150 }, |
203 { text: 'Alpha %', datafield: 'alpha', width: 80, cellsalign: 'right', cellsformat: 'p1' }, |
196 { text: 'Inv.', datafield: 'inventory', width: 70, cellsalign: 'right' }, |
204 { text: 'Beta %', datafield: 'beta', width: 80, cellsalign: 'right', cellsformat: 'p1' }, |
197 { text: 'Cost', datafield: 'cost', width: 70, cellsalign: 'right', cellsformat: 'c2' }, |
205 { text: 'Cohumuloon %%', datafield: 'cohumulone', width: 80, cellsalign: 'right', cellsformat: 'p1' }, |
|
206 { text: 'HSI', datafield: 'hsi', width: 60, cellsalign: 'right', cellsformat: 'f1' }, |
|
207 { text: 'Herkomst', datafield: 'origin', width: 150 }, |
|
208 { text: 'Oogst datum', datafield: 'production_date', width: 100 }, |
|
209 { text: 'Voorraad', datafield: 'inventory', width: 70, cellsalign: 'right' }, |
|
210 { text: 'Prijs /kg', datafield: 'cost', width: 70, cellsalign: 'right', cellsformat: 'c2' }, |
198 { text: 'Edit', datafield: 'Edit', columntype: 'button', cellsrenderer: function () { |
211 { text: 'Edit', datafield: 'Edit', columntype: 'button', cellsrenderer: function () { |
199 return "Edit"; |
212 return "Edit"; |
200 }, buttonclick: function (row) { |
213 }, buttonclick: function (row) { |
201 // open the popup window when the user clicks a button. |
214 // open the popup window when the user clicks a button. |
202 editrow = row; |
215 editrow = row; |
203 $("#popupWindow").jqxWindow({ position: { x: 80, y: 10 } }); |
216 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); |
204 // get the clicked row's data and initialize the input fields. |
217 // get the clicked row's data and initialize the input fields. |
205 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
218 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
206 $("#name").val(dataRecord.name); |
219 $("#name").val(dataRecord.name); |
207 $("#alpha").val(dataRecord.alpha); |
220 $("#alpha").val(dataRecord.alpha); |
208 $("#beta").val(dataRecord.beta); |
221 $("#beta").val(dataRecord.beta); |
209 $("#humulene").val(dataRecord.humulene); |
222 $("#humulene").val(dataRecord.humulene); |
210 $("#caryophyllene").val(dataRecord.caryophyllene); |
223 $("#caryophyllene").val(dataRecord.caryophyllene); |
211 $("#cohumulone").val(dataRecord.cohumulone); |
224 $("#cohumulone").val(dataRecord.cohumulone); |
212 $("#myrcene").val(dataRecord.myrcene); |
225 $("#myrcene").val(dataRecord.myrcene); |
|
226 $("#hsi").val(dataRecord.hsi); |
213 $("#useat").val(dataRecord.useat); |
227 $("#useat").val(dataRecord.useat); |
214 $("#type").val(dataRecord.type); |
228 $("#type").val(dataRecord.type); |
215 $("#form").val(dataRecord.form); |
229 $("#form").val(dataRecord.form); |
216 $("#notes").val(dataRecord.notes); |
230 $("#notes").val(dataRecord.notes); |
217 $("#origin").val(dataRecord.origin); |
231 $("#origin").val(dataRecord.origin); |