-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclientes.htm
More file actions
222 lines (199 loc) · 9.34 KB
/
clientes.htm
File metadata and controls
222 lines (199 loc) · 9.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<!DOCTYPE html>
<html lang="en">
<head>
<title id='Description'>CLIENTES</title>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="en">
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="stylesheet" href="styles/reset.css" type="text/css" />
<link rel="stylesheet" href="styles/app.css" type="text/css" />
<link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />
<script type="text/javascript" src="scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="jqwidgets/jqx-all.js"></script>
<script type="text/javascript">
if (!window.showModalDialog) {
window.showModalDialog = function (arg1, arg2, arg3) {
var w;
var h;
var resizable = "no";
var scroll = "no";
var status = "no";
// get the modal specs
var mdattrs = arg3.split(";");
for (i = 0; i < mdattrs.length; i++) {
var mdattr = mdattrs[i].split(":");
var n = mdattr[0];
var v = mdattr[1];
if (n) { n = n.trim().toLowerCase(); }
if (v) { v = v.trim().toLowerCase(); }
if (n == "dialogheight") {
h = v.replace("px", "");
} else if (n == "dialogwidth") {
w = v.replace("px", "");
} else if (n == "resizable") {
resizable = v;
} else if (n == "scroll") {
scroll = v;
} else if (n == "status") {
status = v;
}
}
var left = window.screenX + (window.outerWidth / 2) - (w / 2);
var top = window.screenY + (window.outerHeight / 2) - (h / 2);
var targetWin = window.open(arg1, arg1, 'toolbar=no, location=no, directories=no, status=' + status + ', menubar=no, scrollbars=' + scroll + ', resizable=' + resizable + ', copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
targetWin.focus();
};
}
$(document).ready(function () {
// prepare the data
var data = {};
var idjuridico =
[
"V1234567890", "J1234567890", "P1234567890", "E1234567890", "V1234567890", "J1234567890", "V1234567890", "V1234567890", "V1234567890", "V1234567890", "J1234567890", "J1234567890", "V1234567890", "J1234567890", "V1234567890", "J1234567890", "J1234567890", "J1234567890"
];
var razonsocial =
[
"Fuller C.A.", "Davolio F.P.", "Burke C.A.", "Murphy C.A.", "Nagase S.A.", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler de algo C.A.", "Bein Coporation", "Petersen S.R.L.", "Sergio Rossi", "Olga de Vileid", "Saylor F.P.", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vel ", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vel "
];
var generaterow = function (i) {
var row = {};
row["idjuridico"] = idjuridico[Math.floor(Math.random() * idjuridico.length)];
row["razonsocial"] = razonsocial[Math.floor(Math.random() * razonsocial.length)];
return row;
}
for (var i = 0; i < 10; i++) {
var row = generaterow(i);
data[i] = row;
}
var source =
{
localdata: data,
datatype: "local",
datafields:
[
{ name: 'idjuridico', type: 'string' },
{ name: 'razonsocial', type: 'string' }
],
addrow: function (rowid, rowdata, position, commit) {
// synchronize with the server - send insert command
// call commit with parameter true if the synchronization with the server is successful
//and with parameter false if the synchronization failed.
// you can pass additional argument to the commit callback which represents the new ID if it is generated from a DB.
commit(true);
},
deleterow: function (rowid, commit) {
// synchronize with the server - send delete command
// call commit with parameter true if the synchronization with the server is successful
//and with parameter false if the synchronization failed.
commit(true);
},
updaterow: function (rowid, newdata, commit) {
// synchronize with the server - send update command
// call commit with parameter true if the synchronization with the server is successful
// and with parameter false if the synchronization failed.
commit(true);
}
};
var dataAdapter = new $.jqx.dataAdapter(source);
// initialize jqxGrid
$("#jqxgrid").jqxGrid(
{
width: 350,
altrows: true,
source: dataAdapter,
showtoolbar: false,
rendertoolbar: function (toolbar) {
var me = this;
// create new rows.
/* $("#editcustomer").on('click', function () {
$("#jqxgrid").jqxGrid('beginupdate');
for (var i = 0; i < 10; i++) {
var datarow = generaterow();
var commit = $("#jqxgrid").jqxGrid('addrow', null, datarow);
}
$("#jqxgrid").jqxGrid('endupdate');
});
*/
},
columns: [
{ text: 'ID Juridico', datafield: 'idjuridico', width: 100, cellsalign: 'right'},
{ text: 'Razon Social', datafield: 'razonsocial' }
]
});
$("#codigo").jqxRadioButton({ checked: true});
$("#codigo2").jqxRadioButton({ checked: true});
$("#description").jqxRadioButton({ });
$("#idjuridico").jqxRadioButton({ });
$("#jqxWidget").jqxButtonGroup({ mode: 'default', width:"350px"});
$("#jqxWidget").on('buttonclick', function (event) {
switch(event.args.button[0].id) {
case 'updatecustomer':
var datarow = generaterow();
var selectedrowindex = $("#jqxgrid").jqxGrid('getselectedrowindex');
var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount;
if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
var id = $("#jqxgrid").jqxGrid('getrowid', selectedrowindex);
var commit = $("#jqxgrid").jqxGrid('updaterow', id, datarow);
$("#jqxgrid").jqxGrid('ensurerowvisible', selectedrowindex);
}
break;
case 'newcustomer':
var datarow = generaterow();
var commit = $("#jqxgrid").jqxGrid('addrow', null, datarow);
break;
case 'editcustomer':
showModalDialog ("clientes_zonas.htm", null, "dialogWidth:710px; dialogHeight:360px;");
//window.open ("clientes_zonas.htm", null, ",modal=yes, height=360, width=710, status=no, toolbar=no, menubar=no, directories=no, location=no");
var selectedrowindex = $("#jqxgrid").jqxGrid('getselectedrowindex');
var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount;
if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
var id = $("#jqxgrid").jqxGrid('getrowid', selectedrowindex);
var data = $('#jqxgrid').jqxGrid('getrowdatabyid', id);
console.log("selectedrowindex: " + selectedrowindex);
console.log("id: " + id);
console.log("rowscount: " + rowscount);
console.log("data.idjuridico: " + data.idjuridico);
console.log("data.razonsocial: " + data.razonsocial);
// commit = $("#jqxgrid").jqxGrid('updaterow', id, datarow);
}
break;
case 'deletecustomer':
var selectedrowindex = $("#jqxgrid").jqxGrid('getselectedrowindex');
var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount;
if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
var id = $("#jqxgrid").jqxGrid('getrowid', selectedrowindex);
var commit = $("#jqxgrid").jqxGrid('deleterow', id);
}
break;
default:
}
});
});
setTimeout(function(){
//window.location.reload(1);
}, 1000);
</script>
</head>
<body class='default'>
<div id="left" style="width: 350px;">
<div id='jqxWidget'>
<button style="" id="newcustomer">Nuevo</button>
<button style="" id="editcustomer">Editar</button>
<button style="" id="updatecustomer">Guardar</button>
<button style="" id="deletecustomer">Borrar</button>
</div>
<div width="100%" style="clear:both;">
<div style="margin-top: 10px;" id="codigo">Código</div>
<div style="margin-top: 10px;" id="description">Razon Social</div>
<div style="margin-top: 10px;" id="idjuridico">ID Juridico</div>
</div>
<div width="100%">
<!-- <span style="margin-top: 5px; margin-right: 4px;">A buscar: </span> -->
<input class="jqx-input jqx-widget-content jqx-rc-all' id='searchField' type='text' style='height: 23px;" width="350" />
</div>
<div id="jqxgrid">
</div>
</div>
</body>
</html>