|
1 /***************************************************************************** |
|
2 * Copyright (C) 2018 |
|
3 * |
|
4 * Michiel Broek <mbroek at mbse dot eu> |
|
5 * |
|
6 * This file is part of BMS |
|
7 * |
|
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 |
|
10 * Free Software Foundation; either version 2, or (at your option) any |
|
11 * later version. |
|
12 * |
|
13 * BrewCloud is distributed in the hope that it will be useful, but |
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 * General Public License for more details. |
|
17 * |
|
18 * You should have received a copy of the GNU General Public License |
|
19 * along with ThermFerm; see the file COPYING. If not, write to the Free |
|
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
|
21 *****************************************************************************/ |
|
22 |
|
23 |
|
24 $(document).ready(function () { |
|
25 var source = { |
|
26 datatype: "json", |
|
27 cache: false, |
|
28 datafields: [ |
|
29 { name: 'record', type: 'number' }, |
|
30 { name: 'name', type: 'string' }, |
|
31 { name: 'code', type: 'string' }, |
|
32 { name: 'birth', type: 'string' }, |
|
33 { name: 'stage', type: 'string' }, |
|
34 ], |
|
35 id: 'record', |
|
36 url: "includes/db_product.php?select=inprod" |
|
37 }; |
|
38 var dataAdapter = new $.jqx.dataAdapter(source); |
|
39 // initialize jqxGrid |
|
40 $("#jqxgrid").jqxGrid({ |
|
41 width: 1280, |
|
42 height: 630, |
|
43 source: dataAdapter, |
|
44 theme: theme, |
|
45 showstatusbar: true, |
|
46 localization: getLocalization(), |
|
47 renderstatusbar: function (statusbar) { |
|
48 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
|
49 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>"); |
|
50 container.append(addButton); |
|
51 statusbar.append(container); |
|
52 addButton.jqxButton({ theme: theme, width: 120, height: 20 }); |
|
53 // add new recipe. |
|
54 addButton.click(function (event) { |
|
55 var url= "prod_new.php?return=prod_inprod.php"; |
|
56 window.location.href = url; |
|
57 }); |
|
58 }, |
|
59 filterable: true, |
|
60 filtermode: 'excel', |
|
61 columns: [ |
|
62 { text: 'Datum', datafield: 'birth', width: 120 }, |
|
63 { text: 'Code', datafield: 'code', width: 120 }, |
|
64 { text: 'Naam', datafield: 'name' }, |
|
65 { text: 'Fase', datafield: 'stage', width: 150 }, |
|
66 { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { |
|
67 return "Wijzig"; |
|
68 }, buttonclick: function (row) { |
|
69 var datarecord = dataAdapter.records[row]; |
|
70 var url= "prod_edit.php?record=" + datarecord.record + "&select=inprod&return=prod_inprod.php"; |
|
71 window.location.href = url; |
|
72 } |
|
73 } |
|
74 ], |
|
75 }); |
|
76 }); |