www/js/inv_suppliers.js

Sun, 12 Aug 2018 21:24:33 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 12 Aug 2018 21:24:33 +0200
changeset 11
d341f0a91a91
parent 10
606b4af8f918
child 41
a26a3d63e90f
permissions
-rw-r--r--

Added fermentable inventory

10
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * Copyright (C) 2014-2018
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of Brewery Management System
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
11
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
24
10
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 function createDelElements() {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 $('#eventWindow').jqxWindow({
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 theme: theme,
11
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
28 position: { x: 490, y: 210 },
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
29 width: 300,
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
30 height: 145,
10
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 resizable: false,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 isModal: true,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 modalOpacity: 0.4,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 okButton: $('#delOk'),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 cancelButton: $('#delCancel'),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 initContent: function () {
11
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
37 $('#delOk').jqxButton({ width: '65px', theme: theme });
10
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 $('#delCancel').jqxButton({ width: '65px', theme: theme });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 $('#delCancel').focus();
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 $('#eventWindow').jqxWindow('hide');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45
11
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
46
10
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 $(document).ready(function () {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 var url = "includes/db_inventory_suppliers.php";
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 // prepare the data
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 var source = {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 datatype: "json",
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 cache: false,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 datafields: [
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 { name: 'record', type: 'number' },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 { name: 'name', type: 'string' },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 { name: 'address', type: 'string' },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 { name: 'city', type: 'string' },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 { name: 'zip', type: 'string' },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 { name: 'country', type: 'string' },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 { name: 'website', type: 'string' },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 { name: 'email', type: 'string' },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 { name: 'phone', type: 'string' },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 { name: 'notes', type: 'string' }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 ],
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 id: 'record',
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 url: url,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 deleterow: function (rowid, commit) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 // synchronize with the server - send delete command
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 var data = "delete=true&" + $.param({ record: rowid });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 $.ajax({
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 dataType: 'json',
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 url: url,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 cache: false,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 data: data,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 success: function (data, status, xhr) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 // delete command is executed.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 commit(true);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 error: function (jqXHR, textStatus, errorThrown) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 commit(false);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 addrow: function (rowid, rowdata, position, commit) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 var data = "insert=true&" + $.param(rowdata);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 $.ajax({
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 dataType: 'json',
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 url: url,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 cache: false,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 data: data,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 success: function (data, status, xhr) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 commit(true);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 error: function(jqXHR, textStatus, errorThrown) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 commit(false);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 updaterow: function (rowid, rowdata, commit) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 var data = "update=true&" + $.param(rowdata);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 $.ajax({
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 dataType: 'json',
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 url: url,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 cache: false,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 data: data,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 success: function (data, status, xhr) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 // update command is executed.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 commit(true);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 error: function(jqXHR, textStatus, errorThrown) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 commit(false);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 };
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 // initialize the input fields.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 $("#name").jqxInput({ theme: theme, width: 250, height: 23 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 $("#address").jqxInput({ theme: theme, width: 250, height: 23 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 $("#zip").jqxInput({ theme: theme, width: 120, height: 23 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 $("#city").jqxInput({ theme: theme, width: 250, height: 23 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 $("#country").jqxInput({ theme: theme, width: 250, height: 23 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 $("#website").jqxInput({ theme: theme, width: 250, height: 23 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 $("#email").jqxInput({ theme: theme, width: 250, height: 23 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 $("#phone").jqxInput({ theme: theme, width: 120, height: 23 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 $("#notes").jqxInput({ theme: theme, width: 640, height: 48 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 var dataAdapter = new $.jqx.dataAdapter(source);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 var editrow = -1;
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 // initialize jqxGrid
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 $("#jqxgrid").jqxGrid({
11
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
131 width: 1280,
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
132 height: 630,
10
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 source: dataAdapter,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 theme: theme,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 showstatusbar: true,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 renderstatusbar: function (statusbar) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 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>");
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 container.append(addButton);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 statusbar.append(container);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 addButton.jqxButton({ width: 60, height: 20 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 // add new row.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 addButton.click(function (event) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 editrow = -1;
11
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
145 $("#popupWindow").jqxWindow({ position: { x: 230, y: 10 } });
10
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 $("#name").val('');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 $("#address").val('');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 $("#city").val('');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 $("#zip").val('');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 $("#country").val('');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 $("#website").val('');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 $("#email").val('');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 $("#phone").val('');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 $("#notes").val('');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 $("#popupWindow").jqxWindow('open');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 },
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 filterable: true,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 filtermode: 'excel',
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 columns: [
11
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
161 { text: 'Leverancier naam', datafield: 'name', width: 250 },
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
162 { text: 'Adres', datafield: 'address', width: 300 },
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
163 { text: 'Plaats', datafield: 'city', width: 250 },
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
164 { text: 'Land', datafield: 'country', width: 250 },
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
165 { text: 'Telefoon', datafield: 'phone', width: 100 },
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
166 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', cellsrenderer: function () {
10
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 return "Edit";
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 }, buttonclick: function (row) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 // open the popup window when the user clicks a button.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 editrow = row;
11
d341f0a91a91 Added fermentable inventory
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
171 $("#popupWindow").jqxWindow({ position: { x: 230, y: 10 } });
10
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 // get the clicked row's data and initialize the input fields.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 $("#name").val(dataRecord.name);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 $("#address").val(dataRecord.address);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 $("#city").val(dataRecord.city);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 $("#zip").val(dataRecord.zip);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 $("#country").val(dataRecord.country);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 $("#website").val(dataRecord.website);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 $("#email").val(dataRecord.email);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 $("#phone").val(dataRecord.phone);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 $("#notes").val(dataRecord.notes);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 // show the popup window.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 $("#popupWindow").jqxWindow('open');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 ]
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189 // initialize the popup window and buttons.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 $("#popupWindow").jqxWindow({
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 width: 860, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.40
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 $("#popupWindow").on('open', function () {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 $("#name").jqxInput('selectAll');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 $("#Delete").jqxButton({ theme: theme });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 $("#Delete").click(function () {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 if (editrow >= 0) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 // Open a popup to confirm this action.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 $('#eventWindow').jqxWindow('open');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 $("#delOk").click(function () {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 $("#jqxgrid").jqxGrid('deleterow', rowID);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 $("#popupWindow").jqxWindow('hide');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 $("#Cancel").jqxButton({ theme: theme });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 $("#Save").jqxButton({ theme: theme });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 // update the edited row when the user clicks the 'Save' button.
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 $("#Save").click(function () {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 if (editrow >= 0) {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 var row = {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 record: rowID,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 name: $("#name").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 address: $("#address").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 city: $("#city").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 zip: $("#zip").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 country: $("#country").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 website: $("#website").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 email: $("#email").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 phone: $("#phone").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 notes: $("#notes").val()
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 };
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 $("#popupWindow").jqxWindow('hide');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 } else {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 // Insert a record
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 var newrow = {
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 record: -1,
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 name: $("#name").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 address: $("#address").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 city: $("#city").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 zip: $("#zip").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 country: $("#country").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 website: $("#website").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 email: $("#email").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 phone: $("#phone").val(),
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 notes: $("#notes").val()
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 };
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 $('#jqxgrid').jqxGrid('addrow', null, newrow);
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 $("#popupWindow").jqxWindow('hide');
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 }
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 createDelElements();
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 });
606b4af8f918 Start of the merge with another unfinished project
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248

mercurial