1
|
Ext.define('mdgenerator', {});
|
2
|
|
3
|
mdgenerator.createFormCard = function (tableName, layout, param_, renderTo, isDisplay, record, act) {
|
4
|
var name = 'MinovaGridFormEdit';
|
5
|
var save = true;
|
6
|
var edit = false;
|
7
|
var delete_ = true;
|
8
|
var back = false;
|
9
|
|
10
|
if (isDisplay) {
|
11
|
name = 'MinovaGridFormDisplay'
|
12
|
} else {
|
13
|
save = false;
|
14
|
edit = true;
|
15
|
delete_ = false;
|
16
|
back = false;
|
17
|
}
|
18
|
var userAction = MinovaUtil.GetActionMenu();
|
19
|
if (userAction != '1') {
|
20
|
save = true;
|
21
|
edit = true;
|
22
|
delete_ = true;
|
23
|
}
|
24
|
if (tableName.toLowerCase().substring(0, 5) == 'phrrc') {
|
25
|
Ext.Ajax.request({
|
26
|
async : false,
|
27
|
method : 'POST',
|
28
|
url : '/UserControl/GetStore',
|
29
|
params : {
|
30
|
tableName : 'phrpa0015',
|
31
|
param : 'ApplicantID[equal]' + getParam('app')
|
32
|
},
|
33
|
success : function (response) {
|
34
|
var results = Ext.decode(response.responseText);
|
35
|
data_ = results.data;
|
36
|
if (data_.length > 0) {
|
37
|
save = true;
|
38
|
edit = true;
|
39
|
delete_ = true;
|
40
|
}
|
41
|
}
|
42
|
});
|
43
|
}
|
44
|
Ext.create('Ext.form.Panel', {
|
45
|
renderTo : renderTo,
|
46
|
name : name + tableName,
|
47
|
formMD : tableName,
|
48
|
act : null,
|
49
|
items : [{
|
50
|
xtype : 'minovaForm',
|
51
|
name : name,
|
52
|
tableName : tableName,
|
53
|
margin : '0 0 10 0',
|
54
|
isDisplay : isDisplay,
|
55
|
//hidden:true
|
56
|
buttons : [{
|
57
|
text : 'Save',
|
58
|
hidden : save,
|
59
|
act : act,
|
60
|
//margin: '0 3 15 0', //(top, right, bottom, left).
|
61
|
name : 'btnSaveMD',
|
62
|
iconCls : 'fa-save',
|
63
|
style : 'font-family: FontAwesome',
|
64
|
handler : function () {
|
65
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
66
|
//p_.mask('Loading...');
|
67
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
68
|
var grid_ = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
69
|
//frm.mask('loading..');
|
70
|
var panelInt = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
71
|
if (panelInt) {
|
72
|
panelInt.mask('Loading..');
|
73
|
}
|
74
|
|
75
|
if (frm.getForm().isValid()) {
|
76
|
Ext.Ajax.request({
|
77
|
method : 'POST',
|
78
|
//async: false,
|
79
|
url : '/Devt/SaveTable',
|
80
|
params : {
|
81
|
tableName : tableName,
|
82
|
data : Ext.encode(frm.getValues()),
|
83
|
action : frm.act,
|
84
|
},
|
85
|
waitMsg : 'Saving Data...',
|
86
|
success : function (response) {
|
87
|
var result = Ext.decode(response.responseText);
|
88
|
if (result.success) {
|
89
|
|
90
|
MinovaMessage('Not Null', '000006', '', 'S');
|
91
|
var menu = Ext.ComponentQuery.query('[name = gridMenuMD]')[0];
|
92
|
var s = menu.getStore();
|
93
|
|
94
|
Ext.Ajax.request({
|
95
|
async : false,
|
96
|
method : 'POST',
|
97
|
url : '/UserControl/GetStore',
|
98
|
params : {
|
99
|
tableName : ' PDSPA0013 ',
|
100
|
param : "ModuleType='" + MinovaUtil.GetModuleType() + "' AND Language='" + getParam("Lang") + "'"
|
101
|
|
102
|
},
|
103
|
success : function (response) {
|
104
|
var results = Ext.decode(response.responseText);
|
105
|
var data_ = results.data;
|
106
|
s.loadData(results.data);
|
107
|
//s.reload()
|
108
|
}
|
109
|
});
|
110
|
grid_.getStore().reload();
|
111
|
|
112
|
frm.setHidden(true);
|
113
|
grid_.setHidden(false);
|
114
|
var p = Ext.ComponentQuery.query('[name = PanelMdDetail]')[0];
|
115
|
p.setHeight(390);
|
116
|
if (getParam('ApplicantID') != 'null') {
|
117
|
var _param = {
|
118
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
119
|
methodName : 'SendMailChangeMD',
|
120
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
121
|
|
122
|
};
|
123
|
|
124
|
var results = null;
|
125
|
Ext.Ajax.request({
|
126
|
method : 'post',
|
127
|
type : 'ajax',
|
128
|
params : _param,
|
129
|
url : '/InvokeService/Invoke/',
|
130
|
loadMask : {
|
131
|
msg : 'please wait...'
|
132
|
},
|
133
|
success : function (response) {}
|
134
|
});
|
135
|
}
|
136
|
frm.destroy();
|
137
|
|
138
|
} else {
|
139
|
|
140
|
//MinovaMessage(' Not Null ', ' 000005 ', result.message.text, 'E');
|
141
|
//1=error 2=warning 4=confirm
|
142
|
var msgType = result.message.type;
|
143
|
if (msgType == 4) {
|
144
|
mdConfirm(tableName, Ext.encode(frm.getValues()), frm.act, result.message.Id)
|
145
|
} else {
|
146
|
MinovaMessage(' Not Null ', ' 000005 ', result.message.text, 'E');
|
147
|
}
|
148
|
}
|
149
|
|
150
|
},
|
151
|
failure : function (response) {
|
152
|
pnl.unmask();
|
153
|
var result = Ext.decode(response.responseText);
|
154
|
console.log(result);
|
155
|
}
|
156
|
});
|
157
|
|
158
|
} else {
|
159
|
var param_ = cekMandatoryIsNull(tableName);
|
160
|
if (param_ != "") {
|
161
|
MinovaMessage(' Not Null ', ' 000009 ', param_, 'E');
|
162
|
} else {
|
163
|
// ada field yang error
|
164
|
var error_ = getErrorFields(tableName);
|
165
|
if (error_ != ' ') {
|
166
|
MinovaMessage(' title ', ' 000005 ', error_, 'E');
|
167
|
}
|
168
|
|
169
|
}
|
170
|
}
|
171
|
//frm.unmask();
|
172
|
if (panelInt) {
|
173
|
panelInt.unmask();
|
174
|
}
|
175
|
|
176
|
}
|
177
|
}, {
|
178
|
text : ' Delete ',
|
179
|
hidden : delete_,
|
180
|
//margin: ' 0 3 15 0 ', //(top, right, bottom, left).
|
181
|
iconCls : ' fa - trash - o ',
|
182
|
name : ' btnDeleteMD ',
|
183
|
style : ' font - family : FontAwesome ',
|
184
|
action : ' CRUDdelete ',
|
185
|
handler : function () {
|
186
|
|
187
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
188
|
var grid_ = Ext.ComponentQuery.query('[gridMD = ' + tableName + ']')[0];
|
189
|
MinovaMessage(' Message ', ' 000007 ', ' ', 'C', function (respone) {
|
190
|
if (respone == "yes") {
|
191
|
//frm.mask(' loading..');
|
192
|
|
193
|
if (frm.getForm().isValid()) {
|
194
|
Ext.Ajax.request({
|
195
|
async : false,
|
196
|
method : 'POST',
|
197
|
url : '/Devt/SaveTable',
|
198
|
params : {
|
199
|
tableName : tableName,
|
200
|
data : Ext.encode(frm.getValues()),
|
201
|
action : '2'
|
202
|
},
|
203
|
waitMsg : ' Saving Data...',
|
204
|
success : function (response) {
|
205
|
var result = Ext.decode(response.responseText);
|
206
|
var _FileID = frm.getForm().findField('FileID');
|
207
|
if (result.success) {
|
208
|
if (_FileID) {
|
209
|
var FileID_ = frm.getForm().findField('FileID').getValue();
|
210
|
var FileName_ = Ext.ComponentQuery.query('[uploadName=uploadName]')[0].getValue(); ;
|
211
|
var valFile = {
|
212
|
Id : FileID_,
|
213
|
FileName : FileName_
|
214
|
};
|
215
|
Ext.Ajax.request({
|
216
|
async : false,
|
217
|
method : 'POST',
|
218
|
url : '/Devt/SaveTable',
|
219
|
params : {
|
220
|
tableName : 'SFILECATALOG',
|
221
|
data : Ext.encode(valFile),
|
222
|
action : '2'
|
223
|
},
|
224
|
});
|
225
|
}
|
226
|
|
227
|
MinovaMessage(' ', ' BSDEL ', ' ', ' S ');
|
228
|
var menu = Ext.ComponentQuery.query('[name = gridMenuMD]')[0];
|
229
|
var s = menu.getStore();
|
230
|
|
231
|
Ext.Ajax.request({
|
232
|
async : false,
|
233
|
method : 'POST',
|
234
|
url : '/UserControl/GetStore',
|
235
|
params : {
|
236
|
tableName : ' PDSPA0013 ',
|
237
|
param : "ModuleType='" + MinovaUtil.GetModuleType() + "' AND Language='" + getParam("Lang") + "'"
|
238
|
|
239
|
},
|
240
|
success : function (response) {
|
241
|
var results = Ext.decode(response.responseText);
|
242
|
var data_ = results.data;
|
243
|
s.loadData(results.data);
|
244
|
//s.reload()
|
245
|
}
|
246
|
});
|
247
|
|
248
|
grid_.getStore().reload();
|
249
|
|
250
|
frm.setHidden(true);
|
251
|
grid_.setHidden(false);
|
252
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
253
|
p.setHeight(390);
|
254
|
if (getParam('ApplicantID') != 'null') {
|
255
|
var _param = {
|
256
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
257
|
methodName : 'SendMailChangeMD',
|
258
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
259
|
|
260
|
};
|
261
|
|
262
|
var results = null;
|
263
|
Ext.Ajax.request({
|
264
|
method : 'post',
|
265
|
type : 'ajax',
|
266
|
params : _param,
|
267
|
url : '/InvokeService/Invoke/',
|
268
|
loadMask : {
|
269
|
msg : 'please wait...'
|
270
|
},
|
271
|
success : function (response) {}
|
272
|
});
|
273
|
}
|
274
|
frm.destroy();
|
275
|
|
276
|
} else {
|
277
|
|
278
|
//MinovaMessage('Not Null', '000005', result.message.text, 'E')
|
279
|
var msgType = result.message.type;
|
280
|
if (msgType == 4) {
|
281
|
mdConfirm(tableName, Ext.encode(frm.getValues()), '2', result.message.Id)
|
282
|
} else {
|
283
|
MinovaMessage(' Not Null ', ' 000005 ', result.message.text, 'E');
|
284
|
}
|
285
|
}
|
286
|
|
287
|
},
|
288
|
failure : function (response) {
|
289
|
pnl.unmask();
|
290
|
var result = Ext.decode(response.responseText);
|
291
|
console.log(result);
|
292
|
}
|
293
|
});
|
294
|
|
295
|
} else {
|
296
|
var param_ = cekMandatoryIsNull(tableName);
|
297
|
if (param_ != "") {
|
298
|
MinovaMessage('Not Null', '000009', param_, 'E');
|
299
|
} else {
|
300
|
// ada field yang error
|
301
|
var error_ = getErrorFields(tableName);
|
302
|
if (error_ != '') {
|
303
|
MinovaMessage('title', '000005', error_, 'E');
|
304
|
}
|
305
|
|
306
|
}
|
307
|
}
|
308
|
//frm.unmask();
|
309
|
}
|
310
|
|
311
|
});
|
312
|
|
313
|
}
|
314
|
|
315
|
}, {
|
316
|
text : 'Back to Grid',
|
317
|
hidden : back,
|
318
|
//margin: '0 3 15 0', //(top, right, bottom, left).
|
319
|
name : 'btnCancelMD',
|
320
|
iconCls : 'fa-reply',
|
321
|
style : 'font-family: FontAwesome',
|
322
|
viewForm : name + tableName,
|
323
|
handler : function () {
|
324
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
325
|
if (respone == "yes") {
|
326
|
Ext.ComponentQuery.query('[name=' + name + tableName + ']')[0].setHidden(true);
|
327
|
Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0].setHidden(false);
|
328
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
329
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
330
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = null;
|
331
|
}
|
332
|
var grid_ = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
333
|
Ext.ComponentQuery.query('[name=DetailMD]')[0].setTitle(grid_.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"));
|
334
|
p.setHeight(390);
|
335
|
var FormEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
336
|
if (FormEdit) {
|
337
|
FormEdit.destroy();
|
338
|
}
|
339
|
var FormDis = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0];
|
340
|
if (FormDis) {
|
341
|
FormDis.destroy();
|
342
|
}
|
343
|
}
|
344
|
});
|
345
|
|
346
|
}
|
347
|
}, {
|
348
|
text : 'Edit',
|
349
|
hidden : edit,
|
350
|
record : record,
|
351
|
//margin: '0 3 15 0', //(top, right, bottom, left).
|
352
|
//name: 'btnEditMD',
|
353
|
iconCls : 'fa-edit',
|
354
|
style : 'font-family: FontAwesome',
|
355
|
handler : function () {
|
356
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
357
|
p_.mask('Loading...');
|
358
|
var tbl = tableName;
|
359
|
var grid_ = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
360
|
var selecton_ = grid_.getView().getSelectionModel().getSelection()[0];
|
361
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
362
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(false)
|
363
|
} else {
|
364
|
mdgenerator.createFormCard(tableName, "", "", renderTo, false, selecton_, '1');
|
365
|
}
|
366
|
|
367
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm().setValues(selecton_.data);
|
368
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
369
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
370
|
if (tinggi < 330) {
|
371
|
tinggi = 330;
|
372
|
}
|
373
|
p.setHeight(tinggi + 100);
|
374
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHidden(true);
|
375
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = '1';
|
376
|
//Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setTitle('Edit - ' + grid_.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"))
|
377
|
Ext.ComponentQuery.query('[name=DetailMD]')[0].setTitle('Edit' + ' - ' + grid_.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"));
|
378
|
|
379
|
setValueAmountEncrypt(tbl);
|
380
|
p_.unmask();
|
381
|
setKeyDisabled(true);
|
382
|
}
|
383
|
},
|
384
|
],
|
385
|
|
386
|
},
|
387
|
]
|
388
|
});
|
389
|
|
390
|
Ext.ComponentQuery.query('[name=Main]')[0].lastView = Ext.ComponentQuery.query('[name=' + name + tableName + ']')[0];
|
391
|
}
|
392
|
|
393
|
mdgenerator.createFormCardLastRecord = function (tableName, layout, param_, renderTo, isDisplay, record, act) {
|
394
|
var name = 'MinovaGridFormEdit';
|
395
|
var save = true;
|
396
|
var edit = false;
|
397
|
var delete_ = true;
|
398
|
var back = false;
|
399
|
|
400
|
if (isDisplay) {
|
401
|
name = 'MinovaGridFormDisplay'
|
402
|
} else {
|
403
|
save = false;
|
404
|
edit = true;
|
405
|
delete_ = false;
|
406
|
back = false;
|
407
|
}
|
408
|
Ext.create('Ext.form.Panel', {
|
409
|
renderTo : renderTo,
|
410
|
name : name + tableName,
|
411
|
lastRecForm : name + tableName,
|
412
|
formMD : tableName,
|
413
|
act : null,
|
414
|
items : [{
|
415
|
xtype : 'minovaForm',
|
416
|
name : name,
|
417
|
tableName : tableName,
|
418
|
margin : '0 0 10 0',
|
419
|
isDisplay : isDisplay,
|
420
|
//hidden:true
|
421
|
buttons : [{
|
422
|
text : 'Save',
|
423
|
hidden : save,
|
424
|
act : act,
|
425
|
//margin: '0 3 15 0', //(top, right, bottom, left).
|
426
|
name : 'btnSaveMD',
|
427
|
iconCls : 'fa-save',
|
428
|
style : 'font-family: FontAwesome',
|
429
|
handler : function () {
|
430
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
431
|
var grid_ = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
432
|
frm.mask('loading..');
|
433
|
|
434
|
if (frm.getForm().isValid()) {
|
435
|
Ext.Ajax.request({
|
436
|
method : 'POST',
|
437
|
async : false,
|
438
|
url : '/Devt/SaveTable',
|
439
|
params : {
|
440
|
tableName : tableName,
|
441
|
data : Ext.encode(frm.getValues()),
|
442
|
action : frm.act
|
443
|
},
|
444
|
waitMsg : 'Saving Data...',
|
445
|
success : function (response) {
|
446
|
var result = Ext.decode(response.responseText);
|
447
|
if (result.success) {
|
448
|
|
449
|
MinovaMessage('Not Null', '000006', '', 'S');
|
450
|
var menu = Ext.ComponentQuery.query('[name = gridMenuMD]')[0];
|
451
|
var s = menu.getStore();
|
452
|
|
453
|
Ext.Ajax.request({
|
454
|
async : false,
|
455
|
method : 'POST',
|
456
|
url : '/UserControl/GetStore',
|
457
|
params : {
|
458
|
tableName : ' PDSPA0013 ',
|
459
|
param : "ModuleType='" + MinovaUtil.GetModuleType() + "' AND Language='" + getParam("Lang") + "'"
|
460
|
|
461
|
},
|
462
|
success : function (response) {
|
463
|
var results = Ext.decode(response.responseText);
|
464
|
var data_ = results.data;
|
465
|
s.loadData(results.data);
|
466
|
//s.reload()
|
467
|
}
|
468
|
});
|
469
|
|
470
|
grid_.getStore().reload();
|
471
|
frm.setHidden(true);
|
472
|
grid_.setHidden(false);
|
473
|
var p = Ext.ComponentQuery.query('[name = PanelMdDetail]')[0];
|
474
|
if (getParam('ApplicantID') != 'null') {
|
475
|
var _param = {
|
476
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
477
|
methodName : 'SendMailChangeMD',
|
478
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
479
|
|
480
|
};
|
481
|
|
482
|
var results = null;
|
483
|
Ext.Ajax.request({
|
484
|
method : 'post',
|
485
|
type : 'ajax',
|
486
|
params : _param,
|
487
|
url : '/InvokeService/Invoke/',
|
488
|
loadMask : {
|
489
|
msg : 'please wait...'
|
490
|
},
|
491
|
success : function (response) {}
|
492
|
});
|
493
|
}
|
494
|
p.setHeight(390);
|
495
|
|
496
|
} else {
|
497
|
|
498
|
//MinovaMessage(' Not Null ', ' 000005 ', result.message.text, 'E')
|
499
|
var msgType = result.message.type;
|
500
|
if (msgType == 4) {
|
501
|
mdConfirm(tableName, Ext.encode(frm.getValues()), frm.act, result.message.Id)
|
502
|
} else {
|
503
|
MinovaMessage(' Not Null ', ' 000005 ', result.message.text, 'E');
|
504
|
}
|
505
|
}
|
506
|
|
507
|
},
|
508
|
failure : function (response) {
|
509
|
pnl.unmask();
|
510
|
var result = Ext.decode(response.responseText);
|
511
|
console.log(result);
|
512
|
}
|
513
|
});
|
514
|
|
515
|
} else {
|
516
|
var param_ = cekMandatoryIsNull(tableName);
|
517
|
if (param_ != "") {
|
518
|
MinovaMessage(' Not Null ', ' 000009 ', param_, 'E');
|
519
|
} else {
|
520
|
// ada field yang error
|
521
|
var error_ = getErrorFields(tableName);
|
522
|
if (error_ != ' ') {
|
523
|
MinovaMessage(' title ', ' 000005 ', error_, 'E');
|
524
|
}
|
525
|
|
526
|
}
|
527
|
}
|
528
|
frm.unmask();
|
529
|
}
|
530
|
}, {
|
531
|
text : ' Delete ',
|
532
|
hidden : delete_,
|
533
|
margin : ' 0 3 15 0 ', //(top, right, bottom, left).
|
534
|
iconCls : ' fa - trash - o ',
|
535
|
name : ' btnDeleteMD ',
|
536
|
style : ' font - family : FontAwesome ',
|
537
|
action : ' CRUDdelete ',
|
538
|
handler : function () {
|
539
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
540
|
var grid_ = Ext.ComponentQuery.query('[gridMD = ' + tableName + ']')[0];
|
541
|
MinovaMessage(' Message ', ' 000007 ', ' ', 'C', function (respone) {
|
542
|
if (respone == "yes") {
|
543
|
frm.mask(' loading..');
|
544
|
|
545
|
if (frm.getForm().isValid()) {
|
546
|
Ext.Ajax.request({
|
547
|
async : false,
|
548
|
method : 'POST',
|
549
|
url : '/Devt/SaveTable',
|
550
|
params : {
|
551
|
tableName : tableName,
|
552
|
data : Ext.encode(frm.getValues()),
|
553
|
action : '2'
|
554
|
},
|
555
|
waitMsg : ' Saving Data...',
|
556
|
success : function (response) {
|
557
|
var result = Ext.decode(response.responseText);
|
558
|
if (result.success) {
|
559
|
|
560
|
MinovaMessage(' ', ' BSDEL ', ' ', ' S ');
|
561
|
var menu = Ext.ComponentQuery.query('[name = gridMenuMD]')[0];
|
562
|
var s = menu.getStore();
|
563
|
|
564
|
Ext.Ajax.request({
|
565
|
async : false,
|
566
|
method : 'POST',
|
567
|
url : '/UserControl/GetStore',
|
568
|
params : {
|
569
|
tableName : ' PDSPA0013 ',
|
570
|
param : "ModuleType='" + MinovaUtil.GetModuleType() + "' AND Language='" + getParam("Lang") + "'"
|
571
|
|
572
|
},
|
573
|
success : function (response) {
|
574
|
var results = Ext.decode(response.responseText);
|
575
|
var data_ = results.data;
|
576
|
s.loadData(results.data);
|
577
|
// console.log(data_)
|
578
|
|
579
|
}
|
580
|
});
|
581
|
|
582
|
grid_.getStore().reload();
|
583
|
frm.setHidden(true);
|
584
|
grid_.setHidden(false);
|
585
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
586
|
if (getParam('ApplicantID') != 'null') {
|
587
|
var _param = {
|
588
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
589
|
methodName : 'SendMailChangeMD',
|
590
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
591
|
|
592
|
};
|
593
|
|
594
|
var results = null;
|
595
|
Ext.Ajax.request({
|
596
|
method : 'post',
|
597
|
type : 'ajax',
|
598
|
params : _param,
|
599
|
url : '/InvokeService/Invoke/',
|
600
|
loadMask : {
|
601
|
msg : 'please wait...'
|
602
|
},
|
603
|
success : function (response) {}
|
604
|
});
|
605
|
}
|
606
|
p.setHeight(390);
|
607
|
|
608
|
} else {
|
609
|
|
610
|
//MinovaMessage('Not Null', '000005', result.message.text, 'E')
|
611
|
var msgType = result.message.type;
|
612
|
if (msgType == 4) {
|
613
|
mdConfirm(tableName, Ext.encode(frm.getValues()), '2', result.message.Id)
|
614
|
} else {
|
615
|
MinovaMessage(' Not Null ', ' 000005 ', result.message.text, 'E');
|
616
|
}
|
617
|
}
|
618
|
|
619
|
},
|
620
|
failure : function (response) {
|
621
|
pnl.unmask();
|
622
|
var result = Ext.decode(response.responseText);
|
623
|
console.log(result);
|
624
|
}
|
625
|
});
|
626
|
|
627
|
} else {
|
628
|
var param_ = cekMandatoryIsNull(tableName);
|
629
|
if (param_ != "") {
|
630
|
MinovaMessage('Not Null', '000009', param_, 'E');
|
631
|
} else {
|
632
|
// ada field yang error
|
633
|
var error_ = getErrorFields(tableName);
|
634
|
if (error_ != '') {
|
635
|
MinovaMessage('title', '000005', error_, 'E');
|
636
|
}
|
637
|
|
638
|
}
|
639
|
}
|
640
|
frm.unmask();
|
641
|
}
|
642
|
|
643
|
});
|
644
|
|
645
|
}
|
646
|
|
647
|
}, {
|
648
|
text : 'Go to Grid',
|
649
|
hidden : back,
|
650
|
//margin: '0 3 15 0', //(top, right, bottom, left).
|
651
|
name : 'btnCancelMD',
|
652
|
iconCls : 'fa-reply',
|
653
|
style : 'font-family: FontAwesome',
|
654
|
viewForm : name + tableName,
|
655
|
handler : function () {
|
656
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
657
|
if (respone == "yes") {
|
658
|
Ext.ComponentQuery.query('[name=' + name + tableName + ']')[0].setHidden(true);
|
659
|
Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0].setHidden(false);
|
660
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
661
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
662
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = null;
|
663
|
}
|
664
|
|
665
|
p.setHeight(390);
|
666
|
}
|
667
|
});
|
668
|
|
669
|
}
|
670
|
}, {
|
671
|
text : 'Edit',
|
672
|
hidden : edit,
|
673
|
record : record,
|
674
|
//margin: '0 3 15 0', //(top, right, bottom, left).
|
675
|
//name: 'btnEditMD',
|
676
|
iconCls : 'fa-edit',
|
677
|
style : 'font-family: FontAwesome',
|
678
|
handler : function () {
|
679
|
var grid_ = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
680
|
var selecton_ = grid_.getView().getSelectionModel().getSelection()[0];
|
681
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
682
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(false)
|
683
|
} else {
|
684
|
mdgenerator.createFormCard(tableName, "", "", renderTo, false, selecton_, '1');
|
685
|
}
|
686
|
|
687
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm().setValues(selecton_.data);
|
688
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
689
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
690
|
if (tinggi < 330) {
|
691
|
tinggi = 330;
|
692
|
}
|
693
|
p.setHeight(tinggi + 100);
|
694
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHidden(true);
|
695
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = '1';
|
696
|
//Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setTitle('Edit - ' + grid_.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"))
|
697
|
Ext.ComponentQuery.query('[name=DetailMD]')[0].setTitle('Edit' + ' - ' + grid_.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"));
|
698
|
var tbl = tableName;
|
699
|
setValueAmountEncrypt(tbl);
|
700
|
}
|
701
|
},
|
702
|
],
|
703
|
|
704
|
},
|
705
|
]
|
706
|
});
|
707
|
|
708
|
Ext.ComponentQuery.query('[name=Main]')[0].lastView = Ext.ComponentQuery.query('[name=' + name + tableName + ']')[0];
|
709
|
|
710
|
}
|
711
|
|
712
|
mdgenerator.createFormL002 = function (tableName, layout, param_, renderTo, isDisplay, record, act) {
|
713
|
var name = 'MinovaGridFormEdit';
|
714
|
var save = true;
|
715
|
var edit = false;
|
716
|
var delete_ = true;
|
717
|
var back = false;
|
718
|
|
719
|
if (isDisplay) {
|
720
|
name = 'MinovaGridFormDisplay'
|
721
|
} else {
|
722
|
save = false;
|
723
|
edit = true;
|
724
|
delete_ = false;
|
725
|
back = false;
|
726
|
}
|
727
|
var userAction = MinovaUtil.GetActionMenu();
|
728
|
if (userAction != '1') {
|
729
|
save = true;
|
730
|
edit = true;
|
731
|
delete_ = true;
|
732
|
}
|
733
|
|
734
|
if (tableName.toLowerCase().substring(0, 5) == 'phrrc') {
|
735
|
Ext.Ajax.request({
|
736
|
async : false,
|
737
|
method : 'POST',
|
738
|
url : '/UserControl/GetStore',
|
739
|
params : {
|
740
|
tableName : 'phrpa0015',
|
741
|
param : 'ApplicantID[equal]' + getParam('app')
|
742
|
},
|
743
|
success : function (response) {
|
744
|
var results = Ext.decode(response.responseText);
|
745
|
data_ = results.data;
|
746
|
if (data_.length > 0) {
|
747
|
save = true;
|
748
|
edit = true;
|
749
|
delete_ = true;
|
750
|
}
|
751
|
}
|
752
|
});
|
753
|
}
|
754
|
Ext.create('Ext.form.Panel', {
|
755
|
renderTo : renderTo,
|
756
|
name : name + tableName,
|
757
|
collapsible : true,
|
758
|
formMD : tableName,
|
759
|
act : null,
|
760
|
items : [{
|
761
|
xtype : 'minovaForm',
|
762
|
name : name,
|
763
|
|
764
|
//title: 'judul',
|
765
|
tableName : tableName,
|
766
|
margin : '0 0 10 0',
|
767
|
isDisplay : isDisplay,
|
768
|
//hidden:true
|
769
|
buttons : [{
|
770
|
text : 'Save',
|
771
|
hidden : save,
|
772
|
act : act,
|
773
|
//margin: '0 3 15 0', //(top, right, bottom, left).
|
774
|
name : 'btnSaveMD',
|
775
|
iconCls : 'fa-save',
|
776
|
style : 'font-family: FontAwesome',
|
777
|
handler : function () {
|
778
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
779
|
var grid_ = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
780
|
//frm.mask('loading..');
|
781
|
|
782
|
if (frm.getForm().isValid()) {
|
783
|
Ext.Ajax.request({
|
784
|
method : 'POST',
|
785
|
async : false,
|
786
|
url : '/Devt/SaveTable',
|
787
|
params : {
|
788
|
tableName : tableName,
|
789
|
data : Ext.encode(frm.getValues()),
|
790
|
action : frm.act
|
791
|
},
|
792
|
waitMsg : 'Saving Data...',
|
793
|
success : function (response) {
|
794
|
var result = Ext.decode(response.responseText);
|
795
|
if (result.success) {
|
796
|
|
797
|
MinovaMessage('Not Null', '000006', '', 'S');
|
798
|
var menu = Ext.ComponentQuery.query('[name = gridMenuMD]')[0];
|
799
|
var s = menu.getStore();
|
800
|
|
801
|
Ext.Ajax.request({
|
802
|
async : false,
|
803
|
method : 'POST',
|
804
|
url : '/UserControl/GetStore',
|
805
|
params : {
|
806
|
tableName : ' PDSPA0013 ',
|
807
|
param : "ModuleType='" + MinovaUtil.GetModuleType() + "' AND Language='" + getParam("Lang") + "'"
|
808
|
|
809
|
},
|
810
|
success : function (response) {
|
811
|
var results = Ext.decode(response.responseText);
|
812
|
var data_ = results.data;
|
813
|
s.loadData(results.data);
|
814
|
//s.reload()
|
815
|
}
|
816
|
});
|
817
|
|
818
|
grid_.getStore().reload();
|
819
|
frm.setHidden(true);
|
820
|
grid_.setHidden(false);
|
821
|
var p = Ext.ComponentQuery.query('[name = PanelMdDetail]')[0];
|
822
|
p.setHeight(390);
|
823
|
if (getParam('ApplicantID') != 'null') {
|
824
|
var _param = {
|
825
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
826
|
methodName : 'SendMailChangeMD',
|
827
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
828
|
|
829
|
};
|
830
|
|
831
|
var results = null;
|
832
|
Ext.Ajax.request({
|
833
|
method : 'post',
|
834
|
type : 'ajax',
|
835
|
params : _param,
|
836
|
url : '/InvokeService/Invoke/',
|
837
|
loadMask : {
|
838
|
msg : 'please wait...'
|
839
|
},
|
840
|
success : function (response) {}
|
841
|
});
|
842
|
}
|
843
|
frm.destroy();
|
844
|
} else {
|
845
|
|
846
|
//MinovaMessage(' Not Null ', ' 000005 ', result.message.text, 'E')
|
847
|
var msgType = result.message.type;
|
848
|
if (msgType == 4) {
|
849
|
mdConfirm(tableName, Ext.encode(frm.getValues()), frm.act, result.message.Id)
|
850
|
} else {
|
851
|
MinovaMessage(' Not Null ', ' 000005 ', result.message.text, 'E');
|
852
|
}
|
853
|
}
|
854
|
|
855
|
},
|
856
|
failure : function (response) {
|
857
|
pnl.unmask();
|
858
|
var result = Ext.decode(response.responseText);
|
859
|
console.log(result);
|
860
|
}
|
861
|
});
|
862
|
|
863
|
} else {
|
864
|
var param_ = cekMandatoryIsNull(tableName);
|
865
|
if (param_ != "") {
|
866
|
MinovaMessage(' Not Null ', ' 000009 ', param_, 'E');
|
867
|
} else {
|
868
|
// ada field yang error
|
869
|
var error_ = getErrorFields(tableName);
|
870
|
if (error_ != ' ') {
|
871
|
MinovaMessage(' title ', ' 000005 ', error_, 'E');
|
872
|
}
|
873
|
|
874
|
}
|
875
|
// frm.unmask();
|
876
|
}
|
877
|
|
878
|
}
|
879
|
}, {
|
880
|
text : ' Delete ',
|
881
|
hidden : delete_,
|
882
|
margin : ' 0 3 15 0 ', //(top, right, bottom, left).
|
883
|
iconCls : ' fa - trash - o ',
|
884
|
name : ' btnDeleteMD ',
|
885
|
style : ' font - family : FontAwesome ',
|
886
|
action : ' CRUDdelete ',
|
887
|
handler : function () {
|
888
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
889
|
var grid_ = Ext.ComponentQuery.query(' minovagridmd[tableName = ' + tableName + ']')[0];
|
890
|
MinovaMessage(' Message ', ' 000007 ', ' ', 'C', function (respone) {
|
891
|
if (respone == "yes") {
|
892
|
//frm.mask(' loading..');
|
893
|
|
894
|
if (frm.getForm().isValid()) {
|
895
|
Ext.Ajax.request({
|
896
|
method : 'POST',
|
897
|
async : false,
|
898
|
url : '/Devt/SaveTable',
|
899
|
params : {
|
900
|
tableName : tableName,
|
901
|
data : Ext.encode(frm.getValues()),
|
902
|
action : '2'
|
903
|
},
|
904
|
waitMsg : ' Saving Data...',
|
905
|
success : function (response) {
|
906
|
var result = Ext.decode(response.responseText);
|
907
|
if (result.success) {
|
908
|
if (frm.getForm().findField('FileID')) {
|
909
|
var FileID_ = frm.getForm().findField('FileID').getValue();
|
910
|
var FileName_ = Ext.ComponentQuery.query('[uploadName=uploadName]')[0].getValue();
|
911
|
var valFile = {
|
912
|
Id : FileID_,
|
913
|
FileName : FileName_
|
914
|
};
|
915
|
Ext.Ajax.request({
|
916
|
async : false,
|
917
|
method : 'POST',
|
918
|
url : '/Devt/SaveTable',
|
919
|
params : {
|
920
|
tableName : 'SFILECATALOG',
|
921
|
data : Ext.encode(valFile),
|
922
|
action : '2'
|
923
|
},
|
924
|
});
|
925
|
}
|
926
|
MinovaMessage(' Not Null ', ' 000006 ', ' ', ' S ');
|
927
|
var menu = Ext.ComponentQuery.query('[name = gridMenuMD]')[0];
|
928
|
var s = menu.getStore();
|
929
|
|
930
|
Ext.Ajax.request({
|
931
|
async : false,
|
932
|
method : 'POST',
|
933
|
url : '/UserControl/GetStore',
|
934
|
params : {
|
935
|
tableName : ' PDSPA0013 ',
|
936
|
param : "ModuleType='" + MinovaUtil.GetModuleType() + "' AND Language='" + getParam("Lang") + "'"
|
937
|
|
938
|
},
|
939
|
success : function (response) {
|
940
|
var results = Ext.decode(response.responseText);
|
941
|
var data_ = results.data;
|
942
|
s.loadData(results.data);
|
943
|
//s.reload()
|
944
|
}
|
945
|
});
|
946
|
|
947
|
grid_.getStore().reload();
|
948
|
frm.setHidden(true);
|
949
|
grid_.setHidden(false);
|
950
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
951
|
if (getParam('ApplicantID') != 'null') {
|
952
|
var _param = {
|
953
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
954
|
methodName : 'SendMailChangeMD',
|
955
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
956
|
|
957
|
};
|
958
|
|
959
|
var results = null;
|
960
|
Ext.Ajax.request({
|
961
|
method : 'post',
|
962
|
type : 'ajax',
|
963
|
params : _param,
|
964
|
url : '/InvokeService/Invoke/',
|
965
|
loadMask : {
|
966
|
msg : 'please wait...'
|
967
|
},
|
968
|
success : function (response) {}
|
969
|
});
|
970
|
}
|
971
|
p.setHeight(390);
|
972
|
//frm.unmask();
|
973
|
frm.destroy();
|
974
|
} else {
|
975
|
|
976
|
//MinovaMessage('Not Null', '000005', result.message.text, 'E')
|
977
|
var msgType = result.message.type;
|
978
|
if (msgType == 4) {
|
979
|
mdConfirm(tableName, Ext.encode(frm.getValues()), '2', result.message.Id)
|
980
|
} else {
|
981
|
MinovaMessage(' Not Null ', ' 000005 ', result.message.text, 'E');
|
982
|
}
|
983
|
}
|
984
|
|
985
|
},
|
986
|
failure : function (response) {
|
987
|
pnl.unmask();
|
988
|
var result = Ext.decode(response.responseText);
|
989
|
console.log(result);
|
990
|
}
|
991
|
});
|
992
|
|
993
|
} else {
|
994
|
var param_ = cekMandatoryIsNull(tableName);
|
995
|
if (param_ != "") {
|
996
|
MinovaMessage('Not Null', '000009', param_, 'E');
|
997
|
} else {
|
998
|
// ada field yang error
|
999
|
var error_ = getErrorFields(tableName);
|
1000
|
if (error_ != '') {
|
1001
|
MinovaMessage('title', '000005', error_, 'E');
|
1002
|
}
|
1003
|
|
1004
|
}
|
1005
|
//frm.unmask();
|
1006
|
}
|
1007
|
}
|
1008
|
});
|
1009
|
|
1010
|
}
|
1011
|
}, {
|
1012
|
text : 'Back to Grid',
|
1013
|
hidden : back,
|
1014
|
//margin: '0 3 15 0', //(top, right, bottom, left).
|
1015
|
name : 'btnCancelMD',
|
1016
|
iconCls : 'fa-reply',
|
1017
|
style : 'font-family: FontAwesome',
|
1018
|
viewForm : name + tableName,
|
1019
|
handler : function () {
|
1020
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
1021
|
if (respone == "yes") {
|
1022
|
Ext.ComponentQuery.query('[name=' + name + tableName + ']')[0].setHidden(true);
|
1023
|
//Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0].setHidden(false);
|
1024
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
1025
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0]) {
|
1026
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHidden(true);
|
1027
|
//Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = null;
|
1028
|
}
|
1029
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
1030
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(true);
|
1031
|
//Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = null;
|
1032
|
}
|
1033
|
p.setHeight(390);
|
1034
|
var grid_ = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1035
|
Ext.ComponentQuery.query('[name=DetailMD]')[0].setTitle(grid_.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"));
|
1036
|
|
1037
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].destroy();
|
1038
|
}
|
1039
|
});
|
1040
|
|
1041
|
}
|
1042
|
}, {
|
1043
|
text : 'Edit',
|
1044
|
hidden : edit,
|
1045
|
record : record,
|
1046
|
//margin: '0 3 15 0', //(top, right, bottom, left).
|
1047
|
//name: 'btnEditMD',
|
1048
|
iconCls : 'fa-edit',
|
1049
|
style : 'font-family: FontAwesome',
|
1050
|
handler : function () {
|
1051
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
1052
|
p_.mask('Loading...');
|
1053
|
var grid_ = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1054
|
var selecton_ = grid_.getView().getSelectionModel().getSelection()[0];
|
1055
|
|
1056
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHidden(true);
|
1057
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
1058
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(false)
|
1059
|
} else {
|
1060
|
mdgenerator.createFormL002(tableName, "", "", renderTo, false, record, '1');
|
1061
|
}
|
1062
|
|
1063
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm().setValues(selecton_.data);
|
1064
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
1065
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
1066
|
if (tinggi < 330) {
|
1067
|
tinggi = 380;
|
1068
|
}
|
1069
|
p.setHeight(380 + tinggi + 100);
|
1070
|
|
1071
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = '1';
|
1072
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setTitle('Edit - ' + grid_.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"))
|
1073
|
var tbl = tableName;
|
1074
|
setValueAmountEncrypt(tbl);
|
1075
|
p_.unmask();
|
1076
|
setKeyDisabled(true);
|
1077
|
}
|
1078
|
},
|
1079
|
],
|
1080
|
|
1081
|
},
|
1082
|
]
|
1083
|
});
|
1084
|
|
1085
|
Ext.ComponentQuery.query('[name=Main]')[0].lastView = Ext.ComponentQuery.query('[name=' + name + tableName + ']')[0];
|
1086
|
}
|
1087
|
|
1088
|
mdgenerator.createGrid = function (tableName, layout, param_, renderTo) {
|
1089
|
|
1090
|
Ext.create('MinovaUtil.MinovaES.MinovaGridMD', {
|
1091
|
renderTo : renderTo,
|
1092
|
tableName : tableName,
|
1093
|
storename : tableName + 'Grid',
|
1094
|
name : 'gridMD' + tableName,
|
1095
|
pagesize : 10,
|
1096
|
param : param_,
|
1097
|
height : 330,
|
1098
|
margin : '0 0 10 0',
|
1099
|
tbar : [{
|
1100
|
xtype : 'button',
|
1101
|
text : 'Action',
|
1102
|
name : 'actionGrid',
|
1103
|
menu : [{
|
1104
|
text : 'Add',
|
1105
|
name : 'addGrid',
|
1106
|
action : 'CRUDaddNewRecord',
|
1107
|
style : 'font-family: FontAwesome',
|
1108
|
itemId : 'AddData',
|
1109
|
iconCls : 'fa-plus-circle',
|
1110
|
|
1111
|
}, {
|
1112
|
text : 'Copy',
|
1113
|
name : 'CopyGrid',
|
1114
|
iconCls : 'fa-copy',
|
1115
|
style : 'font-family: FontAwesome',
|
1116
|
}, {
|
1117
|
text : 'Edit',
|
1118
|
name : 'EditGrid',
|
1119
|
iconCls : 'fa-edit',
|
1120
|
style : 'font-family: FontAwesome',
|
1121
|
}, {
|
1122
|
text : 'Delete',
|
1123
|
name : 'DeleteGrid',
|
1124
|
hidden : true,
|
1125
|
iconCls : 'fa-trash-o',
|
1126
|
style : 'font-family: FontAwesome',
|
1127
|
}
|
1128
|
]
|
1129
|
}, {
|
1130
|
xtype : 'tbfill'
|
1131
|
}, {
|
1132
|
text : 'Clear Filters',
|
1133
|
tooltip : 'Clear all filters',
|
1134
|
name : 'clearbtn',
|
1135
|
handler : function () {
|
1136
|
var tolbar = this.up()
|
1137
|
var grid_ = tolbar.up()
|
1138
|
grid_.filters.clearFilters()
|
1139
|
}
|
1140
|
}, ],
|
1141
|
|
1142
|
dockedItems : [{
|
1143
|
xtype : 'pagingtoolbar',
|
1144
|
store : tableName + 'Grid',
|
1145
|
dock : 'bottom', //posisi paging
|
1146
|
pageSize : 10,
|
1147
|
displayInfo : true,
|
1148
|
|
1149
|
}
|
1150
|
],
|
1151
|
});
|
1152
|
}
|
1153
|
|
1154
|
mdgenerator.createGridCard = function (tableName, layout, param_, renderTo, Label) {
|
1155
|
var userAction = MinovaUtil.GetActionMenu();
|
1156
|
if (userAction != '1') {
|
1157
|
add = true;
|
1158
|
|
1159
|
} else {
|
1160
|
add = false;
|
1161
|
}
|
1162
|
if (tableName.toLowerCase().substring(0, 5) == 'phrrc') {
|
1163
|
Ext.Ajax.request({
|
1164
|
async : false,
|
1165
|
method : 'POST',
|
1166
|
url : '/UserControl/GetStore',
|
1167
|
params : {
|
1168
|
tableName : 'phrpa0015',
|
1169
|
param : 'ApplicantID[equal]' + getParam('app')
|
1170
|
},
|
1171
|
success : function (response) {
|
1172
|
var results = Ext.decode(response.responseText);
|
1173
|
data_ = results.data;
|
1174
|
if (data_.length > 0) {
|
1175
|
add = true;
|
1176
|
|
1177
|
}
|
1178
|
}
|
1179
|
});
|
1180
|
}
|
1181
|
Ext.create('MinovaUtil.MinovaES.MinovaGridMD', {
|
1182
|
renderTo : renderTo,
|
1183
|
tableName : tableName,
|
1184
|
storename : tableName + 'Grid',
|
1185
|
name : 'gridMD' + tableName,
|
1186
|
pagesize : 10,
|
1187
|
param : param_,
|
1188
|
height : 330,
|
1189
|
margin : '0 0 10 0',
|
1190
|
gridMD : tableName,
|
1191
|
tableDesc : Label,
|
1192
|
tbar : [{
|
1193
|
xtype : 'button',
|
1194
|
text : 'Action',
|
1195
|
hidden : add,
|
1196
|
name : 'actionGrid',
|
1197
|
menu : [{
|
1198
|
text : 'Add',
|
1199
|
name : 'addGrid',
|
1200
|
action : 'CRUDaddNewRecord',
|
1201
|
style : 'font-family: FontAwesome',
|
1202
|
itemId : 'AddData',
|
1203
|
iconCls : 'fa-plus-circle',
|
1204
|
handler : function () {
|
1205
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
1206
|
p_.mask('Loading...');
|
1207
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
1208
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(false)
|
1209
|
} else {
|
1210
|
mdgenerator.createFormCard(tableName, "", "", renderTo, false, '', '0');
|
1211
|
}
|
1212
|
|
1213
|
var form_ = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm();
|
1214
|
form_.reset();
|
1215
|
form_.findField('EmployeeID').setValue(getParam('EmployeeID'));
|
1216
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
1217
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
1218
|
if (tinggi < 330) {
|
1219
|
tinggi = 330;
|
1220
|
}
|
1221
|
p.setHeight(tinggi + 100);
|
1222
|
Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0].setHidden(true);
|
1223
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = '0';
|
1224
|
|
1225
|
Ext.ComponentQuery.query('[name=DetailMD]')[0].setTitle('Add' + ' - ' + Label + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"));
|
1226
|
if (Label == "Absence Half Day")
|
1227
|
{
|
1228
|
var maxseq='0'
|
1229
|
MinovaUtil.ExecuteParamQuery({
|
1230
|
ID: 'MAXSEQPA118',
|
1231
|
EmployeeID:EmpID
|
1232
|
}, function (s) {
|
1233
|
var result = Ext.decode(s.responseText);
|
1234
|
var dt = Ext.decode(Ext.decode(result.data));
|
1235
|
if (dt.length > 0){
|
1236
|
maxseq = dt[0].max_sequence;}
|
1237
|
});
|
1238
|
Ext.ComponentQuery.query('[name=Seq]')[0].setValue(maxseq);
|
1239
|
}
|
1240
|
p_.unmask();
|
1241
|
setKeyDisabled(false);
|
1242
|
}
|
1243
|
}, {
|
1244
|
text : 'Copy',
|
1245
|
name : 'CopyGrid',
|
1246
|
iconCls : 'fa-copy',
|
1247
|
style : 'font-family: FontAwesome',
|
1248
|
handler : function () {
|
1249
|
|
1250
|
var grid_ = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
1251
|
var selecton_ = grid_.getView().getSelectionModel().getSelection()[0];
|
1252
|
if (selecton_) {
|
1253
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
1254
|
p_.mask('Loading...');
|
1255
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
1256
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(false)
|
1257
|
} else {
|
1258
|
mdgenerator.createFormCard(tableName, "", "", renderTo, false, selecton_, '0');
|
1259
|
}
|
1260
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm().reset();
|
1261
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm().setValues(selecton_.data);
|
1262
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
1263
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
1264
|
if (tinggi < 330) {
|
1265
|
tinggi = 330;
|
1266
|
}
|
1267
|
p.setHeight(tinggi + 100);
|
1268
|
grid_.setHidden(true);
|
1269
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = '0'
|
1270
|
Ext.ComponentQuery.query('[name=DetailMD]')[0].setTitle('Copy' + ' - ' + grid_.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"));
|
1271
|
var tbl = tableName;
|
1272
|
setValueAmountEncrypt(tbl);
|
1273
|
p_.unmask();
|
1274
|
setKeyDisabled(false);
|
1275
|
setFileID(0);
|
1276
|
}
|
1277
|
|
1278
|
}
|
1279
|
}, {
|
1280
|
text : 'Edit',
|
1281
|
name : 'EditGrid',
|
1282
|
iconCls : 'fa-edit',
|
1283
|
style : 'font-family: FontAwesome',
|
1284
|
handler : function () {
|
1285
|
var grid_ = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
1286
|
var selecton_ = grid_.getView().getSelectionModel().getSelection()[0];
|
1287
|
if (selecton_) {
|
1288
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
1289
|
p_.mask('Loading...');
|
1290
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
1291
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(false)
|
1292
|
} else {
|
1293
|
mdgenerator.createFormCard(tableName, "", "", renderTo, false, selecton_, '1');
|
1294
|
}
|
1295
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm().reset();
|
1296
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm().setValues(selecton_.data);
|
1297
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
1298
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
1299
|
if (tinggi < 330) {
|
1300
|
tinggi = 330;
|
1301
|
}
|
1302
|
p.setHeight(tinggi + 100);
|
1303
|
grid_.setHidden(true);
|
1304
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = '1';
|
1305
|
Ext.ComponentQuery.query('[name=DetailMD]')[0].setTitle('Edit' + ' - ' + grid_.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"));
|
1306
|
var tbl = tableName;
|
1307
|
setValueAmountEncrypt(tbl);
|
1308
|
p_.unmask();
|
1309
|
setKeyDisabled(true);
|
1310
|
}
|
1311
|
|
1312
|
}
|
1313
|
}, {
|
1314
|
text : 'Delete',
|
1315
|
name : 'DeleteGrid',
|
1316
|
hidden : true,
|
1317
|
iconCls : 'fa-trash-o',
|
1318
|
style : 'font-family: FontAwesome',
|
1319
|
}
|
1320
|
]
|
1321
|
}, {
|
1322
|
xtype : 'tbfill'
|
1323
|
}, {
|
1324
|
text : 'Clear Filters',
|
1325
|
tooltip : 'Clear all filters',
|
1326
|
name : 'clearbtn',
|
1327
|
handler : function () {
|
1328
|
var tolbar = this.up()
|
1329
|
var grid_ = tolbar.up()
|
1330
|
grid_.filters.clearFilters()
|
1331
|
}
|
1332
|
}, ],
|
1333
|
|
1334
|
dockedItems : [{
|
1335
|
xtype : 'pagingtoolbar',
|
1336
|
store : tableName + 'Grid',
|
1337
|
dock : 'bottom', //posisi paging
|
1338
|
pageSize : 10,
|
1339
|
displayInfo : true,
|
1340
|
|
1341
|
}
|
1342
|
],
|
1343
|
listeners : {
|
1344
|
'itemdblclick' : function (me, record, item, index, e, eOpts) {
|
1345
|
// me.el.mask("Loading...");
|
1346
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
1347
|
p_.mask('Loading...');
|
1348
|
|
1349
|
var g = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
1350
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0]) {
|
1351
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHidden(false)
|
1352
|
} else {
|
1353
|
mdgenerator.createFormCard(g.tableName, "", "", g.renderTo, true, record, '1');
|
1354
|
}
|
1355
|
|
1356
|
var fDisplay = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0];
|
1357
|
//mdgenerator.FakeValue(fDisplay)
|
1358
|
|
1359
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
1360
|
|
1361
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].getHeight();
|
1362
|
if (tinggi < 330) {
|
1363
|
tinggi = 330;
|
1364
|
}
|
1365
|
p.setHeight(tinggi + 150);
|
1366
|
fDisplay.reset();
|
1367
|
fDisplay.getForm().setValues(record.data);
|
1368
|
g.setHidden(true);
|
1369
|
Ext.ComponentQuery.query('[name=DetailMD]')[0].setTitle('view' + ' - ' + g.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"));
|
1370
|
// me.unmask();
|
1371
|
var tbl = tableName;
|
1372
|
setValueAmountEncryptDisplayField(tbl);
|
1373
|
p_.unmask();
|
1374
|
},
|
1375
|
|
1376
|
},
|
1377
|
});
|
1378
|
|
1379
|
//'gridMD' + tableName
|
1380
|
Ext.ComponentQuery.query('[name=Main]')[0].lastView = Ext.ComponentQuery.query('[name=gridMD' + tableName + ']')[0];
|
1381
|
}
|
1382
|
|
1383
|
mdgenerator.createGridL002 = function (tableName, layout, param_, renderTo, Label) {
|
1384
|
var userAction = MinovaUtil.GetActionMenu();
|
1385
|
if (userAction != '1') {
|
1386
|
add = true;
|
1387
|
|
1388
|
} else {
|
1389
|
add = false;
|
1390
|
}
|
1391
|
if (tableName.toLowerCase().substring(0, 5) == 'phrrc') {
|
1392
|
Ext.Ajax.request({
|
1393
|
async : false,
|
1394
|
method : 'POST',
|
1395
|
url : '/UserControl/GetStore',
|
1396
|
params : {
|
1397
|
tableName : 'phrpa0015',
|
1398
|
param : 'ApplicantID[equal]' + getParam('app')
|
1399
|
},
|
1400
|
success : function (response) {
|
1401
|
var results = Ext.decode(response.responseText);
|
1402
|
data_ = results.data;
|
1403
|
if (data_.length > 0) {
|
1404
|
add = true;
|
1405
|
|
1406
|
}
|
1407
|
}
|
1408
|
});
|
1409
|
}
|
1410
|
Ext.create('MinovaUtil.MinovaES.MinovaGridMD', {
|
1411
|
renderTo : renderTo,
|
1412
|
tableName : tableName,
|
1413
|
storename : tableName + 'Grid',
|
1414
|
name : 'gridMD' + tableName,
|
1415
|
pagesize : 10,
|
1416
|
tableDesc : Label,
|
1417
|
param : param_,
|
1418
|
height : 330,
|
1419
|
margin : '0 0 10 0',
|
1420
|
tbar : [{
|
1421
|
xtype : 'button',
|
1422
|
text : 'Action',
|
1423
|
hidden : add,
|
1424
|
name : 'actionGrid',
|
1425
|
menu : [{
|
1426
|
text : 'Add',
|
1427
|
name : 'addGrid',
|
1428
|
action : 'CRUDaddNewRecord',
|
1429
|
style : 'font-family: FontAwesome',
|
1430
|
itemId : 'AddData',
|
1431
|
iconCls : 'fa-plus-circle',
|
1432
|
handler : function () {
|
1433
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
1434
|
p_.mask('Loading...');
|
1435
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1436
|
//var g = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
1437
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
1438
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
1439
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(false);
|
1440
|
|
1441
|
} else {
|
1442
|
mdgenerator.createFormL002(tableName, "", "", renderTo, false, '', '0');
|
1443
|
}
|
1444
|
|
1445
|
var fDisplay = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1446
|
|
1447
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
1448
|
|
1449
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
1450
|
if (tinggi < 330) {
|
1451
|
tinggi = 330;
|
1452
|
}
|
1453
|
p.setHeight(390 + tinggi + 70);
|
1454
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setTitle('Add - ' + g.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"))
|
1455
|
fDisplay.getForm().reset();
|
1456
|
|
1457
|
fDisplay.getForm().reset();
|
1458
|
fDisplay.getForm().findField('EmployeeID').setValue(getParam('EmployeeID'));
|
1459
|
|
1460
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1461
|
frm.act = '0';
|
1462
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0]) {
|
1463
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHidden(true);
|
1464
|
}
|
1465
|
// go to bottom page
|
1466
|
$("html, body").animate({
|
1467
|
scrollTop : $(document).height()
|
1468
|
}, "slow");
|
1469
|
p_.unmask();
|
1470
|
setKeyDisabled(false);
|
1471
|
}
|
1472
|
|
1473
|
}, {
|
1474
|
text : 'Copy',
|
1475
|
name : 'CopyGrid',
|
1476
|
iconCls : 'fa-copy',
|
1477
|
style : 'font-family: FontAwesome',
|
1478
|
handler : function () {
|
1479
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1480
|
//var g = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
1481
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
1482
|
if (selecton_) {
|
1483
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
1484
|
p_.mask('Loading...');
|
1485
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
1486
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(false);
|
1487
|
|
1488
|
} else {
|
1489
|
mdgenerator.createFormL002(tableName, "", "", renderTo, false, '', '0');
|
1490
|
}
|
1491
|
|
1492
|
var fDisplay = Ext.ComponentQuery.query('minovaform[tableName=' + tableName + ']')[0];
|
1493
|
|
1494
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
1495
|
|
1496
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
1497
|
if (tinggi < 330) {
|
1498
|
tinggi = 330;
|
1499
|
}
|
1500
|
p.setHeight(390 + tinggi + 70);
|
1501
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setTitle('Copy - ' + g.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"))
|
1502
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm().setValues(selecton_.data);
|
1503
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0]) {
|
1504
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHidden(true);
|
1505
|
}
|
1506
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1507
|
frm.act = '0';
|
1508
|
// go to bottom page
|
1509
|
$("html, body").animate({
|
1510
|
scrollTop : $(document).height()
|
1511
|
}, "slow");
|
1512
|
var tbl = tableName;
|
1513
|
setValueAmountEncrypt(tbl);
|
1514
|
p_.unmask();
|
1515
|
setKeyDisabled(false);
|
1516
|
setFileID(0);
|
1517
|
}
|
1518
|
|
1519
|
}
|
1520
|
|
1521
|
}, {
|
1522
|
text : 'Edit',
|
1523
|
name : 'EditGrid',
|
1524
|
iconCls : 'fa-edit',
|
1525
|
style : 'font-family: FontAwesome',
|
1526
|
handler : function () {
|
1527
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1528
|
//var g = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
1529
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
1530
|
if (selecton_) {
|
1531
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
1532
|
p_.mask('Loading...');
|
1533
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
1534
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(false);
|
1535
|
|
1536
|
} else {
|
1537
|
mdgenerator.createFormL002(tableName, "", "", renderTo, false, '', '1');
|
1538
|
}
|
1539
|
|
1540
|
var fDisplay = Ext.ComponentQuery.query('minovaform[tableName=' + tableName + ']')[0];
|
1541
|
|
1542
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
1543
|
|
1544
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
1545
|
if (tinggi < 330) {
|
1546
|
tinggi = 330;
|
1547
|
}
|
1548
|
p.setHeight(390 + tinggi + 100);
|
1549
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setTitle('Edit - ' + g.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"))
|
1550
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm().setValues(selecton_.data);
|
1551
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0]) {
|
1552
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHidden(true);
|
1553
|
}
|
1554
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1555
|
frm.act = '1';
|
1556
|
// go to bottom page
|
1557
|
$("html, body").animate({
|
1558
|
scrollTop : $(document).height()
|
1559
|
}, "slow");
|
1560
|
p_.unmask();
|
1561
|
setKeyDisabled(true);
|
1562
|
}
|
1563
|
|
1564
|
}
|
1565
|
|
1566
|
}, {
|
1567
|
text : 'Delete',
|
1568
|
name : 'DeleteGrid',
|
1569
|
hidden : true,
|
1570
|
iconCls : 'fa-trash-o',
|
1571
|
style : 'font-family: FontAwesome',
|
1572
|
}
|
1573
|
]
|
1574
|
}, {
|
1575
|
xtype : 'tbfill'
|
1576
|
}, {
|
1577
|
text : 'Clear Filters',
|
1578
|
tooltip : 'Clear all filters',
|
1579
|
name : 'clearbtn',
|
1580
|
handler : function () {
|
1581
|
var tolbar = this.up()
|
1582
|
var grid_ = tolbar.up()
|
1583
|
grid_.filters.clearFilters()
|
1584
|
}
|
1585
|
}, ],
|
1586
|
|
1587
|
dockedItems : [{
|
1588
|
xtype : 'pagingtoolbar',
|
1589
|
store : tableName + 'Grid',
|
1590
|
dock : 'bottom', //posisi paging
|
1591
|
pageSize : 10,
|
1592
|
displayInfo : true,
|
1593
|
|
1594
|
}
|
1595
|
],
|
1596
|
listeners : {
|
1597
|
'itemdblclick' : function (me, record, item, index, e, eOpts) {
|
1598
|
// me.el.mask("Loading...");
|
1599
|
//if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
1600
|
// var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1601
|
// if(formEdit)
|
1602
|
// {
|
1603
|
|
1604
|
// }
|
1605
|
//}
|
1606
|
var p_ = Ext.ComponentQuery.query('[name=Main]')[0];
|
1607
|
p_.mask('Loading...');
|
1608
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1609
|
//var g = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
1610
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
1611
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0]) {
|
1612
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHidden(false);
|
1613
|
|
1614
|
} else {
|
1615
|
mdgenerator.createFormL002(tableName, "", "", renderTo, true, selecton_, '1');
|
1616
|
}
|
1617
|
|
1618
|
var fDisplay = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0];
|
1619
|
mdgenerator.FakeValue(fDisplay)
|
1620
|
|
1621
|
var p = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
1622
|
|
1623
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].getHeight();
|
1624
|
if (tinggi < 330) {
|
1625
|
tinggi = 330;
|
1626
|
}
|
1627
|
p.setHeight(390 + tinggi + 100);
|
1628
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setTitle('View - ' + g.tableDesc + ' - ' + getParam("EmployeeID") + ' - ' + getParam("FullName"))
|
1629
|
fDisplay.reset();
|
1630
|
fDisplay.getForm().setValues(selecton_.data);
|
1631
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
1632
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(true);
|
1633
|
}
|
1634
|
|
1635
|
// me.unmask();
|
1636
|
|
1637
|
// go to bottom page
|
1638
|
$("html, body").animate({
|
1639
|
scrollTop : $(document).height()
|
1640
|
}, "slow");
|
1641
|
setValueAmountEncryptDisplayField(tableName);
|
1642
|
p_.unmask();
|
1643
|
},
|
1644
|
|
1645
|
},
|
1646
|
});
|
1647
|
}
|
1648
|
|
1649
|
mdgenerator.FakeValue = function (form_) {
|
1650
|
var form = form_.getForm();
|
1651
|
|
1652
|
var fields = form.getFields().items;
|
1653
|
|
1654
|
for (var i = 0; i < fields.length; i++) {
|
1655
|
var field_xtype = fields[i].xtype;
|
1656
|
|
1657
|
//if (field_xtype === 'numberfield' || field_xtype == 'textfield' || field_xtype == 'combobox' || field_xtype == 'datefield' || field_xtype == 'textareafield') {
|
1658
|
// fields[i].setValue('n');
|
1659
|
//}
|
1660
|
|
1661
|
}
|
1662
|
|
1663
|
}
|
1664
|
|
1665
|
cekMandatoryIsNull = function (tableName) {
|
1666
|
var fields_ = Ext.ComponentQuery.query('[nameTable=' + tableName + '][wasValid=false][allowBlank=false]');
|
1667
|
var param_ = '';
|
1668
|
if (fields_.length > 0) {
|
1669
|
for (var i = 0; i < fields_.length; i++) {
|
1670
|
if (i == 0) {
|
1671
|
param_ = ':' + fields_[i].fieldLabel
|
1672
|
} else {
|
1673
|
param_ = param_ + ',' + fields_[i].fieldLabel;
|
1674
|
}
|
1675
|
|
1676
|
}
|
1677
|
}
|
1678
|
return param_
|
1679
|
}
|
1680
|
|
1681
|
getErrorFields = function (tableName) {
|
1682
|
var fields_ = Ext.ComponentQuery.query('[nameTable=' + tableName + '][wasValid=false]');
|
1683
|
var param_ = '';
|
1684
|
if (fields_.length > 0) {
|
1685
|
for (var i = 0; i < fields_.length; i++) {
|
1686
|
if (i == 0) {
|
1687
|
param_ = ':' + fields_[i].fieldLabel;
|
1688
|
} else {
|
1689
|
param_ = param_ + ',' + fields_[i].fieldLabel;
|
1690
|
}
|
1691
|
|
1692
|
}
|
1693
|
}
|
1694
|
return param_
|
1695
|
}
|
1696
|
|
1697
|
setValueAmountEncrypt = function (tableName) {
|
1698
|
var f = Ext.ComponentQuery.query('[nameTable=' + tableName + '][isEncrypt=true]');
|
1699
|
for (var i = 0; i < f.length; i++) {
|
1700
|
var hasil = null;
|
1701
|
var dt = Ext.ComponentQuery.query('[nameTable=' + tableName + '][isEncrypt=true]')[i].getValue();
|
1702
|
if (dt != "") {
|
1703
|
Ext.Ajax.request({
|
1704
|
async : false,
|
1705
|
method : 'POST',
|
1706
|
url : '/Devt/DecryptData',
|
1707
|
params : {
|
1708
|
dt : dt
|
1709
|
|
1710
|
},
|
1711
|
success : function (response) {
|
1712
|
var results = Ext.decode(response.responseText);
|
1713
|
hasil = results.data;
|
1714
|
Ext.ComponentQuery.query('[nameTable=' + tableName + '][isEncrypt=true]')[i].setValue(hasil);
|
1715
|
}
|
1716
|
});
|
1717
|
}
|
1718
|
}
|
1719
|
|
1720
|
}
|
1721
|
|
1722
|
setValueAmountEncryptDisplayField = function (tableName) {
|
1723
|
|
1724
|
var f = Ext.ComponentQuery.query('[nameTable=' + tableName + '][isEncryptDisplay=true]');
|
1725
|
for (var i = 0; i < f.length; i++) {
|
1726
|
var hasil = null;
|
1727
|
var dt = Ext.ComponentQuery.query('[nameTable=' + tableName + '][isEncryptDisplay=true]')[i].getValue();
|
1728
|
if (dt != "") {
|
1729
|
Ext.Ajax.request({
|
1730
|
async : false,
|
1731
|
method : 'POST',
|
1732
|
url : '/Devt/DecryptData',
|
1733
|
params : {
|
1734
|
dt : dt
|
1735
|
|
1736
|
},
|
1737
|
success : function (response) {
|
1738
|
var results = Ext.decode(response.responseText);
|
1739
|
hasil = results.data;
|
1740
|
Ext.ComponentQuery.query('[nameTable=' + tableName + '][isEncryptDisplay=true]')[i].setValue(hasil);
|
1741
|
}
|
1742
|
});
|
1743
|
}
|
1744
|
}
|
1745
|
}
|
1746
|
|
1747
|
createGridCustomization = function (Label, tableName, renderTo) {
|
1748
|
var userAction = MinovaUtil.GetActionMenu();
|
1749
|
var add = false;
|
1750
|
var copy = false;
|
1751
|
var edit = false;
|
1752
|
if (userAction != '1') {
|
1753
|
actionBtn = true;
|
1754
|
|
1755
|
} else {
|
1756
|
actionBtn = false;
|
1757
|
}
|
1758
|
if (tableName.toLowerCase() == 'sdatatablefield') {
|
1759
|
add = true;
|
1760
|
copy = true;
|
1761
|
}
|
1762
|
Ext.create('MinovaUtil.MinovaES.MinovaGridMD', {
|
1763
|
renderTo : renderTo,
|
1764
|
tableName : tableName,
|
1765
|
storename : tableName + 'Grid',
|
1766
|
name : 'gridMD' + tableName,
|
1767
|
pagesize : 10,
|
1768
|
param : '',
|
1769
|
height : 470,
|
1770
|
margin : '0 0 10 0',
|
1771
|
gridMD : tableName,
|
1772
|
tableDesc : Label,
|
1773
|
tbar : [{
|
1774
|
xtype : 'button',
|
1775
|
text : 'Action',
|
1776
|
hidden : actionBtn,
|
1777
|
name : 'actionGrid',
|
1778
|
menu : [{
|
1779
|
text : 'Add',
|
1780
|
hidden : add,
|
1781
|
name : 'addGrid',
|
1782
|
action : 'CRUDaddNewRecord',
|
1783
|
style : 'font-family: FontAwesome',
|
1784
|
itemId : 'AddData',
|
1785
|
iconCls : 'fa-plus-circle',
|
1786
|
handler : function () {
|
1787
|
var me = this;
|
1788
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1789
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
1790
|
//if (selecton_) {
|
1791
|
var display = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1792
|
if (display) {
|
1793
|
display.setHidden(false);
|
1794
|
} else {
|
1795
|
createFormCustomization(tableName, renderTo, false, selecton_, '0');
|
1796
|
g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1797
|
|
1798
|
}
|
1799
|
|
1800
|
g.setHidden(true);
|
1801
|
var fEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1802
|
fEdit.getForm().reset();
|
1803
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
1804
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
1805
|
if (tinggi < 520) {
|
1806
|
tinggi = 520;
|
1807
|
fEdit.setHeight(520);
|
1808
|
Ext.ComponentQuery.query('minovaform[tableName=' + tableName + ']')[0].setHeight(520);
|
1809
|
}
|
1810
|
p.setHeight(tinggi + 100);
|
1811
|
fEdit.act = '0';
|
1812
|
fEdit.setHidden(false);
|
1813
|
setKeyDisabled(false);
|
1814
|
//}
|
1815
|
}
|
1816
|
}, {
|
1817
|
text : 'Copy',
|
1818
|
hidden : copy,
|
1819
|
name : 'CopyGrid',
|
1820
|
iconCls : 'fa-copy',
|
1821
|
style : 'font-family: FontAwesome',
|
1822
|
handler : function () {
|
1823
|
|
1824
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1825
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
1826
|
if (selecton_) {
|
1827
|
var display = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1828
|
if (display) {
|
1829
|
display.setHidden(false);
|
1830
|
} else {
|
1831
|
createFormCustomization(tableName, renderTo, false, selecton_, '0');
|
1832
|
g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1833
|
|
1834
|
}
|
1835
|
|
1836
|
g.setHidden(true);
|
1837
|
var fEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1838
|
fEdit.getForm().setValues(selecton_.data);
|
1839
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
1840
|
var tinggi = fEdit.getHeight();
|
1841
|
if (tinggi < 520) {
|
1842
|
tinggi = 520;
|
1843
|
fEdit.setHeight(520);
|
1844
|
Ext.ComponentQuery.query('minovaform[tableName=' + tableName + ']')[0].setHeight(520);
|
1845
|
}
|
1846
|
p.setHeight(tinggi + 100);
|
1847
|
fEdit.act = '0';
|
1848
|
setKeyDisabled(false);
|
1849
|
setFileID(0);
|
1850
|
}
|
1851
|
}
|
1852
|
}, {
|
1853
|
text : 'Edit',
|
1854
|
hidden : edit,
|
1855
|
name : 'EditGrid',
|
1856
|
iconCls : 'fa-edit',
|
1857
|
style : 'font-family: FontAwesome',
|
1858
|
handler : function () {
|
1859
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1860
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
1861
|
if (selecton_) {
|
1862
|
var display = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1863
|
if (display) {
|
1864
|
display.setHidden(false);
|
1865
|
} else {
|
1866
|
createFormCustomization(tableName, renderTo, false, selecton_, '1');
|
1867
|
g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1868
|
|
1869
|
}
|
1870
|
|
1871
|
g.setHidden(true);
|
1872
|
var fEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
1873
|
fEdit.getForm().setValues(selecton_.data);
|
1874
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
1875
|
var tinggi = fEdit.getHeight();
|
1876
|
if (tinggi < 520) {
|
1877
|
tinggi = 520;
|
1878
|
fEdit.setHeight(520);
|
1879
|
Ext.ComponentQuery.query('minovaform[tableName=' + tableName + ']')[0].setHeight(520);
|
1880
|
}
|
1881
|
p.setHeight(tinggi + 100);
|
1882
|
fEdit.act = '1';
|
1883
|
setKeyDisabled(true);
|
1884
|
}
|
1885
|
}
|
1886
|
}, {
|
1887
|
text : 'Delete',
|
1888
|
name : 'DeleteGrid',
|
1889
|
hidden : true,
|
1890
|
iconCls : 'fa-trash-o',
|
1891
|
style : 'font-family: FontAwesome',
|
1892
|
}
|
1893
|
]
|
1894
|
}, {
|
1895
|
xtype : 'tbfill'
|
1896
|
}, {
|
1897
|
text : 'Search',
|
1898
|
tooltip : 'Search',
|
1899
|
tableName : tableName,
|
1900
|
name : 'btnSearchCust',
|
1901
|
handler : function () {
|
1902
|
btnSearchCust(tableName);
|
1903
|
}
|
1904
|
|
1905
|
}, {
|
1906
|
text : 'Clear Filters',
|
1907
|
tooltip : 'Clear all filters',
|
1908
|
name : 'clearbtn',
|
1909
|
handler : function () {
|
1910
|
var tolbar = this.up()
|
1911
|
var grid_ = tolbar.up()
|
1912
|
grid_.filters.clearFilters()
|
1913
|
}
|
1914
|
}, ],
|
1915
|
|
1916
|
dockedItems : [{
|
1917
|
xtype : 'pagingtoolbar',
|
1918
|
store : tableName + 'Grid',
|
1919
|
dock : 'bottom', //posisi paging
|
1920
|
pageSize : 10,
|
1921
|
displayInfo : true,
|
1922
|
|
1923
|
}
|
1924
|
],
|
1925
|
listeners : {
|
1926
|
'itemdblclick' : function (me, record, item, index, e, eOpts) {
|
1927
|
var me = this;
|
1928
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1929
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
1930
|
if (selecton_) {
|
1931
|
var display = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0];
|
1932
|
if (display) {
|
1933
|
display.setHidden(false);
|
1934
|
} else {
|
1935
|
createFormCustomization(tableName, renderTo, true, selecton_, null);
|
1936
|
g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
1937
|
|
1938
|
}
|
1939
|
|
1940
|
g.setHidden(true);
|
1941
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].getForm().setValues(selecton_.data);
|
1942
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
1943
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].getHeight();
|
1944
|
if (tinggi <= 520) {
|
1945
|
tinggi = 520;
|
1946
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHeight(520);
|
1947
|
Ext.ComponentQuery.query('minovaform[tableName=' + tableName + ']')[0].setHeight(520);
|
1948
|
}
|
1949
|
p.setHeight(tinggi + 100);
|
1950
|
}
|
1951
|
},
|
1952
|
|
1953
|
},
|
1954
|
});
|
1955
|
|
1956
|
Ext.ComponentQuery.query('[name=mainPanel]')[0].tableName = tableName;
|
1957
|
}
|
1958
|
|
1959
|
createFormCustomization = function (tableName, renderTo, isDisplay, record, act) {
|
1960
|
var name = 'MinovaGridFormEdit';
|
1961
|
var save = true;
|
1962
|
var edit = false;
|
1963
|
var delete_ = true;
|
1964
|
var back = false;
|
1965
|
|
1966
|
if (isDisplay) {
|
1967
|
name = 'MinovaGridFormDisplay'
|
1968
|
} else {
|
1969
|
save = false;
|
1970
|
edit = true;
|
1971
|
delete_ = false;
|
1972
|
back = false;
|
1973
|
}
|
1974
|
var userAction = MinovaUtil.GetActionMenu();
|
1975
|
if (userAction != '1') {
|
1976
|
save = true;
|
1977
|
edit = true;
|
1978
|
delete_ = true;
|
1979
|
}
|
1980
|
|
1981
|
if (tableName.toLowerCase() == 'sdatatablefield') {
|
1982
|
delete_ = true;
|
1983
|
|
1984
|
}
|
1985
|
Ext.create('Ext.form.Panel', {
|
1986
|
renderTo : renderTo,
|
1987
|
name : name + tableName,
|
1988
|
formMD : tableName,
|
1989
|
act : null,
|
1990
|
items : [{
|
1991
|
xtype : 'minovaForm',
|
1992
|
name : name,
|
1993
|
tableName : tableName,
|
1994
|
margin : '0 0 10 0',
|
1995
|
isDisplay : isDisplay,
|
1996
|
buttons : [{
|
1997
|
text : 'Save',
|
1998
|
hidden : save,
|
1999
|
act : act,
|
2000
|
name : 'btnSaveMD',
|
2001
|
iconCls : 'fa-save',
|
2002
|
style : 'font-family: FontAwesome',
|
2003
|
handler : function () {
|
2004
|
|
2005
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2006
|
var grid_ = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
2007
|
var panelInt = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
2008
|
if (panelInt) {
|
2009
|
panelInt.mask('Loading..');
|
2010
|
}
|
2011
|
|
2012
|
if (frm.getForm().isValid()) {
|
2013
|
Ext.Ajax.request({
|
2014
|
method : 'POST',
|
2015
|
//async: false,
|
2016
|
url : '/Devt/SaveTable',
|
2017
|
params : {
|
2018
|
tableName : tableName,
|
2019
|
data : Ext.encode(frm.getValues()),
|
2020
|
action : frm.act
|
2021
|
},
|
2022
|
waitMsg : 'Saving Data...',
|
2023
|
success : function (response) {
|
2024
|
var result = Ext.decode(response.responseText);
|
2025
|
if (result.success) {
|
2026
|
|
2027
|
MinovaMessage('Not Null', '000006', '', 'S');
|
2028
|
|
2029
|
grid_.getStore().reload();
|
2030
|
|
2031
|
frm.setHidden(true);
|
2032
|
grid_.setHidden(false);
|
2033
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2034
|
p.setHeight(520);
|
2035
|
if (getParam('ApplicantID') != 'null') {
|
2036
|
var _param = {
|
2037
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
2038
|
methodName : 'SendMailChangeMD',
|
2039
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
2040
|
|
2041
|
};
|
2042
|
|
2043
|
var results = null;
|
2044
|
Ext.Ajax.request({
|
2045
|
method : 'post',
|
2046
|
type : 'ajax',
|
2047
|
params : _param,
|
2048
|
url : '/InvokeService/Invoke/',
|
2049
|
loadMask : {
|
2050
|
msg : 'please wait...'
|
2051
|
},
|
2052
|
success : function (response) {}
|
2053
|
});
|
2054
|
}
|
2055
|
|
2056
|
} else {
|
2057
|
|
2058
|
MinovaMessage('Not Null', '000005', result.message.text, 'E')
|
2059
|
}
|
2060
|
|
2061
|
},
|
2062
|
failure : function (response) {
|
2063
|
|
2064
|
var result = Ext.decode(response.responseText);
|
2065
|
console.log(result);
|
2066
|
}
|
2067
|
});
|
2068
|
|
2069
|
} else {
|
2070
|
var param_ = cekMandatoryIsNull(tableName);
|
2071
|
if (param_ != "") {
|
2072
|
MinovaMessage('Not Null', '000009', param_, 'E');
|
2073
|
} else {
|
2074
|
// ada field yang error
|
2075
|
var error_ = getErrorFields(tableName);
|
2076
|
if (error_ != '') {
|
2077
|
MinovaMessage('title', '000005', error_, 'E');
|
2078
|
}
|
2079
|
|
2080
|
}
|
2081
|
}
|
2082
|
if (panelInt) {
|
2083
|
panelInt.unmask();
|
2084
|
}
|
2085
|
|
2086
|
}
|
2087
|
}, {
|
2088
|
text : 'Delete',
|
2089
|
hidden : delete_,
|
2090
|
iconCls : 'fa-trash-o',
|
2091
|
name : 'btnDeleteMD',
|
2092
|
style : 'font-family: FontAwesome',
|
2093
|
action : 'CRUDdelete',
|
2094
|
handler : function () {
|
2095
|
|
2096
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2097
|
var grid_ = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
2098
|
MinovaMessage('Message', '000007', '', 'C', function (respone) {
|
2099
|
if (respone == "yes") {
|
2100
|
|
2101
|
if (frm.getForm().isValid()) {
|
2102
|
Ext.Ajax.request({
|
2103
|
async : false,
|
2104
|
method : 'POST',
|
2105
|
url : '/Devt/SaveTable',
|
2106
|
params : {
|
2107
|
tableName : tableName,
|
2108
|
data : Ext.encode(frm.getValues()),
|
2109
|
action : '2'
|
2110
|
},
|
2111
|
waitMsg : 'Saving Data...',
|
2112
|
success : function (response) {
|
2113
|
var result = Ext.decode(response.responseText);
|
2114
|
if (result.success) {
|
2115
|
|
2116
|
MinovaMessage('', 'BSDEL', '', 'S');
|
2117
|
grid_.getStore().reload();
|
2118
|
|
2119
|
frm.setHidden(true);
|
2120
|
grid_.setHidden(false);
|
2121
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2122
|
p.setHeight(520);
|
2123
|
if (getParam('ApplicantID') != 'null') {
|
2124
|
var _param = {
|
2125
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
2126
|
methodName : 'SendMailChangeMD',
|
2127
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
2128
|
|
2129
|
};
|
2130
|
|
2131
|
var results = null;
|
2132
|
Ext.Ajax.request({
|
2133
|
method : 'post',
|
2134
|
type : 'ajax',
|
2135
|
params : _param,
|
2136
|
url : '/InvokeService/Invoke/',
|
2137
|
loadMask : {
|
2138
|
msg : 'please wait...'
|
2139
|
},
|
2140
|
success : function (response) {}
|
2141
|
});
|
2142
|
}
|
2143
|
|
2144
|
} else {
|
2145
|
|
2146
|
MinovaMessage('Not Null', '000005', result.message.text, 'E')
|
2147
|
}
|
2148
|
|
2149
|
},
|
2150
|
failure : function (response) {
|
2151
|
|
2152
|
var result = Ext.decode(response.responseText);
|
2153
|
console.log(result);
|
2154
|
}
|
2155
|
});
|
2156
|
|
2157
|
} else {
|
2158
|
var param_ = cekMandatoryIsNull(tableName);
|
2159
|
if (param_ != "") {
|
2160
|
MinovaMessage('Not Null', '000009', param_, 'E');
|
2161
|
} else {
|
2162
|
// ada field yang error
|
2163
|
var error_ = getErrorFields(tableName);
|
2164
|
if (error_ != '') {
|
2165
|
MinovaMessage('title', '000005', error_, 'E');
|
2166
|
}
|
2167
|
|
2168
|
}
|
2169
|
}
|
2170
|
|
2171
|
}
|
2172
|
|
2173
|
});
|
2174
|
|
2175
|
}
|
2176
|
|
2177
|
}, {
|
2178
|
text : 'Back to Grid',
|
2179
|
hidden : back,
|
2180
|
name : 'btnCancelMD',
|
2181
|
iconCls : 'fa-reply',
|
2182
|
style : 'font-family: FontAwesome',
|
2183
|
viewForm : name + tableName,
|
2184
|
handler : function () {
|
2185
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
2186
|
if (respone == "yes") {
|
2187
|
Ext.ComponentQuery.query('[name=' + name + tableName + ']')[0].setHidden(true);
|
2188
|
Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0].setHidden(false);
|
2189
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2190
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
2191
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = null;
|
2192
|
}
|
2193
|
var grid_ = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2194
|
//p.setTitle(grid_.tableDesc);
|
2195
|
p.setHeight(520);
|
2196
|
}
|
2197
|
});
|
2198
|
|
2199
|
}
|
2200
|
}, {
|
2201
|
text : 'Edit',
|
2202
|
hidden : edit,
|
2203
|
record : record,
|
2204
|
iconCls : 'fa-edit',
|
2205
|
style : 'font-family: FontAwesome',
|
2206
|
handler : function () {
|
2207
|
var me = this;
|
2208
|
var tbl = tableName;
|
2209
|
var grid_ = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2210
|
var selecton_ = grid_.getView().getSelectionModel().getSelection()[0];
|
2211
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0]) {
|
2212
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHidden(false)
|
2213
|
} else {
|
2214
|
createFormCustomization(tableName, renderTo, false, selecton_, '1');
|
2215
|
}
|
2216
|
|
2217
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getForm().setValues(selecton_.data);
|
2218
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2219
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight();
|
2220
|
if (tinggi < 520) {
|
2221
|
tinggi = 520;
|
2222
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].setHeight(520);
|
2223
|
Ext.ComponentQuery.query('minovaform[tableName=' + tableName + ']')[0].setHeight(520);
|
2224
|
}
|
2225
|
p.setHeight(tinggi + 100);
|
2226
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].setHidden(true);
|
2227
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].act = '1';
|
2228
|
setKeyDisabled(true);
|
2229
|
}
|
2230
|
},
|
2231
|
],
|
2232
|
|
2233
|
},
|
2234
|
]
|
2235
|
});
|
2236
|
|
2237
|
}
|
2238
|
|
2239
|
createGridCustomizationL002 = function (Label, tableName, renderTo) {
|
2240
|
var userAction = MinovaUtil.GetActionMenu();
|
2241
|
var add = false;
|
2242
|
var copy = false;
|
2243
|
var edit = false;
|
2244
|
if (userAction != '1') {
|
2245
|
actionBtn = true;
|
2246
|
|
2247
|
} else {
|
2248
|
actionBtn = false;
|
2249
|
}
|
2250
|
if (tableName.toLowerCase() == 'sdatatablefield') {
|
2251
|
add = true;
|
2252
|
copy = true;
|
2253
|
}
|
2254
|
|
2255
|
Ext.create('MinovaUtil.MinovaES.MinovaGridMD', {
|
2256
|
renderTo : renderTo,
|
2257
|
tableName : tableName,
|
2258
|
storename : tableName + 'Grid',
|
2259
|
name : 'gridMD' + tableName,
|
2260
|
pagesize : 10,
|
2261
|
param : '',
|
2262
|
height : 470,
|
2263
|
margin : '0 0 10 0',
|
2264
|
gridMD : tableName,
|
2265
|
tableDesc : Label,
|
2266
|
tbar : [{
|
2267
|
xtype : 'button',
|
2268
|
text : 'Action',
|
2269
|
hidden : actionBtn,
|
2270
|
name : 'actionGrid',
|
2271
|
menu : [{
|
2272
|
text : 'Add',
|
2273
|
hidden : add,
|
2274
|
name : 'addGrid',
|
2275
|
action : 'CRUDaddNewRecord',
|
2276
|
style : 'font-family: FontAwesome',
|
2277
|
itemId : 'AddData',
|
2278
|
iconCls : 'fa-plus-circle',
|
2279
|
handler : function () {
|
2280
|
var me = this;
|
2281
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2282
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
2283
|
//if (selecton_) {
|
2284
|
var display = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2285
|
if (display) {
|
2286
|
display.destroy();
|
2287
|
} else {
|
2288
|
display = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0];
|
2289
|
if (display) {
|
2290
|
display.destroy();
|
2291
|
}
|
2292
|
}
|
2293
|
createFormCustomizationL002(Label, tableName, renderTo, false, selecton_, '0');
|
2294
|
g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2295
|
|
2296
|
//g.setHidden(true);
|
2297
|
var fEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2298
|
fEdit.getForm().reset();
|
2299
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2300
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0].getHeight() + 520;
|
2301
|
p.setHeight(tinggi + 10);
|
2302
|
fEdit.act = '0';
|
2303
|
setKeyDisabled(false);
|
2304
|
fEdit.setHidden(false);
|
2305
|
$('html, body').animate({
|
2306
|
scrollTop : 2000
|
2307
|
}, 500);
|
2308
|
//}
|
2309
|
}
|
2310
|
}, {
|
2311
|
text : 'Copy',
|
2312
|
hidden : copy,
|
2313
|
name : 'CopyGrid',
|
2314
|
iconCls : 'fa-copy',
|
2315
|
style : 'font-family: FontAwesome',
|
2316
|
handler : function () {
|
2317
|
|
2318
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2319
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
2320
|
if (selecton_) {
|
2321
|
var display = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2322
|
if (display) {
|
2323
|
display.setHidden(false);
|
2324
|
} else {
|
2325
|
display = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0];
|
2326
|
if (display) {
|
2327
|
display.destroy();
|
2328
|
}
|
2329
|
}
|
2330
|
createFormCustomizationL002(Label, tableName, renderTo, false, selecton_, '0');
|
2331
|
g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2332
|
|
2333
|
//g.setHidden(true);
|
2334
|
var fEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2335
|
fEdit.getForm().setValues(selecton_.data);
|
2336
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2337
|
var tinggi = fEdit.getHeight() + 520;
|
2338
|
p.setHeight(tinggi + 10);
|
2339
|
fEdit.act = '0';
|
2340
|
setKeyDisabled(false);
|
2341
|
setFileID(0);
|
2342
|
$('html, body').animate({
|
2343
|
scrollTop : 2000
|
2344
|
}, 500);
|
2345
|
}
|
2346
|
}
|
2347
|
}, {
|
2348
|
text : 'Edit',
|
2349
|
hidden : edit,
|
2350
|
name : 'EditGrid',
|
2351
|
iconCls : 'fa-edit',
|
2352
|
style : 'font-family: FontAwesome',
|
2353
|
handler : function () {
|
2354
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2355
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
2356
|
if (selecton_) {
|
2357
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0]) {
|
2358
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].destroy()
|
2359
|
}
|
2360
|
var display = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2361
|
if (display) {
|
2362
|
display.setHidden(false);
|
2363
|
} else {
|
2364
|
display = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0];
|
2365
|
if (display) {
|
2366
|
display.destroy();
|
2367
|
}
|
2368
|
}
|
2369
|
createFormCustomizationL002(Label, tableName, renderTo, false, selecton_, '0');
|
2370
|
g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2371
|
|
2372
|
//g.setHidden(true);
|
2373
|
var fEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2374
|
fEdit.getForm().setValues(selecton_.data);
|
2375
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2376
|
var tinggi = fEdit.getHeight() + 520;
|
2377
|
|
2378
|
p.setHeight(tinggi + 10);
|
2379
|
setKeyDisabled(true);
|
2380
|
fEdit.act = '1';
|
2381
|
$('html, body').animate({
|
2382
|
scrollTop : 2000
|
2383
|
}, 500);
|
2384
|
}
|
2385
|
}
|
2386
|
}, {
|
2387
|
text : 'Delete',
|
2388
|
name : 'DeleteGrid',
|
2389
|
hidden : true,
|
2390
|
iconCls : 'fa-trash-o',
|
2391
|
style : 'font-family: FontAwesome',
|
2392
|
}
|
2393
|
]
|
2394
|
}, {
|
2395
|
xtype : 'tbfill'
|
2396
|
}, {
|
2397
|
text : 'Search',
|
2398
|
tooltip : 'Search',
|
2399
|
tableName : tableName,
|
2400
|
name : 'btnSearchCust',
|
2401
|
handler : function () {
|
2402
|
btnSearchCust(tableName);
|
2403
|
}
|
2404
|
|
2405
|
}, {
|
2406
|
text : 'Clear Filters',
|
2407
|
tooltip : 'Clear all filters',
|
2408
|
name : 'clearbtn',
|
2409
|
handler : function () {
|
2410
|
var tolbar = this.up()
|
2411
|
var grid_ = tolbar.up()
|
2412
|
grid_.filters.clearFilters()
|
2413
|
}
|
2414
|
}, ],
|
2415
|
|
2416
|
dockedItems : [{
|
2417
|
xtype : 'pagingtoolbar',
|
2418
|
store : tableName + 'Grid',
|
2419
|
dock : 'bottom', //posisi paging
|
2420
|
pageSize : 10,
|
2421
|
displayInfo : true,
|
2422
|
|
2423
|
}
|
2424
|
],
|
2425
|
listeners : {
|
2426
|
'itemdblclick' : function (me, record, item, index, e, eOpts) {
|
2427
|
var me = this;
|
2428
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2429
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
2430
|
if (selecton_) {
|
2431
|
|
2432
|
var fEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2433
|
if (fEdit) {
|
2434
|
fEdit.destroy();
|
2435
|
}
|
2436
|
var display = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0];
|
2437
|
if (display) {
|
2438
|
display.setHidden(false);
|
2439
|
} else {
|
2440
|
createFormCustomizationL002(Label, tableName, renderTo, true, selecton_, null);
|
2441
|
g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2442
|
|
2443
|
}
|
2444
|
|
2445
|
//g.setHidden(true);
|
2446
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].getForm().setValues(selecton_.data);
|
2447
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2448
|
var tinggi = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].getHeight();
|
2449
|
|
2450
|
p.setHeight(tinggi + 520 + 10);
|
2451
|
$('html, body').animate({
|
2452
|
scrollTop : 2000
|
2453
|
}, 500);
|
2454
|
}
|
2455
|
},
|
2456
|
|
2457
|
},
|
2458
|
});
|
2459
|
|
2460
|
Ext.ComponentQuery.query('[name=mainPanel]')[0].tableName = tableName;
|
2461
|
}
|
2462
|
|
2463
|
createFormCustomizationL002 = function (Label, tableName, renderTo, isDisplay, record, act) {
|
2464
|
var name = 'MinovaGridFormEdit';
|
2465
|
var save = true;
|
2466
|
var edit = false;
|
2467
|
var delete_ = true;
|
2468
|
var back = false;
|
2469
|
var title = "Edit ";
|
2470
|
if (isDisplay) {
|
2471
|
name = 'MinovaGridFormDisplay';
|
2472
|
title = "View ";
|
2473
|
} else {
|
2474
|
save = false;
|
2475
|
edit = true;
|
2476
|
delete_ = false;
|
2477
|
back = false;
|
2478
|
}
|
2479
|
if (act == '0') {
|
2480
|
title = "Add ";
|
2481
|
}
|
2482
|
if (act == '99') {
|
2483
|
title = "Copy ";
|
2484
|
act = '0';
|
2485
|
}
|
2486
|
var userAction = MinovaUtil.GetActionMenu();
|
2487
|
if (userAction != '1') {
|
2488
|
save = true;
|
2489
|
edit = true;
|
2490
|
delete_ = true;
|
2491
|
}
|
2492
|
|
2493
|
if (tableName.toLowerCase() == 'sdatatablefield') {
|
2494
|
delete_ = true;
|
2495
|
|
2496
|
}
|
2497
|
Ext.create('Ext.form.Panel', {
|
2498
|
renderTo : renderTo,
|
2499
|
name : name + tableName,
|
2500
|
formMD : tableName,
|
2501
|
title : title + Label,
|
2502
|
collapsible : true,
|
2503
|
|
2504
|
act : null,
|
2505
|
items : [{
|
2506
|
xtype : 'minovaForm',
|
2507
|
name : name,
|
2508
|
tableName : tableName,
|
2509
|
margin : '0 0 10 0',
|
2510
|
isDisplay : isDisplay,
|
2511
|
buttons : [{
|
2512
|
text : 'Save',
|
2513
|
hidden : save,
|
2514
|
act : act,
|
2515
|
name : 'btnSaveMD',
|
2516
|
iconCls : 'fa-save',
|
2517
|
style : 'font-family: FontAwesome',
|
2518
|
handler : function () {
|
2519
|
|
2520
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2521
|
var grid_ = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
2522
|
|
2523
|
if (frm.getForm().isValid()) {
|
2524
|
Ext.Ajax.request({
|
2525
|
method : 'POST',
|
2526
|
async : false,
|
2527
|
url : '/Devt/SaveTable',
|
2528
|
params : {
|
2529
|
tableName : tableName,
|
2530
|
data : Ext.encode(frm.getValues()),
|
2531
|
action : frm.act
|
2532
|
},
|
2533
|
waitMsg : 'Saving Data...',
|
2534
|
success : function (response) {
|
2535
|
var result = Ext.decode(response.responseText);
|
2536
|
if (result.success) {
|
2537
|
|
2538
|
MinovaMessage('Not Null', '000006', '', 'S');
|
2539
|
grid_.getStore().reload();
|
2540
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2541
|
p.setHeight(520);
|
2542
|
if (getParam('ApplicantID') != 'null') {
|
2543
|
var _param = {
|
2544
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
2545
|
methodName : 'SendMailChangeMD',
|
2546
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
2547
|
|
2548
|
};
|
2549
|
|
2550
|
var results = null;
|
2551
|
Ext.Ajax.request({
|
2552
|
method : 'post',
|
2553
|
type : 'ajax',
|
2554
|
params : _param,
|
2555
|
url : '/InvokeService/Invoke/',
|
2556
|
loadMask : {
|
2557
|
msg : 'please wait...'
|
2558
|
},
|
2559
|
success : function (response) {}
|
2560
|
});
|
2561
|
}
|
2562
|
frm.destroy();
|
2563
|
} else {
|
2564
|
|
2565
|
MinovaMessage('Not Null', '000005', result.message.text, 'E')
|
2566
|
}
|
2567
|
|
2568
|
},
|
2569
|
failure : function (response) {
|
2570
|
|
2571
|
var result = Ext.decode(response.responseText);
|
2572
|
console.log(result);
|
2573
|
}
|
2574
|
});
|
2575
|
|
2576
|
} else {
|
2577
|
var param_ = cekMandatoryIsNull(tableName);
|
2578
|
if (param_ != "") {
|
2579
|
MinovaMessage('Not Null', '000009', param_, 'E');
|
2580
|
} else {
|
2581
|
// ada field yang error
|
2582
|
var error_ = getErrorFields(tableName);
|
2583
|
if (error_ != '') {
|
2584
|
MinovaMessage('title', '000005', error_, 'E');
|
2585
|
}
|
2586
|
|
2587
|
}
|
2588
|
}
|
2589
|
|
2590
|
}
|
2591
|
}, {
|
2592
|
text : 'Delete',
|
2593
|
hidden : delete_,
|
2594
|
iconCls : 'fa-trash-o',
|
2595
|
name : 'btnDeleteMD',
|
2596
|
style : 'font-family: FontAwesome',
|
2597
|
action : 'CRUDdelete',
|
2598
|
handler : function () {
|
2599
|
|
2600
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2601
|
var grid_ = Ext.ComponentQuery.query('[gridMD=' + tableName + ']')[0];
|
2602
|
MinovaMessage('Message', '000007', '', 'C', function (respone) {
|
2603
|
if (respone == "yes") {
|
2604
|
|
2605
|
if (frm.getForm().isValid()) {
|
2606
|
Ext.Ajax.request({
|
2607
|
async : false,
|
2608
|
method : 'POST',
|
2609
|
url : '/Devt/SaveTable',
|
2610
|
params : {
|
2611
|
tableName : tableName,
|
2612
|
data : Ext.encode(frm.getValues()),
|
2613
|
action : '2'
|
2614
|
},
|
2615
|
waitMsg : 'Saving Data...',
|
2616
|
success : function (response) {
|
2617
|
var result = Ext.decode(response.responseText);
|
2618
|
if (result.success) {
|
2619
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2620
|
p.setHeight(520);
|
2621
|
if (getParam('ApplicantID') != 'null') {
|
2622
|
var _param = {
|
2623
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
2624
|
methodName : 'SendMailChangeMD',
|
2625
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
2626
|
|
2627
|
};
|
2628
|
|
2629
|
var results = null;
|
2630
|
Ext.Ajax.request({
|
2631
|
method : 'post',
|
2632
|
type : 'ajax',
|
2633
|
params : _param,
|
2634
|
url : '/InvokeService/Invoke/',
|
2635
|
loadMask : {
|
2636
|
msg : 'please wait...'
|
2637
|
},
|
2638
|
success : function (response) {}
|
2639
|
});
|
2640
|
}
|
2641
|
MinovaMessage('', 'BSDEL', '', 'S');
|
2642
|
grid_.getStore().reload();
|
2643
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2644
|
if (frm) {
|
2645
|
frm.destroy();
|
2646
|
} else {
|
2647
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].destroy()
|
2648
|
}
|
2649
|
|
2650
|
} else {
|
2651
|
|
2652
|
MinovaMessage('Not Null', '000005', result.message.text, 'E')
|
2653
|
}
|
2654
|
|
2655
|
},
|
2656
|
failure : function (response) {
|
2657
|
|
2658
|
var result = Ext.decode(response.responseText);
|
2659
|
console.log(result);
|
2660
|
}
|
2661
|
});
|
2662
|
|
2663
|
} else {
|
2664
|
var param_ = cekMandatoryIsNull(tableName);
|
2665
|
if (param_ != "") {
|
2666
|
MinovaMessage('Not Null', '000009', param_, 'E');
|
2667
|
} else {
|
2668
|
// ada field yang error
|
2669
|
var error_ = getErrorFields(tableName);
|
2670
|
if (error_ != '') {
|
2671
|
MinovaMessage('title', '000005', error_, 'E');
|
2672
|
}
|
2673
|
|
2674
|
}
|
2675
|
}
|
2676
|
|
2677
|
}
|
2678
|
|
2679
|
});
|
2680
|
|
2681
|
}
|
2682
|
|
2683
|
}, {
|
2684
|
text : 'Back to Grid',
|
2685
|
hidden : back,
|
2686
|
name : 'btnCancelMD',
|
2687
|
iconCls : 'fa-reply',
|
2688
|
style : 'font-family: FontAwesome',
|
2689
|
viewForm : name + tableName,
|
2690
|
handler : function () {
|
2691
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
2692
|
if (respone == "yes") {
|
2693
|
var frm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2694
|
if (frm) {
|
2695
|
frm.destroy();
|
2696
|
} else {
|
2697
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].destroy()
|
2698
|
}
|
2699
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2700
|
p.setHeight(520);
|
2701
|
|
2702
|
}
|
2703
|
});
|
2704
|
|
2705
|
}
|
2706
|
}, {
|
2707
|
text : 'Edit',
|
2708
|
hidden : edit,
|
2709
|
record : record,
|
2710
|
iconCls : 'fa-edit',
|
2711
|
style : 'font-family: FontAwesome',
|
2712
|
handler : function () {
|
2713
|
var me = this;
|
2714
|
var tbl = tableName;
|
2715
|
if (Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0]) {
|
2716
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + tableName + ']')[0].destroy()
|
2717
|
}
|
2718
|
var g = Ext.ComponentQuery.query('minovagridmd[tableName=' + tableName + ']')[0];
|
2719
|
var selecton_ = g.getView().getSelectionModel().getSelection()[0];
|
2720
|
createFormCustomizationL002(Label, tableName, renderTo, false, selecton_, '1');
|
2721
|
var eForm = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + tableName + ']')[0];
|
2722
|
eForm.getForm().setValues(selecton_.data);
|
2723
|
eForm.act = '1';
|
2724
|
var p = Ext.ComponentQuery.query('[name=mainPanel]')[0];
|
2725
|
var tinggi = eForm.getHeight() + 520;
|
2726
|
|
2727
|
p.setHeight(tinggi + 10);
|
2728
|
setKeyDisabled(true);
|
2729
|
$('html, body').animate({
|
2730
|
scrollTop : 2000
|
2731
|
}, 500);
|
2732
|
}
|
2733
|
},
|
2734
|
],
|
2735
|
|
2736
|
},
|
2737
|
]
|
2738
|
});
|
2739
|
|
2740
|
}
|
2741
|
|
2742
|
setKeyDisabled = function (param) {
|
2743
|
var fields_ = Ext.ComponentQuery.query('[IsPrimaryKey=1]')
|
2744
|
for (var i = 0; i < fields_.length; i++) {
|
2745
|
fields_[i].setReadOnly(param);
|
2746
|
}
|
2747
|
}
|
2748
|
|
2749
|
btnSearchCust = function (tableName) {
|
2750
|
|
2751
|
var pnl = Ext.ComponentQuery.query('[name=mainCustomization]')[0];
|
2752
|
var main_ = Ext.ComponentQuery.query('[name=mainSearch' + tableName + ']')[0];
|
2753
|
if (main_) {
|
2754
|
main_.show();
|
2755
|
} else {
|
2756
|
Ext.create('MinovaES.view.customization.searchform', {
|
2757
|
title : 'Search - ' + pnl.title,
|
2758
|
tableName : tableName,
|
2759
|
name : 'mainSearch' + tableName,
|
2760
|
}).show();
|
2761
|
}
|
2762
|
|
2763
|
}
|
2764
|
|
2765
|
setFileID = function (param) {
|
2766
|
var fields_ = Ext.ComponentQuery.query('[name=FileID]')
|
2767
|
for (var i = 0; i < fields_.length; i++) {
|
2768
|
fields_[i].setValue(param);
|
2769
|
}
|
2770
|
}
|
2771
|
|
2772
|
mdSaveForce = function (tableName, data, act) {
|
2773
|
|
2774
|
Ext.Ajax.request({
|
2775
|
method : 'POST',
|
2776
|
//async: false,
|
2777
|
url : '/Devt/SaveTable',
|
2778
|
params : {
|
2779
|
tableName : tableName,
|
2780
|
data : data,
|
2781
|
action : act,
|
2782
|
force : true
|
2783
|
},
|
2784
|
waitMsg : 'Saving Data...',
|
2785
|
success : function (response) {
|
2786
|
var result = Ext.decode(response.responseText);
|
2787
|
if (result.success) {
|
2788
|
|
2789
|
MinovaMessage('Not Null', '000006', '', 'S');
|
2790
|
var menu = Ext.ComponentQuery.query('[name = gridMenuMD]')[0];
|
2791
|
var s = menu.getStore();
|
2792
|
|
2793
|
Ext.Ajax.request({
|
2794
|
async : false,
|
2795
|
method : 'POST',
|
2796
|
url : '/UserControl/GetStore',
|
2797
|
params : {
|
2798
|
tableName : ' PDSPA0013 ',
|
2799
|
param : "ModuleType='" + MinovaUtil.GetModuleType() + "' AND Language='" + getParam("Lang") + "'"
|
2800
|
|
2801
|
},
|
2802
|
success : function (response) {
|
2803
|
var results = Ext.decode(response.responseText);
|
2804
|
var data_ = results.data;
|
2805
|
s.loadData(results.data);
|
2806
|
//s.reload()
|
2807
|
}
|
2808
|
});
|
2809
|
grid_.getStore().reload();
|
2810
|
|
2811
|
frm.setHidden(true);
|
2812
|
grid_.setHidden(false);
|
2813
|
var p = Ext.ComponentQuery.query('[name = PanelMdDetail]')[0];
|
2814
|
p.setHeight(390);
|
2815
|
if (getParam('ApplicantID') != 'null') {
|
2816
|
var _param = {
|
2817
|
serviceName : 'ERecruitmentAuthentication.asmx',
|
2818
|
methodName : 'SendMailChangeMD',
|
2819
|
parameter : 'TableName=' + tableName + '&EmployeeID=' + getParam('ApplicantID')
|
2820
|
|
2821
|
};
|
2822
|
|
2823
|
var results = null;
|
2824
|
Ext.Ajax.request({
|
2825
|
method : 'post',
|
2826
|
type : 'ajax',
|
2827
|
params : _param,
|
2828
|
url : '/InvokeService/Invoke/',
|
2829
|
loadMask : {
|
2830
|
msg : 'please wait...'
|
2831
|
},
|
2832
|
success : function (response) {}
|
2833
|
});
|
2834
|
}
|
2835
|
frm.destroy();
|
2836
|
|
2837
|
}
|
2838
|
|
2839
|
},
|
2840
|
failure : function (response) {
|
2841
|
pnl.unmask();
|
2842
|
var result = Ext.decode(response.responseText);
|
2843
|
//console.log(result);
|
2844
|
}
|
2845
|
});
|
2846
|
|
2847
|
}
|
2848
|
mdConfirm = function (tableName, data, act, msgid) {
|
2849
|
MinovaMessage('Message', msgid, '', 'C', function (respone) {
|
2850
|
if (respone == "yes") {
|
2851
|
mdSaveForce(tableName, data, act)
|
2852
|
}
|
2853
|
|
2854
|
});
|
2855
|
}
|