1
|
var isMobile = {
|
2
|
Android: function () {
|
3
|
return navigator.userAgent.match(/Android/i);
|
4
|
},
|
5
|
BlackBerry: function () {
|
6
|
return navigator.userAgent.match(/BlackBerry/i);
|
7
|
},
|
8
|
iOS: function () {
|
9
|
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
|
10
|
},
|
11
|
Opera: function () {
|
12
|
return navigator.userAgent.match(/Opera Mini/i);
|
13
|
},
|
14
|
Windows: function () {
|
15
|
return navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i);
|
16
|
},
|
17
|
any: function () {
|
18
|
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
|
19
|
}
|
20
|
};
|
21
|
var isDesk = true;
|
22
|
var layoutForm = 'column';
|
23
|
if (isMobile.Android() != null || isMobile.BlackBerry() != null || isMobile.iOS() != null) {
|
24
|
isDesk = false;
|
25
|
layoutForm = 'column'
|
26
|
} else {
|
27
|
isDesk = true;
|
28
|
layoutForm = 'column';
|
29
|
}
|
30
|
|
31
|
Ext.define('MinovaUtil.MinovaES.MinovaLookupGridold', {
|
32
|
extend: 'Ext.form.field.Trigger',
|
33
|
alias: ['widget.minovalookupgridold'],
|
34
|
|
35
|
tableName: undefined,
|
36
|
param: undefined,
|
37
|
formtarget: undefined,
|
38
|
anchor: '50%',
|
39
|
pagesize: undefined,
|
40
|
fieldTarget: undefined,
|
41
|
fieldValue: undefined,
|
42
|
isGrid: undefined,
|
43
|
isMultiSelect: undefined,
|
44
|
LookupFunction: undefined,
|
45
|
SearchFunction: undefined,
|
46
|
|
47
|
trigger1Cls: Ext.baseCSSPrefix + 'form-clear-trigger',
|
48
|
trigger2Cls: Ext.baseCSSPrefix + 'form-search-trigger',
|
49
|
setValue: function (v) {
|
50
|
var me = this;
|
51
|
var value = v;
|
52
|
this.value = '';
|
53
|
this.value = v;
|
54
|
if (value != "" && value != undefined) {
|
55
|
data_ = undefined;
|
56
|
Ext.Ajax.request({
|
57
|
async: false,
|
58
|
method: 'POST',
|
59
|
url: '/UserControl/GetStore',
|
60
|
params: {
|
61
|
tableName: 'PDSCMTABLE',
|
62
|
param: this.tableName + ',' + v + ',hasil'
|
63
|
},
|
64
|
success: function (response) {
|
65
|
var results = Ext.decode(response.responseText);
|
66
|
data_ = results.data
|
67
|
if (data_.length > 0) {
|
68
|
me.setRawValue(v + ' - ' + data_[0].hasil)
|
69
|
|
70
|
}
|
71
|
}
|
72
|
});
|
73
|
}
|
74
|
},
|
75
|
getValue: function () {
|
76
|
var hasil = this.value;
|
77
|
if (this.valData) {
|
78
|
hasil = this.valData;
|
79
|
}
|
80
|
return hasil;
|
81
|
},
|
82
|
getSubmitValue: function () {
|
83
|
var hasil = this.value;
|
84
|
if (this.valData) {
|
85
|
hasil = this.valData;
|
86
|
}
|
87
|
return hasil;
|
88
|
},
|
89
|
initComponent: function () {
|
90
|
//var formtarget_ = this.formtarget;
|
91
|
var pagesize = this.pagesize;
|
92
|
var tableName = this.tableName;
|
93
|
this.callParent();
|
94
|
},
|
95
|
onRender: function () {
|
96
|
var me = this,
|
97
|
el;
|
98
|
|
99
|
me.callParent(arguments);
|
100
|
|
101
|
el = me.triggerEl.first().parent();
|
102
|
el.setVisibilityMode(Ext.Element.DISPLAY);
|
103
|
el.hide();
|
104
|
},
|
105
|
|
106
|
onChange: function (newVal, oldVal) {
|
107
|
var me = this
|
108
|
el = me.triggerEl.first().parent();
|
109
|
|
110
|
me.callParent(arguments);
|
111
|
|
112
|
if (newVal.length) {
|
113
|
el.show();
|
114
|
} else {
|
115
|
el.hide();
|
116
|
}
|
117
|
},
|
118
|
|
119
|
onTrigger1Click: function (event) {
|
120
|
var me = this;
|
121
|
if (me.hideTrigger) {
|
122
|
return;
|
123
|
}
|
124
|
me.setValue("");
|
125
|
me.fireEvent('cleartriggerclick', me, event);
|
126
|
},
|
127
|
onTrigger2Click: function () {
|
128
|
//alert('asa')
|
129
|
var isGrid_ = this.isGrid;
|
130
|
var fieldTarget_ = this.fieldTarget;
|
131
|
var formtarget_ = this.formtarget;
|
132
|
var fieldValue_ = this.fieldValue;
|
133
|
var tableName = this.tableName;
|
134
|
var LookupFunction_ = this.LookupFunction;
|
135
|
var SearchFunction_ = this.SearchFunction;
|
136
|
var pnl = Ext.ComponentQuery.query('[name=' + formtarget_ + ']')[0];
|
137
|
|
138
|
if (tableName == 'PDSPY0006') {
|
139
|
Ext.create('Ext.window.Window', {
|
140
|
title: 'Lookup - ' + this.fieldLabel,
|
141
|
//hamid
|
142
|
controller: 'rdlreportPayResult',
|
143
|
//end hamid
|
144
|
height: 530,
|
145
|
width: 500,
|
146
|
fieldTarget: fieldTarget_,
|
147
|
fieldValue: fieldValue_,
|
148
|
isGrid: isGrid_,
|
149
|
name: 'lookupMain',
|
150
|
//modal: true,
|
151
|
listeners: {
|
152
|
'beforeshow': function (g) {
|
153
|
pnl.mask('Loading...');
|
154
|
setTimeout(function () {
|
155
|
pnl.unmask();
|
156
|
}, 100);
|
157
|
}
|
158
|
},
|
159
|
items: [{
|
160
|
xtype: 'minovaform',
|
161
|
bodyBorder: false,
|
162
|
MaxHeigth: '100',
|
163
|
cls: 'borderLookup',
|
164
|
border: false,
|
165
|
scroll: true,
|
166
|
isLookup: true,
|
167
|
name: "formLookupFilter",
|
168
|
tableName: this.tableName,
|
169
|
buttons: [{
|
170
|
text: 'Search',
|
171
|
//iconCls : 'fa-edit',
|
172
|
//style : 'font-family: FontAwesome',
|
173
|
handler: function () {
|
174
|
var store = Ext.data.StoreManager.lookup('lookupStore');
|
175
|
var form = Ext.ComponentQuery.query('[name=formLookupFilter]')[0].getForm();
|
176
|
grid = Ext.ComponentQuery.query('[name=gridLookup]')[0];
|
177
|
var values_ = form.getValues();
|
178
|
var fields_ = form.getFields().items;
|
179
|
var param_ = '';
|
180
|
for (var i = 0; i < fields_.length; i++) {
|
181
|
var val_ = form.getFields().items[i].getValue();
|
182
|
var xtype_ = form.getFields().items[i].xtype;
|
183
|
var oprator_ = '[like]';
|
184
|
if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
185
|
oprator_ = '[Equal]';
|
186
|
}
|
187
|
if (xtype_ == 'datefield') {
|
188
|
if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
189
|
oprator_ = '[LessThanEqual]';
|
190
|
} else {
|
191
|
oprator_ = '[GreaterThanEqual]';
|
192
|
}
|
193
|
}
|
194
|
if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
195
|
param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
196
|
}
|
197
|
}
|
198
|
store.proxy.extraParams = {
|
199
|
tableName: grid.tableName,
|
200
|
param: param_,
|
201
|
menuId: MinovaUtil.GetMenuID()
|
202
|
};
|
203
|
store.removeAll();
|
204
|
store.reload();
|
205
|
store.loadPage(1);
|
206
|
}
|
207
|
|
208
|
}
|
209
|
],
|
210
|
}, {
|
211
|
xtype: 'minovagrid1',
|
212
|
isLookup: true,
|
213
|
autoLoad: false,
|
214
|
minHeight: 280,
|
215
|
height: 380,
|
216
|
tableName: this.tableName,
|
217
|
param: '',
|
218
|
//name: 'gridForm' + this.tableName,
|
219
|
name: 'gridLookup',
|
220
|
hidebutton: 0,
|
221
|
pagesize: 25,
|
222
|
storename: 'lookupStore',
|
223
|
listeners: {
|
224
|
itemdblclick: function (g) {
|
225
|
|
226
|
var me = this;
|
227
|
var selection = this.getView().getSelectionModel().getSelection()[0];
|
228
|
var name_ = 'form[name=' + formtarget_ + ']';
|
229
|
var form_ = Ext.ComponentQuery.query(name_)[0].getForm();
|
230
|
var mainLookup = Ext.ComponentQuery.query('[name=lookupMain]')[0];
|
231
|
var targetField = mainLookup.fieldTarget;
|
232
|
if (mainLookup.isGrid) {
|
233
|
if (targetField) {
|
234
|
targetField = targetField.split('$')
|
235
|
var dt = targetField[0].split(',');
|
236
|
var fieldValue = targetField[1].split(',');
|
237
|
if (fieldValue.length > 0) {
|
238
|
for (i in dt) {
|
239
|
field_ = dt[i];
|
240
|
Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
241
|
}
|
242
|
} else {
|
243
|
for (i in dt) {
|
244
|
field_ = dt[i];
|
245
|
Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
246
|
}
|
247
|
}
|
248
|
|
249
|
}
|
250
|
}
|
251
|
//else {// untuk form
|
252
|
if (targetField) {
|
253
|
var dt = targetField.split(',');
|
254
|
var fieldValue = mainLookup.fieldValue.split(',');
|
255
|
if (fieldValue.length > 0) {
|
256
|
for (i in dt) {
|
257
|
field_ = dt[i];
|
258
|
Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
259
|
}
|
260
|
} else {
|
261
|
for (i in dt) {
|
262
|
field_ = dt[i];
|
263
|
Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
264
|
}
|
265
|
}
|
266
|
} else {
|
267
|
form_.setValues(selection.data);
|
268
|
}
|
269
|
//}
|
270
|
|
271
|
mainLookup.destroy();
|
272
|
},
|
273
|
beforeedit: function (grid) {
|
274
|
return false;
|
275
|
}
|
276
|
},
|
277
|
dockedItems: [{
|
278
|
xtype: 'pagingtoolbar',
|
279
|
store: 'lookupStore',
|
280
|
dock: 'bottom',
|
281
|
pageSize: 25,
|
282
|
displayInfo: true
|
283
|
}
|
284
|
]
|
285
|
|
286
|
}, ]
|
287
|
}).show();
|
288
|
} else {
|
289
|
// hamid
|
290
|
Ext.create('Ext.window.Window', {
|
291
|
title: 'Lookup - ' + this.fieldLabel,
|
292
|
height: 560,
|
293
|
width: 500,
|
294
|
fieldTarget: fieldTarget_,
|
295
|
fieldValue: fieldValue_,
|
296
|
isGrid: isGrid_,
|
297
|
name: 'lookupMain',
|
298
|
//modal: true,
|
299
|
listeners: {
|
300
|
'beforeshow': function (g) {
|
301
|
pnl.mask('Loading...');
|
302
|
setTimeout(function () {
|
303
|
pnl.unmask();
|
304
|
}, 100);
|
305
|
}
|
306
|
},
|
307
|
items: [{
|
308
|
xtype: 'minovaform',
|
309
|
bodyBorder: false,
|
310
|
MaxHeigth: '100',
|
311
|
cls: 'borderLookup',
|
312
|
border: false,
|
313
|
MaxHeigth: '30',
|
314
|
scroll: true,
|
315
|
isLookup: true,
|
316
|
name: "formLookupFilter",
|
317
|
tableName: this.tableName,
|
318
|
buttons: [{
|
319
|
text: 'Search',
|
320
|
//iconCls : 'fa-edit',
|
321
|
//style : 'font-family: FontAwesome',
|
322
|
handler: function () {
|
323
|
|
324
|
var store = Ext.data.StoreManager.lookup('lookupStore');
|
325
|
var form = Ext.ComponentQuery.query('[name=formLookupFilter]')[0].getForm();
|
326
|
grid = Ext.ComponentQuery.query('[name=gridLookup]')[0];
|
327
|
var values_ = form.getValues();
|
328
|
var fields_ = form.getFields().items;
|
329
|
var param_ = '';
|
330
|
for (var i = 0; i < fields_.length; i++) {
|
331
|
var val_ = form.getFields().items[i].getValue();
|
332
|
var xtype_ = form.getFields().items[i].xtype;
|
333
|
var oprator_ = '[like]';
|
334
|
if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
335
|
oprator_ = '[Equal]';
|
336
|
}
|
337
|
if (xtype_ == 'datefield') {
|
338
|
if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
339
|
oprator_ = '[LessThanEqual]';
|
340
|
} else {
|
341
|
oprator_ = '[GreaterThanEqual]';
|
342
|
}
|
343
|
}
|
344
|
if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
345
|
param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
346
|
}
|
347
|
}
|
348
|
|
349
|
if (SearchFunction_ != undefined && SearchFunction_ != "") {
|
350
|
eval(SearchFunction_);
|
351
|
} else {
|
352
|
store.proxy.extraParams = {
|
353
|
tableName: grid.tableName,
|
354
|
param: param_,
|
355
|
menuId: MinovaUtil.GetMenuID()
|
356
|
};
|
357
|
}
|
358
|
store.removeAll();
|
359
|
store.reload();
|
360
|
store.loadPage(1);
|
361
|
}
|
362
|
|
363
|
}
|
364
|
],
|
365
|
}, {
|
366
|
xtype: 'minovagrid1',
|
367
|
isLookup: true,
|
368
|
autoLoad: false,
|
369
|
minHeight: 240,
|
370
|
height: 340,
|
371
|
tableName: this.tableName,
|
372
|
param: '',
|
373
|
//name: 'gridForm' + this.tableName,
|
374
|
name: 'gridLookup',
|
375
|
hidebutton: 0,
|
376
|
pagesize: 25,
|
377
|
storename: 'lookupStore',
|
378
|
listeners: {
|
379
|
itemdblclick: function (g) {
|
380
|
var LookupFunction = LookupFunction_;
|
381
|
|
382
|
var me = this;
|
383
|
var selection = this.getView().getSelectionModel().getSelection()[0];
|
384
|
var pnlMain = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
385
|
var name_ = 'form[name=' + formtarget_ + ']';
|
386
|
if (pnlMain) {
|
387
|
name_ = 'form[name=' + formtarget_ + pnlMain.nameTable + ']';
|
388
|
}
|
389
|
|
390
|
var form_ = Ext.ComponentQuery.query(name_)[0].getForm();
|
391
|
var mainLookup = Ext.ComponentQuery.query('[name=lookupMain]')[0];
|
392
|
var targetField = mainLookup.fieldTarget;
|
393
|
if (mainLookup.isGrid) {
|
394
|
if (targetField) {
|
395
|
targetField = targetField.split('$')
|
396
|
var dt = targetField[0].split(',');
|
397
|
var fieldValue = targetField[1].split(',');
|
398
|
if (fieldValue.length > 0) {
|
399
|
for (i in dt) {
|
400
|
field_ = dt[i];
|
401
|
Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
402
|
}
|
403
|
} else {
|
404
|
for (i in dt) {
|
405
|
field_ = dt[i];
|
406
|
Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
407
|
}
|
408
|
}
|
409
|
|
410
|
}
|
411
|
} else { // untuk form
|
412
|
if (targetField) {
|
413
|
var dt = targetField.split(',');
|
414
|
var fieldValue = mainLookup.fieldValue.split(',');
|
415
|
if (fieldValue.length > 0) {
|
416
|
for (i in dt) {
|
417
|
field_ = dt[i];
|
418
|
Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
419
|
}
|
420
|
} else {
|
421
|
for (i in dt) {
|
422
|
field_ = dt[i];
|
423
|
Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
424
|
}
|
425
|
}
|
426
|
} else {
|
427
|
form_.setValues(selection.data);
|
428
|
}
|
429
|
}
|
430
|
eval(LookupFunction);
|
431
|
mainLookup.destroy();
|
432
|
},
|
433
|
beforeedit: function (grid) {
|
434
|
return false;
|
435
|
}
|
436
|
},
|
437
|
dockedItems: [{
|
438
|
xtype: 'pagingtoolbar',
|
439
|
store: 'lookupStore',
|
440
|
dock: 'bottom',
|
441
|
pageSize: 25,
|
442
|
displayInfo: true
|
443
|
}
|
444
|
]
|
445
|
|
446
|
}, ]
|
447
|
}).show();
|
448
|
}
|
449
|
//Ext.create('Ext.window.Window', {
|
450
|
// title: 'Lookup - ' + this.fieldLabel,
|
451
|
// height: 530,
|
452
|
// width: 500,
|
453
|
// fieldTarget: fieldTarget_,
|
454
|
// fieldValue: fieldValue_,
|
455
|
// isGrid: isGrid_,
|
456
|
// name: 'lookupMain',
|
457
|
// //modal: true,
|
458
|
// listeners: {
|
459
|
// 'beforeshow': function (g) {
|
460
|
// pnl.mask('Loading...');
|
461
|
// setTimeout(function () {
|
462
|
// pnl.unmask();
|
463
|
// }, 100);
|
464
|
// }
|
465
|
// },
|
466
|
// items: [{
|
467
|
// xtype: 'minovaform',
|
468
|
// bodyBorder: false,
|
469
|
// MaxHeigth: '100',
|
470
|
// cls: 'borderLookup',
|
471
|
// border: false,
|
472
|
// MaxHeigth: '30',
|
473
|
// scroll: true,
|
474
|
// isLookup: true,
|
475
|
// name: "formLookupFilter",
|
476
|
// tableName: this.tableName,
|
477
|
// buttons: [{
|
478
|
// text: 'Search',
|
479
|
// //iconCls : 'fa-edit',
|
480
|
// //style : 'font-family: FontAwesome',
|
481
|
// handler: function () {
|
482
|
// var store = Ext.data.StoreManager.lookup('lookupStore');
|
483
|
// var form = Ext.ComponentQuery.query('[name=formLookupFilter]')[0].getForm();
|
484
|
// grid = Ext.ComponentQuery.query('[name=gridLookup]')[0];
|
485
|
// var values_ = form.getValues();
|
486
|
// var fields_ = form.getFields().items;
|
487
|
// var param_ = '';
|
488
|
// for (var i = 0; i < fields_.length; i++) {
|
489
|
// var val_ = form.getFields().items[i].getValue();
|
490
|
// var xtype_ = form.getFields().items[i].xtype;
|
491
|
// var oprator_ = '[like]';
|
492
|
// if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
493
|
// oprator_ = '[Equal]';
|
494
|
// }
|
495
|
// if (xtype_ == 'datefield') {
|
496
|
// if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
497
|
// oprator_ = '[LessThanEqual]';
|
498
|
// } else {
|
499
|
// oprator_ = '[GreaterThanEqual]';
|
500
|
// }
|
501
|
// }
|
502
|
// if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
503
|
// param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
504
|
// }
|
505
|
// }
|
506
|
// store.proxy.extraParams = {
|
507
|
// tableName: grid.tableName,
|
508
|
// param: param_
|
509
|
// };
|
510
|
// store.removeAll();
|
511
|
// store.reload();
|
512
|
// store.loadPage(1);
|
513
|
// }
|
514
|
|
515
|
// }
|
516
|
// ],
|
517
|
// }, {
|
518
|
// xtype: 'minovagrid1',
|
519
|
// isLookup: true,
|
520
|
// autoLoad: false,
|
521
|
// minHeight: 280,
|
522
|
// height: 380,
|
523
|
// tableName: this.tableName,
|
524
|
// param: '',
|
525
|
// //name: 'gridForm' + this.tableName,
|
526
|
// name: 'gridLookup',
|
527
|
// hidebutton: 0,
|
528
|
// pagesize: 25,
|
529
|
// storename: 'lookupStore',
|
530
|
// listeners: {
|
531
|
// itemdblclick: function (g) {
|
532
|
// var me = this;
|
533
|
// var selection = this.getView().getSelectionModel().getSelection()[0];
|
534
|
// var name_ = 'form[name=' + formtarget_ + ']';
|
535
|
// var form_ = Ext.ComponentQuery.query(name_)[0].getForm();
|
536
|
// var mainLookup = Ext.ComponentQuery.query('[name=lookupMain]')[0];
|
537
|
// var targetField = mainLookup.fieldTarget;
|
538
|
// if (mainLookup.isGrid) {
|
539
|
// if (targetField) {
|
540
|
// targetField = targetField.split('$')
|
541
|
// var dt = targetField[0].split(',');
|
542
|
// var fieldValue = targetField[1].split(',');
|
543
|
// if (fieldValue.length > 0) {
|
544
|
// for (i in dt) {
|
545
|
// field_ = dt[i];
|
546
|
// Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
547
|
// }
|
548
|
// } else {
|
549
|
// for (i in dt) {
|
550
|
// field_ = dt[i];
|
551
|
// Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
552
|
// }
|
553
|
// }
|
554
|
|
555
|
|
556
|
// }
|
557
|
// }
|
558
|
// else {// untuk form
|
559
|
// if (targetField) {
|
560
|
// var dt = targetField.split(',');
|
561
|
// var fieldValue = mainLookup.fieldValue.split(',');
|
562
|
// if (fieldValue.length > 0) {
|
563
|
// for (i in dt) {
|
564
|
// field_ = dt[i];
|
565
|
// Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
566
|
// }
|
567
|
// } else {
|
568
|
// for (i in dt) {
|
569
|
// field_ = dt[i];
|
570
|
// Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
571
|
// }
|
572
|
// }
|
573
|
// }
|
574
|
// else {
|
575
|
// form_.setValues(selection.data);
|
576
|
// }
|
577
|
// }
|
578
|
|
579
|
// mainLookup.destroy();
|
580
|
// },
|
581
|
// beforeedit: function (grid) {
|
582
|
// return false;
|
583
|
// }
|
584
|
// },
|
585
|
// dockedItems: [{
|
586
|
// xtype: 'pagingtoolbar',
|
587
|
// store: 'lookupStore',
|
588
|
// dock: 'bottom',
|
589
|
// pageSize: 25,
|
590
|
// displayInfo: true
|
591
|
// }
|
592
|
// ]
|
593
|
|
594
|
// }, ]
|
595
|
//}).show();
|
596
|
|
597
|
},
|
598
|
onTrigger1Click: function (event) {
|
599
|
var me = this;
|
600
|
if (me.hideTrigger) {
|
601
|
return;
|
602
|
}
|
603
|
me.setValue("");
|
604
|
me.fireEvent('cleartriggerclick', me, event);
|
605
|
},
|
606
|
|
607
|
});
|
608
|
|
609
|
Ext.define('MinovaUtil.MinovaES.MinovaLookupGrid', {
|
610
|
extend: 'Ext.form.field.Trigger',
|
611
|
alias: ['widget.minovalookupgrid', 'widget.minovalookupgrid2'],
|
612
|
tableName: undefined,
|
613
|
param: undefined,
|
614
|
formtarget: undefined,
|
615
|
anchor: '50%',
|
616
|
pagesize: undefined,
|
617
|
fieldTarget: undefined,
|
618
|
fieldValue: undefined,
|
619
|
isGrid: undefined,
|
620
|
isMultiSelect: undefined,
|
621
|
LookupFunction: undefined,
|
622
|
SearchFunction: undefined,
|
623
|
trigger1Cls: Ext.baseCSSPrefix + 'form-clear-trigger',
|
624
|
trigger2Cls: Ext.baseCSSPrefix + 'form-search-trigger',
|
625
|
//clearCls: 'x-form-search-clear',
|
626
|
fieldGrid: undefined,
|
627
|
|
628
|
onTrigger1Click: function (event) {
|
629
|
var me = this;
|
630
|
if (me.hideTrigger) {
|
631
|
return;
|
632
|
}
|
633
|
me.setValue("");
|
634
|
me.setRawValue("");
|
635
|
me.fireEvent('cleartriggerclick', me, event);
|
636
|
},
|
637
|
//onTrigger1Click: function (field) {
|
638
|
// Ext.Msg.alert("Trigger 1", "Trigger One!!!");
|
639
|
//},
|
640
|
setValue: function (v) {
|
641
|
var me = this;
|
642
|
var value = v;
|
643
|
this.value = '';
|
644
|
this.value = v;
|
645
|
me.setRawValue(v);
|
646
|
if (value != "" && value != undefined) {
|
647
|
data_ = undefined;
|
648
|
Ext.Ajax.request({
|
649
|
async: false,
|
650
|
method: 'POST',
|
651
|
url: '/UserControl/GetStore',
|
652
|
params: {
|
653
|
tableName: 'PDSCMTABLE',
|
654
|
param: this.tableName + ',' + v + ',hasil'
|
655
|
},
|
656
|
success: function (response) {
|
657
|
var results = Ext.decode(response.responseText);
|
658
|
data_ = results.data
|
659
|
if (data_ != null) {
|
660
|
if (data_.length > 0) {
|
661
|
me.setRawValue(v + ' - ' + data_[0].hasil);
|
662
|
|
663
|
}
|
664
|
}
|
665
|
|
666
|
}
|
667
|
});
|
668
|
}
|
669
|
//if (me.getRawValue() == "") {
|
670
|
// me.value(v);
|
671
|
// me.setRawValue(v);
|
672
|
//}
|
673
|
},
|
674
|
getValue: function () {
|
675
|
var me = this;
|
676
|
var hasil = this.value;
|
677
|
if (this.valData) {
|
678
|
hasil = this.valData;
|
679
|
}
|
680
|
if (hasil == undefined) {
|
681
|
hasil = me.getRawValue();
|
682
|
}
|
683
|
return hasil;
|
684
|
},
|
685
|
getSubmitValue: function () {
|
686
|
var me = this;
|
687
|
var hasil = this.value;
|
688
|
if (this.valData) {
|
689
|
hasil = this.valData;
|
690
|
}
|
691
|
if (hasil == undefined) {
|
692
|
hasil = me.getRawValue();
|
693
|
}
|
694
|
return hasil;
|
695
|
},
|
696
|
initComponent: function () {
|
697
|
//var formtarget_ = this.formtarget;
|
698
|
var pagesize = this.pagesize;
|
699
|
var tableName = this.tableName;
|
700
|
var fieldGrid_ = this.fieldGrid;
|
701
|
this.callParent();
|
702
|
},
|
703
|
onTrigger2Click: function () {
|
704
|
//alert('asa')
|
705
|
var isGrid_ = this.isGrid;
|
706
|
var fieldTarget_ = this.fieldTarget;
|
707
|
var formtarget_ = this.formtarget;
|
708
|
var fieldValue_ = this.fieldValue;
|
709
|
var tableName = this.tableName;
|
710
|
var LookupFunction_ = this.LookupFunction;
|
711
|
var SearchFunction_ = this.SearchFunction;
|
712
|
var fieldGrid_ = this.fieldGrid;
|
713
|
var pnl = Ext.ComponentQuery.query('[name=' + formtarget_ + ']')[0];
|
714
|
|
715
|
if (tableName == 'PDSPY0006') {
|
716
|
Ext.create('Ext.window.Window', {
|
717
|
title: 'Lookup - ' + this.fieldLabel,
|
718
|
//hamid
|
719
|
controller: 'rdlreportPayResult',
|
720
|
//end hamid
|
721
|
height: 530,
|
722
|
width: 500,
|
723
|
fieldTarget: fieldTarget_,
|
724
|
fieldValue: fieldValue_,
|
725
|
isGrid: isGrid_,
|
726
|
name: 'lookupMain',
|
727
|
//modal: true,
|
728
|
listeners: {
|
729
|
'beforeshow': function (g) {
|
730
|
pnl.mask('Loading...');
|
731
|
setTimeout(function () {
|
732
|
pnl.unmask();
|
733
|
}, 100);
|
734
|
}
|
735
|
},
|
736
|
items: [{
|
737
|
xtype: 'minovaform',
|
738
|
bodyBorder: false,
|
739
|
MaxHeigth: '100',
|
740
|
cls: 'borderLookup',
|
741
|
border: false,
|
742
|
scroll: true,
|
743
|
isLookup: true,
|
744
|
name: "formLookupFilter",
|
745
|
tableName: this.tableName,
|
746
|
buttons: [{
|
747
|
text: 'Search',
|
748
|
//iconCls : 'fa-edit',
|
749
|
//style : 'font-family: FontAwesome',
|
750
|
handler: function () {
|
751
|
var store = Ext.data.StoreManager.lookup('lookupStore');
|
752
|
var form = Ext.ComponentQuery.query('[name=formLookupFilter]')[0].getForm();
|
753
|
grid = Ext.ComponentQuery.query('[name=gridLookup]')[0];
|
754
|
var values_ = form.getValues();
|
755
|
var fields_ = form.getFields().items;
|
756
|
var param_ = '';
|
757
|
for (var i = 0; i < fields_.length; i++) {
|
758
|
var val_ = form.getFields().items[i].getValue();
|
759
|
var xtype_ = form.getFields().items[i].xtype;
|
760
|
var oprator_ = '[like]';
|
761
|
if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
762
|
oprator_ = '[Equal]';
|
763
|
}
|
764
|
if (xtype_ == 'datefield') {
|
765
|
if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
766
|
oprator_ = '[LessThanEqual]';
|
767
|
} else {
|
768
|
oprator_ = '[GreaterThanEqual]';
|
769
|
}
|
770
|
}
|
771
|
if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
772
|
param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
773
|
}
|
774
|
}
|
775
|
store.proxy.extraParams = {
|
776
|
tableName: grid.tableName,
|
777
|
param: param_,
|
778
|
menuId: MinovaUtil.GetMenuID()
|
779
|
};
|
780
|
store.removeAll();
|
781
|
store.reload();
|
782
|
store.loadPage(1);
|
783
|
}
|
784
|
|
785
|
}
|
786
|
],
|
787
|
}, {
|
788
|
xtype: 'minovagrid2',
|
789
|
isLookup: true,
|
790
|
autoLoad: false,
|
791
|
minHeight: 280,
|
792
|
fieldGrid: fieldGrid_,
|
793
|
height: 380,
|
794
|
tableName: this.tableName,
|
795
|
param: '',
|
796
|
//name: 'gridForm' + this.tableName,
|
797
|
name: 'gridLookup',
|
798
|
hidebutton: 0,
|
799
|
pagesize: 25,
|
800
|
storename: 'lookupStore',
|
801
|
listeners: {
|
802
|
itemdblclick: function (g) {
|
803
|
|
804
|
var me = this;
|
805
|
|
806
|
var selection = this.getView().getSelectionModel().getSelection()[0];
|
807
|
var name_ = 'form[name=' + formtarget_ + ']';
|
808
|
var form_ = Ext.ComponentQuery.query(name_)[0].getForm();
|
809
|
var mainLookup = Ext.ComponentQuery.query('[name=lookupMain]')[0];
|
810
|
var targetField = mainLookup.fieldTarget;
|
811
|
if (mainLookup.isGrid) {
|
812
|
var b = Ext.ComponentQuery.query('[fieldGrid=' + me.fieldGrid + ']')[0];
|
813
|
if (b) {
|
814
|
b.setValue(eval('selection.data.' + me.fieldGrid));
|
815
|
}
|
816
|
if (targetField) {
|
817
|
targetField = targetField.split('$')
|
818
|
var dt = targetField[0].split(',');
|
819
|
var fieldValue = targetField[1].split(',');
|
820
|
if (fieldValue.length > 0) {
|
821
|
for (i in dt) {
|
822
|
field_ = dt[i];
|
823
|
Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
824
|
}
|
825
|
} else {
|
826
|
for (i in dt) {
|
827
|
field_ = dt[i];
|
828
|
Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
829
|
}
|
830
|
}
|
831
|
}
|
832
|
}
|
833
|
//else {// untuk form
|
834
|
if (targetField) {
|
835
|
var dt = targetField.split(',');
|
836
|
var fieldValue = mainLookup.fieldValue.split(',');
|
837
|
if (fieldValue.length > 0) {
|
838
|
for (i in dt) {
|
839
|
field_ = dt[i];
|
840
|
Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
841
|
}
|
842
|
} else {
|
843
|
for (i in dt) {
|
844
|
field_ = dt[i];
|
845
|
Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
846
|
}
|
847
|
}
|
848
|
} else {
|
849
|
form_.setValues(selection.data);
|
850
|
}
|
851
|
//}
|
852
|
|
853
|
mainLookup.destroy();
|
854
|
},
|
855
|
beforeedit: function (grid) {
|
856
|
return false;
|
857
|
}
|
858
|
},
|
859
|
dockedItems: [{
|
860
|
xtype: 'pagingtoolbar',
|
861
|
store: 'lookupStore',
|
862
|
dock: 'bottom',
|
863
|
pageSize: 25,
|
864
|
displayInfo: true
|
865
|
}
|
866
|
]
|
867
|
|
868
|
}, ]
|
869
|
}).show();
|
870
|
} else {
|
871
|
// hamid
|
872
|
Ext.create('Ext.window.Window', {
|
873
|
title: 'Lookup - ' + this.fieldLabel,
|
874
|
height: 560,
|
875
|
width: 500,
|
876
|
fieldTarget: fieldTarget_,
|
877
|
fieldValue: fieldValue_,
|
878
|
isGrid: isGrid_,
|
879
|
name: 'lookupMain',
|
880
|
//modal: true,
|
881
|
listeners: {
|
882
|
'beforeshow': function (g) {
|
883
|
pnl.mask('Loading...');
|
884
|
setTimeout(function () {
|
885
|
pnl.unmask();
|
886
|
}, 100);
|
887
|
}
|
888
|
},
|
889
|
items: [{
|
890
|
xtype: 'minovaform',
|
891
|
bodyBorder: false,
|
892
|
MaxHeigth: '100',
|
893
|
cls: 'borderLookup',
|
894
|
border: false,
|
895
|
MaxHeigth: '30',
|
896
|
scroll: true,
|
897
|
isLookup: true,
|
898
|
name: "formLookupFilter",
|
899
|
tableName: this.tableName,
|
900
|
buttons: [{
|
901
|
text: 'Search',
|
902
|
//iconCls : 'fa-edit',
|
903
|
//style : 'font-family: FontAwesome',
|
904
|
handler: function () {
|
905
|
|
906
|
var store = Ext.data.StoreManager.lookup('lookupStore');
|
907
|
var form = Ext.ComponentQuery.query('[name=formLookupFilter]')[0].getForm();
|
908
|
grid = Ext.ComponentQuery.query('[name=gridLookup]')[0];
|
909
|
var values_ = form.getValues();
|
910
|
var fields_ = form.getFields().items;
|
911
|
var param_ = '';
|
912
|
for (var i = 0; i < fields_.length; i++) {
|
913
|
var val_ = form.getFields().items[i].getValue();
|
914
|
var xtype_ = form.getFields().items[i].xtype;
|
915
|
var oprator_ = '[like]';
|
916
|
if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
917
|
oprator_ = '[Equal]';
|
918
|
}
|
919
|
if (xtype_ == 'datefield') {
|
920
|
if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
921
|
oprator_ = '[LessThanEqual]';
|
922
|
} else {
|
923
|
oprator_ = '[GreaterThanEqual]';
|
924
|
}
|
925
|
}
|
926
|
if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
927
|
param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
928
|
}
|
929
|
}
|
930
|
|
931
|
if (SearchFunction_ != undefined && SearchFunction_ != "") {
|
932
|
eval(SearchFunction_);
|
933
|
} else {
|
934
|
store.proxy.extraParams = {
|
935
|
tableName: grid.tableName,
|
936
|
param: param_,
|
937
|
menuId: MinovaUtil.GetMenuID()
|
938
|
};
|
939
|
}
|
940
|
store.removeAll();
|
941
|
store.reload();
|
942
|
store.loadPage(1);
|
943
|
}
|
944
|
|
945
|
}
|
946
|
],
|
947
|
}, {
|
948
|
xtype: 'minovagrid2',
|
949
|
isLookup: true,
|
950
|
autoLoad: false,
|
951
|
minHeight: 240,
|
952
|
height: 340,
|
953
|
tableName: this.tableName,
|
954
|
param: '',
|
955
|
//name: 'gridForm' + this.tableName,
|
956
|
name: 'gridLookup',
|
957
|
hidebutton: 0,
|
958
|
pagesize: 25,
|
959
|
storename: 'lookupStore',
|
960
|
fieldGrid: fieldGrid_,
|
961
|
listeners: {
|
962
|
itemdblclick: function (g) {
|
963
|
var LookupFunction = LookupFunction_;
|
964
|
|
965
|
var me = this;
|
966
|
var selection = this.getView().getSelectionModel().getSelection()[0];
|
967
|
var pnlMain = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0];
|
968
|
var name_ = 'form[name=' + formtarget_ + ']';
|
969
|
if (pnlMain) {
|
970
|
name_ = 'form[name=' + formtarget_ + pnlMain.nameTable + ']';
|
971
|
}
|
972
|
|
973
|
var formM = Ext.ComponentQuery.query(name_)[0];
|
974
|
var form_ = null;
|
975
|
if (!formM) {
|
976
|
form_ = Ext.ComponentQuery.query('[name=MinovaGridFormEdit]')[0].getForm();
|
977
|
} else {
|
978
|
form_ = formM.getForm();
|
979
|
}
|
980
|
var mainLookup = Ext.ComponentQuery.query('[name=lookupMain]')[0];
|
981
|
var targetField = mainLookup.fieldTarget;
|
982
|
if (mainLookup.isGrid) {
|
983
|
var b = Ext.ComponentQuery.query('[fieldGrid=' + me.fieldGrid + ']')[0];
|
984
|
if (b) {
|
985
|
b.setValue(eval('selection.data.' + me.fieldGrid));
|
986
|
}
|
987
|
if (targetField) {
|
988
|
targetField = targetField.split('$')
|
989
|
var dt = targetField[0].split(',');
|
990
|
var fieldValue = targetField[1].split(',');
|
991
|
if (fieldValue.length > 0) {
|
992
|
for (i in dt) {
|
993
|
field_ = dt[i];
|
994
|
Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
995
|
}
|
996
|
} else {
|
997
|
for (i in dt) {
|
998
|
field_ = dt[i];
|
999
|
Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
1000
|
}
|
1001
|
}
|
1002
|
|
1003
|
}
|
1004
|
} else { // untuk form
|
1005
|
if (targetField) {
|
1006
|
var dt = targetField.split(',');
|
1007
|
var fieldValue = mainLookup.fieldValue.split(',');
|
1008
|
if (fieldValue.length > 0) {
|
1009
|
for (i in dt) {
|
1010
|
field_ = dt[i];
|
1011
|
Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
1012
|
}
|
1013
|
} else {
|
1014
|
for (i in dt) {
|
1015
|
field_ = dt[i];
|
1016
|
Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
1017
|
}
|
1018
|
}
|
1019
|
} else {
|
1020
|
form_.setValues(selection.data);
|
1021
|
}
|
1022
|
}
|
1023
|
eval(LookupFunction);
|
1024
|
mainLookup.destroy();
|
1025
|
},
|
1026
|
beforeedit: function (grid) {
|
1027
|
return false;
|
1028
|
}
|
1029
|
},
|
1030
|
dockedItems: [{
|
1031
|
xtype: 'pagingtoolbar',
|
1032
|
store: 'lookupStore',
|
1033
|
dock: 'bottom',
|
1034
|
pageSize: 25,
|
1035
|
displayInfo: true
|
1036
|
}
|
1037
|
]
|
1038
|
|
1039
|
}, ]
|
1040
|
}).show();
|
1041
|
}
|
1042
|
//Ext.create('Ext.window.Window', {
|
1043
|
// title: 'Lookup - ' + this.fieldLabel,
|
1044
|
// height: 530,
|
1045
|
// width: 500,
|
1046
|
// fieldTarget: fieldTarget_,
|
1047
|
// fieldValue: fieldValue_,
|
1048
|
// isGrid: isGrid_,
|
1049
|
// name: 'lookupMain',
|
1050
|
// //modal: true,
|
1051
|
// listeners: {
|
1052
|
// 'beforeshow': function (g) {
|
1053
|
// pnl.mask('Loading...');
|
1054
|
// setTimeout(function () {
|
1055
|
// pnl.unmask();
|
1056
|
// }, 100);
|
1057
|
// }
|
1058
|
// },
|
1059
|
// items: [{
|
1060
|
// xtype: 'minovaform',
|
1061
|
// bodyBorder: false,
|
1062
|
// MaxHeigth: '100',
|
1063
|
// cls: 'borderLookup',
|
1064
|
// border: false,
|
1065
|
// MaxHeigth: '30',
|
1066
|
// scroll: true,
|
1067
|
// isLookup: true,
|
1068
|
// name: "formLookupFilter",
|
1069
|
// tableName: this.tableName,
|
1070
|
// buttons: [{
|
1071
|
// text: 'Search',
|
1072
|
// //iconCls : 'fa-edit',
|
1073
|
// //style : 'font-family: FontAwesome',
|
1074
|
// handler: function () {
|
1075
|
// var store = Ext.data.StoreManager.lookup('lookupStore');
|
1076
|
// var form = Ext.ComponentQuery.query('[name=formLookupFilter]')[0].getForm();
|
1077
|
// grid = Ext.ComponentQuery.query('[name=gridLookup]')[0];
|
1078
|
// var values_ = form.getValues();
|
1079
|
// var fields_ = form.getFields().items;
|
1080
|
// var param_ = '';
|
1081
|
// for (var i = 0; i < fields_.length; i++) {
|
1082
|
// var val_ = form.getFields().items[i].getValue();
|
1083
|
// var xtype_ = form.getFields().items[i].xtype;
|
1084
|
// var oprator_ = '[like]';
|
1085
|
// if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
1086
|
// oprator_ = '[Equal]';
|
1087
|
// }
|
1088
|
// if (xtype_ == 'datefield') {
|
1089
|
// if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
1090
|
// oprator_ = '[LessThanEqual]';
|
1091
|
// } else {
|
1092
|
// oprator_ = '[GreaterThanEqual]';
|
1093
|
// }
|
1094
|
// }
|
1095
|
// if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
1096
|
// param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
1097
|
// }
|
1098
|
// }
|
1099
|
// store.proxy.extraParams = {
|
1100
|
// tableName: grid.tableName,
|
1101
|
// param: param_
|
1102
|
// };
|
1103
|
// store.removeAll();
|
1104
|
// store.reload();
|
1105
|
// store.loadPage(1);
|
1106
|
// }
|
1107
|
|
1108
|
// }
|
1109
|
// ],
|
1110
|
// }, {
|
1111
|
// xtype: 'minovagrid1',
|
1112
|
// isLookup: true,
|
1113
|
// autoLoad: false,
|
1114
|
// minHeight: 280,
|
1115
|
// height: 380,
|
1116
|
// tableName: this.tableName,
|
1117
|
// param: '',
|
1118
|
// //name: 'gridForm' + this.tableName,
|
1119
|
// name: 'gridLookup',
|
1120
|
// hidebutton: 0,
|
1121
|
// pagesize: 25,
|
1122
|
// storename: 'lookupStore',
|
1123
|
// listeners: {
|
1124
|
// itemdblclick: function (g) {
|
1125
|
// var me = this;
|
1126
|
// var selection = this.getView().getSelectionModel().getSelection()[0];
|
1127
|
// var name_ = 'form[name=' + formtarget_ + ']';
|
1128
|
// var form_ = Ext.ComponentQuery.query(name_)[0].getForm();
|
1129
|
// var mainLookup = Ext.ComponentQuery.query('[name=lookupMain]')[0];
|
1130
|
// var targetField = mainLookup.fieldTarget;
|
1131
|
// if (mainLookup.isGrid) {
|
1132
|
// if (targetField) {
|
1133
|
// targetField = targetField.split('$')
|
1134
|
// var dt = targetField[0].split(',');
|
1135
|
// var fieldValue = targetField[1].split(',');
|
1136
|
// if (fieldValue.length > 0) {
|
1137
|
// for (i in dt) {
|
1138
|
// field_ = dt[i];
|
1139
|
// Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
1140
|
// }
|
1141
|
// } else {
|
1142
|
// for (i in dt) {
|
1143
|
// field_ = dt[i];
|
1144
|
// Ext.ComponentQuery.query('[id=' + 'grid' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
1145
|
// }
|
1146
|
// }
|
1147
|
|
1148
|
|
1149
|
// }
|
1150
|
// }
|
1151
|
// else {// untuk form
|
1152
|
// if (targetField) {
|
1153
|
// var dt = targetField.split(',');
|
1154
|
// var fieldValue = mainLookup.fieldValue.split(',');
|
1155
|
// if (fieldValue.length > 0) {
|
1156
|
// for (i in dt) {
|
1157
|
// field_ = dt[i];
|
1158
|
// Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + fieldValue[i]))
|
1159
|
// }
|
1160
|
// } else {
|
1161
|
// for (i in dt) {
|
1162
|
// field_ = dt[i];
|
1163
|
// Ext.ComponentQuery.query('[name=' + field_ + ']')[0].setValue(eval('selection.data.' + field_))
|
1164
|
// }
|
1165
|
// }
|
1166
|
// }
|
1167
|
// else {
|
1168
|
// form_.setValues(selection.data);
|
1169
|
// }
|
1170
|
// }
|
1171
|
|
1172
|
// mainLookup.destroy();
|
1173
|
// },
|
1174
|
// beforeedit: function (grid) {
|
1175
|
// return false;
|
1176
|
// }
|
1177
|
// },
|
1178
|
// dockedItems: [{
|
1179
|
// xtype: 'pagingtoolbar',
|
1180
|
// store: 'lookupStore',
|
1181
|
// dock: 'bottom',
|
1182
|
// pageSize: 25,
|
1183
|
// displayInfo: true
|
1184
|
// }
|
1185
|
// ]
|
1186
|
|
1187
|
// }, ]
|
1188
|
//}).show();
|
1189
|
|
1190
|
},
|
1191
|
});
|
1192
|
Ext.define('MinovaUtil.MinovaES.MinovaComboDisplay', {
|
1193
|
extend: 'Ext.form.field.Display',
|
1194
|
alias: ['widget.minovacombodisplay'],
|
1195
|
initComponent: function () {
|
1196
|
this.callParent(arguments);
|
1197
|
},
|
1198
|
|
1199
|
defaultRenderer: function (value) {
|
1200
|
if (typeof(this.store) !== 'object') {
|
1201
|
this.store = Ext.data.StoreManager.lookup(this.store);
|
1202
|
}
|
1203
|
var idx = this.store.findExact(this.valueField, value);
|
1204
|
if (this.store.getAt(idx)) {
|
1205
|
var result = this.store.getAt(idx).get(this.displayField);
|
1206
|
value = result ? result : value;
|
1207
|
}
|
1208
|
this.setRawValue(value);
|
1209
|
|
1210
|
}
|
1211
|
});
|
1212
|
Ext.define('MinovaUtil.MinovaES.DisplayDate', {
|
1213
|
extend: 'Ext.form.field.Display',
|
1214
|
alias: ['widget.minovadisplaydate'],
|
1215
|
undefinedText: ' ',
|
1216
|
setValue: function (v) {
|
1217
|
var value = v;
|
1218
|
if (value === undefined) {
|
1219
|
return this.undefinedText;
|
1220
|
}
|
1221
|
if (value === null) {
|
1222
|
return this.setRawValue(null);
|
1223
|
}
|
1224
|
var d = value.substring(6, 8);
|
1225
|
var m = value.substring(4, 6);
|
1226
|
var y = value.substring(0, 4);
|
1227
|
|
1228
|
var hasil = d + '/' + m + '/' + y;
|
1229
|
//this.setRawValue(hasil);
|
1230
|
this.setValue(hasil);
|
1231
|
},
|
1232
|
getRawValue: function () {
|
1233
|
return this.getValue();
|
1234
|
},
|
1235
|
getValue: function () {
|
1236
|
var value = this.rawValue;
|
1237
|
var hasil = null;
|
1238
|
if (value != undefined) {
|
1239
|
var d = value.substring(0, 2);
|
1240
|
var m = value.substring(3, 5);
|
1241
|
var y = value.substring(6, 10);
|
1242
|
|
1243
|
hasil = y + m + d;
|
1244
|
}
|
1245
|
return hasil;
|
1246
|
}
|
1247
|
});
|
1248
|
Ext.define('MinovaUtil.MinovaES.DisplaySysDateTime', {
|
1249
|
extend: 'Ext.form.field.Display',
|
1250
|
alias: ['widget.minovadisplaysysdatetime'],
|
1251
|
undefinedText: ' ',
|
1252
|
//hamid
|
1253
|
listeners: {
|
1254
|
change: function (f) {
|
1255
|
var field = f.getValue()
|
1256
|
var value = field;
|
1257
|
if (value === "" || value === undefined) {
|
1258
|
return this.setRawValue("");
|
1259
|
} else {
|
1260
|
var d = value.substring(6, 8);
|
1261
|
var m = value.substring(4, 6);
|
1262
|
var y = value.substring(0, 4);
|
1263
|
var h = value.substring(8, 10);
|
1264
|
var mt = value.substring(10, 12);
|
1265
|
var s = value.substring(12, 14);
|
1266
|
var hasil = d + '/' + m + '/' + y + ' ' + ' ' + h + ':' + mt + ':' + s;
|
1267
|
|
1268
|
}
|
1269
|
|
1270
|
f.setRawValue(hasil)
|
1271
|
},
|
1272
|
},
|
1273
|
//end
|
1274
|
|
1275
|
});
|
1276
|
Ext.define('MinovaUtil.MinovaES.MinovaButton', {
|
1277
|
extend: 'Ext.button.Button',
|
1278
|
alias: ['widget.minovabutton', 'widget.MinovaButton'],
|
1279
|
nextid: undefined,
|
1280
|
parid: undefined,
|
1281
|
page: undefined,
|
1282
|
start: undefined,
|
1283
|
limit: 1,
|
1284
|
setStart: function (value) {
|
1285
|
var me = this;
|
1286
|
me.start = value;
|
1287
|
return me;
|
1288
|
},
|
1289
|
getStart: function () {
|
1290
|
return this.start;
|
1291
|
},
|
1292
|
setNextid: function (value) {
|
1293
|
var me = this;
|
1294
|
me.nextid = value;
|
1295
|
return me;
|
1296
|
},
|
1297
|
getNextid: function () {
|
1298
|
return this.nextid;
|
1299
|
},
|
1300
|
setParid: function (value) {
|
1301
|
var me = this;
|
1302
|
me.parid = value;
|
1303
|
return me;
|
1304
|
},
|
1305
|
getParid: function () {
|
1306
|
return this.parid;
|
1307
|
},
|
1308
|
anchor: '50%',
|
1309
|
initComponent: function () {
|
1310
|
var me = this;
|
1311
|
Ext.applyIf(me, {});
|
1312
|
me.callParent(arguments);
|
1313
|
}
|
1314
|
});
|
1315
|
Ext.define('MinovaUtil.MinovaES.MinovaComboBox', {
|
1316
|
extend: 'Ext.form.field.ComboBox',
|
1317
|
alias: ['widget.minovacombobox', 'widget.minovacombo'],
|
1318
|
tableName: undefined,
|
1319
|
param: undefined,
|
1320
|
anyMatch: true,
|
1321
|
anchor: '50%',
|
1322
|
queryMode: 'local',
|
1323
|
forceSelection: true, // cek data
|
1324
|
initComponent: function () {
|
1325
|
var me = this;
|
1326
|
Ext.applyIf(me, {
|
1327
|
|
1328
|
store: Ext.create('Ext.data.Store', {
|
1329
|
storeId: 'store' + me.name,
|
1330
|
autoLoad: true,
|
1331
|
proxy: {
|
1332
|
method: 'POST',
|
1333
|
type: 'ajax',
|
1334
|
url: '/UserControl/GetStoreAuth',
|
1335
|
extraParams: {
|
1336
|
tableName: me.tableName,
|
1337
|
param: me.param,
|
1338
|
menuId: MinovaUtil.GetMenuID()
|
1339
|
},
|
1340
|
reader: {
|
1341
|
type: 'json',
|
1342
|
root: 'data'
|
1343
|
}
|
1344
|
}
|
1345
|
})
|
1346
|
});
|
1347
|
me.callParent(arguments);
|
1348
|
}
|
1349
|
});
|
1350
|
|
1351
|
Ext.define('MinovaUtil.MinovaES.MinovaComboBoxTpl', {
|
1352
|
extend: 'Ext.form.field.ComboBox',
|
1353
|
alias: ['widget.minovacomboboxtpl', 'widget.minovacombotpl'],
|
1354
|
tableName: undefined,
|
1355
|
param: undefined,
|
1356
|
dis1: undefined,
|
1357
|
dis2: undefined,
|
1358
|
anchor: '50%',
|
1359
|
queryMode: 'local',
|
1360
|
forceSelection: true,
|
1361
|
tpl: Ext.create('Ext.XTemplate',
|
1362
|
'<tpl for=".">',
|
1363
|
'<div class="x-boundlist-item">' + this.dis1 + '</div>',
|
1364
|
'</tpl>'),
|
1365
|
displayTpl: Ext.create('Ext.XTemplate',
|
1366
|
'<tpl for=".">',
|
1367
|
+this.dis1,
|
1368
|
'</tpl>'),
|
1369
|
initComponent: function () {
|
1370
|
var me = this;
|
1371
|
Ext.applyIf(me, {
|
1372
|
store: Ext.create('Ext.data.Store', {
|
1373
|
storeId: 'store' + me.name,
|
1374
|
autoLoad: true,
|
1375
|
proxy: {
|
1376
|
method: 'POST',
|
1377
|
type: 'ajax',
|
1378
|
url: '/UserControl/GetStore',
|
1379
|
extraParams: {
|
1380
|
tableName: me.tableName,
|
1381
|
param: me.param
|
1382
|
},
|
1383
|
reader: {
|
1384
|
type: 'json',
|
1385
|
root: 'data'
|
1386
|
}
|
1387
|
}
|
1388
|
})
|
1389
|
});
|
1390
|
me.callParent(arguments);
|
1391
|
}
|
1392
|
});
|
1393
|
Ext.define('MinovaUtil.MinovaES.MinovaMultiComboBox', {
|
1394
|
extend: 'Ext.form.field.ComboBox',
|
1395
|
alias: ['widget.minovamulticombobox', 'widget.minovamulticombo'],
|
1396
|
tableName: undefined,
|
1397
|
param: undefined,
|
1398
|
anchor: '50%',
|
1399
|
queryMode: 'local',
|
1400
|
forceSelection: true, // cek data
|
1401
|
multiSelect: true,
|
1402
|
getValue: function () {
|
1403
|
var hasil = null;
|
1404
|
var val = this.value;
|
1405
|
if (val != undefined) {
|
1406
|
hasil = val.toString();
|
1407
|
}
|
1408
|
return hasil;
|
1409
|
},
|
1410
|
initComponent: function () {
|
1411
|
var me = this;
|
1412
|
Ext.applyIf(me, {
|
1413
|
store: Ext.create('Ext.data.Store', {
|
1414
|
storeId: 'store' + me.name,
|
1415
|
autoLoad: true,
|
1416
|
proxy: {
|
1417
|
method: 'POST',
|
1418
|
type: 'ajax',
|
1419
|
url: '/UserControl/GetStore',
|
1420
|
extraParams: {
|
1421
|
tableName: me.tableName,
|
1422
|
param: me.param
|
1423
|
},
|
1424
|
reader: {
|
1425
|
type: 'json',
|
1426
|
root: 'data'
|
1427
|
}
|
1428
|
}
|
1429
|
})
|
1430
|
});
|
1431
|
me.callParent(arguments);
|
1432
|
}
|
1433
|
});
|
1434
|
Ext.define('Ext.ux.MinovaLookupGrid1', {
|
1435
|
extend: 'Ext.form.field.Trigger',
|
1436
|
alias: 'widget.minovalookupgrid1',
|
1437
|
tableName: undefined,
|
1438
|
param: undefined,
|
1439
|
formtarget_: this.formtarget,
|
1440
|
anchor: '50%',
|
1441
|
pagesize: undefined,
|
1442
|
initComponent: function () {
|
1443
|
var target = this.formtarget;
|
1444
|
this.callParent();
|
1445
|
},
|
1446
|
onTriggerClick: function () {
|
1447
|
var count_lookup = Ext.ComponentQuery.query('[name=mainLookup]').length;
|
1448
|
if (count_lookup == 1) {
|
1449
|
Ext.ComponentQuery.query('[name=mainLookup]')[0].show();
|
1450
|
} else {
|
1451
|
var target_ = this.formtarget;
|
1452
|
var fieldtarget = this.name;
|
1453
|
var pagesize_ = this.pagesize;
|
1454
|
if (pagesize_ == undefined) {
|
1455
|
pagesize_ = 25;
|
1456
|
}
|
1457
|
var mainLookup = Ext.create('Ext.window.Window', {
|
1458
|
name: 'mainLookup',
|
1459
|
width: 500,
|
1460
|
heigth: 300,
|
1461
|
maxHeigth: 300,
|
1462
|
minWidth: 400,
|
1463
|
scroll: true,
|
1464
|
modal: true,
|
1465
|
title: 'Lookup - ' + this.fieldLabel,
|
1466
|
items: [{
|
1467
|
xtype: 'form',
|
1468
|
collapsible: false,
|
1469
|
items: [{
|
1470
|
xtype: 'form',
|
1471
|
//width: '90%',
|
1472
|
name: 'formFilter',
|
1473
|
layout: 'column',
|
1474
|
dockedItems: [{
|
1475
|
xtype: 'toolbar',
|
1476
|
dock: 'bottom',
|
1477
|
items: [{
|
1478
|
xtype: 'tbfill'
|
1479
|
}, {
|
1480
|
text: 'Search',
|
1481
|
scope: this,
|
1482
|
handler: function () {
|
1483
|
var store = Ext.data.StoreManager.lookup('lookupStore');
|
1484
|
var form = Ext.ComponentQuery.query('[name=formFilter]')[0].getForm();
|
1485
|
var values_ = form.getValues();
|
1486
|
var fields_ = form.getFields().items;
|
1487
|
var param_ = '';
|
1488
|
for (var i = 0; i < fields_.length; i++) {
|
1489
|
var val_ = form.getFields().items[i].getValue();
|
1490
|
var xtype_ = form.getFields().items[i].xtype;
|
1491
|
var oprator_ = '[like]';
|
1492
|
if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
1493
|
oprator_ = '[Equal]';
|
1494
|
}
|
1495
|
if (xtype_ == 'datefield') {
|
1496
|
if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
1497
|
oprator_ = '[LessThanEqual]';
|
1498
|
} else {
|
1499
|
oprator_ = '[GreaterThanEqual]';
|
1500
|
}
|
1501
|
}
|
1502
|
if (val_ != 'undefined' && val_ != "") {
|
1503
|
param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
1504
|
}
|
1505
|
}
|
1506
|
store.proxy.extraParams = {
|
1507
|
tableName: this.tableName,
|
1508
|
param: param_
|
1509
|
};
|
1510
|
store.removeAll();
|
1511
|
store.reload();
|
1512
|
store.loadPage(1);
|
1513
|
}
|
1514
|
}, ]
|
1515
|
}
|
1516
|
],
|
1517
|
defaults: {
|
1518
|
xtype: 'container',
|
1519
|
defaultType: 'textfield',
|
1520
|
style: 'width: 50%'
|
1521
|
},
|
1522
|
items: [{
|
1523
|
xtype: 'minovaform',
|
1524
|
bodyBorder: false,
|
1525
|
cls: 'borderLookup',
|
1526
|
border: false,
|
1527
|
MaxHeigth: '30',
|
1528
|
scroll: true,
|
1529
|
isLookup: 1,
|
1530
|
name: "formLookupFilter",
|
1531
|
tableName: this.tableName,
|
1532
|
}
|
1533
|
],
|
1534
|
}
|
1535
|
]
|
1536
|
}, {
|
1537
|
xtype: 'form',
|
1538
|
name: 'formResult',
|
1539
|
title: 'Result',
|
1540
|
collapsible: true,
|
1541
|
items: [{
|
1542
|
xtype: "minovagrid",
|
1543
|
name: "lookupgrid",
|
1544
|
tableName: this.tableName,
|
1545
|
param: '',
|
1546
|
pagesize: pagesize_,
|
1547
|
storename: 'lookupStore',
|
1548
|
isLookup: 1,
|
1549
|
border: false,
|
1550
|
minHeight: 300,
|
1551
|
maxHeight: 500,
|
1552
|
height: 100,
|
1553
|
columnLines: true,
|
1554
|
scrollable: true,
|
1555
|
listeners: {
|
1556
|
itemdblclick: function (formtarget_) {
|
1557
|
var me = this;
|
1558
|
var selection = this.getView().getSelectionModel().getSelection()[0];
|
1559
|
if (target_ == null || target_ == undefined) {
|
1560
|
var formtarget_ = '[name=' + fieldtarget + ']';
|
1561
|
var form_ = Ext.ComponentQuery.query(formtarget_)[0];
|
1562
|
} else {
|
1563
|
var formtarget_ = 'form[name=' + target_ + ']';
|
1564
|
var form_ = Ext.ComponentQuery.query(formtarget_)[0].getForm();
|
1565
|
form_.setValues(selection.data)
|
1566
|
}
|
1567
|
mainLookup.hide();
|
1568
|
},
|
1569
|
beforeedit: function (grid) {
|
1570
|
return false;
|
1571
|
}
|
1572
|
},
|
1573
|
dockedItems: [{
|
1574
|
xtype: 'pagingtoolbar',
|
1575
|
store: 'lookupStore',
|
1576
|
dock: 'bottom',
|
1577
|
pageSize: pagesize_,
|
1578
|
displayInfo: true
|
1579
|
}
|
1580
|
],
|
1581
|
}
|
1582
|
]
|
1583
|
}
|
1584
|
]
|
1585
|
}).show();
|
1586
|
}
|
1587
|
},
|
1588
|
});
|
1589
|
Ext.define('Ext.ux.MinovaLookupTree', {
|
1590
|
extend: 'Ext.form.field.Trigger',
|
1591
|
alias: 'widget.minovalookuptree',
|
1592
|
tableName: undefined,
|
1593
|
param: undefined,
|
1594
|
onTriggerClick: function () {}
|
1595
|
|
1596
|
});
|
1597
|
Ext.define('Ext.ux.MinovaLookupFile', {
|
1598
|
extend: 'Ext.form.field.Trigger',
|
1599
|
alias: 'widget.minovalookupfile',
|
1600
|
tableName: undefined,
|
1601
|
param: undefined,
|
1602
|
onTriggerClick: function () {}
|
1603
|
|
1604
|
});
|
1605
|
Ext.define('MinovaUtil.MinovaES.MinovaGrid1', {
|
1606
|
extend: 'Ext.grid.Panel',
|
1607
|
requires: ['Ext.grid.RowNumberer'],
|
1608
|
alias: 'widget.minovagrid1',
|
1609
|
//alias: ['widget.minovagrid1', 'widget.minovagrid'],
|
1610
|
//alias: ['widget.minovagrid1', 'widget.minovagrid'],
|
1611
|
alternateClassName: 'Ext.grid.MinovaGrid',
|
1612
|
//controller:'orm-manage2-controller',
|
1613
|
tableName: undefined,
|
1614
|
isLookup: undefined,
|
1615
|
param: undefined,
|
1616
|
pagesize: undefined,
|
1617
|
storename: undefined,
|
1618
|
layoutType: undefined,
|
1619
|
enableLocking: true,
|
1620
|
autoLoad: undefined,
|
1621
|
multiSelect: undefined,
|
1622
|
getTableName: function () {
|
1623
|
return this.tableName;
|
1624
|
},
|
1625
|
|
1626
|
initComponent: function () {
|
1627
|
var me = this;
|
1628
|
var cols_ = [];
|
1629
|
var fieldeditor = {};
|
1630
|
var hasil = null;
|
1631
|
var autoLoad = true;
|
1632
|
var LangID = localStorage.LangId;
|
1633
|
var fielGrid = 'rec.GridView == 1';
|
1634
|
var locking = true;
|
1635
|
var checkSelection = '';
|
1636
|
var widthLock = 250;
|
1637
|
if (me.multiSelect) {
|
1638
|
locking = false;
|
1639
|
checkSelection = 'checkboxmodel';
|
1640
|
widthLock = 40;
|
1641
|
}
|
1642
|
//var _url = 'GetAllField';
|
1643
|
if (me.autoLoad == false) {
|
1644
|
autoLoad = false;
|
1645
|
}
|
1646
|
parameter = null;
|
1647
|
if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
|
1648
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupGrid='1'";
|
1649
|
fielGrid = 'rec.LookupGrid == 1';
|
1650
|
locking = false;
|
1651
|
|
1652
|
} else {
|
1653
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
|
1654
|
//autoLoad = false;
|
1655
|
//_url = 'GetAllFieldGridLookUp';
|
1656
|
};
|
1657
|
|
1658
|
//Ext.Ajax.request({
|
1659
|
// async : false,
|
1660
|
// method : 'POST',
|
1661
|
// url : '/Devt/' + _url + '?tableName=' + me.tableName,
|
1662
|
// success : function (response) {
|
1663
|
// var results = Ext.decode(response.responseText);
|
1664
|
// hasil = results.data;
|
1665
|
// }
|
1666
|
//});
|
1667
|
//hamid03102016
|
1668
|
|
1669
|
Ext.Ajax.request({
|
1670
|
async: false,
|
1671
|
method: 'POST',
|
1672
|
url: '/UserControl/GetStore',
|
1673
|
params: {
|
1674
|
tableName: 'PDSBS0007',
|
1675
|
param: parameter
|
1676
|
},
|
1677
|
success: function (response) {
|
1678
|
var results = Ext.decode(response.responseText);
|
1679
|
hasil = results.data;
|
1680
|
}
|
1681
|
});
|
1682
|
//end
|
1683
|
|
1684
|
if (hasil.length > 0) {
|
1685
|
|
1686
|
Ext.each(hasil, function (rec) {
|
1687
|
var null_ = null;
|
1688
|
if (rec.IsPrimaryKey == true) {
|
1689
|
null_ = false;
|
1690
|
}
|
1691
|
if (rec.IsRequired == true) {
|
1692
|
null_ = false;
|
1693
|
} else {
|
1694
|
null_ = true;
|
1695
|
}
|
1696
|
|
1697
|
if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
|
1698
|
if (rec.LookupGrid == 1) {
|
1699
|
switch (rec.FormatRef) {
|
1700
|
case "file":
|
1701
|
cols_.push({
|
1702
|
xtype: 'minovapicturecolumn',
|
1703
|
text: rec.HeaderTitle,
|
1704
|
dataIndex: rec.FieldName,
|
1705
|
width: 100,
|
1706
|
//filter: {
|
1707
|
// type: 'image',
|
1708
|
// itemDefaults: {
|
1709
|
// emptyText: 'Search for...'
|
1710
|
// }
|
1711
|
//}
|
1712
|
});
|
1713
|
break
|
1714
|
case "date":
|
1715
|
cols_.push({
|
1716
|
xtype: 'minovadatecolumn',
|
1717
|
text: rec.HeaderTitle,
|
1718
|
dataIndex: rec.FieldName,
|
1719
|
width: 100,
|
1720
|
filter: {
|
1721
|
type: 'date',
|
1722
|
itemDefaults: {
|
1723
|
emptyText: 'Search for...'
|
1724
|
}
|
1725
|
}
|
1726
|
});
|
1727
|
break
|
1728
|
case "amount":
|
1729
|
cols_.push({
|
1730
|
xtype: 'minovacurrancycolumn',
|
1731
|
text: rec.HeaderTitle,
|
1732
|
dataIndex: rec.FieldName,
|
1733
|
align: 'right',
|
1734
|
width: 300,
|
1735
|
filter: {
|
1736
|
type: 'number',
|
1737
|
itemDefaults: {
|
1738
|
emptyText: 'Search for...'
|
1739
|
}
|
1740
|
}
|
1741
|
});
|
1742
|
break
|
1743
|
case "amountencrypt":
|
1744
|
cols_.push({
|
1745
|
xtype: 'minovaamountcolumn',
|
1746
|
text: rec.HeaderTitle,
|
1747
|
dataIndex: rec.FieldName,
|
1748
|
align: 'right',
|
1749
|
width: 300,
|
1750
|
filter: {
|
1751
|
type: 'string',
|
1752
|
itemDefaults: {
|
1753
|
emptyText: 'Search for...'
|
1754
|
}
|
1755
|
}
|
1756
|
});
|
1757
|
break
|
1758
|
case "datetime":
|
1759
|
cols_.push({
|
1760
|
xtype: 'minovadatetimecolumn',
|
1761
|
text: rec.HeaderTitle,
|
1762
|
dataIndex: rec.FieldName,
|
1763
|
width: 140,
|
1764
|
filter: {
|
1765
|
type: 'string',
|
1766
|
itemDefaults: {
|
1767
|
emptyText: 'Search for...'
|
1768
|
}
|
1769
|
}
|
1770
|
});
|
1771
|
break
|
1772
|
default:
|
1773
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
1774
|
cols_.push({
|
1775
|
text: rec.HeaderTitle,
|
1776
|
dataIndex: rec.FieldName,
|
1777
|
width: 100,
|
1778
|
filter: {
|
1779
|
type: 'string',
|
1780
|
itemDefaults: {
|
1781
|
emptyText: 'Search for...'
|
1782
|
}
|
1783
|
}
|
1784
|
});
|
1785
|
} else if (rec.SearchType == '2') {
|
1786
|
cols_.push({
|
1787
|
xtype: 'minovalookupcolumn',
|
1788
|
text: rec.HeaderTitle,
|
1789
|
tableName: rec.TableRef,
|
1790
|
dataIndex: rec.FieldName,
|
1791
|
filter: {
|
1792
|
itemDefaults: {
|
1793
|
emptyText: 'Search for...'
|
1794
|
}
|
1795
|
}
|
1796
|
});
|
1797
|
} else if (rec.TableRef != "" && rec.SearchType != '2') {
|
1798
|
if (rec.TableRef != null) {
|
1799
|
var valueField = null;
|
1800
|
var displayValue = null;
|
1801
|
Ext.Ajax.request({
|
1802
|
async: false,
|
1803
|
method: 'POST',
|
1804
|
url: '/UserControl/GetStore',
|
1805
|
params: {
|
1806
|
tableName: 'SDATATABLEFIELD',
|
1807
|
param: 'TableName[equal]' + rec.TableRef
|
1808
|
},
|
1809
|
success: function (response) {
|
1810
|
var results = Ext.decode(response.responseText);
|
1811
|
data_ = results.data;
|
1812
|
if (data_ != undefined) {
|
1813
|
valueField_ = $.grep(data_, function (r) {
|
1814
|
return r.ValueField == '1'
|
1815
|
});
|
1816
|
valueField = valueField_[0].FieldName
|
1817
|
displayValue_ = $.grep(data_, function (r) {
|
1818
|
return r.DisplayValue == '1'
|
1819
|
});
|
1820
|
displayValue = displayValue_[0].FieldName
|
1821
|
}
|
1822
|
}
|
1823
|
});
|
1824
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
1825
|
var count_ = 0;
|
1826
|
if (store_) {
|
1827
|
count_ = store_.count();
|
1828
|
}
|
1829
|
if (count_ == 0) {
|
1830
|
Ext.create('Ext.data.Store', {
|
1831
|
storeId: 'store_' + rec.FieldName,
|
1832
|
//autoLoad: true,
|
1833
|
proxy: {
|
1834
|
method: 'POST',
|
1835
|
type: 'ajax',
|
1836
|
url: '/UserControl/GetStore',
|
1837
|
extraParams: {
|
1838
|
tableName: rec.TableRef,
|
1839
|
param: rec.ParamCombo
|
1840
|
},
|
1841
|
reader: {
|
1842
|
type: 'json',
|
1843
|
root: 'data',
|
1844
|
totalProperty: 'data[0].TotalCount'
|
1845
|
}
|
1846
|
}
|
1847
|
})
|
1848
|
}
|
1849
|
cols_.push({
|
1850
|
xtype: 'minovacombocolumn',
|
1851
|
text: rec.HeaderTitle,
|
1852
|
dataIndex: rec.FieldName,
|
1853
|
valueField: valueField,
|
1854
|
displayField: displayValue,
|
1855
|
store: 'store_' + rec.FieldName,
|
1856
|
filter: {
|
1857
|
type: 'list',
|
1858
|
itemDefaults: {
|
1859
|
emptyText: 'Search for...'
|
1860
|
}
|
1861
|
}
|
1862
|
});
|
1863
|
}
|
1864
|
|
1865
|
} else {
|
1866
|
cols_.push({
|
1867
|
text: rec.HeaderTitle,
|
1868
|
dataIndex: rec.FieldName,
|
1869
|
filter: {
|
1870
|
itemDefaults: {
|
1871
|
emptyText: 'Search for...'
|
1872
|
}
|
1873
|
}
|
1874
|
});
|
1875
|
}
|
1876
|
break
|
1877
|
}
|
1878
|
} else {
|
1879
|
cols_.push({
|
1880
|
text: rec.HeaderTitle,
|
1881
|
dataIndex: rec.FieldName,
|
1882
|
hidden: true,
|
1883
|
filter: {
|
1884
|
itemDefaults: {
|
1885
|
emptyText: 'Search for...'
|
1886
|
}
|
1887
|
}
|
1888
|
});
|
1889
|
}
|
1890
|
|
1891
|
} else {
|
1892
|
if (rec.GridView == 1) {
|
1893
|
switch (rec.FormatRef) {
|
1894
|
case "action":
|
1895
|
cols_.push({
|
1896
|
text: rec.HeaderTitle,
|
1897
|
width: 100,
|
1898
|
xtype: 'actioncolumn',
|
1899
|
tooltip: 'View Data',
|
1900
|
name: rec.FieldName,
|
1901
|
itemId: me.tableName + rec.FieldName,
|
1902
|
align: 'center',
|
1903
|
iconCls: 'fa-edit',
|
1904
|
renderer: function (value, metadata, record) {
|
1905
|
metadata.tdStyle = 'font-family: FontAwesome'
|
1906
|
},
|
1907
|
handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
|
1908
|
|
1909
|
this.fireEvent(me.tableName + rec.FieldName + "onActionClick", record);
|
1910
|
}
|
1911
|
});
|
1912
|
break
|
1913
|
case "file":
|
1914
|
cols_.push({
|
1915
|
xtype: 'minovapicturecolumn',
|
1916
|
text: rec.HeaderTitle,
|
1917
|
dataIndex: rec.FieldName,
|
1918
|
width: 100,
|
1919
|
//filter: {
|
1920
|
// type: '',
|
1921
|
// itemDefaults: {
|
1922
|
// emptyText: 'Search for...'
|
1923
|
// }
|
1924
|
//}
|
1925
|
});
|
1926
|
break
|
1927
|
case "date":
|
1928
|
cols_.push({
|
1929
|
xtype: 'minovadatecolumn',
|
1930
|
text: rec.HeaderTitle,
|
1931
|
dataIndex: rec.FieldName,
|
1932
|
width: 100,
|
1933
|
filter: {
|
1934
|
type: 'date',
|
1935
|
itemDefaults: {
|
1936
|
emptyText: 'Search for...'
|
1937
|
}
|
1938
|
}
|
1939
|
});
|
1940
|
break
|
1941
|
case "amountencrypt":
|
1942
|
cols_.push({
|
1943
|
xtype: 'minovaamountcolumn',
|
1944
|
text: rec.HeaderTitle,
|
1945
|
dataIndex: rec.FieldName,
|
1946
|
align: 'right',
|
1947
|
width: 300,
|
1948
|
filter: {
|
1949
|
type: 'string',
|
1950
|
itemDefaults: {
|
1951
|
emptyText: 'Search for...'
|
1952
|
}
|
1953
|
}
|
1954
|
});
|
1955
|
break
|
1956
|
case "amount":
|
1957
|
cols_.push({
|
1958
|
xtype: 'minovacurrancycolumn',
|
1959
|
text: rec.HeaderTitle,
|
1960
|
dataIndex: rec.FieldName,
|
1961
|
align: 'right',
|
1962
|
width: 300,
|
1963
|
filter: {
|
1964
|
type: 'number',
|
1965
|
itemDefaults: {
|
1966
|
emptyText: 'Search for...'
|
1967
|
}
|
1968
|
}
|
1969
|
});
|
1970
|
break
|
1971
|
case "datetime":
|
1972
|
cols_.push({
|
1973
|
xtype: 'minovadatetimecolumn',
|
1974
|
text: rec.HeaderTitle,
|
1975
|
dataIndex: rec.FieldName,
|
1976
|
width: 140,
|
1977
|
filter: {
|
1978
|
type: 'string',
|
1979
|
itemDefaults: {
|
1980
|
emptyText: 'Search for...'
|
1981
|
}
|
1982
|
}
|
1983
|
});
|
1984
|
break
|
1985
|
default:
|
1986
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
1987
|
cols_.push({
|
1988
|
text: rec.HeaderTitle,
|
1989
|
dataIndex: rec.FieldName,
|
1990
|
width: 100,
|
1991
|
filter: {
|
1992
|
type: 'string',
|
1993
|
itemDefaults: {
|
1994
|
emptyText: 'Search for...'
|
1995
|
}
|
1996
|
}
|
1997
|
});
|
1998
|
} else if (rec.TableRef != "") {
|
1999
|
if (rec.TableRef != null) {
|
2000
|
var valueField = null;
|
2001
|
var displayValue = null;
|
2002
|
Ext.Ajax.request({
|
2003
|
async: false,
|
2004
|
method: 'POST',
|
2005
|
url: '/UserControl/GetStore',
|
2006
|
params: {
|
2007
|
tableName: 'SDATATABLEFIELD',
|
2008
|
param: 'TableName[equal]' + rec.TableRef
|
2009
|
},
|
2010
|
success: function (response) {
|
2011
|
var results = Ext.decode(response.responseText);
|
2012
|
data_ = results.data;
|
2013
|
//if (data_ != undefined) {
|
2014
|
if (data_.length > 0) {
|
2015
|
valueField_ = $.grep(data_, function (r) {
|
2016
|
return r.ValueField == '1'
|
2017
|
});
|
2018
|
valueField = valueField_[0].FieldName
|
2019
|
displayValue_ = $.grep(data_, function (r) {
|
2020
|
return r.DisplayValue == '1'
|
2021
|
});
|
2022
|
displayValue = displayValue_[0].FieldName
|
2023
|
} else {
|
2024
|
MinovaMessage('Not Null', 'BSNULLCOMBO', rec.TableRef, 'E');
|
2025
|
}
|
2026
|
}
|
2027
|
});
|
2028
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
2029
|
var count_ = 0;
|
2030
|
if (store_) {
|
2031
|
count_ = store_.count();
|
2032
|
}
|
2033
|
if (count_ == 0) {
|
2034
|
Ext.create('Ext.data.Store', {
|
2035
|
storeId: 'store_' + rec.FieldName,
|
2036
|
autoLoad: false,
|
2037
|
proxy: {
|
2038
|
method: 'POST',
|
2039
|
type: 'ajax',
|
2040
|
url: '/UserControl/GetStore',
|
2041
|
extraParams: {
|
2042
|
tableName: rec.TableRef,
|
2043
|
param: rec.ParamCombo
|
2044
|
},
|
2045
|
reader: {
|
2046
|
type: 'json',
|
2047
|
root: 'data',
|
2048
|
totalProperty: 'data[0].TotalCount'
|
2049
|
}
|
2050
|
}
|
2051
|
})
|
2052
|
}
|
2053
|
cols_.push({
|
2054
|
xtype: 'minovacombocolumn',
|
2055
|
text: rec.HeaderTitle,
|
2056
|
dataIndex: rec.FieldName,
|
2057
|
valueField: valueField,
|
2058
|
displayField: displayValue,
|
2059
|
store: 'store_' + rec.FieldName,
|
2060
|
filter: {
|
2061
|
type: 'list',
|
2062
|
itemDefaults: {
|
2063
|
emptyText: 'Search for...'
|
2064
|
}
|
2065
|
}
|
2066
|
});
|
2067
|
}
|
2068
|
|
2069
|
} else if (rec.FixedValue != "") {
|
2070
|
cols_.push({
|
2071
|
xtype: 'minovacombocolumnfixvalue',
|
2072
|
text: rec.HeaderTitle,
|
2073
|
dataIndex: rec.FieldName,
|
2074
|
fixedValue: rec.FixedValue,
|
2075
|
filter: {
|
2076
|
type: 'list',
|
2077
|
itemDefaults: {
|
2078
|
emptyText: 'Search for...'
|
2079
|
}
|
2080
|
}
|
2081
|
});
|
2082
|
} else {
|
2083
|
cols_.push({
|
2084
|
text: rec.HeaderTitle,
|
2085
|
dataIndex: rec.FieldName,
|
2086
|
filter: {
|
2087
|
itemDefaults: {
|
2088
|
emptyText: 'Search for...'
|
2089
|
}
|
2090
|
}
|
2091
|
});
|
2092
|
}
|
2093
|
break
|
2094
|
}
|
2095
|
} else {
|
2096
|
cols_.push({
|
2097
|
text: rec.HeaderTitle,
|
2098
|
dataIndex: rec.FieldName,
|
2099
|
hidden: true,
|
2100
|
filter: {
|
2101
|
itemDefaults: {
|
2102
|
emptyText: 'Search for...'
|
2103
|
}
|
2104
|
}
|
2105
|
});
|
2106
|
}
|
2107
|
|
2108
|
}
|
2109
|
});
|
2110
|
};
|
2111
|
var param_ = me.param;
|
2112
|
if (param_ == undefined) {
|
2113
|
param_ = ''
|
2114
|
}
|
2115
|
var jsStoreGrid = new Ext.data.Store({
|
2116
|
storeId: me.storename,
|
2117
|
autoLoad: autoLoad,
|
2118
|
pageSize: me.pagesize,
|
2119
|
proxy: {
|
2120
|
method: 'POST',
|
2121
|
type: 'ajax',
|
2122
|
url: '/UserControl/GetStorePagingAuth',
|
2123
|
extraParams: {
|
2124
|
tableName: me.tableName,
|
2125
|
param: param_,
|
2126
|
menuId: MinovaUtil.GetMenuID()
|
2127
|
},
|
2128
|
reader: {
|
2129
|
type: 'json',
|
2130
|
root: 'data',
|
2131
|
totalProperty: 'totalRecords'
|
2132
|
}
|
2133
|
},
|
2134
|
});
|
2135
|
Ext.applyIf(me, {
|
2136
|
autoScroll: true,
|
2137
|
enableLocking: locking,
|
2138
|
lockedGridConfig: {
|
2139
|
header: false,
|
2140
|
collapsible: true,
|
2141
|
width: widthLock,
|
2142
|
forceFit: locking,
|
2143
|
listeners: {
|
2144
|
render: function (grid) {
|
2145
|
var pagingToolbar = grid.child('pagingtoolbar');
|
2146
|
if (pagingToolbar) {
|
2147
|
grid.remove(pagingToolbar, true);
|
2148
|
}
|
2149
|
}
|
2150
|
}
|
2151
|
},
|
2152
|
listeners: {
|
2153
|
viewready: function () {
|
2154
|
if (autoLoad == true) {
|
2155
|
this.getStore().loadPage(1);
|
2156
|
}
|
2157
|
},
|
2158
|
beforeedit: function () {
|
2159
|
return false;
|
2160
|
},
|
2161
|
},
|
2162
|
lockedViewConfig: {
|
2163
|
scroll: 'horizontal'
|
2164
|
},
|
2165
|
viewConfig: {
|
2166
|
emptyText: 'No Data Display',
|
2167
|
deferEmptyText: false,
|
2168
|
//Add Nana For Autosize Column Mode
|
2169
|
listeners: {
|
2170
|
refresh: function (dataview) {
|
2171
|
Ext.each(dataview.panel.columns, function (column) {
|
2172
|
//if (column.autoSizeColumn == false)
|
2173
|
// column.autoSizeColumn = true;
|
2174
|
column.autoSize();
|
2175
|
//dataview.store.reload();
|
2176
|
})
|
2177
|
},
|
2178
|
afterrender: function (dataview) {
|
2179
|
Ext.defer(function () {
|
2180
|
dataview.store.reload();
|
2181
|
}, 2000, this);
|
2182
|
//dataview.store.reload();
|
2183
|
}
|
2184
|
},
|
2185
|
render: function (comp) {
|
2186
|
comp.getStore().reload();
|
2187
|
}
|
2188
|
},
|
2189
|
//for chekbox
|
2190
|
selModel: {
|
2191
|
//type: 'cellmodel'
|
2192
|
},
|
2193
|
selType: checkSelection,
|
2194
|
columns: cols_,
|
2195
|
|
2196
|
store: jsStoreGrid,
|
2197
|
|
2198
|
plugins: [{
|
2199
|
ptype: 'gridfilters'
|
2200
|
}
|
2201
|
],
|
2202
|
|
2203
|
});
|
2204
|
me.callParent(arguments);
|
2205
|
}
|
2206
|
|
2207
|
});
|
2208
|
|
2209
|
Ext.define('MinovaUtil.MinovaES.MinovaGrid2', {
|
2210
|
extend: 'Ext.grid.Panel',
|
2211
|
requires: ['Ext.grid.RowNumberer'],
|
2212
|
alias: 'widget.minovagrid2',
|
2213
|
//alias: ['widget.minovagrid2', 'widget.minovagrid'],
|
2214
|
//alias: ['widget.minovagrid2', 'widget.minovagrid'],
|
2215
|
alternateClassName: 'Ext.grid.MinovaGrid',
|
2216
|
//controller:'orm-manage2-controller',
|
2217
|
tableName: undefined,
|
2218
|
isLookup: undefined,
|
2219
|
param: undefined,
|
2220
|
pagesize: undefined,
|
2221
|
storename: undefined,
|
2222
|
layoutType: undefined,
|
2223
|
enableLocking: true,
|
2224
|
autoLoad: undefined,
|
2225
|
multiSelect: undefined,
|
2226
|
getTableName: function () {
|
2227
|
return this.tableName;
|
2228
|
},
|
2229
|
|
2230
|
initComponent: function () {
|
2231
|
var me = this;
|
2232
|
var cols_ = [];
|
2233
|
var fieldeditor = {};
|
2234
|
var hasil = null;
|
2235
|
var autoLoad = true;
|
2236
|
var LangID = localStorage.LangId;
|
2237
|
var fielGrid = 'rec.GridView == 1';
|
2238
|
var locking = true;
|
2239
|
var checkSelection = '';
|
2240
|
var widthLock = 250;
|
2241
|
if (me.multiSelect) {
|
2242
|
locking = false;
|
2243
|
checkSelection = 'checkboxmodel';
|
2244
|
widthLock = 40;
|
2245
|
}
|
2246
|
//var _url = 'GetAllField';
|
2247
|
if (me.autoLoad == false) {
|
2248
|
autoLoad = false;
|
2249
|
}
|
2250
|
parameter = null;
|
2251
|
if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
|
2252
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupGrid='1'";
|
2253
|
fielGrid = 'rec.LookupGrid == 1';
|
2254
|
locking = false;
|
2255
|
|
2256
|
} else {
|
2257
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
|
2258
|
//autoLoad = false;
|
2259
|
//_url = 'GetAllFieldGridLookUp';
|
2260
|
};
|
2261
|
|
2262
|
//Ext.Ajax.request({
|
2263
|
// async : false,
|
2264
|
// method : 'POST',
|
2265
|
// url : '/Devt/' + _url + '?tableName=' + me.tableName,
|
2266
|
// success : function (response) {
|
2267
|
// var results = Ext.decode(response.responseText);
|
2268
|
// hasil = results.data;
|
2269
|
// }
|
2270
|
//});
|
2271
|
//hamid03102016
|
2272
|
|
2273
|
Ext.Ajax.request({
|
2274
|
async: false,
|
2275
|
method: 'POST',
|
2276
|
url: '/UserControl/GetStore',
|
2277
|
params: {
|
2278
|
tableName: 'PDSBS0007',
|
2279
|
param: parameter
|
2280
|
},
|
2281
|
success: function (response) {
|
2282
|
var results = Ext.decode(response.responseText);
|
2283
|
hasil = results.data;
|
2284
|
}
|
2285
|
});
|
2286
|
//end
|
2287
|
|
2288
|
if (hasil.length > 0) {
|
2289
|
|
2290
|
Ext.each(hasil, function (rec) {
|
2291
|
var null_ = null;
|
2292
|
if (rec.IsPrimaryKey == true) {
|
2293
|
null_ = false;
|
2294
|
}
|
2295
|
if (rec.IsRequired == true) {
|
2296
|
null_ = false;
|
2297
|
} else {
|
2298
|
null_ = true;
|
2299
|
}
|
2300
|
|
2301
|
if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
|
2302
|
if (rec.LookupGrid == 1) {
|
2303
|
switch (rec.FormatRef) {
|
2304
|
case "file":
|
2305
|
cols_.push({
|
2306
|
xtype: 'minovapicturecolumn',
|
2307
|
text: rec.HeaderTitle,
|
2308
|
dataIndex: rec.FieldName,
|
2309
|
width: 100,
|
2310
|
//filter: {
|
2311
|
// type: 'image',
|
2312
|
// itemDefaults: {
|
2313
|
// emptyText: 'Search for...'
|
2314
|
// }
|
2315
|
//}
|
2316
|
});
|
2317
|
break
|
2318
|
case "date":
|
2319
|
cols_.push({
|
2320
|
xtype: 'minovadatecolumn',
|
2321
|
text: rec.HeaderTitle,
|
2322
|
dataIndex: rec.FieldName,
|
2323
|
width: 100,
|
2324
|
filter: {
|
2325
|
type: 'date',
|
2326
|
itemDefaults: {
|
2327
|
emptyText: 'Search for...'
|
2328
|
}
|
2329
|
}
|
2330
|
});
|
2331
|
break
|
2332
|
case "amount":
|
2333
|
cols_.push({
|
2334
|
xtype: 'minovacurrancycolumn',
|
2335
|
text: rec.HeaderTitle,
|
2336
|
dataIndex: rec.FieldName,
|
2337
|
align: 'right',
|
2338
|
width: 300,
|
2339
|
filter: {
|
2340
|
type: 'number',
|
2341
|
itemDefaults: {
|
2342
|
emptyText: 'Search for...'
|
2343
|
}
|
2344
|
}
|
2345
|
});
|
2346
|
break
|
2347
|
case "amountencrypt":
|
2348
|
cols_.push({
|
2349
|
xtype: 'minovaamountcolumn',
|
2350
|
text: rec.HeaderTitle,
|
2351
|
dataIndex: rec.FieldName,
|
2352
|
align: 'right',
|
2353
|
width: 300,
|
2354
|
filter: {
|
2355
|
type: 'string',
|
2356
|
itemDefaults: {
|
2357
|
emptyText: 'Search for...'
|
2358
|
}
|
2359
|
}
|
2360
|
});
|
2361
|
break
|
2362
|
case "datetime":
|
2363
|
cols_.push({
|
2364
|
xtype: 'minovadatetimecolumn',
|
2365
|
text: rec.HeaderTitle,
|
2366
|
dataIndex: rec.FieldName,
|
2367
|
width: 140,
|
2368
|
filter: {
|
2369
|
type: 'string',
|
2370
|
itemDefaults: {
|
2371
|
emptyText: 'Search for...'
|
2372
|
}
|
2373
|
}
|
2374
|
});
|
2375
|
break
|
2376
|
default:
|
2377
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
2378
|
cols_.push({
|
2379
|
text: rec.HeaderTitle,
|
2380
|
dataIndex: rec.FieldName,
|
2381
|
width: 100,
|
2382
|
filter: {
|
2383
|
type: 'string',
|
2384
|
itemDefaults: {
|
2385
|
emptyText: 'Search for...'
|
2386
|
}
|
2387
|
}
|
2388
|
});
|
2389
|
} else if (rec.SearchType == '2') {
|
2390
|
cols_.push({
|
2391
|
xtype: 'minovalookupcolumn',
|
2392
|
text: rec.HeaderTitle,
|
2393
|
tableName: rec.TableRef,
|
2394
|
dataIndex: rec.FieldName,
|
2395
|
filter: {
|
2396
|
itemDefaults: {
|
2397
|
emptyText: 'Search for...'
|
2398
|
}
|
2399
|
}
|
2400
|
});
|
2401
|
} else if (rec.TableRef != "" && rec.SearchType != '2') {
|
2402
|
if (rec.TableRef != null) {
|
2403
|
var valueField = null;
|
2404
|
var displayValue = null;
|
2405
|
Ext.Ajax.request({
|
2406
|
async: false,
|
2407
|
method: 'POST',
|
2408
|
url: '/UserControl/GetStore',
|
2409
|
params: {
|
2410
|
tableName: 'SDATATABLEFIELD',
|
2411
|
param: 'TableName[equal]' + rec.TableRef
|
2412
|
},
|
2413
|
success: function (response) {
|
2414
|
var results = Ext.decode(response.responseText);
|
2415
|
data_ = results.data;
|
2416
|
if (data_ != undefined) {
|
2417
|
valueField_ = $.grep(data_, function (r) {
|
2418
|
return r.ValueField == '1'
|
2419
|
});
|
2420
|
valueField = valueField_[0].FieldName
|
2421
|
displayValue_ = $.grep(data_, function (r) {
|
2422
|
return r.DisplayValue == '1'
|
2423
|
});
|
2424
|
displayValue = displayValue_[0].FieldName
|
2425
|
}
|
2426
|
}
|
2427
|
});
|
2428
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
2429
|
var count_ = 0;
|
2430
|
if (store_) {
|
2431
|
count_ = store_.count();
|
2432
|
}
|
2433
|
if (count_ == 0) {
|
2434
|
Ext.create('Ext.data.Store', {
|
2435
|
storeId: 'store_' + rec.FieldName,
|
2436
|
//autoLoad: true,
|
2437
|
proxy: {
|
2438
|
method: 'POST',
|
2439
|
type: 'ajax',
|
2440
|
url: '/UserControl/GetStore',
|
2441
|
extraParams: {
|
2442
|
tableName: rec.TableRef,
|
2443
|
param: rec.ParamCombo
|
2444
|
},
|
2445
|
reader: {
|
2446
|
type: 'json',
|
2447
|
root: 'data',
|
2448
|
totalProperty: 'data[0].TotalCount'
|
2449
|
}
|
2450
|
}
|
2451
|
})
|
2452
|
}
|
2453
|
cols_.push({
|
2454
|
xtype: 'minovacombocolumn',
|
2455
|
text: rec.HeaderTitle,
|
2456
|
dataIndex: rec.FieldName,
|
2457
|
valueField: valueField,
|
2458
|
displayField: displayValue,
|
2459
|
store: 'store_' + rec.FieldName,
|
2460
|
filter: {
|
2461
|
type: 'list',
|
2462
|
itemDefaults: {
|
2463
|
emptyText: 'Search for...'
|
2464
|
}
|
2465
|
}
|
2466
|
});
|
2467
|
}
|
2468
|
|
2469
|
} else {
|
2470
|
cols_.push({
|
2471
|
text: rec.HeaderTitle,
|
2472
|
dataIndex: rec.FieldName,
|
2473
|
filter: {
|
2474
|
itemDefaults: {
|
2475
|
emptyText: 'Search for...'
|
2476
|
}
|
2477
|
}
|
2478
|
});
|
2479
|
}
|
2480
|
break
|
2481
|
}
|
2482
|
} else {
|
2483
|
cols_.push({
|
2484
|
text: rec.HeaderTitle,
|
2485
|
dataIndex: rec.FieldName,
|
2486
|
hidden: true,
|
2487
|
filter: {
|
2488
|
itemDefaults: {
|
2489
|
emptyText: 'Search for...'
|
2490
|
}
|
2491
|
}
|
2492
|
});
|
2493
|
}
|
2494
|
|
2495
|
} else {
|
2496
|
if (rec.GridView == 1) {
|
2497
|
switch (rec.FormatRef) {
|
2498
|
case "action":
|
2499
|
cols_.push({
|
2500
|
text: rec.HeaderTitle,
|
2501
|
width: 100,
|
2502
|
xtype: 'actioncolumn',
|
2503
|
tooltip: 'View Data',
|
2504
|
name: rec.FieldName,
|
2505
|
itemId: me.tableName + rec.FieldName,
|
2506
|
align: 'center',
|
2507
|
iconCls: 'fa-edit',
|
2508
|
renderer: function (value, metadata, record) {
|
2509
|
metadata.tdStyle = 'font-family: FontAwesome'
|
2510
|
},
|
2511
|
handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
|
2512
|
|
2513
|
this.fireEvent(me.tableName + rec.FieldName + "onActionClick", record);
|
2514
|
}
|
2515
|
});
|
2516
|
break
|
2517
|
case "file":
|
2518
|
cols_.push({
|
2519
|
xtype: 'minovapicturecolumn',
|
2520
|
text: rec.HeaderTitle,
|
2521
|
dataIndex: rec.FieldName,
|
2522
|
width: 100,
|
2523
|
//filter: {
|
2524
|
// type: '',
|
2525
|
// itemDefaults: {
|
2526
|
// emptyText: 'Search for...'
|
2527
|
// }
|
2528
|
//}
|
2529
|
});
|
2530
|
break
|
2531
|
case "date":
|
2532
|
cols_.push({
|
2533
|
xtype: 'minovadatecolumn',
|
2534
|
text: rec.HeaderTitle,
|
2535
|
dataIndex: rec.FieldName,
|
2536
|
width: 100,
|
2537
|
filter: {
|
2538
|
type: 'date',
|
2539
|
itemDefaults: {
|
2540
|
emptyText: 'Search for...'
|
2541
|
}
|
2542
|
}
|
2543
|
});
|
2544
|
break
|
2545
|
case "amountencrypt":
|
2546
|
cols_.push({
|
2547
|
xtype: 'minovaamountcolumn',
|
2548
|
text: rec.HeaderTitle,
|
2549
|
dataIndex: rec.FieldName,
|
2550
|
align: 'right',
|
2551
|
width: 300,
|
2552
|
filter: {
|
2553
|
type: 'string',
|
2554
|
itemDefaults: {
|
2555
|
emptyText: 'Search for...'
|
2556
|
}
|
2557
|
}
|
2558
|
});
|
2559
|
break
|
2560
|
case "amount":
|
2561
|
cols_.push({
|
2562
|
xtype: 'minovacurrancycolumn',
|
2563
|
text: rec.HeaderTitle,
|
2564
|
dataIndex: rec.FieldName,
|
2565
|
align: 'right',
|
2566
|
width: 300,
|
2567
|
filter: {
|
2568
|
type: 'number',
|
2569
|
itemDefaults: {
|
2570
|
emptyText: 'Search for...'
|
2571
|
}
|
2572
|
}
|
2573
|
});
|
2574
|
break
|
2575
|
case "datetime":
|
2576
|
cols_.push({
|
2577
|
xtype: 'minovadatetimecolumn',
|
2578
|
text: rec.HeaderTitle,
|
2579
|
dataIndex: rec.FieldName,
|
2580
|
width: 140,
|
2581
|
filter: {
|
2582
|
type: 'string',
|
2583
|
itemDefaults: {
|
2584
|
emptyText: 'Search for...'
|
2585
|
}
|
2586
|
}
|
2587
|
});
|
2588
|
break
|
2589
|
default:
|
2590
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
2591
|
cols_.push({
|
2592
|
text: rec.HeaderTitle,
|
2593
|
dataIndex: rec.FieldName,
|
2594
|
width: 100,
|
2595
|
filter: {
|
2596
|
type: 'string',
|
2597
|
itemDefaults: {
|
2598
|
emptyText: 'Search for...'
|
2599
|
}
|
2600
|
}
|
2601
|
});
|
2602
|
} else if (rec.TableRef != "") {
|
2603
|
if (rec.TableRef != null) {
|
2604
|
var valueField = null;
|
2605
|
var displayValue = null;
|
2606
|
Ext.Ajax.request({
|
2607
|
async: false,
|
2608
|
method: 'POST',
|
2609
|
url: '/UserControl/GetStore',
|
2610
|
params: {
|
2611
|
tableName: 'SDATATABLEFIELD',
|
2612
|
param: 'TableName[equal]' + rec.TableRef
|
2613
|
},
|
2614
|
success: function (response) {
|
2615
|
var results = Ext.decode(response.responseText);
|
2616
|
data_ = results.data;
|
2617
|
//if (data_ != undefined) {
|
2618
|
if (data_.length > 0) {
|
2619
|
valueField_ = $.grep(data_, function (r) {
|
2620
|
return r.ValueField == '1'
|
2621
|
});
|
2622
|
valueField = valueField_[0].FieldName
|
2623
|
displayValue_ = $.grep(data_, function (r) {
|
2624
|
return r.DisplayValue == '1'
|
2625
|
});
|
2626
|
displayValue = displayValue_[0].FieldName
|
2627
|
} else {
|
2628
|
MinovaMessage('Not Null', 'BSNULLCOMBO', rec.TableRef, 'E');
|
2629
|
}
|
2630
|
}
|
2631
|
});
|
2632
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
2633
|
var count_ = 0;
|
2634
|
if (store_) {
|
2635
|
count_ = store_.count();
|
2636
|
}
|
2637
|
if (count_ == 0) {
|
2638
|
Ext.create('Ext.data.Store', {
|
2639
|
storeId: 'store_' + rec.FieldName,
|
2640
|
autoLoad: false,
|
2641
|
proxy: {
|
2642
|
method: 'POST',
|
2643
|
type: 'ajax',
|
2644
|
url: '/UserControl/GetStore',
|
2645
|
extraParams: {
|
2646
|
tableName: rec.TableRef,
|
2647
|
param: rec.ParamCombo
|
2648
|
},
|
2649
|
reader: {
|
2650
|
type: 'json',
|
2651
|
root: 'data',
|
2652
|
totalProperty: 'data[0].TotalCount'
|
2653
|
}
|
2654
|
}
|
2655
|
})
|
2656
|
}
|
2657
|
cols_.push({
|
2658
|
xtype: 'minovacombocolumn',
|
2659
|
text: rec.HeaderTitle,
|
2660
|
dataIndex: rec.FieldName,
|
2661
|
valueField: valueField,
|
2662
|
displayField: displayValue,
|
2663
|
store: 'store_' + rec.FieldName,
|
2664
|
filter: {
|
2665
|
type: 'list',
|
2666
|
itemDefaults: {
|
2667
|
emptyText: 'Search for...'
|
2668
|
}
|
2669
|
}
|
2670
|
});
|
2671
|
}
|
2672
|
|
2673
|
} else if (rec.FixedValue != "") {
|
2674
|
cols_.push({
|
2675
|
xtype: 'minovacombocolumnfixvalue',
|
2676
|
text: rec.HeaderTitle,
|
2677
|
dataIndex: rec.FieldName,
|
2678
|
fixedValue: rec.FixedValue,
|
2679
|
filter: {
|
2680
|
type: 'list',
|
2681
|
itemDefaults: {
|
2682
|
emptyText: 'Search for...'
|
2683
|
}
|
2684
|
}
|
2685
|
});
|
2686
|
} else {
|
2687
|
cols_.push({
|
2688
|
text: rec.HeaderTitle,
|
2689
|
dataIndex: rec.FieldName,
|
2690
|
filter: {
|
2691
|
itemDefaults: {
|
2692
|
emptyText: 'Search for...'
|
2693
|
}
|
2694
|
}
|
2695
|
});
|
2696
|
}
|
2697
|
break
|
2698
|
}
|
2699
|
} else {
|
2700
|
cols_.push({
|
2701
|
text: rec.HeaderTitle,
|
2702
|
dataIndex: rec.FieldName,
|
2703
|
hidden: true,
|
2704
|
filter: {
|
2705
|
itemDefaults: {
|
2706
|
emptyText: 'Search for...'
|
2707
|
}
|
2708
|
}
|
2709
|
});
|
2710
|
}
|
2711
|
|
2712
|
}
|
2713
|
});
|
2714
|
};
|
2715
|
var param_ = me.param;
|
2716
|
if (param_ == undefined) {
|
2717
|
param_ = ''
|
2718
|
}
|
2719
|
var jsStoreGrid = new Ext.data.Store({
|
2720
|
storeId: me.storename,
|
2721
|
autoLoad: autoLoad,
|
2722
|
pageSize: me.pagesize,
|
2723
|
proxy: {
|
2724
|
method: 'POST',
|
2725
|
type: 'ajax',
|
2726
|
url: '/UserControl/GetStorePagingAuth',
|
2727
|
extraParams: {
|
2728
|
tableName: me.tableName,
|
2729
|
param: param_,
|
2730
|
menuId: MinovaUtil.GetMenuID()
|
2731
|
},
|
2732
|
reader: {
|
2733
|
type: 'json',
|
2734
|
root: 'data',
|
2735
|
totalProperty: 'totalRecords'
|
2736
|
}
|
2737
|
},
|
2738
|
});
|
2739
|
Ext.applyIf(me, {
|
2740
|
autoScroll: true,
|
2741
|
enableLocking: locking,
|
2742
|
lockedGridConfig: {
|
2743
|
header: false,
|
2744
|
collapsible: true,
|
2745
|
width: widthLock,
|
2746
|
forceFit: locking,
|
2747
|
listeners: {
|
2748
|
render: function (grid) {
|
2749
|
var pagingToolbar = grid.child('pagingtoolbar');
|
2750
|
if (pagingToolbar) {
|
2751
|
grid.remove(pagingToolbar, true);
|
2752
|
}
|
2753
|
}
|
2754
|
}
|
2755
|
},
|
2756
|
listeners: {
|
2757
|
viewready: function () {
|
2758
|
if (autoLoad == true) {
|
2759
|
this.getStore().loadPage(1);
|
2760
|
}
|
2761
|
},
|
2762
|
beforeedit: function () {
|
2763
|
return false;
|
2764
|
},
|
2765
|
},
|
2766
|
lockedViewConfig: {
|
2767
|
scroll: 'horizontal'
|
2768
|
},
|
2769
|
viewConfig: {
|
2770
|
emptyText: 'No Data Display',
|
2771
|
deferEmptyText: false,
|
2772
|
//Add Nana For Autosize Column Mode
|
2773
|
listeners: {
|
2774
|
refresh: function (dataview) {
|
2775
|
Ext.each(dataview.panel.columns, function (column) {
|
2776
|
//if (column.autoSizeColumn == false)
|
2777
|
// column.autoSizeColumn = true;
|
2778
|
column.autoSize();
|
2779
|
//dataview.store.reload();
|
2780
|
})
|
2781
|
}
|
2782
|
},
|
2783
|
render: function (comp) {
|
2784
|
comp.getStore().reload();
|
2785
|
}
|
2786
|
},
|
2787
|
//for chekbox
|
2788
|
selModel: {
|
2789
|
//type: 'cellmodel'
|
2790
|
},
|
2791
|
selType: checkSelection,
|
2792
|
columns: cols_,
|
2793
|
|
2794
|
store: jsStoreGrid,
|
2795
|
|
2796
|
plugins: [{
|
2797
|
ptype: 'gridfilters'
|
2798
|
}
|
2799
|
],
|
2800
|
|
2801
|
});
|
2802
|
me.callParent(arguments);
|
2803
|
}
|
2804
|
|
2805
|
});
|
2806
|
Ext.define('MinovaUtil.MinovaES.MinovaGrid', {
|
2807
|
extend: 'Ext.grid.Panel',
|
2808
|
requires: ['Ext.grid.RowNumberer'],
|
2809
|
alias: 'widget.minovagrid',
|
2810
|
//alternateClassName : 'Ext.grid.MinovaGrid',
|
2811
|
tableName: undefined,
|
2812
|
isLookup: undefined,
|
2813
|
param: undefined,
|
2814
|
pagesize: undefined,
|
2815
|
storename: undefined,
|
2816
|
layoutType: undefined,
|
2817
|
enableLocking: true,
|
2818
|
|
2819
|
tbar: [{
|
2820
|
xtype: 'button',
|
2821
|
text: 'Action',
|
2822
|
name: 'actionBtn',
|
2823
|
//scale: 'medium',
|
2824
|
menu: [{
|
2825
|
text: 'Add',
|
2826
|
name: 'Add_',
|
2827
|
action: 'CRUDaddNewRecord',
|
2828
|
style: 'font-family: FontAwesome',
|
2829
|
iconCls: 'fa-plus-circle',
|
2830
|
handler: function () {
|
2831
|
var layout = null;
|
2832
|
var tolbar = this.up();
|
2833
|
var name = '';
|
2834
|
var tableName = tolbar.up().up().up().tableName;
|
2835
|
var mpnl = Ext.ComponentQuery.query('[name=DetailMD]')[0];
|
2836
|
var titleMain = mpnl.getTitle();
|
2837
|
var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
|
2838
|
if (pnl) {
|
2839
|
layout = pnl.getLayoutType();
|
2840
|
pnl.setLastpage('MinovaGridFormGrid' + tableName);
|
2841
|
pnl.setLastTitle(titleMain);
|
2842
|
mpnl.setTitle('Add ' + titleMain);
|
2843
|
} else {
|
2844
|
pnl = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
|
2845
|
layout = pnl.getLayoutType();
|
2846
|
pnl.setLastpage('MinovaGridFormGrid' + tableName);
|
2847
|
pnl.setLastTitle(titleMain);
|
2848
|
mpnl.setTitle('Add ' + titleMain);
|
2849
|
}
|
2850
|
if (layout == 'L003') {
|
2851
|
var _grid = "MinovaGridFormGrid" + tableName;
|
2852
|
var _formDisplay = "MinovaGridFormDisplay" + tableName;
|
2853
|
var _formEdit = "MinovaGridFormEdit" + tableName;
|
2854
|
var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
|
2855
|
var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
|
2856
|
var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
|
2857
|
g.setHidden(true);
|
2858
|
formDisplay.setHidden(true);
|
2859
|
formEdit.reset();
|
2860
|
formEdit.setActionSubmit(0)
|
2861
|
formEdit.setSubmitProc(true)
|
2862
|
formEdit.setHidden(false);
|
2863
|
var heigh = pnl.getLastheightform();
|
2864
|
var pDetail = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
|
2865
|
if (pDetail) {
|
2866
|
// pDetail.setHeight(heigh + 100);
|
2867
|
} else {
|
2868
|
pDetail = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0];
|
2869
|
var mainPnl_ = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]
|
2870
|
var mainPnl = mainPnl_.getHeight();
|
2871
|
//pDetail.setHeight(mainPnl + 100);
|
2872
|
|
2873
|
}
|
2874
|
|
2875
|
var emp = formEdit.getForm().findField("EmployeeID");
|
2876
|
if (emp) {
|
2877
|
emp.setValue(getParam("EmployeeID"))
|
2878
|
emp.setHidden(true);
|
2879
|
}
|
2880
|
|
2881
|
} else {
|
2882
|
var _grid = "MinovaGridFormGrid" + tableName;
|
2883
|
var _formDisplay = "MinovaGridFormDisplay" + tableName;
|
2884
|
var _formEdit = "MinovaGridFormEdit" + tableName;
|
2885
|
var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
|
2886
|
var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
|
2887
|
var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
|
2888
|
formEdit.setActionSubmit(0)
|
2889
|
formDisplay.setHidden(true);
|
2890
|
formDisplay.setTitle("Add");
|
2891
|
|
2892
|
formEdit.setTitle("Add - " + titleMain);
|
2893
|
formEdit.reset();
|
2894
|
formEdit.setSubmitProc(true)
|
2895
|
formEdit.setHidden(false);
|
2896
|
var emp = formEdit.getForm().findField("EmployeeID");
|
2897
|
if (emp) {
|
2898
|
emp.setValue(Ext.ComponentQuery.query('[name=EmployeeID]')[0].getValue())
|
2899
|
emp.setHidden(true);
|
2900
|
}
|
2901
|
|
2902
|
}
|
2903
|
}
|
2904
|
}, {
|
2905
|
text: 'Copy',
|
2906
|
name: 'Copy_',
|
2907
|
iconCls: 'fa-copy',
|
2908
|
style: 'font-family: FontAwesome',
|
2909
|
handler: function () {
|
2910
|
var layout = null;
|
2911
|
var tolbar = this.up();
|
2912
|
var name = '';
|
2913
|
var tableName = tolbar.up().up().up().tableName;
|
2914
|
var mpnl = Ext.ComponentQuery.query('[name=DetailMD]')[0];
|
2915
|
var titleMain = mpnl.getTitle();
|
2916
|
var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
|
2917
|
|
2918
|
if (pnl) {
|
2919
|
layout = pnl.getLayoutType();
|
2920
|
pnl.setLastpage('MinovaGridFormGrid' + tableName);
|
2921
|
pnl.setLastTitle(titleMain);
|
2922
|
mpnl.setTitle('Copy ' + titleMain);
|
2923
|
} else {
|
2924
|
pnl = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
|
2925
|
layout = pnl.getLayoutType();
|
2926
|
pnl.setLastpage('MinovaGridFormGrid' + tableName);
|
2927
|
pnl.setLastTitle(titleMain);
|
2928
|
mpnl.setTitle('Copy ' + titleMain);
|
2929
|
}
|
2930
|
if (layout == 'L003') {
|
2931
|
var _grid = "MinovaGridFormGrid" + tableName;
|
2932
|
var _formDisplay = "MinovaGridFormDisplay" + tableName;
|
2933
|
var _formEdit = "MinovaGridFormEdit" + tableName;
|
2934
|
var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
|
2935
|
var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
|
2936
|
var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
|
2937
|
g.setHidden(true);
|
2938
|
formDisplay.setHidden(true);
|
2939
|
formEdit.reset();
|
2940
|
formEdit.setActionSubmit(0)
|
2941
|
formEdit.setSubmitProc(true)
|
2942
|
formEdit.setHidden(false);
|
2943
|
var heigh = pnl.getLastheightform();
|
2944
|
var pDetail = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
|
2945
|
if (pDetail) {
|
2946
|
//pDetail.setHeight(heigh + 100);
|
2947
|
} else {
|
2948
|
pDetail = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0];
|
2949
|
var mainPnl_ = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]
|
2950
|
var mainPnl = mainPnl_.getHeight();
|
2951
|
//pDetail.setHeight(mainPnl + 100);
|
2952
|
|
2953
|
}
|
2954
|
Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]
|
2955
|
|
2956
|
var emp = formEdit.getForm().findField("EmployeeID");
|
2957
|
if (emp) {
|
2958
|
emp.setValue(getParam("EmployeeID"))
|
2959
|
emp.setHidden(true);
|
2960
|
}
|
2961
|
var selection = tolbar.up().up().up().getView().getSelectionModel().getSelection()[0];
|
2962
|
if (selection) {
|
2963
|
formDisplay.getForm().setValues(selection.data);
|
2964
|
formEdit.getForm().setValues(selection.data);
|
2965
|
}
|
2966
|
|
2967
|
} else {
|
2968
|
var _grid = "MinovaGridFormGrid" + tableName;
|
2969
|
var _formDisplay = "MinovaGridFormDisplay" + tableName;
|
2970
|
var _formEdit = "MinovaGridFormEdit" + tableName;
|
2971
|
var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
|
2972
|
var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
|
2973
|
var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
|
2974
|
formEdit.setActionSubmit(0)
|
2975
|
formDisplay.setHidden(true);
|
2976
|
formDisplay.setTitle("Add");
|
2977
|
|
2978
|
formEdit.setTitle("Copy - " + titleMain);
|
2979
|
formEdit.reset();
|
2980
|
formEdit.setSubmitProc(true)
|
2981
|
formEdit.setHidden(false);
|
2982
|
var emp = formEdit.getForm().findField("EmployeeID");
|
2983
|
if (emp) {
|
2984
|
emp.setValue(Ext.ComponentQuery.query('[name=EmployeeID]')[0].getValue())
|
2985
|
emp.setHidden(true);
|
2986
|
}
|
2987
|
var selection = tolbar.up().up().up().getView().getSelectionModel().getSelection()[0];
|
2988
|
if (selection) {
|
2989
|
formDisplay.getForm().setValues(selection.data);
|
2990
|
formEdit.getForm().setValues(selection.data);
|
2991
|
formEdit.setSubmitProc(true);
|
2992
|
formEdit.setActionSubmit(0);
|
2993
|
}
|
2994
|
|
2995
|
}
|
2996
|
}
|
2997
|
}, {
|
2998
|
text: 'Edit',
|
2999
|
name: 'Edit_',
|
3000
|
iconCls: 'fa-edit',
|
3001
|
style: 'font-family: FontAwesome',
|
3002
|
handler: function () {
|
3003
|
var layout = null;
|
3004
|
var tolbar = this.up();
|
3005
|
var name = '';
|
3006
|
var tableName = tolbar.up().up().up().tableName;
|
3007
|
|
3008
|
var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
|
3009
|
if (pnl) {
|
3010
|
layout = pnl.getLayoutType();
|
3011
|
pnl.setLastpage('MinovaGridFormGrid' + tableName);
|
3012
|
|
3013
|
} else {
|
3014
|
pnl = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
|
3015
|
layout = pnl.getLayoutType();
|
3016
|
pnl.setLastpage('MinovaGridFormGrid' + tableName);
|
3017
|
}
|
3018
|
|
3019
|
if (layout == 'L003') {
|
3020
|
var _grid = "MinovaGridFormGrid" + tableName;
|
3021
|
var _formDisplay = "MinovaGridFormDisplay" + tableName;
|
3022
|
var _formEdit = "MinovaGridFormEdit" + tableName;
|
3023
|
var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
|
3024
|
var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
|
3025
|
var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
|
3026
|
|
3027
|
var selection = tolbar.up().up().up().getView().getSelectionModel().getSelection()[0];
|
3028
|
if (selection) {
|
3029
|
formDisplay.getForm().setValues(selection.data);
|
3030
|
formEdit.getForm().setValues(selection.data);
|
3031
|
formDisplay.setHidden(true);
|
3032
|
formEdit.setSubmitProc(true);
|
3033
|
formEdit.setActionSubmit(1);
|
3034
|
formEdit.setHidden(false);
|
3035
|
formEdit.setHidden(false);
|
3036
|
g.setHidden(true);
|
3037
|
var heigh = pnl.getLastheightform();
|
3038
|
var pDetail = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
|
3039
|
if (pDetail) {
|
3040
|
pDetail.setHeight(heigh + 100);
|
3041
|
} else {
|
3042
|
pDetail = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0];
|
3043
|
var mainPnl_ = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]
|
3044
|
var mainPnl = mainPnl_.getHeight();
|
3045
|
//pDetail.setHeight(mainPnl + 100);
|
3046
|
|
3047
|
}
|
3048
|
|
3049
|
var p = Ext.ComponentQuery.query('[name=DetailMD]')[0];
|
3050
|
if (p) {
|
3051
|
var lastTitile = p.getTitle();
|
3052
|
pnl.setLastTitle(lastTitile);
|
3053
|
p.setTitle('Edit - ' + lastTitile)
|
3054
|
|
3055
|
}
|
3056
|
}
|
3057
|
} else {
|
3058
|
var _grid = "MinovaGridFormGrid" + tableName;
|
3059
|
var _formDisplay = "MinovaGridFormDisplay" + tableName;
|
3060
|
var _formEdit = "MinovaGridFormEdit" + tableName;
|
3061
|
var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
|
3062
|
var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
|
3063
|
var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
|
3064
|
|
3065
|
var selection = tolbar.up().up().up().getView().getSelectionModel().getSelection()[0];
|
3066
|
if (selection) {
|
3067
|
formDisplay.getForm().setValues(selection.data);
|
3068
|
formEdit.getForm().setValues(selection.data);
|
3069
|
formDisplay.setTitle("Edit");
|
3070
|
formEdit.setTitle("Edit");
|
3071
|
if (layout == 'L003') {
|
3072
|
g.setHidden(true);
|
3073
|
}
|
3074
|
|
3075
|
formDisplay.setHidden(true);
|
3076
|
formEdit.setActionSubmit(1)
|
3077
|
formEdit.setSubmitProc(true)
|
3078
|
formEdit.setHidden(false);
|
3079
|
|
3080
|
var mpnl = Ext.ComponentQuery.query('[name=DetailMD]')[0]
|
3081
|
var lastTitile = mpnl.getTitle();
|
3082
|
formEdit.setTitle('Edit - ' + lastTitile);
|
3083
|
//mpnl.setTitle('Edit ' + lastTitile);
|
3084
|
}
|
3085
|
}
|
3086
|
}
|
3087
|
}, {
|
3088
|
text: 'Delete',
|
3089
|
name: 'Delete_',
|
3090
|
iconCls: 'fa-trash-o',
|
3091
|
style: 'font-family: FontAwesome',
|
3092
|
}
|
3093
|
]
|
3094
|
}, {
|
3095
|
xtype: 'tbfill'
|
3096
|
}, {
|
3097
|
text: 'Clear Filters',
|
3098
|
tooltip: 'Clear all filters',
|
3099
|
name: 'clearbtn',
|
3100
|
handler: function () {
|
3101
|
var tolbar = this.up()
|
3102
|
var grid_ = tolbar.up()
|
3103
|
grid_.filters.clearFilters()
|
3104
|
}
|
3105
|
}, ],
|
3106
|
|
3107
|
getTableName: function () {
|
3108
|
return this.tableName;
|
3109
|
},
|
3110
|
|
3111
|
initComponent: function () {
|
3112
|
var me = this;
|
3113
|
var cols_ = [];
|
3114
|
var fieldeditor = {};
|
3115
|
var hasil = null;
|
3116
|
var autoLoad = true;
|
3117
|
var LangID = MinovaUtil.GetLangID();
|
3118
|
//var _url = 'GetAllField';
|
3119
|
|
3120
|
//if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
|
3121
|
// autoLoad = false;
|
3122
|
// _url = 'GetAllFieldGridLookUp';
|
3123
|
|
3124
|
//};
|
3125
|
//Ext.Ajax.request({
|
3126
|
// async : false,
|
3127
|
// method : 'POST',
|
3128
|
// url : '/Devt/' + _url + '?tableName=' + me.tableName,
|
3129
|
// success : function (response) {
|
3130
|
// var results = Ext.decode(response.responseText);
|
3131
|
// hasil = results.data;
|
3132
|
// }
|
3133
|
//});
|
3134
|
//hamid03102016
|
3135
|
//if (me.isLookup == 1 || isLookup == true || isLookup == 'Y') {
|
3136
|
parameter = null;
|
3137
|
if (me.isLookup == true || isLookup == 1 || isLookup == 'Y') {
|
3138
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupGrid='1'"
|
3139
|
} else {
|
3140
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
|
3141
|
}
|
3142
|
Ext.Ajax.request({
|
3143
|
async: false,
|
3144
|
method: 'POST',
|
3145
|
url: '/UserControl/GetStore',
|
3146
|
params: {
|
3147
|
tableName: 'PDSBS0007',
|
3148
|
param: parameter
|
3149
|
},
|
3150
|
success: function (response) {
|
3151
|
var results = Ext.decode(response.responseText);
|
3152
|
hasil = results.data;
|
3153
|
}
|
3154
|
});
|
3155
|
//end
|
3156
|
if (hasil.length > 0) {
|
3157
|
Ext.each(hasil, function (rec) {
|
3158
|
var null_ = null;
|
3159
|
if (rec.IsPrimaryKey == true) {
|
3160
|
null_ = false;
|
3161
|
}
|
3162
|
if (rec.IsRequired == true) {
|
3163
|
null_ = false;
|
3164
|
} else {
|
3165
|
null_ = true;
|
3166
|
}
|
3167
|
if (rec.GridView == 1) {
|
3168
|
switch (rec.FormatRef) {
|
3169
|
case "date":
|
3170
|
cols_.push({
|
3171
|
xtype: 'minovadatecolumn',
|
3172
|
text: rec.HeaderTitle,
|
3173
|
dataIndex: rec.FieldName,
|
3174
|
width: 100,
|
3175
|
filter: {
|
3176
|
type: 'date',
|
3177
|
itemDefaults: {
|
3178
|
emptyText: 'Search for...'
|
3179
|
}
|
3180
|
}
|
3181
|
});
|
3182
|
break
|
3183
|
case "amountencrypt":
|
3184
|
cols_.push({
|
3185
|
xtype: 'minovaamountcolumn',
|
3186
|
text: rec.HeaderTitle,
|
3187
|
dataIndex: rec.FieldName,
|
3188
|
align: 'right',
|
3189
|
width: 100,
|
3190
|
filter: {
|
3191
|
type: 'string',
|
3192
|
itemDefaults: {
|
3193
|
emptyText: 'Search for...'
|
3194
|
}
|
3195
|
}
|
3196
|
});
|
3197
|
break
|
3198
|
case "amount":
|
3199
|
cols_.push({
|
3200
|
xtype: 'minovacurrancycolumn',
|
3201
|
text: rec.HeaderTitle,
|
3202
|
dataIndex: rec.FieldName,
|
3203
|
align: 'right',
|
3204
|
width: 100,
|
3205
|
filter: {
|
3206
|
type: 'number',
|
3207
|
itemDefaults: {
|
3208
|
emptyText: 'Search for...'
|
3209
|
}
|
3210
|
}
|
3211
|
});
|
3212
|
break
|
3213
|
case "datetime":
|
3214
|
cols_.push({
|
3215
|
xtype: 'minovadatetimecolumn',
|
3216
|
text: rec.HeaderTitle,
|
3217
|
dataIndex: rec.FieldName,
|
3218
|
width: 140,
|
3219
|
filter: {
|
3220
|
type: 'string',
|
3221
|
itemDefaults: {
|
3222
|
emptyText: 'Search for...'
|
3223
|
}
|
3224
|
}
|
3225
|
});
|
3226
|
break
|
3227
|
default:
|
3228
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
3229
|
cols_.push({
|
3230
|
text: rec.HeaderTitle,
|
3231
|
dataIndex: rec.FieldName,
|
3232
|
width: 100,
|
3233
|
filter: {
|
3234
|
type: 'string',
|
3235
|
itemDefaults: {
|
3236
|
emptyText: 'Search for...'
|
3237
|
}
|
3238
|
}
|
3239
|
});
|
3240
|
} else if (rec.SearchType == '2') {
|
3241
|
cols_.push({
|
3242
|
xtype: 'minovalookupcolumn',
|
3243
|
text: rec.HeaderTitle,
|
3244
|
tableName: rec.TableRef,
|
3245
|
dataIndex: rec.FieldName,
|
3246
|
filter: {
|
3247
|
itemDefaults: {
|
3248
|
emptyText: 'Search for...'
|
3249
|
}
|
3250
|
}
|
3251
|
});
|
3252
|
} else if (rec.TableRef != "") {
|
3253
|
if (rec.TableRef != null) {
|
3254
|
var valueField = null;
|
3255
|
Ext.Ajax.request({
|
3256
|
async: false,
|
3257
|
method: 'POST',
|
3258
|
url: '/UserControl/GetStore',
|
3259
|
params: {
|
3260
|
tableName: 'SDATATABLEFIELD',
|
3261
|
param: 'ValueField[equal]1,TableName[equal]' + rec.TableRef
|
3262
|
},
|
3263
|
success: function (response) {
|
3264
|
var results = Ext.decode(response.responseText);
|
3265
|
data_ = results.data[0];
|
3266
|
if (data_ != undefined) {
|
3267
|
valueField = data_.FieldName;
|
3268
|
}
|
3269
|
}
|
3270
|
});
|
3271
|
|
3272
|
displayValue = null;
|
3273
|
Ext.Ajax.request({
|
3274
|
async: false,
|
3275
|
method: 'POST',
|
3276
|
url: '/UserControl/GetStore',
|
3277
|
params: {
|
3278
|
tableName: 'SDATATABLEFIELD',
|
3279
|
param: 'DisplayValue[equal]1,TableName[equal]' + rec.TableRef
|
3280
|
},
|
3281
|
success: function (response) {
|
3282
|
var results = Ext.decode(response.responseText);
|
3283
|
data_ = results.data[0];
|
3284
|
if (data_ != undefined) {
|
3285
|
displayValue = data_.FieldName;
|
3286
|
//console.log(data_)
|
3287
|
}
|
3288
|
}
|
3289
|
});
|
3290
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
3291
|
var count_ = 0;
|
3292
|
if (store_) {
|
3293
|
count_ = store_.count();
|
3294
|
}
|
3295
|
if (count_ == 0) {
|
3296
|
Ext.create('Ext.data.Store', {
|
3297
|
storeId: 'store_' + rec.FieldName,
|
3298
|
autoLoad: true,
|
3299
|
proxy: {
|
3300
|
method: 'POST',
|
3301
|
type: 'ajax',
|
3302
|
url: '/UserControl/GetStore',
|
3303
|
extraParams: {
|
3304
|
tableName: rec.TableRef,
|
3305
|
param: rec.ParamCombo
|
3306
|
},
|
3307
|
reader: {
|
3308
|
type: 'json',
|
3309
|
root: 'data',
|
3310
|
totalProperty: 'data[0].TotalCount'
|
3311
|
}
|
3312
|
}
|
3313
|
})
|
3314
|
}
|
3315
|
cols_.push({
|
3316
|
xtype: 'minovacombocolumn',
|
3317
|
text: rec.HeaderTitle,
|
3318
|
dataIndex: rec.FieldName,
|
3319
|
valueField: valueField,
|
3320
|
displayField: displayValue,
|
3321
|
store: 'store_' + rec.FieldName,
|
3322
|
filter: {
|
3323
|
type: 'list',
|
3324
|
itemDefaults: {
|
3325
|
emptyText: 'Search for...'
|
3326
|
}
|
3327
|
}
|
3328
|
});
|
3329
|
}
|
3330
|
|
3331
|
} else {
|
3332
|
cols_.push({
|
3333
|
text: rec.HeaderTitle,
|
3334
|
dataIndex: rec.FieldName,
|
3335
|
filter: {
|
3336
|
itemDefaults: {
|
3337
|
emptyText: 'Search for...'
|
3338
|
}
|
3339
|
}
|
3340
|
});
|
3341
|
}
|
3342
|
break
|
3343
|
}
|
3344
|
} else {
|
3345
|
cols_.push({
|
3346
|
text: rec.HeaderTitle,
|
3347
|
dataIndex: rec.FieldName,
|
3348
|
hidden: true,
|
3349
|
filter: {
|
3350
|
itemDefaults: {
|
3351
|
emptyText: 'Search for...'
|
3352
|
}
|
3353
|
}
|
3354
|
});
|
3355
|
}
|
3356
|
});
|
3357
|
};
|
3358
|
var param_ = me.param;
|
3359
|
if (param_ == undefined) {
|
3360
|
param_ = ''
|
3361
|
}
|
3362
|
var jsStoreGrid = new Ext.data.Store({
|
3363
|
storeId: me.storename,
|
3364
|
autoLoad: autoLoad,
|
3365
|
pageSize: me.pagesize,
|
3366
|
proxy: {
|
3367
|
method: 'POST',
|
3368
|
type: 'ajax',
|
3369
|
url: '/UserControl/GetStorePaging',
|
3370
|
extraParams: {
|
3371
|
tableName: me.tableName,
|
3372
|
param: param_
|
3373
|
},
|
3374
|
reader: {
|
3375
|
type: 'json',
|
3376
|
root: 'data',
|
3377
|
totalProperty: 'totalRecords'
|
3378
|
}
|
3379
|
}
|
3380
|
});
|
3381
|
Ext.applyIf(me, {
|
3382
|
autoScroll: true,
|
3383
|
enableLocking: true,
|
3384
|
lockedGridConfig: {
|
3385
|
header: false,
|
3386
|
collapsible: true,
|
3387
|
width: 250,
|
3388
|
forceFit: true,
|
3389
|
listeners: {
|
3390
|
render: function (grid) {
|
3391
|
var pagingToolbar = grid.child('pagingtoolbar');
|
3392
|
if (pagingToolbar) {
|
3393
|
grid.remove(pagingToolbar, true);
|
3394
|
}
|
3395
|
}
|
3396
|
}
|
3397
|
},
|
3398
|
listeners: {
|
3399
|
viewready: function () {
|
3400
|
if (autoLoad == true) {
|
3401
|
this.getStore().loadPage(1);
|
3402
|
}
|
3403
|
|
3404
|
},
|
3405
|
beforeedit: function () {
|
3406
|
return false;
|
3407
|
}
|
3408
|
},
|
3409
|
lockedViewConfig: {
|
3410
|
scroll: 'horizontal'
|
3411
|
},
|
3412
|
viewConfig: {
|
3413
|
emptyText: 'No Data Display',
|
3414
|
deferEmptyText: false,
|
3415
|
//add Nana for Autosize Column Mode
|
3416
|
listeners: {
|
3417
|
refresh: function (dataview) {
|
3418
|
Ext.each(dataview.panel.columns, function (column) {
|
3419
|
if (column.autoSizeColumn == false)
|
3420
|
column.autoSizeColumn = true;
|
3421
|
column.autoSize();
|
3422
|
})
|
3423
|
}
|
3424
|
}
|
3425
|
},
|
3426
|
columns: cols_,
|
3427
|
|
3428
|
store: jsStoreGrid,
|
3429
|
|
3430
|
plugins: [{
|
3431
|
ptype: 'gridfilters'
|
3432
|
}, {
|
3433
|
ptype: 'rowediting',
|
3434
|
clicksToEdit: 2,
|
3435
|
listeners: {
|
3436
|
edit: function (editor, context, eOpts) {}
|
3437
|
}
|
3438
|
}, ]
|
3439
|
});
|
3440
|
me.callParent(arguments);
|
3441
|
}
|
3442
|
|
3443
|
});
|
3444
|
/*MinovaGrid Report Generator*/
|
3445
|
Ext.define('MinovaUtil.MinovaES.MinovaRptGeneratorGrid', {
|
3446
|
extend: 'Ext.grid.Panel',
|
3447
|
requires: ['Ext.grid.RowNumberer', 'Ext.grid.feature.Grouping'],
|
3448
|
alias: 'widget.minovareportgeneratorgrid',
|
3449
|
storeOutput: undefined,
|
3450
|
storeName: undefined,
|
3451
|
filter: undefined,
|
3452
|
tableName: undefined,
|
3453
|
pagesize: undefined,
|
3454
|
autoLoad: undefined,
|
3455
|
initComponent: function () {
|
3456
|
var me = this;
|
3457
|
var store = me.storeOutput;
|
3458
|
var cols = [];
|
3459
|
var groupField = '';
|
3460
|
var autoLoad = true;
|
3461
|
if (me.autoLoad == false) {
|
3462
|
autoLoad = false;
|
3463
|
}
|
3464
|
if (store.length > 0) {
|
3465
|
Ext.each(store, function (rec) {
|
3466
|
var isHide = false;
|
3467
|
if (rec.IsGrouping == "YES") {
|
3468
|
groupField = rec.FieldName;
|
3469
|
isHide = true;
|
3470
|
}
|
3471
|
var format = rec.FormatRef;
|
3472
|
if (format != null && format != undefined)
|
3473
|
format = format.toLowerCase();
|
3474
|
switch (format) {
|
3475
|
case "file":
|
3476
|
cols.push({
|
3477
|
xtype: 'minovapicturecolumn',
|
3478
|
text: rec.HeaderTitle,
|
3479
|
dataIndex: rec.FieldName,
|
3480
|
hidden: isHide,
|
3481
|
width: 100
|
3482
|
});
|
3483
|
break
|
3484
|
case "date":
|
3485
|
cols.push({
|
3486
|
xtype: 'minovadatecolumn',
|
3487
|
text: rec.HeaderTitle,
|
3488
|
dataIndex: rec.FieldName,
|
3489
|
hidden: isHide,
|
3490
|
width: 100
|
3491
|
});
|
3492
|
break
|
3493
|
case "amount":
|
3494
|
cols.push({
|
3495
|
xtype: 'minovacurrancycolumn',
|
3496
|
text: rec.HeaderTitle,
|
3497
|
align: 'right',
|
3498
|
dataIndex: rec.FieldName,
|
3499
|
width: 150,
|
3500
|
hidden: isHide,
|
3501
|
summaryType: rec.Aggregator,
|
3502
|
summaryRenderer: function (value) {
|
3503
|
return Ext.util.Format.number(value, '0,000.00');
|
3504
|
}
|
3505
|
});
|
3506
|
break
|
3507
|
case "amountencrypt":
|
3508
|
cols.push({
|
3509
|
xtype: 'minovaamountcolumn',
|
3510
|
align: 'right',
|
3511
|
text: rec.HeaderTitle,
|
3512
|
dataIndex: rec.FieldName,
|
3513
|
width: 150,
|
3514
|
hidden: isHide,
|
3515
|
summaryType: rec.Aggregator,
|
3516
|
summaryRenderer: function (value) {
|
3517
|
if (rec.Aggregator == "sum") {
|
3518
|
var str = Ext.StoreManager.lookup("store" + me.tableName);
|
3519
|
var records = str.data.items;
|
3520
|
var total = 0,
|
3521
|
len = records.length;
|
3522
|
if (len > 0) {
|
3523
|
for (var i = 0; i < len; ++i) {
|
3524
|
var nilai = records[i].get(rec.FieldName);
|
3525
|
Ext.Ajax.request({
|
3526
|
async: false,
|
3527
|
method: 'POST',
|
3528
|
url: '/Devt/DecryptData',
|
3529
|
params: {
|
3530
|
dt: nilai
|
3531
|
},
|
3532
|
success: function (response) {
|
3533
|
var results = Ext.decode(response.responseText);
|
3534
|
nilai = results.data;
|
3535
|
total += parseFloat(nilai);
|
3536
|
}
|
3537
|
});
|
3538
|
}
|
3539
|
Ext.util.Format.thousandSeparator = ".";
|
3540
|
return Ext.util.Format.number(total, '0,000');
|
3541
|
}
|
3542
|
return 0;
|
3543
|
} else if (rec.Aggregator == "average") {
|
3544
|
var str = Ext.StoreManager.lookup("store" + me.tableName);
|
3545
|
var records = str.data.items;
|
3546
|
var len = records.length,
|
3547
|
sum = 0;
|
3548
|
if (len > 0) {
|
3549
|
for (var i = 0; i < len; ++i) {
|
3550
|
var nilai = records[i].get(rec.FieldName);
|
3551
|
Ext.Ajax.request({
|
3552
|
async: false,
|
3553
|
method: 'POST',
|
3554
|
url: '/Devt/DecryptData',
|
3555
|
params: {
|
3556
|
dt: nilai
|
3557
|
},
|
3558
|
success: function (response) {
|
3559
|
var results = Ext.decode(response.responseText);
|
3560
|
nilai = results.data;
|
3561
|
sum += parseFloat(nilai);
|
3562
|
}
|
3563
|
});
|
3564
|
}
|
3565
|
var rs = sum / len;
|
3566
|
Ext.util.Format.thousandSeparator = ".";
|
3567
|
return Ext.util.Format.number(rs, '0,000');
|
3568
|
}
|
3569
|
return 0;
|
3570
|
} else {
|
3571
|
return value;
|
3572
|
}
|
3573
|
}
|
3574
|
});
|
3575
|
break
|
3576
|
case "datetime":
|
3577
|
cols.push({
|
3578
|
xtype: 'minovadatetimecolumn',
|
3579
|
text: rec.HeaderTitle,
|
3580
|
dataIndex: rec.FieldName,
|
3581
|
width: 150,
|
3582
|
hidden: isHide
|
3583
|
});
|
3584
|
break
|
3585
|
default:
|
3586
|
if (rec.TableRef != "" && rec.TableRef != null) {
|
3587
|
var valueField = null;
|
3588
|
var displayValue = null;
|
3589
|
Ext.Ajax.request({
|
3590
|
async: false,
|
3591
|
method: 'POST',
|
3592
|
url: '/UserControl/GetStore',
|
3593
|
params: {
|
3594
|
tableName: 'SDATATABLEFIELD',
|
3595
|
param: 'TableName[equal]' + rec.TableRef
|
3596
|
},
|
3597
|
success: function (response) {
|
3598
|
var results = Ext.decode(response.responseText);
|
3599
|
data_ = results.data;
|
3600
|
if (data_.length > 0) {
|
3601
|
valueField_ = $.grep(data_, function (r) {
|
3602
|
return r.ValueField == '1'
|
3603
|
});
|
3604
|
valueField = valueField_[0].FieldName
|
3605
|
displayValue_ = $.grep(data_, function (r) {
|
3606
|
return r.DisplayValue == '1'
|
3607
|
});
|
3608
|
displayValue = displayValue_[0].FieldName
|
3609
|
} else {
|
3610
|
MinovaMessage('Not Null', 'BSNULLCOMBO', rec.TableRef, 'E');
|
3611
|
}
|
3612
|
}
|
3613
|
});
|
3614
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
3615
|
var count_ = 0;
|
3616
|
if (store_) {
|
3617
|
count_ = store_.count();
|
3618
|
}
|
3619
|
if (count_ == 0) {
|
3620
|
Ext.create('Ext.data.Store', {
|
3621
|
storeId: 'store_' + rec.FieldName,
|
3622
|
autoLoad: false,
|
3623
|
proxy: {
|
3624
|
method: 'POST',
|
3625
|
type: 'ajax',
|
3626
|
url: '/UserControl/GetStore',
|
3627
|
extraParams: {
|
3628
|
tableName: rec.TableRef,
|
3629
|
param: ""
|
3630
|
},
|
3631
|
reader: {
|
3632
|
type: 'json',
|
3633
|
root: 'data',
|
3634
|
totalProperty: 'data[0].TotalCount'
|
3635
|
}
|
3636
|
}
|
3637
|
})
|
3638
|
}
|
3639
|
Ext.StoreMgr.lookup('store_' + rec.FieldName).load();
|
3640
|
var stror = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
3641
|
cols.push({
|
3642
|
xtype: 'minovacombocolumn',
|
3643
|
text: rec.HeaderTitle,
|
3644
|
dataIndex: rec.FieldName,
|
3645
|
valueField: valueField,
|
3646
|
displayField: displayValue,
|
3647
|
store: 'store_' + rec.FieldName,
|
3648
|
width: 200,
|
3649
|
hidden: isHide,
|
3650
|
renderer: function (val) {
|
3651
|
var stor = stror;
|
3652
|
if (stor.getCount() === 0) {}
|
3653
|
var index = stor.find(valueField, val);
|
3654
|
if (index != -1) {
|
3655
|
var rec = stor.getAt(index);
|
3656
|
return val + ' - ' + rec.get(displayValue);
|
3657
|
} else {
|
3658
|
return val;
|
3659
|
}
|
3660
|
}
|
3661
|
});
|
3662
|
} else if (rec.FixedValue != "" && rec.FixedValue != null) {
|
3663
|
cols.push({
|
3664
|
xtype: 'minovacombocolumnfixvalue',
|
3665
|
text: rec.HeaderTitle,
|
3666
|
dataIndex: rec.FieldName,
|
3667
|
fixedValue: rec.FixedValue,
|
3668
|
width: 100,
|
3669
|
hidden: isHide
|
3670
|
});
|
3671
|
} else {
|
3672
|
if (rec.DataType == "0") {
|
3673
|
cols.push({
|
3674
|
text: rec.HeaderTitle,
|
3675
|
dataIndex: rec.FieldName,
|
3676
|
width: 150,
|
3677
|
hidden: isHide
|
3678
|
});
|
3679
|
} else {
|
3680
|
cols.push({
|
3681
|
text: rec.HeaderTitle,
|
3682
|
dataIndex: rec.FieldName,
|
3683
|
width: 150,
|
3684
|
hidden: isHide,
|
3685
|
summaryType: rec.Aggregator,
|
3686
|
});
|
3687
|
}
|
3688
|
}
|
3689
|
break
|
3690
|
}
|
3691
|
});
|
3692
|
var featuretype = "summary";
|
3693
|
if (groupField != "") {
|
3694
|
featuretype = "groupingsummary";
|
3695
|
}
|
3696
|
var param = me.filter;
|
3697
|
if (param == undefined) {
|
3698
|
param = ''
|
3699
|
}
|
3700
|
var jsStoreGrid = new Ext.data.Store({
|
3701
|
storeId: me.storeName,
|
3702
|
autoLoad: autoLoad,
|
3703
|
pageSize: me.pagesize,
|
3704
|
proxy: {
|
3705
|
method: 'POST',
|
3706
|
type: 'ajax',
|
3707
|
url: '/UserControl/GetStorePagingAuth',
|
3708
|
extraParams: {
|
3709
|
tableName: me.tableName,
|
3710
|
param: param,
|
3711
|
menuId: MinovaUtil.GetMenuID()
|
3712
|
},
|
3713
|
reader: {
|
3714
|
type: 'json',
|
3715
|
root: 'data',
|
3716
|
totalProperty: 'totalRecords'
|
3717
|
}
|
3718
|
},
|
3719
|
groupField: groupField
|
3720
|
});
|
3721
|
Ext.applyIf(me, {
|
3722
|
autoScroll: true,
|
3723
|
enableLocking: false,
|
3724
|
lockedGridConfig: {
|
3725
|
header: false,
|
3726
|
collapsible: true,
|
3727
|
width: 250,
|
3728
|
forceFit: false,
|
3729
|
listeners: {
|
3730
|
render: function (grid) {
|
3731
|
var pagingToolbar = grid.child('pagingtoolbar');
|
3732
|
if (pagingToolbar) {
|
3733
|
grid.remove(pagingToolbar, true);
|
3734
|
}
|
3735
|
}
|
3736
|
}
|
3737
|
},
|
3738
|
listeners: {
|
3739
|
viewready: function () {
|
3740
|
if (autoLoad == true) {
|
3741
|
this.getStore().loadPage(1);
|
3742
|
}
|
3743
|
},
|
3744
|
beforeedit: function () {
|
3745
|
return false;
|
3746
|
}
|
3747
|
},
|
3748
|
lockedViewConfig: {
|
3749
|
scroll: 'horizontal'
|
3750
|
},
|
3751
|
viewConfig: {
|
3752
|
emptyText: 'No Data Display',
|
3753
|
deferEmptyText: false
|
3754
|
},
|
3755
|
selModel: {},
|
3756
|
columns: cols,
|
3757
|
store: jsStoreGrid,
|
3758
|
features: [{
|
3759
|
ftype: 'groupingsummary'
|
3760
|
}
|
3761
|
],
|
3762
|
plugins: [{
|
3763
|
ptype: 'gridfilters'
|
3764
|
}
|
3765
|
]
|
3766
|
});
|
3767
|
}
|
3768
|
me.callParent(arguments);
|
3769
|
}
|
3770
|
});
|
3771
|
/*MinovaGrouping Grid*/
|
3772
|
Ext.define('MinovaUtil.MinovaES.MinovaGroupingGrid', {
|
3773
|
extend: 'Ext.grid.Panel',
|
3774
|
requires: ['Ext.grid.RowNumberer', 'Ext.grid.feature.Grouping'],
|
3775
|
alias: 'widget.minovagroupinggrid',
|
3776
|
tableName: undefined,
|
3777
|
isLookup: undefined,
|
3778
|
param: undefined,
|
3779
|
pagesize: undefined,
|
3780
|
storeName: undefined,
|
3781
|
layoutType: undefined,
|
3782
|
enableLocking: true,
|
3783
|
autoLoad: undefined,
|
3784
|
multiSelect: undefined,
|
3785
|
getTableName: function () {
|
3786
|
return this.tableName;
|
3787
|
},
|
3788
|
initComponent: function () {
|
3789
|
var me = this;
|
3790
|
var cols_ = [];
|
3791
|
var fieldeditor = {};
|
3792
|
var hasil = null;
|
3793
|
var autoLoad = true;
|
3794
|
var LangID = localStorage.LangId;
|
3795
|
var fielGrid = 'rec.GridView == 1';
|
3796
|
var locking = true;
|
3797
|
var checkSelection = '';
|
3798
|
var widthLock = 250;
|
3799
|
var GroupField = '';
|
3800
|
if (me.multiSelect) {
|
3801
|
locking = false;
|
3802
|
checkSelection = 'checkboxmodel';
|
3803
|
widthLock = 40;
|
3804
|
}
|
3805
|
if (me.autoLoad == false) {
|
3806
|
autoLoad = false;
|
3807
|
}
|
3808
|
parameter = null;
|
3809
|
if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
|
3810
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupGrid='1'";
|
3811
|
fielGrid = 'rec.LookupGrid == 1';
|
3812
|
locking = false;
|
3813
|
} else {
|
3814
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
|
3815
|
};
|
3816
|
|
3817
|
Ext.Ajax.request({
|
3818
|
async: false,
|
3819
|
method: 'POST',
|
3820
|
url: '/UserControl/GetStore',
|
3821
|
params: {
|
3822
|
tableName: 'PDSBS0007',
|
3823
|
param: parameter
|
3824
|
},
|
3825
|
success: function (response) {
|
3826
|
var results = Ext.decode(response.responseText);
|
3827
|
hasil = results.data;
|
3828
|
}
|
3829
|
});
|
3830
|
if (hasil.length > 0) {
|
3831
|
Ext.each(hasil, function (rec) {
|
3832
|
var null_ = null;
|
3833
|
if (rec.SearchFunction == "group") {
|
3834
|
GroupField = rec.FieldName;
|
3835
|
}
|
3836
|
if (rec.IsPrimaryKey == true) {
|
3837
|
null_ = false;
|
3838
|
}
|
3839
|
if (rec.IsRequired == true) {
|
3840
|
null_ = false;
|
3841
|
} else {
|
3842
|
null_ = true;
|
3843
|
}
|
3844
|
if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
|
3845
|
if (rec.LookupGrid == 1) {
|
3846
|
switch (rec.FormatRef) {
|
3847
|
case "date":
|
3848
|
cols_.push({
|
3849
|
xtype: 'minovadatecolumn',
|
3850
|
text: rec.HeaderTitle,
|
3851
|
dataIndex: rec.FieldName,
|
3852
|
width: 100,
|
3853
|
filter: {
|
3854
|
type: 'date',
|
3855
|
itemDefaults: {
|
3856
|
emptyText: 'Search for...'
|
3857
|
}
|
3858
|
}
|
3859
|
});
|
3860
|
break
|
3861
|
case "amount":
|
3862
|
cols_.push({
|
3863
|
xtype: 'minovacurrancycolumn',
|
3864
|
text: rec.HeaderTitle,
|
3865
|
align: 'right',
|
3866
|
dataIndex: rec.FieldName,
|
3867
|
width: 100,
|
3868
|
filter: {
|
3869
|
type: 'number',
|
3870
|
itemDefaults: {
|
3871
|
emptyText: 'Search for...'
|
3872
|
}
|
3873
|
}
|
3874
|
});
|
3875
|
break
|
3876
|
case "amountencrypt":
|
3877
|
cols_.push({
|
3878
|
xtype: 'minovaamountcolumn',
|
3879
|
align: 'right',
|
3880
|
text: rec.HeaderTitle,
|
3881
|
dataIndex: rec.FieldName,
|
3882
|
width: 100,
|
3883
|
filter: {
|
3884
|
type: 'string',
|
3885
|
itemDefaults: {
|
3886
|
emptyText: 'Search for...'
|
3887
|
}
|
3888
|
}
|
3889
|
});
|
3890
|
break
|
3891
|
case "datetime":
|
3892
|
cols_.push({
|
3893
|
xtype: 'minovadatetimecolumn',
|
3894
|
text: rec.HeaderTitle,
|
3895
|
dataIndex: rec.FieldName,
|
3896
|
width: 140,
|
3897
|
filter: {
|
3898
|
type: 'string',
|
3899
|
itemDefaults: {
|
3900
|
emptyText: 'Search for...'
|
3901
|
}
|
3902
|
}
|
3903
|
});
|
3904
|
break
|
3905
|
default:
|
3906
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
3907
|
cols_.push({
|
3908
|
text: rec.HeaderTitle,
|
3909
|
dataIndex: rec.FieldName,
|
3910
|
width: 100,
|
3911
|
filter: {
|
3912
|
type: 'string',
|
3913
|
itemDefaults: {
|
3914
|
emptyText: 'Search for...'
|
3915
|
}
|
3916
|
}
|
3917
|
});
|
3918
|
} else if (rec.TableRef != "") {
|
3919
|
if (rec.TableRef != null) {
|
3920
|
var valueField = null;
|
3921
|
var displayValue = null;
|
3922
|
Ext.Ajax.request({
|
3923
|
async: false,
|
3924
|
method: 'POST',
|
3925
|
url: '/UserControl/GetStore',
|
3926
|
params: {
|
3927
|
tableName: 'SDATATABLEFIELD',
|
3928
|
param: 'TableName[equal]' + rec.TableRef
|
3929
|
},
|
3930
|
success: function (response) {
|
3931
|
var results = Ext.decode(response.responseText);
|
3932
|
data_ = results.data;
|
3933
|
if (data_ != undefined) {
|
3934
|
valueField_ = $.grep(data_, function (r) {
|
3935
|
return r.ValueField == '1'
|
3936
|
});
|
3937
|
valueField = valueField_[0].FieldName
|
3938
|
displayValue_ = $.grep(data_, function (r) {
|
3939
|
return r.DisplayValue == '1'
|
3940
|
});
|
3941
|
displayValue = displayValue_[0].FieldName
|
3942
|
}
|
3943
|
}
|
3944
|
});
|
3945
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
3946
|
var count_ = 0;
|
3947
|
if (store_) {
|
3948
|
count_ = store_.count();
|
3949
|
}
|
3950
|
if (count_ == 0) {
|
3951
|
Ext.create('Ext.data.Store', {
|
3952
|
storeId: 'store_' + rec.FieldName,
|
3953
|
//autoLoad: true,
|
3954
|
proxy: {
|
3955
|
method: 'POST',
|
3956
|
type: 'ajax',
|
3957
|
url: '/UserControl/GetStore',
|
3958
|
extraParams: {
|
3959
|
tableName: rec.TableRef,
|
3960
|
param: rec.ParamCombo
|
3961
|
},
|
3962
|
reader: {
|
3963
|
type: 'json',
|
3964
|
root: 'data',
|
3965
|
totalProperty: 'data[0].TotalCount'
|
3966
|
}
|
3967
|
}
|
3968
|
})
|
3969
|
}
|
3970
|
cols_.push({
|
3971
|
xtype: 'minovacombocolumn',
|
3972
|
text: rec.HeaderTitle,
|
3973
|
dataIndex: rec.FieldName,
|
3974
|
valueField: valueField,
|
3975
|
displayField: displayValue,
|
3976
|
store: 'store_' + rec.FieldName,
|
3977
|
filter: {
|
3978
|
type: 'list',
|
3979
|
itemDefaults: {
|
3980
|
emptyText: 'Search for...'
|
3981
|
}
|
3982
|
}
|
3983
|
});
|
3984
|
}
|
3985
|
} else {
|
3986
|
cols_.push({
|
3987
|
text: rec.HeaderTitle,
|
3988
|
dataIndex: rec.FieldName,
|
3989
|
filter: {
|
3990
|
itemDefaults: {
|
3991
|
emptyText: 'Search for...'
|
3992
|
}
|
3993
|
}
|
3994
|
});
|
3995
|
}
|
3996
|
break
|
3997
|
}
|
3998
|
} else {
|
3999
|
cols_.push({
|
4000
|
text: rec.HeaderTitle,
|
4001
|
dataIndex: rec.FieldName,
|
4002
|
hidden: true,
|
4003
|
filter: {
|
4004
|
itemDefaults: {
|
4005
|
emptyText: 'Search for...'
|
4006
|
}
|
4007
|
}
|
4008
|
});
|
4009
|
}
|
4010
|
|
4011
|
} else {
|
4012
|
if (rec.GridView == 1) {
|
4013
|
switch (rec.FormatRef) {
|
4014
|
case "date":
|
4015
|
cols_.push({
|
4016
|
xtype: 'minovadatecolumn',
|
4017
|
text: rec.HeaderTitle,
|
4018
|
dataIndex: rec.FieldName,
|
4019
|
width: 100,
|
4020
|
flex: 1,
|
4021
|
filter: {
|
4022
|
type: 'date',
|
4023
|
itemDefaults: {
|
4024
|
emptyText: 'Search for...'
|
4025
|
}
|
4026
|
}
|
4027
|
});
|
4028
|
break
|
4029
|
case "amountencrypt":
|
4030
|
cols_.push({
|
4031
|
xtype: 'minovaamountcolumn',
|
4032
|
align: 'right',
|
4033
|
text: rec.HeaderTitle,
|
4034
|
dataIndex: rec.FieldName,
|
4035
|
width: 100,
|
4036
|
flex: 1,
|
4037
|
filter: {
|
4038
|
type: 'string',
|
4039
|
itemDefaults: {
|
4040
|
emptyText: 'Search for...'
|
4041
|
}
|
4042
|
}
|
4043
|
});
|
4044
|
break
|
4045
|
case "amount":
|
4046
|
cols_.push({
|
4047
|
xtype: 'minovacurrancycolumn',
|
4048
|
text: rec.HeaderTitle,
|
4049
|
align: 'right',
|
4050
|
dataIndex: rec.FieldName,
|
4051
|
width: 100,
|
4052
|
flex: 1,
|
4053
|
filter: {
|
4054
|
type: 'number',
|
4055
|
itemDefaults: {
|
4056
|
emptyText: 'Search for...'
|
4057
|
}
|
4058
|
}
|
4059
|
});
|
4060
|
break
|
4061
|
case "datetime":
|
4062
|
cols_.push({
|
4063
|
xtype: 'minovadatetimecolumn',
|
4064
|
text: rec.HeaderTitle,
|
4065
|
dataIndex: rec.FieldName,
|
4066
|
width: 140,
|
4067
|
flex: 1,
|
4068
|
filter: {
|
4069
|
type: 'string',
|
4070
|
itemDefaults: {
|
4071
|
emptyText: 'Search for...'
|
4072
|
}
|
4073
|
}
|
4074
|
});
|
4075
|
break
|
4076
|
default:
|
4077
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
4078
|
cols_.push({
|
4079
|
text: rec.HeaderTitle,
|
4080
|
dataIndex: rec.FieldName,
|
4081
|
width: 100,
|
4082
|
flex: 1,
|
4083
|
filter: {
|
4084
|
type: 'string',
|
4085
|
itemDefaults: {
|
4086
|
emptyText: 'Search for...'
|
4087
|
}
|
4088
|
}
|
4089
|
});
|
4090
|
} else if (rec.TableRef != "") {
|
4091
|
if (rec.TableRef != null) {
|
4092
|
var valueField = null;
|
4093
|
var displayValue = null;
|
4094
|
Ext.Ajax.request({
|
4095
|
async: false,
|
4096
|
method: 'POST',
|
4097
|
url: '/UserControl/GetStore',
|
4098
|
params: {
|
4099
|
tableName: 'SDATATABLEFIELD',
|
4100
|
param: 'TableName[equal]' + rec.TableRef
|
4101
|
},
|
4102
|
success: function (response) {
|
4103
|
var results = Ext.decode(response.responseText);
|
4104
|
data_ = results.data;
|
4105
|
if (data_ != undefined) {
|
4106
|
valueField_ = $.grep(data_, function (r) {
|
4107
|
return r.ValueField == '1'
|
4108
|
});
|
4109
|
valueField = valueField_[0].FieldName
|
4110
|
displayValue_ = $.grep(data_, function (r) {
|
4111
|
return r.DisplayValue == '1'
|
4112
|
});
|
4113
|
displayValue = displayValue_[0].FieldName
|
4114
|
}
|
4115
|
}
|
4116
|
});
|
4117
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
4118
|
var count_ = 0;
|
4119
|
if (store_) {
|
4120
|
count_ = store_.count();
|
4121
|
}
|
4122
|
if (count_ == 0) {
|
4123
|
Ext.create('Ext.data.Store', {
|
4124
|
storeId: 'store_' + rec.FieldName,
|
4125
|
autoLoad: false,
|
4126
|
proxy: {
|
4127
|
method: 'POST',
|
4128
|
type: 'ajax',
|
4129
|
url: '/UserControl/GetStore',
|
4130
|
extraParams: {
|
4131
|
tableName: rec.TableRef,
|
4132
|
param: rec.ParamCombo
|
4133
|
},
|
4134
|
reader: {
|
4135
|
type: 'json',
|
4136
|
root: 'data',
|
4137
|
totalProperty: 'data[0].TotalCount'
|
4138
|
}
|
4139
|
}
|
4140
|
})
|
4141
|
}
|
4142
|
cols_.push({
|
4143
|
xtype: 'minovacombocolumn',
|
4144
|
text: rec.HeaderTitle,
|
4145
|
dataIndex: rec.FieldName,
|
4146
|
valueField: valueField,
|
4147
|
displayField: displayValue,
|
4148
|
store: 'store_' + rec.FieldName,
|
4149
|
flex: 1,
|
4150
|
filter: {
|
4151
|
type: 'list',
|
4152
|
itemDefaults: {
|
4153
|
emptyText: 'Search for...'
|
4154
|
}
|
4155
|
}
|
4156
|
});
|
4157
|
}
|
4158
|
|
4159
|
} else {
|
4160
|
cols_.push({
|
4161
|
text: rec.HeaderTitle,
|
4162
|
dataIndex: rec.FieldName,
|
4163
|
flex: 1,
|
4164
|
filter: {
|
4165
|
itemDefaults: {
|
4166
|
emptyText: 'Search for...'
|
4167
|
}
|
4168
|
}
|
4169
|
});
|
4170
|
}
|
4171
|
break
|
4172
|
}
|
4173
|
} else {
|
4174
|
cols_.push({
|
4175
|
text: rec.HeaderTitle,
|
4176
|
dataIndex: rec.FieldName,
|
4177
|
hidden: true,
|
4178
|
filter: {
|
4179
|
itemDefaults: {
|
4180
|
emptyText: 'Search for...'
|
4181
|
}
|
4182
|
}
|
4183
|
});
|
4184
|
}
|
4185
|
|
4186
|
}
|
4187
|
});
|
4188
|
}
|
4189
|
var param_ = me.param;
|
4190
|
if (param_ == undefined) {
|
4191
|
param_ = ''
|
4192
|
}
|
4193
|
var jsStoreGrid = new Ext.data.Store({
|
4194
|
storeId: me.storeName,
|
4195
|
autoLoad: autoLoad,
|
4196
|
pageSize: me.pagesize,
|
4197
|
proxy: {
|
4198
|
method: 'POST',
|
4199
|
type: 'ajax',
|
4200
|
url: '/UserControl/GetStorePagingAuth',
|
4201
|
extraParams: {
|
4202
|
tableName: me.tableName,
|
4203
|
param: param_,
|
4204
|
menuId: MinovaUtil.GetMenuID()
|
4205
|
},
|
4206
|
reader: {
|
4207
|
type: 'json',
|
4208
|
root: 'data',
|
4209
|
totalProperty: 'totalRecords'
|
4210
|
}
|
4211
|
},
|
4212
|
groupField: GroupField,
|
4213
|
//sorters: ['tipe','cuisine','name'],
|
4214
|
});
|
4215
|
Ext.applyIf(me, {
|
4216
|
autoScroll: true,
|
4217
|
enableLocking: locking,
|
4218
|
lockedGridConfig: {
|
4219
|
header: false,
|
4220
|
collapsible: true,
|
4221
|
width: widthLock,
|
4222
|
forceFit: locking,
|
4223
|
listeners: {
|
4224
|
render: function (grid) {
|
4225
|
var pagingToolbar = grid.child('pagingtoolbar');
|
4226
|
if (pagingToolbar) {
|
4227
|
grid.remove(pagingToolbar, true);
|
4228
|
}
|
4229
|
}
|
4230
|
}
|
4231
|
},
|
4232
|
listeners: {
|
4233
|
viewready: function () {
|
4234
|
if (autoLoad == true) {
|
4235
|
this.getStore().loadPage(1);
|
4236
|
}
|
4237
|
|
4238
|
},
|
4239
|
beforeedit: function () {
|
4240
|
return false;
|
4241
|
}
|
4242
|
},
|
4243
|
lockedViewConfig: {
|
4244
|
scroll: 'horizontal'
|
4245
|
},
|
4246
|
viewConfig: {
|
4247
|
emptyText: 'No Data Display',
|
4248
|
deferEmptyText: false,
|
4249
|
listeners: {
|
4250
|
refresh: function (dataview) {
|
4251
|
Ext.each(dataview.panel.columns, function (column) {
|
4252
|
if (column.autoSizeColumn == false)
|
4253
|
column.autoSizeColumn = true;
|
4254
|
column.autoSize();
|
4255
|
})
|
4256
|
}
|
4257
|
}
|
4258
|
},
|
4259
|
selModel: {},
|
4260
|
selType: checkSelection,
|
4261
|
columns: cols_,
|
4262
|
store: jsStoreGrid,
|
4263
|
features: [{
|
4264
|
ftype: 'grouping'
|
4265
|
}
|
4266
|
],
|
4267
|
plugins: [{
|
4268
|
ptype: 'gridfilters'
|
4269
|
}
|
4270
|
]
|
4271
|
});
|
4272
|
me.callParent(arguments);
|
4273
|
}
|
4274
|
});
|
4275
|
/*Form ESS Generator*/
|
4276
|
Ext.define('MinovaUtil.MinovaES.MinovaWorkflowForm', {
|
4277
|
extend: 'Ext.form.Panel',
|
4278
|
alias: ['widget.MinovaWorkflowForm', 'widget.minovaworkflowform', 'widget.workflowform'],
|
4279
|
formname: this.name,
|
4280
|
bizprocid: undefined,
|
4281
|
taskid: undefined,
|
4282
|
tableName: undefined,
|
4283
|
titleform: undefined,
|
4284
|
resizable: true,
|
4285
|
border: false,
|
4286
|
autoScroll: true,
|
4287
|
minHeight: 20,
|
4288
|
layout: 'column',
|
4289
|
listeners: {
|
4290
|
render: function () {
|
4291
|
if (this.titleform != undefined) {
|
4292
|
this.setTitle(this.titleform);
|
4293
|
}
|
4294
|
},
|
4295
|
},
|
4296
|
defaults: {
|
4297
|
layout: 'form',
|
4298
|
xtype: 'container',
|
4299
|
defaultType: 'textfield',
|
4300
|
style: 'width: 50%',
|
4301
|
},
|
4302
|
initComponent: function () {
|
4303
|
var col1 = [];
|
4304
|
var col2 = [];
|
4305
|
var me = this;
|
4306
|
var LangID = localStorage.LangId;
|
4307
|
var parameter = "LangID='" + LangID + "',BizProcessID='" + me.bizprocid + "',TaskID='" + me.taskid + "',TableName='" + me.tableName + "'";
|
4308
|
var formname_ = me.name;
|
4309
|
var nameTable_ = me.tableName;
|
4310
|
Ext.Ajax.request({
|
4311
|
async: false,
|
4312
|
method: 'POST',
|
4313
|
url: '/UserControl/GetStore',
|
4314
|
params: {
|
4315
|
tableName: 'PDSWFSTRUCTUREFIELD',
|
4316
|
param: parameter
|
4317
|
},
|
4318
|
success: function (response) {
|
4319
|
var results = Ext.decode(response.responseText);
|
4320
|
hasil = results.data;
|
4321
|
}
|
4322
|
});
|
4323
|
if (hasil.length > 0) {
|
4324
|
Ext.each(hasil, function (rec) {
|
4325
|
var formfield = undefined;
|
4326
|
var readonly = false;
|
4327
|
var ishidden = false;
|
4328
|
var allowblank = true;
|
4329
|
var startDt = null;
|
4330
|
var endDt = null;
|
4331
|
if (rec.FieldName == 'StartDate' || rec.FieldName == 'EndDate') {
|
4332
|
startDt = 'StartDate';
|
4333
|
endDt = 'EndDate';
|
4334
|
}
|
4335
|
if (rec.IsReadOnly == '1') {
|
4336
|
readonly = true;
|
4337
|
}
|
4338
|
if (rec.IsRequired == '1') {
|
4339
|
allowblank = false;
|
4340
|
}
|
4341
|
if (rec.IsVisible == '0') {
|
4342
|
ishidden = true;
|
4343
|
}
|
4344
|
if (rec.SearchType == "") //textfield
|
4345
|
{
|
4346
|
switch (rec.FormatRef) {
|
4347
|
case "date":
|
4348
|
if (rec.FieldName == 'StartDate' || rec.FieldName == 'EndDate') {
|
4349
|
formfield = new Ext.form.DateField({
|
4350
|
allowBlank: allowblank,
|
4351
|
fieldLabel: rec.ScreenCaption,
|
4352
|
readOnly: readonly,
|
4353
|
msgTarget: 'side',
|
4354
|
labelCls: 'label-minova',
|
4355
|
labelWidth: 150,
|
4356
|
hidden: ishidden,
|
4357
|
name: rec.FieldName,
|
4358
|
submitFormat: 'Ymd',
|
4359
|
value: rec.DefaultValue,
|
4360
|
anchor: '100%',
|
4361
|
vtype: 'daterange',
|
4362
|
start: startDt,
|
4363
|
end: endDt,
|
4364
|
formname: formname_,
|
4365
|
nameTable: nameTable_,
|
4366
|
hideMode: 'visibility',
|
4367
|
listeners: {
|
4368
|
change: function (val) {
|
4369
|
var _label = val.name;
|
4370
|
var _form = val.formname;
|
4371
|
var _Value = val.getValue();
|
4372
|
var target = rec.TriggerCombo;
|
4373
|
var custumFunc = rec.SelectFunction;
|
4374
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
4375
|
Ext.Ajax.request({
|
4376
|
async: false,
|
4377
|
method: 'POST',
|
4378
|
url: '/UserControl/GetStore',
|
4379
|
params: {
|
4380
|
tableName: 'PCMFUNC',
|
4381
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
4382
|
},
|
4383
|
success: function (response) {
|
4384
|
var results = Ext.decode(response.responseText);
|
4385
|
data_ = results.data[0];
|
4386
|
if (data_ != undefined) {
|
4387
|
custumFunc = data_.FunctionCode;
|
4388
|
}
|
4389
|
}
|
4390
|
});
|
4391
|
}
|
4392
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4393
|
if (frm) {
|
4394
|
if (custumFunc) {
|
4395
|
eval(custumFunc)
|
4396
|
}
|
4397
|
}
|
4398
|
}
|
4399
|
}
|
4400
|
});
|
4401
|
} else {
|
4402
|
formfield = new Ext.form.DateField({
|
4403
|
allowBlank: allowblank,
|
4404
|
fieldLabel: rec.ScreenCaption,
|
4405
|
readOnly: readonly,
|
4406
|
msgTarget: 'side',
|
4407
|
labelCls: 'label-minova',
|
4408
|
labelWidth: 150,
|
4409
|
hidden: ishidden,
|
4410
|
name: rec.FieldName,
|
4411
|
submitFormat: 'Ymd',
|
4412
|
value: rec.DefaultValue,
|
4413
|
anchor: '100%',
|
4414
|
formname: formname_,
|
4415
|
nameTable: nameTable_,
|
4416
|
hideMode: 'visibility',
|
4417
|
listeners: {
|
4418
|
change: function (val) {
|
4419
|
var _label = val.name;
|
4420
|
var _form = val.formname;
|
4421
|
var _Value = val.getValue();
|
4422
|
var target = rec.TriggerCombo;
|
4423
|
var custumFunc = rec.SelectFunction;
|
4424
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
4425
|
Ext.Ajax.request({
|
4426
|
async: false,
|
4427
|
method: 'POST',
|
4428
|
url: '/UserControl/GetStore',
|
4429
|
params: {
|
4430
|
tableName: 'PCMFUNC',
|
4431
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
4432
|
},
|
4433
|
success: function (response) {
|
4434
|
var results = Ext.decode(response.responseText);
|
4435
|
data_ = results.data[0];
|
4436
|
if (data_ != undefined) {
|
4437
|
custumFunc = data_.FunctionCode;
|
4438
|
}
|
4439
|
}
|
4440
|
});
|
4441
|
}
|
4442
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4443
|
if (frm) {
|
4444
|
if (custumFunc) {
|
4445
|
eval(custumFunc)
|
4446
|
}
|
4447
|
}
|
4448
|
}
|
4449
|
}
|
4450
|
});
|
4451
|
}
|
4452
|
break;
|
4453
|
case "time":
|
4454
|
formfield = new Ext.form.TimeField({
|
4455
|
allowBlank: allowblank,
|
4456
|
fieldLabel: rec.ScreenCaption,
|
4457
|
readOnly: readonly,
|
4458
|
labelCls: 'label-minova',
|
4459
|
labelWidth: 150,
|
4460
|
hidden: ishidden,
|
4461
|
name: rec.FieldName,
|
4462
|
msgTarget: 'side',
|
4463
|
format: 'Hi',
|
4464
|
submitFormat: 'Hi',
|
4465
|
increment: 5,
|
4466
|
value: rec.DefaultValue,
|
4467
|
anchor: '100%',
|
4468
|
formname: formname_,
|
4469
|
nameTable: nameTable_,
|
4470
|
listeners: {
|
4471
|
change: function (val) {
|
4472
|
var _label = val.name;
|
4473
|
var _form = val.formname;
|
4474
|
var _Value = val.getValue();
|
4475
|
var target = rec.TriggerCombo;
|
4476
|
var custumFunc = rec.SelectFunction;
|
4477
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
4478
|
Ext.Ajax.request({
|
4479
|
async: false,
|
4480
|
method: 'POST',
|
4481
|
url: '/UserControl/GetStore',
|
4482
|
params: {
|
4483
|
tableName: 'PCMFUNC',
|
4484
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
4485
|
},
|
4486
|
success: function (response) {
|
4487
|
var results = Ext.decode(response.responseText);
|
4488
|
data_ = results.data[0];
|
4489
|
if (data_ != undefined) {
|
4490
|
custumFunc = data_.FunctionCode;
|
4491
|
}
|
4492
|
}
|
4493
|
});
|
4494
|
}
|
4495
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4496
|
if (frm) {
|
4497
|
if (custumFunc) {
|
4498
|
eval(custumFunc)
|
4499
|
}
|
4500
|
}
|
4501
|
}
|
4502
|
}
|
4503
|
});
|
4504
|
break;
|
4505
|
case "amount":
|
4506
|
formfield = new Ext.form.TextField({
|
4507
|
allowBlank: allowblank,
|
4508
|
fieldLabel: rec.ScreenCaption,
|
4509
|
readOnly: readonly,
|
4510
|
labelCls: 'label-minova',
|
4511
|
labelWidth: 150,
|
4512
|
hidden: ishidden,
|
4513
|
name: rec.FieldName,
|
4514
|
msgTarget: 'side',
|
4515
|
value: rec.DefaultValue,
|
4516
|
maxLength: rec.Length,
|
4517
|
anchor: '100%',
|
4518
|
formname: formname_,
|
4519
|
nameTable: nameTable_,
|
4520
|
fieldStyle: 'text-align:right;',
|
4521
|
listeners: {
|
4522
|
change: function (val) {
|
4523
|
var _label = val.name;
|
4524
|
var _form = val.formname;
|
4525
|
var _Value = val.getValue();
|
4526
|
var target = rec.TriggerCombo;
|
4527
|
var custumFunc = rec.SelectFunction;
|
4528
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
4529
|
Ext.Ajax.request({
|
4530
|
async: false,
|
4531
|
method: 'POST',
|
4532
|
url: '/UserControl/GetStore',
|
4533
|
params: {
|
4534
|
tableName: 'PCMFUNC',
|
4535
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
4536
|
},
|
4537
|
success: function (response) {
|
4538
|
var results = Ext.decode(response.responseText);
|
4539
|
data_ = results.data[0];
|
4540
|
if (data_ != undefined) {
|
4541
|
custumFunc = data_.FunctionCode;
|
4542
|
}
|
4543
|
}
|
4544
|
});
|
4545
|
}
|
4546
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4547
|
if (frm) {
|
4548
|
if (custumFunc) {
|
4549
|
eval(custumFunc)
|
4550
|
}
|
4551
|
}
|
4552
|
}
|
4553
|
}
|
4554
|
});
|
4555
|
break;
|
4556
|
case "file":
|
4557
|
formfield = new MinovaUtil.MinovaES.UploadFile({
|
4558
|
allowBlank: allowblank,
|
4559
|
fieldLabel: rec.ScreenCaption,
|
4560
|
readOnly: readonly,
|
4561
|
readOnlyCls: 'minova-readonly',
|
4562
|
hidden: ishidden,
|
4563
|
labelCls: 'label-minova',
|
4564
|
name: rec.FieldName,
|
4565
|
msgTarget: 'side',
|
4566
|
fieldname: rec.FieldName,
|
4567
|
IsPrimaryKey: rec.IsPrimaryKey,
|
4568
|
tableName: rec.TableRef,
|
4569
|
triggerCls: 'x-form-search-trigger',
|
4570
|
formtarget: me.formname,
|
4571
|
anchor: '100%',
|
4572
|
formname: formname_,
|
4573
|
nameTable: nameTable_,
|
4574
|
listeners: {
|
4575
|
change: function (val) {
|
4576
|
var _label = val.name;
|
4577
|
var _form = val.formname;
|
4578
|
var _Value = val.getValue();
|
4579
|
var target = rec.TriggerCombo;
|
4580
|
var custumFunc = rec.SelectFunction;
|
4581
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
4582
|
Ext.Ajax.request({
|
4583
|
async: false,
|
4584
|
method: 'POST',
|
4585
|
url: '/UserControl/GetStore',
|
4586
|
params: {
|
4587
|
tableName: 'PCMFUNC',
|
4588
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
4589
|
},
|
4590
|
success: function (response) {
|
4591
|
var results = Ext.decode(response.responseText);
|
4592
|
data_ = results.data[0];
|
4593
|
if (data_ != undefined) {
|
4594
|
custumFunc = data_.FunctionCode;
|
4595
|
}
|
4596
|
}
|
4597
|
});
|
4598
|
}
|
4599
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4600
|
if (frm) {
|
4601
|
if (target) {
|
4602
|
var f = frm.getForm().findField(target)
|
4603
|
_store = f.getStore();
|
4604
|
var _tbl = _store.proxy.extraParams.tableName;
|
4605
|
var oldParam = _store.proxy.extraParams.param;
|
4606
|
_store.proxy.extraParams = {
|
4607
|
tableName: _tbl,
|
4608
|
param: _label + '[=]' + _Value
|
4609
|
};
|
4610
|
_store.load();
|
4611
|
}
|
4612
|
if (custumFunc) {
|
4613
|
eval(custumFunc)
|
4614
|
}
|
4615
|
}
|
4616
|
}
|
4617
|
}
|
4618
|
});
|
4619
|
break;
|
4620
|
default:
|
4621
|
if (rec.DataType == 0) {
|
4622
|
if (rec.Length > 250) {
|
4623
|
formfield = new Ext.form.TextArea({
|
4624
|
allowBlank: allowblank,
|
4625
|
fieldLabel: rec.ScreenCaption,
|
4626
|
readOnly: readonly,
|
4627
|
labelCls: 'label-minova',
|
4628
|
labelWidth: 150,
|
4629
|
hidden: ishidden,
|
4630
|
name: rec.FieldName,
|
4631
|
msgTarget: 'side',
|
4632
|
value: rec.DefaultValue,
|
4633
|
maxLength: rec.Length,
|
4634
|
anchor: '100%',
|
4635
|
formname: formname_,
|
4636
|
nameTable: nameTable_,
|
4637
|
listeners: {
|
4638
|
change: function (val) {
|
4639
|
var _label = val.name;
|
4640
|
var _form = val.formname;
|
4641
|
var _Value = val.getValue();
|
4642
|
var target = rec.TriggerCombo;
|
4643
|
var custumFunc = rec.SelectFunction;
|
4644
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
4645
|
Ext.Ajax.request({
|
4646
|
async: false,
|
4647
|
method: 'POST',
|
4648
|
url: '/UserControl/GetStore',
|
4649
|
params: {
|
4650
|
tableName: 'PCMFUNC',
|
4651
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
4652
|
},
|
4653
|
success: function (response) {
|
4654
|
var results = Ext.decode(response.responseText);
|
4655
|
data_ = results.data[0];
|
4656
|
if (data_ != undefined) {
|
4657
|
custumFunc = data_.FunctionCode;
|
4658
|
}
|
4659
|
}
|
4660
|
});
|
4661
|
}
|
4662
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4663
|
if (frm) {
|
4664
|
if (custumFunc) {
|
4665
|
eval(custumFunc)
|
4666
|
}
|
4667
|
}
|
4668
|
}
|
4669
|
}
|
4670
|
});
|
4671
|
} else {
|
4672
|
if (rec.FixedValue != '') {
|
4673
|
var storeData = [];
|
4674
|
var str = rec.FixedValue;
|
4675
|
var hasil = str.split('||');
|
4676
|
hasil.forEach(function (h) {
|
4677
|
store_ = h.split('=')
|
4678
|
storeData.push({
|
4679
|
code: store_[0],
|
4680
|
desc: store_[1],
|
4681
|
});
|
4682
|
});
|
4683
|
formfield = new Ext.form.ComboBox({
|
4684
|
allowBlank: allowblank,
|
4685
|
fieldLabel: rec.ScreenCaption,
|
4686
|
forceSelection: true,
|
4687
|
readOnly: readonly,
|
4688
|
labelCls: 'label-minova',
|
4689
|
labelWidth: 150,
|
4690
|
hidden: ishidden,
|
4691
|
name: rec.FieldName,
|
4692
|
msgTarget: 'side',
|
4693
|
value: rec.DefaultValue,
|
4694
|
anchor: '100%',
|
4695
|
formname: formname_,
|
4696
|
nameTable: nameTable_,
|
4697
|
formtarget: me.formname,
|
4698
|
store: Ext.create('Ext.data.Store', {
|
4699
|
storeId: 'store' + rec.FieldName,
|
4700
|
autoLoad: true,
|
4701
|
data: storeData
|
4702
|
|
4703
|
}),
|
4704
|
listeners: {
|
4705
|
change: function (val) {
|
4706
|
var _label = val.name;
|
4707
|
var _form = val.formtarget;
|
4708
|
var _Value = val.getValue();
|
4709
|
var target = rec.TriggerCombo;
|
4710
|
var custumFunc = rec.SelectFunction;
|
4711
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4712
|
if (frm) {
|
4713
|
if (target) {
|
4714
|
var f = frm.getForm().findField(target)
|
4715
|
_store = f.getStore();
|
4716
|
var _tbl = _store.proxy.extraParams.tableName;
|
4717
|
var oldParam = _store.proxy.extraParams.param;
|
4718
|
_store.proxy.extraParams = {
|
4719
|
tableName: _tbl,
|
4720
|
param: _label + '[=]' + _Value
|
4721
|
};
|
4722
|
_store.load();
|
4723
|
}
|
4724
|
if (custumFunc) {
|
4725
|
eval(custumFunc)
|
4726
|
}
|
4727
|
}
|
4728
|
}
|
4729
|
},
|
4730
|
queryMode: 'local',
|
4731
|
valueField: 'code',
|
4732
|
displayField: 'desc',
|
4733
|
});
|
4734
|
} else {
|
4735
|
formfield = new Ext.form.TextField({
|
4736
|
allowBlank: allowblank,
|
4737
|
fieldLabel: rec.ScreenCaption,
|
4738
|
readOnly: readonly,
|
4739
|
labelCls: 'label-minova',
|
4740
|
labelWidth: 150,
|
4741
|
hidden: ishidden,
|
4742
|
name: rec.FieldName,
|
4743
|
msgTarget: 'side',
|
4744
|
value: rec.DefaultValue,
|
4745
|
maxLength: rec.Length,
|
4746
|
anchor: '100%',
|
4747
|
formname: formname_,
|
4748
|
nameTable: nameTable_,
|
4749
|
listeners: {
|
4750
|
change: function (val) {
|
4751
|
var _label = val.name;
|
4752
|
var _form = val.formname;
|
4753
|
var _Value = val.getValue();
|
4754
|
var target = rec.TriggerCombo;
|
4755
|
var custumFunc = rec.SelectFunction;
|
4756
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
4757
|
Ext.Ajax.request({
|
4758
|
async: false,
|
4759
|
method: 'POST',
|
4760
|
url: '/UserControl/GetStore',
|
4761
|
params: {
|
4762
|
tableName: 'PCMFUNC',
|
4763
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
4764
|
},
|
4765
|
success: function (response) {
|
4766
|
var results = Ext.decode(response.responseText);
|
4767
|
data_ = results.data[0];
|
4768
|
if (data_ != undefined) {
|
4769
|
custumFunc = data_.FunctionCode;
|
4770
|
}
|
4771
|
}
|
4772
|
});
|
4773
|
}
|
4774
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4775
|
if (frm) {
|
4776
|
if (custumFunc) {
|
4777
|
eval(custumFunc)
|
4778
|
}
|
4779
|
}
|
4780
|
}
|
4781
|
}
|
4782
|
});
|
4783
|
}
|
4784
|
}
|
4785
|
} else if (rec.DataType == 1 || rec.DataType == 2) {
|
4786
|
formfield = new MinovaUtil.MinovaES.MinovaNumberField({
|
4787
|
allowBlank: allowblank,
|
4788
|
fieldLabel: rec.ScreenCaption,
|
4789
|
readOnly: readonly,
|
4790
|
labelCls: 'label-minova',
|
4791
|
labelWidth: 150,
|
4792
|
msgTarget: 'side',
|
4793
|
hidden: ishidden,
|
4794
|
name: rec.FieldName,
|
4795
|
value: rec.DefaultValue,
|
4796
|
maxLength: rec.Length,
|
4797
|
anchor: '100%',
|
4798
|
formname: formname_,
|
4799
|
nameTable: nameTable_,
|
4800
|
fieldStyle: 'text-align:right;',
|
4801
|
listeners: {
|
4802
|
change: function (val) {
|
4803
|
var _label = val.name;
|
4804
|
var _form = val.formname;
|
4805
|
var _Value = val.getValue();
|
4806
|
var target = rec.TriggerCombo;
|
4807
|
var custumFunc = rec.SelectFunction;
|
4808
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
4809
|
Ext.Ajax.request({
|
4810
|
async: false,
|
4811
|
method: 'POST',
|
4812
|
url: '/UserControl/GetStore',
|
4813
|
params: {
|
4814
|
tableName: 'PCMFUNC',
|
4815
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
4816
|
},
|
4817
|
success: function (response) {
|
4818
|
var results = Ext.decode(response.responseText);
|
4819
|
data_ = results.data[0];
|
4820
|
if (data_ != undefined) {
|
4821
|
custumFunc = data_.FunctionCode;
|
4822
|
}
|
4823
|
}
|
4824
|
});
|
4825
|
}
|
4826
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4827
|
if (frm) {
|
4828
|
if (target) {
|
4829
|
var f = frm.getForm().findField(target)
|
4830
|
_store = f.getStore();
|
4831
|
var _tbl = _store.proxy.extraParams.tableName;
|
4832
|
var oldParam = _store.proxy.extraParams.param;
|
4833
|
_store.proxy.extraParams = {
|
4834
|
tableName: _tbl,
|
4835
|
param: _label + '[=]' + _Value
|
4836
|
};
|
4837
|
_store.load();
|
4838
|
}
|
4839
|
if (custumFunc) {
|
4840
|
eval(custumFunc)
|
4841
|
}
|
4842
|
}
|
4843
|
}
|
4844
|
}
|
4845
|
});
|
4846
|
} else if (rec.DataType == 3) {
|
4847
|
formfield = new Ext.form.TextField({
|
4848
|
allowBlank: allowblank,
|
4849
|
fieldLabel: rec.ScreenCaption,
|
4850
|
readOnly: readonly,
|
4851
|
labelCls: 'label-minova',
|
4852
|
labelWidth: 150,
|
4853
|
msgTarget: 'side',
|
4854
|
hidden: ishidden,
|
4855
|
name: rec.FieldName,
|
4856
|
value: rec.DefaultValue,
|
4857
|
maxLength: rec.Length,
|
4858
|
precision: rec.Prec,
|
4859
|
anchor: '100%',
|
4860
|
formname: formname_,
|
4861
|
nameTable: nameTable_,
|
4862
|
fieldStyle: 'text-align:right;',
|
4863
|
maskRe: '^[0-9]+(\.[0-9]{1,2})?$',
|
4864
|
listeners: {
|
4865
|
change: function (val) {
|
4866
|
var _label = val.name;
|
4867
|
var _form = val.formname;
|
4868
|
var _Value = val.getValue();
|
4869
|
var target = rec.TriggerCombo;
|
4870
|
var custumFunc = rec.SelectFunction;
|
4871
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
4872
|
Ext.Ajax.request({
|
4873
|
async: false,
|
4874
|
method: 'POST',
|
4875
|
url: '/UserControl/GetStore',
|
4876
|
params: {
|
4877
|
tableName: 'PCMFUNC',
|
4878
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
4879
|
},
|
4880
|
success: function (response) {
|
4881
|
var results = Ext.decode(response.responseText);
|
4882
|
data_ = results.data[0];
|
4883
|
if (data_ != undefined) {
|
4884
|
custumFunc = data_.FunctionCode;
|
4885
|
}
|
4886
|
}
|
4887
|
});
|
4888
|
}
|
4889
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4890
|
if (frm) {
|
4891
|
if (target) {
|
4892
|
var f = frm.getForm().findField(target)
|
4893
|
_store = f.getStore();
|
4894
|
var _tbl = _store.proxy.extraParams.tableName;
|
4895
|
var oldParam = _store.proxy.extraParams.param;
|
4896
|
_store.proxy.extraParams = {
|
4897
|
tableName: _tbl,
|
4898
|
param: _label + '[=]' + _Value
|
4899
|
};
|
4900
|
_store.load();
|
4901
|
}
|
4902
|
if (custumFunc) {
|
4903
|
eval(custumFunc)
|
4904
|
}
|
4905
|
}
|
4906
|
}
|
4907
|
}
|
4908
|
});
|
4909
|
}
|
4910
|
}
|
4911
|
} else if (rec.SearchType != "") {
|
4912
|
if (rec.SearchType == "0") //combobox
|
4913
|
{
|
4914
|
valueField = null;
|
4915
|
displayValue = null;
|
4916
|
Ext.Ajax.request({
|
4917
|
async: false,
|
4918
|
method: 'POST',
|
4919
|
url: '/UserControl/GetStore',
|
4920
|
params: {
|
4921
|
tableName: 'SDATATABLEFIELD',
|
4922
|
param: 'TableName[equal]' + rec.TableRef
|
4923
|
},
|
4924
|
success: function (response) {
|
4925
|
var results = Ext.decode(response.responseText);
|
4926
|
data_ = results.data;
|
4927
|
if (data_ != undefined) {
|
4928
|
valueField_ = $.grep(data_, function (r) {
|
4929
|
return r.ValueField == '1'
|
4930
|
});
|
4931
|
if (valueField_.length > 0) {
|
4932
|
valueField = valueField_[0].FieldName
|
4933
|
}
|
4934
|
displayValue_ = $.grep(data_, function (r) {
|
4935
|
return r.DisplayValue == '1'
|
4936
|
});
|
4937
|
if (displayValue_.length > 0) {
|
4938
|
displayValue = displayValue_[0].FieldName
|
4939
|
}
|
4940
|
}
|
4941
|
}
|
4942
|
});
|
4943
|
formfield = new Ext.form.ComboBox({
|
4944
|
allowBlank: allowblank,
|
4945
|
fieldLabel: rec.ScreenCaption,
|
4946
|
forceSelection: true,
|
4947
|
anyMatch: true,
|
4948
|
readOnly: readonly,
|
4949
|
labelCls: 'label-minova',
|
4950
|
labelWidth: 150,
|
4951
|
hidden: ishidden,
|
4952
|
msgTarget: 'side',
|
4953
|
name: rec.FieldName,
|
4954
|
formname: formname_,
|
4955
|
nameTable: nameTable_,
|
4956
|
value: rec.DefaultValue,
|
4957
|
width: '95%',
|
4958
|
store: Ext.create('Ext.data.Store', {
|
4959
|
storeId: 'store' + rec.FieldName,
|
4960
|
autoLoad: false,
|
4961
|
proxy: {
|
4962
|
method: 'POST',
|
4963
|
type: 'ajax',
|
4964
|
url: '/UserControl/GetStore',
|
4965
|
extraParams: {
|
4966
|
tableName: rec.TableRef,
|
4967
|
param: rec.ParamCombo
|
4968
|
},
|
4969
|
reader: {
|
4970
|
type: 'json',
|
4971
|
root: 'data',
|
4972
|
totalProperty: 'data[0].TotalCount'
|
4973
|
}
|
4974
|
}
|
4975
|
}),
|
4976
|
formtarget: formname_,
|
4977
|
listeners: {
|
4978
|
afterrender: function (f) {
|
4979
|
var store_ = f.getStore();
|
4980
|
store_.load();
|
4981
|
},
|
4982
|
change: function (val) {
|
4983
|
var _label = val.name;
|
4984
|
var _form = val.formtarget;
|
4985
|
var _Value = val.getValue();
|
4986
|
var target = rec.TriggerCombo;
|
4987
|
var custumFunc = rec.SelectFunction;
|
4988
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
4989
|
if (frm) {
|
4990
|
|
4991
|
if (target) {
|
4992
|
var f = frm.getForm().findField(target)
|
4993
|
_store = f.getStore();
|
4994
|
var _tbl = _store.proxy.extraParams.tableName;
|
4995
|
var oldParam = _store.proxy.extraParams.param;
|
4996
|
_store.proxy.extraParams = {
|
4997
|
tableName: _tbl,
|
4998
|
param: _label + '[=]' + _Value
|
4999
|
};
|
5000
|
_store.load();
|
5001
|
}
|
5002
|
if (custumFunc) {
|
5003
|
eval(custumFunc)
|
5004
|
}
|
5005
|
}
|
5006
|
}
|
5007
|
},
|
5008
|
queryMode: 'local',
|
5009
|
displayField: displayValue,
|
5010
|
valueField: valueField,
|
5011
|
});
|
5012
|
} else if (rec.SearchType == '2') //Lookup
|
5013
|
{
|
5014
|
formfield = new MinovaUtil.MinovaES.MinovaLookupGrid({
|
5015
|
allowBlank: allowblank,
|
5016
|
fieldLabel: rec.ScreenCaption,
|
5017
|
readOnly: readonly,
|
5018
|
IsPrimaryKey: rec.IsPrimaryKey,
|
5019
|
msgTarget: 'side',
|
5020
|
labelCls: 'label-minova',
|
5021
|
labelWidth: 150,
|
5022
|
hidden: ishidden,
|
5023
|
name: rec.FieldName,
|
5024
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
5025
|
triggerCls: 'x-form-search-trigger',
|
5026
|
vtype: 'alphanum', // disable space
|
5027
|
formtarget: me.formname, // nama form yang akan di set value-nya
|
5028
|
anchor: '100%',
|
5029
|
formname: formname_,
|
5030
|
nameTable: nameTable_,
|
5031
|
LookupFunction: rec.LookupFunction,
|
5032
|
SearchFunction: rec.SearchFunction,
|
5033
|
listeners: {
|
5034
|
change: function (val) {
|
5035
|
var _label = val.name;
|
5036
|
var _form = val.formname;
|
5037
|
var _Value = val.getValue();
|
5038
|
var target = rec.TriggerCombo;
|
5039
|
var custumFunc = rec.SelectFunction;
|
5040
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
5041
|
Ext.Ajax.request({
|
5042
|
async: false,
|
5043
|
method: 'POST',
|
5044
|
url: '/UserControl/GetStore',
|
5045
|
params: {
|
5046
|
tableName: 'PCMFUNC',
|
5047
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
5048
|
},
|
5049
|
success: function (response) {
|
5050
|
var results = Ext.decode(response.responseText);
|
5051
|
data_ = results.data[0];
|
5052
|
if (data_ != undefined) {
|
5053
|
custumFunc = data_.FunctionCode;
|
5054
|
}
|
5055
|
}
|
5056
|
});
|
5057
|
}
|
5058
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
5059
|
if (frm) {
|
5060
|
|
5061
|
if (target) {
|
5062
|
var f = frm.getForm().findField(target)
|
5063
|
_store = f.getStore();
|
5064
|
var _tbl = _store.proxy.extraParams.tableName;
|
5065
|
var oldParam = _store.proxy.extraParams.param;
|
5066
|
_store.proxy.extraParams = {
|
5067
|
tableName: _tbl,
|
5068
|
param: _label + '[=]' + _Value
|
5069
|
};
|
5070
|
_store.load();
|
5071
|
}
|
5072
|
|
5073
|
if (custumFunc) {
|
5074
|
eval(custumFunc)
|
5075
|
}
|
5076
|
|
5077
|
}
|
5078
|
|
5079
|
},
|
5080
|
|
5081
|
},
|
5082
|
});
|
5083
|
} else if (rec.SearchType == '3') //lookup tree
|
5084
|
{
|
5085
|
formfield = new MinovaUtil.MinovaES.MinovaLookupTree({
|
5086
|
allowBlank: allowblank,
|
5087
|
fieldLabel: rec.ScreenCaption,
|
5088
|
readOnly: readonly,
|
5089
|
IsPrimaryKey: rec.IsPrimaryKey,
|
5090
|
labelCls: 'label-minova',
|
5091
|
labelWidth: 150,
|
5092
|
hidden: ishidden,
|
5093
|
name: rec.FieldName,
|
5094
|
msgTarget: 'side',
|
5095
|
triggerCls: 'x-form-search-trigger',
|
5096
|
treeSructure: rec.SearchFunction, //'O-O-P',
|
5097
|
objClassValue: rec.ParamCombo, //'O',
|
5098
|
formname: formname_,
|
5099
|
targetField: rec.FieldName,
|
5100
|
nameTable: nameTable_,
|
5101
|
editable: false,
|
5102
|
anchor: '100%',
|
5103
|
listeners: {
|
5104
|
change3: function (val) {
|
5105
|
var _label = val.name;
|
5106
|
var _form = val.formname;
|
5107
|
var _Value = val.getValue();
|
5108
|
var target = rec.TriggerCombo;
|
5109
|
var custumFunc = rec.SelectFunction;
|
5110
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
5111
|
Ext.Ajax.request({
|
5112
|
async: false,
|
5113
|
method: 'POST',
|
5114
|
url: '/UserControl/GetStore',
|
5115
|
params: {
|
5116
|
tableName: 'PCMFUNC',
|
5117
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
5118
|
},
|
5119
|
success: function (response) {
|
5120
|
var results = Ext.decode(response.responseText);
|
5121
|
data_ = results.data[0];
|
5122
|
if (data_ != undefined) {
|
5123
|
custumFunc = data_.FunctionCode;
|
5124
|
}
|
5125
|
}
|
5126
|
});
|
5127
|
}
|
5128
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
5129
|
if (frm) {
|
5130
|
|
5131
|
if (target) {
|
5132
|
var f = frm.getForm().findField(target)
|
5133
|
_store = f.getStore();
|
5134
|
var _tbl = _store.proxy.extraParams.tableName;
|
5135
|
var oldParam = _store.proxy.extraParams.param;
|
5136
|
_store.proxy.extraParams = {
|
5137
|
tableName: _tbl,
|
5138
|
param: _label + '[=]' + _Value
|
5139
|
};
|
5140
|
_store.load();
|
5141
|
}
|
5142
|
if (custumFunc) {
|
5143
|
eval(custumFunc)
|
5144
|
}
|
5145
|
}
|
5146
|
},
|
5147
|
blur: function (val) {
|
5148
|
//if(val.value.split('-').length != 2){
|
5149
|
var _label = val.name;
|
5150
|
var _form = val.formname;
|
5151
|
var _Value = val.getValue();
|
5152
|
var target = rec.TriggerCombo;
|
5153
|
var custumFunc = rec.SelectFunction;
|
5154
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
5155
|
Ext.Ajax.request({
|
5156
|
async: false,
|
5157
|
method: 'POST',
|
5158
|
url: '/UserControl/GetStore',
|
5159
|
params: {
|
5160
|
tableName: 'PCMFUNC',
|
5161
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
5162
|
},
|
5163
|
success: function (response) {
|
5164
|
var results = Ext.decode(response.responseText);
|
5165
|
data_ = results.data[0];
|
5166
|
if (data_ != undefined) {
|
5167
|
custumFunc = data_.FunctionCode;
|
5168
|
}
|
5169
|
}
|
5170
|
});
|
5171
|
}
|
5172
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
5173
|
if (frm) {
|
5174
|
|
5175
|
if (target) {
|
5176
|
var f = frm.getForm().findField(target)
|
5177
|
_store = f.getStore();
|
5178
|
var _tbl = _store.proxy.extraParams.tableName;
|
5179
|
var oldParam = _store.proxy.extraParams.param;
|
5180
|
_store.proxy.extraParams = {
|
5181
|
tableName: _tbl,
|
5182
|
param: _label + '[=]' + _Value
|
5183
|
};
|
5184
|
_store.load();
|
5185
|
}
|
5186
|
if (custumFunc) {
|
5187
|
eval(custumFunc)
|
5188
|
}
|
5189
|
}
|
5190
|
//}
|
5191
|
}
|
5192
|
|
5193
|
}
|
5194
|
});
|
5195
|
}
|
5196
|
}
|
5197
|
if (isDesk) {
|
5198
|
if (rec.ColumnNo == 1) {
|
5199
|
col1.push(formfield);
|
5200
|
} else {
|
5201
|
col2.push(formfield);
|
5202
|
}
|
5203
|
} else {
|
5204
|
col1.push(formfield);
|
5205
|
}
|
5206
|
|
5207
|
});
|
5208
|
}
|
5209
|
Ext.applyIf(me, {
|
5210
|
items: [{
|
5211
|
//width: 450,
|
5212
|
style: 'width: 50%',
|
5213
|
items: col1
|
5214
|
}, {
|
5215
|
//width: 450,
|
5216
|
style: 'width: 50%',
|
5217
|
items: col2
|
5218
|
}
|
5219
|
],
|
5220
|
});
|
5221
|
this.callParent();
|
5222
|
}
|
5223
|
});
|
5224
|
/*Gird ESS Generator*/
|
5225
|
Ext.define('MinovaUtil.MinovaES.MinovaWorkflowGrid', {
|
5226
|
extend: 'Ext.grid.Panel',
|
5227
|
requires: ['Ext.grid.RowNumberer'],
|
5228
|
alias: 'widget.minovaworkflowgrid',
|
5229
|
alternateClassName: 'Ext.grid.MinovaGrid',
|
5230
|
tableName: undefined,
|
5231
|
param: undefined,
|
5232
|
pagesize: undefined,
|
5233
|
storeName: undefined,
|
5234
|
enableLocking: true,
|
5235
|
autoLoad: undefined,
|
5236
|
multiSelect: undefined,
|
5237
|
formname: this.name,
|
5238
|
bizprocid: undefined,
|
5239
|
taskid: undefined,
|
5240
|
initComponent: function () {
|
5241
|
var me = this;
|
5242
|
var cols_ = [];
|
5243
|
var fieldeditor = {};
|
5244
|
var hasil = null;
|
5245
|
var autoLoad = true;
|
5246
|
var locking = true;
|
5247
|
var widthLock = 250;
|
5248
|
if (me.autoLoad == false) {
|
5249
|
autoLoad = false;
|
5250
|
}
|
5251
|
var LangID = MinovaUtil.GetLangID();
|
5252
|
var parameter = "LangID='" + LangID + "',BizProcessID='" + me.bizprocid + "',TaskID='" + me.taskid + "',TableName='" + me.tableName + "'";
|
5253
|
Ext.Ajax.request({
|
5254
|
async: false,
|
5255
|
method: 'POST',
|
5256
|
url: '/UserControl/GetStore',
|
5257
|
params: {
|
5258
|
tableName: 'PDSWFSTRUCTUREFIELD',
|
5259
|
param: parameter
|
5260
|
},
|
5261
|
success: function (response) {
|
5262
|
var results = Ext.decode(response.responseText);
|
5263
|
hasil = results.data;
|
5264
|
}
|
5265
|
});
|
5266
|
|
5267
|
if (hasil.length > 0) {
|
5268
|
Ext.each(hasil, function (rec) {
|
5269
|
var readonly = false;
|
5270
|
var ishidden = false;
|
5271
|
var allowblank = true;
|
5272
|
var null_ = null;
|
5273
|
if (rec.IsReadOnly == '1') {
|
5274
|
readonly = true;
|
5275
|
}
|
5276
|
if (rec.IsRequired == '1') {
|
5277
|
allowblank = false;
|
5278
|
}
|
5279
|
if (rec.IsVisible == '1') {
|
5280
|
switch (rec.FormatRef) {
|
5281
|
case "date":
|
5282
|
cols_.push({
|
5283
|
xtype: 'minovadatecolumn',
|
5284
|
text: rec.HeaderTitle,
|
5285
|
dataIndex: rec.FieldName,
|
5286
|
width: 100
|
5287
|
});
|
5288
|
break
|
5289
|
case "amountencrypt":
|
5290
|
cols_.push({
|
5291
|
xtype: 'minovaamountcolumn',
|
5292
|
align: 'right',
|
5293
|
text: rec.HeaderTitle,
|
5294
|
dataIndex: rec.FieldName,
|
5295
|
width: 100
|
5296
|
});
|
5297
|
break
|
5298
|
case "amount":
|
5299
|
cols_.push({
|
5300
|
xtype: 'minovacurrancycolumn',
|
5301
|
align: 'right',
|
5302
|
text: rec.HeaderTitle,
|
5303
|
dataIndex: rec.FieldName,
|
5304
|
width: 100,
|
5305
|
filter: {
|
5306
|
type: 'number',
|
5307
|
itemDefaults: {
|
5308
|
emptyText: 'Search for...'
|
5309
|
}
|
5310
|
}
|
5311
|
});
|
5312
|
break
|
5313
|
case "datetime":
|
5314
|
cols_.push({
|
5315
|
xtype: 'minovadatetimecolumn',
|
5316
|
text: rec.HeaderTitle,
|
5317
|
dataIndex: rec.FieldName,
|
5318
|
width: 140,
|
5319
|
filter: {
|
5320
|
type: 'string',
|
5321
|
itemDefaults: {
|
5322
|
emptyText: 'Search for...'
|
5323
|
}
|
5324
|
}
|
5325
|
});
|
5326
|
break
|
5327
|
default:
|
5328
|
if (rec.TableRef != "") {
|
5329
|
if (rec.TableRef != null) {
|
5330
|
var valueField = null;
|
5331
|
var displayValue = null;
|
5332
|
Ext.Ajax.request({
|
5333
|
async: false,
|
5334
|
method: 'POST',
|
5335
|
url: '/UserControl/GetStore',
|
5336
|
params: {
|
5337
|
tableName: 'SDATATABLEFIELD',
|
5338
|
param: 'TableName[equal]' + rec.TableRef
|
5339
|
},
|
5340
|
success: function (response) {
|
5341
|
var results = Ext.decode(response.responseText);
|
5342
|
data_ = results.data;
|
5343
|
|
5344
|
if (data_ != undefined) {
|
5345
|
if (data_.length > 0) {
|
5346
|
valueField_ = $.grep(data_, function (r) {
|
5347
|
return r.ValueField == '1'
|
5348
|
});
|
5349
|
valueField = valueField_[0].FieldName
|
5350
|
displayValue_ = $.grep(data_, function (r) {
|
5351
|
return r.DisplayValue == '1'
|
5352
|
});
|
5353
|
displayValue = displayValue_[0].FieldName
|
5354
|
}
|
5355
|
}
|
5356
|
}
|
5357
|
});
|
5358
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
5359
|
var count_ = 0;
|
5360
|
if (store_) {
|
5361
|
count_ = store_.count();
|
5362
|
}
|
5363
|
if (count_ == 0) {
|
5364
|
Ext.create('Ext.data.Store', {
|
5365
|
storeId: 'store_' + rec.FieldName,
|
5366
|
autoLoad: false,
|
5367
|
proxy: {
|
5368
|
method: 'POST',
|
5369
|
type: 'ajax',
|
5370
|
url: '/UserControl/GetStore',
|
5371
|
extraParams: {
|
5372
|
tableName: rec.TableRef,
|
5373
|
param: rec.ParamCombo
|
5374
|
},
|
5375
|
reader: {
|
5376
|
type: 'json',
|
5377
|
root: 'data',
|
5378
|
totalProperty: 'data[0].TotalCount'
|
5379
|
}
|
5380
|
}
|
5381
|
})
|
5382
|
}
|
5383
|
cols_.push({
|
5384
|
xtype: 'minovacombocolumn',
|
5385
|
text: rec.HeaderTitle,
|
5386
|
dataIndex: rec.FieldName,
|
5387
|
valueField: valueField,
|
5388
|
displayField: displayValue,
|
5389
|
store: 'store_' + rec.FieldName,
|
5390
|
filter: {
|
5391
|
type: 'list',
|
5392
|
itemDefaults: {
|
5393
|
emptyText: 'Search for...'
|
5394
|
}
|
5395
|
}
|
5396
|
});
|
5397
|
}
|
5398
|
} else {
|
5399
|
cols_.push({
|
5400
|
text: rec.HeaderTitle,
|
5401
|
dataIndex: rec.FieldName,
|
5402
|
filter: {
|
5403
|
itemDefaults: {
|
5404
|
emptyText: 'Search for...'
|
5405
|
}
|
5406
|
}
|
5407
|
});
|
5408
|
}
|
5409
|
break
|
5410
|
}
|
5411
|
} else {
|
5412
|
cols_.push({
|
5413
|
text: rec.HeaderTitle,
|
5414
|
dataIndex: rec.FieldName,
|
5415
|
hidden: true,
|
5416
|
filter: {
|
5417
|
itemDefaults: {
|
5418
|
emptyText: 'Search for...'
|
5419
|
}
|
5420
|
}
|
5421
|
});
|
5422
|
}
|
5423
|
});
|
5424
|
};
|
5425
|
var param_ = me.param;
|
5426
|
if (param_ == undefined) {
|
5427
|
param_ = ''
|
5428
|
}
|
5429
|
var jsStoreGrid = new Ext.data.Store({
|
5430
|
storeId: me.storeName,
|
5431
|
autoLoad: autoLoad,
|
5432
|
pageSize: 10,
|
5433
|
proxy: {
|
5434
|
method: 'POST',
|
5435
|
type: 'ajax',
|
5436
|
url: '/UserControl/GetStorePagingAuth',
|
5437
|
extraParams: {
|
5438
|
tableName: me.tableName,
|
5439
|
param: param_,
|
5440
|
menuId: MinovaUtil.GetMenuID()
|
5441
|
},
|
5442
|
reader: {
|
5443
|
type: 'json',
|
5444
|
root: 'data',
|
5445
|
totalProperty: 'totalRecords'
|
5446
|
}
|
5447
|
}
|
5448
|
});
|
5449
|
Ext.applyIf(me, {
|
5450
|
autoScroll: true,
|
5451
|
enableLocking: locking,
|
5452
|
lockedGridConfig: {
|
5453
|
header: false,
|
5454
|
collapsible: true,
|
5455
|
width: widthLock,
|
5456
|
forceFit: locking,
|
5457
|
listeners: {
|
5458
|
render: function (grid) {
|
5459
|
var pagingToolbar = grid.child('pagingtoolbar');
|
5460
|
if (pagingToolbar) {
|
5461
|
grid.remove(pagingToolbar, true);
|
5462
|
}
|
5463
|
}
|
5464
|
}
|
5465
|
},
|
5466
|
listeners: {
|
5467
|
viewready: function () {
|
5468
|
if (autoLoad == true) {
|
5469
|
this.getStore().loadPage(1);
|
5470
|
}
|
5471
|
|
5472
|
},
|
5473
|
beforeedit: function () {
|
5474
|
return false;
|
5475
|
}
|
5476
|
},
|
5477
|
lockedViewConfig: {
|
5478
|
scroll: 'horizontal'
|
5479
|
},
|
5480
|
viewConfig: {
|
5481
|
emptyText: 'No Data Display',
|
5482
|
deferEmptyText: false,
|
5483
|
listeners: {
|
5484
|
refresh: function (dataview) {
|
5485
|
Ext.each(dataview.panel.columns, function (column) {
|
5486
|
if (column.autoSizeColumn == false)
|
5487
|
column.autoSizeColumn = true;
|
5488
|
column.autoSize();
|
5489
|
})
|
5490
|
}
|
5491
|
}
|
5492
|
},
|
5493
|
columns: cols_,
|
5494
|
store: jsStoreGrid,
|
5495
|
plugins: [{
|
5496
|
ptype: 'gridfilters'
|
5497
|
}
|
5498
|
]
|
5499
|
});
|
5500
|
this.callParent();
|
5501
|
}
|
5502
|
});
|
5503
|
/*EditableGrid ESS Generator*/
|
5504
|
Ext.define('MinovaUtil.MinovaES.MinovaWorkflowEditableGrid', {
|
5505
|
extend: 'Ext.form.Panel',
|
5506
|
alias: ['widget.minovaworkfloweditablegrid', 'widget.workfloweditablegrid1'],
|
5507
|
requires: [
|
5508
|
'Ext.grid.plugin.CellEditing',
|
5509
|
'Ext.grid.RowNumberer',
|
5510
|
'Ext.grid.Panel',
|
5511
|
],
|
5512
|
anchor: '100%',
|
5513
|
tableName: undefined,
|
5514
|
hideButton: undefined,
|
5515
|
multiSelect: undefined,
|
5516
|
formname: this.name,
|
5517
|
bizprocid: undefined,
|
5518
|
bizflowid: undefined,
|
5519
|
taskid: undefined,
|
5520
|
features: undefined,
|
5521
|
initComponent: function () {
|
5522
|
var me = this;
|
5523
|
var isLookup = me.isLookup;
|
5524
|
var hide_ = false;
|
5525
|
var widthLock = 250;
|
5526
|
var checkSelection = '';
|
5527
|
if (me.hideButton == true) {
|
5528
|
hide_ = true;
|
5529
|
}
|
5530
|
if (me.multiSelect) {
|
5531
|
locking = false;
|
5532
|
checkSelection = 'checkboxmodel';
|
5533
|
widthLock = 40;
|
5534
|
}
|
5535
|
var tableName = me.tableName;
|
5536
|
var features = me.features;
|
5537
|
var cols = [];
|
5538
|
var fieldStore = [];
|
5539
|
var _url = 'GetAllField';
|
5540
|
var hasil = null;
|
5541
|
var height = me.height;
|
5542
|
var storeID = 'store' + me.tableName;
|
5543
|
var gridName = 'grid' + me.name;
|
5544
|
if (me.storeName) {
|
5545
|
storeID = me.storeName;
|
5546
|
}
|
5547
|
var LangID = MinovaUtil.GetLangID();
|
5548
|
var parameter = "LangID='" + LangID + "',BizProcessID='" + me.bizprocid + "',TaskID='" + me.taskid + "',TableName='" + me.tableName + "'";
|
5549
|
Ext.Ajax.request({
|
5550
|
async: false,
|
5551
|
method: 'POST',
|
5552
|
url: '/UserControl/GetStore',
|
5553
|
params: {
|
5554
|
tableName: 'PDSWFSTRUCTUREFIELD',
|
5555
|
param: parameter
|
5556
|
},
|
5557
|
success: function (response) {
|
5558
|
var results = Ext.decode(response.responseText);
|
5559
|
hasil = results.data;
|
5560
|
}
|
5561
|
});
|
5562
|
cols.push({
|
5563
|
xtype: 'rownumberer'
|
5564
|
});
|
5565
|
var addData = 'var data={';
|
5566
|
if (hasil.length > 0) {
|
5567
|
Ext.each(hasil, function (rec) {
|
5568
|
fieldStore.push(rec.FieldName);
|
5569
|
if (rec.FieldName != 'Sequence') {
|
5570
|
addData = addData + rec.FieldName + ":" + "'',";
|
5571
|
}
|
5572
|
var null_ = null;
|
5573
|
var ReadOnly_ = false;
|
5574
|
if (rec.IsRequired == '1') {
|
5575
|
null_ = false;
|
5576
|
} else {
|
5577
|
null_ = true;
|
5578
|
}
|
5579
|
var Hidden_ = false;
|
5580
|
if (rec.IsReadOnly == '1') {
|
5581
|
ReadOnly_ = true;
|
5582
|
}
|
5583
|
if (rec.IsVisible == '1') {
|
5584
|
switch (rec.FormatRef) {
|
5585
|
case "date":
|
5586
|
cols.push({
|
5587
|
xtype: 'minovadatecolumn',
|
5588
|
hidden: Hidden_,
|
5589
|
text: rec.HeaderTitle,
|
5590
|
dataIndex: rec.FieldName,
|
5591
|
filter: {
|
5592
|
itemDefaults: {
|
5593
|
emptyText: 'Search for...',
|
5594
|
}
|
5595
|
},
|
5596
|
editor: {
|
5597
|
allowBlank: null_,
|
5598
|
xtype: 'datefield',
|
5599
|
hideMode: 'visibility',
|
5600
|
readOnly: ReadOnly_,
|
5601
|
id: tableName + rec.FieldName,
|
5602
|
fieldGrid: rec.FieldName,
|
5603
|
nameTable: rec.TableName,
|
5604
|
value: rec.DefaultValue
|
5605
|
}
|
5606
|
});
|
5607
|
break
|
5608
|
case "amount":
|
5609
|
cols.push({
|
5610
|
xtype: 'minovacurrancycolumn',
|
5611
|
align: 'right',
|
5612
|
text: rec.HeaderTitle,
|
5613
|
dataIndex: rec.FieldName,
|
5614
|
hidden: Hidden_,
|
5615
|
filter: {
|
5616
|
itemDefaults: {
|
5617
|
emptyText: 'Search for...'
|
5618
|
}
|
5619
|
},
|
5620
|
editor: {
|
5621
|
allowBlank: null_,
|
5622
|
xtype: 'minovacurrencyfield',
|
5623
|
readOnly: ReadOnly_,
|
5624
|
id: tableName + rec.FieldName,
|
5625
|
nameTable: rec.TableName,
|
5626
|
fieldGrid: rec.FieldName,
|
5627
|
fieldStyle: 'text-align:right;',
|
5628
|
value: '0'
|
5629
|
}
|
5630
|
});
|
5631
|
break
|
5632
|
default:
|
5633
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
|
5634
|
cols.push({
|
5635
|
text: rec.HeaderTitle,
|
5636
|
dataIndex: rec.FieldName,
|
5637
|
width: 100,
|
5638
|
filter: {
|
5639
|
type: 'string',
|
5640
|
itemDefaults: {
|
5641
|
emptyText: 'Search for...'
|
5642
|
}
|
5643
|
}
|
5644
|
});
|
5645
|
} else if (rec.SearchType == '0') {
|
5646
|
var valueField = null;
|
5647
|
var displayValue = null;
|
5648
|
var TableRef = undefined;
|
5649
|
if (rec.TableRef != '') {
|
5650
|
TableRef = rec.TableRef;
|
5651
|
Ext.Ajax.request({
|
5652
|
async: false,
|
5653
|
method: 'POST',
|
5654
|
url: '/UserControl/GetStore',
|
5655
|
params: {
|
5656
|
tableName: 'SDATATABLEFIELD',
|
5657
|
param: 'TableName[equal]' + rec.TableRef
|
5658
|
},
|
5659
|
success: function (response) {
|
5660
|
var results = Ext.decode(response.responseText);
|
5661
|
data_ = results.data;
|
5662
|
if (data_ != undefined) {
|
5663
|
valueField_ = $.grep(data_, function (r) {
|
5664
|
return r.ValueField == '1'
|
5665
|
});
|
5666
|
valueField = valueField_[0].FieldName
|
5667
|
displayValue_ = $.grep(data_, function (r) {
|
5668
|
return r.DisplayValue == '1'
|
5669
|
});
|
5670
|
displayValue = displayValue_[0].FieldName
|
5671
|
}
|
5672
|
}
|
5673
|
});
|
5674
|
}
|
5675
|
Ext.create('Ext.data.Store', {
|
5676
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
5677
|
autoLoad: true,
|
5678
|
proxy: {
|
5679
|
method: 'POST',
|
5680
|
type: 'ajax',
|
5681
|
url: '/UserControl/GetStoreAuth',
|
5682
|
extraParams: {
|
5683
|
tableName: TableRef,
|
5684
|
param: rec.ParamCombo,
|
5685
|
menuId: MinovaUtil.GetMenuID()
|
5686
|
},
|
5687
|
reader: {
|
5688
|
type: 'json',
|
5689
|
root: 'data',
|
5690
|
totalProperty: 'data[0].TotalCount'
|
5691
|
}
|
5692
|
}
|
5693
|
});
|
5694
|
cols.push({
|
5695
|
//xtype : 'minovacombocolumn',
|
5696
|
hidden: Hidden_,
|
5697
|
text: rec.HeaderTitle,
|
5698
|
dataIndex: rec.FieldName,
|
5699
|
//valueField : valueField,
|
5700
|
//displayField : displayValue,
|
5701
|
//store : 'store_' + me.tableName + rec.FieldName,
|
5702
|
editor: {
|
5703
|
allowBlank: null_,
|
5704
|
xtype: 'minovacombobox',
|
5705
|
readOnly: ReadOnly_,
|
5706
|
id: rec.TableName + rec.FieldName,
|
5707
|
nameTable: rec.TableName,
|
5708
|
fieldGrid: rec.FieldName,
|
5709
|
valueField: valueField,
|
5710
|
displayField: displayValue,
|
5711
|
store: 'store_' + me.tableName + rec.FieldName,
|
5712
|
value: rec.DefaultValue
|
5713
|
},
|
5714
|
renderer: function (value) {
|
5715
|
var store = Ext.data.StoreManager.lookup('store_' + me.tableName + rec.FieldName);
|
5716
|
var index = store.find(valueField, value);
|
5717
|
var val = "";
|
5718
|
if (index != -1) {
|
5719
|
var rc = store.getAt(index);
|
5720
|
val = rc.get(displayValue);
|
5721
|
} else {
|
5722
|
val = value;
|
5723
|
}
|
5724
|
return val;
|
5725
|
},
|
5726
|
filter: {
|
5727
|
type: 'list',
|
5728
|
itemDefaults: {
|
5729
|
emptyText: 'Search for...'
|
5730
|
}
|
5731
|
}
|
5732
|
});
|
5733
|
} else if (rec.SearchType == '5') {
|
5734
|
var valueField = null;
|
5735
|
var displayValue = null;
|
5736
|
var AdditionaldisplayValue = null;
|
5737
|
var TableRef = undefined;
|
5738
|
if (rec.TableRef != '') {
|
5739
|
TableRef = rec.TableRef;
|
5740
|
Ext.Ajax.request({
|
5741
|
async: false,
|
5742
|
method: 'POST',
|
5743
|
url: '/UserControl/GetStore',
|
5744
|
params: {
|
5745
|
tableName: 'SDATATABLEFIELD',
|
5746
|
param: 'TableName[equal]' + rec.TableRef
|
5747
|
},
|
5748
|
success: function (response) {
|
5749
|
var results = Ext.decode(response.responseText);
|
5750
|
data_ = results.data;
|
5751
|
if (data_ != undefined) {
|
5752
|
valueField_ = $.grep(data_, function (r) {
|
5753
|
return r.ValueField == '1'
|
5754
|
});
|
5755
|
if (valueField_.length > 0) {
|
5756
|
valueField = valueField_[0].FieldName
|
5757
|
}
|
5758
|
|
5759
|
displayValue_ = $.grep(data_, function (r) {
|
5760
|
return r.DisplayValue == '1' || r.DisplayValue == '2'
|
5761
|
});
|
5762
|
if (displayValue_.length > 0) {
|
5763
|
displayValue = displayValue_[0].FieldName;
|
5764
|
}
|
5765
|
if (displayValue_.length >= 2) {
|
5766
|
AdditionaldisplayValue = displayValue_[1].FieldName
|
5767
|
}
|
5768
|
}
|
5769
|
}
|
5770
|
});
|
5771
|
}
|
5772
|
Ext.create('Ext.data.Store', {
|
5773
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
5774
|
autoLoad: true,
|
5775
|
proxy: {
|
5776
|
method: 'POST',
|
5777
|
type: 'ajax',
|
5778
|
url: '/UserControl/GetStoreAuth',
|
5779
|
extraParams: {
|
5780
|
tableName: TableRef,
|
5781
|
param: rec.ParamCombo,
|
5782
|
menuId: MinovaUtil.GetMenuID()
|
5783
|
},
|
5784
|
reader: {
|
5785
|
type: 'json',
|
5786
|
root: 'data',
|
5787
|
totalProperty: 'data[0].TotalCount'
|
5788
|
}
|
5789
|
}
|
5790
|
});
|
5791
|
cols.push({
|
5792
|
//xtype : 'minovacombocolumn',
|
5793
|
hidden: Hidden_,
|
5794
|
text: rec.HeaderTitle,
|
5795
|
dataIndex: rec.FieldName,
|
5796
|
//valueField : valueField,
|
5797
|
//displayField : displayValue,
|
5798
|
//store : 'store_' + me.tableName + rec.FieldName,
|
5799
|
tpl: Ext.create('Ext.XTemplate',
|
5800
|
'<ul class="x-list-plain"><tpl for=".">',
|
5801
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
5802
|
'</tpl></ul>'),
|
5803
|
displayTpl: Ext.create('Ext.XTemplate',
|
5804
|
'<tpl for=".">',
|
5805
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
5806
|
'</tpl>'),
|
5807
|
editor: {
|
5808
|
allowBlank: null_,
|
5809
|
xtype: 'combobox',
|
5810
|
readOnly: ReadOnly_,
|
5811
|
id: rec.TableName + rec.FieldName,
|
5812
|
nameTable: rec.TableName,
|
5813
|
fieldGrid: rec.FieldName,
|
5814
|
valueField: valueField,
|
5815
|
displayField: displayValue,
|
5816
|
store: 'store_' + me.tableName + rec.FieldName,
|
5817
|
value: rec.DefaultValue,
|
5818
|
tpl: Ext.create('Ext.XTemplate',
|
5819
|
'<ul class="x-list-plain"><tpl for=".">',
|
5820
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
5821
|
'</tpl></ul>'),
|
5822
|
displayTpl: Ext.create('Ext.XTemplate',
|
5823
|
'<tpl for=".">',
|
5824
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
5825
|
'</tpl>')
|
5826
|
},
|
5827
|
renderer: function (value) {
|
5828
|
var store = Ext.data.StoreManager.lookup('store_' + me.tableName + rec.FieldName);
|
5829
|
var index = store.find(valueField, value);
|
5830
|
var val = "";
|
5831
|
if (index != -1) {
|
5832
|
var rc = store.getAt(index);
|
5833
|
//val = rc.get(displayValue);
|
5834
|
val = rc.get(AdditionaldisplayValue) + ' - ' + rc.get(displayValue);
|
5835
|
} else {
|
5836
|
val = value;
|
5837
|
}
|
5838
|
return val;
|
5839
|
},
|
5840
|
filter: {
|
5841
|
type: 'list',
|
5842
|
itemDefaults: {
|
5843
|
emptyText: 'Search for...'
|
5844
|
}
|
5845
|
}
|
5846
|
});
|
5847
|
} else if (rec.SearchType == '2') {
|
5848
|
var triger = (rec.TriggerCombo).split('$');
|
5849
|
var targetField_ = triger[0];
|
5850
|
var fieldValue_ = triger[1];
|
5851
|
cols.push({
|
5852
|
text: rec.HeaderTitle,
|
5853
|
hidden: Hidden_,
|
5854
|
dataIndex: rec.FieldName,
|
5855
|
filter: {
|
5856
|
itemDefaults: {
|
5857
|
emptyText: 'Search for...'
|
5858
|
}
|
5859
|
},
|
5860
|
editor: {
|
5861
|
allowBlank: null_,
|
5862
|
xtype: 'minovalookupgrid',
|
5863
|
readOnly: ReadOnly_,
|
5864
|
isGrid: true,
|
5865
|
fieldTarget: targetField_,
|
5866
|
fieldValue: fieldValue_,
|
5867
|
isGrid: true,
|
5868
|
id: tableName + rec.FieldName,
|
5869
|
tableName: rec.TableRef,
|
5870
|
triggerCls: 'x-form-search-trigger',
|
5871
|
vtype: 'alphanum',
|
5872
|
nameTable: rec.TableName,
|
5873
|
fieldGrid: rec.FieldName,
|
5874
|
listeners: {
|
5875
|
change: function (val) {
|
5876
|
var custumFunc = rec.SelectFunction;
|
5877
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
5878
|
Ext.Ajax.request({
|
5879
|
async: false,
|
5880
|
method: 'POST',
|
5881
|
url: '/UserControl/GetStore',
|
5882
|
params: {
|
5883
|
tableName: 'PCMFUNC',
|
5884
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
5885
|
},
|
5886
|
success: function (response) {
|
5887
|
var results = Ext.decode(response.responseText);
|
5888
|
data_ = results.data[0];
|
5889
|
if (data_ != undefined) {
|
5890
|
custumFunc = data_.FunctionCode;
|
5891
|
}
|
5892
|
}
|
5893
|
});
|
5894
|
}
|
5895
|
if (custumFunc) {
|
5896
|
eval(custumFunc)
|
5897
|
}
|
5898
|
}
|
5899
|
}
|
5900
|
}
|
5901
|
});
|
5902
|
} else if (rec.SearchType == '3') {
|
5903
|
cols.push({
|
5904
|
text: rec.HeaderTitle,
|
5905
|
hidden: Hidden_,
|
5906
|
dataIndex: rec.FieldName,
|
5907
|
filter: {
|
5908
|
itemDefaults: {
|
5909
|
emptyText: 'Search for...'
|
5910
|
}
|
5911
|
},
|
5912
|
editor: {
|
5913
|
allowBlank: null_,
|
5914
|
xtype: 'MinovaLookupTree',
|
5915
|
readOnly: ReadOnly_,
|
5916
|
id: tableName + rec.FieldName,
|
5917
|
tableName: rec.TableRef,
|
5918
|
triggerCls: 'x-form-search-trigger',
|
5919
|
vtype: 'alphanum',
|
5920
|
treeSructure: rec.SearchFunction,
|
5921
|
objClassValue: rec.ParamCombo,
|
5922
|
nameTable: rec.TableName,
|
5923
|
fieldGrid: rec.FieldName,
|
5924
|
listeners: {
|
5925
|
change: function (val) {
|
5926
|
var custumFunc = rec.SelectFunction;
|
5927
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
5928
|
Ext.Ajax.request({
|
5929
|
async: false,
|
5930
|
method: 'POST',
|
5931
|
url: '/UserControl/GetStore',
|
5932
|
params: {
|
5933
|
tableName: 'PCMFUNC',
|
5934
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
5935
|
},
|
5936
|
success: function (response) {
|
5937
|
var results = Ext.decode(response.responseText);
|
5938
|
data_ = results.data[0];
|
5939
|
if (data_ != undefined) {
|
5940
|
custumFunc = data_.FunctionCode;
|
5941
|
}
|
5942
|
}
|
5943
|
});
|
5944
|
}
|
5945
|
if (custumFunc) {
|
5946
|
eval(custumFunc)
|
5947
|
}
|
5948
|
}
|
5949
|
}
|
5950
|
}
|
5951
|
});
|
5952
|
} else if (rec.SearchType != '0' && rec.SearchType != '1' && rec.SearchType != '3' && (rec.FieldName == 'EmployeeID' || rec.FieldName == 'ApplicantID' || rec.FieldName == 'EmployeeIDFrom' || rec.FieldName == 'EmployeeIDTo') && isLookup != true) {
|
5953
|
var triger = (rec.TriggerCombo).split('&');
|
5954
|
var targetField_ = triger[0];
|
5955
|
var fieldValue_ = triger[0];
|
5956
|
cols.push({
|
5957
|
text: rec.HeaderTitle,
|
5958
|
hidden: Hidden_,
|
5959
|
dataIndex: rec.FieldName,
|
5960
|
filter: {
|
5961
|
itemDefaults: {
|
5962
|
emptyText: 'Search for...'
|
5963
|
}
|
5964
|
},
|
5965
|
editor: {
|
5966
|
allowBlank: null_,
|
5967
|
xtype: 'lookupemployee',
|
5968
|
readOnly: ReadOnly_,
|
5969
|
isGrid: true,
|
5970
|
fieldTarget: targetField_,
|
5971
|
fieldValue: fieldValue_,
|
5972
|
isGrid: true,
|
5973
|
id: tableName + rec.FieldName,
|
5974
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
5975
|
triggerCls: 'x-form-search-trigger',
|
5976
|
vtype: 'alphanum', // disable space
|
5977
|
nameTable: rec.TableName,
|
5978
|
fieldGrid: rec.FieldName,
|
5979
|
listeners: {
|
5980
|
change: function (val) {
|
5981
|
var custumFunc = rec.SelectFunction;
|
5982
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
5983
|
Ext.Ajax.request({
|
5984
|
async: false,
|
5985
|
method: 'POST',
|
5986
|
url: '/UserControl/GetStore',
|
5987
|
params: {
|
5988
|
tableName: 'PCMFUNC',
|
5989
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
5990
|
},
|
5991
|
success: function (response) {
|
5992
|
var results = Ext.decode(response.responseText);
|
5993
|
data_ = results.data[0];
|
5994
|
if (data_ != undefined) {
|
5995
|
custumFunc = data_.FunctionCode;
|
5996
|
}
|
5997
|
}
|
5998
|
});
|
5999
|
}
|
6000
|
if (custumFunc) {
|
6001
|
eval(custumFunc)
|
6002
|
}
|
6003
|
}
|
6004
|
}
|
6005
|
}
|
6006
|
});
|
6007
|
} else if (rec.SearchType == '4' && isLookup != true) {
|
6008
|
cols.push({
|
6009
|
text: rec.HeaderTitle,
|
6010
|
hidden: Hidden_,
|
6011
|
dataIndex: rec.FieldName,
|
6012
|
filter: {
|
6013
|
itemDefaults: {
|
6014
|
emptyText: 'Search for...'
|
6015
|
}
|
6016
|
},
|
6017
|
editor: {
|
6018
|
allowBlank: null_,
|
6019
|
xtype: 'lookupemployee',
|
6020
|
readOnly: ReadOnly_,
|
6021
|
isGrid: true,
|
6022
|
fieldTarget: targetField_,
|
6023
|
fieldValue: fieldValue_,
|
6024
|
isGrid: true,
|
6025
|
id: tableName + rec.FieldName,
|
6026
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
6027
|
triggerCls: 'x-form-search-trigger',
|
6028
|
vtype: 'alphanum', // disable space
|
6029
|
nameTable: rec.TableName,
|
6030
|
fieldGrid: rec.FieldName,
|
6031
|
listeners: {
|
6032
|
change: function (val) {
|
6033
|
var custumFunc = rec.SelectFunction;
|
6034
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
6035
|
Ext.Ajax.request({
|
6036
|
async: false,
|
6037
|
method: 'POST',
|
6038
|
url: '/UserControl/GetStore',
|
6039
|
params: {
|
6040
|
tableName: 'PCMFUNC',
|
6041
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
6042
|
},
|
6043
|
success: function (response) {
|
6044
|
var results = Ext.decode(response.responseText);
|
6045
|
data_ = results.data[0];
|
6046
|
if (data_ != undefined) {
|
6047
|
custumFunc = data_.FunctionCode;
|
6048
|
}
|
6049
|
}
|
6050
|
});
|
6051
|
}
|
6052
|
if (custumFunc) {
|
6053
|
eval(custumFunc)
|
6054
|
}
|
6055
|
}
|
6056
|
}
|
6057
|
}
|
6058
|
});
|
6059
|
} else if (rec.FixedValue != '') { // add by taufan
|
6060
|
cols.push({
|
6061
|
text: rec.HeaderTitle,
|
6062
|
hidden: Hidden_,
|
6063
|
dataIndex: rec.FieldName,
|
6064
|
filter: {
|
6065
|
itemDefaults: {
|
6066
|
emptyText: 'Search for...'
|
6067
|
}
|
6068
|
},
|
6069
|
editor: {
|
6070
|
allowBlank: null_,
|
6071
|
xtype: 'minovafixvalue',
|
6072
|
readOnly: ReadOnly_,
|
6073
|
id: rec.TableName + rec.FieldName,
|
6074
|
name: rec.TableName + rec.FieldName,
|
6075
|
nameTable: rec.TableName,
|
6076
|
fieldGrid: rec.FieldName,
|
6077
|
fixedValue: rec.FixedValue,
|
6078
|
valueField: 'code',
|
6079
|
displayField: 'desc',
|
6080
|
value: rec.DefaultValue
|
6081
|
},
|
6082
|
renderer: function (value) {
|
6083
|
var val = "";
|
6084
|
var storeData = [];
|
6085
|
var str = rec.FixedValue;
|
6086
|
var hasil = str.split('||');
|
6087
|
hasil.forEach(function (h) {
|
6088
|
store_ = h.split('=')
|
6089
|
storeData.push({
|
6090
|
code: store_[0],
|
6091
|
desc: store_[1]
|
6092
|
});
|
6093
|
});
|
6094
|
var item = storeData.find(x => x.code == value);
|
6095
|
if (item != undefined) {
|
6096
|
val = item.desc;
|
6097
|
}
|
6098
|
return val;
|
6099
|
}
|
6100
|
});
|
6101
|
} else {
|
6102
|
cols.push({
|
6103
|
text: rec.HeaderTitle,
|
6104
|
hidden: Hidden_,
|
6105
|
dataIndex: rec.FieldName,
|
6106
|
filter: {
|
6107
|
itemDefaults: {
|
6108
|
emptyText: 'Search for...'
|
6109
|
}
|
6110
|
},
|
6111
|
editor: {
|
6112
|
allowBlank: null_,
|
6113
|
xtype: 'textfield',
|
6114
|
readOnly: ReadOnly_,
|
6115
|
id: tableName + rec.FieldName,
|
6116
|
nameTable: rec.TableName,
|
6117
|
fieldGrid: rec.FieldName,
|
6118
|
value: rec.DefaultValue,
|
6119
|
listeners: {
|
6120
|
change: function (val) {
|
6121
|
var custumFunc = null;
|
6122
|
Ext.Ajax.request({
|
6123
|
async: false,
|
6124
|
method: 'POST',
|
6125
|
url: '/UserControl/GetStore',
|
6126
|
params: {
|
6127
|
tableName: 'SDATATABLEFIELD',
|
6128
|
param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
|
6129
|
},
|
6130
|
success: function (response) {
|
6131
|
var results = Ext.decode(response.responseText);
|
6132
|
data_ = results.data[0];
|
6133
|
if (data_ != undefined) {
|
6134
|
custumFunc = data_.SelectFunction;
|
6135
|
//console.log(data_)
|
6136
|
}
|
6137
|
}
|
6138
|
});
|
6139
|
|
6140
|
if (custumFunc) {
|
6141
|
eval(custumFunc)
|
6142
|
}
|
6143
|
}
|
6144
|
}
|
6145
|
}
|
6146
|
});
|
6147
|
}
|
6148
|
break
|
6149
|
}
|
6150
|
} else {
|
6151
|
cols.push({
|
6152
|
text: rec.HeaderTitle,
|
6153
|
hidden: Hidden_,
|
6154
|
dataIndex: rec.FieldName,
|
6155
|
hidden: true,
|
6156
|
editor: {
|
6157
|
allowBlank: true,
|
6158
|
xtype: 'textfield',
|
6159
|
readOnly: ReadOnly_,
|
6160
|
id: tableName + rec.FieldName,
|
6161
|
nameTable: rec.TableName,
|
6162
|
fieldGrid: rec.FieldName,
|
6163
|
value: rec.DefaultValue
|
6164
|
},
|
6165
|
filter: {
|
6166
|
itemDefaults: {
|
6167
|
emptyText: 'Search for...'
|
6168
|
}
|
6169
|
}
|
6170
|
});
|
6171
|
}
|
6172
|
});
|
6173
|
|
6174
|
};
|
6175
|
addData = addData + "}";
|
6176
|
Ext.applyIf(me, {
|
6177
|
items: [{
|
6178
|
xtype: 'grid',
|
6179
|
id: gridName,
|
6180
|
name: gridName,
|
6181
|
height: height,
|
6182
|
addFlag: true,
|
6183
|
deleteFlag: true,
|
6184
|
store: Ext.create('Ext.data.Store', {
|
6185
|
storeId: storeID,
|
6186
|
fields: fieldStore,
|
6187
|
//groupField: 'QuestionGroup',
|
6188
|
grouper: {
|
6189
|
sortProperty: 'SeqQuest',
|
6190
|
groupFn: function (record) {
|
6191
|
return record.get('QuestionGroup');
|
6192
|
}
|
6193
|
},
|
6194
|
proxy: {
|
6195
|
method: 'POST',
|
6196
|
type: 'ajax',
|
6197
|
url: '',
|
6198
|
reader: {
|
6199
|
type: 'json',
|
6200
|
root: 'data'
|
6201
|
}
|
6202
|
}
|
6203
|
}),
|
6204
|
dockedItems: [{
|
6205
|
xtype: 'toolbar',
|
6206
|
items: [{
|
6207
|
text: 'Add',
|
6208
|
hidden: hide_,
|
6209
|
name: tableName + 'Add',
|
6210
|
iconCls: 'fa-plus-circle',
|
6211
|
style: 'font-family: FontAwesome',
|
6212
|
handler: function () {
|
6213
|
var grid = Ext.getCmp(gridName);
|
6214
|
if (grid.addFlag === true) {
|
6215
|
var store = Ext.StoreMgr.lookup(storeID)
|
6216
|
idx = store.getCount();
|
6217
|
var action = getParam('action');
|
6218
|
var data = '';
|
6219
|
var Sequence = 0;
|
6220
|
if (idx == 0) {
|
6221
|
Sequence = 1;
|
6222
|
} else {
|
6223
|
Sequence = 1 + idx;
|
6224
|
}
|
6225
|
var seq = 'Sequence';
|
6226
|
var SequenceValue = Sequence;
|
6227
|
eval(addData);
|
6228
|
data[seq] = SequenceValue;
|
6229
|
store.insert(idx, data);
|
6230
|
}
|
6231
|
}
|
6232
|
}, {
|
6233
|
text: 'Delete',
|
6234
|
hidden: hide_,
|
6235
|
name: tableName + 'DeleteText',
|
6236
|
iconCls: 'fa-trash-o',
|
6237
|
style: 'font-family: FontAwesome',
|
6238
|
handler: function () {
|
6239
|
var grid = Ext.getCmp(gridName);
|
6240
|
if (grid.deleteFlag === true) {
|
6241
|
var me = this,
|
6242
|
store = Ext.StoreMgr.lookup(storeID)
|
6243
|
var grid = Ext.getCmp(gridName);
|
6244
|
Ext.MessageBox.show({
|
6245
|
title: 'Remove tab',
|
6246
|
msg: "This will remove. Do you want to continue?",
|
6247
|
buttons: Ext.MessageBox.YESNO,
|
6248
|
fn: function (choice) {
|
6249
|
console.log(choice);
|
6250
|
if (choice === 'yes') {
|
6251
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
6252
|
if (selection) {
|
6253
|
store.remove(selection);
|
6254
|
}
|
6255
|
}
|
6256
|
}
|
6257
|
});
|
6258
|
}
|
6259
|
}
|
6260
|
}
|
6261
|
]
|
6262
|
}
|
6263
|
],
|
6264
|
columns: cols,
|
6265
|
selType: checkSelection,
|
6266
|
plugins: {
|
6267
|
ptype: 'rowediting',
|
6268
|
pluginId: 'rowEditing',
|
6269
|
clicksToEdit: 0,
|
6270
|
listeners: {}
|
6271
|
},
|
6272
|
features: features,
|
6273
|
viewConfig: {
|
6274
|
listeners: {
|
6275
|
refresh: function (dataview) {
|
6276
|
Ext.each(dataview.panel.columns, function (column) {
|
6277
|
column.autoSize();
|
6278
|
})
|
6279
|
}
|
6280
|
}
|
6281
|
}
|
6282
|
}
|
6283
|
]
|
6284
|
});
|
6285
|
me.callParent(arguments);
|
6286
|
}
|
6287
|
});
|
6288
|
Ext.define('MinovaUtil.MinovaES.MinovaWorkflowEditableGrid1', {
|
6289
|
extend: 'Ext.form.Panel',
|
6290
|
alias: ['widget.minovaworkfloweditablegrid1', 'widget.workfloweditablegrid1'],
|
6291
|
requires: [
|
6292
|
'Ext.grid.plugin.CellEditing',
|
6293
|
'Ext.grid.Panel',
|
6294
|
],
|
6295
|
anchor: '100%',
|
6296
|
tableName: undefined,
|
6297
|
hideButton: undefined,
|
6298
|
multiSelect: undefined,
|
6299
|
formname: this.name,
|
6300
|
bizprocid: undefined,
|
6301
|
bizflowid: undefined,
|
6302
|
taskid: undefined,
|
6303
|
initComponent: function () {
|
6304
|
var me = this;
|
6305
|
var hide_ = false;
|
6306
|
var widthLock = 250;
|
6307
|
var checkSelection = '';
|
6308
|
|
6309
|
if (me.hideButton == true) {
|
6310
|
hide_ = true;
|
6311
|
}
|
6312
|
if (me.multiSelect) {
|
6313
|
locking = false;
|
6314
|
checkSelection = 'checkboxmodel';
|
6315
|
widthLock = 40;
|
6316
|
}
|
6317
|
var tableName = me.tableName;
|
6318
|
var cols = [];
|
6319
|
var fieldStore = [];
|
6320
|
var _url = 'GetAllField';
|
6321
|
var hasil = null;
|
6322
|
var height = me.height;
|
6323
|
var storeID = 'store' + me.tableName;
|
6324
|
var gridName = 'grid' + me.name;
|
6325
|
if (me.storeName) {
|
6326
|
storeID = me.storeName;
|
6327
|
}
|
6328
|
var LangID = MinovaUtil.GetLangID();
|
6329
|
var parameter = "LangID='" + LangID + "',BizProcessID='" + me.bizprocid + "',TaskID='" + me.taskid + "',TableName='" + me.tableName + "'";
|
6330
|
Ext.Ajax.request({
|
6331
|
async: false,
|
6332
|
method: 'POST',
|
6333
|
url: '/UserControl/GetStore',
|
6334
|
params: {
|
6335
|
tableName: 'PDSWFSTRUCTUREFIELD',
|
6336
|
param: parameter
|
6337
|
},
|
6338
|
success: function (response) {
|
6339
|
var results = Ext.decode(response.responseText);
|
6340
|
hasil = results.data;
|
6341
|
}
|
6342
|
});
|
6343
|
if (hasil.length > 0) {
|
6344
|
Ext.each(hasil, function (rec) {
|
6345
|
fieldStore.push(rec.FieldName)
|
6346
|
var readonly = false;
|
6347
|
var ishidden = false;
|
6348
|
var allowblank = true;
|
6349
|
if (rec.IsReadOnly == '1') {
|
6350
|
readonly = true;
|
6351
|
}
|
6352
|
if (rec.IsRequired == '1') {
|
6353
|
allowblank = false;
|
6354
|
}
|
6355
|
if (rec.IsVisible == '1') {
|
6356
|
switch (rec.FormatRef) {
|
6357
|
case "date":
|
6358
|
cols.push({
|
6359
|
xtype: 'minovadatecolumn',
|
6360
|
text: rec.HeaderTitle,
|
6361
|
dataIndex: rec.FieldName,
|
6362
|
editor: {
|
6363
|
allowBlank: allowblank,
|
6364
|
xtype: 'datefield',
|
6365
|
hideMode: 'visibility',
|
6366
|
readOnly: readonly,
|
6367
|
name: 'grid' + tableName + rec.FieldName,
|
6368
|
id: 'grid' + tableName + rec.FieldName,
|
6369
|
value: rec.DefaultValue,
|
6370
|
formname: me.formname,
|
6371
|
listeners: {
|
6372
|
change: function (val) {
|
6373
|
var _label = val.name;
|
6374
|
var _form = val.formname;
|
6375
|
var _Value = val.getValue();
|
6376
|
var target = rec.TriggerCombo;
|
6377
|
var custumFunc = rec.SelectFunction;
|
6378
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
6379
|
Ext.Ajax.request({
|
6380
|
async: false,
|
6381
|
method: 'POST',
|
6382
|
url: '/UserControl/GetStore',
|
6383
|
params: {
|
6384
|
tableName: 'PCMFUNC',
|
6385
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
6386
|
},
|
6387
|
success: function (response) {
|
6388
|
var results = Ext.decode(response.responseText);
|
6389
|
data_ = results.data[0];
|
6390
|
if (data_ != undefined) {
|
6391
|
custumFunc = data_.FunctionCode;
|
6392
|
}
|
6393
|
}
|
6394
|
});
|
6395
|
}
|
6396
|
var frm = Ext.ComponentQuery.query('[name=' + _form + ']')[0];
|
6397
|
if (frm) {
|
6398
|
if (custumFunc) {
|
6399
|
eval(custumFunc)
|
6400
|
}
|
6401
|
}
|
6402
|
}
|
6403
|
}
|
6404
|
}
|
6405
|
});
|
6406
|
break;
|
6407
|
case "amount":
|
6408
|
cols.push({
|
6409
|
xtype: 'minovacurrancycolumn',
|
6410
|
align: 'right',
|
6411
|
text: rec.HeaderTitle,
|
6412
|
dataIndex: rec.FieldName,
|
6413
|
editor: {
|
6414
|
allowBlank: allowblank,
|
6415
|
xtype: 'textfield',
|
6416
|
readOnly: readonly,
|
6417
|
name: 'grid' + tableName + rec.FieldName,
|
6418
|
id: 'grid' + tableName + rec.FieldName,
|
6419
|
value: rec.DefaultValue
|
6420
|
}
|
6421
|
});
|
6422
|
break;
|
6423
|
case "time":
|
6424
|
cols.push({
|
6425
|
text: rec.HeaderTitle,
|
6426
|
dataIndex: rec.FieldName,
|
6427
|
editor: {
|
6428
|
allowBlank: allowblank,
|
6429
|
xtype: 'timefield',
|
6430
|
readOnly: readonly,
|
6431
|
name: 'grid' + tableName + rec.FieldName,
|
6432
|
id: 'grid' + tableName + rec.FieldName,
|
6433
|
msgTarget: 'side',
|
6434
|
format: 'Hi',
|
6435
|
submitFormat: 'Hi',
|
6436
|
increment: 5,
|
6437
|
value: rec.DefaultValue,
|
6438
|
formname: me.formname,
|
6439
|
listeners: {
|
6440
|
change: function (val) {
|
6441
|
var _label = val.name;
|
6442
|
var _form = val.formname;
|
6443
|
var _Value = val.getValue();
|
6444
|
var target = rec.TriggerCombo;
|
6445
|
var custumFunc = rec.SelectFunction;
|
6446
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
6447
|
Ext.Ajax.request({
|
6448
|
async: false,
|
6449
|
method: 'POST',
|
6450
|
url: '/UserControl/GetStore',
|
6451
|
params: {
|
6452
|
tableName: 'PCMFUNC',
|
6453
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
6454
|
},
|
6455
|
success: function (response) {
|
6456
|
var results = Ext.decode(response.responseText);
|
6457
|
data_ = results.data[0];
|
6458
|
if (data_ != undefined) {
|
6459
|
custumFunc = data_.FunctionCode;
|
6460
|
}
|
6461
|
}
|
6462
|
});
|
6463
|
}
|
6464
|
var frm = Ext.ComponentQuery.query('[name=' + _form + ']')[0];
|
6465
|
if (frm) {
|
6466
|
if (custumFunc) {
|
6467
|
eval(custumFunc)
|
6468
|
}
|
6469
|
}
|
6470
|
}
|
6471
|
}
|
6472
|
}
|
6473
|
});
|
6474
|
break;
|
6475
|
default:
|
6476
|
if (rec.SearchType != "") {
|
6477
|
if (rec.SearchType == "0") {
|
6478
|
var valueField = null;
|
6479
|
var displayValue = null;
|
6480
|
var TableRef = undefined;
|
6481
|
if (rec.TableRef != '') {
|
6482
|
TableRef = rec.TableRef;
|
6483
|
Ext.Ajax.request({
|
6484
|
async: false,
|
6485
|
method: 'POST',
|
6486
|
url: '/UserControl/GetStore',
|
6487
|
params: {
|
6488
|
tableName: 'SDATATABLEFIELD',
|
6489
|
param: 'TableName[equal]' + rec.TableRef
|
6490
|
},
|
6491
|
success: function (response) {
|
6492
|
var results = Ext.decode(response.responseText);
|
6493
|
data_ = results.data;
|
6494
|
if (data_ != undefined) {
|
6495
|
valueField_ = $.grep(data_, function (r) {
|
6496
|
return r.ValueField == '1'
|
6497
|
});
|
6498
|
valueField = valueField_[0].FieldName
|
6499
|
displayValue_ = $.grep(data_, function (r) {
|
6500
|
return r.DisplayValue == '1'
|
6501
|
});
|
6502
|
displayValue = displayValue_[0].FieldName
|
6503
|
}
|
6504
|
}
|
6505
|
});
|
6506
|
}
|
6507
|
//create Store
|
6508
|
Ext.create('Ext.data.Store', {
|
6509
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
6510
|
autoLoad: true,
|
6511
|
proxy: {
|
6512
|
method: 'POST',
|
6513
|
type: 'ajax',
|
6514
|
url: '/UserControl/GetStore',
|
6515
|
extraParams: {
|
6516
|
tableName: TableRef,
|
6517
|
param: rec.ParamCombo
|
6518
|
},
|
6519
|
reader: {
|
6520
|
type: 'json',
|
6521
|
root: 'data',
|
6522
|
totalProperty: 'data[0].TotalCount'
|
6523
|
}
|
6524
|
}
|
6525
|
});
|
6526
|
cols.push({
|
6527
|
xtype: 'minovacombocolumn',
|
6528
|
text: rec.HeaderTitle,
|
6529
|
dataIndex: rec.FieldName,
|
6530
|
valueField: valueField,
|
6531
|
displayField: displayValue,
|
6532
|
store: 'store_' + me.tableName + rec.FieldName,
|
6533
|
editor: {
|
6534
|
allowBlank: allowblank,
|
6535
|
xtype: 'combobox',
|
6536
|
readOnly: readonly,
|
6537
|
name: 'grid' + tableName + rec.FieldName,
|
6538
|
id: 'grid' + tableName + rec.FieldName,
|
6539
|
valueField: valueField,
|
6540
|
displayField: displayValue,
|
6541
|
store: 'store_' + me.tableName + rec.FieldName,
|
6542
|
value: rec.DefaultValue,
|
6543
|
formname: me.formname,
|
6544
|
listeners: {
|
6545
|
change: function (val) {
|
6546
|
var _label = val.name;
|
6547
|
var _form = val.formname;
|
6548
|
var _Value = val.getValue();
|
6549
|
var target = rec.TriggerCombo;
|
6550
|
var custumFunc = rec.SelectFunction;
|
6551
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
6552
|
Ext.Ajax.request({
|
6553
|
async: false,
|
6554
|
method: 'POST',
|
6555
|
url: '/UserControl/GetStore',
|
6556
|
params: {
|
6557
|
tableName: 'PCMFUNC',
|
6558
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
6559
|
},
|
6560
|
success: function (response) {
|
6561
|
var results = Ext.decode(response.responseText);
|
6562
|
data_ = results.data[0];
|
6563
|
if (data_ != undefined) {
|
6564
|
custumFunc = data_.FunctionCode;
|
6565
|
}
|
6566
|
}
|
6567
|
});
|
6568
|
}
|
6569
|
var frm = Ext.ComponentQuery.query('[name=' + _form + ']')[0];
|
6570
|
if (frm) {
|
6571
|
if (custumFunc) {
|
6572
|
eval(custumFunc)
|
6573
|
}
|
6574
|
}
|
6575
|
}
|
6576
|
}
|
6577
|
}
|
6578
|
});
|
6579
|
} else if (rec.SearchType == "2") {
|
6580
|
cols.push({
|
6581
|
text: rec.HeaderTitle,
|
6582
|
dataIndex: rec.FieldName,
|
6583
|
editor: {
|
6584
|
xtype: 'minovalookupgrid',
|
6585
|
allowBlank: allowblank,
|
6586
|
readOnly: readonly,
|
6587
|
msgTarget: 'side',
|
6588
|
labelCls: 'label-minova',
|
6589
|
labelWidth: 150,
|
6590
|
name: 'grid' + tableName + rec.FieldName,
|
6591
|
id: 'grid' + tableName + rec.FieldName,
|
6592
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
6593
|
triggerCls: 'x-form-search-trigger',
|
6594
|
vtype: 'alphanum', // disable space
|
6595
|
formtarget: me.formname, // nama form yang akan di set value-nya
|
6596
|
anchor: '100%',
|
6597
|
formname: me.formname,
|
6598
|
listeners: {
|
6599
|
change: function (val) {
|
6600
|
var _label = val.name;
|
6601
|
var _form = val.formname;
|
6602
|
var _Value = val.getValue();
|
6603
|
var target = rec.TriggerCombo;
|
6604
|
var custumFunc = rec.SelectFunction;
|
6605
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
6606
|
Ext.Ajax.request({
|
6607
|
async: false,
|
6608
|
method: 'POST',
|
6609
|
url: '/UserControl/GetStore',
|
6610
|
params: {
|
6611
|
tableName: 'PCMFUNC',
|
6612
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
6613
|
},
|
6614
|
success: function (response) {
|
6615
|
var results = Ext.decode(response.responseText);
|
6616
|
data_ = results.data[0];
|
6617
|
if (data_ != undefined) {
|
6618
|
custumFunc = data_.FunctionCode;
|
6619
|
}
|
6620
|
}
|
6621
|
});
|
6622
|
}
|
6623
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
6624
|
if (frm) {
|
6625
|
if (target) {
|
6626
|
var f = frm.getForm().findField(target)
|
6627
|
_store = f.getStore();
|
6628
|
var _tbl = _store.proxy.extraParams.tableName;
|
6629
|
var oldParam = _store.proxy.extraParams.param;
|
6630
|
_store.proxy.extraParams = {
|
6631
|
tableName: _tbl,
|
6632
|
param: _label + '[=]' + _Value
|
6633
|
};
|
6634
|
_store.load();
|
6635
|
}
|
6636
|
if (custumFunc) {
|
6637
|
eval(custumFunc)
|
6638
|
}
|
6639
|
|
6640
|
}
|
6641
|
|
6642
|
},
|
6643
|
|
6644
|
}
|
6645
|
}
|
6646
|
});
|
6647
|
} else if (rec.SearchType == "3") {
|
6648
|
cols.push({
|
6649
|
text: rec.HeaderTitle,
|
6650
|
dataIndex: rec.FieldName,
|
6651
|
editor: {
|
6652
|
xtype: 'minovalookuptree',
|
6653
|
allowBlank: allowblank,
|
6654
|
fieldLabel: rec.ScreenCaption,
|
6655
|
readOnly: readonly,
|
6656
|
labelCls: 'label-minova',
|
6657
|
labelWidth: 150,
|
6658
|
name: 'grid' + tableName + rec.FieldName,
|
6659
|
id: 'grid' + tableName + rec.FieldName,
|
6660
|
msgTarget: 'side',
|
6661
|
triggerCls: 'x-form-search-trigger',
|
6662
|
treeSructure: rec.SearchFunction, //'O-O-P',
|
6663
|
objClassValue: rec.ParamCombo, //'O',
|
6664
|
formname: me.formname,
|
6665
|
targetField: rec.FieldName,
|
6666
|
anchor: '100%',
|
6667
|
listeners: {
|
6668
|
change: function (val) {
|
6669
|
var _label = val.name;
|
6670
|
var _form = val.formname;
|
6671
|
var _Value = val.getValue();
|
6672
|
var target = rec.TriggerCombo;
|
6673
|
var custumFunc = rec.SelectFunction;
|
6674
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
6675
|
Ext.Ajax.request({
|
6676
|
async: false,
|
6677
|
method: 'POST',
|
6678
|
url: '/UserControl/GetStore',
|
6679
|
params: {
|
6680
|
tableName: 'PCMFUNC',
|
6681
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
6682
|
},
|
6683
|
success: function (response) {
|
6684
|
var results = Ext.decode(response.responseText);
|
6685
|
data_ = results.data[0];
|
6686
|
if (data_ != undefined) {
|
6687
|
custumFunc = data_.FunctionCode;
|
6688
|
}
|
6689
|
}
|
6690
|
});
|
6691
|
}
|
6692
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
6693
|
if (frm) {
|
6694
|
|
6695
|
if (target) {
|
6696
|
var f = frm.getForm().findField(target)
|
6697
|
_store = f.getStore();
|
6698
|
var _tbl = _store.proxy.extraParams.tableName;
|
6699
|
var oldParam = _store.proxy.extraParams.param;
|
6700
|
_store.proxy.extraParams = {
|
6701
|
tableName: _tbl,
|
6702
|
param: _label + '[=]' + _Value
|
6703
|
};
|
6704
|
_store.load();
|
6705
|
}
|
6706
|
if (custumFunc) {
|
6707
|
eval(custumFunc)
|
6708
|
}
|
6709
|
}
|
6710
|
}
|
6711
|
}
|
6712
|
}
|
6713
|
});
|
6714
|
} else if (rec.SearchType == "4") {
|
6715
|
cols.push({
|
6716
|
text: rec.HeaderTitle,
|
6717
|
dataIndex: rec.FieldName,
|
6718
|
editor: {
|
6719
|
xtype: 'lookupemployee',
|
6720
|
allowBlank: allowblank,
|
6721
|
fieldLabel: rec.ScreenCaption,
|
6722
|
readOnly: readonly,
|
6723
|
labelCls: 'label-minova',
|
6724
|
name: 'grid' + tableName + rec.FieldName,
|
6725
|
id: 'grid' + tableName + rec.FieldName,
|
6726
|
msgTarget: 'side',
|
6727
|
fieldname: rec.FieldName,
|
6728
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
6729
|
triggerCls: 'x-form-search-trigger',
|
6730
|
vtype: 'alphanum', // disable space
|
6731
|
formtarget: formname, // nama form yang akan di set value-nya
|
6732
|
isLookup: isLookup,
|
6733
|
anchor: '100%',
|
6734
|
formname: formname,
|
6735
|
listeners: {
|
6736
|
change: function (val) {
|
6737
|
var _label = val.name;
|
6738
|
var _form = val.formname;
|
6739
|
var _Value = val.getValue();
|
6740
|
var target = rec.TriggerCombo;
|
6741
|
var custumFunc = rec.SelectFunction;
|
6742
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
6743
|
Ext.Ajax.request({
|
6744
|
async: false,
|
6745
|
method: 'POST',
|
6746
|
url: '/UserControl/GetStore',
|
6747
|
params: {
|
6748
|
tableName: 'PCMFUNC',
|
6749
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
6750
|
},
|
6751
|
success: function (response) {
|
6752
|
var results = Ext.decode(response.responseText);
|
6753
|
data_ = results.data[0];
|
6754
|
if (data_ != undefined) {
|
6755
|
custumFunc = data_.FunctionCode;
|
6756
|
}
|
6757
|
}
|
6758
|
});
|
6759
|
}
|
6760
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
6761
|
if (frm) {
|
6762
|
|
6763
|
if (target) {
|
6764
|
var f = frm.getForm().findField(target)
|
6765
|
_store = f.getStore();
|
6766
|
var _tbl = _store.proxy.extraParams.tableName;
|
6767
|
var oldParam = _store.proxy.extraParams.param;
|
6768
|
_store.proxy.extraParams = {
|
6769
|
tableName: _tbl,
|
6770
|
param: _label + '[=]' + _Value
|
6771
|
};
|
6772
|
_store.load();
|
6773
|
}
|
6774
|
if (custumFunc) {
|
6775
|
eval(custumFunc)
|
6776
|
}
|
6777
|
|
6778
|
}
|
6779
|
|
6780
|
},
|
6781
|
|
6782
|
},
|
6783
|
}
|
6784
|
});
|
6785
|
}
|
6786
|
} else {
|
6787
|
if (rec.FixedValue != "") {
|
6788
|
var storeData = [];
|
6789
|
var str = rec.FixedValue;
|
6790
|
var hasil = str.split('||');
|
6791
|
hasil.forEach(function (h) {
|
6792
|
store_ = h.split('=')
|
6793
|
storeData.push({
|
6794
|
code: store_[0],
|
6795
|
desc: store_[1],
|
6796
|
});
|
6797
|
});
|
6798
|
cols.push({
|
6799
|
xtype: 'minovacombocolumn',
|
6800
|
text: rec.HeaderTitle,
|
6801
|
dataIndex: rec.FieldName,
|
6802
|
valueField: valueField,
|
6803
|
displayField: displayValue,
|
6804
|
store: Ext.create('Ext.data.Store', {
|
6805
|
storeId: 'store' + rec.FieldName,
|
6806
|
autoLoad: true,
|
6807
|
data: storeData
|
6808
|
|
6809
|
}),
|
6810
|
editor: {
|
6811
|
xtype: 'combobox',
|
6812
|
allowBlank: allowblank,
|
6813
|
forceSelection: true,
|
6814
|
readOnly: readonly,
|
6815
|
labelCls: 'label-minova',
|
6816
|
labelWidth: 150,
|
6817
|
name: 'grid' + tableName + rec.FieldName,
|
6818
|
id: 'grid' + tableName + rec.FieldName,
|
6819
|
msgTarget: 'side',
|
6820
|
value: rec.DefaultValue,
|
6821
|
anchor: '100%',
|
6822
|
formname: me.formname,
|
6823
|
formtarget: me.formname,
|
6824
|
store: Ext.create('Ext.data.Store', {
|
6825
|
storeId: 'store' + rec.FieldName,
|
6826
|
autoLoad: true,
|
6827
|
data: storeData
|
6828
|
|
6829
|
}),
|
6830
|
listeners: {
|
6831
|
change: function (val) {
|
6832
|
var _label = val.name;
|
6833
|
var _form = val.formtarget;
|
6834
|
var _Value = val.getValue();
|
6835
|
var target = rec.TriggerCombo;
|
6836
|
var custumFunc = rec.SelectFunction;
|
6837
|
var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
|
6838
|
if (frm) {
|
6839
|
if (target) {
|
6840
|
var f = frm.getForm().findField(target)
|
6841
|
_store = f.getStore();
|
6842
|
var _tbl = _store.proxy.extraParams.tableName;
|
6843
|
var oldParam = _store.proxy.extraParams.param;
|
6844
|
_store.proxy.extraParams = {
|
6845
|
tableName: _tbl,
|
6846
|
param: _label + '[=]' + _Value
|
6847
|
};
|
6848
|
_store.load();
|
6849
|
}
|
6850
|
if (custumFunc) {
|
6851
|
eval(custumFunc)
|
6852
|
}
|
6853
|
}
|
6854
|
}
|
6855
|
},
|
6856
|
queryMode: 'local',
|
6857
|
valueField: 'code',
|
6858
|
displayField: 'desc',
|
6859
|
}
|
6860
|
})
|
6861
|
} else {
|
6862
|
cols.push({
|
6863
|
text: rec.HeaderTitle,
|
6864
|
dataIndex: rec.FieldName,
|
6865
|
editor: {
|
6866
|
allowBlank: allowblank,
|
6867
|
xtype: 'textfield',
|
6868
|
readOnly: readonly,
|
6869
|
name: 'grid' + tableName + rec.FieldName,
|
6870
|
id: 'grid' + tableName + rec.FieldName,
|
6871
|
value: rec.DefaultValue
|
6872
|
}
|
6873
|
});
|
6874
|
}
|
6875
|
}
|
6876
|
break;
|
6877
|
}
|
6878
|
} else {
|
6879
|
cols.push({
|
6880
|
text: rec.HeaderTitle,
|
6881
|
dataIndex: rec.FieldName,
|
6882
|
hidden: true,
|
6883
|
editor: {
|
6884
|
allowBlank: true,
|
6885
|
xtype: 'textfield',
|
6886
|
readOnly: false,
|
6887
|
name: 'grid' + tableName + rec.FieldName,
|
6888
|
id: 'grid' + tableName + rec.FieldName,
|
6889
|
}
|
6890
|
});
|
6891
|
}
|
6892
|
});
|
6893
|
};
|
6894
|
|
6895
|
this.editing = Ext.create('Ext.grid.plugin.CellEditing');
|
6896
|
Ext.applyIf(me, {
|
6897
|
items: [{
|
6898
|
xtype: 'grid',
|
6899
|
id: gridName,
|
6900
|
name: gridName,
|
6901
|
height: height,
|
6902
|
store: Ext.create('Ext.data.Store', {
|
6903
|
storeId: storeID,
|
6904
|
fields: fieldStore,
|
6905
|
proxy: {
|
6906
|
method: 'POST',
|
6907
|
type: 'ajax',
|
6908
|
url: '',
|
6909
|
reader: {
|
6910
|
type: 'json',
|
6911
|
root: 'data'
|
6912
|
}
|
6913
|
}
|
6914
|
}),
|
6915
|
dockedItems: [{
|
6916
|
xtype: 'toolbar',
|
6917
|
items: [{
|
6918
|
text: 'Add',
|
6919
|
hidden: hide_,
|
6920
|
name: tableName + 'Add',
|
6921
|
iconCls: 'fa-plus-circle',
|
6922
|
style: 'font-family: FontAwesome',
|
6923
|
handler: function () {
|
6924
|
var store = Ext.StoreMgr.lookup(storeID)
|
6925
|
idx = store.getCount();
|
6926
|
var action = getParam('action');
|
6927
|
var data = '';
|
6928
|
var Sequence = 0;
|
6929
|
if (idx == 0) {
|
6930
|
Sequence = 1;
|
6931
|
} else {
|
6932
|
Sequence = 1 + idx;
|
6933
|
}
|
6934
|
data = {
|
6935
|
Sequence: Sequence
|
6936
|
};
|
6937
|
store.insert(idx, data);
|
6938
|
}
|
6939
|
}, {
|
6940
|
text: 'Delete',
|
6941
|
hidden: hide_,
|
6942
|
name: tableName + 'DeleteText',
|
6943
|
iconCls: 'fa-trash-o',
|
6944
|
style: 'font-family: FontAwesome',
|
6945
|
handler: function () {
|
6946
|
var me = this,
|
6947
|
store = Ext.StoreMgr.lookup(storeID);
|
6948
|
var grid = Ext.getCmp(gridName);
|
6949
|
Ext.MessageBox.show({
|
6950
|
title: 'Remove tab',
|
6951
|
msg: "This will remove. Do you want to continue?",
|
6952
|
buttons: Ext.MessageBox.YESNO,
|
6953
|
fn: function (choice) {
|
6954
|
console.log(choice);
|
6955
|
if (choice === 'yes') {
|
6956
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
6957
|
if (selection) {
|
6958
|
store.remove(selection);
|
6959
|
}
|
6960
|
}
|
6961
|
}
|
6962
|
});
|
6963
|
}
|
6964
|
}
|
6965
|
]
|
6966
|
}
|
6967
|
],
|
6968
|
columns: cols,
|
6969
|
selType: checkSelection,
|
6970
|
plugins: [this.editing],
|
6971
|
// plugins: {
|
6972
|
// ptype: 'rowediting',
|
6973
|
// pluginId: 'rowEditing',
|
6974
|
// clicksToEdit: 0,
|
6975
|
// listeners: {
|
6976
|
// }
|
6977
|
// }
|
6978
|
}
|
6979
|
]
|
6980
|
});
|
6981
|
me.callParent(arguments);
|
6982
|
}
|
6983
|
});
|
6984
|
Ext.define('MinovaUtil.MinovaES.MinovaForm', {
|
6985
|
extend: 'Ext.form.Panel',
|
6986
|
alias: ['widget.minovaForm', 'widget.minovaform'],
|
6987
|
tableName: undefined,
|
6988
|
param: undefined,
|
6989
|
titleform: undefined,
|
6990
|
formname: this.name,
|
6991
|
isLookup: undefined,
|
6992
|
hidebutton: undefined,
|
6993
|
//frame: true,
|
6994
|
resizable: true,
|
6995
|
border: false,
|
6996
|
autoScroll: true,
|
6997
|
minHeight: 20,
|
6998
|
layout: 'column',
|
6999
|
submitproc: undefined, //true if stil edit ,add
|
7000
|
actionsubmit: undefined,
|
7001
|
iseditform: undefined,
|
7002
|
isFormReadOnly: undefined, // true== form di read only default false
|
7003
|
isDisplay: undefined, // true if display only and false or undefined or empety if form can be edit
|
7004
|
searchcustomization: undefined,
|
7005
|
getIsFormReadOnly: function () {
|
7006
|
return this.isFormReadOnly;
|
7007
|
},
|
7008
|
setIsFormReadOnly: function (value) {
|
7009
|
var me = this;
|
7010
|
me.isFormReadOnly = value;
|
7011
|
return me;
|
7012
|
},
|
7013
|
getIsEditform: function () {
|
7014
|
return this.iseditform;
|
7015
|
},
|
7016
|
setIsEditform: function (value) {
|
7017
|
var me = this;
|
7018
|
me.iseditform = value;
|
7019
|
return me;
|
7020
|
},
|
7021
|
getActionSubmit: function () {
|
7022
|
return this.actionsubmit;
|
7023
|
},
|
7024
|
setActionSubmit: function (value) {
|
7025
|
var me = this;
|
7026
|
me.actionsubmit = value;
|
7027
|
return me;
|
7028
|
},
|
7029
|
getSubmitProc: function () {
|
7030
|
return this.submitnproc;
|
7031
|
},
|
7032
|
setSubmitProc: function (value) {
|
7033
|
var me = this;
|
7034
|
me.submitnproc = value;
|
7035
|
return me;
|
7036
|
},
|
7037
|
listeners: {
|
7038
|
render: function () {
|
7039
|
if (this.isLookup == 1 || this.isLookup == 'Y' || this.hidebutton == 1 || this.hidebutton == 'Y') {
|
7040
|
var v = Ext.ComponentQuery.query('[name=formLookupFilter]')[0];
|
7041
|
if (v) {
|
7042
|
v.setMaxHeight(200);
|
7043
|
}
|
7044
|
|
7045
|
}
|
7046
|
if (this.titleform != undefined) {
|
7047
|
this.setTitle(this.titleform);
|
7048
|
}
|
7049
|
},
|
7050
|
|
7051
|
},
|
7052
|
defaults: {
|
7053
|
layout: 'form',
|
7054
|
xtype: 'container',
|
7055
|
defaultType: 'textfield',
|
7056
|
style: 'width: 50%',
|
7057
|
//height: 1000
|
7058
|
},
|
7059
|
initComponent: function () {
|
7060
|
var col1 = [];
|
7061
|
var col2 = [];
|
7062
|
var me = this;
|
7063
|
LangID = localStorage.LangId;
|
7064
|
isLookup = me.isLookup;
|
7065
|
//var _url = 'GetAllField';
|
7066
|
|
7067
|
if (isLookup == 1 || isLookup == true || isLookup == 'Y') {}
|
7068
|
isDisplay = me.isDisplay;
|
7069
|
var hasil = null;
|
7070
|
//hamid 200916
|
7071
|
//Ext.Ajax.request({
|
7072
|
// async : false,
|
7073
|
// method : 'POST',
|
7074
|
// url : '/Devt/' + _url + '?tableName=' + me.tableName,
|
7075
|
// success : function (response) {
|
7076
|
// var results = Ext.decode(response.responseText);
|
7077
|
// hasil = results.data;
|
7078
|
// }
|
7079
|
//});
|
7080
|
//end
|
7081
|
|
7082
|
|
7083
|
//hamid
|
7084
|
//if (me.isLookup == 1 || isLookup == true || isLookup == 'Y') {
|
7085
|
parameter = null;
|
7086
|
if (me.isLookup == true || isLookup == 1 || isLookup == 'Y') {
|
7087
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupFilter='1'"
|
7088
|
} else if (me.searchcustomization == true) {
|
7089
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',IsCustomizationFilter='1'"
|
7090
|
} else {
|
7091
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
|
7092
|
}
|
7093
|
Ext.Ajax.request({
|
7094
|
async: false,
|
7095
|
method: 'POST',
|
7096
|
url: '/UserControl/GetStore',
|
7097
|
params: {
|
7098
|
tableName: 'PDSBS0007',
|
7099
|
param: parameter
|
7100
|
},
|
7101
|
success: function (response) {
|
7102
|
var results = Ext.decode(response.responseText);
|
7103
|
hasil = results.data;
|
7104
|
}
|
7105
|
});
|
7106
|
//end
|
7107
|
if (hasil.length > 0) {
|
7108
|
// hasil = hasil.sort(MinovaUtil.SortBy("Sequence"))
|
7109
|
var me = this;
|
7110
|
Ext.each(hasil, function (rec) {
|
7111
|
var null_ = null;
|
7112
|
if (rec.IsPrimaryKey == true) {
|
7113
|
null_ = false;
|
7114
|
}
|
7115
|
if (rec.IsRequired == true) {
|
7116
|
null_ = false;
|
7117
|
} else {
|
7118
|
null_ = true;
|
7119
|
}
|
7120
|
var formfield = MinovaUtil.FieldGenerator.Form(me.name, rec, null_, isDisplay, me.tableName, me.isLookup);
|
7121
|
var descField = undefined;
|
7122
|
//if (isDisplay == true && rec.SearchType !='') {
|
7123
|
// descField = new Ext.form.Display({
|
7124
|
// fieldCode:'codeDisplay'+rec.name+rec.tableName,
|
7125
|
// allowBlank: true,
|
7126
|
// fieldLabel: 'Desc ' + rec.ScreenCaption,
|
7127
|
// readOnly: true,
|
7128
|
// maxLength: rec.Length,
|
7129
|
// anchor: '100%',
|
7130
|
// submitValue: false
|
7131
|
// });
|
7132
|
//}
|
7133
|
//else {
|
7134
|
// if (rec.SearchType == '2') {// lookup
|
7135
|
// descField = new Ext.form.TextField({
|
7136
|
// fieldCode: 'codeEdit' + rec.name + rec.tableName,
|
7137
|
// allowBlank: true,
|
7138
|
// fieldLabel: 'Desc ' + rec.ScreenCaption,
|
7139
|
// readOnly: true,
|
7140
|
// maxLength: rec.Length,
|
7141
|
// anchor: '100%',
|
7142
|
// submitValue: false
|
7143
|
// });
|
7144
|
// }
|
7145
|
// if (rec.SearchType == '3') {// tree
|
7146
|
// descField = new Ext.form.TextField({
|
7147
|
// fieldCode: 'codeEdit' + rec.name + rec.tableName,
|
7148
|
// allowBlank: true,
|
7149
|
// fieldLabel: 'Desc ' + rec.ScreenCaption,
|
7150
|
// readOnly: true,
|
7151
|
// maxLength: rec.Length,
|
7152
|
// anchor: '100%',
|
7153
|
// submitValue: false
|
7154
|
// });
|
7155
|
// }
|
7156
|
// if (rec.SearchType == '4' && me.isLookup != true) {
|
7157
|
// descField = new Ext.form.TextField({
|
7158
|
// fieldCode: 'codeEdit' + rec.name + rec.tableName,
|
7159
|
// allowBlank: true,
|
7160
|
// fieldLabel: 'Full Name',
|
7161
|
// readOnly: true,
|
7162
|
// maxLength: rec.Length,
|
7163
|
// anchor: '100%',
|
7164
|
// submitValue: false
|
7165
|
// });
|
7166
|
// }
|
7167
|
|
7168
|
//}
|
7169
|
|
7170
|
if (me.isLookup == true || isLookup == 1 || isLookup == 'Y') {
|
7171
|
col1.push(formfield);
|
7172
|
if (descField) {
|
7173
|
col1.push(descField)
|
7174
|
}
|
7175
|
} else {
|
7176
|
if (isDesk) {
|
7177
|
if (rec.ColumnNo == 1) {
|
7178
|
col1.push(formfield);
|
7179
|
if (descField) {
|
7180
|
col1.push(descField)
|
7181
|
}
|
7182
|
} else {
|
7183
|
col2.push(formfield);
|
7184
|
if (descField) {
|
7185
|
col2.push(descField)
|
7186
|
}
|
7187
|
}
|
7188
|
} else {
|
7189
|
col1.push(formfield);
|
7190
|
if (descField) {
|
7191
|
col1.push(descField)
|
7192
|
}
|
7193
|
}
|
7194
|
|
7195
|
}
|
7196
|
|
7197
|
if (rec.IsPrimaryKey == 1 && me.isLookup == undefined) {
|
7198
|
formfieldKey = new Ext.form.TextField({
|
7199
|
hidden: true,
|
7200
|
name: "Key_" + rec.FieldName,
|
7201
|
});
|
7202
|
col2.push(formfieldKey);
|
7203
|
}
|
7204
|
|
7205
|
});
|
7206
|
//console.log(col1);
|
7207
|
}
|
7208
|
Ext.applyIf(me, {
|
7209
|
items: [{
|
7210
|
//width: 450,
|
7211
|
style: 'width: 50%',
|
7212
|
items: col1
|
7213
|
}, {
|
7214
|
//width: 450,
|
7215
|
style: 'width: 50%',
|
7216
|
items: col2
|
7217
|
}
|
7218
|
],
|
7219
|
});
|
7220
|
this.callParent();
|
7221
|
}
|
7222
|
});
|
7223
|
|
7224
|
Ext.define('MinovaUtil.MinovaES.MinovaGridForm', {
|
7225
|
extend: 'Ext.form.Panel',
|
7226
|
alias: ['widget.minovagridform', 'widget.MinovaGridForm'],
|
7227
|
tableName: undefined, //nama tabel
|
7228
|
param: undefined, //param query
|
7229
|
pagesize: undefined,
|
7230
|
storename: undefined,
|
7231
|
titleform: undefined,
|
7232
|
titlegrid: undefined,
|
7233
|
heightgrid: undefined,
|
7234
|
heightform: undefined,
|
7235
|
iseditform: undefined,
|
7236
|
lastheightform: undefined,
|
7237
|
layoutType: undefined,
|
7238
|
lastpage: undefined,
|
7239
|
lastTitle: undefined,
|
7240
|
getLastTitle: function () {
|
7241
|
return this.lastTitle;
|
7242
|
},
|
7243
|
setLastTitle: function (value) {
|
7244
|
var me = this;
|
7245
|
me.lastTitle = value;
|
7246
|
return me;
|
7247
|
},
|
7248
|
getLastpage: function () {
|
7249
|
return this.lastpage;
|
7250
|
},
|
7251
|
setLastpage: function (value) {
|
7252
|
var me = this;
|
7253
|
me.lastpage = value;
|
7254
|
return me;
|
7255
|
},
|
7256
|
getLayoutType: function () {
|
7257
|
return this.layoutType;
|
7258
|
},
|
7259
|
setLayoutType: function (value) {
|
7260
|
var me = this;
|
7261
|
me.layoutType = value;
|
7262
|
return me;
|
7263
|
},
|
7264
|
getLastheightform: function () {
|
7265
|
return this.lastheightform;
|
7266
|
},
|
7267
|
setLastheightform: function (value) {
|
7268
|
var me = this;
|
7269
|
me.lastheightform = value;
|
7270
|
return me;
|
7271
|
},
|
7272
|
|
7273
|
getIsEditform: function () {
|
7274
|
return this.iseditform;
|
7275
|
},
|
7276
|
setIsEditform: function (value) {
|
7277
|
var me = this;
|
7278
|
me.iseditform = value;
|
7279
|
return me;
|
7280
|
},
|
7281
|
initComponent: function () {
|
7282
|
var me = this;
|
7283
|
var storename = me.storename;
|
7284
|
if (storename == "" || storename == undefined) {
|
7285
|
storename = "store" + me.tableName;
|
7286
|
}
|
7287
|
var tableName = me.tableName;
|
7288
|
Ext.applyIf(me, {
|
7289
|
items: [{
|
7290
|
layoutType: "MinovaGridForm",
|
7291
|
title: me.titlegrid,
|
7292
|
xtype: "minovagrid",
|
7293
|
tableName: tableName, // nama tebel/dataset
|
7294
|
name: "MinovaGridFormGrid" + tableName, //name bebeas
|
7295
|
param: me.param, // parameter filteran
|
7296
|
pagesize: me.pagesize, // jumlah record yang muncul per page
|
7297
|
storename: storename, //nama store bebas
|
7298
|
isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
|
7299
|
height: 330,
|
7300
|
bodyPadding: 0,
|
7301
|
dockedItems: [{
|
7302
|
xtype: 'pagingtoolbar',
|
7303
|
store: storename, // harus sama dengan naa store diatas
|
7304
|
dock: 'bottom', //posisi paging
|
7305
|
pageSize: me.pagesize,
|
7306
|
displayInfo: true
|
7307
|
}
|
7308
|
],
|
7309
|
|
7310
|
listeners: {
|
7311
|
viewready: function () {
|
7312
|
//alert('ready')
|
7313
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + this.tableName + ']')[0];
|
7314
|
formEdit.setHidden(true);
|
7315
|
|
7316
|
if (MinovaUtil.GetActionMenu() == 0 || MinovaUtil.GetActionMenu() == undefined || MinovaUtil.GetActionMenu() == "") {
|
7317
|
Ext.ComponentQuery.query('[name=actionBtn]')[0].setHidden(true)
|
7318
|
Ext.ComponentQuery.query('[name=Edit' + me.tableName + ']')[0].setHidden(true)
|
7319
|
Ext.ComponentQuery.query('[name=Delete_]')[0].setHidden(true)
|
7320
|
} else {
|
7321
|
Ext.ComponentQuery.query('[name=actionBtn]')[0].setHidden(false)
|
7322
|
//Ext.ComponentQuery.query('[name=Edit_]')[0].setHidden(true)
|
7323
|
Ext.ComponentQuery.query('[name=Delete_]')[0].setHidden(true)
|
7324
|
Ext.ComponentQuery.query('[name=Edit' + me.tableName + ']')[0].setHidden(false)
|
7325
|
}
|
7326
|
},
|
7327
|
selectionchange: function () {
|
7328
|
//case md
|
7329
|
var layout = null;
|
7330
|
var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
|
7331
|
if (pnl) {
|
7332
|
layout = pnl.getLayoutType();
|
7333
|
|
7334
|
}
|
7335
|
//end case
|
7336
|
|
7337
|
if (layout == 'L003') {
|
7338
|
var selection = this.getView().getSelectionModel().getSelection()[0];
|
7339
|
var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + this.tableName + ']')[0];
|
7340
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + this.tableName + ']')[0];
|
7341
|
if (selection) {
|
7342
|
formDisplay.getForm().setValues(selection.data);
|
7343
|
formEdit.getForm().setValues(selection.data);
|
7344
|
}
|
7345
|
|
7346
|
}
|
7347
|
},
|
7348
|
itemdblclick: function () {
|
7349
|
var me = this;
|
7350
|
//case md
|
7351
|
var layout = null;
|
7352
|
var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
|
7353
|
if (pnl) {
|
7354
|
layout = pnl.getLayoutType();
|
7355
|
|
7356
|
} else {
|
7357
|
pnl = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
|
7358
|
layout = pnl.getLayoutType();
|
7359
|
}
|
7360
|
//end case
|
7361
|
var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + this.tableName + ']')[0];
|
7362
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + this.tableName + ']')[0];
|
7363
|
var submit_ = formEdit.getSubmitProc();
|
7364
|
var selection = me.getView().getSelectionModel().getSelection()[0];
|
7365
|
if (submit_ == undefined) {
|
7366
|
submit_ = false;
|
7367
|
}
|
7368
|
if (submit_ == false) {
|
7369
|
|
7370
|
formDisplay.getForm().setValues(selection.data);
|
7371
|
formEdit.getForm().setValues(selection.data);
|
7372
|
if (layout == 'L003') {
|
7373
|
formDisplay.setHidden(false);
|
7374
|
Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + this.tableName + ']')[0].setHidden(true);
|
7375
|
var heigh = pnl.getLastheightform();
|
7376
|
|
7377
|
var pDetail = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
|
7378
|
if (pDetail) {
|
7379
|
pDetail.setHeight(heigh + 100);
|
7380
|
} else {
|
7381
|
pDetail = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0];
|
7382
|
var mainPnl_ = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]
|
7383
|
var mainPnl = mainPnl_.getHeight();
|
7384
|
//pDetail.setHeight(mainPnl + 100);
|
7385
|
|
7386
|
}
|
7387
|
} else {
|
7388
|
formDisplay.setTitle("View")
|
7389
|
formEdit.setTitle("Edit")
|
7390
|
}
|
7391
|
} else {
|
7392
|
alert('still process')
|
7393
|
}
|
7394
|
|
7395
|
},
|
7396
|
beforeedit: function () {
|
7397
|
return false;
|
7398
|
}
|
7399
|
}
|
7400
|
}, {
|
7401
|
xtype: 'minovaform',
|
7402
|
name: "MinovaGridFormDisplay" + tableName,
|
7403
|
tableName: tableName, // nama tabel /dataset
|
7404
|
isLookup: '', // 1 or 'Y' for lookup
|
7405
|
isDisplay: true, // true== form is displayfield
|
7406
|
buttons: [{
|
7407
|
text: 'Edit',
|
7408
|
name: 'Edit' + tableName,
|
7409
|
iconCls: 'fa-edit',
|
7410
|
style: 'font-family: FontAwesome',
|
7411
|
handler: function () {
|
7412
|
|
7413
|
f = this.up().up();
|
7414
|
f.setSubmitProc(false);
|
7415
|
f.setHidden(true);
|
7416
|
//f.setActionSubmit(1);
|
7417
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(true);
|
7418
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0];
|
7419
|
formEdit.setSubmitProc(true);
|
7420
|
formEdit.setHidden(false);
|
7421
|
formEdit.setActionSubmit(1);
|
7422
|
var p = Ext.ComponentQuery.query('[name=DetailMD]')[0];
|
7423
|
if (p) {
|
7424
|
var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
|
7425
|
var lastTitile = p.getTitle();
|
7426
|
pnl.setLastTitle(lastTitile);
|
7427
|
p.setTitle('Edit - ' + lastTitile)
|
7428
|
|
7429
|
}
|
7430
|
|
7431
|
}
|
7432
|
}, {
|
7433
|
text: 'Back to Grid',
|
7434
|
name: 'Edit' + tableName,
|
7435
|
iconCls: 'fa-reply',
|
7436
|
style: 'font-family: FontAwesome',
|
7437
|
handler: function () {
|
7438
|
var layout = null;
|
7439
|
var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
|
7440
|
if (pnl) {
|
7441
|
layout = pnl.getLayoutType();
|
7442
|
|
7443
|
}
|
7444
|
|
7445
|
f = this.up().up();
|
7446
|
f.setSubmitProc(false);
|
7447
|
f.setHidden(true);
|
7448
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(false);
|
7449
|
Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0].setHidden(true);
|
7450
|
|
7451
|
if (layout == 'L003') {
|
7452
|
var grid_ = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + f.tableName + ']')[0];
|
7453
|
grid_.setHidden(false);
|
7454
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(true);
|
7455
|
Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(grid_.getHeight() + 100)
|
7456
|
}
|
7457
|
}
|
7458
|
}
|
7459
|
],
|
7460
|
}, {
|
7461
|
xtype: 'minovaform',
|
7462
|
name: "MinovaGridFormEdit" + tableName,
|
7463
|
tableName: tableName, // nama tabel /dataset
|
7464
|
isLookup: '', // 1 or 'Y' for lookup
|
7465
|
isDisplay: false, // true== form is displayfield
|
7466
|
buttons: [{
|
7467
|
text: 'Save',
|
7468
|
name: 'btnSaveMD',
|
7469
|
name: 'Save' + tableName,
|
7470
|
iconCls: 'fa-save',
|
7471
|
style: 'font-family: FontAwesome',
|
7472
|
handler: function () {
|
7473
|
f = this.up().up();
|
7474
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0];
|
7475
|
|
7476
|
if (formEdit.getForm().isValid()) {
|
7477
|
|
7478
|
if (Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]) {
|
7479
|
var action_ = formEdit.getActionSubmit();
|
7480
|
var main_ = Ext.ComponentQuery.query('[name=mainORM]')[0];
|
7481
|
var record = main_.getRecordSelect();
|
7482
|
|
7483
|
if (record == undefined) {
|
7484
|
var treeDetail = Ext.ComponentQuery.query('[name=treeDetail]')[0];
|
7485
|
treeDetail.getSelectionModel().select(0);
|
7486
|
record = treeDetail.getView().getSelectionModel().getSelection()[0];
|
7487
|
|
7488
|
}
|
7489
|
var frmValue = formEdit.getValues();
|
7490
|
var InitStartDate = 'InitStartDate';
|
7491
|
var InitStartDateValue = record.get('StartDate');
|
7492
|
frmValue[InitStartDate] = InitStartDateValue;
|
7493
|
|
7494
|
var InitEndDate = 'InitEndDate';
|
7495
|
var InitEndDateValue = record.get('EndDate');
|
7496
|
frmValue[InitEndDate] = InitEndDateValue;
|
7497
|
|
7498
|
var InitParentObject = 'InitParentObject';
|
7499
|
var InitParentObjectValue = record.get('ObjectId');
|
7500
|
if (InitParentObjectValue == undefined) {
|
7501
|
InitParentObjectValue = "";
|
7502
|
}
|
7503
|
frmValue[InitParentObject] = InitParentObjectValue;
|
7504
|
|
7505
|
var InitParentClass = 'InitParentClass';
|
7506
|
var InitParentClassValue = record.get('ObjectType');
|
7507
|
if (InitParentClassValue == undefined) {
|
7508
|
InitParentClassValue = "";
|
7509
|
}
|
7510
|
frmValue[InitParentClass] = InitParentClassValue;
|
7511
|
var frmValue_ = Ext.encode(frmValue);
|
7512
|
|
7513
|
Ext.Ajax.request({
|
7514
|
method: 'POST',
|
7515
|
url: '/Devt/SaveMaintainORM',
|
7516
|
params: {
|
7517
|
tableName: f.tableName,
|
7518
|
data: frmValue_,
|
7519
|
action: action_,
|
7520
|
/*
|
7521
|
InitStartDate: InitStartDate,
|
7522
|
InitEndaDate: InitEndaDate,
|
7523
|
InitParentObject: InitParentObject,
|
7524
|
InitParentClass: InitParentClass
|
7525
|
*/
|
7526
|
},
|
7527
|
waitMsg: 'Saving Data...',
|
7528
|
success: function (response) {
|
7529
|
var result = Ext.decode(response.responseText);
|
7530
|
if (result.success) {
|
7531
|
MinovaMessage('Not Null', '000006', '', 'S')
|
7532
|
|
7533
|
var pnl = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
|
7534
|
if (pnl) {
|
7535
|
Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0].setHeight(394);
|
7536
|
layout = pnl.getLayoutType();
|
7537
|
pnl.setLastpage(undefined);
|
7538
|
var last = 'MinovaGridFormGrid' + f.tableName;
|
7539
|
var grid_ = Ext.ComponentQuery.query('[name=' + last + ']')[0]
|
7540
|
|
7541
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0];
|
7542
|
formEdit.setSubmitProc(false);
|
7543
|
formEdit.setHidden(true);
|
7544
|
grid_.setHidden(false);
|
7545
|
grid_.getStore().reload()
|
7546
|
|
7547
|
}
|
7548
|
if (layout == 'L003') {
|
7549
|
var grid_ = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + f.tableName + ']')[0];
|
7550
|
grid_.setHidden(false);
|
7551
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(true);
|
7552
|
var detail = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
|
7553
|
if (detail) {
|
7554
|
detail.setHeight(grid_.getHeight() + 100)
|
7555
|
} else {
|
7556
|
var p = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
|
7557
|
var p_ = Ext.ComponentQuery.query('[name=DetailMD]')[0];
|
7558
|
p_.setTitle(p.getLastTitle());
|
7559
|
}
|
7560
|
|
7561
|
}
|
7562
|
|
7563
|
} else {
|
7564
|
MinovaMessage('Not Null', '000005', result.message.text, 'E')
|
7565
|
}
|
7566
|
var grid = Ext.ComponentQuery.query('[name=gridMenuMDOrm]')[0];
|
7567
|
var s = grid.getStore();
|
7568
|
s.removeAll();
|
7569
|
var ObjectType = getParam("ObjectType");
|
7570
|
var Lang = null;
|
7571
|
Ext.Ajax.request({
|
7572
|
async: false,
|
7573
|
method: 'POST',
|
7574
|
url: '/Devt/GetLangID',
|
7575
|
success: function (response) {
|
7576
|
Lang = response.responseText;
|
7577
|
}
|
7578
|
});
|
7579
|
Ext.Ajax.request({
|
7580
|
async: true,
|
7581
|
method: 'POST',
|
7582
|
url: '/UserControl/GetStore',
|
7583
|
params: {
|
7584
|
tableName: 'PHRCM0006',
|
7585
|
param: 'Language[equal]' + Lang + ',ObjectClass[equal]' + ObjectType
|
7586
|
|
7587
|
},
|
7588
|
success: function (response) {
|
7589
|
var results = Ext.decode(response.responseText);
|
7590
|
var data_ = results.data;
|
7591
|
s.loadData(results.data);
|
7592
|
// console.log(data_)
|
7593
|
}
|
7594
|
});
|
7595
|
},
|
7596
|
failure: function (response) {
|
7597
|
var result = Ext.decode(response.responseText);
|
7598
|
console.log(result);
|
7599
|
}
|
7600
|
});
|
7601
|
} else {
|
7602
|
var frmValue = Ext.encode(formEdit.getValues());
|
7603
|
Ext.Ajax.request({
|
7604
|
method: 'POST',
|
7605
|
url: '/Devt/SaveTable',
|
7606
|
params: {
|
7607
|
tableName: f.tableName,
|
7608
|
data: frmValue,
|
7609
|
action: formEdit.getActionSubmit()
|
7610
|
},
|
7611
|
waitMsg: 'Saving Data...',
|
7612
|
success: function (response) {
|
7613
|
var result = Ext.decode(response.responseText);
|
7614
|
if (result.success) {
|
7615
|
MinovaMessage('Not Null', '000006', '', 'S')
|
7616
|
|
7617
|
var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
|
7618
|
|
7619
|
if (pnl) {
|
7620
|
Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(394);
|
7621
|
layout = pnl.getLayoutType();
|
7622
|
pnl.setLastpage(undefined);
|
7623
|
var last = 'MinovaGridFormGrid' + f.tableName;
|
7624
|
var grid_ = Ext.ComponentQuery.query('[name=' + last + ']')[0]
|
7625
|
|
7626
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0];
|
7627
|
formEdit.setSubmitProc(false);
|
7628
|
formEdit.setHidden(true);
|
7629
|
grid_.setHidden(false);
|
7630
|
grid_.getStore().reload()
|
7631
|
var mpnl = Ext.ComponentQuery.query('[name=DetailMD]')[0]
|
7632
|
mpnl.setTitle(pnl.getLastTitle());
|
7633
|
|
7634
|
}
|
7635
|
if (layout == 'L003') {
|
7636
|
var grid_ = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + f.tableName + ']')[0];
|
7637
|
grid_.setHidden(false);
|
7638
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(true);
|
7639
|
Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(grid_.getHeight() + 100)
|
7640
|
}
|
7641
|
|
7642
|
} else {
|
7643
|
MinovaMessage('Not Null', '000005', result.message.text, 'E')
|
7644
|
}
|
7645
|
},
|
7646
|
failure: function (response) {
|
7647
|
var result = Ext.decode(response.responseText);
|
7648
|
//console.log(result);
|
7649
|
}
|
7650
|
});
|
7651
|
}
|
7652
|
|
7653
|
}
|
7654
|
}
|
7655
|
}, {
|
7656
|
text: 'Delete',
|
7657
|
iconCls: 'fa-trash-o',
|
7658
|
name: 'Delete',
|
7659
|
style: 'font-family: FontAwesome',
|
7660
|
action: 'CRUDdelete',
|
7661
|
handler: function () {
|
7662
|
//add fungsi Delete
|
7663
|
f = this.up().up();
|
7664
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0];
|
7665
|
var frmValue = Ext.encode(formEdit.getValues());
|
7666
|
if (formEdit.getForm().isValid()) {
|
7667
|
Ext.Ajax.request({
|
7668
|
method: 'POST',
|
7669
|
url: '/Devt/SaveTable',
|
7670
|
params: {
|
7671
|
tableName: f.tableName,
|
7672
|
data: frmValue,
|
7673
|
action: 2
|
7674
|
},
|
7675
|
waitMsg: 'Saving Data...',
|
7676
|
success: function (response) {
|
7677
|
var result = Ext.decode(response.responseText);
|
7678
|
if (result.success) {
|
7679
|
MinovaMessage('Not Null', '000006', '', 'S')
|
7680
|
|
7681
|
var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
|
7682
|
if (pnl) {
|
7683
|
layout = pnl.getLayoutType();
|
7684
|
pnl.setLastpage(undefined);
|
7685
|
|
7686
|
}
|
7687
|
if (layout == 'L003') {
|
7688
|
var grid_ = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + f.tableName + ']')[0];
|
7689
|
grid_.setHidden(false);
|
7690
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(true);
|
7691
|
Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(grid_.getHeight() + 100)
|
7692
|
}
|
7693
|
|
7694
|
} else {
|
7695
|
MinovaMessage('Not Null', '000005', result.message.text, 'E')
|
7696
|
}
|
7697
|
},
|
7698
|
failure: function (response) {
|
7699
|
var result = Ext.decode(response.responseText);
|
7700
|
//console.log(result);
|
7701
|
}
|
7702
|
});
|
7703
|
}
|
7704
|
}
|
7705
|
|
7706
|
}, {
|
7707
|
text: 'Cancel',
|
7708
|
iconCls: 'fa-reply',
|
7709
|
style: 'font-family: FontAwesome',
|
7710
|
handler: function () {
|
7711
|
f = this.up().up();
|
7712
|
f.setSubmitProc(false);
|
7713
|
f.setHidden(true);
|
7714
|
var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
|
7715
|
|
7716
|
if (pnl) {
|
7717
|
//'L001'=grid L002 =heder detail L003=card L004=custom
|
7718
|
layout = pnl.getLayoutType();
|
7719
|
var last = 'MinovaGridFormGrid' + f.tableName;
|
7720
|
var grid_ = Ext.ComponentQuery.query('[name=' + last + ']')[0];
|
7721
|
grid_.setHidden(false);
|
7722
|
pnl.setLastpage(undefined);
|
7723
|
var mpnl = Ext.ComponentQuery.query('[name=DetailMD]')[0]
|
7724
|
mpnl.setTitle(pnl.getLastTitle());
|
7725
|
if (layout == 'L003') {
|
7726
|
Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(400);
|
7727
|
} else {
|
7728
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(false);
|
7729
|
}
|
7730
|
} else {
|
7731
|
// Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(false);
|
7732
|
var mdDetail = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
|
7733
|
layout = mdDetail.getLayoutType();
|
7734
|
if (layout == 'L003') {
|
7735
|
var panelDetail = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0];
|
7736
|
Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + tableName + ']')[0].setHidden(false)
|
7737
|
|
7738
|
panelDetail.setHeight(400);
|
7739
|
} else {
|
7740
|
Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(false);
|
7741
|
}
|
7742
|
}
|
7743
|
|
7744
|
}
|
7745
|
}
|
7746
|
],
|
7747
|
}
|
7748
|
]
|
7749
|
});
|
7750
|
me.callParent(arguments);
|
7751
|
}
|
7752
|
});
|
7753
|
|
7754
|
Ext.define('MinovaUtil.MinovaES.MinovaGridCard', {
|
7755
|
extend: 'Ext.form.Panel',
|
7756
|
alias: ['widget.minovagridcard', 'widget.MinovaGridCard'],
|
7757
|
tableName: undefined, //nama tabel
|
7758
|
param: undefined, //param query
|
7759
|
//hidebutton: undefined,
|
7760
|
pagesize: undefined,
|
7761
|
storename: undefined,
|
7762
|
titleform: undefined,
|
7763
|
titlegrid: undefined,
|
7764
|
heightgrid: undefined,
|
7765
|
heightform: undefined,
|
7766
|
iseditform: undefined,
|
7767
|
|
7768
|
getIsEditform: function () {
|
7769
|
return this.iseditform;
|
7770
|
},
|
7771
|
setIsEditform: function (value) {
|
7772
|
var me = this;
|
7773
|
me.iseditform = value;
|
7774
|
return me;
|
7775
|
},
|
7776
|
initComponent: function () {
|
7777
|
var me = this;
|
7778
|
var storename = me.storename;
|
7779
|
if (storename == "" || storename == undefined) {
|
7780
|
storename = "store" + me.tableName;
|
7781
|
}
|
7782
|
var tableName = me.tableName;
|
7783
|
Ext.applyIf(me, {
|
7784
|
items: [{
|
7785
|
layoutType: "MinovaGridCard",
|
7786
|
//title: me.titlegrid,
|
7787
|
xtype: "minovagrid",
|
7788
|
tableName: tableName, // nama tebel/dataset
|
7789
|
name: "MinovaGridCardGrid" + tableName, //name bebeas
|
7790
|
param: me.param, // parameter filteran
|
7791
|
pagesize: me.pagesize, // jumlah record yang muncul per page
|
7792
|
storename: storename, //nama store bebas
|
7793
|
isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
|
7794
|
height: 330,
|
7795
|
bodyPadding: 0,
|
7796
|
dockedItems: [{
|
7797
|
xtype: 'pagingtoolbar',
|
7798
|
store: storename, // harus sama dengan naa store diatas
|
7799
|
dock: 'bottom', //posisi paging
|
7800
|
pageSize: me.pagesize,
|
7801
|
displayInfo: true
|
7802
|
}
|
7803
|
],
|
7804
|
|
7805
|
listeners: {
|
7806
|
viewready: function () {
|
7807
|
if (MinovaUtil.GetActionMenu() == 0 || MinovaUtil.GetActionMenu() == undefined || MinovaUtil.GetActionMenu() == "") {
|
7808
|
Ext.ComponentQuery.query('[name=actionBtn]')[0].setHidden(true)
|
7809
|
Ext.ComponentQuery.query('[name=Edit' + me.tableName + ']')[0].setHidden(true)
|
7810
|
} else {
|
7811
|
Ext.ComponentQuery.query('[name=actionBtn]')[0].setHidden(false)
|
7812
|
//Ext.ComponentQuery.query('[name=Edit_]')[0].setHidden(true)
|
7813
|
Ext.ComponentQuery.query('[name=Delete_]')[0].setHidden(true)
|
7814
|
Ext.ComponentQuery.query('[name=Edit' + me.tableName + ']')[0].setHidden(false)
|
7815
|
}
|
7816
|
//case orm
|
7817
|
if (this.layoutType == "MinovaGridCard") {
|
7818
|
var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + this.tableName + ']')[0];
|
7819
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
|
7820
|
formDisplay.setHidden(true);
|
7821
|
formEdit.setHidden(true);
|
7822
|
} else if (this.layoutType == "MinovaGridForm") {
|
7823
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
|
7824
|
formEdit.setHidden(true);
|
7825
|
} else {
|
7826
|
var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + this.tableName + ']')[0];
|
7827
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
|
7828
|
formDisplay.setHidden(true);
|
7829
|
formEdit.setHidden(true);
|
7830
|
}
|
7831
|
|
7832
|
},
|
7833
|
itemdblclick: function () {
|
7834
|
//alert('a')
|
7835
|
var me = this;
|
7836
|
|
7837
|
var formDisplay = undefined;
|
7838
|
var formEdit = undefined;
|
7839
|
//case md orm
|
7840
|
|
7841
|
if (this.layoutType == "MinovaGridCard") {
|
7842
|
formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + this.tableName + ']')[0];
|
7843
|
formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
|
7844
|
} else if (this.layoutType == "MinovaGridForm") {
|
7845
|
formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + this.tableName + ']')[0];
|
7846
|
formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
|
7847
|
// formDisplay.setHidden(true);
|
7848
|
|
7849
|
} else {
|
7850
|
formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + this.tableName + ']')[0];
|
7851
|
formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
|
7852
|
|
7853
|
}
|
7854
|
var submit_ = formEdit.getSubmitProc();
|
7855
|
var selection = me.getView().getSelectionModel().getSelection()[0];
|
7856
|
if (submit_ == undefined) {
|
7857
|
submit_ = false;
|
7858
|
}
|
7859
|
if (submit_ == false) {
|
7860
|
|
7861
|
if (this.layoutType == "MinovaGridCard") {
|
7862
|
|
7863
|
formDisplay.getForm().setValues(selection.data);
|
7864
|
formEdit.getForm().setValues(selection.data);
|
7865
|
formDisplay.setHidden(false);
|
7866
|
formEdit.setHidden(true);
|
7867
|
this.setHidden(true);
|
7868
|
} else if (this.layoutType == "MinovaGridForm") {
|
7869
|
formEdit.setHidden(true);
|
7870
|
formDisplay.getForm().setValues(selection.data);
|
7871
|
formEdit.getForm().setValues(selection.data);
|
7872
|
} else {
|
7873
|
formDisplay.setHidden(true);
|
7874
|
formEdit.setHidden(true);
|
7875
|
|
7876
|
formDisplay.getForm().setValues(selection.data);
|
7877
|
formEdit.getForm().setValues(selection.data);
|
7878
|
}
|
7879
|
// untuk case ORM
|
7880
|
var display_ = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + tableName + ']')[0].getHeight();
|
7881
|
if (display_) {
|
7882
|
var pnlORM = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0]
|
7883
|
var pnlMD = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
|
7884
|
if (pnlORM) {
|
7885
|
pnlORM.setHeight(pnl + 100);
|
7886
|
}
|
7887
|
if (pnlMD) {
|
7888
|
Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0].setHeight(pnlMD + 600);
|
7889
|
Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(pnlMD + 600);
|
7890
|
}
|
7891
|
}
|
7892
|
//end case ORM and MD
|
7893
|
} else {
|
7894
|
alert('still process')
|
7895
|
}
|
7896
|
|
7897
|
},
|
7898
|
beforeedit: function () {
|
7899
|
return false;
|
7900
|
}
|
7901
|
}
|
7902
|
}, {
|
7903
|
xtype: 'minovaform',
|
7904
|
name: "MinovaGridCardDisplay" + tableName,
|
7905
|
tableName: tableName, // nama tabel /dataset
|
7906
|
isLookup: '', // 1 or 'Y' for lookup
|
7907
|
isDisplay: true, // true== form is displayfield
|
7908
|
buttons: [{
|
7909
|
text: 'Edit',
|
7910
|
name: 'Edit' + tableName,
|
7911
|
iconCls: 'fa-edit',
|
7912
|
style: 'font-family: FontAwesome',
|
7913
|
handler: function () {
|
7914
|
f = this.up().up();
|
7915
|
f.setSubmitProc(false);
|
7916
|
f.setHidden(true);
|
7917
|
var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + f.tableName + ']')[0].setHidden(true);
|
7918
|
Ext.ComponentQuery.query('[name=MinovaGridCardGrid' + f.tableName + ']')[0].setHidden(true);
|
7919
|
Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + f.tableName + ']')[0].setHidden(false);
|
7920
|
|
7921
|
}
|
7922
|
}, {
|
7923
|
text: 'Back to Grid',
|
7924
|
name: 'Cancel' + tableName,
|
7925
|
iconCls: 'fa-reply',
|
7926
|
style: 'font-family: FontAwesome',
|
7927
|
handler: function () {
|
7928
|
f = this.up().up();
|
7929
|
f.setSubmitProc(false);
|
7930
|
f.setHidden(true);
|
7931
|
var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + f.tableName + ']')[0].setHidden(true);
|
7932
|
Ext.ComponentQuery.query('[name=MinovaGridCardGrid' + f.tableName + ']')[0].setHidden(false);
|
7933
|
Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + f.tableName + ']')[0].setHidden(true);
|
7934
|
|
7935
|
}
|
7936
|
}
|
7937
|
],
|
7938
|
}, {
|
7939
|
xtype: 'minovaform',
|
7940
|
name: "MinovaGridCardEdit" + tableName,
|
7941
|
tableName: tableName, // nama tabel /dataset
|
7942
|
isLookup: '', // 1 or 'Y' for lookup
|
7943
|
isDisplay: false, // true== form is displayfield
|
7944
|
buttons: [{
|
7945
|
text: 'Save',
|
7946
|
name: 'Save' + tableName,
|
7947
|
iconCls: 'fa-save',
|
7948
|
style: 'font-family: FontAwesome',
|
7949
|
handler: function () {
|
7950
|
f = this.up().up();
|
7951
|
var formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + f.tableName + ']')[0];
|
7952
|
}
|
7953
|
}, {
|
7954
|
text: 'Delete',
|
7955
|
iconCls: 'fa-trash-o',
|
7956
|
name: 'Delete',
|
7957
|
style: 'font-family: FontAwesome',
|
7958
|
action: 'CRUDdelete'
|
7959
|
}, {
|
7960
|
text: 'Back to Grid',
|
7961
|
name: 'EditForm' + tableName,
|
7962
|
iconCls: 'fa-reply',
|
7963
|
style: 'font-family: FontAwesome',
|
7964
|
handler: function () {
|
7965
|
f = this.up().up();
|
7966
|
f.setSubmitProc(false);
|
7967
|
f.setHidden(true);
|
7968
|
var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + f.tableName + ']')[0].setHidden(true);
|
7969
|
Ext.ComponentQuery.query('[name=MinovaGridCardGrid' + f.tableName + ']')[0].setHidden(false);
|
7970
|
Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + f.tableName + ']')[0].setHidden(true);
|
7971
|
|
7972
|
}
|
7973
|
}
|
7974
|
],
|
7975
|
}
|
7976
|
]
|
7977
|
});
|
7978
|
me.callParent(arguments);
|
7979
|
}
|
7980
|
});
|
7981
|
|
7982
|
Ext.define('MinovaUtil.MinovaES.MinovaFloatField', {
|
7983
|
extend: 'Ext.form.field.Number',
|
7984
|
alias: 'widget.minovafloatfield',
|
7985
|
hideTrigger: true,
|
7986
|
allowDecimals: true,
|
7987
|
precision: undefined,
|
7988
|
isValid: function () {
|
7989
|
var b = this,
|
7990
|
a = b.disabled,
|
7991
|
c = b.forceValidation || !a;
|
7992
|
return c ? b.validateValue(b.processRawValue(b.getValue())) : a
|
7993
|
},
|
7994
|
setValue: function (v) {
|
7995
|
this.setRawValue(this.getFormattedValue(v));
|
7996
|
},
|
7997
|
getValue: function () {
|
7998
|
var val = this.removeFormat(this.getRawValue());
|
7999
|
this.value = val;
|
8000
|
return val;
|
8001
|
},
|
8002
|
getSubmitValue: function () {
|
8003
|
return this.removeFormat(this.getRawValue());
|
8004
|
},
|
8005
|
removeFormat: function (v) {
|
8006
|
if (Ext.isEmpty(v))
|
8007
|
return v;
|
8008
|
else {
|
8009
|
v = v.replace(Ext.util.Format.currencySign, '');
|
8010
|
v = v.replace(new RegExp('[' + Ext.util.Format.thousandSeparator + ']', 'g'), '');
|
8011
|
return v;
|
8012
|
}
|
8013
|
},
|
8014
|
onFocus: function () {
|
8015
|
this.setRawValue(this.removeFormat(this.getRawValue()));
|
8016
|
},
|
8017
|
onBlur: function () {
|
8018
|
this.setRawValue(this.getFormattedValue(this.getValue()));
|
8019
|
},
|
8020
|
getFormattedValue: function (v) {
|
8021
|
var prec = '';
|
8022
|
if (this.precision != '' && this.precision > 0) {
|
8023
|
for (var i = 0; i < this.precision; i++) {
|
8024
|
prec = prec + '0'
|
8025
|
}
|
8026
|
}
|
8027
|
return Ext.util.Format.number(v, '0,000.' + prec);
|
8028
|
}
|
8029
|
});
|
8030
|
Ext.define('MinovaUtil.MinovaES.MinovaNumberField', {
|
8031
|
extend: 'Ext.form.field.Number',
|
8032
|
alias: 'widget.minovanumberfield',
|
8033
|
//hideTrigger: true,
|
8034
|
isValid: function () {
|
8035
|
var b = this,
|
8036
|
a = b.disabled,
|
8037
|
c = b.forceValidation || !a;
|
8038
|
return c ? b.validateValue(b.processRawValue(b.getValue())) : a
|
8039
|
},
|
8040
|
setValue: function (v) {
|
8041
|
this.setRawValue(this.getFormattedValue(v));
|
8042
|
},
|
8043
|
getValue: function () {
|
8044
|
var val = this.removeFormat(this.getRawValue());
|
8045
|
this.value = val;
|
8046
|
return val;
|
8047
|
},
|
8048
|
getSubmitValue: function () {
|
8049
|
return this.removeFormat(this.getRawValue());
|
8050
|
},
|
8051
|
removeFormat: function (v) {
|
8052
|
if (Ext.isEmpty(v))
|
8053
|
return v;
|
8054
|
else {
|
8055
|
v = v.replace(Ext.util.Format.currencySign, '');
|
8056
|
v = v.replace(new RegExp('[' + Ext.util.Format.thousandSeparator + ']', 'g'), '');
|
8057
|
return v;
|
8058
|
}
|
8059
|
},
|
8060
|
onFocus: function () {
|
8061
|
this.setRawValue(this.removeFormat(this.getRawValue()));
|
8062
|
},
|
8063
|
onBlur: function () {
|
8064
|
this.setRawValue(this.getFormattedValue(this.getValue()));
|
8065
|
},
|
8066
|
getFormattedValue: function (v) {
|
8067
|
return Ext.util.Format.number(v, '0,000');
|
8068
|
}
|
8069
|
});
|
8070
|
|
8071
|
Ext.define('MinovaUtil.MinovaES.SysDateTime', {
|
8072
|
extend: 'Ext.form.field.Text',
|
8073
|
alias: ['widget.minovasysdatetime'],
|
8074
|
undefinedText: ' ',
|
8075
|
setValue: function (v) {
|
8076
|
var value = v;
|
8077
|
var hasil = null;
|
8078
|
/*
|
8079
|
if (value === undefined) {
|
8080
|
return this.undefinedText;
|
8081
|
}
|
8082
|
if (value === null) {
|
8083
|
return this.setRawValue(null);
|
8084
|
}
|
8085
|
*/
|
8086
|
//hamid 200916
|
8087
|
//if (value != null || value != "" || value != undefined) {
|
8088
|
// return this.setRawValue(null);
|
8089
|
if (value == "" || value == null) {
|
8090
|
return this.setRawValue("");
|
8091
|
//end
|
8092
|
} else {
|
8093
|
var d = value.substring(6, 8);
|
8094
|
var m = value.substring(4, 6);
|
8095
|
var y = value.substring(0, 4);
|
8096
|
var h = value.substring(8, 10);
|
8097
|
var mt = value.substring(10, 12);
|
8098
|
var s = value.substring(12, 14);
|
8099
|
hasil = d + '/' + m + '/' + y + ' ' + ' ' + h + ':' + mt + ':' + s;
|
8100
|
}
|
8101
|
|
8102
|
this.setRawValue(hasil);
|
8103
|
},
|
8104
|
getRawValue: function () {
|
8105
|
return this.getValue();
|
8106
|
},
|
8107
|
getValue: function () {
|
8108
|
var value = this.rawValue;
|
8109
|
var hasil = null;
|
8110
|
if (value != undefined) {
|
8111
|
var d = value.substring(0, 2);
|
8112
|
var m = value.substring(3, 5);
|
8113
|
var y = value.substring(6, 10);
|
8114
|
var h = value.substring(14, 16);
|
8115
|
var mt = value.substring(17, 19);
|
8116
|
var s = value.substring(20, 22);
|
8117
|
hasil = y + m + d + h + mt + s;
|
8118
|
}
|
8119
|
return hasil;
|
8120
|
}
|
8121
|
});
|
8122
|
Ext.define('MinovaUtil.MinovaES.MinovaDateTime', {
|
8123
|
extend: 'Ext.form.field.Trigger',
|
8124
|
alias: ['widget.minovadatetime', 'widget.MinovaDateTime'],
|
8125
|
tableName: undefined,
|
8126
|
param: undefined,
|
8127
|
anchor: '50%',
|
8128
|
initComponent: function () {
|
8129
|
var me = this;
|
8130
|
Ext.applyIf(me, {});
|
8131
|
me.callParent(arguments);
|
8132
|
},
|
8133
|
onTriggerClick: function () {
|
8134
|
Ext.create('Ext.window.Window', {
|
8135
|
title: 'Hello',
|
8136
|
modal: true,
|
8137
|
layout: 'fit',
|
8138
|
dockedItems: [{
|
8139
|
xtype: 'toolbar',
|
8140
|
dock: 'bottom',
|
8141
|
align: 'center',
|
8142
|
items: [{
|
8143
|
xtype: 'tbspacer'
|
8144
|
}, {
|
8145
|
xtype: 'button',
|
8146
|
text: 'Today'
|
8147
|
}, {
|
8148
|
xtype: 'tbspacer'
|
8149
|
}, ]
|
8150
|
}
|
8151
|
],
|
8152
|
items: [{
|
8153
|
xtype: 'panel',
|
8154
|
layout: 'hbox',
|
8155
|
items: [{
|
8156
|
xtype: 'datepicker',
|
8157
|
name: 'date',
|
8158
|
showToday: false,
|
8159
|
handler: function (picker, date) {}
|
8160
|
|
8161
|
}, {
|
8162
|
xtype: 'sliderfield',
|
8163
|
width: 60,
|
8164
|
name: 'hour',
|
8165
|
labelAlign: 'top',
|
8166
|
fieldLabel: 'Hour',
|
8167
|
value: 0,
|
8168
|
increment: 1,
|
8169
|
minValue: 0,
|
8170
|
maxValue: 24,
|
8171
|
margin: '10 5 3 20',
|
8172
|
renderTo: Ext.getBody(),
|
8173
|
}, {
|
8174
|
xtype: 'sliderfield',
|
8175
|
width: 60,
|
8176
|
name: 'minute',
|
8177
|
labelAlign: 'top',
|
8178
|
fieldLabel: 'Minute',
|
8179
|
value: 0,
|
8180
|
increment: 1,
|
8181
|
minValue: 0,
|
8182
|
maxValue: 60,
|
8183
|
margin: '10 5 3 20',
|
8184
|
renderTo: Ext.getBody(),
|
8185
|
}, {
|
8186
|
xtype: 'sliderfield',
|
8187
|
width: 60,
|
8188
|
name: 'second',
|
8189
|
labelAlign: 'top',
|
8190
|
fieldLabel: 'Second',
|
8191
|
value: 0,
|
8192
|
increment: 1,
|
8193
|
minValue: 0,
|
8194
|
maxValue: 60,
|
8195
|
margin: '10 5 3 20',
|
8196
|
renderTo: Ext.getBody(),
|
8197
|
}
|
8198
|
]
|
8199
|
}
|
8200
|
]
|
8201
|
}).show();
|
8202
|
}
|
8203
|
});
|
8204
|
|
8205
|
Ext.define('MinovaUtil.MinovaES.MinovaMDORM', {
|
8206
|
extend: 'Ext.form.Panel',
|
8207
|
alias: ['widget.minovamdorm'],
|
8208
|
|
8209
|
//controller: 'sample',
|
8210
|
controller: 'orm-manage-controller',
|
8211
|
tableName: undefined, //nama tabel
|
8212
|
param: undefined, //param query
|
8213
|
pagesize: undefined,
|
8214
|
storename: undefined,
|
8215
|
titleform: undefined,
|
8216
|
titlegrid: undefined,
|
8217
|
heightgrid: undefined,
|
8218
|
heightform: undefined,
|
8219
|
iseditform: undefined,
|
8220
|
lastheightform: undefined,
|
8221
|
layoutType: undefined,
|
8222
|
lastpage: undefined,
|
8223
|
lastTitle: undefined,
|
8224
|
getLastTitle: function () {
|
8225
|
return this.lastTitle;
|
8226
|
},
|
8227
|
setLastTitle: function (value) {
|
8228
|
var me = this;
|
8229
|
me.lastTitle = value;
|
8230
|
return me;
|
8231
|
},
|
8232
|
getLastpage: function () {
|
8233
|
return this.lastpage;
|
8234
|
},
|
8235
|
setLastpage: function (value) {
|
8236
|
var me = this;
|
8237
|
me.lastpage = value;
|
8238
|
return me;
|
8239
|
},
|
8240
|
getLayoutType: function () {
|
8241
|
return this.layoutType;
|
8242
|
},
|
8243
|
setLayoutType: function (value) {
|
8244
|
var me = this;
|
8245
|
me.layoutType = value;
|
8246
|
return me;
|
8247
|
},
|
8248
|
getLastheightform: function () {
|
8249
|
return this.lastheightform;
|
8250
|
},
|
8251
|
setLastheightform: function (value) {
|
8252
|
var me = this;
|
8253
|
me.lastheightform = value;
|
8254
|
return me;
|
8255
|
},
|
8256
|
|
8257
|
getIsEditform: function () {
|
8258
|
return this.iseditform;
|
8259
|
},
|
8260
|
setIsEditform: function (value) {
|
8261
|
var me = this;
|
8262
|
me.iseditform = value;
|
8263
|
return me;
|
8264
|
},
|
8265
|
initComponent: function () {
|
8266
|
var me = this;
|
8267
|
var userAction = MinovaUtil.GetActionMenu();
|
8268
|
var crudBtn = true;
|
8269
|
if (userAction == '1') {
|
8270
|
crudBtn = false
|
8271
|
}
|
8272
|
var storename = me.storename;
|
8273
|
if (storename == "" || storename == undefined) {
|
8274
|
storename = "store" + me.tableName;
|
8275
|
}
|
8276
|
var tableName = me.tableName;
|
8277
|
Ext.applyIf(me, {
|
8278
|
items: [{
|
8279
|
layoutType: "MinovaGridForm",
|
8280
|
title: me.titlegrid,
|
8281
|
xtype: "minovagridmd",
|
8282
|
tableName: tableName, // nama tebel/dataset
|
8283
|
name: "MinovaGridFormGrid", //name bebeas
|
8284
|
param: me.param, // parameter filteran
|
8285
|
pagesize: me.pagesize, // jumlah record yang muncul per page
|
8286
|
storename: storename, //nama store bebas
|
8287
|
isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
|
8288
|
height: 330,
|
8289
|
bodyPadding: 0,
|
8290
|
tbar: [{
|
8291
|
xtype: 'button',
|
8292
|
text: 'Action',
|
8293
|
hidden: crudBtn,
|
8294
|
name: 'actionGrid',
|
8295
|
menu: [{
|
8296
|
text: 'Add',
|
8297
|
action: 'addGrid',
|
8298
|
name: 'addGridORM',
|
8299
|
action: 'CRUDaddNewRecord',
|
8300
|
style: 'font-family: FontAwesome',
|
8301
|
itemId: 'AddData',
|
8302
|
iconCls: 'fa-plus-circle',
|
8303
|
|
8304
|
}, {
|
8305
|
text: 'Copy',
|
8306
|
action: 'copyGrid',
|
8307
|
name: 'CopyGridORM',
|
8308
|
iconCls: 'fa-copy',
|
8309
|
style: 'font-family: FontAwesome',
|
8310
|
}, {
|
8311
|
text: 'Edit',
|
8312
|
action: 'editGrid',
|
8313
|
name: 'EditGridORM',
|
8314
|
iconCls: 'fa-edit',
|
8315
|
style: 'font-family: FontAwesome',
|
8316
|
}, {
|
8317
|
text: 'Delete',
|
8318
|
name: 'DeleteGridORM',
|
8319
|
hidden: true,
|
8320
|
iconCls: 'fa-trash-o',
|
8321
|
style: 'font-family: FontAwesome',
|
8322
|
}
|
8323
|
]
|
8324
|
}, {
|
8325
|
xtype: 'tbfill'
|
8326
|
}, {
|
8327
|
text: 'Clear Filters',
|
8328
|
tooltip: 'Clear all filters',
|
8329
|
name: 'clearbtn',
|
8330
|
handler: function () {
|
8331
|
var tolbar = this.up()
|
8332
|
var grid_ = tolbar.up()
|
8333
|
grid_.filters.clearFilters()
|
8334
|
}
|
8335
|
}, ],
|
8336
|
|
8337
|
dockedItems: [{
|
8338
|
xtype: 'pagingtoolbar',
|
8339
|
store: storename, // harus sama dengan naa store diatas
|
8340
|
dock: 'bottom', //posisi paging
|
8341
|
pageSize: me.pagesize,
|
8342
|
displayInfo: true
|
8343
|
}
|
8344
|
],
|
8345
|
listeners: {
|
8346
|
afterrender: function (me) {
|
8347
|
if (MinovaUtil.GetActionMenu() == "1") {}
|
8348
|
else {}
|
8349
|
},
|
8350
|
|
8351
|
},
|
8352
|
|
8353
|
}, {
|
8354
|
xtype: 'minovaform',
|
8355
|
name: "MinovaGridFormDisplay",
|
8356
|
//name: "MinovaGridFormEdit",
|
8357
|
border: false,
|
8358
|
tableName: tableName, // nama tabel /dataset
|
8359
|
isLookup: '', // 1 or 'Y' for lookup
|
8360
|
isDisplay: true, // true== form is displayfield
|
8361
|
/*
|
8362
|
buttons: [{
|
8363
|
text: 'Edit',
|
8364
|
name: 'EditDisplay',
|
8365
|
iconCls: 'fa-edit',
|
8366
|
style: 'font-family: FontAwesome',
|
8367
|
}, {
|
8368
|
text: 'Back to Grid',
|
8369
|
name: 'BackGrid',
|
8370
|
iconCls: 'fa-reply',
|
8371
|
style: 'font-family: FontAwesome',
|
8372
|
}
|
8373
|
],
|
8374
|
*/
|
8375
|
}, {
|
8376
|
xtype: 'minovaform',
|
8377
|
//name: "MinovaGridFormDisplay",
|
8378
|
name: "MinovaGridFormEdit",
|
8379
|
border: false,
|
8380
|
tableName: tableName, // nama tabel /dataset
|
8381
|
isLookup: '', // 1 or 'Y' for lookup
|
8382
|
isDisplay: false, // true== form is displayfield
|
8383
|
/*
|
8384
|
buttons: [{
|
8385
|
text: 'Save',
|
8386
|
name: 'btnSaveMD',
|
8387
|
iconCls: 'fa-save',
|
8388
|
style: 'font-family: FontAwesome',
|
8389
|
}, {
|
8390
|
text: 'Delete',
|
8391
|
iconCls: 'fa-trash-o',
|
8392
|
name: 'btnDeleteMD',
|
8393
|
style: 'font-family: FontAwesome',
|
8394
|
action: 'CRUDdelete',
|
8395
|
}, {
|
8396
|
text: 'Cancel',
|
8397
|
name: 'btnCancelMD',
|
8398
|
iconCls: 'fa-reply',
|
8399
|
style: 'font-family: FontAwesome',
|
8400
|
}
|
8401
|
],
|
8402
|
*/
|
8403
|
}
|
8404
|
]
|
8405
|
|
8406
|
});
|
8407
|
me.callParent(arguments);
|
8408
|
}
|
8409
|
});
|
8410
|
|
8411
|
Ext.define('MinovaUtil.MinovaES.MinovaHeaderMD', {
|
8412
|
extend: 'Ext.form.Panel',
|
8413
|
alias: ['widget.MinovaHeadermd', 'widget.MinovaHeaderMD'],
|
8414
|
allTableName: undefined,
|
8415
|
param: undefined,
|
8416
|
//frame: true,
|
8417
|
resizable: true,
|
8418
|
autoScroll: true,
|
8419
|
minHeight: 20,
|
8420
|
layout: 'column',
|
8421
|
name: 'HeaderMD',
|
8422
|
getAllTableName: function () {
|
8423
|
return this.allTableName;
|
8424
|
},
|
8425
|
setAllTableName: function (value) {
|
8426
|
var me = this;
|
8427
|
me.allTableName = value;
|
8428
|
return me;
|
8429
|
},
|
8430
|
listeners: {
|
8431
|
afterrender: function (me) {
|
8432
|
|
8433
|
var nowDate = MinovaUtil.GetNowDate()
|
8434
|
var allTbl = me.getAllTableName();
|
8435
|
//alert(allTbl);
|
8436
|
var splitTable = allTbl.split(',')
|
8437
|
splitTable.forEach(function (tbl) {
|
8438
|
// console.log(tbl);
|
8439
|
//set values form
|
8440
|
var nowDate = MinovaUtil.GetNowDate();
|
8441
|
parameter = null;
|
8442
|
if (me.isEmployee == true) {
|
8443
|
parameter = 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("EmployeeID")
|
8444
|
} else {
|
8445
|
parameter = 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("ApplicantID")
|
8446
|
}
|
8447
|
Ext.Ajax.request({
|
8448
|
method: 'POST',
|
8449
|
//async: false,
|
8450
|
url: '/UserControl/GetStore',
|
8451
|
params: {
|
8452
|
tableName: tbl,
|
8453
|
param: parameter
|
8454
|
},
|
8455
|
success: function (response) {
|
8456
|
var results = Ext.decode(response.responseText);
|
8457
|
hasil = results.data;
|
8458
|
//console.log(hasil)
|
8459
|
if (hasil.length > 0) {
|
8460
|
me.getForm().setValues(hasil[0]);
|
8461
|
|
8462
|
//console.log(me)
|
8463
|
}
|
8464
|
|
8465
|
}
|
8466
|
});
|
8467
|
});
|
8468
|
|
8469
|
//setTimeout(function () {
|
8470
|
// // var me_ = Ext.ComponentQuery.query('[name=Header]')[0];
|
8471
|
// // me_.setTitle(me_.getTitle() + ' - ' + Ext.ComponentQuery.query('[name=FullName]')[0].getValue());
|
8472
|
//}, 100);
|
8473
|
|
8474
|
},
|
8475
|
|
8476
|
},
|
8477
|
|
8478
|
initComponent: function () {
|
8479
|
var me = this;
|
8480
|
var col1 = [];
|
8481
|
var col2 = [];
|
8482
|
var hasil = null;
|
8483
|
//get moduletype
|
8484
|
//var ModuleType = 'PA';
|
8485
|
//var ModuleType = MinovaUtil.GetModuleType()
|
8486
|
//get Lang
|
8487
|
var LangId = localStorage.LangId;
|
8488
|
var allTable = null;
|
8489
|
var tbl = null;
|
8490
|
var tblTemp = null;
|
8491
|
var nowDate = MinovaUtil.GetNowDate();
|
8492
|
//var Photo_ = 'nophoto.gif';
|
8493
|
var Photo = 'nophoto.gif';
|
8494
|
tableName = null;
|
8495
|
parameter = null;
|
8496
|
// get Photo
|
8497
|
//hamid200916
|
8498
|
if (me.isEmployee == true) {
|
8499
|
tableName = 'PHRPA0001';
|
8500
|
parameter = 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("EmployeeID");
|
8501
|
} else {
|
8502
|
tableName = 'PHRRC0001';
|
8503
|
parameter = 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("ApplicantID")
|
8504
|
}
|
8505
|
Ext.Ajax.request({
|
8506
|
method: 'POST',
|
8507
|
async: false,
|
8508
|
url: '/UserControl/GetStore',
|
8509
|
params: {
|
8510
|
tableName: tableName,
|
8511
|
param: parameter
|
8512
|
},
|
8513
|
success: function (response) {
|
8514
|
var results = Ext.decode(response.responseText);
|
8515
|
hasil = results.data;
|
8516
|
if (hasil.length > 0) {
|
8517
|
dataPhoto = hasil[0].Picture
|
8518
|
if (dataPhoto != "") {
|
8519
|
Photo = dataPhoto;
|
8520
|
}
|
8521
|
}
|
8522
|
|
8523
|
}
|
8524
|
});
|
8525
|
|
8526
|
var hasil = undefined;
|
8527
|
Ext.Ajax.request({
|
8528
|
async: false,
|
8529
|
method: 'POST',
|
8530
|
url: '/UserControl/GetStore',
|
8531
|
params: {
|
8532
|
tableName: 'PDSBS0009',
|
8533
|
param: 'MenuID[=]' + MinovaUtil.GetMenuID() + ',LangId[=]' + LangId
|
8534
|
},
|
8535
|
success: function (response) {
|
8536
|
hasil = Ext.decode(response.responseText).data;
|
8537
|
|
8538
|
}
|
8539
|
});
|
8540
|
|
8541
|
//sorting results
|
8542
|
hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
|
8543
|
if (hasil.length > 0) {
|
8544
|
Ext.each(hasil, function (rec) {
|
8545
|
tblTemp = rec.TableName;
|
8546
|
if (tbl != tblTemp) {
|
8547
|
tbl = tblTemp;
|
8548
|
if (allTable == null) {
|
8549
|
allTable = tbl
|
8550
|
} else {
|
8551
|
allTable = allTable + ',' + tbl
|
8552
|
}
|
8553
|
|
8554
|
}
|
8555
|
// build form
|
8556
|
if (rec.TableRef != '') {
|
8557
|
valueField = null;
|
8558
|
displayValue = null;
|
8559
|
Ext.Ajax.request({
|
8560
|
async: false,
|
8561
|
method: 'POST',
|
8562
|
url: '/UserControl/GetStore',
|
8563
|
params: {
|
8564
|
tableName: 'SDATATABLEFIELD',
|
8565
|
param: 'TableName[equal]' + rec.TableRef
|
8566
|
},
|
8567
|
success: function (response) {
|
8568
|
var results = Ext.decode(response.responseText);
|
8569
|
data_ = results.data;
|
8570
|
if (data_ != undefined) {
|
8571
|
valueField_ = $.grep(data_, function (r) {
|
8572
|
return r.ValueField == '1'
|
8573
|
});
|
8574
|
if (valueField_.length > 0) {
|
8575
|
valueField = valueField_[0].FieldName
|
8576
|
}
|
8577
|
|
8578
|
displayValue_ = $.grep(data_, function (r) {
|
8579
|
return r.DisplayValue == '1'
|
8580
|
});
|
8581
|
if (displayValue_.length > 0) {
|
8582
|
displayValue = displayValue_[0].FieldName
|
8583
|
}
|
8584
|
}
|
8585
|
}
|
8586
|
});
|
8587
|
|
8588
|
formfield = new Ext.form.Display({
|
8589
|
fieldLabel: rec.ScreenCaption,
|
8590
|
name: rec.FieldName,
|
8591
|
//value: rec.DefaultValue,
|
8592
|
padding: 0,
|
8593
|
labelCls: 'label-minova',
|
8594
|
labelWidth: 150,
|
8595
|
anchor: '80%',
|
8596
|
store: Ext.create('Ext.data.Store', {
|
8597
|
storeId: 'storeDisplay' + rec.FieldName,
|
8598
|
//autoLoad: true,
|
8599
|
proxy: {
|
8600
|
method: 'POST',
|
8601
|
type: 'ajax',
|
8602
|
extraParams: {
|
8603
|
tableName: rec.TableRef,
|
8604
|
param: ''
|
8605
|
},
|
8606
|
reader: {
|
8607
|
type: 'json',
|
8608
|
root: 'data',
|
8609
|
totalProperty: 'data[0].TotalCount'
|
8610
|
}
|
8611
|
}
|
8612
|
}),
|
8613
|
listeners: {
|
8614
|
afterrender: function (f) {
|
8615
|
var store = Ext.StoreMgr.lookup('storeDisplay' + rec.FieldName);
|
8616
|
var ParamCombo = rec.ParamCombo;
|
8617
|
var param = '';
|
8618
|
//if (ParamCombo != '') {
|
8619
|
if ((rec.TableRef).toLowerCase() == 'phrom0001') {
|
8620
|
var splitParam = ParamCombo.split(']');
|
8621
|
switch (rec.FieldName) {
|
8622
|
case 'Position':
|
8623
|
ParamCombo = 'P'
|
8624
|
break;
|
8625
|
case 'CostCenter':
|
8626
|
ParamCombo = 'CC'
|
8627
|
break;
|
8628
|
case 'Organization':
|
8629
|
ParamCombo = 'O'
|
8630
|
break;
|
8631
|
case 'Job':
|
8632
|
ParamCombo = 'J'
|
8633
|
break;
|
8634
|
}
|
8635
|
//if (splitParam.length == 1) {
|
8636
|
param = 'StartDate[<=]' + MinovaUtil.GetNowDate() + 'EndDate[>=]' + MinovaUtil.GetNowDate() + ',ObjectClass[=]' + ParamCombo
|
8637
|
//} else {
|
8638
|
// param = ParamCombo;
|
8639
|
//}
|
8640
|
}
|
8641
|
//}
|
8642
|
Ext.Ajax.request({
|
8643
|
method: 'POST',
|
8644
|
async: false,
|
8645
|
url: '/UserControl/GetStore',
|
8646
|
params: {
|
8647
|
tableName: rec.TableRef,
|
8648
|
param: param
|
8649
|
},
|
8650
|
success: function (response) {
|
8651
|
var results = Ext.decode(response.responseText);
|
8652
|
|
8653
|
//dt = results.data;
|
8654
|
store.loadData(results.data);
|
8655
|
|
8656
|
}
|
8657
|
});
|
8658
|
},
|
8659
|
change: function (f) {
|
8660
|
//alert(this.valueField, value);
|
8661
|
var display = this.displayField;
|
8662
|
var value = this.getValue();
|
8663
|
var st = f.store
|
8664
|
var r = st.findRecord(f.valueField, f.value)
|
8665
|
if (r != null) {
|
8666
|
f.setRawValue(r.get(f.displayField))
|
8667
|
} else {
|
8668
|
f.setRawValue(f.value);
|
8669
|
|
8670
|
}
|
8671
|
}
|
8672
|
|
8673
|
},
|
8674
|
queryMode: 'local',
|
8675
|
displayField: displayValue,
|
8676
|
valueField: valueField,
|
8677
|
});
|
8678
|
} else {
|
8679
|
formfield = new Ext.form.Display({
|
8680
|
fieldLabel: rec.ScreenCaption,
|
8681
|
name: rec.FieldName,
|
8682
|
labelCls: 'label-minova',
|
8683
|
labelWidth: 150,
|
8684
|
//value: rec.DefaultValue,
|
8685
|
padding: 0,
|
8686
|
anchor: '80%'
|
8687
|
});
|
8688
|
}
|
8689
|
if (isDesk) {
|
8690
|
if (rec.Column == 1) {
|
8691
|
col1.push(formfield);
|
8692
|
} else {
|
8693
|
col2.push(formfield);
|
8694
|
}
|
8695
|
} else {
|
8696
|
col1.push(formfield);
|
8697
|
}
|
8698
|
|
8699
|
});
|
8700
|
//set allTable
|
8701
|
this.setAllTableName(allTable);
|
8702
|
}
|
8703
|
|
8704
|
Ext.applyIf(me, {
|
8705
|
items: [{
|
8706
|
bodyPadding: 0,
|
8707
|
width: 400,
|
8708
|
margin: '10 5 3 30',
|
8709
|
items: col1
|
8710
|
}, {
|
8711
|
bodyPadding: 0,
|
8712
|
width: 400,
|
8713
|
margin: '10 5 3 30',
|
8714
|
items: col2
|
8715
|
}, {
|
8716
|
width: 150,
|
8717
|
//margin: '10 5 3 30',
|
8718
|
items: [{
|
8719
|
xtype: 'image',
|
8720
|
id: 'imageusermd',
|
8721
|
name: 'imageusermd',
|
8722
|
width: 120,
|
8723
|
height: 150,
|
8724
|
padding: 5,
|
8725
|
border: true,
|
8726
|
src: '/Devt/GetFileData?FileName=' + Photo + '&download=false',
|
8727
|
}
|
8728
|
]
|
8729
|
}
|
8730
|
],
|
8731
|
});
|
8732
|
me.callParent(arguments);
|
8733
|
|
8734
|
}
|
8735
|
});
|
8736
|
/*Add Taufan (Header Master Data For ERP)*/
|
8737
|
Ext.define('MinovaUtil.MinovaES.MinovaHeaderMDLogistic', {
|
8738
|
extend: 'Ext.form.Panel',
|
8739
|
alias: ['widget.MinovaHeadermdLogistic', 'widget.MinovaHeaderMDLogistic', 'widget.minovaheadermdlogistic'],
|
8740
|
tablenameheader: undefined,
|
8741
|
keyid: undefined,
|
8742
|
allTableName: undefined,
|
8743
|
param: undefined,
|
8744
|
resizable: true,
|
8745
|
autoScroll: true,
|
8746
|
minHeight: 20,
|
8747
|
layout: 'column',
|
8748
|
name: 'HeaderMDLogistic',
|
8749
|
getAllTableName: function () {
|
8750
|
return this.allTableName;
|
8751
|
},
|
8752
|
setAllTableName: function (value) {
|
8753
|
var me = this;
|
8754
|
me.allTableName = value;
|
8755
|
return me;
|
8756
|
},
|
8757
|
listeners: {
|
8758
|
afterrender: function (me) {
|
8759
|
var nowDate = MinovaUtil.GetNowDate()
|
8760
|
var allTbl = me.getAllTableName();
|
8761
|
var splitTable = allTbl.split(',')
|
8762
|
splitTable.forEach(function (tbl) {
|
8763
|
var nowDate = MinovaUtil.GetNowDate();
|
8764
|
var parameter = me.keyid + '[=]' + getParam("KeyValue");
|
8765
|
Ext.Ajax.request({
|
8766
|
method: 'POST',
|
8767
|
url: '/UserControl/GetStore',
|
8768
|
params: {
|
8769
|
tableName: tbl,
|
8770
|
param: parameter
|
8771
|
},
|
8772
|
success: function (response) {
|
8773
|
var results = Ext.decode(response.responseText);
|
8774
|
hasil = results.data;
|
8775
|
if (hasil.length > 0) {
|
8776
|
me.getForm().setValues(hasil[0]);
|
8777
|
}
|
8778
|
}
|
8779
|
});
|
8780
|
});
|
8781
|
}
|
8782
|
},
|
8783
|
initComponent: function () {
|
8784
|
var me = this;
|
8785
|
var col1 = [];
|
8786
|
var col2 = [];
|
8787
|
var hasil = null;
|
8788
|
var LangId = localStorage.LangId;
|
8789
|
var allTable = null;
|
8790
|
var tbl = null;
|
8791
|
var tblTemp = null;
|
8792
|
var nowDate = MinovaUtil.GetNowDate();
|
8793
|
var Photo = 'nophoto.gif';
|
8794
|
var hasil = undefined;
|
8795
|
var parameter = me.keyid + '[=]' + getParam("KeyValue");
|
8796
|
Ext.Ajax.request({
|
8797
|
method: 'POST',
|
8798
|
async: false,
|
8799
|
url: '/UserControl/GetStore',
|
8800
|
params: {
|
8801
|
tableName: me.tablenameheader,
|
8802
|
param: parameter
|
8803
|
},
|
8804
|
success: function (response) {
|
8805
|
var results = Ext.decode(response.responseText);
|
8806
|
hasil = results.data;
|
8807
|
if (hasil.length > 0) {
|
8808
|
dataPhoto = hasil[0].Photo
|
8809
|
if (dataPhoto != "") {
|
8810
|
Photo = dataPhoto;
|
8811
|
}
|
8812
|
}
|
8813
|
}
|
8814
|
});
|
8815
|
Ext.Ajax.request({
|
8816
|
async: false,
|
8817
|
method: 'POST',
|
8818
|
url: '/UserControl/GetStore',
|
8819
|
params: {
|
8820
|
tableName: 'PDSBS0009',
|
8821
|
param: 'MenuID[=]' + MinovaUtil.GetMenuID() + ',LangId[=]' + LangId
|
8822
|
},
|
8823
|
success: function (response) {
|
8824
|
hasil = Ext.decode(response.responseText).data;
|
8825
|
}
|
8826
|
});
|
8827
|
hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
|
8828
|
if (hasil.length > 0) {
|
8829
|
Ext.each(hasil, function (rec) {
|
8830
|
tblTemp = rec.TableName;
|
8831
|
if (tbl != tblTemp) {
|
8832
|
tbl = tblTemp;
|
8833
|
if (allTable == null) {
|
8834
|
allTable = tbl
|
8835
|
} else {
|
8836
|
allTable = allTable + ',' + tbl
|
8837
|
}
|
8838
|
}
|
8839
|
if (rec.TableRef != '') {
|
8840
|
valueField = null;
|
8841
|
displayValue = null;
|
8842
|
Ext.Ajax.request({
|
8843
|
async: false,
|
8844
|
method: 'POST',
|
8845
|
url: '/UserControl/GetStore',
|
8846
|
params: {
|
8847
|
tableName: 'SDATATABLEFIELD',
|
8848
|
param: 'TableName[equal]' + rec.TableRef
|
8849
|
},
|
8850
|
success: function (response) {
|
8851
|
var results = Ext.decode(response.responseText);
|
8852
|
data_ = results.data;
|
8853
|
if (data_ != undefined) {
|
8854
|
valueField_ = $.grep(data_, function (r) {
|
8855
|
return r.ValueField == '1'
|
8856
|
});
|
8857
|
if (valueField_.length > 0) {
|
8858
|
valueField = valueField_[0].FieldName
|
8859
|
}
|
8860
|
displayValue_ = $.grep(data_, function (r) {
|
8861
|
return r.DisplayValue == '1'
|
8862
|
});
|
8863
|
if (displayValue_.length > 0) {
|
8864
|
displayValue = displayValue_[0].FieldName
|
8865
|
}
|
8866
|
}
|
8867
|
}
|
8868
|
});
|
8869
|
|
8870
|
formfield = new Ext.form.Display({
|
8871
|
fieldLabel: rec.ScreenCaption,
|
8872
|
name: rec.FieldName,
|
8873
|
padding: 0,
|
8874
|
labelCls: 'label-minova',
|
8875
|
labelWidth: 150,
|
8876
|
anchor: '80%',
|
8877
|
store: Ext.create('Ext.data.Store', {
|
8878
|
storeId: 'storeDisplay' + rec.FieldName,
|
8879
|
proxy: {
|
8880
|
method: 'POST',
|
8881
|
type: 'ajax',
|
8882
|
extraParams: {
|
8883
|
tableName: rec.TableRef,
|
8884
|
param: ''
|
8885
|
},
|
8886
|
reader: {
|
8887
|
type: 'json',
|
8888
|
root: 'data',
|
8889
|
totalProperty: 'data[0].TotalCount'
|
8890
|
}
|
8891
|
}
|
8892
|
}),
|
8893
|
listeners: {
|
8894
|
afterrender: function (f) {
|
8895
|
var store = Ext.StoreMgr.lookup('storeDisplay' + rec.FieldName);
|
8896
|
var ParamCombo = rec.ParamCombo;
|
8897
|
var param = '';
|
8898
|
Ext.Ajax.request({
|
8899
|
method: 'POST',
|
8900
|
async: false,
|
8901
|
url: '/UserControl/GetStore',
|
8902
|
params: {
|
8903
|
tableName: rec.TableRef,
|
8904
|
param: param
|
8905
|
},
|
8906
|
success: function (response) {
|
8907
|
var results = Ext.decode(response.responseText);
|
8908
|
store.loadData(results.data);
|
8909
|
}
|
8910
|
});
|
8911
|
},
|
8912
|
change: function (f) {
|
8913
|
var display = this.displayField;
|
8914
|
var value = this.getValue();
|
8915
|
var st = f.store
|
8916
|
var r = st.findRecord(f.valueField, f.value)
|
8917
|
if (r != null) {
|
8918
|
f.setRawValue(r.get(f.displayField))
|
8919
|
} else {
|
8920
|
f.setRawValue(f.value);
|
8921
|
}
|
8922
|
}
|
8923
|
},
|
8924
|
queryMode: 'local',
|
8925
|
displayField: displayValue,
|
8926
|
valueField: valueField,
|
8927
|
});
|
8928
|
} else {
|
8929
|
formfield = new Ext.form.Display({
|
8930
|
fieldLabel: rec.ScreenCaption,
|
8931
|
name: rec.FieldName,
|
8932
|
labelCls: 'label-minova',
|
8933
|
labelWidth: 150,
|
8934
|
padding: 0,
|
8935
|
anchor: '80%'
|
8936
|
});
|
8937
|
}
|
8938
|
if (isDesk) {
|
8939
|
if (rec.Column == 1) {
|
8940
|
col1.push(formfield);
|
8941
|
} else {
|
8942
|
col2.push(formfield);
|
8943
|
}
|
8944
|
} else {
|
8945
|
col1.push(formfield);
|
8946
|
}
|
8947
|
|
8948
|
});
|
8949
|
this.setAllTableName(allTable);
|
8950
|
}
|
8951
|
Ext.applyIf(me, {
|
8952
|
items: [{
|
8953
|
bodyPadding: 0,
|
8954
|
width: 400,
|
8955
|
margin: '10 5 3 30',
|
8956
|
items: col1
|
8957
|
}, {
|
8958
|
bodyPadding: 0,
|
8959
|
width: 400,
|
8960
|
margin: '10 5 3 30',
|
8961
|
items: col2
|
8962
|
}, {
|
8963
|
width: 150,
|
8964
|
items: [{
|
8965
|
xtype: 'image',
|
8966
|
id: 'imageusermd',
|
8967
|
name: 'imageusermd',
|
8968
|
width: 120,
|
8969
|
height: 150,
|
8970
|
padding: 5,
|
8971
|
border: true,
|
8972
|
src: '/Devt/GetFileData?FileName=' + Photo + '&download=false',
|
8973
|
}
|
8974
|
]
|
8975
|
}
|
8976
|
]
|
8977
|
});
|
8978
|
me.callParent(arguments);
|
8979
|
}
|
8980
|
});
|
8981
|
Ext.define('MinovaUtil.MinovaES.Column.MinovaDateTimeColumn', {
|
8982
|
extend: 'Ext.grid.column.Column',
|
8983
|
alias: ['widget.minovadatetimecolumn'],
|
8984
|
alternateClassName: 'Ext.grid.MinovaDateTimeColumn',
|
8985
|
undefinedText: ' ',
|
8986
|
defaultRenderer: function (value) {
|
8987
|
//hamid200916
|
8988
|
//if (value === undefined) {
|
8989
|
if (value === "") {
|
8990
|
return this.undefinedText;
|
8991
|
//end
|
8992
|
}
|
8993
|
|
8994
|
var d = value.substring(6, 8);
|
8995
|
var m = value.substring(4, 6);
|
8996
|
var y = value.substring(0, 4);
|
8997
|
var h = value.substring(8, 10);
|
8998
|
var mt = value.substring(10, 12);
|
8999
|
var s = value.substring(12, 14);
|
9000
|
var hasil = d + '/' + m + '/' + y + ' ' + ' ' + h + ':' + mt + ':' + s;
|
9001
|
return hasil;
|
9002
|
}
|
9003
|
});
|
9004
|
Ext.define('MinovaUtil.MinovaES.Column.MinovaDateColumn', {
|
9005
|
extend: 'Ext.grid.column.Column',
|
9006
|
alias: ['widget.minovadatecolumn'],
|
9007
|
alternateClassName: 'Ext.grid.MinovaDateColumn',
|
9008
|
undefinedText: ' ',
|
9009
|
defaultRenderer: function (value) {
|
9010
|
if (value === "" || value === undefined || value === null) {
|
9011
|
return "";
|
9012
|
}
|
9013
|
var d = value.substring(6, 8);
|
9014
|
var m = value.substring(4, 6);
|
9015
|
var y = value.substring(0, 4);
|
9016
|
var hasil = d + '/' + m + '/' + y;
|
9017
|
return hasil;
|
9018
|
}
|
9019
|
});
|
9020
|
Ext.define('MinovaUtil.MinovaES.MinovaComboColumn', {
|
9021
|
extend: 'Ext.grid.column.Column',
|
9022
|
alias: ['widget.minovacombocolumn'],
|
9023
|
initComponent: function () {
|
9024
|
this.callParent(arguments);
|
9025
|
},
|
9026
|
defaultRenderer: function (value) {
|
9027
|
if (typeof(this.store) !== 'object') {
|
9028
|
Ext.data.StoreManager.lookup(this.store).load();
|
9029
|
this.store = Ext.data.StoreManager.lookup(this.store);
|
9030
|
}
|
9031
|
var idx = this.store.findExact(this.valueField, value);
|
9032
|
if (this.store.getAt(idx)) {
|
9033
|
var result = this.store.getAt(idx).get(this.displayField);
|
9034
|
value = result ? result : value;
|
9035
|
}
|
9036
|
return value;
|
9037
|
}
|
9038
|
});
|
9039
|
//atien
|
9040
|
Ext.define('MinovaUtil.MinovaES.MinovaAmountColumn', {
|
9041
|
extend: 'Ext.grid.column.Column',
|
9042
|
alias: ['widget.minovaamountcolumn'],
|
9043
|
initComponent: function () {
|
9044
|
this.callParent(arguments);
|
9045
|
},
|
9046
|
defaultRenderer: function (value) {
|
9047
|
if (value != "") {
|
9048
|
Ext.Ajax.request({
|
9049
|
async: false,
|
9050
|
method: 'POST',
|
9051
|
url: '/Devt/DecryptData',
|
9052
|
params: {
|
9053
|
dt: value
|
9054
|
|
9055
|
},
|
9056
|
success: function (response) {
|
9057
|
var results = Ext.decode(response.responseText);
|
9058
|
value = results.data;
|
9059
|
Ext.util.Format.thousandSeparator = "."
|
9060
|
|
9061
|
value = Ext.util.Format.number(value, '0,000');
|
9062
|
}
|
9063
|
});
|
9064
|
}
|
9065
|
|
9066
|
return value;
|
9067
|
}
|
9068
|
});
|
9069
|
//end amount column
|
9070
|
//hamid200916
|
9071
|
Ext.define('MinovaUtil.MinovaES.MinovaMDApplicant', {
|
9072
|
extend: 'Ext.form.Panel',
|
9073
|
alias: ['widget.minovamdApp', 'widget.MinovaMDApplicant'],
|
9074
|
controller: 'recruitment-controller',
|
9075
|
tableName: undefined, //nama tabel
|
9076
|
param: undefined, //param query
|
9077
|
pagesize: undefined,
|
9078
|
storename: undefined,
|
9079
|
titleform: undefined,
|
9080
|
titlegrid: undefined,
|
9081
|
heightgrid: undefined,
|
9082
|
heightform: undefined,
|
9083
|
iseditform: undefined,
|
9084
|
lastheightform: undefined,
|
9085
|
layoutType: undefined,
|
9086
|
lastpage: undefined,
|
9087
|
lastTitle: undefined,
|
9088
|
getLastTitle: function () {
|
9089
|
return this.lastTitle;
|
9090
|
},
|
9091
|
setLastTitle: function (value) {
|
9092
|
var me = this;
|
9093
|
me.lastTitle = value;
|
9094
|
return me;
|
9095
|
},
|
9096
|
getLastpage: function () {
|
9097
|
return this.lastpage;
|
9098
|
},
|
9099
|
setLastpage: function (value) {
|
9100
|
var me = this;
|
9101
|
me.lastpage = value;
|
9102
|
return me;
|
9103
|
},
|
9104
|
getLayoutType: function () {
|
9105
|
return this.layoutType;
|
9106
|
},
|
9107
|
setLayoutType: function (value) {
|
9108
|
var me = this;
|
9109
|
me.layoutType = value;
|
9110
|
return me;
|
9111
|
},
|
9112
|
getLastheightform: function () {
|
9113
|
return this.lastheightform;
|
9114
|
},
|
9115
|
setLastheightform: function (value) {
|
9116
|
var me = this;
|
9117
|
me.lastheightform = value;
|
9118
|
return me;
|
9119
|
},
|
9120
|
|
9121
|
getIsEditform: function () {
|
9122
|
return this.iseditform;
|
9123
|
},
|
9124
|
setIsEditform: function (value) {
|
9125
|
var me = this;
|
9126
|
me.iseditform = value;
|
9127
|
return me;
|
9128
|
},
|
9129
|
initComponent: function () {
|
9130
|
var me = this;
|
9131
|
var storename = me.storename;
|
9132
|
if (storename == "" || storename == undefined) {
|
9133
|
storename = "store" + me.tableName;
|
9134
|
}
|
9135
|
var isHired = false;
|
9136
|
nowDate = MinovaUtil.GetNowDate();
|
9137
|
Ext.Ajax.request({
|
9138
|
async: false,
|
9139
|
method: 'POST',
|
9140
|
url: '/UserControl/GetStore',
|
9141
|
params: {
|
9142
|
tableName: 'PHRRC0002',
|
9143
|
param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("ApplicantID")
|
9144
|
|
9145
|
},
|
9146
|
success: function (response) {
|
9147
|
var results = Ext.decode(response.responseText);
|
9148
|
dataForm = results.data;
|
9149
|
//cek is hired or blacklist
|
9150
|
dataForm_ = $.grep(dataForm, function (r) {
|
9151
|
return r.ApplicantStatus == '05'
|
9152
|
});
|
9153
|
if (dataForm_.length == 0) {
|
9154
|
dataForm_ = $.grep(dataForm, function (r) {
|
9155
|
return r.ApplicantStatus == '99'
|
9156
|
});
|
9157
|
}
|
9158
|
if (dataForm_ != null && dataForm_.length > 0) {
|
9159
|
isHired = true;
|
9160
|
}
|
9161
|
}
|
9162
|
});
|
9163
|
|
9164
|
var tableName = me.tableName;
|
9165
|
Ext.applyIf(me, {
|
9166
|
items: [{
|
9167
|
layoutType: "MinovaGridForm",
|
9168
|
title: me.titlegrid,
|
9169
|
xtype: "minovagrid1",
|
9170
|
tableName: tableName, // nama tebel/dataset
|
9171
|
name: "MinovaGridFormGrid",
|
9172
|
param: me.param, // parameter filteran
|
9173
|
pagesize: me.pagesize, // jumlah record yang muncul per page
|
9174
|
storename: storename, //nama store bebas
|
9175
|
isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
|
9176
|
height: 330,
|
9177
|
bodyPadding: 0,
|
9178
|
tbar: [{
|
9179
|
|
9180
|
xtype: 'button',
|
9181
|
text: 'Action',
|
9182
|
name: 'actionGrid',
|
9183
|
hidden: isHired,
|
9184
|
menu: [{
|
9185
|
text: 'Add',
|
9186
|
name: 'addGrid',
|
9187
|
action: 'CRUDaddNewRecord',
|
9188
|
style: 'font-family: FontAwesome',
|
9189
|
itemId: 'AddData',
|
9190
|
iconCls: 'fa-plus-circle',
|
9191
|
hidden: isHired
|
9192
|
|
9193
|
}, {
|
9194
|
text: 'Copy',
|
9195
|
name: 'CopyGrid',
|
9196
|
iconCls: 'fa-copy',
|
9197
|
style: 'font-family: FontAwesome',
|
9198
|
hidden: isHired
|
9199
|
}, {
|
9200
|
text: 'Edit',
|
9201
|
name: 'EditGrid',
|
9202
|
iconCls: 'fa-edit',
|
9203
|
style: 'font-family: FontAwesome',
|
9204
|
hidden: isHired
|
9205
|
}, {
|
9206
|
text: 'Delete',
|
9207
|
name: 'DeleteGrid',
|
9208
|
hidden: true,
|
9209
|
iconCls: 'fa-trash-o',
|
9210
|
style: 'font-family: FontAwesome',
|
9211
|
}
|
9212
|
],
|
9213
|
listeners: {
|
9214
|
afterender: function () {
|
9215
|
var me = this;
|
9216
|
nowDate = MinovaUtil.GetNowDate();
|
9217
|
var isHired = false;
|
9218
|
Ext.Ajax.request({
|
9219
|
async: false,
|
9220
|
method: 'POST',
|
9221
|
url: '/UserControl/GetStore',
|
9222
|
params: {
|
9223
|
tableName: 'PHRRC0027',
|
9224
|
param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("ApplicantID") + ',ActivityType[=]8'
|
9225
|
|
9226
|
},
|
9227
|
success: function (response) {
|
9228
|
var results = Ext.decode(response.responseText);
|
9229
|
dataForm = results.data;
|
9230
|
if (dataForm != null) {
|
9231
|
isHired = true;
|
9232
|
}
|
9233
|
}
|
9234
|
});
|
9235
|
if (isHired) {
|
9236
|
me.setHidden(true);
|
9237
|
} else {
|
9238
|
me.setHidden(false);
|
9239
|
}
|
9240
|
|
9241
|
},
|
9242
|
|
9243
|
},
|
9244
|
}, {
|
9245
|
xtype: 'tbfill'
|
9246
|
}, {
|
9247
|
text: 'Clear Filters',
|
9248
|
tooltip: 'Clear all filters',
|
9249
|
name: 'clearbtn',
|
9250
|
handler: function () {
|
9251
|
var tolbar = this.up()
|
9252
|
var grid_ = tolbar.up()
|
9253
|
grid_.filters.clearFilters()
|
9254
|
}
|
9255
|
}, ],
|
9256
|
|
9257
|
dockedItems: [{
|
9258
|
xtype: 'pagingtoolbar',
|
9259
|
store: storename, // harus sama dengan naa store diatas
|
9260
|
dock: 'bottom', //posisi paging
|
9261
|
pageSize: me.pagesize,
|
9262
|
displayInfo: true
|
9263
|
}
|
9264
|
],
|
9265
|
|
9266
|
}, {
|
9267
|
xtype: 'minovaform',
|
9268
|
name: "MinovaGridFormDisplay",
|
9269
|
tableName: tableName, // nama tabel /dataset
|
9270
|
isLookup: '', // 1 or 'Y' for lookup
|
9271
|
isDisplay: true, // true== form is displayfield
|
9272
|
}, {
|
9273
|
xtype: 'minovaform',
|
9274
|
name: "MinovaGridFormEdit",
|
9275
|
tableName: tableName, // nama tabel /dataset
|
9276
|
isLookup: '', // 1 or 'Y' for lookup
|
9277
|
isDisplay: false, // true== form is displayfield
|
9278
|
}
|
9279
|
]
|
9280
|
});
|
9281
|
me.callParent(arguments);
|
9282
|
}
|
9283
|
});
|
9284
|
//end
|
9285
|
|
9286
|
Ext.define('MinovaUtil.MinovaES.MinovaMD', {
|
9287
|
extend: 'Ext.form.Panel',
|
9288
|
alias: ['widget.minovamd', 'widget.MinovaMD'],
|
9289
|
controller: 'pa-controller',
|
9290
|
tableName: undefined, //nama tabel
|
9291
|
param: undefined, //param query
|
9292
|
pagesize: undefined,
|
9293
|
storename: undefined,
|
9294
|
titleform: undefined,
|
9295
|
titlegrid: undefined,
|
9296
|
heightgrid: undefined,
|
9297
|
heightform: undefined,
|
9298
|
iseditform: undefined,
|
9299
|
lastheightform: undefined,
|
9300
|
layoutType: undefined,
|
9301
|
lastpage: undefined,
|
9302
|
lastTitle: undefined,
|
9303
|
getLastTitle: function () {
|
9304
|
return this.lastTitle;
|
9305
|
},
|
9306
|
setLastTitle: function (value) {
|
9307
|
var me = this;
|
9308
|
me.lastTitle = value;
|
9309
|
return me;
|
9310
|
},
|
9311
|
getLastpage: function () {
|
9312
|
return this.lastpage;
|
9313
|
},
|
9314
|
setLastpage: function (value) {
|
9315
|
var me = this;
|
9316
|
me.lastpage = value;
|
9317
|
return me;
|
9318
|
},
|
9319
|
getLayoutType: function () {
|
9320
|
return this.layoutType;
|
9321
|
},
|
9322
|
setLayoutType: function (value) {
|
9323
|
var me = this;
|
9324
|
me.layoutType = value;
|
9325
|
return me;
|
9326
|
},
|
9327
|
getLastheightform: function () {
|
9328
|
return this.lastheightform;
|
9329
|
},
|
9330
|
setLastheightform: function (value) {
|
9331
|
var me = this;
|
9332
|
me.lastheightform = value;
|
9333
|
return me;
|
9334
|
},
|
9335
|
|
9336
|
getIsEditform: function () {
|
9337
|
return this.iseditform;
|
9338
|
},
|
9339
|
setIsEditform: function (value) {
|
9340
|
var me = this;
|
9341
|
me.iseditform = value;
|
9342
|
return me;
|
9343
|
},
|
9344
|
initComponent: function () {
|
9345
|
var me = this;
|
9346
|
var storename = me.storename;
|
9347
|
if (storename == "" || storename == undefined) {
|
9348
|
storename = "store" + me.tableName;
|
9349
|
}
|
9350
|
var tableName = me.tableName;
|
9351
|
Ext.applyIf(me, {
|
9352
|
items: [{
|
9353
|
layoutType: "MinovaGridForm",
|
9354
|
title: me.titlegrid,
|
9355
|
xtype: "minovagrid1",
|
9356
|
tableName: tableName, // nama tebel/dataset
|
9357
|
name: "MinovaGridFormGrid",
|
9358
|
param: me.param, // parameter filteran
|
9359
|
pagesize: me.pagesize, // jumlah record yang muncul per page
|
9360
|
storename: storename, //nama store bebas
|
9361
|
isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
|
9362
|
height: 330,
|
9363
|
bodyPadding: 0,
|
9364
|
tbar: [{
|
9365
|
xtype: 'button',
|
9366
|
text: 'Action',
|
9367
|
name: 'actionGrid',
|
9368
|
menu: [{
|
9369
|
text: 'Add',
|
9370
|
name: 'addGrid',
|
9371
|
action: 'CRUDaddNewRecord',
|
9372
|
style: 'font-family: FontAwesome',
|
9373
|
itemId: 'AddData',
|
9374
|
iconCls: 'fa-plus-circle',
|
9375
|
|
9376
|
}, {
|
9377
|
text: 'Copy',
|
9378
|
name: 'CopyGrid',
|
9379
|
iconCls: 'fa-copy',
|
9380
|
style: 'font-family: FontAwesome',
|
9381
|
}, {
|
9382
|
text: 'Edit',
|
9383
|
name: 'EditGrid',
|
9384
|
iconCls: 'fa-edit',
|
9385
|
style: 'font-family: FontAwesome',
|
9386
|
}, {
|
9387
|
text: 'Delete',
|
9388
|
name: 'DeleteGrid',
|
9389
|
hidden: true,
|
9390
|
iconCls: 'fa-trash-o',
|
9391
|
style: 'font-family: FontAwesome',
|
9392
|
}
|
9393
|
]
|
9394
|
}, {
|
9395
|
xtype: 'tbfill'
|
9396
|
}, {
|
9397
|
text: 'Clear Filters',
|
9398
|
tooltip: 'Clear all filters',
|
9399
|
name: 'clearbtn',
|
9400
|
handler: function () {
|
9401
|
var tolbar = this.up()
|
9402
|
var grid_ = tolbar.up()
|
9403
|
grid_.filters.clearFilters()
|
9404
|
}
|
9405
|
}, ],
|
9406
|
|
9407
|
dockedItems: [{
|
9408
|
xtype: 'pagingtoolbar',
|
9409
|
store: storename, // harus sama dengan naa store diatas
|
9410
|
dock: 'bottom', //posisi paging
|
9411
|
pageSize: me.pagesize,
|
9412
|
displayInfo: true
|
9413
|
}
|
9414
|
],
|
9415
|
|
9416
|
}, {
|
9417
|
xtype: 'minovaform',
|
9418
|
name: "MinovaGridFormDisplay",
|
9419
|
tableName: tableName, // nama tabel /dataset
|
9420
|
isLookup: '', // 1 or 'Y' for lookup
|
9421
|
isDisplay: true, // true== form is displayfield
|
9422
|
}, {
|
9423
|
xtype: 'minovaform',
|
9424
|
name: "MinovaGridFormEdit",
|
9425
|
tableName: tableName, // nama tabel /dataset
|
9426
|
isLookup: '', // 1 or 'Y' for lookup
|
9427
|
isDisplay: false, // true== form is displayfield
|
9428
|
}
|
9429
|
]
|
9430
|
});
|
9431
|
me.callParent(arguments);
|
9432
|
}
|
9433
|
});
|
9434
|
|
9435
|
Ext.define('MinovaUtil.MinovaES.MinovaCustomization', {
|
9436
|
extend: 'Ext.form.Panel',
|
9437
|
alias: ['widget.minovacustomization', 'widget.MinovaCustomization'],
|
9438
|
controller: 'treeCustomization',
|
9439
|
tableName: undefined, //nama tabel
|
9440
|
param: undefined, //param query
|
9441
|
pagesize: undefined,
|
9442
|
storename: undefined,
|
9443
|
titleform: undefined,
|
9444
|
titlegrid: undefined,
|
9445
|
heightgrid: undefined,
|
9446
|
heightform: undefined,
|
9447
|
iseditform: undefined,
|
9448
|
lastheightform: undefined,
|
9449
|
layoutType: undefined,
|
9450
|
lastpage: undefined,
|
9451
|
lastTitle: undefined,
|
9452
|
collapsibleForm: undefined,
|
9453
|
getLastTitle: function () {
|
9454
|
return this.lastTitle;
|
9455
|
},
|
9456
|
setLastTitle: function (value) {
|
9457
|
var me = this;
|
9458
|
me.lastTitle = value;
|
9459
|
return me;
|
9460
|
},
|
9461
|
getLastpage: function () {
|
9462
|
return this.lastpage;
|
9463
|
},
|
9464
|
setLastpage: function (value) {
|
9465
|
var me = this;
|
9466
|
me.lastpage = value;
|
9467
|
return me;
|
9468
|
},
|
9469
|
getLayoutType: function () {
|
9470
|
return this.layoutType;
|
9471
|
},
|
9472
|
setLayoutType: function (value) {
|
9473
|
var me = this;
|
9474
|
me.layoutType = value;
|
9475
|
return me;
|
9476
|
},
|
9477
|
getLastheightform: function () {
|
9478
|
return this.lastheightform;
|
9479
|
},
|
9480
|
setLastheightform: function (value) {
|
9481
|
var me = this;
|
9482
|
me.lastheightform = value;
|
9483
|
return me;
|
9484
|
},
|
9485
|
|
9486
|
getIsEditform: function () {
|
9487
|
return this.iseditform;
|
9488
|
},
|
9489
|
setIsEditform: function (value) {
|
9490
|
var me = this;
|
9491
|
me.iseditform = value;
|
9492
|
return me;
|
9493
|
},
|
9494
|
initComponent: function () {
|
9495
|
var me = this;
|
9496
|
var storename = me.storename;
|
9497
|
if (storename == "" || storename == undefined) {
|
9498
|
storename = "store" + me.tableName;
|
9499
|
}
|
9500
|
var tableName = me.tableName;
|
9501
|
var collapsibleForm_ = me.collapsibleForm;
|
9502
|
// if (!collapsibleForm_) {
|
9503
|
// collapsibleForm_ = false;
|
9504
|
//}
|
9505
|
Ext.applyIf(me, {
|
9506
|
items: [{
|
9507
|
layoutType: "MinovaGridForm",
|
9508
|
title: me.titlegrid,
|
9509
|
xtype: "minovagrid1",
|
9510
|
tableName: tableName, // nama tebel/dataset
|
9511
|
name: "MinovaGridFormGrid",
|
9512
|
param: me.param, // parameter filteran
|
9513
|
pagesize: me.pagesize, // jumlah record yang muncul per page
|
9514
|
storename: storename, //nama store bebas
|
9515
|
isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
|
9516
|
height: 480,
|
9517
|
bodyPadding: 0,
|
9518
|
tbar: [{
|
9519
|
xtype: 'button',
|
9520
|
text: 'Action',
|
9521
|
name: 'actionGrid',
|
9522
|
menu: [{
|
9523
|
text: 'Add',
|
9524
|
name: 'addGrid',
|
9525
|
action: 'CRUDaddNewRecord',
|
9526
|
style: 'font-family: FontAwesome',
|
9527
|
itemId: 'AddData',
|
9528
|
iconCls: 'fa-plus-circle',
|
9529
|
|
9530
|
}, {
|
9531
|
text: 'Copy',
|
9532
|
name: 'CopyGrid',
|
9533
|
iconCls: 'fa-copy',
|
9534
|
style: 'font-family: FontAwesome',
|
9535
|
}, {
|
9536
|
text: 'Edit',
|
9537
|
name: 'EditGrid',
|
9538
|
iconCls: 'fa-edit',
|
9539
|
style: 'font-family: FontAwesome',
|
9540
|
}, {
|
9541
|
text: 'Delete',
|
9542
|
name: 'DeleteGrid',
|
9543
|
hidden: true,
|
9544
|
iconCls: 'fa-trash-o',
|
9545
|
style: 'font-family: FontAwesome',
|
9546
|
}
|
9547
|
]
|
9548
|
}, {
|
9549
|
xtype: 'tbfill'
|
9550
|
}, {
|
9551
|
text: 'Search',
|
9552
|
tooltip: 'Search',
|
9553
|
tableName: tableName,
|
9554
|
name: 'btnSearchCust',
|
9555
|
handler: function () {
|
9556
|
//var tolbar = this.up()
|
9557
|
//var grid_ = tolbar.up()
|
9558
|
//alert(this.tableName)
|
9559
|
|
9560
|
}
|
9561
|
|
9562
|
}, {
|
9563
|
text: 'Import/Export',
|
9564
|
tooltip: 'Import/Export',
|
9565
|
name: 'Import/Exportbtn',
|
9566
|
|
9567
|
}, {
|
9568
|
text: 'Clear Filters',
|
9569
|
tooltip: 'Clear all filters',
|
9570
|
name: 'clearbtn',
|
9571
|
handler: function () {
|
9572
|
var tolbar = this.up()
|
9573
|
var grid_ = tolbar.up()
|
9574
|
grid_.filters.clearFilters()
|
9575
|
}
|
9576
|
}
|
9577
|
],
|
9578
|
|
9579
|
dockedItems: [{
|
9580
|
xtype: 'pagingtoolbar',
|
9581
|
store: storename, // harus sama dengan naa store diatas
|
9582
|
dock: 'bottom', //posisi paging
|
9583
|
pageSize: me.pagesize,
|
9584
|
displayInfo: true
|
9585
|
}
|
9586
|
],
|
9587
|
|
9588
|
}, {
|
9589
|
xtype: 'minovaform',
|
9590
|
//layout: 'anchor',
|
9591
|
height: '200',
|
9592
|
collapsible: collapsibleForm_,
|
9593
|
name: "MinovaGridFormDisplay",
|
9594
|
tableName: tableName, // nama tabel /dataset
|
9595
|
isLookup: '', // 1 or 'Y' for lookup
|
9596
|
isDisplay: true, // true== form is displayfield
|
9597
|
}, {
|
9598
|
xtype: 'minovaform',
|
9599
|
//layout:'anchor',
|
9600
|
collapsible: collapsibleForm_,
|
9601
|
name: "MinovaGridFormEdit",
|
9602
|
tableName: tableName, // nama tabel /dataset
|
9603
|
isLookup: '', // 1 or 'Y' for lookup
|
9604
|
isDisplay: false, // true== form is displayfield
|
9605
|
}
|
9606
|
]
|
9607
|
});
|
9608
|
me.callParent(arguments);
|
9609
|
}
|
9610
|
});
|
9611
|
|
9612
|
Ext.define('MinovaUtil.view.override.Panel', {
|
9613
|
override: 'Ext.panel.Panel',
|
9614
|
|
9615
|
print: function (pnl) {
|
9616
|
|
9617
|
if (!pnl) {
|
9618
|
pnl = this;
|
9619
|
}
|
9620
|
|
9621
|
// instantiate hidden iframe
|
9622
|
|
9623
|
var iFrameId = "printerFrame";
|
9624
|
var printFrame = Ext.get(iFrameId);
|
9625
|
|
9626
|
if (printFrame == null) {
|
9627
|
printFrame = Ext.getBody().appendChild({
|
9628
|
id: iFrameId,
|
9629
|
tag: 'iframe',
|
9630
|
cls: 'x-hidden',
|
9631
|
style: {
|
9632
|
display: "none"
|
9633
|
}
|
9634
|
});
|
9635
|
}
|
9636
|
|
9637
|
var cw = printFrame.dom.contentWindow;
|
9638
|
|
9639
|
// instantiate application stylesheets in the hidden iframe
|
9640
|
|
9641
|
var stylesheets = "";
|
9642
|
for (var i = 0; i < document.styleSheets.length; i++) {
|
9643
|
stylesheets += Ext.String.format('<link rel="stylesheet" href="{0}" />', document.styleSheets[i].href);
|
9644
|
}
|
9645
|
|
9646
|
// various style overrides
|
9647
|
stylesheets += ''.concat(
|
9648
|
"<style>",
|
9649
|
".x-panel-body {overflow: visible !important;}",
|
9650
|
// experimental - page break after embedded panels
|
9651
|
// .x-panel {page-break-after: always; margin-top: 10px}",
|
9652
|
"</style>");
|
9653
|
|
9654
|
// get the contents of the panel and remove hardcoded overflow properties
|
9655
|
var markup = pnl.getEl().dom.innerHTML;
|
9656
|
while (markup.indexOf('overflow: auto;') >= 0) {
|
9657
|
markup = markup.replace('overflow: auto;', '');
|
9658
|
}
|
9659
|
|
9660
|
var str = Ext.String.format('<html><head>{0}</head><body>{1}</body></html>', stylesheets, markup);
|
9661
|
|
9662
|
// output to the iframe
|
9663
|
cw.document.open();
|
9664
|
cw.document.write(str);
|
9665
|
cw.document.close();
|
9666
|
|
9667
|
// remove style attrib that has hardcoded height property
|
9668
|
cw.document.getElementsByTagName('DIV')[0].removeAttribute('style');
|
9669
|
|
9670
|
// print the iframe
|
9671
|
cw.print();
|
9672
|
|
9673
|
// destroy the iframe
|
9674
|
Ext.fly(iFrameId).destroy();
|
9675
|
|
9676
|
}
|
9677
|
});
|
9678
|
|
9679
|
Ext.define('MinovaUtil.MinovaES.MinovaRptForm', {
|
9680
|
extend: 'Ext.form.Panel',
|
9681
|
alias: ['widget.MinovaRptForm', 'widget.minovarptform'],
|
9682
|
ReportID: undefined,
|
9683
|
SelectionType: undefined,
|
9684
|
layout: 'column',
|
9685
|
//frame : true,
|
9686
|
defaults: {
|
9687
|
layout: 'form',
|
9688
|
xtype: 'container',
|
9689
|
defaultType: 'textfield',
|
9690
|
style: 'width: 50%',
|
9691
|
//height: 1000
|
9692
|
},
|
9693
|
initComponent: function () {
|
9694
|
var col1 = [];
|
9695
|
var col2 = [];
|
9696
|
var me = this;
|
9697
|
var hasil = null;
|
9698
|
var hideButton_ = me.hideButton;
|
9699
|
Ext.Ajax.request({
|
9700
|
async: false,
|
9701
|
method: 'POST',
|
9702
|
url: '/UserControl/GetStore',
|
9703
|
params: {
|
9704
|
tableName: 'PDSBS0006',
|
9705
|
//param : "ReportID='" + me.ReportID + "' and SelectionType='" + me.SelectionType + "' and LangId='" + localStorage.LangId + "'"
|
9706
|
param: "ReportID='" + me.ReportID + "',SelectionType='" + me.SelectionType + "',LangId='" + localStorage.LangId + "'"
|
9707
|
},
|
9708
|
success: function (response) {
|
9709
|
var results = Ext.decode(response.responseText);
|
9710
|
hasil = results.data;
|
9711
|
//count = hasil.length
|
9712
|
}
|
9713
|
});
|
9714
|
if (hasil.length > 0) {
|
9715
|
hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
|
9716
|
var me = this;
|
9717
|
Ext.each(hasil, function (rec) {
|
9718
|
var null_ = true;
|
9719
|
if (rec.IsRequired == '1') {
|
9720
|
null_ = false;
|
9721
|
} else {
|
9722
|
null_ = true;
|
9723
|
}
|
9724
|
var formfield = MinovaUtil.FieldGenerator.Form(me.name, rec, null_, false, me.tableName, me.isLookup);
|
9725
|
if (isDesk) {
|
9726
|
if (rec.ColumnNo == 1) {
|
9727
|
col1.push(formfield);
|
9728
|
} else {
|
9729
|
col2.push(formfield);
|
9730
|
}
|
9731
|
} else {
|
9732
|
col1.push(formfield);
|
9733
|
}
|
9734
|
});
|
9735
|
|
9736
|
}
|
9737
|
Ext.applyIf(me, {
|
9738
|
items: [{
|
9739
|
style: 'width: 50%',
|
9740
|
items: col1
|
9741
|
}, {
|
9742
|
style: 'width: 50%',
|
9743
|
items: col2
|
9744
|
}
|
9745
|
],
|
9746
|
});
|
9747
|
this.callParent();
|
9748
|
}
|
9749
|
});
|
9750
|
|
9751
|
Ext.define('MinovaUtil.MinovaES.MinovaRptSimple', {
|
9752
|
extend: 'Ext.form.Panel',
|
9753
|
alias: ['widget.MinovaRptSimple', 'widget.minovarptsimple'],
|
9754
|
//layout: 'column',
|
9755
|
controller: 'basereports-controller',
|
9756
|
ReportID: undefined,
|
9757
|
hideButton: undefined,
|
9758
|
reportLayout: 'simple',
|
9759
|
getReportLayout: function () {
|
9760
|
return this.reportLayout;
|
9761
|
},
|
9762
|
setReportLayout: function (value) {
|
9763
|
var me = this;
|
9764
|
me.reportLayout = value;
|
9765
|
return me;
|
9766
|
},
|
9767
|
|
9768
|
initComponent: function () {
|
9769
|
var me = this;
|
9770
|
var ReportID = me.ReportID;
|
9771
|
var hideButton_ = me.hideButton;
|
9772
|
var hide_ = false;
|
9773
|
if (hideButton_) {
|
9774
|
hide_ = true;
|
9775
|
}
|
9776
|
Ext.applyIf(me, {
|
9777
|
items: [{
|
9778
|
//title: 'Report Selection',
|
9779
|
xtype: 'minovarptform',
|
9780
|
hideButton: hide_,
|
9781
|
name: 'minovarptsimple',
|
9782
|
ReportID: ReportID,
|
9783
|
SelectionType: '1',
|
9784
|
bodyPadding: 10,
|
9785
|
buttons: [{
|
9786
|
text: 'Search',
|
9787
|
name: 'SearchRpt',
|
9788
|
hidden: hide_
|
9789
|
}, {
|
9790
|
text: 'Variant',
|
9791
|
style: 'font-family: FontAwesome',
|
9792
|
hidden: hide_,
|
9793
|
menu: [{
|
9794
|
text: 'Load Variant',
|
9795
|
name: 'loadvariant',
|
9796
|
|
9797
|
}, {
|
9798
|
text: 'Save Variant',
|
9799
|
name: 'savevariant',
|
9800
|
|
9801
|
}
|
9802
|
],
|
9803
|
|
9804
|
}
|
9805
|
],
|
9806
|
|
9807
|
},
|
9808
|
//{
|
9809
|
// title: 'Result',
|
9810
|
// height: 530,
|
9811
|
// collapsible: false,
|
9812
|
// name: 'resultPanel',
|
9813
|
// layout: 'fit',
|
9814
|
// html: '<div id="formMdDiv"></div>',
|
9815
|
//}
|
9816
|
],
|
9817
|
});
|
9818
|
this.callParent();
|
9819
|
}
|
9820
|
});
|
9821
|
|
9822
|
Ext.define('MinovaUtil.MinovaES.MinovaRptAdvance', {
|
9823
|
extend: 'Ext.form.Panel',
|
9824
|
alias: ['widget.MinovaRptAdvance', 'widget.minovarptadvance'],
|
9825
|
//layout: 'column',
|
9826
|
controller: 'basereports-controller',
|
9827
|
ReportID: undefined,
|
9828
|
reportLayout: 'advance',
|
9829
|
hideButton: undefined,
|
9830
|
getReportLayout: function () {
|
9831
|
return this.reportLayout;
|
9832
|
},
|
9833
|
setReportLayout: function (value) {
|
9834
|
var me = this;
|
9835
|
me.reportLayout = value;
|
9836
|
return me;
|
9837
|
},
|
9838
|
|
9839
|
initComponent: function () {
|
9840
|
var me = this;
|
9841
|
var ReportID = me.ReportID;
|
9842
|
var hideButton_ = me.hideButton;
|
9843
|
var hide_ = false;
|
9844
|
if (hideButton_) {
|
9845
|
hide_ = true;
|
9846
|
}
|
9847
|
Ext.applyIf(me, {
|
9848
|
items: [{
|
9849
|
//title: 'Report Selection',
|
9850
|
xtype: 'minovarptform',
|
9851
|
hideButton: hide_,
|
9852
|
name: 'minovarptadvance',
|
9853
|
ReportID: ReportID,
|
9854
|
SelectionType: '2',
|
9855
|
bodyPadding: 10,
|
9856
|
buttons: [{
|
9857
|
text: 'Search',
|
9858
|
name: 'SearchRpt',
|
9859
|
hidden: hide_
|
9860
|
}, {
|
9861
|
text: 'Variant',
|
9862
|
hidden: hide_,
|
9863
|
style: 'font-family: FontAwesome',
|
9864
|
menu: [{
|
9865
|
text: 'Load Variant',
|
9866
|
name: 'loadvariant',
|
9867
|
|
9868
|
}, {
|
9869
|
text: 'Save Variant',
|
9870
|
name: 'savevariant',
|
9871
|
|
9872
|
}
|
9873
|
],
|
9874
|
|
9875
|
}
|
9876
|
],
|
9877
|
|
9878
|
},
|
9879
|
//{
|
9880
|
// title: 'Result',
|
9881
|
// height: 530,
|
9882
|
// collapsible: false,
|
9883
|
// name: 'resultPanel',
|
9884
|
// layout: 'fit',
|
9885
|
// html: '<div id="formMdDiv"></div>',
|
9886
|
//}
|
9887
|
],
|
9888
|
});
|
9889
|
this.callParent();
|
9890
|
}
|
9891
|
});
|
9892
|
|
9893
|
Ext.define('MinovaUtil.MinovaES.MinovaRptAll', {
|
9894
|
extend: 'Ext.form.Panel',
|
9895
|
alias: ['widget.MinovaRptAll', 'widget.minovarptall'],
|
9896
|
//layout: 'column',
|
9897
|
controller: 'basereports-controller',
|
9898
|
ReportID: undefined,
|
9899
|
titleSimle: undefined,
|
9900
|
titleAdvance: undefined,
|
9901
|
reportLayout: 'all',
|
9902
|
hideButton: undefined,
|
9903
|
getReportLayout: function () {
|
9904
|
return this.reportLayout;
|
9905
|
},
|
9906
|
setReportLayout: function (value) {
|
9907
|
var me = this;
|
9908
|
me.reportLayout = value;
|
9909
|
return me;
|
9910
|
},
|
9911
|
|
9912
|
initComponent: function () {
|
9913
|
var me = this;
|
9914
|
var ReportID = me.ReportID;
|
9915
|
var hideButton_ = me.hideButton;
|
9916
|
var hide_ = false;
|
9917
|
if (hideButton_) {
|
9918
|
hide_ = true;
|
9919
|
}
|
9920
|
Ext.applyIf(me, {
|
9921
|
items: [{
|
9922
|
xtype: 'tabpanel',
|
9923
|
name: 'mainTab',
|
9924
|
buttons: [{
|
9925
|
text: 'Search',
|
9926
|
name: 'SearchRpt',
|
9927
|
hidden: hide_,
|
9928
|
}, {
|
9929
|
text: 'Variant',
|
9930
|
hidden: hide_,
|
9931
|
style: 'font-family: FontAwesome',
|
9932
|
menu: [{
|
9933
|
text: 'Load Variant',
|
9934
|
name: 'loadvariant',
|
9935
|
|
9936
|
}, {
|
9937
|
text: 'Save Variant',
|
9938
|
name: 'savevariant',
|
9939
|
|
9940
|
}
|
9941
|
],
|
9942
|
|
9943
|
}
|
9944
|
],
|
9945
|
|
9946
|
items: [{
|
9947
|
title: 'Simple',
|
9948
|
xtype: 'minovarptform',
|
9949
|
hideButton: hide_,
|
9950
|
name: 'simpleForm',
|
9951
|
ReportID: ReportID,
|
9952
|
SelectionType: '1',
|
9953
|
bodyPadding: 10,
|
9954
|
|
9955
|
}, {
|
9956
|
title: 'Advance',
|
9957
|
xtype: 'minovarptform',
|
9958
|
hideButton: hide_,
|
9959
|
name: 'advanceForm',
|
9960
|
ReportID: ReportID,
|
9961
|
SelectionType: '2',
|
9962
|
bodyPadding: 10,
|
9963
|
|
9964
|
}
|
9965
|
]
|
9966
|
},
|
9967
|
//{
|
9968
|
// title: 'Result',
|
9969
|
// height: 530,
|
9970
|
// collapsible: false,
|
9971
|
// name: 'resultPanel',
|
9972
|
// layout: 'fit',
|
9973
|
// html: '<div id="formMdDiv"></div>',
|
9974
|
//}
|
9975
|
|
9976
|
],
|
9977
|
});
|
9978
|
this.callParent();
|
9979
|
}
|
9980
|
});
|
9981
|
|
9982
|
Ext.define('MinovaUtil.MinovaES.MinovaGridRpt', {
|
9983
|
extend: 'Ext.grid.Panel',
|
9984
|
requires: ['Ext.grid.RowNumberer'],
|
9985
|
alias: 'widget.minovagridrpt',
|
9986
|
alternateClassName: 'Ext.grid.MinovaGridRpt',
|
9987
|
tableName: undefined,
|
9988
|
param: undefined,
|
9989
|
//pagesize: undefined,
|
9990
|
storename: undefined,
|
9991
|
//layoutType: undefined,
|
9992
|
enableLocking: true,
|
9993
|
tbar: [{
|
9994
|
xtype: 'tbfill'
|
9995
|
}, {
|
9996
|
text: 'Clear Filters',
|
9997
|
tooltip: 'Clear all filters',
|
9998
|
name: 'clearbtn',
|
9999
|
handler: function () {
|
10000
|
var tolbar = this.up()
|
10001
|
var grid_ = tolbar.up()
|
10002
|
grid_.filters.clearFilters()
|
10003
|
}
|
10004
|
}, ],
|
10005
|
getTableName: function () {
|
10006
|
return this.tableName;
|
10007
|
},
|
10008
|
|
10009
|
initComponent: function () {
|
10010
|
var me = this;
|
10011
|
var cols_ = [];
|
10012
|
var fieldeditor = {};
|
10013
|
var hasil = null;
|
10014
|
var autoLoad = true;
|
10015
|
var _url = 'GetAllField';
|
10016
|
|
10017
|
Ext.Ajax.request({
|
10018
|
async: false,
|
10019
|
method: 'POST',
|
10020
|
url: '/Devt/' + _url + '?tableName=' + me.tableName,
|
10021
|
success: function (response) {
|
10022
|
var results = Ext.decode(response.responseText);
|
10023
|
hasil = results.data;
|
10024
|
}
|
10025
|
});
|
10026
|
var structure = undefined;
|
10027
|
Ext.Ajax.request({
|
10028
|
async: false,
|
10029
|
method: 'POST',
|
10030
|
url: '/UserControl/GetStore',
|
10031
|
params: {
|
10032
|
tableName: 'SDATATABLEFIELD',
|
10033
|
param: 'TableName[equal]' + me.tableName
|
10034
|
|
10035
|
},
|
10036
|
success: function (response) {
|
10037
|
var results = Ext.decode(response.responseText);
|
10038
|
data_ = results.data;
|
10039
|
if (data_ != undefined) {
|
10040
|
structure = data_;
|
10041
|
}
|
10042
|
}
|
10043
|
});
|
10044
|
if (hasil.length > 0) {
|
10045
|
Ext.each(hasil, function (rec) {
|
10046
|
// get field will be summary
|
10047
|
|
10048
|
var summaryType = undefined;
|
10049
|
if (structure != undefined) {
|
10050
|
_field = $.grep(structure, function (r) {
|
10051
|
return r.FieldName == rec.FieldName
|
10052
|
});
|
10053
|
summaryType = _field[0].SummaryType
|
10054
|
}
|
10055
|
|
10056
|
var null_ = null;
|
10057
|
if (rec.IsPrimaryKey == true) {
|
10058
|
null_ = false;
|
10059
|
}
|
10060
|
if (rec.IsRequired == true) {
|
10061
|
null_ = false;
|
10062
|
} else {
|
10063
|
null_ = true;
|
10064
|
}
|
10065
|
if (rec.GridView == 1) {
|
10066
|
switch (rec.FormatRef) {
|
10067
|
case "date":
|
10068
|
cols_.push({
|
10069
|
xtype: 'minovadatecolumn',
|
10070
|
text: rec.HeaderTitle,
|
10071
|
dataIndex: rec.FieldName,
|
10072
|
summaryType: summaryType,
|
10073
|
width: 100,
|
10074
|
filter: {
|
10075
|
type: 'date',
|
10076
|
itemDefaults: {
|
10077
|
emptyText: 'Search for...'
|
10078
|
}
|
10079
|
}
|
10080
|
});
|
10081
|
break
|
10082
|
case "amount":
|
10083
|
cols_.push({
|
10084
|
xtype: 'minovacurrancycolumn',
|
10085
|
align: 'right',
|
10086
|
text: rec.HeaderTitle,
|
10087
|
dataIndex: rec.FieldName,
|
10088
|
summaryType: summaryType,
|
10089
|
width: 100,
|
10090
|
filter: {
|
10091
|
type: 'number',
|
10092
|
itemDefaults: {
|
10093
|
emptyText: 'Search for...'
|
10094
|
}
|
10095
|
}
|
10096
|
});
|
10097
|
break
|
10098
|
case "datetime":
|
10099
|
cols_.push({
|
10100
|
xtype: 'minovadatetimecolumn',
|
10101
|
text: rec.HeaderTitle,
|
10102
|
dataIndex: rec.FieldName,
|
10103
|
summaryType: summaryType,
|
10104
|
width: 140,
|
10105
|
filter: {
|
10106
|
type: 'string',
|
10107
|
itemDefaults: {
|
10108
|
emptyText: 'Search for...'
|
10109
|
}
|
10110
|
}
|
10111
|
});
|
10112
|
break
|
10113
|
default:
|
10114
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
10115
|
cols_.push({
|
10116
|
text: rec.HeaderTitle,
|
10117
|
dataIndex: rec.FieldName,
|
10118
|
summaryType: summaryType,
|
10119
|
width: 100,
|
10120
|
filter: {
|
10121
|
type: 'string',
|
10122
|
itemDefaults: {
|
10123
|
emptyText: 'Search for...'
|
10124
|
}
|
10125
|
}
|
10126
|
});
|
10127
|
} else if (rec.TableRef != "") {
|
10128
|
if (rec.TableRef != null) {
|
10129
|
var valueField = null;
|
10130
|
var displayValue = null;
|
10131
|
Ext.Ajax.request({
|
10132
|
async: false,
|
10133
|
method: 'POST',
|
10134
|
url: '/UserControl/GetStore',
|
10135
|
params: {
|
10136
|
tableName: 'SDATATABLEFIELD',
|
10137
|
param: 'TableName[equal]' + rec.TableRef
|
10138
|
},
|
10139
|
success: function (response) {
|
10140
|
var results = Ext.decode(response.responseText);
|
10141
|
data_ = results.data;
|
10142
|
if (data_ != undefined) {
|
10143
|
valueField_ = $.grep(data_, function (r) {
|
10144
|
return r.ValueField == '1'
|
10145
|
});
|
10146
|
valueField = valueField_[0].FieldName
|
10147
|
displayValue_ = $.grep(data_, function (r) {
|
10148
|
return r.DisplayValue == '1'
|
10149
|
});
|
10150
|
displayValue = displayValue_[0].FieldName
|
10151
|
|
10152
|
}
|
10153
|
}
|
10154
|
});
|
10155
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
10156
|
var count_ = 0;
|
10157
|
if (store_) {
|
10158
|
count_ = store_.count();
|
10159
|
}
|
10160
|
if (count_ == 0) {
|
10161
|
Ext.create('Ext.data.Store', {
|
10162
|
storeId: 'store_' + rec.FieldName,
|
10163
|
autoLoad: true,
|
10164
|
proxy: {
|
10165
|
method: 'POST',
|
10166
|
type: 'ajax',
|
10167
|
url: '/UserControl/GetStore',
|
10168
|
extraParams: {
|
10169
|
tableName: rec.TableRef,
|
10170
|
param: rec.ParamCombo
|
10171
|
},
|
10172
|
reader: {
|
10173
|
type: 'json',
|
10174
|
root: 'data',
|
10175
|
totalProperty: 'data[0].TotalCount'
|
10176
|
}
|
10177
|
}
|
10178
|
})
|
10179
|
}
|
10180
|
cols_.push({
|
10181
|
xtype: 'minovacombocolumn',
|
10182
|
TableRef: rec.TableRef,
|
10183
|
text: rec.HeaderTitle,
|
10184
|
summaryType: summaryType,
|
10185
|
dataIndex: rec.FieldName,
|
10186
|
valueField: valueField,
|
10187
|
displayField: displayValue,
|
10188
|
store: 'store_' + rec.FieldName,
|
10189
|
filter: {
|
10190
|
type: 'list',
|
10191
|
itemDefaults: {
|
10192
|
emptyText: 'Search for...'
|
10193
|
}
|
10194
|
}
|
10195
|
});
|
10196
|
}
|
10197
|
|
10198
|
} else {
|
10199
|
cols_.push({
|
10200
|
text: rec.HeaderTitle,
|
10201
|
dataIndex: rec.FieldName,
|
10202
|
summaryType: summaryType,
|
10203
|
filter: {
|
10204
|
itemDefaults: {
|
10205
|
emptyText: 'Search for...'
|
10206
|
}
|
10207
|
}
|
10208
|
});
|
10209
|
}
|
10210
|
break
|
10211
|
}
|
10212
|
} else {
|
10213
|
cols_.push({
|
10214
|
text: rec.HeaderTitle,
|
10215
|
dataIndex: rec.FieldName,
|
10216
|
hidden: true,
|
10217
|
filter: {
|
10218
|
itemDefaults: {
|
10219
|
emptyText: 'Search for...'
|
10220
|
}
|
10221
|
}
|
10222
|
});
|
10223
|
}
|
10224
|
});
|
10225
|
};
|
10226
|
var param_ = me.param;
|
10227
|
if (param_ == undefined) {
|
10228
|
param_ = ''
|
10229
|
}
|
10230
|
var jsStoreGrid = new Ext.data.Store({
|
10231
|
storeId: me.storename,
|
10232
|
autoLoad: false,
|
10233
|
//pageSize: me.pagesize,
|
10234
|
proxy: {
|
10235
|
method: 'POST',
|
10236
|
type: 'ajax',
|
10237
|
url: '/UserControl/GetStore',
|
10238
|
//extraParams: {
|
10239
|
// tableName: me.tableName,
|
10240
|
// param: param_
|
10241
|
//},
|
10242
|
reader: {
|
10243
|
type: 'json',
|
10244
|
root: 'data',
|
10245
|
totalProperty: 'totalRecords'
|
10246
|
}
|
10247
|
}
|
10248
|
});
|
10249
|
Ext.applyIf(me, {
|
10250
|
autoScroll: true,
|
10251
|
enableLocking: true,
|
10252
|
lockedGridConfig: {
|
10253
|
header: false,
|
10254
|
collapsible: true,
|
10255
|
width: 250,
|
10256
|
forceFit: true,
|
10257
|
listeners: {
|
10258
|
render: function (grid) {
|
10259
|
var pagingToolbar = grid.child('pagingtoolbar');
|
10260
|
if (pagingToolbar) {
|
10261
|
grid.remove(pagingToolbar, true);
|
10262
|
}
|
10263
|
}
|
10264
|
}
|
10265
|
},
|
10266
|
listeners: {
|
10267
|
viewready: function () {
|
10268
|
if (autoLoad == true) {
|
10269
|
this.getStore().loadPage(1);
|
10270
|
}
|
10271
|
|
10272
|
},
|
10273
|
beforeedit: function () {
|
10274
|
return false;
|
10275
|
}
|
10276
|
},
|
10277
|
lockedViewConfig: {
|
10278
|
scroll: 'horizontal'
|
10279
|
},
|
10280
|
viewConfig: {
|
10281
|
emptyText: 'No Data Display',
|
10282
|
deferEmptyText: false
|
10283
|
},
|
10284
|
//features: [{
|
10285
|
// ftype: 'summary'
|
10286
|
//}],
|
10287
|
columns: cols_,
|
10288
|
|
10289
|
store: jsStoreGrid,
|
10290
|
|
10291
|
plugins: [{
|
10292
|
ptype: 'gridfilters'
|
10293
|
},
|
10294
|
|
10295
|
],
|
10296
|
|
10297
|
});
|
10298
|
me.callParent(arguments);
|
10299
|
}
|
10300
|
|
10301
|
});
|
10302
|
|
10303
|
Ext.define('MinovaUtil.MinovaES.MinovaEditAbleGrid', {
|
10304
|
extend: 'Ext.form.Panel',
|
10305
|
alias: ['widget.MinovaEditAbleGrid', 'widget.Minovaeditablegrid', 'widget.minovaeditablegrid'],
|
10306
|
requires: [
|
10307
|
'Ext.grid.plugin.CellEditing',
|
10308
|
'Ext.grid.RowNumberer',
|
10309
|
'Ext.grid.Panel',
|
10310
|
],
|
10311
|
|
10312
|
//renderTo: 'panel-extjs',
|
10313
|
anchor: '100%',
|
10314
|
tableName: undefined,
|
10315
|
hideButton: undefined,
|
10316
|
multiSelect: undefined,
|
10317
|
initComponent: function () {
|
10318
|
var me = this;
|
10319
|
var isLookup = me.isLookup;
|
10320
|
var hide_ = false;
|
10321
|
var widthLock = 250;
|
10322
|
var checkSelection = '';
|
10323
|
|
10324
|
if (me.hideButton == true) {
|
10325
|
hide_ = true;
|
10326
|
}
|
10327
|
if (me.multiSelect) {
|
10328
|
locking = false;
|
10329
|
checkSelection = 'checkboxmodel';
|
10330
|
widthLock = 40;
|
10331
|
}
|
10332
|
var tableName = me.tableName;
|
10333
|
var cols = [];
|
10334
|
var fieldStore = [];
|
10335
|
var _url = 'GetAllField';
|
10336
|
var hasil = null;
|
10337
|
var height = me.height;
|
10338
|
var storeID = 'store' + me.tableName;
|
10339
|
var gridName = 'grid' + me.name;
|
10340
|
if (me.storeName) {
|
10341
|
storeID = me.storeName;
|
10342
|
}
|
10343
|
var LangID = MinovaUtil.GetLangID();
|
10344
|
var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
|
10345
|
Ext.Ajax.request({
|
10346
|
async: false,
|
10347
|
method: 'POST',
|
10348
|
url: '/UserControl/GetStore',
|
10349
|
params: {
|
10350
|
tableName: 'PDSBS0007',
|
10351
|
param: parameter
|
10352
|
},
|
10353
|
success: function (response) {
|
10354
|
var results = Ext.decode(response.responseText);
|
10355
|
hasil = results.data;
|
10356
|
}
|
10357
|
});
|
10358
|
cols.push({
|
10359
|
xtype: 'rownumberer'
|
10360
|
});
|
10361
|
var addData = 'var data={';
|
10362
|
if (hasil.length > 0) {
|
10363
|
Ext.each(hasil, function (rec) {
|
10364
|
fieldStore.push(rec.FieldName);
|
10365
|
if (rec.FieldName != 'Sequence') {
|
10366
|
addData = addData + rec.FieldName + ":" + "'',";
|
10367
|
}
|
10368
|
|
10369
|
var null_ = null;
|
10370
|
var ReadOnly_ = false;
|
10371
|
if (rec.IsPrimaryKey == true) {
|
10372
|
null_ = false;
|
10373
|
}
|
10374
|
if (rec.IsRequired == true) {
|
10375
|
null_ = false;
|
10376
|
} else {
|
10377
|
null_ = true;
|
10378
|
}
|
10379
|
if (rec.ReadOnly == '1') {
|
10380
|
ReadOnly_ = true;
|
10381
|
}
|
10382
|
var Hidden_ = false;
|
10383
|
if (rec.ReadOnly == '1') {
|
10384
|
ReadOnly_ = true;
|
10385
|
}
|
10386
|
|
10387
|
if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
|
10388
|
Hidden_ = true;
|
10389
|
null_ = true;
|
10390
|
}
|
10391
|
|
10392
|
if (rec.GridView == 1) {
|
10393
|
switch (rec.FormatRef) {
|
10394
|
case "date":
|
10395
|
cols.push({
|
10396
|
xtype: 'minovadatecolumn',
|
10397
|
hidden: Hidden_,
|
10398
|
text: rec.HeaderTitle,
|
10399
|
dataIndex: rec.FieldName,
|
10400
|
filter: {
|
10401
|
itemDefaults: {
|
10402
|
emptyText: 'Search for...',
|
10403
|
|
10404
|
}
|
10405
|
},
|
10406
|
editor: {
|
10407
|
allowBlank: null_,
|
10408
|
xtype: 'datefield',
|
10409
|
hideMode: 'visibility',
|
10410
|
readOnly: ReadOnly_,
|
10411
|
id: tableName + rec.FieldName,
|
10412
|
fieldGrid: rec.FieldName,
|
10413
|
nameTable: rec.TableName,
|
10414
|
}
|
10415
|
});
|
10416
|
break
|
10417
|
case "amount":
|
10418
|
cols.push({
|
10419
|
xtype: 'minovacurrancycolumn',
|
10420
|
//renderer: Ext.util.Format.numberRenderer("0,0"),
|
10421
|
text: rec.HeaderTitle,
|
10422
|
align: 'right',
|
10423
|
dataIndex: rec.FieldName,
|
10424
|
hidden: Hidden_,
|
10425
|
filter: {
|
10426
|
itemDefaults: {
|
10427
|
emptyText: 'Search for...'
|
10428
|
}
|
10429
|
},
|
10430
|
editor: {
|
10431
|
allowBlank: null_,
|
10432
|
xtype: 'minovacurrencyfield',
|
10433
|
//renderer: Ext.util.Format.numberRenderer("0,0"),
|
10434
|
//vtype: 'validateDecimal',
|
10435
|
readOnly: ReadOnly_,
|
10436
|
id: tableName + rec.FieldName,
|
10437
|
nameTable: rec.TableName,
|
10438
|
fieldGrid: rec.FieldName,
|
10439
|
fieldStyle: 'text-align:right;',
|
10440
|
value: '0',
|
10441
|
|
10442
|
}
|
10443
|
});
|
10444
|
break
|
10445
|
case "time":
|
10446
|
var DefaultValue = rec.DefaultValue;
|
10447
|
if (DefaultValue == '') {
|
10448
|
defaultValue = '00:00';
|
10449
|
}
|
10450
|
cols.push({
|
10451
|
//xtype: 'minovatimecolumn',
|
10452
|
xtype: 'timefield',
|
10453
|
format: 'H:i',
|
10454
|
submitFormat: 'Hi',
|
10455
|
text: rec.HeaderTitle,
|
10456
|
dataIndex: rec.FieldName,
|
10457
|
hidden: Hidden_,
|
10458
|
//renderer: Ext.util.Format.dateRenderer('G:i'),
|
10459
|
filter: {
|
10460
|
itemDefaults: {
|
10461
|
emptyText: 'Search for...'
|
10462
|
}
|
10463
|
},
|
10464
|
editor: {
|
10465
|
allowBlank: null_,
|
10466
|
xtype: 'timefield',
|
10467
|
readOnly: ReadOnly_,
|
10468
|
id: tableName + rec.FieldName,
|
10469
|
format: 'H:i',
|
10470
|
submitFormat: 'Hi',
|
10471
|
increment: 5,
|
10472
|
value: DefaultValue,
|
10473
|
anchor: '100%',
|
10474
|
listeners: {}
|
10475
|
//renderer: Ext.util.Format.dateRenderer('G:i'),
|
10476
|
}
|
10477
|
});
|
10478
|
break
|
10479
|
//case "datetime":
|
10480
|
// if (rec.DataRef != 'CREATEDT' && rec.DataRef != 'CHANGEDT') {
|
10481
|
// cols.push({
|
10482
|
// xtype: 'minovadatetimecolumn',
|
10483
|
// text: rec.HeaderTitle,
|
10484
|
// dataIndex: rec.FieldName,
|
10485
|
// filter: {
|
10486
|
// itemDefaults: {
|
10487
|
// emptyText: 'Search for...'
|
10488
|
// }
|
10489
|
// },
|
10490
|
// editor: {
|
10491
|
// allowBlank: null_,
|
10492
|
// xtype: 'textfield',
|
10493
|
// }
|
10494
|
// });
|
10495
|
// }
|
10496
|
// break
|
10497
|
default:
|
10498
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
|
10499
|
cols.push({
|
10500
|
text: rec.HeaderTitle,
|
10501
|
dataIndex: rec.FieldName,
|
10502
|
width: 100,
|
10503
|
filter: {
|
10504
|
type: 'string',
|
10505
|
itemDefaults: {
|
10506
|
emptyText: 'Search for...'
|
10507
|
}
|
10508
|
}
|
10509
|
});
|
10510
|
} else if (rec.SearchType == '0') {
|
10511
|
var valueField = null;
|
10512
|
var displayValue = null;
|
10513
|
var TableRef = undefined;
|
10514
|
if (rec.TableRef != '') {
|
10515
|
TableRef = rec.TableRef;
|
10516
|
|
10517
|
Ext.Ajax.request({
|
10518
|
async: false,
|
10519
|
method: 'POST',
|
10520
|
url: '/UserControl/GetStore',
|
10521
|
params: {
|
10522
|
tableName: 'SDATATABLEFIELD',
|
10523
|
param: 'TableName[equal]' + rec.TableRef
|
10524
|
},
|
10525
|
success: function (response) {
|
10526
|
var results = Ext.decode(response.responseText);
|
10527
|
data_ = results.data;
|
10528
|
if (data_ != undefined) {
|
10529
|
valueField_ = $.grep(data_, function (r) {
|
10530
|
return r.ValueField == '1'
|
10531
|
});
|
10532
|
valueField = valueField_[0].FieldName
|
10533
|
displayValue_ = $.grep(data_, function (r) {
|
10534
|
return r.DisplayValue == '1'
|
10535
|
});
|
10536
|
displayValue = displayValue_[0].FieldName
|
10537
|
}
|
10538
|
}
|
10539
|
});
|
10540
|
|
10541
|
//create Store
|
10542
|
Ext.create('Ext.data.Store', {
|
10543
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
10544
|
autoLoad: true,
|
10545
|
proxy: {
|
10546
|
method: 'POST',
|
10547
|
type: 'ajax',
|
10548
|
url: '/UserControl/GetStoreAuth',
|
10549
|
extraParams: {
|
10550
|
tableName: TableRef,
|
10551
|
param: rec.ParamCombo,
|
10552
|
menuId: MinovaUtil.GetMenuID()
|
10553
|
},
|
10554
|
reader: {
|
10555
|
type: 'json',
|
10556
|
root: 'data',
|
10557
|
totalProperty: 'data[0].TotalCount'
|
10558
|
}
|
10559
|
}
|
10560
|
});
|
10561
|
} else if (rec.FixedValue != '') {
|
10562
|
var storeData = [];
|
10563
|
var str = rec.FixedValue;
|
10564
|
var hasil = str.split('||');
|
10565
|
hasil.forEach(function (h) {
|
10566
|
store_ = h.split('=')
|
10567
|
storeData.push({
|
10568
|
code: store_[0],
|
10569
|
desc: store_[1],
|
10570
|
|
10571
|
});
|
10572
|
});
|
10573
|
|
10574
|
valueField = 'code';
|
10575
|
displayValue = 'desc';
|
10576
|
|
10577
|
Ext.create('Ext.data.Store', {
|
10578
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
10579
|
autoLoad: true,
|
10580
|
data: storeData
|
10581
|
})
|
10582
|
}
|
10583
|
|
10584
|
cols.push({
|
10585
|
xtype: 'minovacombocolumn',
|
10586
|
hidden: Hidden_,
|
10587
|
text: rec.HeaderTitle,
|
10588
|
dataIndex: rec.FieldName,
|
10589
|
valueField: valueField,
|
10590
|
displayField: displayValue,
|
10591
|
store: 'store_' + me.tableName + rec.FieldName,
|
10592
|
editor: {
|
10593
|
allowBlank: null_,
|
10594
|
xtype: 'combobox',
|
10595
|
readOnly: ReadOnly_,
|
10596
|
id: tableName + rec.FieldName,
|
10597
|
nameTable: rec.TableName,
|
10598
|
fieldGrid: rec.FieldName,
|
10599
|
valueField: valueField,
|
10600
|
displayField: displayValue,
|
10601
|
vtype: 'validateCombobox',
|
10602
|
store: 'store_' + me.tableName + rec.FieldName,
|
10603
|
},
|
10604
|
filter: {
|
10605
|
type: 'list',
|
10606
|
itemDefaults: {
|
10607
|
emptyText: 'Search for...'
|
10608
|
}
|
10609
|
}
|
10610
|
});
|
10611
|
|
10612
|
} else if (rec.SearchType == '5') {
|
10613
|
var valueField = null;
|
10614
|
var displayValue = null;
|
10615
|
var AdditionaldisplayValue = null;
|
10616
|
var TableRef = undefined;
|
10617
|
if (rec.TableRef != '') {
|
10618
|
TableRef = rec.TableRef;
|
10619
|
Ext.Ajax.request({
|
10620
|
async: false,
|
10621
|
method: 'POST',
|
10622
|
url: '/UserControl/GetStore',
|
10623
|
params: {
|
10624
|
tableName: 'SDATATABLEFIELD',
|
10625
|
param: 'TableName[equal]' + rec.TableRef
|
10626
|
},
|
10627
|
success: function (response) {
|
10628
|
var results = Ext.decode(response.responseText);
|
10629
|
data_ = results.data;
|
10630
|
if (data_ != undefined) {
|
10631
|
valueField_ = $.grep(data_, function (r) {
|
10632
|
return r.ValueField == '1'
|
10633
|
});
|
10634
|
if (valueField_.length > 0) {
|
10635
|
valueField = valueField_[0].FieldName
|
10636
|
}
|
10637
|
|
10638
|
displayValue_ = $.grep(data_, function (r) {
|
10639
|
return r.DisplayValue == '1' || r.DisplayValue == '2'
|
10640
|
});
|
10641
|
if (displayValue_.length > 0) {
|
10642
|
displayValue = displayValue_[0].FieldName;
|
10643
|
}
|
10644
|
if (displayValue_.length >= 2) {
|
10645
|
AdditionaldisplayValue = displayValue_[1].FieldName
|
10646
|
}
|
10647
|
}
|
10648
|
}
|
10649
|
});
|
10650
|
}
|
10651
|
Ext.create('Ext.data.Store', {
|
10652
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
10653
|
autoLoad: true,
|
10654
|
proxy: {
|
10655
|
method: 'POST',
|
10656
|
type: 'ajax',
|
10657
|
url: '/UserControl/GetStoreAuth',
|
10658
|
extraParams: {
|
10659
|
tableName: TableRef,
|
10660
|
param: rec.ParamCombo,
|
10661
|
menuId: MinovaUtil.GetMenuID()
|
10662
|
},
|
10663
|
reader: {
|
10664
|
type: 'json',
|
10665
|
root: 'data',
|
10666
|
totalProperty: 'data[0].TotalCount'
|
10667
|
}
|
10668
|
}
|
10669
|
});
|
10670
|
cols.push({
|
10671
|
xtype : 'minovacombocolumn',
|
10672
|
hidden: Hidden_,
|
10673
|
text: rec.HeaderTitle,
|
10674
|
dataIndex: rec.FieldName,
|
10675
|
valueField : valueField,
|
10676
|
displayField : displayValue,
|
10677
|
store : 'store_' + me.tableName + rec.FieldName,
|
10678
|
tpl: Ext.create('Ext.XTemplate',
|
10679
|
'<ul class="x-list-plain"><tpl for=".">',
|
10680
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
10681
|
'</tpl></ul>'),
|
10682
|
displayTpl: Ext.create('Ext.XTemplate',
|
10683
|
'<tpl for=".">',
|
10684
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
10685
|
'</tpl>'),
|
10686
|
editor: {
|
10687
|
allowBlank: null_,
|
10688
|
xtype: 'combobox',
|
10689
|
readOnly: ReadOnly_,
|
10690
|
id: rec.TableName + rec.FieldName,
|
10691
|
nameTable: rec.TableName,
|
10692
|
fieldGrid: rec.FieldName,
|
10693
|
valueField: valueField,
|
10694
|
displayField: displayValue,
|
10695
|
store: 'store_' + me.tableName + rec.FieldName,
|
10696
|
value: rec.DefaultValue,
|
10697
|
tpl: Ext.create('Ext.XTemplate',
|
10698
|
'<ul class="x-list-plain"><tpl for=".">',
|
10699
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
10700
|
'</tpl></ul>'),
|
10701
|
displayTpl: Ext.create('Ext.XTemplate',
|
10702
|
'<tpl for=".">',
|
10703
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
10704
|
'</tpl>')
|
10705
|
},
|
10706
|
renderer: function (value) {
|
10707
|
var store = Ext.data.StoreManager.lookup('store_' + me.tableName + rec.FieldName);
|
10708
|
var index = store.find(valueField, value);
|
10709
|
var val = "";
|
10710
|
if (index != -1) {
|
10711
|
var rc = store.getAt(index);
|
10712
|
//val = rc.get(displayValue);
|
10713
|
val = rc.get(AdditionaldisplayValue) + ' - ' + rc.get(displayValue);
|
10714
|
} else {
|
10715
|
val = value;
|
10716
|
}
|
10717
|
return val;
|
10718
|
},
|
10719
|
filter: {
|
10720
|
type: 'list',
|
10721
|
itemDefaults: {
|
10722
|
emptyText: 'Search for...'
|
10723
|
}
|
10724
|
}
|
10725
|
});
|
10726
|
} else if (rec.SearchType == '2') {
|
10727
|
var triger = (rec.TriggerCombo).split('$');
|
10728
|
var targetField_ = triger[0];
|
10729
|
var fieldValue_ = triger[1];
|
10730
|
cols.push({
|
10731
|
text: rec.HeaderTitle,
|
10732
|
hidden: Hidden_,
|
10733
|
dataIndex: rec.FieldName,
|
10734
|
filter: {
|
10735
|
itemDefaults: {
|
10736
|
emptyText: 'Search for...'
|
10737
|
}
|
10738
|
},
|
10739
|
editor: {
|
10740
|
allowBlank: null_,
|
10741
|
xtype: 'minovalookupgrid',
|
10742
|
readOnly: ReadOnly_,
|
10743
|
isGrid: true,
|
10744
|
fieldTarget: targetField_,
|
10745
|
fieldValue: fieldValue_,
|
10746
|
isGrid: true,
|
10747
|
id: tableName + rec.FieldName,
|
10748
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
10749
|
triggerCls: 'x-form-search-trigger',
|
10750
|
vtype: 'alphanum', // disable space
|
10751
|
nameTable: rec.TableName,
|
10752
|
fieldGrid: rec.FieldName,
|
10753
|
LookupFunction: rec.LookupFunction,
|
10754
|
listeners: {
|
10755
|
change: function (val) {
|
10756
|
var custumFunc = rec.SelectFunction;
|
10757
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
10758
|
Ext.Ajax.request({
|
10759
|
async: false,
|
10760
|
method: 'POST',
|
10761
|
url: '/UserControl/GetStore',
|
10762
|
params: {
|
10763
|
tableName: 'PCMFUNC',
|
10764
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
10765
|
},
|
10766
|
success: function (response) {
|
10767
|
var results = Ext.decode(response.responseText);
|
10768
|
data_ = results.data[0];
|
10769
|
if (data_ != undefined) {
|
10770
|
custumFunc = data_.FunctionCode;
|
10771
|
}
|
10772
|
}
|
10773
|
});
|
10774
|
}
|
10775
|
if (custumFunc) {
|
10776
|
eval(custumFunc)
|
10777
|
}
|
10778
|
}
|
10779
|
}
|
10780
|
}
|
10781
|
});
|
10782
|
} else if (rec.SearchType == '3') {
|
10783
|
cols.push({
|
10784
|
text: rec.HeaderTitle,
|
10785
|
hidden: Hidden_,
|
10786
|
dataIndex: rec.FieldName,
|
10787
|
filter: {
|
10788
|
itemDefaults: {
|
10789
|
emptyText: 'Search for...'
|
10790
|
}
|
10791
|
},
|
10792
|
editor: {
|
10793
|
allowBlank: null_,
|
10794
|
// xtype: 'minovalookuptreePopup',
|
10795
|
xtype: 'MinovaLookupTree',
|
10796
|
readOnly: ReadOnly_,
|
10797
|
id: tableName + rec.FieldName,
|
10798
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
10799
|
triggerCls: 'x-form-search-trigger',
|
10800
|
vtype: 'alphanum', // disable space
|
10801
|
treeSructure: rec.SearchFunction, //'O-O-P',
|
10802
|
objClassValue: rec.ParamCombo, //'O',
|
10803
|
nameTable: rec.TableName,
|
10804
|
fieldGrid: rec.FieldName,
|
10805
|
listeners: {
|
10806
|
change: function (val) {
|
10807
|
var custumFunc = rec.SelectFunction;
|
10808
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
10809
|
Ext.Ajax.request({
|
10810
|
async: false,
|
10811
|
method: 'POST',
|
10812
|
url: '/UserControl/GetStore',
|
10813
|
params: {
|
10814
|
tableName: 'PCMFUNC',
|
10815
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
10816
|
},
|
10817
|
success: function (response) {
|
10818
|
var results = Ext.decode(response.responseText);
|
10819
|
data_ = results.data[0];
|
10820
|
if (data_ != undefined) {
|
10821
|
custumFunc = data_.FunctionCode;
|
10822
|
}
|
10823
|
}
|
10824
|
});
|
10825
|
}
|
10826
|
if (custumFunc) {
|
10827
|
eval(custumFunc)
|
10828
|
}
|
10829
|
}
|
10830
|
}
|
10831
|
}
|
10832
|
});
|
10833
|
} else if (rec.SearchType != '0' && rec.SearchType != '1' && rec.SearchType != '3' && (rec.FieldName == 'EmployeeID' || rec.FieldName == 'ApplicantID' || rec.FieldName == 'EmployeeIDFrom' || rec.FieldName == 'EmployeeIDTo') && isLookup != true) {
|
10834
|
var triger = (rec.TriggerCombo).split('&');
|
10835
|
var targetField_ = triger[0];
|
10836
|
var fieldValue_ = triger[0];
|
10837
|
cols.push({
|
10838
|
text: rec.HeaderTitle,
|
10839
|
hidden: Hidden_,
|
10840
|
dataIndex: rec.FieldName,
|
10841
|
filter: {
|
10842
|
itemDefaults: {
|
10843
|
emptyText: 'Search for...'
|
10844
|
}
|
10845
|
},
|
10846
|
editor: {
|
10847
|
allowBlank: null_,
|
10848
|
xtype: 'lookupemployee',
|
10849
|
readOnly: ReadOnly_,
|
10850
|
isGrid: true,
|
10851
|
fieldTarget: targetField_,
|
10852
|
fieldValue: fieldValue_,
|
10853
|
isGrid: true,
|
10854
|
id: tableName + rec.FieldName,
|
10855
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
10856
|
triggerCls: 'x-form-search-trigger',
|
10857
|
vtype: 'alphanum', // disable space
|
10858
|
nameTable: rec.TableName,
|
10859
|
fieldGrid: rec.FieldName,
|
10860
|
listeners: {
|
10861
|
change: function (val) {
|
10862
|
var custumFunc = rec.SelectFunction;
|
10863
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
10864
|
Ext.Ajax.request({
|
10865
|
async: false,
|
10866
|
method: 'POST',
|
10867
|
url: '/UserControl/GetStore',
|
10868
|
params: {
|
10869
|
tableName: 'PCMFUNC',
|
10870
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
10871
|
},
|
10872
|
success: function (response) {
|
10873
|
var results = Ext.decode(response.responseText);
|
10874
|
data_ = results.data[0];
|
10875
|
if (data_ != undefined) {
|
10876
|
custumFunc = data_.FunctionCode;
|
10877
|
}
|
10878
|
}
|
10879
|
});
|
10880
|
}
|
10881
|
if (custumFunc) {
|
10882
|
eval(custumFunc)
|
10883
|
}
|
10884
|
}
|
10885
|
}
|
10886
|
}
|
10887
|
});
|
10888
|
} else if (rec.SearchType == '4' && isLookup != true) {
|
10889
|
cols.push({
|
10890
|
|
10891
|
text: rec.HeaderTitle,
|
10892
|
hidden: Hidden_,
|
10893
|
dataIndex: rec.FieldName,
|
10894
|
filter: {
|
10895
|
itemDefaults: {
|
10896
|
emptyText: 'Search for...'
|
10897
|
}
|
10898
|
},
|
10899
|
editor: {
|
10900
|
allowBlank: null_,
|
10901
|
xtype: 'lookupemployee',
|
10902
|
readOnly: ReadOnly_,
|
10903
|
isGrid: true,
|
10904
|
fieldTarget: targetField_,
|
10905
|
fieldValue: fieldValue_,
|
10906
|
isGrid: true,
|
10907
|
id: tableName + rec.FieldName,
|
10908
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
10909
|
triggerCls: 'x-form-search-trigger',
|
10910
|
vtype: 'alphanum', // disable space
|
10911
|
nameTable: rec.TableName,
|
10912
|
fieldGrid: rec.FieldName,
|
10913
|
listeners: {
|
10914
|
change: function (val) {
|
10915
|
var custumFunc = rec.SelectFunction;
|
10916
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
10917
|
Ext.Ajax.request({
|
10918
|
async: false,
|
10919
|
method: 'POST',
|
10920
|
url: '/UserControl/GetStore',
|
10921
|
params: {
|
10922
|
tableName: 'PCMFUNC',
|
10923
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
10924
|
},
|
10925
|
success: function (response) {
|
10926
|
var results = Ext.decode(response.responseText);
|
10927
|
data_ = results.data[0];
|
10928
|
if (data_ != undefined) {
|
10929
|
custumFunc = data_.FunctionCode;
|
10930
|
}
|
10931
|
}
|
10932
|
});
|
10933
|
}
|
10934
|
if (custumFunc) {
|
10935
|
eval(custumFunc)
|
10936
|
}
|
10937
|
}
|
10938
|
}
|
10939
|
}
|
10940
|
});
|
10941
|
} else {
|
10942
|
if (rec.FieldDataType == 3) { //add by taufan
|
10943
|
cols.push({
|
10944
|
text: rec.HeaderTitle,
|
10945
|
hidden: Hidden_,
|
10946
|
dataIndex: rec.FieldName,
|
10947
|
filter: {
|
10948
|
itemDefaults: {
|
10949
|
emptyText: 'Search for...'
|
10950
|
}
|
10951
|
},
|
10952
|
editor: {
|
10953
|
allowBlank: null_,
|
10954
|
xtype: 'textfield',
|
10955
|
readOnly: ReadOnly_,
|
10956
|
id: tableName + rec.FieldName,
|
10957
|
nameTable: rec.TableName,
|
10958
|
fieldGrid: rec.FieldName,
|
10959
|
vtype: 'validateDecimal',
|
10960
|
maxLength: rec.Length,
|
10961
|
precision: rec.Prec,
|
10962
|
fieldStyle: 'text-align:right;',
|
10963
|
listeners: {
|
10964
|
change: function (val) {
|
10965
|
var custumFunc = null;
|
10966
|
Ext.Ajax.request({
|
10967
|
async: false,
|
10968
|
method: 'POST',
|
10969
|
url: '/UserControl/GetStore',
|
10970
|
params: {
|
10971
|
tableName: 'SDATATABLEFIELD',
|
10972
|
param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
|
10973
|
},
|
10974
|
success: function (response) {
|
10975
|
var results = Ext.decode(response.responseText);
|
10976
|
data_ = results.data[0];
|
10977
|
if (data_ != undefined) {
|
10978
|
custumFunc = data_.SelectFunction;
|
10979
|
//console.log(data_)
|
10980
|
}
|
10981
|
}
|
10982
|
});
|
10983
|
|
10984
|
if (custumFunc) {
|
10985
|
eval(custumFunc)
|
10986
|
}
|
10987
|
}
|
10988
|
}
|
10989
|
}
|
10990
|
});
|
10991
|
} else {
|
10992
|
cols.push({
|
10993
|
text: rec.HeaderTitle,
|
10994
|
hidden: Hidden_,
|
10995
|
dataIndex: rec.FieldName,
|
10996
|
filter: {
|
10997
|
itemDefaults: {
|
10998
|
emptyText: 'Search for...'
|
10999
|
}
|
11000
|
},
|
11001
|
editor: {
|
11002
|
allowBlank: null_,
|
11003
|
xtype: 'textfield',
|
11004
|
readOnly: ReadOnly_,
|
11005
|
id: tableName + rec.FieldName,
|
11006
|
nameTable: rec.TableName,
|
11007
|
fieldGrid: rec.FieldName,
|
11008
|
listeners: {
|
11009
|
change: function (val) {
|
11010
|
var custumFunc = null;
|
11011
|
Ext.Ajax.request({
|
11012
|
async: false,
|
11013
|
method: 'POST',
|
11014
|
url: '/UserControl/GetStore',
|
11015
|
params: {
|
11016
|
tableName: 'SDATATABLEFIELD',
|
11017
|
param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
|
11018
|
},
|
11019
|
success: function (response) {
|
11020
|
var results = Ext.decode(response.responseText);
|
11021
|
data_ = results.data[0];
|
11022
|
if (data_ != undefined) {
|
11023
|
custumFunc = data_.SelectFunction;
|
11024
|
//console.log(data_)
|
11025
|
}
|
11026
|
}
|
11027
|
});
|
11028
|
|
11029
|
if (custumFunc) {
|
11030
|
eval(custumFunc)
|
11031
|
}
|
11032
|
}
|
11033
|
}
|
11034
|
}
|
11035
|
});
|
11036
|
}
|
11037
|
}
|
11038
|
|
11039
|
break
|
11040
|
|
11041
|
}
|
11042
|
} else {
|
11043
|
cols.push({
|
11044
|
text: rec.HeaderTitle,
|
11045
|
hidden: Hidden_,
|
11046
|
dataIndex: rec.FieldName,
|
11047
|
hidden: true,
|
11048
|
editor: {
|
11049
|
allowBlank: true,
|
11050
|
xtype: 'textfield',
|
11051
|
readOnly: ReadOnly_,
|
11052
|
id: tableName + rec.FieldName,
|
11053
|
nameTable: rec.TableName,
|
11054
|
fieldGrid: rec.FieldName,
|
11055
|
},
|
11056
|
filter: {
|
11057
|
itemDefaults: {
|
11058
|
emptyText: 'Search for...'
|
11059
|
}
|
11060
|
}
|
11061
|
});
|
11062
|
}
|
11063
|
});
|
11064
|
|
11065
|
};
|
11066
|
addData = addData + "}";
|
11067
|
Ext.applyIf(me, {
|
11068
|
items: [{
|
11069
|
xtype: 'grid',
|
11070
|
id: gridName,
|
11071
|
name: gridName,
|
11072
|
height: height,
|
11073
|
viewConfig: {
|
11074
|
emptyText: 'No Data Display',
|
11075
|
deferEmptyText: false,
|
11076
|
//Add Nana For Autosize Column Mode
|
11077
|
listeners: {
|
11078
|
refresh: function (dataview) {
|
11079
|
Ext.each(dataview.panel.columns, function (column) {
|
11080
|
//if (column.autoSizeColumn == false)
|
11081
|
// column.autoSizeColumn = true;
|
11082
|
column.autoSize();
|
11083
|
//dataview.store.reload();
|
11084
|
})
|
11085
|
}
|
11086
|
},
|
11087
|
render: function (comp) {
|
11088
|
comp.getStore().reload();
|
11089
|
console.log(comp);
|
11090
|
}
|
11091
|
},
|
11092
|
//store: 'gridStore',
|
11093
|
store: Ext.create('Ext.data.Store', {
|
11094
|
storeId: storeID,
|
11095
|
fields: fieldStore,
|
11096
|
proxy: {
|
11097
|
method: 'POST',
|
11098
|
type: 'ajax',
|
11099
|
url: '',
|
11100
|
reader: {
|
11101
|
type: 'json',
|
11102
|
root: 'data'
|
11103
|
}
|
11104
|
}
|
11105
|
}),
|
11106
|
dockedItems: [{
|
11107
|
xtype: 'toolbar',
|
11108
|
items: [{
|
11109
|
text: 'Add',
|
11110
|
hidden: hide_,
|
11111
|
name: tableName + 'Add',
|
11112
|
iconCls: 'fa-plus-circle',
|
11113
|
style: 'font-family: FontAwesome',
|
11114
|
handler: function () {
|
11115
|
var store = Ext.StoreMgr.lookup(storeID)
|
11116
|
idx = store.getCount();
|
11117
|
var action = getParam('action');
|
11118
|
var data = '';
|
11119
|
var Sequence = 0;
|
11120
|
if (idx == 0) {
|
11121
|
Sequence = 1;
|
11122
|
} else {
|
11123
|
Sequence = 1 + idx;
|
11124
|
}
|
11125
|
//data = {
|
11126
|
// Sequence: Sequence
|
11127
|
//};
|
11128
|
|
11129
|
var seq = 'Sequence';
|
11130
|
var SequenceValue = Sequence;
|
11131
|
eval(addData);
|
11132
|
data[seq] = SequenceValue;
|
11133
|
|
11134
|
store.insert(idx, data);
|
11135
|
}
|
11136
|
|
11137
|
}, {
|
11138
|
text: 'Delete',
|
11139
|
hidden: hide_,
|
11140
|
name: tableName + 'DeleteText',
|
11141
|
iconCls: 'fa-trash-o',
|
11142
|
style: 'font-family: FontAwesome',
|
11143
|
//disabled: true
|
11144
|
handler: function () {
|
11145
|
var me = this,
|
11146
|
store = Ext.StoreMgr.lookup(storeID)
|
11147
|
|
11148
|
var grid = Ext.getCmp(gridName);
|
11149
|
|
11150
|
Ext.MessageBox.show({
|
11151
|
title: 'Remove tab',
|
11152
|
msg: "This will remove. Do you want to continue?",
|
11153
|
buttons: Ext.MessageBox.YESNO,
|
11154
|
fn: function (choice) {
|
11155
|
console.log(choice);
|
11156
|
if (choice === 'yes') {
|
11157
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
11158
|
if (selection) {
|
11159
|
store.remove(selection);
|
11160
|
}
|
11161
|
}
|
11162
|
//delete panel.pendingClose;
|
11163
|
}
|
11164
|
});
|
11165
|
}
|
11166
|
|
11167
|
}
|
11168
|
]
|
11169
|
}
|
11170
|
],
|
11171
|
columns: cols,
|
11172
|
selType: checkSelection,
|
11173
|
//selType: 'rowmodel',
|
11174
|
plugins: {
|
11175
|
ptype: 'rowediting',
|
11176
|
pluginId: 'rowEditing',
|
11177
|
clicksToEdit: 0,
|
11178
|
listeners: {
|
11179
|
//edit: 'onGridEditorEdit'
|
11180
|
}
|
11181
|
}
|
11182
|
}, ]
|
11183
|
|
11184
|
});
|
11185
|
|
11186
|
me.callParent(arguments);
|
11187
|
}
|
11188
|
});
|
11189
|
|
11190
|
Ext.define('MinovaUtil.MinovaES.MinovaCellEditGrid', {
|
11191
|
extend: 'Ext.form.Panel',
|
11192
|
alias: ['widget.MinovaCellEditGrid', 'widget.minovacelleditgrid'],
|
11193
|
requires: [
|
11194
|
'Ext.grid.plugin.CellEditing',
|
11195
|
'Ext.grid.Panel',
|
11196
|
],
|
11197
|
|
11198
|
//renderTo: 'panel-extjs',
|
11199
|
anchor: '100%',
|
11200
|
tableName: undefined,
|
11201
|
hideButton: undefined,
|
11202
|
multiSelect: undefined,
|
11203
|
initComponent: function () {
|
11204
|
var me = this;
|
11205
|
var isLookup = me.isLookup;
|
11206
|
var hide_ = false;
|
11207
|
var widthLock = 250;
|
11208
|
var checkSelection = '';
|
11209
|
|
11210
|
if (me.hideButton == true) {
|
11211
|
hide_ = true;
|
11212
|
}
|
11213
|
if (me.multiSelect) {
|
11214
|
locking = false;
|
11215
|
checkSelection = 'checkboxmodel';
|
11216
|
widthLock = 40;
|
11217
|
}
|
11218
|
var tableName = me.tableName;
|
11219
|
var cols = [];
|
11220
|
var fieldStore = [];
|
11221
|
var _url = 'GetAllField';
|
11222
|
var hasil = null;
|
11223
|
var height = me.height;
|
11224
|
var storeID = 'store' + me.tableName;
|
11225
|
var gridName = 'grid' + me.name;
|
11226
|
if (me.storeName) {
|
11227
|
storeID = me.storeName;
|
11228
|
}
|
11229
|
var LangID = MinovaUtil.GetLangID();
|
11230
|
var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
|
11231
|
Ext.Ajax.request({
|
11232
|
async: false,
|
11233
|
method: 'POST',
|
11234
|
url: '/UserControl/GetStore',
|
11235
|
params: {
|
11236
|
tableName: 'PDSBS0007',
|
11237
|
param: parameter
|
11238
|
},
|
11239
|
success: function (response) {
|
11240
|
var results = Ext.decode(response.responseText);
|
11241
|
hasil = results.data;
|
11242
|
}
|
11243
|
});
|
11244
|
if (hasil.length > 0) {
|
11245
|
Ext.each(hasil, function (rec) {
|
11246
|
fieldStore.push(rec.FieldName)
|
11247
|
|
11248
|
var null_ = null;
|
11249
|
var ReadOnly_ = false;
|
11250
|
if (rec.IsPrimaryKey == true) {
|
11251
|
null_ = false;
|
11252
|
}
|
11253
|
if (rec.IsRequired == true) {
|
11254
|
null_ = false;
|
11255
|
} else {
|
11256
|
null_ = true;
|
11257
|
}
|
11258
|
if (rec.ReadOnly == '1') {
|
11259
|
ReadOnly_ = true;
|
11260
|
}
|
11261
|
var Hidden_ = false;
|
11262
|
if (rec.ReadOnly == '1') {
|
11263
|
ReadOnly_ = true;
|
11264
|
}
|
11265
|
|
11266
|
if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
|
11267
|
Hidden_ = true;
|
11268
|
null_ = true;
|
11269
|
}
|
11270
|
|
11271
|
if (rec.GridView == 1) {
|
11272
|
switch (rec.FormatRef) {
|
11273
|
case "date":
|
11274
|
cols.push({
|
11275
|
xtype: 'minovadatecolumn',
|
11276
|
hidden: Hidden_,
|
11277
|
text: rec.HeaderTitle,
|
11278
|
dataIndex: rec.FieldName,
|
11279
|
filter: {
|
11280
|
itemDefaults: {
|
11281
|
emptyText: 'Search for...',
|
11282
|
|
11283
|
}
|
11284
|
},
|
11285
|
editor: {
|
11286
|
allowBlank: null_,
|
11287
|
xtype: 'datefield',
|
11288
|
hideMode: 'visibility',
|
11289
|
readOnly: ReadOnly_,
|
11290
|
id: tableName + rec.FieldName,
|
11291
|
}
|
11292
|
});
|
11293
|
break
|
11294
|
case "amount":
|
11295
|
cols.push({
|
11296
|
xtype: 'minovacurrancycolumn',
|
11297
|
text: rec.HeaderTitle,
|
11298
|
align: 'right',
|
11299
|
dataIndex: rec.FieldName,
|
11300
|
hidden: Hidden_,
|
11301
|
filter: {
|
11302
|
itemDefaults: {
|
11303
|
emptyText: 'Search for...'
|
11304
|
}
|
11305
|
},
|
11306
|
editor: {
|
11307
|
allowBlank: null_,
|
11308
|
xtype: 'textfield',
|
11309
|
readOnly: ReadOnly_,
|
11310
|
id: tableName + rec.FieldName,
|
11311
|
}
|
11312
|
});
|
11313
|
break
|
11314
|
//case "datetime":
|
11315
|
// if (rec.DataRef != 'CREATEDT' && rec.DataRef != 'CHANGEDT') {
|
11316
|
// cols.push({
|
11317
|
// xtype: 'minovadatetimecolumn',
|
11318
|
// text: rec.HeaderTitle,
|
11319
|
// dataIndex: rec.FieldName,
|
11320
|
// filter: {
|
11321
|
// itemDefaults: {
|
11322
|
// emptyText: 'Search for...'
|
11323
|
// }
|
11324
|
// },
|
11325
|
// editor: {
|
11326
|
// allowBlank: null_,
|
11327
|
// xtype: 'textfield',
|
11328
|
// }
|
11329
|
// });
|
11330
|
// }
|
11331
|
// break
|
11332
|
default:
|
11333
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
|
11334
|
cols.push({
|
11335
|
text: rec.HeaderTitle,
|
11336
|
dataIndex: rec.FieldName,
|
11337
|
width: 100,
|
11338
|
filter: {
|
11339
|
type: 'string',
|
11340
|
itemDefaults: {
|
11341
|
emptyText: 'Search for...'
|
11342
|
}
|
11343
|
}
|
11344
|
});
|
11345
|
} else if (rec.SearchType == '0') {
|
11346
|
var valueField = null;
|
11347
|
var displayValue = null;
|
11348
|
var TableRef = undefined;
|
11349
|
if (rec.TableRef != '') {
|
11350
|
TableRef = rec.TableRef;
|
11351
|
|
11352
|
Ext.Ajax.request({
|
11353
|
async: false,
|
11354
|
method: 'POST',
|
11355
|
url: '/UserControl/GetStore',
|
11356
|
params: {
|
11357
|
tableName: 'SDATATABLEFIELD',
|
11358
|
param: 'TableName[equal]' + rec.TableRef
|
11359
|
},
|
11360
|
success: function (response) {
|
11361
|
var results = Ext.decode(response.responseText);
|
11362
|
data_ = results.data;
|
11363
|
if (data_ != undefined) {
|
11364
|
valueField_ = $.grep(data_, function (r) {
|
11365
|
return r.ValueField == '1'
|
11366
|
});
|
11367
|
valueField = valueField_[0].FieldName
|
11368
|
displayValue_ = $.grep(data_, function (r) {
|
11369
|
return r.DisplayValue == '1'
|
11370
|
});
|
11371
|
displayValue = displayValue_[0].FieldName
|
11372
|
}
|
11373
|
}
|
11374
|
});
|
11375
|
|
11376
|
//create Store
|
11377
|
Ext.create('Ext.data.Store', {
|
11378
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
11379
|
autoLoad: true,
|
11380
|
proxy: {
|
11381
|
method: 'POST',
|
11382
|
type: 'ajax',
|
11383
|
url: '/UserControl/GetStoreAuth',
|
11384
|
extraParams: {
|
11385
|
tableName: TableRef,
|
11386
|
param: rec.ParamCombo,
|
11387
|
menuId: MinovaUtil.GetMenuID()
|
11388
|
},
|
11389
|
reader: {
|
11390
|
type: 'json',
|
11391
|
root: 'data',
|
11392
|
totalProperty: 'data[0].TotalCount'
|
11393
|
}
|
11394
|
}
|
11395
|
});
|
11396
|
|
11397
|
} else if (rec.FixedValue != '') {
|
11398
|
var storeData = [];
|
11399
|
var str = rec.FixedValue;
|
11400
|
var hasil = str.split('||');
|
11401
|
hasil.forEach(function (h) {
|
11402
|
store_ = h.split('=')
|
11403
|
storeData.push({
|
11404
|
code: store_[0],
|
11405
|
desc: store_[1],
|
11406
|
|
11407
|
});
|
11408
|
});
|
11409
|
|
11410
|
valueField = 'code';
|
11411
|
displayValue = 'desc';
|
11412
|
|
11413
|
Ext.create('Ext.data.Store', {
|
11414
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
11415
|
autoLoad: true,
|
11416
|
data: storeData
|
11417
|
})
|
11418
|
}
|
11419
|
|
11420
|
cols.push({
|
11421
|
xtype: 'minovacombocolumn',
|
11422
|
hidden: Hidden_,
|
11423
|
text: rec.HeaderTitle,
|
11424
|
dataIndex: rec.FieldName,
|
11425
|
valueField: valueField,
|
11426
|
displayField: displayValue,
|
11427
|
store: 'store_' + me.tableName + rec.FieldName,
|
11428
|
editor: {
|
11429
|
allowBlank: null_,
|
11430
|
xtype: 'combobox',
|
11431
|
readOnly: ReadOnly_,
|
11432
|
id: tableName + rec.FieldName,
|
11433
|
valueField: valueField,
|
11434
|
displayField: displayValue,
|
11435
|
store: 'store_' + me.tableName + rec.FieldName,
|
11436
|
},
|
11437
|
filter: {
|
11438
|
type: 'list',
|
11439
|
itemDefaults: {
|
11440
|
emptyText: 'Search for...'
|
11441
|
}
|
11442
|
}
|
11443
|
});
|
11444
|
|
11445
|
} else if (rec.SearchType == '5') {
|
11446
|
var valueField = null;
|
11447
|
var displayValue = null;
|
11448
|
var AdditionaldisplayValue = null;
|
11449
|
var TableRef = undefined;
|
11450
|
if (rec.TableRef != '') {
|
11451
|
TableRef = rec.TableRef;
|
11452
|
Ext.Ajax.request({
|
11453
|
async: false,
|
11454
|
method: 'POST',
|
11455
|
url: '/UserControl/GetStore',
|
11456
|
params: {
|
11457
|
tableName: 'SDATATABLEFIELD',
|
11458
|
param: 'TableName[equal]' + rec.TableRef
|
11459
|
},
|
11460
|
success: function (response) {
|
11461
|
var results = Ext.decode(response.responseText);
|
11462
|
data_ = results.data;
|
11463
|
if (data_ != undefined) {
|
11464
|
valueField_ = $.grep(data_, function (r) {
|
11465
|
return r.ValueField == '1'
|
11466
|
});
|
11467
|
if (valueField_.length > 0) {
|
11468
|
valueField = valueField_[0].FieldName
|
11469
|
}
|
11470
|
|
11471
|
displayValue_ = $.grep(data_, function (r) {
|
11472
|
return r.DisplayValue == '1' || r.DisplayValue == '2'
|
11473
|
});
|
11474
|
if (displayValue_.length > 0) {
|
11475
|
displayValue = displayValue_[0].FieldName;
|
11476
|
}
|
11477
|
if (displayValue_.length >= 2) {
|
11478
|
AdditionaldisplayValue = displayValue_[1].FieldName
|
11479
|
}
|
11480
|
}
|
11481
|
}
|
11482
|
});
|
11483
|
}
|
11484
|
Ext.create('Ext.data.Store', {
|
11485
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
11486
|
autoLoad: true,
|
11487
|
proxy: {
|
11488
|
method: 'POST',
|
11489
|
type: 'ajax',
|
11490
|
url: '/UserControl/GetStoreAuth',
|
11491
|
extraParams: {
|
11492
|
tableName: TableRef,
|
11493
|
param: rec.ParamCombo,
|
11494
|
menuId: MinovaUtil.GetMenuID()
|
11495
|
},
|
11496
|
reader: {
|
11497
|
type: 'json',
|
11498
|
root: 'data',
|
11499
|
totalProperty: 'data[0].TotalCount'
|
11500
|
}
|
11501
|
}
|
11502
|
});
|
11503
|
cols.push({
|
11504
|
xtype : 'minovacombocolumn',
|
11505
|
hidden: Hidden_,
|
11506
|
text: rec.HeaderTitle,
|
11507
|
dataIndex: rec.FieldName,
|
11508
|
valueField : valueField,
|
11509
|
displayField : displayValue,
|
11510
|
store : 'store_' + me.tableName + rec.FieldName,
|
11511
|
tpl: Ext.create('Ext.XTemplate',
|
11512
|
'<ul class="x-list-plain"><tpl for=".">',
|
11513
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
11514
|
'</tpl></ul>'),
|
11515
|
displayTpl: Ext.create('Ext.XTemplate',
|
11516
|
'<tpl for=".">',
|
11517
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
11518
|
'</tpl>'),
|
11519
|
editor: {
|
11520
|
allowBlank: null_,
|
11521
|
xtype: 'combobox',
|
11522
|
readOnly: ReadOnly_,
|
11523
|
id: rec.TableName + rec.FieldName,
|
11524
|
nameTable: rec.TableName,
|
11525
|
fieldGrid: rec.FieldName,
|
11526
|
valueField: valueField,
|
11527
|
displayField: displayValue,
|
11528
|
store: 'store_' + me.tableName + rec.FieldName,
|
11529
|
value: rec.DefaultValue,
|
11530
|
tpl: Ext.create('Ext.XTemplate',
|
11531
|
'<ul class="x-list-plain"><tpl for=".">',
|
11532
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
11533
|
'</tpl></ul>'),
|
11534
|
displayTpl: Ext.create('Ext.XTemplate',
|
11535
|
'<tpl for=".">',
|
11536
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
11537
|
'</tpl>')
|
11538
|
},
|
11539
|
renderer: function (value) {
|
11540
|
var store = Ext.data.StoreManager.lookup('store_' + me.tableName + rec.FieldName);
|
11541
|
var index = store.find(valueField, value);
|
11542
|
var val = "";
|
11543
|
if (index != -1) {
|
11544
|
var rc = store.getAt(index);
|
11545
|
//val = rc.get(displayValue);
|
11546
|
val = rc.get(AdditionaldisplayValue) + ' - ' + rc.get(displayValue);
|
11547
|
} else {
|
11548
|
val = value;
|
11549
|
}
|
11550
|
return val;
|
11551
|
},
|
11552
|
filter: {
|
11553
|
type: 'list',
|
11554
|
itemDefaults: {
|
11555
|
emptyText: 'Search for...'
|
11556
|
}
|
11557
|
}
|
11558
|
});
|
11559
|
} else if (rec.SearchType == '2') {
|
11560
|
var triger = (rec.TriggerCombo).split('$');
|
11561
|
var targetField_ = triger[0];
|
11562
|
var fieldValue_ = triger[1];
|
11563
|
cols.push({
|
11564
|
text: rec.HeaderTitle,
|
11565
|
hidden: Hidden_,
|
11566
|
dataIndex: rec.FieldName,
|
11567
|
filter: {
|
11568
|
itemDefaults: {
|
11569
|
emptyText: 'Search for...'
|
11570
|
}
|
11571
|
},
|
11572
|
editor: {
|
11573
|
allowBlank: null_,
|
11574
|
xtype: 'minovalookupgrid',
|
11575
|
readOnly: ReadOnly_,
|
11576
|
isGrid: true,
|
11577
|
fieldTarget: targetField_,
|
11578
|
fieldValue: fieldValue_,
|
11579
|
isGrid: true,
|
11580
|
id: tableName + rec.FieldName,
|
11581
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
11582
|
triggerCls: 'x-form-search-trigger',
|
11583
|
vtype: 'alphanum', // disable space
|
11584
|
|
11585
|
listeners: {
|
11586
|
change: function (val) {
|
11587
|
var custumFunc = rec.SelectFunction;
|
11588
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
11589
|
Ext.Ajax.request({
|
11590
|
async: false,
|
11591
|
method: 'POST',
|
11592
|
url: '/UserControl/GetStore',
|
11593
|
params: {
|
11594
|
tableName: 'PCMFUNC',
|
11595
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
11596
|
},
|
11597
|
success: function (response) {
|
11598
|
var results = Ext.decode(response.responseText);
|
11599
|
data_ = results.data[0];
|
11600
|
if (data_ != undefined) {
|
11601
|
custumFunc = data_.FunctionCode;
|
11602
|
}
|
11603
|
}
|
11604
|
});
|
11605
|
}
|
11606
|
if (custumFunc) {
|
11607
|
eval(custumFunc)
|
11608
|
}
|
11609
|
}
|
11610
|
}
|
11611
|
}
|
11612
|
});
|
11613
|
} else if (rec.SearchType == '3') {
|
11614
|
cols.push({
|
11615
|
text: rec.HeaderTitle,
|
11616
|
hidden: Hidden_,
|
11617
|
dataIndex: rec.FieldName,
|
11618
|
filter: {
|
11619
|
itemDefaults: {
|
11620
|
emptyText: 'Search for...'
|
11621
|
}
|
11622
|
},
|
11623
|
editor: {
|
11624
|
allowBlank: null_,
|
11625
|
// xtype: 'minovalookuptreePopup',
|
11626
|
xtype: 'MinovaLookupTree',
|
11627
|
readOnly: ReadOnly_,
|
11628
|
id: tableName + rec.FieldName,
|
11629
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
11630
|
triggerCls: 'x-form-search-trigger',
|
11631
|
vtype: 'alphanum', // disable space
|
11632
|
treeSructure: rec.SearchFunction, //'O-O-P',
|
11633
|
objClassValue: rec.ParamCombo, //'O',
|
11634
|
listeners: {
|
11635
|
change: function (val) {
|
11636
|
var custumFunc = rec.SelectFunction;
|
11637
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
11638
|
Ext.Ajax.request({
|
11639
|
async: false,
|
11640
|
method: 'POST',
|
11641
|
url: '/UserControl/GetStore',
|
11642
|
params: {
|
11643
|
tableName: 'PCMFUNC',
|
11644
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
11645
|
},
|
11646
|
success: function (response) {
|
11647
|
var results = Ext.decode(response.responseText);
|
11648
|
data_ = results.data[0];
|
11649
|
if (data_ != undefined) {
|
11650
|
custumFunc = data_.FunctionCode;
|
11651
|
}
|
11652
|
}
|
11653
|
});
|
11654
|
}
|
11655
|
if (custumFunc) {
|
11656
|
eval(custumFunc)
|
11657
|
}
|
11658
|
}
|
11659
|
}
|
11660
|
}
|
11661
|
});
|
11662
|
} else if (rec.SearchType != '0' && rec.SearchType != '1' && rec.SearchType != '3' && (rec.FieldName == 'EmployeeID' || rec.FieldName == 'ApplicantID' || rec.FieldName == 'EmployeeIDFrom' || rec.FieldName == 'EmployeeIDTo') && isLookup != true) {
|
11663
|
var triger = (rec.TriggerCombo).split('&');
|
11664
|
var targetField_ = triger[0];
|
11665
|
var fieldValue_ = triger[0];
|
11666
|
cols.push({
|
11667
|
text: rec.HeaderTitle,
|
11668
|
hidden: Hidden_,
|
11669
|
dataIndex: rec.FieldName,
|
11670
|
filter: {
|
11671
|
itemDefaults: {
|
11672
|
emptyText: 'Search for...'
|
11673
|
}
|
11674
|
},
|
11675
|
editor: {
|
11676
|
allowBlank: null_,
|
11677
|
xtype: 'lookupemployee',
|
11678
|
readOnly: ReadOnly_,
|
11679
|
isGrid: true,
|
11680
|
fieldTarget: targetField_,
|
11681
|
fieldValue: fieldValue_,
|
11682
|
isGrid: true,
|
11683
|
id: tableName + rec.FieldName,
|
11684
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
11685
|
triggerCls: 'x-form-search-trigger',
|
11686
|
vtype: 'alphanum', // disable space
|
11687
|
listeners: {
|
11688
|
change: function (val) {
|
11689
|
var custumFunc = rec.SelectFunction;
|
11690
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
11691
|
Ext.Ajax.request({
|
11692
|
async: false,
|
11693
|
method: 'POST',
|
11694
|
url: '/UserControl/GetStore',
|
11695
|
params: {
|
11696
|
tableName: 'PCMFUNC',
|
11697
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
11698
|
},
|
11699
|
success: function (response) {
|
11700
|
var results = Ext.decode(response.responseText);
|
11701
|
data_ = results.data[0];
|
11702
|
if (data_ != undefined) {
|
11703
|
custumFunc = data_.FunctionCode;
|
11704
|
}
|
11705
|
}
|
11706
|
});
|
11707
|
}
|
11708
|
if (custumFunc) {
|
11709
|
eval(custumFunc)
|
11710
|
}
|
11711
|
}
|
11712
|
}
|
11713
|
}
|
11714
|
});
|
11715
|
} else if (rec.SearchType == '4' && isLookup != true) {
|
11716
|
cols.push({
|
11717
|
|
11718
|
text: rec.HeaderTitle,
|
11719
|
hidden: Hidden_,
|
11720
|
dataIndex: rec.FieldName,
|
11721
|
filter: {
|
11722
|
itemDefaults: {
|
11723
|
emptyText: 'Search for...'
|
11724
|
}
|
11725
|
},
|
11726
|
editor: {
|
11727
|
allowBlank: null_,
|
11728
|
xtype: 'lookupemployee',
|
11729
|
readOnly: ReadOnly_,
|
11730
|
isGrid: true,
|
11731
|
fieldTarget: targetField_,
|
11732
|
fieldValue: fieldValue_,
|
11733
|
isGrid: true,
|
11734
|
id: tableName + rec.FieldName,
|
11735
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
11736
|
triggerCls: 'x-form-search-trigger',
|
11737
|
vtype: 'alphanum', // disable space
|
11738
|
listeners: {
|
11739
|
change: function (val) {
|
11740
|
var custumFunc = rec.SelectFunction;
|
11741
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
11742
|
Ext.Ajax.request({
|
11743
|
async: false,
|
11744
|
method: 'POST',
|
11745
|
url: '/UserControl/GetStore',
|
11746
|
params: {
|
11747
|
tableName: 'PCMFUNC',
|
11748
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
11749
|
},
|
11750
|
success: function (response) {
|
11751
|
var results = Ext.decode(response.responseText);
|
11752
|
data_ = results.data[0];
|
11753
|
if (data_ != undefined) {
|
11754
|
custumFunc = data_.FunctionCode;
|
11755
|
}
|
11756
|
}
|
11757
|
});
|
11758
|
}
|
11759
|
if (custumFunc) {
|
11760
|
eval(custumFunc)
|
11761
|
}
|
11762
|
}
|
11763
|
}
|
11764
|
}
|
11765
|
});
|
11766
|
} else {
|
11767
|
cols.push({
|
11768
|
text: rec.HeaderTitle,
|
11769
|
hidden: Hidden_,
|
11770
|
dataIndex: rec.FieldName,
|
11771
|
filter: {
|
11772
|
itemDefaults: {
|
11773
|
emptyText: 'Search for...'
|
11774
|
}
|
11775
|
},
|
11776
|
editor: {
|
11777
|
allowBlank: null_,
|
11778
|
xtype: 'textfield',
|
11779
|
readOnly: ReadOnly_,
|
11780
|
id: tableName + rec.FieldName,
|
11781
|
listeners: {
|
11782
|
change: function (val) {
|
11783
|
var custumFunc = null;
|
11784
|
Ext.Ajax.request({
|
11785
|
async: false,
|
11786
|
method: 'POST',
|
11787
|
url: '/UserControl/GetStore',
|
11788
|
params: {
|
11789
|
tableName: 'SDATATABLEFIELD',
|
11790
|
param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
|
11791
|
},
|
11792
|
success: function (response) {
|
11793
|
var results = Ext.decode(response.responseText);
|
11794
|
data_ = results.data[0];
|
11795
|
if (data_ != undefined) {
|
11796
|
custumFunc = data_.SelectFunction;
|
11797
|
//console.log(data_)
|
11798
|
}
|
11799
|
}
|
11800
|
});
|
11801
|
|
11802
|
if (custumFunc) {
|
11803
|
eval(custumFunc)
|
11804
|
}
|
11805
|
}
|
11806
|
}
|
11807
|
}
|
11808
|
});
|
11809
|
}
|
11810
|
|
11811
|
break
|
11812
|
|
11813
|
}
|
11814
|
} else {
|
11815
|
cols.push({
|
11816
|
text: rec.HeaderTitle,
|
11817
|
hidden: Hidden_,
|
11818
|
dataIndex: rec.FieldName,
|
11819
|
hidden: true,
|
11820
|
editor: {
|
11821
|
allowBlank: true,
|
11822
|
xtype: 'textfield',
|
11823
|
readOnly: ReadOnly_,
|
11824
|
id: tableName + rec.FieldName,
|
11825
|
},
|
11826
|
filter: {
|
11827
|
itemDefaults: {
|
11828
|
emptyText: 'Search for...'
|
11829
|
}
|
11830
|
}
|
11831
|
});
|
11832
|
}
|
11833
|
});
|
11834
|
};
|
11835
|
|
11836
|
this.cellEditing = new Ext.grid.plugin.CellEditing({
|
11837
|
clicksToEdit: 1
|
11838
|
});
|
11839
|
Ext.applyIf(me, {
|
11840
|
items: [{
|
11841
|
xtype: 'grid',
|
11842
|
id: gridName,
|
11843
|
name: gridName,
|
11844
|
height: height,
|
11845
|
//store: 'gridStore',
|
11846
|
store: Ext.create('Ext.data.Store', {
|
11847
|
storeId: storeID,
|
11848
|
fields: fieldStore,
|
11849
|
proxy: {
|
11850
|
method: 'POST',
|
11851
|
type: 'ajax',
|
11852
|
url: '',
|
11853
|
reader: {
|
11854
|
type: 'json',
|
11855
|
root: 'data'
|
11856
|
}
|
11857
|
}
|
11858
|
}),
|
11859
|
viewConfig: {
|
11860
|
emptyText: 'No Data Display',
|
11861
|
deferEmptyText: false,
|
11862
|
//Add Nana For Autosize Column Mode
|
11863
|
listeners: {
|
11864
|
refresh: function (dataview) {
|
11865
|
Ext.each(dataview.panel.columns, function (column) {
|
11866
|
if (column.autoSizeColumn == false)
|
11867
|
column.autoSizeColumn = true;
|
11868
|
column.autoSize();
|
11869
|
//dataview.store.reload();
|
11870
|
})
|
11871
|
}
|
11872
|
},
|
11873
|
render: function (comp) {
|
11874
|
comp.getStore().reload();
|
11875
|
console.log(comp);
|
11876
|
}
|
11877
|
},
|
11878
|
dockedItems: [{
|
11879
|
xtype: 'toolbar',
|
11880
|
items: [{
|
11881
|
text: 'Add',
|
11882
|
hidden: hide_,
|
11883
|
name: tableName + 'Add',
|
11884
|
iconCls: 'fa-plus-circle',
|
11885
|
style: 'font-family: FontAwesome',
|
11886
|
handler: function () {
|
11887
|
var store = Ext.StoreMgr.lookup(storeID)
|
11888
|
idx = store.getCount();
|
11889
|
var action = getParam('action');
|
11890
|
var data = '';
|
11891
|
var Sequence = 0;
|
11892
|
if (idx == 0) {
|
11893
|
Sequence = 1;
|
11894
|
} else {
|
11895
|
Sequence = 1 + idx;
|
11896
|
}
|
11897
|
data = {
|
11898
|
Sequence: Sequence
|
11899
|
};
|
11900
|
|
11901
|
store.insert(idx, data);
|
11902
|
}
|
11903
|
|
11904
|
}, {
|
11905
|
text: 'Delete',
|
11906
|
hidden: hide_,
|
11907
|
name: tableName + 'DeleteText',
|
11908
|
iconCls: 'fa-trash-o',
|
11909
|
style: 'font-family: FontAwesome',
|
11910
|
//disabled: true
|
11911
|
handler: function () {
|
11912
|
var me = this,
|
11913
|
store = Ext.StoreMgr.lookup(storeID)
|
11914
|
|
11915
|
var grid = Ext.getCmp(gridName);
|
11916
|
|
11917
|
Ext.MessageBox.show({
|
11918
|
title: 'Remove tab',
|
11919
|
msg: "This will remove. Do you want to continue?",
|
11920
|
buttons: Ext.MessageBox.YESNO,
|
11921
|
fn: function (choice) {
|
11922
|
console.log(choice);
|
11923
|
if (choice === 'yes') {
|
11924
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
11925
|
if (selection) {
|
11926
|
store.remove(selection);
|
11927
|
}
|
11928
|
}
|
11929
|
//delete panel.pendingClose;
|
11930
|
}
|
11931
|
});
|
11932
|
}
|
11933
|
|
11934
|
}
|
11935
|
]
|
11936
|
}
|
11937
|
],
|
11938
|
columns: cols,
|
11939
|
selModel: {
|
11940
|
type: 'cellmodel'
|
11941
|
},
|
11942
|
plugins: [this.cellEditing],
|
11943
|
}, ]
|
11944
|
|
11945
|
});
|
11946
|
|
11947
|
me.callParent(arguments);
|
11948
|
}
|
11949
|
});
|
11950
|
//hamid200916
|
11951
|
Ext.define('MinovaUtil.MinovaES.MinovaLookupEmployeelama', {
|
11952
|
extend: 'Ext.panel.Panel',
|
11953
|
alias: 'widget.lookupemployeelama',
|
11954
|
requires: [
|
11955
|
'Ext.data.*',
|
11956
|
'Ext.grid.*',
|
11957
|
'Ext.tree.*',
|
11958
|
'Ext.ux.CheckColumn',
|
11959
|
//'MinovaES.View.sample.samplepopupEMPID'
|
11960
|
|
11961
|
],
|
11962
|
formname: undefined,
|
11963
|
fieldname: undefined,
|
11964
|
allowBlank: undefined,
|
11965
|
width: undefined,
|
11966
|
tableName: undefined,
|
11967
|
//bodyStyle: 'padding-left: -20px; padding-bottom: -20px; padding-top: -20px; padding-right: -20px;',
|
11968
|
//padding: '-40px',
|
11969
|
//bodyStyle: 'margin:-20px;',
|
11970
|
//margin: '-20 -20 -20 -20',
|
11971
|
//fieldLabel: undefined,
|
11972
|
//name: undefined,
|
11973
|
//pnl: this.name,
|
11974
|
initComponent: function () {
|
11975
|
var me = this;
|
11976
|
targetField_ = me.fieldname;
|
11977
|
//var nameField_ = me.name;
|
11978
|
//var panelform = this.pnl;
|
11979
|
var nameField_ = me.fieldname;
|
11980
|
var blank = me.allowBlank;
|
11981
|
var width_ = me.width;
|
11982
|
var tableName_ = me.tableName;
|
11983
|
var panelform = "form" + me.name;
|
11984
|
//var fieldLabel_ = me.fieldLabel;
|
11985
|
Ext.applyIf(me, {
|
11986
|
items: [{
|
11987
|
xtype: 'form',
|
11988
|
name: panelform,
|
11989
|
items: [{
|
11990
|
xtype: 'fieldcontainer',
|
11991
|
layout: 'hbox',
|
11992
|
fieldLabel: me.fieldLabel,
|
11993
|
items: [{
|
11994
|
xtype: "triggerfield",
|
11995
|
name: nameField_,
|
11996
|
width: width_,
|
11997
|
//anchor: '50%',
|
11998
|
//editable: true,
|
11999
|
allowBlank: blank,
|
12000
|
triggerCls: 'x-form-search-trigger',
|
12001
|
onTriggerClick: function (e) {
|
12002
|
//var tableName_ = this.tableName;
|
12003
|
var count_lookup = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
|
12004
|
var lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0];
|
12005
|
var EmployeeID = Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0];
|
12006
|
var EmployeeID_ = EmployeeID.getValue();
|
12007
|
//var params = "EmployeeID[=]" + EmployeeID.getValue();
|
12008
|
//var Url = "sample?EmployeeID=" + EmployeeID.getValue();
|
12009
|
//window.open(Url, "_self");
|
12010
|
//var selection_ = selection.getValue();
|
12011
|
//var EmployeeSearch = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
|
12012
|
//var lokup = EmployeeSearch.setValue(selection_);
|
12013
|
|
12014
|
var popup_lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
|
12015
|
if (count_lookup == 1) {
|
12016
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField = this.name;
|
12017
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].show();
|
12018
|
} else {
|
12019
|
//var _popUploadView = Ext.create("MinovaUtil.MinovaES.LookupEmployeeQuickSearch");
|
12020
|
Ext.create('MinovaUtil.MinovaES.LookupEmployeeQuickSearch', {
|
12021
|
// tableName: tableName_,
|
12022
|
|
12023
|
//}).show()
|
12024
|
//_popUploadView.tableName = tableName_;
|
12025
|
tableName: tableName_,
|
12026
|
targetField: this.name,
|
12027
|
}).show()
|
12028
|
}
|
12029
|
|
12030
|
//var _popUploadView = Ext.create("MinovaES.view.sample.samplepopupEMPID");
|
12031
|
//var a = _popUploadView.show();
|
12032
|
var text = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
|
12033
|
text.setValue(EmployeeID_);
|
12034
|
|
12035
|
if (EmployeeID_ !== "") {
|
12036
|
var store = Ext.data.StoreManager.lookup('lookupEMPID');
|
12037
|
var grid = Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0];
|
12038
|
store.proxy.extraParams = {
|
12039
|
tableName: tableName_, //'PDSEMP0002',
|
12040
|
param: 'EmpID_ExternalID_FullName[like]' + EmployeeID_
|
12041
|
};
|
12042
|
store.reload();
|
12043
|
}
|
12044
|
},
|
12045
|
listeners: {
|
12046
|
specialkey: function (f, e) {
|
12047
|
if (e.getKey() == e.ENTER) {
|
12048
|
//alert("about to submit");
|
12049
|
var count_lookup = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
|
12050
|
var lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0];
|
12051
|
var EmployeeID = Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0];
|
12052
|
var EmployeeID_ = EmployeeID.getValue();
|
12053
|
|
12054
|
var popup_lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
|
12055
|
if (count_lookup == 1) {
|
12056
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField = this.name;
|
12057
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].show();
|
12058
|
} else {
|
12059
|
Ext.create('MinovaUtil.MinovaES.LookupEmployeeQuickSearch', {
|
12060
|
tableName: tableName_,
|
12061
|
targetField: this.name,
|
12062
|
}).show()
|
12063
|
//var _popUploadView = Ext.create("MinovaUtil.MinovaES.LookupEmployeeQuickSearch");
|
12064
|
//_popUploadView.targetField = this.name;
|
12065
|
//_popUploadView.show();
|
12066
|
|
12067
|
}
|
12068
|
//var _popUploadView = Ext.create("MinovaES.view.sample.samplepopupEMPID");
|
12069
|
//var a = _popUploadView.show();
|
12070
|
var text = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
|
12071
|
text.setValue(EmployeeID_);
|
12072
|
|
12073
|
if (EmployeeID_ !== "") {
|
12074
|
var store = Ext.data.StoreManager.lookup('lookupEMPID');
|
12075
|
var grid = Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0];
|
12076
|
store.proxy.extraParams = {
|
12077
|
tableName: tableName_, //'PDSEMP0002',
|
12078
|
param: 'EmpID_ExternalID_FullName[like]' + EmployeeID_
|
12079
|
};
|
12080
|
store.reload();
|
12081
|
}
|
12082
|
//myform.getForm().submit();
|
12083
|
}
|
12084
|
}
|
12085
|
}
|
12086
|
|
12087
|
}, {
|
12088
|
xtype: 'tbspacer',
|
12089
|
width: 5
|
12090
|
}, {
|
12091
|
xtype: 'button',
|
12092
|
name: nameField_,
|
12093
|
anchor: '50%',
|
12094
|
text: 'Advance',
|
12095
|
listeners: {
|
12096
|
click: function () {
|
12097
|
var count_lookup = Ext.ComponentQuery.query('[name=popup_lookupEmployee]').length;
|
12098
|
if (count_lookup == 1) {
|
12099
|
Ext.ComponentQuery.query('[name=popup_lookupEmployee]')[0].targetField = this.name;
|
12100
|
Ext.ComponentQuery.query('[name=popup_lookupEmployee]')[0].show();
|
12101
|
} else {
|
12102
|
Ext.create('MinovaUtil.MinovaES.LookupEmployeeAdvance', {
|
12103
|
tableName: tableName_,
|
12104
|
targetField: this.name,
|
12105
|
}).show()
|
12106
|
//var _popUploadView = Ext.create("MinovaUtil.MinovaES.LookupEmployeeAdvance");
|
12107
|
//_popUploadView.targetField = this.name;
|
12108
|
//_popUploadView.show();
|
12109
|
|
12110
|
}
|
12111
|
}
|
12112
|
},
|
12113
|
}
|
12114
|
]
|
12115
|
}
|
12116
|
]
|
12117
|
}
|
12118
|
]
|
12119
|
});
|
12120
|
me.callParent(arguments);
|
12121
|
}
|
12122
|
});
|
12123
|
|
12124
|
Ext.define('MinovaUtil.MinovaES.LookupEmployeeQuickSearch', {
|
12125
|
extend: 'Ext.window.Window',
|
12126
|
alias: 'widget.popup_employeequicksearch',
|
12127
|
requires: [
|
12128
|
// 'MinovaES.controller.sample.ctrlsample',
|
12129
|
//'MinovaES.store.data.TableType',
|
12130
|
],
|
12131
|
//controller: 'ctrlsample',
|
12132
|
height: '85%',
|
12133
|
width: '42%',
|
12134
|
minWidth: '50%',
|
12135
|
maxWidth: '100%',
|
12136
|
bodyPadding: 0,
|
12137
|
formname: undefined,
|
12138
|
//modal: true,
|
12139
|
title: 'Lookup - EmployeeID',
|
12140
|
name: 'popup_lookupEMPID',
|
12141
|
test: undefined,
|
12142
|
targetField: undefined,
|
12143
|
tableName: undefined,
|
12144
|
afterender: function () {
|
12145
|
test = nameform;
|
12146
|
},
|
12147
|
initComponent: function () {
|
12148
|
|
12149
|
var me = this;
|
12150
|
var targetField_ = me.targetField;
|
12151
|
var form = me.test;
|
12152
|
var tableName_ = me.tableName;
|
12153
|
Ext.applyIf(me, {
|
12154
|
items: [{
|
12155
|
xtype: 'form',
|
12156
|
name: 'frmSearch',
|
12157
|
width: '100%',
|
12158
|
height: 'auto',
|
12159
|
dockedItems: [{
|
12160
|
xtype: 'toolbar',
|
12161
|
dock: 'top',
|
12162
|
layout: 'vbox',
|
12163
|
bodyPadding: 10,
|
12164
|
border: 0,
|
12165
|
items: [{
|
12166
|
xtype: 'fieldset',
|
12167
|
layout: 'hbox',
|
12168
|
width: '100%',
|
12169
|
border: 0,
|
12170
|
padding: 0,
|
12171
|
items: [{
|
12172
|
xtype: 'textfield',
|
12173
|
name: 'EmployeeSearch',
|
12174
|
fieldLabel: 'Emp ID/ External ID/ Full Name',
|
12175
|
width: 475,
|
12176
|
labelWidth: 185,
|
12177
|
enableKeyEvents: true,
|
12178
|
listeners: {
|
12179
|
specialkey: function (f, e) {
|
12180
|
if (e.getKey() == e.ENTER) {
|
12181
|
var emp = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
|
12182
|
var emp_ = emp.getValue();
|
12183
|
var store = Ext.data.StoreManager.lookup('lookupEMPID');
|
12184
|
var grid = Ext.ComponentQuery.query('[name=EmployeeID]')[0];
|
12185
|
store.proxy.extraParams = {
|
12186
|
tableName: tableName_, //'PDSEMP0002',
|
12187
|
param: 'EmpID_ExternalID_FullName[like]' + emp_
|
12188
|
};
|
12189
|
store.reload();
|
12190
|
}
|
12191
|
}
|
12192
|
}
|
12193
|
}, {
|
12194
|
xtype: 'tbspacer',
|
12195
|
width: 5
|
12196
|
}, {
|
12197
|
xtype: 'button',
|
12198
|
name: 'Search',
|
12199
|
text: 'Search',
|
12200
|
handler: function () {
|
12201
|
var emp = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
|
12202
|
var emp_ = emp.getValue();
|
12203
|
var store = Ext.data.StoreManager.lookup('lookupEMPID');
|
12204
|
var grid = Ext.ComponentQuery.query('[name=EmployeeID]')[0];
|
12205
|
store.proxy.extraParams = {
|
12206
|
tableName: tableName_, //'PDSEMP0002',
|
12207
|
param: 'EmpID_ExternalID_FullName[like]' + emp_
|
12208
|
};
|
12209
|
store.reload();
|
12210
|
},
|
12211
|
|
12212
|
}
|
12213
|
]
|
12214
|
}
|
12215
|
]
|
12216
|
}
|
12217
|
],
|
12218
|
}, {
|
12219
|
items: [{
|
12220
|
xtype: "minovagrid1",
|
12221
|
name: "GridEmployeeID",
|
12222
|
storename: 'lookupEMPID',
|
12223
|
tableName: tableName_, //'PDSEMP0002',
|
12224
|
param: '',
|
12225
|
isLookup: true,
|
12226
|
pagesize: 25,
|
12227
|
height: 425,
|
12228
|
listeners: {
|
12229
|
beforeedit: function () {
|
12230
|
return false;
|
12231
|
},
|
12232
|
itemdblclick: function () {
|
12233
|
var grid = Ext.ComponentQuery.query('[name=GridEmployeeID]')[0];
|
12234
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
12235
|
var Emp_ = selection.data.EmployeeID;
|
12236
|
//var formSelection = Ext.ComponentQuery.query('[name=' + form + ']')[0];
|
12237
|
//formSelection.getForm().setValues(grid.getSelectionModel().getSelection()[0].data);
|
12238
|
|
12239
|
var target = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField;
|
12240
|
Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(Emp_);
|
12241
|
//Ext.ComponentQuery.query('[name=EmployeeiD]')[0].setValue(selection.data.EmployeeID);;
|
12242
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].hide();
|
12243
|
}
|
12244
|
},
|
12245
|
}, {
|
12246
|
xtype: 'pagingtoolbar',
|
12247
|
store: 'lookupEMPID',
|
12248
|
dock: 'bottom',
|
12249
|
displayInfo: true
|
12250
|
}
|
12251
|
]
|
12252
|
}
|
12253
|
]
|
12254
|
});
|
12255
|
me.callParent(arguments);
|
12256
|
}
|
12257
|
});
|
12258
|
Ext.define('MinovaUtil.MinovaES.LookupEmployeeAdvance', {
|
12259
|
extend: 'Ext.window.Window',
|
12260
|
alias: 'widget.popup_employeeadvance',
|
12261
|
requires: [
|
12262
|
//'MinovaES.controller.sample.ctrlsample',
|
12263
|
//'MinovaES.store.data.TableType',
|
12264
|
],
|
12265
|
//controller: 'ctrlsample',
|
12266
|
height: '85%',
|
12267
|
width: '42%',
|
12268
|
minWidth: '50%',
|
12269
|
maxWidth: '100%',
|
12270
|
bodyPadding: 10,
|
12271
|
anchor: '50%',
|
12272
|
formname: undefined,
|
12273
|
//modal: true,
|
12274
|
title: 'Lookup - EmployeeID',
|
12275
|
name: 'popup_lookupEmployee',
|
12276
|
test: undefined,
|
12277
|
targetField: undefined,
|
12278
|
tableName: undefined,
|
12279
|
initComponent: function () {
|
12280
|
var me = this;
|
12281
|
var targetField_ = me.targetField;
|
12282
|
var form = me.test;
|
12283
|
var tableName_ = me.tableName;
|
12284
|
Ext.applyIf(me, {
|
12285
|
items: [{
|
12286
|
xtype: 'form',
|
12287
|
name: 'formlookup',
|
12288
|
items: [{
|
12289
|
xtype: 'minovaform',
|
12290
|
name: 'frmlookup',
|
12291
|
tableName: tableName_, //'PDSEMP0001',
|
12292
|
param: '',
|
12293
|
isLookup: true,
|
12294
|
listeners: {
|
12295
|
onStockFormKeyPress: function (textfield, event, options) {
|
12296
|
if (event.getKey() == event.ENTER) {
|
12297
|
alert("test");
|
12298
|
//Ext.Msg.alert('Keys', 'You pressed the Enter key');
|
12299
|
}
|
12300
|
}
|
12301
|
},
|
12302
|
buttons: [{
|
12303
|
text: 'Search',
|
12304
|
//iconCls : 'fa-edit',
|
12305
|
//style : 'font-family: FontAwesome',
|
12306
|
listeners: {
|
12307
|
click: function () {
|
12308
|
var store = Ext.data.StoreManager.lookup('lookupStore');
|
12309
|
var form = Ext.ComponentQuery.query('[name=formlookup]')[0].getForm();
|
12310
|
grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
|
12311
|
var values_ = form.getValues();
|
12312
|
var fields_ = form.getFields().items;
|
12313
|
var param_ = '';
|
12314
|
for (var i = 0; i < fields_.length; i++) {
|
12315
|
var val_ = form.getFields().items[i].getValue();
|
12316
|
var xtype_ = form.getFields().items[i].xtype;
|
12317
|
var oprator_ = '[like]';
|
12318
|
if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
12319
|
oprator_ = '[Equal]';
|
12320
|
}
|
12321
|
if (xtype_ == 'datefield') {
|
12322
|
if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
12323
|
oprator_ = '[LessThanEqual]';
|
12324
|
} else {
|
12325
|
oprator_ = '[GreaterThanEqual]';
|
12326
|
}
|
12327
|
}
|
12328
|
if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
12329
|
param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
12330
|
}
|
12331
|
}
|
12332
|
store.proxy.extraParams = {
|
12333
|
tableName: grid.tableName,
|
12334
|
param: param_
|
12335
|
};
|
12336
|
store.removeAll();
|
12337
|
store.reload();
|
12338
|
store.loadPage(1);
|
12339
|
},
|
12340
|
|
12341
|
}
|
12342
|
}
|
12343
|
]
|
12344
|
}, {
|
12345
|
xtype: 'minovagrid',
|
12346
|
name: 'gridlookup',
|
12347
|
minHeight: 320,
|
12348
|
height: 250,
|
12349
|
tableName: tableName_, //'PDSEMP0001',
|
12350
|
param: '',
|
12351
|
isLookup: true,
|
12352
|
storename: 'lookupStore',
|
12353
|
pagesize: 25,
|
12354
|
listeners: {
|
12355
|
beforeedit: function () {
|
12356
|
return false;
|
12357
|
},
|
12358
|
itemdblclick: function () {
|
12359
|
var grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
|
12360
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
12361
|
var Emp_ = selection.data.EmployeeID;
|
12362
|
//var formSelection = Ext.ComponentQuery.query('[name=EmployeeSelection]')[0];
|
12363
|
//formSelection.getForm().setValues(grid.getSelectionModel().getSelection()[0].data);
|
12364
|
var target = Ext.ComponentQuery.query('[name=popup_lookupEmployee]')[0].targetField;
|
12365
|
Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(Emp_);
|
12366
|
Ext.ComponentQuery.query('[name=popup_lookupEmployee]')[0].hide();
|
12367
|
|
12368
|
}
|
12369
|
},
|
12370
|
dockedItems: [{
|
12371
|
xtype: 'pagingtoolbar',
|
12372
|
store: 'lookupStore',
|
12373
|
dock: 'bottom',
|
12374
|
displayInfo: true
|
12375
|
}
|
12376
|
]
|
12377
|
}
|
12378
|
]
|
12379
|
}
|
12380
|
]
|
12381
|
});
|
12382
|
me.callParent(arguments);
|
12383
|
}
|
12384
|
});
|
12385
|
//end hamid
|
12386
|
|
12387
|
|
12388
|
// lookup tree
|
12389
|
Ext.define('MinovaES.view.orm.lookup.minovalookuptreePopup', {
|
12390
|
extend: 'Ext.window.Window',
|
12391
|
alias: 'widget.minovalookuptreePopup',
|
12392
|
requires: [
|
12393
|
|
12394
|
],
|
12395
|
height: '80%',
|
12396
|
width: '40%',
|
12397
|
minWidth: '50%',
|
12398
|
maxWidth: '100%',
|
12399
|
bodyPadding: 5,
|
12400
|
modal: true,
|
12401
|
name: 'mainlookupTree',
|
12402
|
objFilter: undefined,
|
12403
|
treeSructure: undefined, // object relationship
|
12404
|
objClassValue: undefined, // object yang akan di input ke field
|
12405
|
formname: undefined, // nama form
|
12406
|
targetField: undefined, // nama field yang akan diset value
|
12407
|
//title:'judul',
|
12408
|
bodyPadding: 0,
|
12409
|
initComponent: function () {
|
12410
|
var me = this;
|
12411
|
var objFilter_ = me.objFilter;
|
12412
|
var treeSructure_ = me.treeSructure;
|
12413
|
var formname_ = me.formname;
|
12414
|
var objClassValue_ = me.objClassValue;
|
12415
|
var targetField_ = me.targetField;
|
12416
|
var AllObjectClass = treeSructure_.split('-');
|
12417
|
var form_ = Ext.ComponentQuery.query('[name=' + formname_ + ']')[0];
|
12418
|
var StartDate_ = '';
|
12419
|
if (form_) {
|
12420
|
|
12421
|
if (form_.getForm().findField('StartDate')) {
|
12422
|
StartDate_ = form_.getForm().findField('StartDate').getValue();
|
12423
|
} else {
|
12424
|
StartDate_ = MinovaUtil.GetNowDate();
|
12425
|
}
|
12426
|
|
12427
|
}
|
12428
|
|
12429
|
Ext.applyIf(me, {
|
12430
|
items: [{
|
12431
|
//xtype : 'panel',
|
12432
|
items: [{
|
12433
|
xtype: 'tabpanel',
|
12434
|
items: [{
|
12435
|
|
12436
|
xtype: 'form',
|
12437
|
title: 'Structured Search',
|
12438
|
height: '70%',
|
12439
|
tabConfig: {
|
12440
|
tooltip: 'Search by tree'
|
12441
|
},
|
12442
|
items: [{
|
12443
|
xtype: 'form',
|
12444
|
items: [{
|
12445
|
|
12446
|
xtype: 'treepanel',
|
12447
|
rootVisible: false,
|
12448
|
height: 400,
|
12449
|
|
12450
|
name: 'searchByTreePopUp',
|
12451
|
useArrows: true,
|
12452
|
animate: false,
|
12453
|
targetField: targetField_,
|
12454
|
formname: formname_,
|
12455
|
root: {
|
12456
|
expanded: true,
|
12457
|
nodeType: 'async',
|
12458
|
ext: 'Favorites',
|
12459
|
id: 'null'
|
12460
|
},
|
12461
|
listeners: {
|
12462
|
afterrender: function (me_) {
|
12463
|
me_.mask();
|
12464
|
if (treeSructure_ != 'O-O-P') {
|
12465
|
var countCol = me_.columns.length;
|
12466
|
me_.columns[countCol - 1].setHidden(true);
|
12467
|
|
12468
|
}
|
12469
|
if (StartDate_ != '') {
|
12470
|
var node = "root";
|
12471
|
var ObjectClass_ = treeSructure_.split('-');
|
12472
|
//Ext.Ajax.request({
|
12473
|
// method: 'POST',
|
12474
|
// async: false,
|
12475
|
// url: '/UserControl/GetStoreAuth',
|
12476
|
// params: {
|
12477
|
// tableName: "PHROM0001",
|
12478
|
// param: "ObjectClass[=]" + ObjectClass_[0],
|
12479
|
// menuId: MinovaUtil.GetMenuID()
|
12480
|
// },
|
12481
|
// success: function (response) {
|
12482
|
// var results = Ext.decode(response.responseText);
|
12483
|
// var data_ = results.data;
|
12484
|
// if (data_.length > 0 && data_.length == 1) {
|
12485
|
// node = ObjectClass_[0] + data_[0].ObjectID;
|
12486
|
// }
|
12487
|
|
12488
|
// }
|
12489
|
//});
|
12490
|
|
12491
|
Ext.Ajax.request({
|
12492
|
async: false,
|
12493
|
//url: '/ORM/GetRelObjectTreeAsync?node=' + node + '&tree_struct_code=' + treeSructure_ + '&keyDate=' + StartDate_,
|
12494
|
url: '/ORM/GetRelObjectTreeAsyncAuth?node=' + 'root' + '&tree_struct_code=' + treeSructure_ + '&keyDate=' + StartDate_ + '&ObjectClass=' + ObjectClass_[0] + '&MenuID=' + MinovaUtil.GetMenuID(),
|
12495
|
success: function (response) {
|
12496
|
var results = Ext.decode(response.responseText);
|
12497
|
var data_ = results.results;
|
12498
|
//console.log(data_)
|
12499
|
var pnl = Ext.ComponentQuery.query('[name=searchByTreePopUp]')[0];
|
12500
|
pnl.store.setRootNode({
|
12501
|
expanded: true,
|
12502
|
nodetype: 'async',
|
12503
|
children: data_
|
12504
|
//[]
|
12505
|
});
|
12506
|
}
|
12507
|
});
|
12508
|
|
12509
|
}
|
12510
|
me_.unmask();
|
12511
|
},
|
12512
|
afteritemexpand: function (node, index, item, eOpts) {
|
12513
|
var me = this;
|
12514
|
var data_ = null;
|
12515
|
var idx = 0;
|
12516
|
var tree_ = Ext.ComponentQuery.query('treepanel[name=searchByTreePopUp]')[0];
|
12517
|
var v = tree_.getView();
|
12518
|
tree_.mask('Expanding tree...');
|
12519
|
var main_ = Ext.ComponentQuery.query('[name=ORMMain]')[0];
|
12520
|
Ext.Ajax.request({
|
12521
|
async: false,
|
12522
|
url: '/ORM/GetRelObjectTreeAsync?node=' + node.get('Id') + '&tree_struct_code=' + treeSructure_ + '&keyDate=' + StartDate_,
|
12523
|
success: function (response) {
|
12524
|
var results = Ext.decode(response.responseText);
|
12525
|
data_ = results.results;
|
12526
|
console.log(data_)
|
12527
|
}
|
12528
|
});
|
12529
|
|
12530
|
if (data_.length > 0) {
|
12531
|
data_.forEach(function (rec) {
|
12532
|
|
12533
|
console.log(rec.Id)
|
12534
|
if (v.store.data.find('Id', rec.Id) == null) {
|
12535
|
node.appendChild(data_[idx])
|
12536
|
}
|
12537
|
idx++;
|
12538
|
})
|
12539
|
}
|
12540
|
|
12541
|
setTimeout(function () {
|
12542
|
|
12543
|
tree_.unmask();
|
12544
|
}, 200);
|
12545
|
|
12546
|
},
|
12547
|
itemdblclick: function (this_, record, item, index, e, eOpts) {
|
12548
|
var cek = false;
|
12549
|
var class_ = objClassValue_;
|
12550
|
var classDt = class_.split(']');
|
12551
|
var classVal = "";
|
12552
|
if (classDt.length == 1) {
|
12553
|
classVal = classDt[0];
|
12554
|
}
|
12555
|
if (classDt.length > 1) {
|
12556
|
classVal = classDt[1];
|
12557
|
}
|
12558
|
if (classVal == record.data.ObjectType) {
|
12559
|
var form_ = Ext.ComponentQuery.query('[name=' + formname_ + ']')[0].getForm();
|
12560
|
var type = 'rc';
|
12561
|
if (form_.findField(targetField_).nameTable) {
|
12562
|
type = form_.findField(targetField_).nameTable.substr(3, 2).toLowerCase();
|
12563
|
}
|
12564
|
if (type != "rc") {
|
12565
|
if (classVal == 'P' && (MinovaUtil.GetMenuID() == 'PA02' || MinovaUtil.GetMenuID() == 'ESS_MUTATION' || MinovaUtil.GetMenuID() == 'ESS_PROMOTION')) {
|
12566
|
// cek apakah posisis sudah di assign
|
12567
|
var hasil = null;
|
12568
|
Ext.Ajax.request({
|
12569
|
async: false,
|
12570
|
method: 'POST',
|
12571
|
url: '/UserControl/GetStore',
|
12572
|
params: {
|
12573
|
tableName: 'PHROM0002',
|
12574
|
param: 'ObjectClass[=]P,RelationshipDirectory[=]A,RelationshipClass[=]E,StartDate[LessThanEqual]' + StartDate_ + ',EndDate[GreaterThanEqual]' + StartDate_ + ',ObjectID[=]' + record.data.ObjectId
|
12575
|
},
|
12576
|
success: function (response) {
|
12577
|
var results = Ext.decode(response.responseText);
|
12578
|
//hasil = results.data[0].RelationshipObject;
|
12579
|
hasil = results.data.length;
|
12580
|
if (hasil == 0) {
|
12581
|
cek = true;
|
12582
|
} else {
|
12583
|
//Ext.Msg.show({
|
12584
|
// title: 'Warning',
|
12585
|
// message: MinovaMessageData('OM0001', ''),
|
12586
|
// buttons: Ext.Msg.OK,
|
12587
|
// fn: function (choice) {
|
12588
|
// console.log(choice);
|
12589
|
// if (choice === 'ok') {
|
12590
|
// }
|
12591
|
|
12592
|
// }
|
12593
|
//});
|
12594
|
//alert(MinovaMessageData('OM0001', ''))
|
12595
|
MinovaMessageError("Position Occupied", "OM0001", "");
|
12596
|
}
|
12597
|
//count = hasil.length
|
12598
|
}
|
12599
|
});
|
12600
|
} else {
|
12601
|
cek = true;
|
12602
|
}
|
12603
|
} else {
|
12604
|
cek = true;
|
12605
|
}
|
12606
|
}
|
12607
|
if (cek) {
|
12608
|
// set value to form
|
12609
|
var form_ = Ext.ComponentQuery.query('[name=' + formname_ + ']')[0].getForm();
|
12610
|
form_.findField(targetField_).setValue('a');
|
12611
|
form_.findField(targetField_).valData = 'a';
|
12612
|
form_.findField(targetField_).setValue(record.data.Text);
|
12613
|
form_.findField(targetField_).valData = record.data.ObjectId;
|
12614
|
form_.findField(targetField_).focus();
|
12615
|
if (form_.findField(targetField_).nextSibling()) {
|
12616
|
form_.findField(targetField_).nextSibling().focus();
|
12617
|
} else {
|
12618
|
form_.findField(targetField_).blur();
|
12619
|
}
|
12620
|
Ext.ComponentQuery.query('[name=' + targetField_ + 'lookUp' + ']')[0].destroy();
|
12621
|
}
|
12622
|
|
12623
|
}
|
12624
|
},
|
12625
|
|
12626
|
columns: [{
|
12627
|
xtype: 'treecolumn',
|
12628
|
text: 'Organization Structure',
|
12629
|
flex: 2,
|
12630
|
sortable: true,
|
12631
|
dataIndex: 'TextObject'
|
12632
|
}, {
|
12633
|
text: 'Object ID',
|
12634
|
flex: 1,
|
12635
|
sortable: true,
|
12636
|
dataIndex: 'ObjectId',
|
12637
|
}, {
|
12638
|
text: 'Object Class',
|
12639
|
flex: 1,
|
12640
|
sortable: true,
|
12641
|
dataIndex: 'ObjectType',
|
12642
|
}, {
|
12643
|
text: 'Object Abbr',
|
12644
|
flex: 1,
|
12645
|
sortable: true,
|
12646
|
dataIndex: 'TextObject',
|
12647
|
}, {
|
12648
|
text: 'Start Date',
|
12649
|
flex: 1,
|
12650
|
sortable: true,
|
12651
|
dataIndex: 'StartDate',
|
12652
|
}, {
|
12653
|
text: 'End Date',
|
12654
|
flex: 1,
|
12655
|
sortable: true,
|
12656
|
dataIndex: 'EndDate',
|
12657
|
}, {
|
12658
|
xtype: 'actioncolumn',
|
12659
|
text: 'Vacant Status',
|
12660
|
flex: 1,
|
12661
|
dataIndex: 'IsVacant',
|
12662
|
sortable: true,
|
12663
|
iconCls: 'fa-child',
|
12664
|
renderer: function (value, metadata, record) {
|
12665
|
if (record.data.ObjectType == "P") {
|
12666
|
var Vacant = record.data.IsVacant;
|
12667
|
if (!Vacant) {
|
12668
|
metadata.tdStyle = 'font-family: FontAwesome';
|
12669
|
}
|
12670
|
|
12671
|
}
|
12672
|
|
12673
|
},
|
12674
|
}
|
12675
|
]
|
12676
|
|
12677
|
}
|
12678
|
]
|
12679
|
}
|
12680
|
]
|
12681
|
}, {
|
12682
|
title: 'Search by Object',
|
12683
|
height: 400,
|
12684
|
autoScroll: true,
|
12685
|
items: [{
|
12686
|
xtype: 'form',
|
12687
|
name: 'filterbyObj',
|
12688
|
margin: '5 5 5 5',
|
12689
|
buttons: [{
|
12690
|
text: 'Search',
|
12691
|
name: 'SearchAssign',
|
12692
|
handler: function () {
|
12693
|
var storeGrid = Ext.StoreMgr.lookup("gridObj");
|
12694
|
var form = Ext.ComponentQuery.query('[name=filterbyObj]')[0].getForm();
|
12695
|
if (form.isValid()) {
|
12696
|
var values_ = form.getValues();
|
12697
|
storeGrid.proxy.url = '/ORM/SearchByObject?StartDate=' + values_.StartDate + "&EndDate=99991231" + "&ObjectID=" + values_.ObjectID + "&ObjectClass=" + values_.ObjectClass +
|
12698
|
"&ObjectClassTarget=" + values_.ObjectClassTarget + "&ObjectDescription=" + values_.ObjectDescription +
|
12699
|
"&Abbreviation=" + values_.Abbreviation + "&MenuID=" + MinovaUtil.GetMenuID() +
|
12700
|
"&TreeStructCode=" + values_.TreeStructCode;
|
12701
|
storeGrid.load({});
|
12702
|
storeGrid.loadPage(1);
|
12703
|
|
12704
|
}
|
12705
|
|
12706
|
}
|
12707
|
}
|
12708
|
],
|
12709
|
items: [{
|
12710
|
xtype: "datefield",
|
12711
|
fieldLabel: "Date",
|
12712
|
name: 'StartDate',
|
12713
|
submitFormat: 'Ymd',
|
12714
|
format: 'd/m/Y',
|
12715
|
value: new Date(),
|
12716
|
anchor: '50%',
|
12717
|
}, {
|
12718
|
xtype: "hidden",
|
12719
|
fieldLabel: "Date",
|
12720
|
name: 'ObjectClass',
|
12721
|
value: AllObjectClass[0],
|
12722
|
anchor: '50%',
|
12723
|
}, {
|
12724
|
xtype: "hidden",
|
12725
|
fieldLabel: "Date",
|
12726
|
name: 'EndDate',
|
12727
|
value: '99991231',
|
12728
|
anchor: '50%',
|
12729
|
}, {
|
12730
|
xtype: "combobox",
|
12731
|
fieldLabel: "Object Class",
|
12732
|
name: 'ObjectClassTarget',
|
12733
|
allowBlank: false,
|
12734
|
anchor: '50%',
|
12735
|
displayField: 'desc',
|
12736
|
valueField: 'code',
|
12737
|
store: Ext.create('Ext.data.Store', {
|
12738
|
storeId: 'storeYesNo',
|
12739
|
fields: ['code', 'desc'],
|
12740
|
data: [{
|
12741
|
"desc": AllObjectClass[0],
|
12742
|
"code": AllObjectClass[0]
|
12743
|
}, {
|
12744
|
"desc": AllObjectClass[2],
|
12745
|
"code": AllObjectClass[2]
|
12746
|
}
|
12747
|
]
|
12748
|
}),
|
12749
|
queryMode: 'local',
|
12750
|
}, {
|
12751
|
xtype: "textfield",
|
12752
|
fieldLabel: "Object ID",
|
12753
|
name: 'ObjectID',
|
12754
|
anchor: '50%',
|
12755
|
}, {
|
12756
|
xtype: "textfield",
|
12757
|
fieldLabel: "Object Description",
|
12758
|
name: 'ObjectDescription',
|
12759
|
anchor: '50%',
|
12760
|
}, {
|
12761
|
xtype: "textfield",
|
12762
|
fieldLabel: "Abbreviation",
|
12763
|
name: 'Abbreviation',
|
12764
|
anchor: '50%',
|
12765
|
}, {
|
12766
|
xtype: "hidden",
|
12767
|
fieldLabel: "MenuID",
|
12768
|
name: 'MenuID',
|
12769
|
anchor: '50%',
|
12770
|
value: MinovaUtil.GetMenuID()
|
12771
|
}, {
|
12772
|
xtype: "hidden",
|
12773
|
fieldLabel: "TreeStructCode",
|
12774
|
name: 'TreeStructCode',
|
12775
|
anchor: '50%',
|
12776
|
value: treeSructure_
|
12777
|
},
|
12778
|
],
|
12779
|
}, {
|
12780
|
xtype: "minovagrid1",
|
12781
|
tableName: 'PDSBS0008',
|
12782
|
name: "gridbyObject",
|
12783
|
param: '',
|
12784
|
autoLoad: false,
|
12785
|
pagesize: 5,
|
12786
|
storename: 'gridObj',
|
12787
|
isLookup: true,
|
12788
|
height: 250,
|
12789
|
targetField: targetField_,
|
12790
|
formname: formname_,
|
12791
|
bodyPadding: 0,
|
12792
|
listeners: {
|
12793
|
afterrender: function (me_) {
|
12794
|
if (treeSructure_ != 'O-O-P') {
|
12795
|
var countCol = me_.columns.length;
|
12796
|
me_.columns[countCol - 1].setHidden(true);
|
12797
|
|
12798
|
}
|
12799
|
},
|
12800
|
itemdblclick: function (this_, record, item, index, e, eOpts) {
|
12801
|
console.log(record.data);
|
12802
|
var cek = false;
|
12803
|
if (objClassValue_ == record.data.ObjectClass) {
|
12804
|
var form_ = Ext.ComponentQuery.query('[name=' + formname_ + ']')[0].getForm();
|
12805
|
if (form_.findField(targetField_).nameTable.substr(3, 2).toLowerCase() != "rc") {
|
12806
|
if (objClassValue_ == 'P') {
|
12807
|
// cek apakah posisis sudah di assign
|
12808
|
var hasil = null;
|
12809
|
Ext.Ajax.request({
|
12810
|
async: false,
|
12811
|
method: 'POST',
|
12812
|
url: '/UserControl/GetStore',
|
12813
|
params: {
|
12814
|
tableName: 'PHROM0002',
|
12815
|
param: 'ObjectClass[=]P,RelationshipDirectory[=]A,RelationshipClass[=]E,StartDate[GreaterThanEqual]' + StartDate_ + ',ObjectID[=]' + record.data.ObjectID
|
12816
|
},
|
12817
|
success: function (response) {
|
12818
|
var results = Ext.decode(response.responseText);
|
12819
|
//hasil = results.data[0].RelationshipObject;
|
12820
|
hasil = results.data.length;
|
12821
|
if (hasil == 0) {
|
12822
|
cek = true;
|
12823
|
}
|
12824
|
//count = hasil.length
|
12825
|
}
|
12826
|
});
|
12827
|
|
12828
|
} else {
|
12829
|
cek = true;
|
12830
|
}
|
12831
|
} else {
|
12832
|
cek = true;
|
12833
|
}
|
12834
|
}
|
12835
|
if (cek) {
|
12836
|
var form_ = Ext.ComponentQuery.query('[name=' + formname_ + ']')[0].getForm();
|
12837
|
//form_.findField(targetField_).setValue(record.data.ObjectID);
|
12838
|
//form_.findField(targetField_).valData = record.data.ObjectID + ' - ' + record.data.ObjectDescription;
|
12839
|
form_.findField(targetField_).setValue('-');
|
12840
|
form_.findField(targetField_).valData = '-';
|
12841
|
form_.findField(targetField_).setValue(record.data.ObjectID);
|
12842
|
form_.findField(targetField_).valData = record.data.ObjectID;
|
12843
|
form_.findField(targetField_).setRawValue(record.data.ObjectID + ' - ' + record.data.ObjectDescription);
|
12844
|
Ext.ComponentQuery.query('[name=' + targetField_ + 'lookUp' + ']')[0].destroy();
|
12845
|
} else {
|
12846
|
alert(MinovaMessageData('OM0001', ''))
|
12847
|
}
|
12848
|
},
|
12849
|
beforeclick: function () {
|
12850
|
return false;
|
12851
|
}
|
12852
|
|
12853
|
},
|
12854
|
dockedItems: [{
|
12855
|
xtype: 'pagingtoolbar',
|
12856
|
store: 'gridObj',
|
12857
|
dock: 'bottom',
|
12858
|
displayInfo: true
|
12859
|
}
|
12860
|
|
12861
|
]
|
12862
|
},
|
12863
|
]
|
12864
|
|
12865
|
}
|
12866
|
]
|
12867
|
|
12868
|
}
|
12869
|
]
|
12870
|
},
|
12871
|
]
|
12872
|
|
12873
|
});
|
12874
|
me.callParent(arguments);
|
12875
|
}
|
12876
|
});
|
12877
|
|
12878
|
Ext.define('MinovaUtil.MinovaES.MinovaLookupTree', {
|
12879
|
extend: 'Ext.form.field.Trigger',
|
12880
|
alias: ['widget.minovalookuptree', 'widget.MinovaLookupTree'],
|
12881
|
treeSructure: undefined, // object relationship
|
12882
|
objClassValue: undefined, // object yang akan di input ke field
|
12883
|
formname: undefined, // nama form
|
12884
|
targetField: undefined, // nama field yang akan diset value
|
12885
|
initComponent: function () {
|
12886
|
|
12887
|
this.callParent();
|
12888
|
},
|
12889
|
getValue: function () {
|
12890
|
var me = this;
|
12891
|
var hasil = '';
|
12892
|
if (this.valData) {
|
12893
|
hasil = this.valData.split('-')[0].replace(' ', '');
|
12894
|
|
12895
|
} else {
|
12896
|
if (me.rawValue != '' && me.rawValue != undefined) {
|
12897
|
hasil = me.rawValue.split('-')[0].replace(' ', '');
|
12898
|
}
|
12899
|
}
|
12900
|
|
12901
|
return hasil;
|
12902
|
},
|
12903
|
getSubmitValue: function () {
|
12904
|
var me = this;
|
12905
|
var hasil = '';
|
12906
|
if (this.valData) {
|
12907
|
hasil = this.valData.split('-')[0].replace(' ', '');
|
12908
|
} else {
|
12909
|
if (me.rawValue != '' && me.rawValue != undefined) {
|
12910
|
hasil = me.rawValue.split('-')[0].replace(' ', '');
|
12911
|
}
|
12912
|
}
|
12913
|
|
12914
|
return hasil;
|
12915
|
},
|
12916
|
onTriggerClick: function () {
|
12917
|
var _treeSructure = this.treeSructure;
|
12918
|
var _objClassValue = this.objClassValue;
|
12919
|
var _formname = this.formname;
|
12920
|
var _targetField = this.name;
|
12921
|
var _fieldLabel = this.fieldLabel;
|
12922
|
var _objFilter = this.objFilter;
|
12923
|
var Mainform = Ext.ComponentQuery.query('[name=' + _formname + ']')[0];
|
12924
|
var _StartDate = MinovaUtil.GetNowDate();
|
12925
|
if (Mainform) {
|
12926
|
if (Mainform.getForm().findField('StartDate')) {
|
12927
|
_StartDate = Mainform.getForm().findField('StartDate').getValue();
|
12928
|
}
|
12929
|
}
|
12930
|
//alert(treeSructure_ + ',' + objClassValue_ + ',' + formname_ + ',' + targetField_)
|
12931
|
if (_StartDate != "") {
|
12932
|
Ext.create('MinovaES.view.orm.lookup.minovalookuptreePopup', {
|
12933
|
name: _targetField + 'lookUp',
|
12934
|
treeSructure: _treeSructure, // object relationship
|
12935
|
objClassValue: _objClassValue, // object yang akan di input ke field
|
12936
|
formname: _formname, // nama form
|
12937
|
targetField: _targetField,
|
12938
|
objFilter: _objFilter,
|
12939
|
title: 'Lookup ' + _fieldLabel
|
12940
|
}).show()
|
12941
|
} else {
|
12942
|
MinovaMessage('', 'BS0001', 'Start Date', 'E')
|
12943
|
}
|
12944
|
|
12945
|
},
|
12946
|
});
|
12947
|
|
12948
|
Ext.define('MinovaUtil.MinovaES.LookupEmployee', {
|
12949
|
extend: 'Ext.window.Window',
|
12950
|
alias: 'widget.minovalookupemployee',
|
12951
|
requires: [],
|
12952
|
height: '87%',
|
12953
|
width: '41%',
|
12954
|
minWidth: '50%',
|
12955
|
maxWidth: '100%',
|
12956
|
bodyPadding: 0,
|
12957
|
formname: undefined,
|
12958
|
name: 'popup_lookupEMPID',
|
12959
|
test: undefined,
|
12960
|
vtype: 'validateMinovaXss',
|
12961
|
targetField: undefined,
|
12962
|
valueField: undefined,
|
12963
|
tableName: undefined,
|
12964
|
LookupFunction: undefined,
|
12965
|
isGrid: undefined,
|
12966
|
listeners: {
|
12967
|
afterrender: function (f) {
|
12968
|
f.setTitle('Lookup - ' + f.targetField);
|
12969
|
}
|
12970
|
},
|
12971
|
initComponent: function () {
|
12972
|
var me = this;
|
12973
|
var targetField_ = me.targetField;
|
12974
|
var valueField_ = me.valueField;
|
12975
|
var form = me.test;
|
12976
|
var tableName_ = me.tableName;
|
12977
|
var isGrid = me.isGrid_;
|
12978
|
var LookupFunction = me.LookupFunction;
|
12979
|
param_ = null;
|
12980
|
|
12981
|
var filterParam_ = me.filterParam;
|
12982
|
if (tableName_ == "PDSRC0002") {
|
12983
|
fieldLabel_ = 'App ID/ External ID/ Full Name';
|
12984
|
} else {
|
12985
|
fieldLabel_ = 'Emp ID/ External ID/ Full Name';
|
12986
|
}
|
12987
|
Ext.applyIf(me, {
|
12988
|
items: [{
|
12989
|
items: [{
|
12990
|
xtype: 'tabpanel',
|
12991
|
items: [{
|
12992
|
xtype: 'form',
|
12993
|
title: 'Quick Search',
|
12994
|
height: '70%',
|
12995
|
items: [{
|
12996
|
xtype: 'form',
|
12997
|
name: 'frmSearch',
|
12998
|
width: '100%',
|
12999
|
height: 'auto',
|
13000
|
dockedItems: [{
|
13001
|
xtype: 'toolbar',
|
13002
|
dock: 'top',
|
13003
|
layout: 'vbox',
|
13004
|
bodyPadding: 10,
|
13005
|
border: 0,
|
13006
|
items: [{
|
13007
|
xtype: 'fieldset',
|
13008
|
layout: 'hbox',
|
13009
|
width: '100%',
|
13010
|
border: 0,
|
13011
|
padding: 0,
|
13012
|
items: [{
|
13013
|
xtype: 'textfield',
|
13014
|
name: 'EmployeeSearch',
|
13015
|
fieldLabel: fieldLabel_,
|
13016
|
width: 470,
|
13017
|
labelWidth: 185,
|
13018
|
enableKeyEvents: true,
|
13019
|
filterParam: filterParam_,
|
13020
|
listeners: {
|
13021
|
specialkey: function (f, e) {
|
13022
|
if (e.getKey() == e.ENTER) {
|
13023
|
var emp = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
|
13024
|
var emp_ = emp.getValue();
|
13025
|
var store = Ext.data.StoreManager.lookup('storeQC');
|
13026
|
var grid = Ext.ComponentQuery.query('[name=EmployeeID]')[0];
|
13027
|
if (tableName_ == 'PDSRC0002') {
|
13028
|
param_ = 'AppIDExternalIDFullName[like]' + emp_
|
13029
|
} else {
|
13030
|
param_ = 'EmpIDExternalIDFullName[like]' + emp_
|
13031
|
}
|
13032
|
if (this.filterParam) {
|
13033
|
param_ = param_ + ',' + this.filterParam_
|
13034
|
}
|
13035
|
|
13036
|
store.proxy.extraParams = {
|
13037
|
tableName: tableName_,
|
13038
|
param: param_,
|
13039
|
menuId: MinovaUtil.GetMenuID()
|
13040
|
};
|
13041
|
store.removeAll();
|
13042
|
store.reload();
|
13043
|
store.loadPage(1);
|
13044
|
}
|
13045
|
}
|
13046
|
}
|
13047
|
}, {
|
13048
|
xtype: 'tbspacer',
|
13049
|
width: 5
|
13050
|
}, {
|
13051
|
xtype: 'button',
|
13052
|
name: 'Search',
|
13053
|
text: 'Search',
|
13054
|
filterParam: filterParam_,
|
13055
|
handler: function () {
|
13056
|
var emp = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
|
13057
|
var emp_ = emp.getValue();
|
13058
|
var store = Ext.data.StoreManager.lookup('storeQC');
|
13059
|
var grid = Ext.ComponentQuery.query('[name=EmployeeID]')[0];
|
13060
|
|
13061
|
if (tableName_ == 'PDSRC0002') {
|
13062
|
param_ = 'AppIDExternalIDFullName[like]' + emp_
|
13063
|
} else {
|
13064
|
param_ = 'EmpIDExternalIDFullName[like]' + emp_
|
13065
|
}
|
13066
|
if (this.filterParam) {
|
13067
|
param_ = param_ + ',' + this.filterParam
|
13068
|
}
|
13069
|
store.proxy.extraParams = {
|
13070
|
tableName: tableName_,
|
13071
|
param: param_,
|
13072
|
menuId: MinovaUtil.GetMenuID()
|
13073
|
};
|
13074
|
store.removeAll();
|
13075
|
store.reload();
|
13076
|
store.loadPage(1);
|
13077
|
}
|
13078
|
}
|
13079
|
]
|
13080
|
}
|
13081
|
]
|
13082
|
}
|
13083
|
]
|
13084
|
}, {
|
13085
|
items: [{
|
13086
|
xtype: "minovagrid1",
|
13087
|
name: "GridEmployeeID",
|
13088
|
storename: 'storeQC',
|
13089
|
tableName: tableName_,
|
13090
|
param: '',
|
13091
|
isLookup: true,
|
13092
|
pagesize: 25,
|
13093
|
height: 398,
|
13094
|
LookupFunction: LookupFunction,
|
13095
|
valueField: valueField_,
|
13096
|
targetField: targetField_,
|
13097
|
isGrid: true,
|
13098
|
listeners: {
|
13099
|
beforeedit: function () {
|
13100
|
return false;
|
13101
|
},
|
13102
|
itemdblclick: function () {
|
13103
|
var grid = Ext.ComponentQuery.query('[name=GridEmployeeID]')[0];
|
13104
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
13105
|
var Emp_ = selection.data.EmployeeID;
|
13106
|
LookupFunction = this.LookupFunction;
|
13107
|
eval(LookupFunction);
|
13108
|
var target = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField;
|
13109
|
var c = Ext.ComponentQuery.query('[name=' + target + ']')[0]; console.log(tableName_);
|
13110
|
Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(Emp_);
|
13111
|
if(Ext.ComponentQuery.query('[name=FORMPMDAST0002]')[0] != undefined) // add by Tri nwh 20230612 start
|
13112
|
{ console.log('nwh');
|
13113
|
var a = Ext.ComponentQuery.query('[name=FORMPMDAST0002]')[0].getForm()
|
13114
|
var b = a.findField(target);
|
13115
|
b.setValue(Emp_);
|
13116
|
} // add by Tri nwh 20230612 end
|
13117
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].hide();
|
13118
|
}
|
13119
|
},
|
13120
|
}, {
|
13121
|
xtype: 'pagingtoolbar',
|
13122
|
store: 'storeQC',
|
13123
|
dock: 'bottom',
|
13124
|
displayInfo: true
|
13125
|
}
|
13126
|
]
|
13127
|
}
|
13128
|
]
|
13129
|
}, {
|
13130
|
title: 'Advance Search',
|
13131
|
items: [{
|
13132
|
xtype: 'form',
|
13133
|
name: 'formlookup',
|
13134
|
items: [{
|
13135
|
xtype: 'minovaform',
|
13136
|
name: 'frmlookup',
|
13137
|
tableName: tableName_,
|
13138
|
param: filterParam_,
|
13139
|
isLookup: true,
|
13140
|
listeners: {
|
13141
|
onStockFormKeyPress: function (textfield, event, options) {
|
13142
|
if (event.getKey() == event.ENTER) {
|
13143
|
alert("test");
|
13144
|
}
|
13145
|
}
|
13146
|
},
|
13147
|
buttons: [{
|
13148
|
text: 'Search',
|
13149
|
filterParam: filterParam_,
|
13150
|
listeners: {
|
13151
|
click: function () {
|
13152
|
var store = Ext.data.StoreManager.lookup('storeadvance');
|
13153
|
var form = Ext.ComponentQuery.query('[name=formlookup]')[0].getForm();
|
13154
|
grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
|
13155
|
var values_ = form.getValues();
|
13156
|
var fields_ = form.getFields().items;
|
13157
|
var param_ = '';
|
13158
|
for (var i = 0; i < fields_.length; i++) {
|
13159
|
var val_ = form.getFields().items[i].getValue();
|
13160
|
var xtype_ = form.getFields().items[i].xtype;
|
13161
|
var oprator_ = '[like]';
|
13162
|
if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
13163
|
oprator_ = '[Equal]';
|
13164
|
}
|
13165
|
if (xtype_ == 'datefield') {
|
13166
|
if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
13167
|
oprator_ = '[LessThanEqual]';
|
13168
|
} else {
|
13169
|
oprator_ = '[GreaterThanEqual]';
|
13170
|
}
|
13171
|
}
|
13172
|
if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
13173
|
param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
13174
|
}
|
13175
|
}
|
13176
|
if (this.filterParam_) {
|
13177
|
param_ = param_ + ',' + this.filterParam_
|
13178
|
}
|
13179
|
store.proxy.extraParams = {
|
13180
|
tableName: grid.tableName,
|
13181
|
param: param_,
|
13182
|
menuId: MinovaUtil.GetMenuID()
|
13183
|
};
|
13184
|
store.removeAll();
|
13185
|
store.reload();
|
13186
|
store.loadPage(1);
|
13187
|
},
|
13188
|
|
13189
|
}
|
13190
|
}
|
13191
|
]
|
13192
|
}, {
|
13193
|
xtype: 'minovagrid1', // update by hamid 20170208
|
13194
|
name: 'gridlookup',
|
13195
|
minHeight: 312,
|
13196
|
height: 290,
|
13197
|
tableName: tableName_, //'PDSEMP0001',
|
13198
|
param: '',
|
13199
|
isLookup: true,
|
13200
|
storename: 'storeadvance',
|
13201
|
pagesize: 25,
|
13202
|
valueField: valueField_,
|
13203
|
targetField: targetField_,
|
13204
|
hidebutton: 0, // update by hamid 20170208
|
13205
|
isGrid: true,
|
13206
|
listeners: {
|
13207
|
beforeedit: function () {
|
13208
|
return false;
|
13209
|
},
|
13210
|
itemdblclick: function () {
|
13211
|
var grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
|
13212
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
13213
|
var Emp_ = selection.data.EmployeeID;
|
13214
|
LookupFunction = this.LookupFunction;
|
13215
|
eval(LookupFunction);
|
13216
|
var target = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField;
|
13217
|
Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(Emp_);
|
13218
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].hide();
|
13219
|
}
|
13220
|
},
|
13221
|
dockedItems: [{
|
13222
|
xtype: 'pagingtoolbar',
|
13223
|
store: 'storeadvance',
|
13224
|
dock: 'bottom',
|
13225
|
displayInfo: true
|
13226
|
}
|
13227
|
]
|
13228
|
}
|
13229
|
]
|
13230
|
|
13231
|
}
|
13232
|
]
|
13233
|
|
13234
|
}
|
13235
|
]
|
13236
|
|
13237
|
}
|
13238
|
]
|
13239
|
}
|
13240
|
]
|
13241
|
});
|
13242
|
me.callParent(arguments);
|
13243
|
}
|
13244
|
});
|
13245
|
|
13246
|
Ext.define('MinovaUtil.MinovaES.MinovaLookupEmployee', {
|
13247
|
extend: 'Ext.form.field.Trigger',
|
13248
|
alias: 'widget.lookupemployee',
|
13249
|
|
13250
|
formname: undefined,
|
13251
|
fieldname: undefined,
|
13252
|
allowBlank: undefined,
|
13253
|
width: undefined,
|
13254
|
tableName: undefined,
|
13255
|
LookupFunction: undefined,
|
13256
|
targetField: undefined,
|
13257
|
vtype: 'validateMinovaXss',
|
13258
|
fieldValue: undefined,
|
13259
|
initComponent: function () {
|
13260
|
|
13261
|
this.callParent();
|
13262
|
},
|
13263
|
onTriggerClick: function () {
|
13264
|
var nameField_ = this.fieldname;
|
13265
|
var blank = this.allowBlank;
|
13266
|
var width_ = this.width;
|
13267
|
var tableName_ = this.tableName;
|
13268
|
var panelform = "form" + this.name;
|
13269
|
//add filer by atin
|
13270
|
var filterParam_ = this.filterParam;
|
13271
|
// and add by atin
|
13272
|
var _targetField = this.name;
|
13273
|
if (this.targetField) {
|
13274
|
_targetField = targetField
|
13275
|
}
|
13276
|
var fieldValue_ = this.fieldValue;
|
13277
|
var _fieldLabel = this.fieldLabel;
|
13278
|
|
13279
|
//var tableName_ = this.tableName;
|
13280
|
var count_lookup = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
|
13281
|
var lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0];
|
13282
|
var EmployeeID = Ext.ComponentQuery.query('[name=' + _targetField + ']')[0];
|
13283
|
var EmployeeID_ = EmployeeID.getValue();
|
13284
|
var LookupFunction = this.LookupFunction;
|
13285
|
var popup_lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
|
13286
|
if (count_lookup == 1) {
|
13287
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField = this.name;
|
13288
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].show();
|
13289
|
} else {
|
13290
|
Ext.create('MinovaUtil.MinovaES.LookupEmployee', {
|
13291
|
tableName: tableName_,
|
13292
|
targetField: this.name,
|
13293
|
fieldValue: fieldValue_,
|
13294
|
LookupFunction: LookupFunction,
|
13295
|
filterParam: filterParam_,
|
13296
|
}).show()
|
13297
|
}
|
13298
|
var text = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
|
13299
|
text.setValue(EmployeeID_);
|
13300
|
var store = Ext.data.StoreManager.lookup('storeQC');
|
13301
|
if (EmployeeID_ !== "") {
|
13302
|
|
13303
|
var grid = Ext.ComponentQuery.query('[name=' + _targetField + ']')[0];
|
13304
|
if (tableName_ == 'PDSEMP0002') {
|
13305
|
param_ = 'EmpIDExternalIDFullName[like]' + EmployeeID_
|
13306
|
} else {
|
13307
|
param_ = 'AppIDExternalIDFullName[like]' + EmployeeID_
|
13308
|
}
|
13309
|
if (filterParam_) {
|
13310
|
param_ = param_ + ',' + filterParam_;
|
13311
|
}
|
13312
|
store.proxy.extraParams = {
|
13313
|
tableName: tableName_, //'PDSEMP0002',
|
13314
|
param: param_,
|
13315
|
menuId: MinovaUtil.GetMenuID()
|
13316
|
};
|
13317
|
store.reload();
|
13318
|
} else {
|
13319
|
store.proxy.extraParams = {
|
13320
|
tableName: tableName_, //'PDSEMP0002',
|
13321
|
param: filterParam_,
|
13322
|
menuId: MinovaUtil.GetMenuID()
|
13323
|
};
|
13324
|
store.reload();
|
13325
|
}
|
13326
|
|
13327
|
},
|
13328
|
listeners: {
|
13329
|
specialkey: function (f, e) {
|
13330
|
if (e.getKey() == e.ENTER) {
|
13331
|
//alert("about to submit");
|
13332
|
var nameField_ = this.fieldname;
|
13333
|
var blank = this.allowBlank;
|
13334
|
var width_ = this.width;
|
13335
|
var tableName_ = this.tableName;
|
13336
|
var panelform = "form" + this.name;
|
13337
|
//add filer by atin
|
13338
|
var filterParam = this.filterParam;
|
13339
|
// and add by atin
|
13340
|
var _targetField = this.name;
|
13341
|
var _fieldLabel = this.fieldLabel;
|
13342
|
var count_lookup = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
|
13343
|
var lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0];
|
13344
|
var EmployeeID = Ext.ComponentQuery.query('[name=' + _targetField + ']')[0];
|
13345
|
var EmployeeID_ = EmployeeID.getValue();
|
13346
|
|
13347
|
var popup_lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
|
13348
|
if (count_lookup == 1) {
|
13349
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField = this.name;
|
13350
|
Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].show();
|
13351
|
} else {
|
13352
|
Ext.create('MinovaUtil.MinovaES.LookupEmployee', {
|
13353
|
tableName: tableName_,
|
13354
|
targetField: this.name,
|
13355
|
fieldValue: this.fieldValue,
|
13356
|
LookupFunction: this.LookupFunction,
|
13357
|
filterParam: filterParam,
|
13358
|
}).show()
|
13359
|
}
|
13360
|
var text = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
|
13361
|
text.setValue(EmployeeID_);
|
13362
|
|
13363
|
if (EmployeeID_ !== "") {
|
13364
|
var store = Ext.data.StoreManager.lookup('storeQC');
|
13365
|
var grid = Ext.ComponentQuery.query('[name=' + _targetField + ']')[0];
|
13366
|
if (tableName_ == 'PDSEMP0002') {
|
13367
|
param_ = 'EmpIDExternalIDFullName[like]' + EmployeeID_
|
13368
|
} else {
|
13369
|
param_ = 'AppIDExternalIDFullName[like]' + EmployeeID_
|
13370
|
}
|
13371
|
if (filterParam_) {
|
13372
|
param_ = param_ + ',' + filterParam_;
|
13373
|
}
|
13374
|
store.proxy.extraParams = {
|
13375
|
tableName: tableName_, //'PDSEMP0002',
|
13376
|
param: param_,
|
13377
|
menuId: MinovaUtil.GetMenuID()
|
13378
|
};
|
13379
|
store.reload();
|
13380
|
}
|
13381
|
}
|
13382
|
}
|
13383
|
}
|
13384
|
|
13385
|
});
|
13386
|
Ext.define('MinovaUtil.MinovaES.UploadFile', {
|
13387
|
extend: 'Ext.form.field.Trigger',
|
13388
|
alias: 'widget.uploadfile',
|
13389
|
|
13390
|
//fieldLabel: undefined,
|
13391
|
uploadName: 'uploadName',
|
13392
|
formname: undefined,
|
13393
|
fieldname: undefined,
|
13394
|
allowBlank: undefined,
|
13395
|
width: undefined,
|
13396
|
tableName: undefined,
|
13397
|
initComponent: function () {
|
13398
|
|
13399
|
this.callParent();
|
13400
|
},
|
13401
|
onTriggerClick: function () {
|
13402
|
var nameField_ = this.fieldname;
|
13403
|
var blank = this.allowBlank;
|
13404
|
var width_ = this.width;
|
13405
|
var tableName_ = this.tableName;
|
13406
|
var panelform = "form" + this.name;
|
13407
|
var val_ = this.value;
|
13408
|
var _targetField = this.name;
|
13409
|
var _fieldLabel = this.fieldLabel;
|
13410
|
|
13411
|
//var tableName_ = this.tableName;
|
13412
|
var count_lookup = Ext.ComponentQuery.query('[name=FormFileUpload]').length;
|
13413
|
var lookupEMPID = Ext.ComponentQuery.query('[name=FormFileUpload]')[0];
|
13414
|
var EmployeeID = Ext.ComponentQuery.query('[name=' + _targetField + ']')[0];
|
13415
|
var EmployeeID_ = EmployeeID.getValue();
|
13416
|
|
13417
|
var FormFileUpload = Ext.ComponentQuery.query('[name=FormFileUpload]').length;
|
13418
|
Ext.create('MinovaES.view.uploadfile.fileupload', {
|
13419
|
tableName: tableName_,
|
13420
|
targetField: this.name,
|
13421
|
valueFile: val_,
|
13422
|
titleLookup: _fieldLabel,
|
13423
|
}).show()
|
13424
|
|
13425
|
}
|
13426
|
|
13427
|
});
|
13428
|
|
13429
|
//atien
|
13430
|
Ext.define('MinovaES.view.uploadfile.fileupload', {
|
13431
|
extend: 'Ext.window.Window',
|
13432
|
alias: 'widget.fileupload',
|
13433
|
requires: [
|
13434
|
|
13435
|
],
|
13436
|
//height: '67%',
|
13437
|
width: '35%',
|
13438
|
minWidth: '50%',
|
13439
|
maxWidth: '100%',
|
13440
|
bodyPadding: 0,
|
13441
|
formname: undefined,
|
13442
|
fieldname: undefined,
|
13443
|
modal: true,
|
13444
|
title: 'Upload ',
|
13445
|
name: 'FormLookup',
|
13446
|
test: undefined,
|
13447
|
targetField: undefined,
|
13448
|
tableName: undefined,
|
13449
|
listeners: {
|
13450
|
afterrender: function (f) {
|
13451
|
f.setTitle('Upload ' + f.titleLookup);
|
13452
|
var id_ = Ext.ComponentQuery.query('minovanumberfield[name=FileID]')[0];
|
13453
|
if (id_) {
|
13454
|
var valID = id_.getValue();
|
13455
|
Ext.ComponentQuery.query('textfield[name=FileID_]')[0].setValue(valID);
|
13456
|
}
|
13457
|
},
|
13458
|
},
|
13459
|
initComponent: function () {
|
13460
|
var me = this;
|
13461
|
var targetField_ = me.targetField;
|
13462
|
var titleLookup_ = me.titleLookup;
|
13463
|
var maxFileSize = me.maxFileSize;
|
13464
|
var fileName = me.valueFile;
|
13465
|
Ext.applyIf(me, {
|
13466
|
items: [{
|
13467
|
xtype: 'form',
|
13468
|
name: 'FormFileUpload',
|
13469
|
valueFile: fileName,
|
13470
|
buttons: [{
|
13471
|
xtype: 'button',
|
13472
|
iconCls: 'fa-upload',
|
13473
|
style: 'font-family: FontAwesome',
|
13474
|
text: 'Upload',
|
13475
|
action: 'Upload',
|
13476
|
name: 'Upload',
|
13477
|
handler: function () {
|
13478
|
maxFileSize = Ext.ComponentQuery.query('uploadfile[name=' + targetField_ + ']')[0].maxFileSize;
|
13479
|
Ext.ComponentQuery.query('[name=FileMax]')[0].setValue(maxFileSize);
|
13480
|
var form = Ext.ComponentQuery.query('form[name=FormFileUpload]')[0].getForm();
|
13481
|
pnl = Ext.ComponentQuery.query('[name=FormLookup]')[0]; // by hamid 20170206
|
13482
|
if (form.isValid()) {
|
13483
|
form.submit({
|
13484
|
url: '/Devt/UploadFile',
|
13485
|
waitMsg: 'Uploading your file...',
|
13486
|
success: function (fp, o) {
|
13487
|
var result = o.result;
|
13488
|
Ext.ComponentQuery.query('uploadfile[name=' + targetField_ + ']')[0].setValue(result.FileName);
|
13489
|
Ext.ComponentQuery.query('[name=FormFileUpload]')[0].valueFile = result.FileName;
|
13490
|
Ext.ComponentQuery.query('[name=download]')[0].fileName = result.FileName;
|
13491
|
var fileID = Ext.ComponentQuery.query('minovanumberfield[name=FileID]')[0]
|
13492
|
if (fileID) {
|
13493
|
fileID.setValue(result.ID);
|
13494
|
}
|
13495
|
|
13496
|
if (result.msg === "") {
|
13497
|
if (me.onSuccess !== undefined)
|
13498
|
me.onSuccess(result.FileName, result.content_type);
|
13499
|
pnl.destroy(); // by hamid 20170206
|
13500
|
} else
|
13501
|
alert(result.msg);
|
13502
|
|
13503
|
//by Agung 20200428
|
13504
|
Ext.ComponentQuery.query('[name=FORMPHRUPLOADFILE]')[0].getForm().findField('FileID').setValue(result.ID);
|
13505
|
Ext.ComponentQuery.query('[name=FORMPHRUPLOADFILE]')[0].getForm().findField('FileName').setValue(result.FileName);
|
13506
|
}
|
13507
|
});
|
13508
|
}
|
13509
|
}
|
13510
|
}, {
|
13511
|
xtype: 'button',
|
13512
|
text: 'Clear',
|
13513
|
width: 60,
|
13514
|
handler: function () {
|
13515
|
//Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0].setValue('');
|
13516
|
Ext.ComponentQuery.query('[name=' + targetField_ + ']')[0].setValue(''); // by hamid 20170206
|
13517
|
}
|
13518
|
}, {
|
13519
|
xtype: 'button',
|
13520
|
text: 'Download',
|
13521
|
name: 'download',
|
13522
|
width: 60,
|
13523
|
fileName: fileName,
|
13524
|
handler: function (f) {
|
13525
|
var url = '/Devt/GetFileData?FileName=' + f.fileName + '&download=true';
|
13526
|
window.open(url, '_blank');
|
13527
|
}
|
13528
|
//href: '/Devt/GetFileData?FileName=' + me.valueFile + '&download=true',
|
13529
|
|
13530
|
}
|
13531
|
],
|
13532
|
items: [{
|
13533
|
xtype: 'filefield',
|
13534
|
name: 'File',
|
13535
|
fieldLabel: 'Select File',
|
13536
|
//allowBlank: false,
|
13537
|
//width: 270,
|
13538
|
//labelWidth: 85,
|
13539
|
}, {
|
13540
|
xtype: 'textfield',
|
13541
|
name: 'FileID_',
|
13542
|
hidden: true,
|
13543
|
}, {
|
13544
|
xtype: 'textfield',
|
13545
|
name: 'FileMax',
|
13546
|
hidden: true,
|
13547
|
}
|
13548
|
]
|
13549
|
}
|
13550
|
]
|
13551
|
});
|
13552
|
me.callParent(arguments);
|
13553
|
}
|
13554
|
});
|
13555
|
//atien
|
13556
|
|
13557
|
|
13558
|
//update by hamid 12012017
|
13559
|
Ext.define('MinovaES.view.uploadfile.fileupload1', {
|
13560
|
extend: 'Ext.window.Window',
|
13561
|
alias: 'widget.fileupload1',
|
13562
|
requires: [
|
13563
|
|
13564
|
],
|
13565
|
height: '67%',
|
13566
|
width: '21%',
|
13567
|
minWidth: '50%',
|
13568
|
maxWidth: '100%',
|
13569
|
bodyPadding: 0,
|
13570
|
formname: undefined,
|
13571
|
fieldname: undefined,
|
13572
|
//modal: true,
|
13573
|
title: 'Lookup - Photo',
|
13574
|
name: 'FormLookup',
|
13575
|
test: undefined,
|
13576
|
targetField: undefined,
|
13577
|
tableName: undefined,
|
13578
|
initComponent: function () {
|
13579
|
var me = this;
|
13580
|
var targetField_ = me.targetField;
|
13581
|
var nameField_ = this.fieldname;
|
13582
|
var form = me.test;
|
13583
|
var tableName_ = me.tableName;
|
13584
|
//var img_ = Ext.ComponentQuery.query('[name=Photo]')[0].getValue()
|
13585
|
var img_ = Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0];
|
13586
|
Ext.applyIf(me, {
|
13587
|
// items: [{
|
13588
|
//xtype : 'panel',
|
13589
|
items: [{
|
13590
|
xtype: 'tabpanel',
|
13591
|
//name: 'mainTab',
|
13592
|
items: [{
|
13593
|
xtype: 'form',
|
13594
|
title: 'Upload File',
|
13595
|
height: '70%',
|
13596
|
name: 'FormFileUpload',
|
13597
|
buttons: [{
|
13598
|
xtype: 'button',
|
13599
|
iconCls: 'fa-upload',
|
13600
|
style: 'font-family: FontAwesome',
|
13601
|
text: 'Upload',
|
13602
|
action: 'Upload',
|
13603
|
name: 'Upload',
|
13604
|
handler: function () {
|
13605
|
//var Tab = Ext.ComponentQuery.query('[name=mainTab]')[0].getActiveTab();
|
13606
|
var form = Ext.ComponentQuery.query('form[name=FormFileUpload]')[0].getForm();
|
13607
|
pnl = Ext.ComponentQuery.query('[name=FormLookup]')[0];
|
13608
|
if (form.isValid()) {
|
13609
|
form.submit({
|
13610
|
url: '/Devt/UploadFile',
|
13611
|
waitMsg: 'Uploading your file...',
|
13612
|
success: function (fp, o) {
|
13613
|
var result = o.result;
|
13614
|
Ext.ComponentQuery.query('[name=' + targetField_ + ']')[0].setValue(result.FileName)
|
13615
|
//Ext.ComponentQuery.query('[name=Photo]')[0].setValue(result.FileName)
|
13616
|
if (result.msg === "") {
|
13617
|
//alert('success');
|
13618
|
if (me.onSuccess !== undefined)
|
13619
|
me.onSuccess(result.FileName, result.content_type);
|
13620
|
pnl.destroy();
|
13621
|
} else
|
13622
|
alert(result.msg);
|
13623
|
}
|
13624
|
});
|
13625
|
}
|
13626
|
}
|
13627
|
}, {
|
13628
|
xtype: 'button',
|
13629
|
text: 'Clear',
|
13630
|
width: 60,
|
13631
|
handler: function () {
|
13632
|
Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0].setValue('');
|
13633
|
//Ext.ComponentQuery.query('[name=Photo]')[0].setValue('');
|
13634
|
|
13635
|
}
|
13636
|
}
|
13637
|
],
|
13638
|
items: [{
|
13639
|
xtype: 'fieldset',
|
13640
|
layout: 'hbox',
|
13641
|
width: '100%',
|
13642
|
bodyPadding: 10,
|
13643
|
border: 0,
|
13644
|
padding: 0,
|
13645
|
items: [{
|
13646
|
xtype: 'filefield',
|
13647
|
name: 'File',
|
13648
|
fieldLabel: 'Select File',
|
13649
|
//allowBlank: false,
|
13650
|
width: 270,
|
13651
|
labelWidth: 85,
|
13652
|
}
|
13653
|
]
|
13654
|
}
|
13655
|
]
|
13656
|
//items: [{
|
13657
|
// xtype: 'form',
|
13658
|
// name: 'Photo',
|
13659
|
// width: '100%',
|
13660
|
// height: 'auto',
|
13661
|
// dockedItems: [{
|
13662
|
// xtype: 'toolbar',
|
13663
|
// dock: 'top',
|
13664
|
// layout: 'vbox',
|
13665
|
// bodyPadding: 10,
|
13666
|
// border: 0,
|
13667
|
// items: [{
|
13668
|
// xtype: 'fieldset',
|
13669
|
// layout: 'hbox',
|
13670
|
// width: '100%',
|
13671
|
// border: 0,
|
13672
|
// padding: 0,
|
13673
|
// items: [{
|
13674
|
// xtype: 'filefield',
|
13675
|
// name: 'SelectFile',
|
13676
|
// fieldLabel: 'Select File',
|
13677
|
// width: 270,
|
13678
|
// labelWidth: 85,
|
13679
|
// enableKeyEvents: true,
|
13680
|
// buttonText: 'Browse',
|
13681
|
// }]
|
13682
|
|
13683
|
// }
|
13684
|
// ]
|
13685
|
// }
|
13686
|
// ]
|
13687
|
//}]
|
13688
|
}, {
|
13689
|
title: 'View Image',
|
13690
|
//height: 400,
|
13691
|
//autoScroll: true,
|
13692
|
items: [{
|
13693
|
xtype: 'form',
|
13694
|
name: 'ViewImage',
|
13695
|
//margin: '5 5 5 5',
|
13696
|
items: [{
|
13697
|
xtype: 'form',
|
13698
|
buttons: [{
|
13699
|
text: 'Download',
|
13700
|
handler: function () {},
|
13701
|
href: '/Devt/GetFileData?FileName=' + img_ + '&download=true'
|
13702
|
|
13703
|
}
|
13704
|
],
|
13705
|
items: [{
|
13706
|
xtype: 'image',
|
13707
|
//id: 'imageuser',
|
13708
|
src: '/Devt/GetFileData?FileName=' + img_ + '&download=false'
|
13709
|
},
|
13710
|
]
|
13711
|
}
|
13712
|
]
|
13713
|
|
13714
|
}
|
13715
|
]
|
13716
|
|
13717
|
}
|
13718
|
]
|
13719
|
|
13720
|
}
|
13721
|
]
|
13722
|
|
13723
|
});
|
13724
|
me.callParent(arguments);
|
13725
|
}
|
13726
|
});
|
13727
|
|
13728
|
Ext.define('MinovaUtil.MinovaES.Column.MinovaPictureColumn', {
|
13729
|
extend: 'Ext.grid.column.Column',
|
13730
|
alias: ['widget.minovapicturecolumn'],
|
13731
|
alternateClassName: 'Ext.grid.MinovaPictureColumn',
|
13732
|
//undefinedText: ' ',
|
13733
|
defaultRenderer: function (value) {
|
13734
|
return '<img alt="" class="icon-imagecolumn" src = "/Devt/GetFileData?FileName=' + value + '&download=false" id="">'
|
13735
|
}
|
13736
|
});
|
13737
|
|
13738
|
Ext.define('MinovaUtil.MinovaES.MinovaFixValue', {
|
13739
|
extend: 'Ext.form.field.ComboBox',
|
13740
|
alias: ['widget.MinovaFixValue', 'widget.minovafixvalue'],
|
13741
|
fixedValue: undefined,
|
13742
|
anchor: '50%',
|
13743
|
queryMode: 'local',
|
13744
|
forceSelection: true, // cek data
|
13745
|
getValue: function () {
|
13746
|
var value = this.value;
|
13747
|
|
13748
|
return value;
|
13749
|
},
|
13750
|
getSubmitValue: function () {
|
13751
|
var value = this.value;
|
13752
|
|
13753
|
return value;
|
13754
|
},
|
13755
|
initComponent: function () {
|
13756
|
var me = this;
|
13757
|
var storeData = [];
|
13758
|
//var str= "y=yes|| n=no";
|
13759
|
var str = me.fixedValue;
|
13760
|
var hasil = str.split('||');
|
13761
|
hasil.forEach(function (h) {
|
13762
|
store_ = h.split('=')
|
13763
|
storeData.push({
|
13764
|
code: store_[0],
|
13765
|
desc: store_[1],
|
13766
|
|
13767
|
});
|
13768
|
});
|
13769
|
Ext.applyIf(me, {
|
13770
|
|
13771
|
store: Ext.create('Ext.data.Store', {
|
13772
|
storeId: 'store' + name,
|
13773
|
autoLoad: true,
|
13774
|
data: storeData
|
13775
|
|
13776
|
}),
|
13777
|
});
|
13778
|
me.callParent(arguments);
|
13779
|
}
|
13780
|
});
|
13781
|
|
13782
|
Ext.define('MinovaUtil.MinovaES.MinovaDecimal', {
|
13783
|
extend: 'Ext.form.field.Text',
|
13784
|
alias: ['widget.MinovaDecimal', 'widget.minovadecimal'],
|
13785
|
fixedValue: undefined,
|
13786
|
anchor: '50%',
|
13787
|
getValue: function () {
|
13788
|
var value = this.value;
|
13789
|
|
13790
|
return value.replace(',', '.');
|
13791
|
},
|
13792
|
getSubmitValue: function () {
|
13793
|
var value = this.value;
|
13794
|
return value.replace(',', '.');
|
13795
|
},
|
13796
|
initComponent: function () {
|
13797
|
var me = this;
|
13798
|
Ext.applyIf(me, {});
|
13799
|
me.callParent(arguments);
|
13800
|
}
|
13801
|
});
|
13802
|
|
13803
|
Ext.define('MinovaUtil.com.xtype.MinovaWorflowEditor', {
|
13804
|
extend: 'Ext.panel.Panel',
|
13805
|
alias: ['widget.minovawfeditor', 'widget.minovafloweditor'],
|
13806
|
title: undefined,
|
13807
|
initComponent: function () {
|
13808
|
// this.layout = 'fit';
|
13809
|
this.readOnly = this.readOnly ? this.readOnly : false;
|
13810
|
this.autoScroll = true;
|
13811
|
this.height = 480;
|
13812
|
this.title = this.title ? this.title : 'Workflow editor';
|
13813
|
this.html = '<div id="minovaGraphContainer" title="' + this.title
|
13814
|
+ '" style="background:url(\'' + mxBasePath
|
13815
|
+ '/editors/images/grid.gif\')"></div>';
|
13816
|
this.tbar = [{
|
13817
|
xtype: 'button',
|
13818
|
hidden: true,
|
13819
|
text: 'add Task',
|
13820
|
handler: this.addTask
|
13821
|
|
13822
|
}, {
|
13823
|
xtype: 'button',
|
13824
|
text: 'Remove',
|
13825
|
hidden: true,
|
13826
|
handler: this.removeCells
|
13827
|
},
|
13828
|
'->', {
|
13829
|
xtype: 'cycle',
|
13830
|
text: 'layout',
|
13831
|
menu: {
|
13832
|
// id : 'view-type-menu',
|
13833
|
items: [{
|
13834
|
text: 'mxCircleLayout'
|
13835
|
}, {
|
13836
|
text: 'mxCompactTreeLayout'
|
13837
|
}, {
|
13838
|
text: 'mxCompositeLayout'
|
13839
|
}, {
|
13840
|
text: 'mxEdgeLabelLayout'
|
13841
|
}, {
|
13842
|
text: 'mxFastOrganicLayout'
|
13843
|
}, {
|
13844
|
text: 'mxGraphLayout'
|
13845
|
}, {
|
13846
|
text: 'mxHierarchicalLayout'
|
13847
|
}
|
13848
|
// , {
|
13849
|
// text : 'mxParallelEdgeLayout'
|
13850
|
// }
|
13851
|
// , {
|
13852
|
// text : 'mxPartitionLayout'
|
13853
|
// },
|
13854
|
// {
|
13855
|
// text : 'mxStackLayout'
|
13856
|
// }
|
13857
|
]
|
13858
|
},
|
13859
|
changeHandler: function (cycleBtn, activeItem) {
|
13860
|
// Ext.Msg.alert('Change View', activeItem.text);
|
13861
|
try {
|
13862
|
switch (activeItem.text) {
|
13863
|
case 'mxCircleLayout':
|
13864
|
var layout = new mxCircleLayout(graph);
|
13865
|
layout.execute(graph.getDefaultParent());
|
13866
|
break;
|
13867
|
case 'mxCompactTreeLayout':
|
13868
|
var layout = new mxCompactTreeLayout(graph,
|
13869
|
false);
|
13870
|
layout.execute(graph.getDefaultParent());
|
13871
|
break;
|
13872
|
case 'mxCompositeLayout':
|
13873
|
var first = new mxFastOrganicLayout(graph);
|
13874
|
var second = new mxParallelEdgeLayout(graph);
|
13875
|
var layout = new mxCompositeLayout(graph, [
|
13876
|
first, second], first);
|
13877
|
layout.execute(graph.getDefaultParent());
|
13878
|
break;
|
13879
|
case 'mxEdgeLabelLayout':
|
13880
|
var layout = new mxEdgeLabelLayout(graph);
|
13881
|
layout.execute(graph.getDefaultParent());
|
13882
|
break;
|
13883
|
case 'mxFastOrganicLayout':
|
13884
|
var layout = new mxCircleLayout(graph);
|
13885
|
layout.execute(graph.getDefaultParent());
|
13886
|
break;
|
13887
|
case 'mxGraphLayout':
|
13888
|
var layout = new mxFastOrganicLayout(graph);
|
13889
|
layout.execute(graph.getDefaultParent());
|
13890
|
break;
|
13891
|
case 'mxParallelEdgeLayout':
|
13892
|
var layout = new mxParallelEdgeLayout(graph);
|
13893
|
layout.execute(graph.getDefaultParent());
|
13894
|
break;
|
13895
|
case 'mxPartitionLayout':
|
13896
|
var layout = new mxPartitionLayout(graph,
|
13897
|
true, 10, 20);
|
13898
|
layout.execute(graph.getDefaultParent());
|
13899
|
break;
|
13900
|
case 'mxStackLayout':
|
13901
|
var layout = new mxStackLayout(graph, false);
|
13902
|
layout.execute(graph.getDefaultParent());
|
13903
|
break;
|
13904
|
case 'mxHierarchicalLayout':
|
13905
|
var layout = new mxHierarchicalLayout(graph);
|
13906
|
layout.parallelEdgeSpacing = 100;
|
13907
|
layout.moveParent = true;
|
13908
|
layout.parentBorder = 100;
|
13909
|
layout.intraCellSpacing = 100;
|
13910
|
layout.interRankCellSpacing = 100;
|
13911
|
layout.interHierarchySpacing = 0;
|
13912
|
layout.orientation = mxConstants.DIRECTION_NORTH;
|
13913
|
//layout.traverseAncestors = false;
|
13914
|
layout.execute(parent);
|
13915
|
break;
|
13916
|
|
13917
|
}
|
13918
|
} catch (e) {}
|
13919
|
}
|
13920
|
}, {
|
13921
|
xtype: 'tbseparator'
|
13922
|
}, {
|
13923
|
text: 'In',
|
13924
|
name: 'zoomin',
|
13925
|
handler: function () {
|
13926
|
graph.zoomIn();
|
13927
|
graph.fit();
|
13928
|
}
|
13929
|
}, {
|
13930
|
text: 'Out',
|
13931
|
name: 'zoomout',
|
13932
|
handler: function () {
|
13933
|
graph.zoomOut();
|
13934
|
graph.fit();
|
13935
|
}
|
13936
|
}
|
13937
|
// , {
|
13938
|
// text : 'Fit',
|
13939
|
// name : 'zoomfit',
|
13940
|
// handler : function() {
|
13941
|
// graph.fit();
|
13942
|
// }
|
13943
|
// }
|
13944
|
, {
|
13945
|
xtype: 'tbseparator'
|
13946
|
}, {
|
13947
|
xtype: 'button',
|
13948
|
text: 'print',
|
13949
|
name: 'print',
|
13950
|
handler: this.printPreview
|
13951
|
}
|
13952
|
]
|
13953
|
|
13954
|
this.autoScroll = true;
|
13955
|
this.listeners = {
|
13956
|
afterrender: this.onAfterRender,
|
13957
|
resize: this.onResize
|
13958
|
}
|
13959
|
|
13960
|
this.callParent(arguments);
|
13961
|
},
|
13962
|
printPreview: function () {
|
13963
|
var preview = new mxPrintPreview(graph);
|
13964
|
preview.print();
|
13965
|
},
|
13966
|
onAfterRender: function (_this) {
|
13967
|
this.main(document.getElementById('minovaGraphContainer'));
|
13968
|
},
|
13969
|
removeCells: function () {
|
13970
|
graph.removeCells();
|
13971
|
},
|
13972
|
onResize: function () {
|
13973
|
try {
|
13974
|
graph.sizeDidChange();
|
13975
|
} catch (e) {}
|
13976
|
},
|
13977
|
addTask: function () {
|
13978
|
graph.insertVertex(graph.getDefaultParent(), null, 'Task-' + Ext.id(),
|
13979
|
0, 0, 80, 30);
|
13980
|
},
|
13981
|
main: function (container) {
|
13982
|
// Checks if the browser is supported
|
13983
|
if (!mxClient.isBrowserSupported()) {
|
13984
|
// Displays an error message if the browser is not supported.
|
13985
|
// mxUtils.error('Browser is not supported!', 200, false);
|
13986
|
alert('Browser is not supported!');
|
13987
|
} else {
|
13988
|
// // Creates the graph inside the given container
|
13989
|
// graph = new mxGraph(container);
|
13990
|
// var keyHandler = new mxKeyHandler(graph);
|
13991
|
// // keyHandler.bindKey(46, function(evt) {
|
13992
|
// // if (graph.isEnabled()) {
|
13993
|
// // graph.removeCells();
|
13994
|
// // }
|
13995
|
// // });
|
13996
|
// wfEditor = new mxEditor();
|
13997
|
//
|
13998
|
// // Enables rubberband selection
|
13999
|
//
|
14000
|
// new mxRubberband(graph);
|
14001
|
// graph.setPanning(true);
|
14002
|
// graph.setTooltips(true);
|
14003
|
//
|
14004
|
// // graph.setConnectable(true);
|
14005
|
// // graph.setDropEnabled(true);
|
14006
|
// // graph.connectionHandler.setCreateTarget(true);
|
14007
|
//
|
14008
|
// // Gets the default parent for inserting new cells. This
|
14009
|
// // is normally the first child of the root (ie. layer 0).
|
14010
|
// var parent = graph.getDefaultParent();
|
14011
|
|
14012
|
// Enables crisp rendering in SVG
|
14013
|
// mxShape.prototype.crisp = true;
|
14014
|
|
14015
|
// Enables guides
|
14016
|
// mxGraphHandler.prototype.guidesEnabled = true;
|
14017
|
|
14018
|
// Alt disables guides
|
14019
|
// mxGuide.prototype.isEnabledForEvent = function(evt) {
|
14020
|
// return !mxEvent.isAltDown(evt);
|
14021
|
// };
|
14022
|
|
14023
|
// Enables snapping waypoints to terminals
|
14024
|
// mxEdgeHandler.prototype.snapToTerminals = true;
|
14025
|
|
14026
|
// Enables orthogonal connect preview in IE
|
14027
|
// mxConnectionHandler.prototype.movePreviewAway = true;
|
14028
|
|
14029
|
// Creates the graph inside the given container
|
14030
|
graph = new mxGraph(container);
|
14031
|
// graph.disconnectOnMove = false;
|
14032
|
// graph.foldingEnabled = false;
|
14033
|
// graph.cellsResizable = false;
|
14034
|
// graph.extendParents = false;
|
14035
|
// graph.setConnectable(true);
|
14036
|
graph.setAllowDanglingEdges(false);
|
14037
|
|
14038
|
// Implements perimeter-less connection points as fixed points
|
14039
|
// (computed before the edge style).
|
14040
|
// graph.view.updateFixedTerminalPoint = function(edge, terminal,
|
14041
|
// source, constraint) {
|
14042
|
// mxGraphView.prototype.updateFixedTerminalPoint.apply(this,
|
14043
|
// arguments);
|
14044
|
//
|
14045
|
// var pts = edge.absolutePoints;
|
14046
|
// var pt = pts[(source) ? 0 : pts.length - 1];
|
14047
|
//
|
14048
|
// if (terminal != null && pt == null
|
14049
|
// && this.getPerimeterFunction(terminal) == null) {
|
14050
|
// edge.setAbsoluteTerminalPoint(new mxPoint(this
|
14051
|
// .getRoutingCenterX(terminal), this
|
14052
|
// .getRoutingCenterY(terminal)),
|
14053
|
// source)
|
14054
|
// }
|
14055
|
// };
|
14056
|
|
14057
|
// Changes the default edge style
|
14058
|
graph.getStylesheet().getDefaultEdgeStyle()['edgeStyle'] = 'orthogonalEdgeStyle';
|
14059
|
// delete graph.getStylesheet().getDefaultEdgeStyle()['endArrow'];
|
14060
|
|
14061
|
// Implements the connect preview
|
14062
|
graph.connectionHandler.createEdgeState = function (me) {
|
14063
|
var edge = graph.createEdge(null, null, null, null, null);
|
14064
|
|
14065
|
return new mxCellState(this.graph.view, edge, this.graph
|
14066
|
.getCellStyle(edge));
|
14067
|
};
|
14068
|
|
14069
|
// Uncomment the following if you want the container
|
14070
|
// to fit the size of the graph
|
14071
|
// graph.setResizeContainer(true);
|
14072
|
|
14073
|
// Enables rubberband selection
|
14074
|
new mxRubberband(graph);
|
14075
|
|
14076
|
// Disables basic selection and cell handling
|
14077
|
graph.setEnabled(false);
|
14078
|
|
14079
|
// Gets the default parent for inserting new cells. This
|
14080
|
// is normally the first child of the root (ie. layer 0).
|
14081
|
var parent = graph.getDefaultParent();
|
14082
|
|
14083
|
// Enables HTML labels as wrapping is only available for those
|
14084
|
graph.htmlLabels = true;
|
14085
|
|
14086
|
// Disables in-place editing for edges
|
14087
|
// graph.isCellEditable = function(cell) {
|
14088
|
// return !this.model.isEdge(cell);
|
14089
|
// };
|
14090
|
|
14091
|
// Changes the default vertex style in-place
|
14092
|
var style = graph.getStylesheet().getDefaultVertexStyle();
|
14093
|
style[mxConstants.STYLE_PERIMETER] = mxPerimeter.RectanglePerimeter;
|
14094
|
style[mxConstants.STYLE_GRADIENTCOLOR] = 'white';
|
14095
|
style[mxConstants.STYLE_PERIMETER_SPACING] = 1; // 6;
|
14096
|
style[mxConstants.STYLE_ROUNDED] = true;
|
14097
|
style[mxConstants.STYLE_SHADOW] = true;
|
14098
|
|
14099
|
style = graph.getStylesheet().getDefaultEdgeStyle();
|
14100
|
style[mxConstants.STYLE_ROUNDED] = true;
|
14101
|
style[mxConstants.STYLE_EDGE] = mxEdgeStyle.SegmentConnector;
|
14102
|
|
14103
|
var style2 = new Object();
|
14104
|
style2[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_RHOMBUS;
|
14105
|
style2[mxConstants.STYLE_PERIMETER] = mxPerimeter.RhombusPerimeter;
|
14106
|
style2[mxConstants.STYLE_GRADIENTCOLOR] = 'white';
|
14107
|
style2[mxConstants.STYLE_PERIMETER_SPACING] = 1;
|
14108
|
style2[mxConstants.STYLE_ROUNDED] = true;
|
14109
|
style2[mxConstants.STYLE_SHADOW] = true;
|
14110
|
style2[mxConstants.STYLE_STROKECOLOR] = '#B3BFD7';
|
14111
|
style2[mxConstants.STYLE_FILLCOLOR] = '#C4DAFF';
|
14112
|
style2[mxConstants.STYLE_ALIGN] = 'center';
|
14113
|
style2[mxConstants.STYLE_VERTICALALIGN] = 'middle';
|
14114
|
graph.getStylesheet().putCellStyle('RHOMBUS', style2);
|
14115
|
|
14116
|
style2 = new Object();
|
14117
|
style2[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_ELLIPSE;
|
14118
|
style2[mxConstants.STYLE_PERIMETER] = mxPerimeter.EllipsePerimeter;
|
14119
|
style2[mxConstants.STYLE_GRADIENTCOLOR] = 'white';
|
14120
|
style2[mxConstants.STYLE_PERIMETER_SPACING] = 1;
|
14121
|
style2[mxConstants.STYLE_ROUNDED] = true;
|
14122
|
style2[mxConstants.STYLE_SHADOW] = true;
|
14123
|
style2[mxConstants.STYLE_STROKECOLOR] = '#B3BFD7';
|
14124
|
style2[mxConstants.STYLE_FILLCOLOR] = '#C4DAFF';
|
14125
|
style2[mxConstants.STYLE_ALIGN] = 'center';
|
14126
|
style2[mxConstants.STYLE_VERTICALALIGN] = 'middle';
|
14127
|
graph.getStylesheet().putCellStyle('ELLIPSE', style2);
|
14128
|
|
14129
|
style2 = new Object();
|
14130
|
style2[mxConstants.STYLE_SHAPE] = 'label';
|
14131
|
style2[mxConstants.STYLE_VERTICAL_ALIGN] = 'bottom';
|
14132
|
style2[mxConstants.STYLE_INDICATOR_SHAPE] = 'ellipse';
|
14133
|
style2[mxConstants.STYLE_INDICATOR_WIDTH] = 34;
|
14134
|
style2[mxConstants.STYLE_INDICATOR_HEIGHT] = 34;
|
14135
|
style2[mxConstants.STYLE_IMAGE_VERTICAL_ALIGN] = 'top'; // indicator v-alignment
|
14136
|
style2[mxConstants.STYLE_IMAGE_ALIGN] = 'center';
|
14137
|
graph.getStylesheet().putCellStyle('LABEL', style2);
|
14138
|
|
14139
|
style2 = new Object();
|
14140
|
style2[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_RECTANGLE;
|
14141
|
style2[mxConstants.STYLE_PERIMETER] = mxPerimeter.RectanglePerimeter;
|
14142
|
style2[mxConstants.STYLE_GRADIENTCOLOR] = 'white';
|
14143
|
style2[mxConstants.STYLE_PERIMETER_SPACING] = 1;
|
14144
|
style2[mxConstants.STYLE_ROUNDED] = false;
|
14145
|
style2[mxConstants.STYLE_SHADOW] = true;
|
14146
|
style2[mxConstants.STYLE_STROKECOLOR] = '#B3BFD7';
|
14147
|
style2[mxConstants.STYLE_FILLCOLOR] = '#C4DAFF';
|
14148
|
graph.getStylesheet().putCellStyle('RECTANGLE', style2);
|
14149
|
// Adds cells to the model in a single step
|
14150
|
graph.getModel().beginUpdate();
|
14151
|
try {
|
14152
|
// var v1 = graph.insertVertex(parent, null, '1', 20, 0, 150,
|
14153
|
// 80);
|
14154
|
// var v2 = graph.insertVertex(parent, null, '2', 20, 50, 150,
|
14155
|
// 80);
|
14156
|
// var v3 = graph
|
14157
|
// .insertVertex(parent, null, '3', 20, 100, 150, 80);
|
14158
|
// var v4 = graph
|
14159
|
// .insertVertex(parent, null, '4', 120, 50, 150, 80);
|
14160
|
// var v5 = graph.insertVertex(parent, null, '5', 120, 100, 150,
|
14161
|
// 80);
|
14162
|
//
|
14163
|
// var e1 = graph.insertEdge(parent, null, '', v1, v2);
|
14164
|
// var e2 = graph.insertEdge(parent, null, '', v2, v3);
|
14165
|
// var e3 = graph.insertEdge(parent, null, '', v2, v4);
|
14166
|
// var e4 = graph.insertEdge(parent, null, '', v4, v5);
|
14167
|
// var e5 = graph.insertEdge(parent, null, '', v3, v5);
|
14168
|
}
|
14169
|
finally {
|
14170
|
// Updates the display
|
14171
|
graph.getModel().endUpdate();
|
14172
|
}
|
14173
|
|
14174
|
}
|
14175
|
}
|
14176
|
});
|
14177
|
|
14178
|
Ext.define('MinovaUtil.MinovaES.MinovaMonthPicker', {
|
14179
|
extend: 'Ext.form.field.Text',
|
14180
|
alias: ['widget.minovamonthpicker', 'widget.minovamonthpicker'],
|
14181
|
tableName: undefined,
|
14182
|
param: undefined,
|
14183
|
formtarget_: this.formtarget,
|
14184
|
Sequence: this.Sequence,
|
14185
|
anchor: '50%',
|
14186
|
pagesize: undefined,
|
14187
|
triggerCls: 'x-form-date-trigger',
|
14188
|
getValue: function () {
|
14189
|
var Sequence = this.Sequence;
|
14190
|
var me = this;
|
14191
|
var _e = Ext.ComponentQuery.query('[name=' + Sequence + 'monthselect]')[0];
|
14192
|
var hasil = "";
|
14193
|
if (_e != undefined) {
|
14194
|
if (_e.value[0] >= 0) {
|
14195
|
if (_e.value[0].toString() != '') {
|
14196
|
var _m = (_e.value[0] + 1).toString();
|
14197
|
if (_m.length == 1) {
|
14198
|
_m = '0' + _m;
|
14199
|
}
|
14200
|
hasil = _e.value[1].toString() + _m;
|
14201
|
}
|
14202
|
}
|
14203
|
}
|
14204
|
if (hasil == "") {
|
14205
|
me.value = null;
|
14206
|
me.submitValue = null;
|
14207
|
} else {
|
14208
|
me.submitValue = hasil;
|
14209
|
}
|
14210
|
return hasil;
|
14211
|
},
|
14212
|
clearValue: function () {
|
14213
|
var Sequence = this.Sequence;
|
14214
|
var _e = Ext.ComponentQuery.query('[name=' + Sequence + 'monthselect]')[0];
|
14215
|
_e.value[0] = '';
|
14216
|
_e.value[1] = '';
|
14217
|
return this.setValue('');
|
14218
|
},
|
14219
|
getRawValue: function () {
|
14220
|
var Sequence = this.Sequence;
|
14221
|
var _e = Ext.ComponentQuery.query('[name=' + Sequence + 'monthselect]')[0];
|
14222
|
var hasil = null;
|
14223
|
if (_e != undefined) {
|
14224
|
var _m = (_e.value[0] + 1).toString();
|
14225
|
if (_m.length == 1) {
|
14226
|
_m = '0' + _m;
|
14227
|
}
|
14228
|
hasil = _e.value[1].toString() + _m;
|
14229
|
}
|
14230
|
return hasil;
|
14231
|
},
|
14232
|
initComponent: function () {
|
14233
|
var target = this.formtarget;
|
14234
|
this.callParent();
|
14235
|
},
|
14236
|
onTriggerClick: function () {
|
14237
|
var Sequence = this.Sequence;
|
14238
|
var count_lookup = Ext.ComponentQuery.query('[name=' + Sequence + 'monthLookup]').length;
|
14239
|
if (count_lookup == 1) {
|
14240
|
Ext.ComponentQuery.query('[name=' + Sequence + 'monthLookup]')[0].show();
|
14241
|
} else {
|
14242
|
var target_ = this.formtarget;
|
14243
|
var fieldtarget = this.name;
|
14244
|
Ext.create('Ext.window.Window', {
|
14245
|
title: 'Select Period',
|
14246
|
name: Sequence + 'monthLookup',
|
14247
|
layout: 'fit',
|
14248
|
bodyPadding: 0,
|
14249
|
border: false,
|
14250
|
items: [{
|
14251
|
xtype: 'monthpicker',
|
14252
|
name: Sequence + 'monthselect',
|
14253
|
listeners: {
|
14254
|
afterrender: function () {
|
14255
|
var _e = Ext.ComponentQuery.query('[name=' + Sequence + 'monthselect]')[0];
|
14256
|
|
14257
|
_e.setValue(new Date());
|
14258
|
}
|
14259
|
},
|
14260
|
onOkClick: function () {
|
14261
|
var _e = Ext.ComponentQuery.query('[name=' + Sequence + 'monthselect]')[0];
|
14262
|
if (_e.value[0] == null || _e.value[1] == null) {
|
14263
|
alert('Pilih Tanggal!');
|
14264
|
return;
|
14265
|
}
|
14266
|
|
14267
|
var _m = (_e.value[0] + 1).toString();
|
14268
|
if (_m.length == 1) {
|
14269
|
_m = '0' + _m;
|
14270
|
}
|
14271
|
var _period = _m + ' - ' + _e.value[1].toString();
|
14272
|
|
14273
|
var _f = Ext.ComponentQuery.query('[name=' + fieldtarget + ']')[0];
|
14274
|
_f.setValue(_period);
|
14275
|
|
14276
|
Ext.ComponentQuery.query('[name=' + Sequence + 'monthLookup]')[0].hide();
|
14277
|
},
|
14278
|
onCancelClick: function () {
|
14279
|
Ext.ComponentQuery.query('[name=' + Sequence + 'monthLookup]')[0].hide();
|
14280
|
}
|
14281
|
}
|
14282
|
]
|
14283
|
}).show();
|
14284
|
}
|
14285
|
}
|
14286
|
});
|
14287
|
|
14288
|
Ext.define('MinovaUtil.MinovaES.Column.MinovaTimeColumn', {
|
14289
|
extend: 'Ext.grid.column.Column',
|
14290
|
alias: ['widget.minovatimecolumn'],
|
14291
|
alternateClassName: 'Ext.grid.MinovaTimeColumn',
|
14292
|
undefinedText: ' ',
|
14293
|
defaultRenderer: function (value) {
|
14294
|
if (value === "") {
|
14295
|
return "";
|
14296
|
}
|
14297
|
return hasil;
|
14298
|
}
|
14299
|
});
|
14300
|
|
14301
|
Ext.define('MinovaUtil.MinovaES.Column.MinovaCurrencyColumn', {
|
14302
|
extend: 'Ext.grid.column.Column',
|
14303
|
alias: ['widget.minovacurrancycolumn'],
|
14304
|
undefinedText: ' ',
|
14305
|
defaultRenderer: function (value) {
|
14306
|
if (value === "" || value === undefined || value === null) {
|
14307
|
return this.undefinedText;
|
14308
|
}
|
14309
|
|
14310
|
Ext.util.Format.thousandSeparator = ",";
|
14311
|
Ext.util.Format.decimalSeparator = ".";
|
14312
|
value = value.toString().replace(',', '.');
|
14313
|
return Ext.util.Format.number(value, '0,000.00');
|
14314
|
}
|
14315
|
});
|
14316
|
|
14317
|
Ext.define('MinovaUtil.MinovaES.Field.MinovaCurrencyField', {
|
14318
|
extend: 'Ext.form.field.Text',
|
14319
|
alias: ['widget.MinovaCurrencyField', 'widget.minovacurrencyfield'],
|
14320
|
undefinedText: ' ',
|
14321
|
defaultRenderer: function (value) {
|
14322
|
if (value === "" || value === undefined || value === null) {
|
14323
|
return this.undefinedText;
|
14324
|
}
|
14325
|
|
14326
|
Ext.util.Format.thousandSeparator = ",";
|
14327
|
Ext.util.Format.decimalSeparator = ".";
|
14328
|
value = value.toString().replace(',', '.');
|
14329
|
return Ext.util.Format.number(value, '0000.00');
|
14330
|
}
|
14331
|
});
|
14332
|
|
14333
|
Ext.define('MinovaUtil.MinovaES.MinovaGridMD', {
|
14334
|
extend: 'Ext.grid.Panel',
|
14335
|
requires: ['Ext.grid.RowNumberer'],
|
14336
|
alias: 'widget.minovagridmd',
|
14337
|
//alias: ['widget.minovagrid1', 'widget.minovagrid'],
|
14338
|
//alias: ['widget.minovagrid1', 'widget.minovagrid'],
|
14339
|
alternateClassName: 'Ext.grid.MinovaGrid',
|
14340
|
//controller:'orm-manage2-controller',
|
14341
|
tableName: undefined,
|
14342
|
isLookup: undefined,
|
14343
|
param: undefined,
|
14344
|
pagesize: undefined,
|
14345
|
storename: undefined,
|
14346
|
layoutType: undefined,
|
14347
|
enableLocking: true,
|
14348
|
autoLoad: undefined,
|
14349
|
multiSelect: undefined,
|
14350
|
getTableName: function () {
|
14351
|
return this.tableName;
|
14352
|
},
|
14353
|
|
14354
|
initComponent: function () {
|
14355
|
var me = this;
|
14356
|
var cols_ = [];
|
14357
|
var fieldeditor = {};
|
14358
|
var hasil = null;
|
14359
|
var autoLoad = true;
|
14360
|
var LangID = localStorage.LangId;
|
14361
|
var fielGrid = 'rec.GridView == 1';
|
14362
|
var locking = true;
|
14363
|
var checkSelection = '';
|
14364
|
var widthLock = 250;
|
14365
|
if (me.multiSelect) {
|
14366
|
locking = false;
|
14367
|
checkSelection = 'checkboxmodel';
|
14368
|
widthLock = 40;
|
14369
|
}
|
14370
|
//var _url = 'GetAllField';
|
14371
|
if (me.autoLoad == false) {
|
14372
|
autoLoad = false;
|
14373
|
}
|
14374
|
parameter = null;
|
14375
|
if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
|
14376
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupGrid='1'";
|
14377
|
fielGrid = 'rec.LookupGrid == 1';
|
14378
|
locking = false;
|
14379
|
|
14380
|
} else {
|
14381
|
parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
|
14382
|
//autoLoad = false;
|
14383
|
//_url = 'GetAllFieldGridLookUp';
|
14384
|
};
|
14385
|
|
14386
|
//Ext.Ajax.request({
|
14387
|
// async : false,
|
14388
|
// method : 'POST',
|
14389
|
// url : '/Devt/' + _url + '?tableName=' + me.tableName,
|
14390
|
// success : function (response) {
|
14391
|
// var results = Ext.decode(response.responseText);
|
14392
|
// hasil = results.data;
|
14393
|
// }
|
14394
|
//});
|
14395
|
//hamid03102016
|
14396
|
|
14397
|
Ext.Ajax.request({
|
14398
|
async: false,
|
14399
|
method: 'POST',
|
14400
|
url: '/UserControl/GetStore',
|
14401
|
params: {
|
14402
|
tableName: 'PDSBS0007',
|
14403
|
param: parameter
|
14404
|
},
|
14405
|
success: function (response) {
|
14406
|
var results = Ext.decode(response.responseText);
|
14407
|
hasil = results.data;
|
14408
|
}
|
14409
|
});
|
14410
|
//end
|
14411
|
|
14412
|
if (hasil.length > 0) {
|
14413
|
|
14414
|
Ext.each(hasil, function (rec) {
|
14415
|
var null_ = null;
|
14416
|
if (rec.IsPrimaryKey == true) {
|
14417
|
null_ = false;
|
14418
|
}
|
14419
|
if (rec.IsRequired == true) {
|
14420
|
null_ = false;
|
14421
|
} else {
|
14422
|
null_ = true;
|
14423
|
}
|
14424
|
|
14425
|
if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
|
14426
|
if (rec.LookupGrid == 1) {
|
14427
|
switch (rec.FormatRef) {
|
14428
|
case "file":
|
14429
|
cols_.push({
|
14430
|
xtype: 'minovapicturecolumn',
|
14431
|
text: rec.HeaderTitle,
|
14432
|
dataIndex: rec.FieldName,
|
14433
|
width: 100,
|
14434
|
//filter: {
|
14435
|
// type: 'image',
|
14436
|
// itemDefaults: {
|
14437
|
// emptyText: 'Search for...'
|
14438
|
// }
|
14439
|
//}
|
14440
|
});
|
14441
|
break
|
14442
|
case "date":
|
14443
|
cols_.push({
|
14444
|
xtype: 'minovadatecolumn',
|
14445
|
text: rec.HeaderTitle,
|
14446
|
dataIndex: rec.FieldName,
|
14447
|
width: 100,
|
14448
|
filter: {
|
14449
|
type: 'date',
|
14450
|
itemDefaults: {
|
14451
|
emptyText: 'Search for...'
|
14452
|
}
|
14453
|
}
|
14454
|
});
|
14455
|
break
|
14456
|
case "amount":
|
14457
|
cols_.push({
|
14458
|
xtype: 'minovacurrancycolumn',
|
14459
|
text: rec.HeaderTitle,
|
14460
|
align: 'right',
|
14461
|
dataIndex: rec.FieldName,
|
14462
|
width: 100,
|
14463
|
filter: {
|
14464
|
type: 'number',
|
14465
|
itemDefaults: {
|
14466
|
emptyText: 'Search for...'
|
14467
|
}
|
14468
|
}
|
14469
|
});
|
14470
|
break
|
14471
|
case "amountencrypt":
|
14472
|
cols_.push({
|
14473
|
xtype: 'minovaamountcolumn',
|
14474
|
align: 'right',
|
14475
|
text: rec.HeaderTitle,
|
14476
|
dataIndex: rec.FieldName,
|
14477
|
width: 100,
|
14478
|
filter: {
|
14479
|
type: 'string',
|
14480
|
itemDefaults: {
|
14481
|
emptyText: 'Search for...'
|
14482
|
}
|
14483
|
}
|
14484
|
});
|
14485
|
break
|
14486
|
case "datetime":
|
14487
|
cols_.push({
|
14488
|
xtype: 'minovadatetimecolumn',
|
14489
|
text: rec.HeaderTitle,
|
14490
|
dataIndex: rec.FieldName,
|
14491
|
width: 140,
|
14492
|
filter: {
|
14493
|
type: 'string',
|
14494
|
itemDefaults: {
|
14495
|
emptyText: 'Search for...'
|
14496
|
}
|
14497
|
}
|
14498
|
});
|
14499
|
break
|
14500
|
default:
|
14501
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
14502
|
cols_.push({
|
14503
|
text: rec.HeaderTitle,
|
14504
|
dataIndex: rec.FieldName,
|
14505
|
width: 100,
|
14506
|
filter: {
|
14507
|
type: 'string',
|
14508
|
itemDefaults: {
|
14509
|
emptyText: 'Search for...'
|
14510
|
}
|
14511
|
}
|
14512
|
});
|
14513
|
} else if (rec.SearchType == '2') {
|
14514
|
cols_.push({
|
14515
|
xtype: 'minovalookupcolumn',
|
14516
|
text: rec.HeaderTitle,
|
14517
|
tableName: rec.TableRef,
|
14518
|
dataIndex: rec.FieldName,
|
14519
|
filter: {
|
14520
|
itemDefaults: {
|
14521
|
emptyText: 'Search for...'
|
14522
|
}
|
14523
|
}
|
14524
|
});
|
14525
|
} else if (rec.TableRef != "") {
|
14526
|
if (rec.TableRef != null) {
|
14527
|
var valueField = null;
|
14528
|
var displayValue = null;
|
14529
|
Ext.Ajax.request({
|
14530
|
async: false,
|
14531
|
method: 'POST',
|
14532
|
url: '/UserControl/GetStore',
|
14533
|
params: {
|
14534
|
tableName: 'SDATATABLEFIELD',
|
14535
|
param: 'TableName[equal]' + rec.TableRef
|
14536
|
},
|
14537
|
success: function (response) {
|
14538
|
var results = Ext.decode(response.responseText);
|
14539
|
data_ = results.data;
|
14540
|
if (data_ != undefined) {
|
14541
|
valueField_ = $.grep(data_, function (r) {
|
14542
|
return r.ValueField == '1'
|
14543
|
});
|
14544
|
valueField = valueField_[0].FieldName
|
14545
|
displayValue_ = $.grep(data_, function (r) {
|
14546
|
return r.DisplayValue == '1'
|
14547
|
});
|
14548
|
displayValue = displayValue_[0].FieldName
|
14549
|
}
|
14550
|
}
|
14551
|
});
|
14552
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
14553
|
var count_ = 0;
|
14554
|
if (store_) {
|
14555
|
count_ = store_.count();
|
14556
|
}
|
14557
|
if (count_ == 0) {
|
14558
|
Ext.create('Ext.data.Store', {
|
14559
|
storeId: 'store_' + rec.FieldName,
|
14560
|
//autoLoad: true,
|
14561
|
proxy: {
|
14562
|
method: 'POST',
|
14563
|
type: 'ajax',
|
14564
|
url: '/UserControl/GetStore',
|
14565
|
extraParams: {
|
14566
|
tableName: rec.TableRef,
|
14567
|
param: rec.ParamCombo
|
14568
|
},
|
14569
|
reader: {
|
14570
|
type: 'json',
|
14571
|
root: 'data',
|
14572
|
totalProperty: 'data[0].TotalCount'
|
14573
|
}
|
14574
|
}
|
14575
|
})
|
14576
|
}
|
14577
|
cols_.push({
|
14578
|
xtype: 'minovacombocolumn',
|
14579
|
text: rec.HeaderTitle,
|
14580
|
dataIndex: rec.FieldName,
|
14581
|
valueField: valueField,
|
14582
|
displayField: displayValue,
|
14583
|
store: 'store_' + rec.FieldName,
|
14584
|
filter: {
|
14585
|
type: 'list',
|
14586
|
itemDefaults: {
|
14587
|
emptyText: 'Search for...'
|
14588
|
}
|
14589
|
}
|
14590
|
});
|
14591
|
}
|
14592
|
|
14593
|
} else {
|
14594
|
cols_.push({
|
14595
|
text: rec.HeaderTitle,
|
14596
|
dataIndex: rec.FieldName,
|
14597
|
filter: {
|
14598
|
itemDefaults: {
|
14599
|
emptyText: 'Search for...'
|
14600
|
}
|
14601
|
}
|
14602
|
});
|
14603
|
}
|
14604
|
break
|
14605
|
}
|
14606
|
} else {
|
14607
|
cols_.push({
|
14608
|
text: rec.HeaderTitle,
|
14609
|
dataIndex: rec.FieldName,
|
14610
|
hidden: true,
|
14611
|
filter: {
|
14612
|
itemDefaults: {
|
14613
|
emptyText: 'Search for...'
|
14614
|
}
|
14615
|
}
|
14616
|
});
|
14617
|
}
|
14618
|
|
14619
|
} else {
|
14620
|
if (rec.GridView == 1) {
|
14621
|
switch (rec.FormatRef) {
|
14622
|
case "file":
|
14623
|
cols_.push({
|
14624
|
xtype: 'minovapicturecolumn',
|
14625
|
text: rec.HeaderTitle,
|
14626
|
dataIndex: rec.FieldName,
|
14627
|
width: 100,
|
14628
|
//filter: {
|
14629
|
// type: '',
|
14630
|
// itemDefaults: {
|
14631
|
// emptyText: 'Search for...'
|
14632
|
// }
|
14633
|
//}
|
14634
|
});
|
14635
|
break
|
14636
|
case "date":
|
14637
|
cols_.push({
|
14638
|
xtype: 'minovadatecolumn',
|
14639
|
text: rec.HeaderTitle,
|
14640
|
dataIndex: rec.FieldName,
|
14641
|
width: 100,
|
14642
|
filter: {
|
14643
|
type: 'date',
|
14644
|
itemDefaults: {
|
14645
|
emptyText: 'Search for...'
|
14646
|
}
|
14647
|
}
|
14648
|
});
|
14649
|
break
|
14650
|
case "amountencrypt":
|
14651
|
cols_.push({
|
14652
|
xtype: 'minovaamountcolumn',
|
14653
|
align: 'right',
|
14654
|
text: rec.HeaderTitle,
|
14655
|
dataIndex: rec.FieldName,
|
14656
|
width: 100,
|
14657
|
filter: {
|
14658
|
type: 'string',
|
14659
|
itemDefaults: {
|
14660
|
emptyText: 'Search for...'
|
14661
|
}
|
14662
|
}
|
14663
|
});
|
14664
|
break
|
14665
|
case "amount":
|
14666
|
cols_.push({
|
14667
|
text: rec.HeaderTitle,
|
14668
|
dataIndex: rec.FieldName,
|
14669
|
width: 100,
|
14670
|
filter: {
|
14671
|
type: 'number',
|
14672
|
itemDefaults: {
|
14673
|
emptyText: 'Search for...'
|
14674
|
}
|
14675
|
}
|
14676
|
});
|
14677
|
break
|
14678
|
case "datetime":
|
14679
|
cols_.push({
|
14680
|
xtype: 'minovadatetimecolumn',
|
14681
|
text: rec.HeaderTitle,
|
14682
|
dataIndex: rec.FieldName,
|
14683
|
width: 140,
|
14684
|
filter: {
|
14685
|
type: 'string',
|
14686
|
itemDefaults: {
|
14687
|
emptyText: 'Search for...'
|
14688
|
}
|
14689
|
}
|
14690
|
});
|
14691
|
break
|
14692
|
default:
|
14693
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
14694
|
cols_.push({
|
14695
|
text: rec.HeaderTitle,
|
14696
|
dataIndex: rec.FieldName,
|
14697
|
width: 100,
|
14698
|
filter: {
|
14699
|
type: 'string',
|
14700
|
itemDefaults: {
|
14701
|
emptyText: 'Search for...'
|
14702
|
}
|
14703
|
}
|
14704
|
});
|
14705
|
} else if (rec.SearchType == '2') {
|
14706
|
cols_.push({
|
14707
|
xtype: 'minovalookupcolumn',
|
14708
|
text: rec.HeaderTitle,
|
14709
|
tableName: rec.TableRef,
|
14710
|
dataIndex: rec.FieldName,
|
14711
|
filter: {
|
14712
|
itemDefaults: {
|
14713
|
emptyText: 'Search for...'
|
14714
|
}
|
14715
|
}
|
14716
|
});
|
14717
|
} else if (rec.TableRef != "" && rec.SearchType != '2') {
|
14718
|
if (rec.TableRef != null) {
|
14719
|
var valueField = null;
|
14720
|
var displayValue = null;
|
14721
|
Ext.Ajax.request({
|
14722
|
async: false,
|
14723
|
method: 'POST',
|
14724
|
url: '/UserControl/GetStore',
|
14725
|
params: {
|
14726
|
tableName: 'SDATATABLEFIELD',
|
14727
|
param: 'TableName[equal]' + rec.TableRef
|
14728
|
},
|
14729
|
success: function (response) {
|
14730
|
var results = Ext.decode(response.responseText);
|
14731
|
data_ = results.data;
|
14732
|
//if (data_ != undefined) {
|
14733
|
if (data_.length > 0) {
|
14734
|
valueField_ = $.grep(data_, function (r) {
|
14735
|
return r.ValueField == '1'
|
14736
|
});
|
14737
|
valueField = valueField_[0].FieldName
|
14738
|
displayValue_ = $.grep(data_, function (r) {
|
14739
|
return r.DisplayValue == '1'
|
14740
|
});
|
14741
|
displayValue = displayValue_[0].FieldName
|
14742
|
} else {
|
14743
|
MinovaMessage('Not Null', 'BSNULLCOMBO', rec.TableRef, 'E');
|
14744
|
}
|
14745
|
}
|
14746
|
});
|
14747
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
14748
|
var count_ = 0;
|
14749
|
if (store_) {
|
14750
|
count_ = store_.count();
|
14751
|
}
|
14752
|
if (count_ == 0) {
|
14753
|
var paramFilter = rec.ParamCombo;
|
14754
|
if (rec.TableRef.toLowerCase() == 'phrom0001' && rec.ParamCombo.length == 1) {
|
14755
|
paramFilter = 'ObjectClass[=]' + paramFilter;
|
14756
|
}
|
14757
|
Ext.create('Ext.data.Store', {
|
14758
|
storeId: 'store_' + rec.FieldName,
|
14759
|
autoLoad: false,
|
14760
|
proxy: {
|
14761
|
method: 'POST',
|
14762
|
type: 'ajax',
|
14763
|
url: '/UserControl/GetStore',
|
14764
|
extraParams: {
|
14765
|
tableName: rec.TableRef,
|
14766
|
param: paramFilter
|
14767
|
},
|
14768
|
reader: {
|
14769
|
type: 'json',
|
14770
|
root: 'data',
|
14771
|
totalProperty: 'data[0].TotalCount'
|
14772
|
}
|
14773
|
}
|
14774
|
})
|
14775
|
}
|
14776
|
cols_.push({
|
14777
|
xtype: 'minovacombocolumn',
|
14778
|
text: rec.HeaderTitle,
|
14779
|
dataIndex: rec.FieldName,
|
14780
|
valueField: valueField,
|
14781
|
displayField: displayValue,
|
14782
|
store: 'store_' + rec.FieldName,
|
14783
|
filter: {
|
14784
|
type: 'list',
|
14785
|
itemDefaults: {
|
14786
|
emptyText: 'Search for...'
|
14787
|
}
|
14788
|
}
|
14789
|
});
|
14790
|
}
|
14791
|
|
14792
|
} else if (rec.FixedValue != "") {
|
14793
|
cols_.push({
|
14794
|
xtype: 'minovacombocolumnfixvalue',
|
14795
|
text: rec.HeaderTitle,
|
14796
|
dataIndex: rec.FieldName,
|
14797
|
fixedValue: rec.FixedValue,
|
14798
|
filter: {
|
14799
|
type: 'list',
|
14800
|
itemDefaults: {
|
14801
|
emptyText: 'Search for...'
|
14802
|
}
|
14803
|
}
|
14804
|
});
|
14805
|
} else {
|
14806
|
cols_.push({
|
14807
|
text: rec.HeaderTitle,
|
14808
|
dataIndex: rec.FieldName,
|
14809
|
filter: {
|
14810
|
itemDefaults: {
|
14811
|
emptyText: 'Search for...'
|
14812
|
}
|
14813
|
}
|
14814
|
});
|
14815
|
}
|
14816
|
break
|
14817
|
}
|
14818
|
} else {
|
14819
|
cols_.push({
|
14820
|
text: rec.HeaderTitle,
|
14821
|
dataIndex: rec.FieldName,
|
14822
|
hidden: true,
|
14823
|
filter: {
|
14824
|
itemDefaults: {
|
14825
|
emptyText: 'Search for...'
|
14826
|
}
|
14827
|
}
|
14828
|
});
|
14829
|
}
|
14830
|
|
14831
|
}
|
14832
|
});
|
14833
|
};
|
14834
|
var param_ = me.param;
|
14835
|
if (param_ == undefined) {
|
14836
|
param_ = ''
|
14837
|
}
|
14838
|
var jsStoreGrid = new Ext.data.Store({
|
14839
|
storeId: me.storename,
|
14840
|
autoLoad: autoLoad,
|
14841
|
pageSize: me.pagesize,
|
14842
|
proxy: {
|
14843
|
method: 'POST',
|
14844
|
type: 'ajax',
|
14845
|
url: '/UserControl/GetStorePaging',
|
14846
|
extraParams: {
|
14847
|
tableName: me.tableName,
|
14848
|
param: param_,
|
14849
|
//menuId: MinovaUtil.GetMenuID()
|
14850
|
},
|
14851
|
reader: {
|
14852
|
type: 'json',
|
14853
|
root: 'data',
|
14854
|
totalProperty: 'totalRecords'
|
14855
|
}
|
14856
|
},
|
14857
|
});
|
14858
|
Ext.applyIf(me, {
|
14859
|
autoScroll: true,
|
14860
|
enableLocking: locking,
|
14861
|
lockedGridConfig: {
|
14862
|
header: false,
|
14863
|
collapsible: true,
|
14864
|
width: widthLock,
|
14865
|
forceFit: locking,
|
14866
|
listeners: {
|
14867
|
render: function (grid) {
|
14868
|
var pagingToolbar = grid.child('pagingtoolbar');
|
14869
|
if (pagingToolbar) {
|
14870
|
grid.remove(pagingToolbar, true);
|
14871
|
}
|
14872
|
}
|
14873
|
}
|
14874
|
},
|
14875
|
listeners: {
|
14876
|
viewready: function () {
|
14877
|
if (autoLoad == true) {
|
14878
|
this.getStore().loadPage(1);
|
14879
|
}
|
14880
|
|
14881
|
},
|
14882
|
beforeedit: function () {
|
14883
|
return false;
|
14884
|
}
|
14885
|
},
|
14886
|
lockedViewConfig: {
|
14887
|
scroll: 'horizontal'
|
14888
|
},
|
14889
|
viewConfig: {
|
14890
|
emptyText: 'No Data Display',
|
14891
|
deferEmptyText: false,
|
14892
|
//Add Nana For Autosize Column Mode Grid MD
|
14893
|
listeners: {
|
14894
|
refresh: function (dataview) {
|
14895
|
Ext.each(dataview.panel.columns, function (column) {
|
14896
|
if (column.autoSizeColumn == false)
|
14897
|
column.autoSizeColumn = true;
|
14898
|
column.autoSize();
|
14899
|
console.log('GridMD');
|
14900
|
})
|
14901
|
},
|
14902
|
//afterrender: function (dataview) {
|
14903
|
// console.log(dataview);
|
14904
|
// dataview.getStore().reload();
|
14905
|
//}
|
14906
|
afterrender: function (dataview) {
|
14907
|
Ext.defer(function () {
|
14908
|
dataview.store.reload();
|
14909
|
}, 2500, this);
|
14910
|
}
|
14911
|
}
|
14912
|
},
|
14913
|
//for chekbox
|
14914
|
selModel: {
|
14915
|
//type: 'cellmodel'
|
14916
|
},
|
14917
|
selType: checkSelection,
|
14918
|
columns: cols_,
|
14919
|
store: jsStoreGrid,
|
14920
|
plugins: [{
|
14921
|
ptype: 'gridfilters'
|
14922
|
}
|
14923
|
],
|
14924
|
|
14925
|
});
|
14926
|
me.callParent(arguments);
|
14927
|
}
|
14928
|
|
14929
|
});
|
14930
|
|
14931
|
Ext.define('MinovaUtil.MinovaES.MinovaPMSEditAbleGrid', {
|
14932
|
extend: 'Ext.form.Panel',
|
14933
|
alias: ['widget.MinovaPMSEditAbleGrid', 'widget.Minovapmseditablegrid', 'widget.minovapmseditablegrid'],
|
14934
|
requires: [
|
14935
|
'Ext.grid.plugin.CellEditing',
|
14936
|
'Ext.grid.Panel',
|
14937
|
],
|
14938
|
anchor: '100%',
|
14939
|
tableName: undefined,
|
14940
|
apprasalType: undefined,
|
14941
|
empID: undefined,
|
14942
|
hideButton: undefined,
|
14943
|
multiSelect: undefined,
|
14944
|
initComponent: function () {
|
14945
|
var me = this;
|
14946
|
var isLookup = me.isLookup;
|
14947
|
var hide_ = false;
|
14948
|
var widthLock = 250;
|
14949
|
var checkSelection = '';
|
14950
|
if (me.hideButton == true) {
|
14951
|
hide_ = true;
|
14952
|
}
|
14953
|
if (me.multiSelect) {
|
14954
|
locking = false;
|
14955
|
checkSelection = 'checkboxmodel';
|
14956
|
widthLock = 40;
|
14957
|
}
|
14958
|
var tableName = me.tableName;
|
14959
|
var cols = [];
|
14960
|
var fieldStore = [];
|
14961
|
var _url = 'GetAllField';
|
14962
|
var hasil = null;
|
14963
|
var height = me.height;
|
14964
|
var storeID = 'store' + me.tableName;
|
14965
|
var gridName = 'grid' + me.name;
|
14966
|
if (me.storeName) {
|
14967
|
storeID = me.storeName;
|
14968
|
}
|
14969
|
var empID = me.empID;
|
14970
|
var apprasalType = me.apprasalType;
|
14971
|
var LangID = MinovaUtil.GetLangID();
|
14972
|
var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'" + "," + empID + "," + apprasalType
|
14973
|
Ext.Ajax.request({
|
14974
|
async: false,
|
14975
|
method: 'POST',
|
14976
|
url: '/Performance/getFieldPMS',
|
14977
|
params: {
|
14978
|
tableName: 'PDSPMS001',
|
14979
|
_param: parameter
|
14980
|
},
|
14981
|
success: function (response) {
|
14982
|
var results = Ext.decode(response.responseText);
|
14983
|
hasil = Ext.decode(results.data);
|
14984
|
}
|
14985
|
});
|
14986
|
var addData = 'var data={';
|
14987
|
if (hasil.length > 0) {
|
14988
|
Ext.each(hasil, function (rec) {
|
14989
|
fieldStore.push(rec.FieldName)
|
14990
|
if (rec.FieldName != 'Sequence') {
|
14991
|
addData = addData + rec.FieldName + ":" + "'',";
|
14992
|
}
|
14993
|
var null_ = null;
|
14994
|
var ReadOnly_ = false;
|
14995
|
if (rec.IsPrimaryKey == true) {
|
14996
|
null_ = false;
|
14997
|
}
|
14998
|
if (rec.IsRequired == true) {
|
14999
|
null_ = false;
|
15000
|
} else {
|
15001
|
null_ = true;
|
15002
|
}
|
15003
|
if (rec.ReadOnly == '1') {
|
15004
|
ReadOnly_ = true;
|
15005
|
}
|
15006
|
var Hidden_ = false;
|
15007
|
if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
|
15008
|
Hidden_ = true;
|
15009
|
null_ = true;
|
15010
|
}
|
15011
|
if (rec.GridView == 1) {
|
15012
|
switch (rec.FormatRef) {
|
15013
|
case "date":
|
15014
|
cols.push({
|
15015
|
xtype: 'minovadatecolumn',
|
15016
|
hidden: Hidden_,
|
15017
|
text: rec.HeaderTitle,
|
15018
|
dataIndex: rec.FieldName,
|
15019
|
filter: {
|
15020
|
itemDefaults: {
|
15021
|
emptyText: 'Search for...',
|
15022
|
}
|
15023
|
},
|
15024
|
editor: {
|
15025
|
allowBlank: null_,
|
15026
|
xtype: 'datefield',
|
15027
|
hideMode: 'visibility',
|
15028
|
readOnly: ReadOnly_,
|
15029
|
id: tableName + rec.FieldName,
|
15030
|
fieldGrid: rec.FieldName,
|
15031
|
nameTable: rec.TableName,
|
15032
|
}
|
15033
|
});
|
15034
|
break
|
15035
|
case "amount":
|
15036
|
cols.push({
|
15037
|
xtype: 'minovacurrancycolumn',
|
15038
|
//renderer: Ext.util.Format.numberRenderer("0,0"),
|
15039
|
text: rec.HeaderTitle,
|
15040
|
align: 'right',
|
15041
|
dataIndex: rec.FieldName,
|
15042
|
hidden: Hidden_,
|
15043
|
filter: {
|
15044
|
itemDefaults: {
|
15045
|
emptyText: 'Search for...'
|
15046
|
}
|
15047
|
},
|
15048
|
editor: {
|
15049
|
allowBlank: null_,
|
15050
|
xtype: 'minovacurrencyfield',
|
15051
|
//renderer: Ext.util.Format.numberRenderer("0,0"),
|
15052
|
//vtype: 'validateDecimal',
|
15053
|
readOnly: ReadOnly_,
|
15054
|
id: tableName + rec.FieldName,
|
15055
|
nameTable: rec.TableName,
|
15056
|
fieldGrid: rec.FieldName,
|
15057
|
fieldStyle: 'text-align:right;',
|
15058
|
value: '0',
|
15059
|
|
15060
|
}
|
15061
|
});
|
15062
|
break
|
15063
|
case "time":
|
15064
|
var DefaultValue = rec.DefaultValue;
|
15065
|
if (DefaultValue == '') {
|
15066
|
defaultValue = '00:00';
|
15067
|
}
|
15068
|
cols.push({
|
15069
|
//xtype: 'minovatimecolumn',
|
15070
|
xtype: 'timefield',
|
15071
|
format: 'H:i',
|
15072
|
submitFormat: 'Hi',
|
15073
|
text: rec.HeaderTitle,
|
15074
|
dataIndex: rec.FieldName,
|
15075
|
hidden: Hidden_,
|
15076
|
//renderer: Ext.util.Format.dateRenderer('G:i'),
|
15077
|
filter: {
|
15078
|
itemDefaults: {
|
15079
|
emptyText: 'Search for...'
|
15080
|
}
|
15081
|
},
|
15082
|
editor: {
|
15083
|
allowBlank: null_,
|
15084
|
xtype: 'timefield',
|
15085
|
readOnly: ReadOnly_,
|
15086
|
id: tableName + rec.FieldName,
|
15087
|
format: 'H:i',
|
15088
|
submitFormat: 'Hi',
|
15089
|
increment: 5,
|
15090
|
value: DefaultValue,
|
15091
|
anchor: '100%',
|
15092
|
listeners: {}
|
15093
|
//renderer: Ext.util.Format.dateRenderer('G:i'),
|
15094
|
}
|
15095
|
});
|
15096
|
break
|
15097
|
default:
|
15098
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
|
15099
|
cols.push({
|
15100
|
text: rec.HeaderTitle,
|
15101
|
dataIndex: rec.FieldName,
|
15102
|
width: 100,
|
15103
|
filter: {
|
15104
|
type: 'string',
|
15105
|
itemDefaults: {
|
15106
|
emptyText: 'Search for...'
|
15107
|
}
|
15108
|
}
|
15109
|
});
|
15110
|
} else if (rec.SearchType == '0') {
|
15111
|
var valueField = null;
|
15112
|
var displayValue = null;
|
15113
|
var TableRef = undefined;
|
15114
|
if (rec.TableRef != '') {
|
15115
|
TableRef = rec.TableRef;
|
15116
|
|
15117
|
Ext.Ajax.request({
|
15118
|
async: false,
|
15119
|
method: 'POST',
|
15120
|
url: '/UserControl/GetStore',
|
15121
|
params: {
|
15122
|
tableName: 'SDATATABLEFIELD',
|
15123
|
param: 'TableName[equal]' + rec.TableRef
|
15124
|
},
|
15125
|
success: function (response) {
|
15126
|
var results = Ext.decode(response.responseText);
|
15127
|
data_ = results.data;
|
15128
|
if (data_ != undefined) {
|
15129
|
valueField_ = $.grep(data_, function (r) {
|
15130
|
return r.ValueField == '1'
|
15131
|
});
|
15132
|
valueField = valueField_[0].FieldName
|
15133
|
displayValue_ = $.grep(data_, function (r) {
|
15134
|
return r.DisplayValue == '1'
|
15135
|
});
|
15136
|
displayValue = displayValue_[0].FieldName
|
15137
|
}
|
15138
|
}
|
15139
|
});
|
15140
|
|
15141
|
//create Store
|
15142
|
Ext.create('Ext.data.Store', {
|
15143
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
15144
|
autoLoad: true,
|
15145
|
proxy: {
|
15146
|
method: 'POST',
|
15147
|
type: 'ajax',
|
15148
|
url: '/UserControl/GetStore',
|
15149
|
extraParams: {
|
15150
|
tableName: TableRef,
|
15151
|
param: rec.ParamCombo
|
15152
|
},
|
15153
|
reader: {
|
15154
|
type: 'json',
|
15155
|
root: 'data',
|
15156
|
totalProperty: 'data[0].TotalCount'
|
15157
|
}
|
15158
|
}
|
15159
|
});
|
15160
|
} else if (rec.FixedValue != '') {
|
15161
|
var storeData = [];
|
15162
|
var str = rec.FixedValue;
|
15163
|
var hasil = str.split('||');
|
15164
|
hasil.forEach(function (h) {
|
15165
|
store_ = h.split('=')
|
15166
|
storeData.push({
|
15167
|
code: store_[0],
|
15168
|
desc: store_[1],
|
15169
|
|
15170
|
});
|
15171
|
});
|
15172
|
|
15173
|
valueField = 'code';
|
15174
|
displayValue = 'desc';
|
15175
|
|
15176
|
Ext.create('Ext.data.Store', {
|
15177
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
15178
|
autoLoad: true,
|
15179
|
data: storeData
|
15180
|
})
|
15181
|
}
|
15182
|
|
15183
|
cols.push({
|
15184
|
xtype: 'minovacombocolumn',
|
15185
|
hidden: Hidden_,
|
15186
|
text: rec.HeaderTitle,
|
15187
|
dataIndex: rec.FieldName,
|
15188
|
valueField: valueField,
|
15189
|
displayField: displayValue,
|
15190
|
store: 'store_' + me.tableName + rec.FieldName,
|
15191
|
editor: {
|
15192
|
allowBlank: null_,
|
15193
|
xtype: 'combobox',
|
15194
|
readOnly: ReadOnly_,
|
15195
|
id: tableName + rec.FieldName,
|
15196
|
nameTable: rec.TableName,
|
15197
|
fieldGrid: rec.FieldName,
|
15198
|
valueField: valueField,
|
15199
|
displayField: displayValue,
|
15200
|
|
15201
|
store: 'store_' + me.tableName + rec.FieldName,
|
15202
|
},
|
15203
|
filter: {
|
15204
|
type: 'list',
|
15205
|
itemDefaults: {
|
15206
|
emptyText: 'Search for...'
|
15207
|
}
|
15208
|
}
|
15209
|
});
|
15210
|
} else if (rec.SearchType == '5') {
|
15211
|
var valueField = null;
|
15212
|
var displayValue = null;
|
15213
|
var AdditionaldisplayValue = null;
|
15214
|
var TableRef = undefined;
|
15215
|
if (rec.TableRef != '') {
|
15216
|
TableRef = rec.TableRef;
|
15217
|
Ext.Ajax.request({
|
15218
|
async: false,
|
15219
|
method: 'POST',
|
15220
|
url: '/UserControl/GetStore',
|
15221
|
params: {
|
15222
|
tableName: 'SDATATABLEFIELD',
|
15223
|
param: 'TableName[equal]' + rec.TableRef
|
15224
|
},
|
15225
|
success: function (response) {
|
15226
|
var results = Ext.decode(response.responseText);
|
15227
|
data_ = results.data;
|
15228
|
if (data_ != undefined) {
|
15229
|
valueField_ = $.grep(data_, function (r) {
|
15230
|
return r.ValueField == '1'
|
15231
|
});
|
15232
|
if (valueField_.length > 0) {
|
15233
|
valueField = valueField_[0].FieldName
|
15234
|
}
|
15235
|
|
15236
|
displayValue_ = $.grep(data_, function (r) {
|
15237
|
return r.DisplayValue == '1' || r.DisplayValue == '2'
|
15238
|
});
|
15239
|
if (displayValue_.length > 0) {
|
15240
|
displayValue = displayValue_[0].FieldName;
|
15241
|
}
|
15242
|
if (displayValue_.length >= 2) {
|
15243
|
AdditionaldisplayValue = displayValue_[1].FieldName
|
15244
|
}
|
15245
|
}
|
15246
|
}
|
15247
|
});
|
15248
|
}
|
15249
|
Ext.create('Ext.data.Store', {
|
15250
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
15251
|
autoLoad: true,
|
15252
|
proxy: {
|
15253
|
method: 'POST',
|
15254
|
type: 'ajax',
|
15255
|
url: '/UserControl/GetStoreAuth',
|
15256
|
extraParams: {
|
15257
|
tableName: TableRef,
|
15258
|
param: rec.ParamCombo,
|
15259
|
menuId: MinovaUtil.GetMenuID()
|
15260
|
},
|
15261
|
reader: {
|
15262
|
type: 'json',
|
15263
|
root: 'data',
|
15264
|
totalProperty: 'data[0].TotalCount'
|
15265
|
}
|
15266
|
}
|
15267
|
});
|
15268
|
cols.push({
|
15269
|
xtype : 'minovacombocolumn',
|
15270
|
hidden: Hidden_,
|
15271
|
text: rec.HeaderTitle,
|
15272
|
dataIndex: rec.FieldName,
|
15273
|
valueField : valueField,
|
15274
|
displayField : displayValue,
|
15275
|
store : 'store_' + me.tableName + rec.FieldName,
|
15276
|
tpl: Ext.create('Ext.XTemplate',
|
15277
|
'<ul class="x-list-plain"><tpl for=".">',
|
15278
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
15279
|
'</tpl></ul>'),
|
15280
|
displayTpl: Ext.create('Ext.XTemplate',
|
15281
|
'<tpl for=".">',
|
15282
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
15283
|
'</tpl>'),
|
15284
|
editor: {
|
15285
|
allowBlank: null_,
|
15286
|
xtype: 'combobox',
|
15287
|
readOnly: ReadOnly_,
|
15288
|
id: rec.TableName + rec.FieldName,
|
15289
|
nameTable: rec.TableName,
|
15290
|
fieldGrid: rec.FieldName,
|
15291
|
valueField: valueField,
|
15292
|
displayField: displayValue,
|
15293
|
store: 'store_' + me.tableName + rec.FieldName,
|
15294
|
value: rec.DefaultValue,
|
15295
|
tpl: Ext.create('Ext.XTemplate',
|
15296
|
'<ul class="x-list-plain"><tpl for=".">',
|
15297
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
15298
|
'</tpl></ul>'),
|
15299
|
displayTpl: Ext.create('Ext.XTemplate',
|
15300
|
'<tpl for=".">',
|
15301
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
15302
|
'</tpl>')
|
15303
|
},
|
15304
|
renderer: function (value) {
|
15305
|
var store = Ext.data.StoreManager.lookup('store_' + me.tableName + rec.FieldName);
|
15306
|
var index = store.find(valueField, value);
|
15307
|
var val = "";
|
15308
|
if (index != -1) {
|
15309
|
var rc = store.getAt(index);
|
15310
|
//val = rc.get(displayValue);
|
15311
|
val = rc.get(AdditionaldisplayValue) + ' - ' + rc.get(displayValue);
|
15312
|
} else {
|
15313
|
val = value;
|
15314
|
}
|
15315
|
return val;
|
15316
|
},
|
15317
|
filter: {
|
15318
|
type: 'list',
|
15319
|
itemDefaults: {
|
15320
|
emptyText: 'Search for...'
|
15321
|
}
|
15322
|
}
|
15323
|
});
|
15324
|
} else if (rec.SearchType == '2') {
|
15325
|
var triger = (rec.TriggerCombo).split('$');
|
15326
|
var targetField_ = triger[0];
|
15327
|
var fieldValue_ = triger[1];
|
15328
|
cols.push({
|
15329
|
text: rec.HeaderTitle,
|
15330
|
hidden: Hidden_,
|
15331
|
dataIndex: rec.FieldName,
|
15332
|
filter: {
|
15333
|
itemDefaults: {
|
15334
|
emptyText: 'Search for...'
|
15335
|
}
|
15336
|
},
|
15337
|
editor: {
|
15338
|
allowBlank: null_,
|
15339
|
xtype: 'minovalookupgrid',
|
15340
|
readOnly: ReadOnly_,
|
15341
|
isGrid: true,
|
15342
|
fieldTarget: targetField_,
|
15343
|
fieldValue: fieldValue_,
|
15344
|
isGrid: true,
|
15345
|
id: tableName + rec.FieldName,
|
15346
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
15347
|
triggerCls: 'x-form-search-trigger',
|
15348
|
vtype: 'alphanum', // disable space
|
15349
|
nameTable: rec.TableName,
|
15350
|
fieldGrid: rec.FieldName,
|
15351
|
LookupFunction: rec.LookupFunction,
|
15352
|
listeners: {
|
15353
|
change: function (val) {
|
15354
|
var custumFunc = rec.SelectFunction;
|
15355
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
15356
|
Ext.Ajax.request({
|
15357
|
async: false,
|
15358
|
method: 'POST',
|
15359
|
url: '/UserControl/GetStore',
|
15360
|
params: {
|
15361
|
tableName: 'PCMFUNC',
|
15362
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
15363
|
},
|
15364
|
success: function (response) {
|
15365
|
var results = Ext.decode(response.responseText);
|
15366
|
data_ = results.data[0];
|
15367
|
if (data_ != undefined) {
|
15368
|
custumFunc = data_.FunctionCode;
|
15369
|
}
|
15370
|
}
|
15371
|
});
|
15372
|
}
|
15373
|
if (custumFunc) {
|
15374
|
eval(custumFunc)
|
15375
|
}
|
15376
|
}
|
15377
|
}
|
15378
|
}
|
15379
|
});
|
15380
|
} else if (rec.SearchType == '3') {
|
15381
|
cols.push({
|
15382
|
text: rec.HeaderTitle,
|
15383
|
hidden: Hidden_,
|
15384
|
dataIndex: rec.FieldName,
|
15385
|
filter: {
|
15386
|
itemDefaults: {
|
15387
|
emptyText: 'Search for...'
|
15388
|
}
|
15389
|
},
|
15390
|
editor: {
|
15391
|
allowBlank: null_,
|
15392
|
// xtype: 'minovalookuptreePopup',
|
15393
|
xtype: 'MinovaLookupTree',
|
15394
|
readOnly: ReadOnly_,
|
15395
|
id: tableName + rec.FieldName,
|
15396
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
15397
|
triggerCls: 'x-form-search-trigger',
|
15398
|
vtype: 'alphanum', // disable space
|
15399
|
treeSructure: rec.SearchFunction, //'O-O-P',
|
15400
|
objClassValue: rec.ParamCombo, //'O',
|
15401
|
nameTable: rec.TableName,
|
15402
|
fieldGrid: rec.FieldName,
|
15403
|
listeners: {
|
15404
|
change: function (val) {
|
15405
|
var custumFunc = rec.SelectFunction;
|
15406
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
15407
|
Ext.Ajax.request({
|
15408
|
async: false,
|
15409
|
method: 'POST',
|
15410
|
url: '/UserControl/GetStore',
|
15411
|
params: {
|
15412
|
tableName: 'PCMFUNC',
|
15413
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
15414
|
},
|
15415
|
success: function (response) {
|
15416
|
var results = Ext.decode(response.responseText);
|
15417
|
data_ = results.data[0];
|
15418
|
if (data_ != undefined) {
|
15419
|
custumFunc = data_.FunctionCode;
|
15420
|
}
|
15421
|
}
|
15422
|
});
|
15423
|
}
|
15424
|
if (custumFunc) {
|
15425
|
eval(custumFunc)
|
15426
|
}
|
15427
|
}
|
15428
|
}
|
15429
|
}
|
15430
|
});
|
15431
|
} else if (rec.SearchType != '0' && rec.SearchType != '1' && rec.SearchType != '3' && (rec.FieldName == 'EmployeeID' || rec.FieldName == 'ApplicantID' || rec.FieldName == 'EmployeeIDFrom' || rec.FieldName == 'EmployeeIDTo') && isLookup != true) {
|
15432
|
var triger = (rec.TriggerCombo).split('&');
|
15433
|
var targetField_ = triger[0];
|
15434
|
var fieldValue_ = triger[0];
|
15435
|
cols.push({
|
15436
|
text: rec.HeaderTitle,
|
15437
|
hidden: Hidden_,
|
15438
|
dataIndex: rec.FieldName,
|
15439
|
filter: {
|
15440
|
itemDefaults: {
|
15441
|
emptyText: 'Search for...'
|
15442
|
}
|
15443
|
},
|
15444
|
editor: {
|
15445
|
allowBlank: null_,
|
15446
|
xtype: 'lookupemployee',
|
15447
|
readOnly: ReadOnly_,
|
15448
|
isGrid: true,
|
15449
|
fieldTarget: targetField_,
|
15450
|
fieldValue: fieldValue_,
|
15451
|
isGrid: true,
|
15452
|
id: tableName + rec.FieldName,
|
15453
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
15454
|
triggerCls: 'x-form-search-trigger',
|
15455
|
vtype: 'alphanum', // disable space
|
15456
|
nameTable: rec.TableName,
|
15457
|
fieldGrid: rec.FieldName,
|
15458
|
listeners: {
|
15459
|
change: function (val) {
|
15460
|
var custumFunc = rec.SelectFunction;
|
15461
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
15462
|
Ext.Ajax.request({
|
15463
|
async: false,
|
15464
|
method: 'POST',
|
15465
|
url: '/UserControl/GetStore',
|
15466
|
params: {
|
15467
|
tableName: 'PCMFUNC',
|
15468
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
15469
|
},
|
15470
|
success: function (response) {
|
15471
|
var results = Ext.decode(response.responseText);
|
15472
|
data_ = results.data[0];
|
15473
|
if (data_ != undefined) {
|
15474
|
custumFunc = data_.FunctionCode;
|
15475
|
}
|
15476
|
}
|
15477
|
});
|
15478
|
}
|
15479
|
if (custumFunc) {
|
15480
|
eval(custumFunc)
|
15481
|
}
|
15482
|
}
|
15483
|
}
|
15484
|
}
|
15485
|
});
|
15486
|
} else if (rec.SearchType == '4' && isLookup != true) {
|
15487
|
cols.push({
|
15488
|
|
15489
|
text: rec.HeaderTitle,
|
15490
|
hidden: Hidden_,
|
15491
|
dataIndex: rec.FieldName,
|
15492
|
filter: {
|
15493
|
itemDefaults: {
|
15494
|
emptyText: 'Search for...'
|
15495
|
}
|
15496
|
},
|
15497
|
editor: {
|
15498
|
allowBlank: null_,
|
15499
|
xtype: 'lookupemployee',
|
15500
|
readOnly: ReadOnly_,
|
15501
|
isGrid: true,
|
15502
|
fieldTarget: targetField_,
|
15503
|
fieldValue: fieldValue_,
|
15504
|
isGrid: true,
|
15505
|
id: tableName + rec.FieldName,
|
15506
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
15507
|
triggerCls: 'x-form-search-trigger',
|
15508
|
vtype: 'alphanum', // disable space
|
15509
|
nameTable: rec.TableName,
|
15510
|
fieldGrid: rec.FieldName,
|
15511
|
listeners: {
|
15512
|
change: function (val) {
|
15513
|
var custumFunc = rec.SelectFunction;
|
15514
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
15515
|
Ext.Ajax.request({
|
15516
|
async: false,
|
15517
|
method: 'POST',
|
15518
|
url: '/UserControl/GetStore',
|
15519
|
params: {
|
15520
|
tableName: 'PCMFUNC',
|
15521
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
15522
|
},
|
15523
|
success: function (response) {
|
15524
|
var results = Ext.decode(response.responseText);
|
15525
|
data_ = results.data[0];
|
15526
|
if (data_ != undefined) {
|
15527
|
custumFunc = data_.FunctionCode;
|
15528
|
}
|
15529
|
}
|
15530
|
});
|
15531
|
}
|
15532
|
if (custumFunc) {
|
15533
|
eval(custumFunc)
|
15534
|
}
|
15535
|
}
|
15536
|
}
|
15537
|
}
|
15538
|
});
|
15539
|
} else {
|
15540
|
cols.push({
|
15541
|
text: rec.HeaderTitle,
|
15542
|
hidden: Hidden_,
|
15543
|
dataIndex: rec.FieldName,
|
15544
|
filter: {
|
15545
|
itemDefaults: {
|
15546
|
emptyText: 'Search for...'
|
15547
|
}
|
15548
|
},
|
15549
|
editor: {
|
15550
|
allowBlank: null_,
|
15551
|
xtype: 'textfield',
|
15552
|
readOnly: ReadOnly_,
|
15553
|
id: tableName + rec.FieldName,
|
15554
|
nameTable: rec.TableName,
|
15555
|
fieldGrid: rec.FieldName,
|
15556
|
listeners: {
|
15557
|
change: function (val) {
|
15558
|
var custumFunc = null;
|
15559
|
Ext.Ajax.request({
|
15560
|
async: false,
|
15561
|
method: 'POST',
|
15562
|
url: '/UserControl/GetStore',
|
15563
|
params: {
|
15564
|
tableName: 'SDATATABLEFIELD',
|
15565
|
param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
|
15566
|
},
|
15567
|
success: function (response) {
|
15568
|
var results = Ext.decode(response.responseText);
|
15569
|
data_ = results.data[0];
|
15570
|
if (data_ != undefined) {
|
15571
|
custumFunc = data_.SelectFunction;
|
15572
|
//console.log(data_)
|
15573
|
}
|
15574
|
}
|
15575
|
});
|
15576
|
if (custumFunc) {
|
15577
|
eval(custumFunc)
|
15578
|
}
|
15579
|
}
|
15580
|
}
|
15581
|
}
|
15582
|
});
|
15583
|
}
|
15584
|
break
|
15585
|
}
|
15586
|
} else {
|
15587
|
cols.push({
|
15588
|
text: rec.HeaderTitle,
|
15589
|
hidden: Hidden_,
|
15590
|
dataIndex: rec.FieldName,
|
15591
|
hidden: true,
|
15592
|
editor: {
|
15593
|
allowBlank: true,
|
15594
|
xtype: 'textfield',
|
15595
|
readOnly: ReadOnly_,
|
15596
|
id: tableName + rec.FieldName,
|
15597
|
nameTable: rec.TableName,
|
15598
|
fieldGrid: rec.FieldName,
|
15599
|
},
|
15600
|
filter: {
|
15601
|
itemDefaults: {
|
15602
|
emptyText: 'Search for...'
|
15603
|
}
|
15604
|
}
|
15605
|
});
|
15606
|
}
|
15607
|
});
|
15608
|
};
|
15609
|
addData = addData + "}";
|
15610
|
Ext.applyIf(me, {
|
15611
|
|
15612
|
items: [{
|
15613
|
xtype: 'grid',
|
15614
|
id: gridName,
|
15615
|
name: gridName,
|
15616
|
height: height,
|
15617
|
autoHeight: true,
|
15618
|
//store: 'gridStore',
|
15619
|
autoScroll: true,
|
15620
|
store: Ext.create('Ext.data.Store', {
|
15621
|
storeId: storeID,
|
15622
|
fields: fieldStore,
|
15623
|
proxy: {
|
15624
|
method: 'POST',
|
15625
|
type: 'ajax',
|
15626
|
url: '',
|
15627
|
reader: {
|
15628
|
type: 'json',
|
15629
|
root: 'data'
|
15630
|
}
|
15631
|
}
|
15632
|
}),
|
15633
|
dockedItems: [{
|
15634
|
xtype: 'toolbar',
|
15635
|
items: [{
|
15636
|
text: 'Add',
|
15637
|
hidden: hide_,
|
15638
|
name: tableName + 'Add',
|
15639
|
iconCls: 'fa-plus-circle',
|
15640
|
style: 'font-family: FontAwesome',
|
15641
|
handler: function () {
|
15642
|
var store = Ext.StoreMgr.lookup(storeID)
|
15643
|
idx = store.getCount();
|
15644
|
var action = getParam('action');
|
15645
|
var data = '';
|
15646
|
var Sequence = 0;
|
15647
|
if (idx == 0) {
|
15648
|
Sequence = 1;
|
15649
|
} else {
|
15650
|
Sequence = 1 + idx;
|
15651
|
}
|
15652
|
//data = {
|
15653
|
// Sequence: Sequence
|
15654
|
//};
|
15655
|
|
15656
|
var seq = 'Sequence';
|
15657
|
var SequenceValue = Sequence;
|
15658
|
eval(addData);
|
15659
|
data[seq] = SequenceValue;
|
15660
|
|
15661
|
store.insert(idx, data);
|
15662
|
}
|
15663
|
|
15664
|
}, {
|
15665
|
text: 'Delete',
|
15666
|
hidden: hide_,
|
15667
|
name: tableName + 'DeleteText',
|
15668
|
iconCls: 'fa-trash-o',
|
15669
|
style: 'font-family: FontAwesome',
|
15670
|
//disabled: true
|
15671
|
handler: function () {
|
15672
|
var me = this,
|
15673
|
store = Ext.StoreMgr.lookup(storeID)
|
15674
|
|
15675
|
var grid = Ext.getCmp(gridName);
|
15676
|
|
15677
|
Ext.MessageBox.show({
|
15678
|
title: 'Remove tab',
|
15679
|
msg: "This will remove. Do you want to continue?",
|
15680
|
buttons: Ext.MessageBox.YESNO,
|
15681
|
fn: function (choice) {
|
15682
|
console.log(choice);
|
15683
|
if (choice === 'yes') {
|
15684
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
15685
|
if (selection) {
|
15686
|
store.remove(selection);
|
15687
|
}
|
15688
|
}
|
15689
|
//delete panel.pendingClose;
|
15690
|
}
|
15691
|
});
|
15692
|
}
|
15693
|
|
15694
|
}
|
15695
|
]
|
15696
|
}
|
15697
|
],
|
15698
|
columns: cols,
|
15699
|
selType: checkSelection,
|
15700
|
//selType: 'rowmodel',
|
15701
|
plugins: {
|
15702
|
ptype: 'rowediting',
|
15703
|
pluginId: 'rowEditing',
|
15704
|
clicksToEdit: 0,
|
15705
|
listeners: {
|
15706
|
//edit: 'onGridEditorEdit'
|
15707
|
}
|
15708
|
}
|
15709
|
}, ]
|
15710
|
|
15711
|
});
|
15712
|
|
15713
|
me.callParent(arguments);
|
15714
|
}
|
15715
|
});
|
15716
|
|
15717
|
Ext.define('MinovaUtil.MinovaES.Minovatimefield', {
|
15718
|
extend: 'Ext.form.field.Time',
|
15719
|
alias: ['widget.minovatimefield'],
|
15720
|
undefinedText: ' ',
|
15721
|
setValue: function (v) {
|
15722
|
hasil = '';
|
15723
|
if (v != this.getValue()) {
|
15724
|
if (v) {
|
15725
|
if (v.length == 4) {
|
15726
|
|
15727
|
var h = v.substring(0, 2);
|
15728
|
var m = v.substring(2, 4)
|
15729
|
//this.setValue(h +':'+m);
|
15730
|
hasil = h + ':' + m;
|
15731
|
}
|
15732
|
if (v.length == 5) {
|
15733
|
this.setValue(v);
|
15734
|
hasil = v;
|
15735
|
}
|
15736
|
}
|
15737
|
this.setValue(hasil);
|
15738
|
}
|
15739
|
|
15740
|
},
|
15741
|
});
|
15742
|
|
15743
|
Ext.define('MinovaUtil.MinovaES.MinovaFixValueLabel', {
|
15744
|
extend: 'Ext.form.Label',
|
15745
|
alias: ['widget.MinovaFixValueLabel', 'widget.minovafixvaluelabel'],
|
15746
|
anchor: '50%',
|
15747
|
defaultRenderer: function (value) {
|
15748
|
if (typeof(this.store) !== 'object') {
|
15749
|
this.store = Ext.data.StoreManager.lookup(this.store);
|
15750
|
}
|
15751
|
var idx = this.store.findExact('code', value);
|
15752
|
if (this.store.getAt(idx)) {
|
15753
|
var result = this.store.getAt(idx).get('desc');
|
15754
|
value = result ? result : value;
|
15755
|
}
|
15756
|
this.setRawValue(value);
|
15757
|
|
15758
|
},
|
15759
|
initComponent: function () {
|
15760
|
var me = this;
|
15761
|
var storeData = [];
|
15762
|
var str = me.fixedValue;
|
15763
|
var hasil = str.split('||');
|
15764
|
hasil.forEach(function (h) {
|
15765
|
store_ = h.split('=')
|
15766
|
storeData.push({
|
15767
|
code: store_[0],
|
15768
|
desc: store_[1],
|
15769
|
|
15770
|
});
|
15771
|
});
|
15772
|
Ext.applyIf(me, {
|
15773
|
|
15774
|
store: Ext.create('Ext.data.Store', {
|
15775
|
storeId: 'store' + name,
|
15776
|
autoLoad: true,
|
15777
|
data: storeData
|
15778
|
|
15779
|
}),
|
15780
|
|
15781
|
});
|
15782
|
me.callParent(arguments);
|
15783
|
}
|
15784
|
});
|
15785
|
|
15786
|
Ext.define('MinovaUtil.MinovaES.MinovaComboColumnFixValueLabel', {
|
15787
|
extend: 'Ext.grid.column.Column',
|
15788
|
alias: ['widget.minovacombocolumnfixvalue'],
|
15789
|
initComponent: function () {
|
15790
|
var me = this;
|
15791
|
var storeData = [];
|
15792
|
var str = me.fixedValue;
|
15793
|
var hasil = str.split('||');
|
15794
|
hasil.forEach(function (h) {
|
15795
|
store_ = h.split('=')
|
15796
|
storeData.push({
|
15797
|
code: store_[0],
|
15798
|
desc: store_[1],
|
15799
|
|
15800
|
});
|
15801
|
});
|
15802
|
Ext.applyIf(me, {
|
15803
|
|
15804
|
store: Ext.create('Ext.data.Store', {
|
15805
|
storeId: 'store' + name,
|
15806
|
autoLoad: true,
|
15807
|
data: storeData
|
15808
|
|
15809
|
}),
|
15810
|
|
15811
|
});
|
15812
|
this.callParent(arguments);
|
15813
|
},
|
15814
|
defaultRenderer: function (value) {
|
15815
|
if (typeof(this.store) !== 'object') {
|
15816
|
Ext.data.StoreManager.lookup(this.store).load();
|
15817
|
this.store = Ext.data.StoreManager.lookup(this.store);
|
15818
|
}
|
15819
|
var idx = this.store.findExact('code', value);
|
15820
|
if (this.store.getAt(idx)) {
|
15821
|
var result = this.store.getAt(idx).get('desc');
|
15822
|
value = result ? result : value;
|
15823
|
}
|
15824
|
return value;
|
15825
|
}
|
15826
|
});
|
15827
|
|
15828
|
Ext.define('MinovaUtil.MinovaES.MinovaLookupColumn', {
|
15829
|
extend: 'Ext.grid.column.Column',
|
15830
|
alias: ['widget.minovalookupcolumn'],
|
15831
|
initComponent: function () {
|
15832
|
this.callParent(arguments);
|
15833
|
},
|
15834
|
defaultRenderer: function (value) {
|
15835
|
data_ = undefined;
|
15836
|
Ext.Ajax.request({
|
15837
|
async: false,
|
15838
|
method: 'POST',
|
15839
|
url: '/UserControl/GetStore',
|
15840
|
params: {
|
15841
|
tableName: 'PDSCMTABLE',
|
15842
|
param: this.tableName + ',' + value + ',hasil'
|
15843
|
},
|
15844
|
success: function (response) {
|
15845
|
var results = Ext.decode(response.responseText);
|
15846
|
data_ = results.data;
|
15847
|
if (data_ != null) {
|
15848
|
if (data_.length > 0) {
|
15849
|
value = value + '-' + data_[0].hasil;
|
15850
|
}
|
15851
|
}
|
15852
|
}
|
15853
|
});
|
15854
|
return value;
|
15855
|
}
|
15856
|
});
|
15857
|
|
15858
|
Ext.define('MinovaUtil.MinovaES.MinovaPMSTreeEditAbleGrid', {
|
15859
|
extend: 'Ext.form.Panel',
|
15860
|
alias: ['widget.MinovaPMSTreeEditAbleGrid', 'widget.Minovapmstreeeditablegrid', 'widget.minovapmstreeeeditablegrid'],
|
15861
|
requires: [
|
15862
|
'Ext.grid.plugin.CellEditing',
|
15863
|
'Ext.grid.Panel',
|
15864
|
],
|
15865
|
anchor: '100%',
|
15866
|
tableName: undefined,
|
15867
|
apprasalType: undefined,
|
15868
|
empID: undefined,
|
15869
|
hideButton: undefined,
|
15870
|
multiSelect: undefined,
|
15871
|
height: undefined,
|
15872
|
initComponent: function () {
|
15873
|
var me = this;
|
15874
|
var isLookup = me.isLookup;
|
15875
|
var hide_ = false;
|
15876
|
var widthLock = 250;
|
15877
|
var checkSelection = '';
|
15878
|
if (me.hideButton == true) {
|
15879
|
hide_ = true;
|
15880
|
}
|
15881
|
if (me.multiSelect) {
|
15882
|
locking = false;
|
15883
|
checkSelection = 'checkboxmodel';
|
15884
|
widthLock = 40;
|
15885
|
}
|
15886
|
var tableName = me.tableName;
|
15887
|
var cols = [];
|
15888
|
var fieldStore = [];
|
15889
|
var _url = 'GetAllField';
|
15890
|
var hasil = null;
|
15891
|
var height = me.height;
|
15892
|
var storeID = 'store' + me.tableName;
|
15893
|
var gridName = 'grid' + me.tableName;
|
15894
|
if (me.storeName) {
|
15895
|
storeID = me.storeName;
|
15896
|
}
|
15897
|
var empID = me.empID;
|
15898
|
var apprasalType = me.apprasalType;
|
15899
|
var LangID = MinovaUtil.GetLangID();
|
15900
|
var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'" + "," + empID + "," + apprasalType
|
15901
|
Ext.Ajax.request({
|
15902
|
async: false,
|
15903
|
method: 'POST',
|
15904
|
url: '/Performance/getFieldPMS',
|
15905
|
params: {
|
15906
|
tableName: 'PDSPMS001',
|
15907
|
_param: parameter
|
15908
|
},
|
15909
|
success: function (response) {
|
15910
|
var results = Ext.decode(response.responseText);
|
15911
|
hasil = Ext.decode(results.data);
|
15912
|
}
|
15913
|
});
|
15914
|
var addData = 'var data={';
|
15915
|
if (hasil.length > 0) {
|
15916
|
Ext.each(hasil, function (rec) {
|
15917
|
fieldStore.push(rec.FieldName)
|
15918
|
if (rec.FieldName != 'Sequence') {
|
15919
|
addData = addData + rec.FieldName + ":" + "'',";
|
15920
|
}
|
15921
|
var null_ = null;
|
15922
|
var ReadOnly_ = false;
|
15923
|
if (rec.IsPrimaryKey == true) {
|
15924
|
null_ = false;
|
15925
|
}
|
15926
|
if (rec.IsRequired == true) {
|
15927
|
null_ = false;
|
15928
|
} else {
|
15929
|
null_ = true;
|
15930
|
}
|
15931
|
if (rec.ReadOnly == '1') {
|
15932
|
ReadOnly_ = true;
|
15933
|
}
|
15934
|
var Hidden_ = false;
|
15935
|
if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
|
15936
|
Hidden_ = true;
|
15937
|
null_ = true;
|
15938
|
}
|
15939
|
if (rec.GridView != 0) {
|
15940
|
if (rec.GridView == 3) {
|
15941
|
cols.push({
|
15942
|
xtype: 'treecolumn',
|
15943
|
text: rec.HeaderTitle,
|
15944
|
dataIndex: rec.FieldName,
|
15945
|
hidden: Hidden_,
|
15946
|
width: 200,
|
15947
|
sortable: true,
|
15948
|
filter: {
|
15949
|
itemDefaults: {
|
15950
|
emptyText: 'Search for...'
|
15951
|
}
|
15952
|
}
|
15953
|
});
|
15954
|
} else {
|
15955
|
switch (rec.FormatRef) {
|
15956
|
case "date":
|
15957
|
cols.push({
|
15958
|
xtype: 'minovadatecolumn',
|
15959
|
hidden: Hidden_,
|
15960
|
text: rec.HeaderTitle,
|
15961
|
dataIndex: rec.FieldName,
|
15962
|
filter: {
|
15963
|
itemDefaults: {
|
15964
|
emptyText: 'Search for...',
|
15965
|
}
|
15966
|
},
|
15967
|
editor: {
|
15968
|
allowBlank: null_,
|
15969
|
xtype: 'datefield',
|
15970
|
hideMode: 'visibility',
|
15971
|
readOnly: ReadOnly_,
|
15972
|
id: tableName + rec.FieldName,
|
15973
|
fieldGrid: rec.FieldName,
|
15974
|
nameTable: rec.TableName,
|
15975
|
}
|
15976
|
});
|
15977
|
break
|
15978
|
case "amount":
|
15979
|
cols.push({
|
15980
|
xtype: 'minovacurrancycolumn',
|
15981
|
//renderer: Ext.util.Format.numberRenderer("0,0"),
|
15982
|
text: rec.HeaderTitle,
|
15983
|
align: 'right',
|
15984
|
dataIndex: rec.FieldName,
|
15985
|
hidden: Hidden_,
|
15986
|
filter: {
|
15987
|
itemDefaults: {
|
15988
|
emptyText: 'Search for...'
|
15989
|
}
|
15990
|
},
|
15991
|
editor: {
|
15992
|
allowBlank: null_,
|
15993
|
xtype: 'minovacurrencyfield',
|
15994
|
//renderer: Ext.util.Format.numberRenderer("0,0"),
|
15995
|
//vtype: 'validateDecimal',
|
15996
|
readOnly: ReadOnly_,
|
15997
|
id: tableName + rec.FieldName,
|
15998
|
nameTable: rec.TableName,
|
15999
|
fieldGrid: rec.FieldName,
|
16000
|
fieldStyle: 'text-align:right;',
|
16001
|
value: '0',
|
16002
|
|
16003
|
}
|
16004
|
});
|
16005
|
break
|
16006
|
case "time":
|
16007
|
var DefaultValue = rec.DefaultValue;
|
16008
|
if (DefaultValue == '') {
|
16009
|
defaultValue = '00:00';
|
16010
|
}
|
16011
|
cols.push({
|
16012
|
//xtype: 'minovatimecolumn',
|
16013
|
xtype: 'timefield',
|
16014
|
format: 'H:i',
|
16015
|
submitFormat: 'Hi',
|
16016
|
text: rec.HeaderTitle,
|
16017
|
dataIndex: rec.FieldName,
|
16018
|
hidden: Hidden_,
|
16019
|
//renderer: Ext.util.Format.dateRenderer('G:i'),
|
16020
|
filter: {
|
16021
|
itemDefaults: {
|
16022
|
emptyText: 'Search for...'
|
16023
|
}
|
16024
|
},
|
16025
|
editor: {
|
16026
|
allowBlank: null_,
|
16027
|
xtype: 'timefield',
|
16028
|
readOnly: ReadOnly_,
|
16029
|
id: tableName + rec.FieldName,
|
16030
|
format: 'H:i',
|
16031
|
submitFormat: 'Hi',
|
16032
|
increment: 5,
|
16033
|
value: DefaultValue,
|
16034
|
anchor: '100%',
|
16035
|
listeners: {}
|
16036
|
//renderer: Ext.util.Format.dateRenderer('G:i'),
|
16037
|
}
|
16038
|
});
|
16039
|
break
|
16040
|
default:
|
16041
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
|
16042
|
cols.push({
|
16043
|
text: rec.HeaderTitle,
|
16044
|
dataIndex: rec.FieldName,
|
16045
|
width: 100,
|
16046
|
filter: {
|
16047
|
type: 'string',
|
16048
|
itemDefaults: {
|
16049
|
emptyText: 'Search for...'
|
16050
|
}
|
16051
|
}
|
16052
|
});
|
16053
|
} else if (rec.SearchType == '0') {
|
16054
|
var valueField = null;
|
16055
|
var displayValue = null;
|
16056
|
var TableRef = undefined;
|
16057
|
if (rec.TableRef != '') {
|
16058
|
TableRef = rec.TableRef;
|
16059
|
|
16060
|
Ext.Ajax.request({
|
16061
|
async: false,
|
16062
|
method: 'POST',
|
16063
|
url: '/UserControl/GetStore',
|
16064
|
params: {
|
16065
|
tableName: 'SDATATABLEFIELD',
|
16066
|
param: 'TableName[equal]' + rec.TableRef
|
16067
|
},
|
16068
|
success: function (response) {
|
16069
|
var results = Ext.decode(response.responseText);
|
16070
|
data_ = results.data;
|
16071
|
if (data_ != undefined) {
|
16072
|
valueField_ = $.grep(data_, function (r) {
|
16073
|
return r.ValueField == '1'
|
16074
|
});
|
16075
|
valueField = valueField_[0].FieldName
|
16076
|
displayValue_ = $.grep(data_, function (r) {
|
16077
|
return r.DisplayValue == '1'
|
16078
|
});
|
16079
|
displayValue = displayValue_[0].FieldName
|
16080
|
}
|
16081
|
}
|
16082
|
});
|
16083
|
|
16084
|
//create Store
|
16085
|
Ext.create('Ext.data.Store', {
|
16086
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
16087
|
autoLoad: true,
|
16088
|
proxy: {
|
16089
|
method: 'POST',
|
16090
|
type: 'ajax',
|
16091
|
url: '/UserControl/GetStore',
|
16092
|
extraParams: {
|
16093
|
tableName: TableRef,
|
16094
|
param: rec.ParamCombo
|
16095
|
},
|
16096
|
reader: {
|
16097
|
type: 'json',
|
16098
|
root: 'data',
|
16099
|
totalProperty: 'data[0].TotalCount'
|
16100
|
}
|
16101
|
}
|
16102
|
});
|
16103
|
} else if (rec.FixedValue != '') {
|
16104
|
var storeData = [];
|
16105
|
var str = rec.FixedValue;
|
16106
|
var hasil = str.split('||');
|
16107
|
hasil.forEach(function (h) {
|
16108
|
store_ = h.split('=')
|
16109
|
storeData.push({
|
16110
|
code: store_[0],
|
16111
|
desc: store_[1],
|
16112
|
|
16113
|
});
|
16114
|
});
|
16115
|
|
16116
|
valueField = 'code';
|
16117
|
displayValue = 'desc';
|
16118
|
|
16119
|
Ext.create('Ext.data.Store', {
|
16120
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
16121
|
autoLoad: true,
|
16122
|
data: storeData
|
16123
|
})
|
16124
|
}
|
16125
|
|
16126
|
cols.push({
|
16127
|
xtype: 'minovacombocolumn',
|
16128
|
hidden: Hidden_,
|
16129
|
text: rec.HeaderTitle,
|
16130
|
dataIndex: rec.FieldName,
|
16131
|
valueField: valueField,
|
16132
|
displayField: displayValue,
|
16133
|
store: 'store_' + me.tableName + rec.FieldName,
|
16134
|
editor: {
|
16135
|
allowBlank: null_,
|
16136
|
xtype: 'combobox',
|
16137
|
readOnly: ReadOnly_,
|
16138
|
id: tableName + rec.FieldName,
|
16139
|
nameTable: rec.TableName,
|
16140
|
fieldGrid: rec.FieldName,
|
16141
|
valueField: valueField,
|
16142
|
displayField: displayValue,
|
16143
|
|
16144
|
store: 'store_' + me.tableName + rec.FieldName,
|
16145
|
},
|
16146
|
filter: {
|
16147
|
type: 'list',
|
16148
|
itemDefaults: {
|
16149
|
emptyText: 'Search for...'
|
16150
|
}
|
16151
|
}
|
16152
|
});
|
16153
|
|
16154
|
} else if (rec.SearchType == '5') {
|
16155
|
var valueField = null;
|
16156
|
var displayValue = null;
|
16157
|
var AdditionaldisplayValue = null;
|
16158
|
var TableRef = undefined;
|
16159
|
if (rec.TableRef != '') {
|
16160
|
TableRef = rec.TableRef;
|
16161
|
Ext.Ajax.request({
|
16162
|
async: false,
|
16163
|
method: 'POST',
|
16164
|
url: '/UserControl/GetStore',
|
16165
|
params: {
|
16166
|
tableName: 'SDATATABLEFIELD',
|
16167
|
param: 'TableName[equal]' + rec.TableRef
|
16168
|
},
|
16169
|
success: function (response) {
|
16170
|
var results = Ext.decode(response.responseText);
|
16171
|
data_ = results.data;
|
16172
|
if (data_ != undefined) {
|
16173
|
valueField_ = $.grep(data_, function (r) {
|
16174
|
return r.ValueField == '1'
|
16175
|
});
|
16176
|
if (valueField_.length > 0) {
|
16177
|
valueField = valueField_[0].FieldName
|
16178
|
}
|
16179
|
|
16180
|
displayValue_ = $.grep(data_, function (r) {
|
16181
|
return r.DisplayValue == '1' || r.DisplayValue == '2'
|
16182
|
});
|
16183
|
if (displayValue_.length > 0) {
|
16184
|
displayValue = displayValue_[0].FieldName;
|
16185
|
}
|
16186
|
if (displayValue_.length >= 2) {
|
16187
|
AdditionaldisplayValue = displayValue_[1].FieldName
|
16188
|
}
|
16189
|
}
|
16190
|
}
|
16191
|
});
|
16192
|
}
|
16193
|
Ext.create('Ext.data.Store', {
|
16194
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
16195
|
autoLoad: true,
|
16196
|
proxy: {
|
16197
|
method: 'POST',
|
16198
|
type: 'ajax',
|
16199
|
url: '/UserControl/GetStoreAuth',
|
16200
|
extraParams: {
|
16201
|
tableName: TableRef,
|
16202
|
param: rec.ParamCombo,
|
16203
|
menuId: MinovaUtil.GetMenuID()
|
16204
|
},
|
16205
|
reader: {
|
16206
|
type: 'json',
|
16207
|
root: 'data',
|
16208
|
totalProperty: 'data[0].TotalCount'
|
16209
|
}
|
16210
|
}
|
16211
|
});
|
16212
|
cols.push({
|
16213
|
xtype : 'minovacombocolumn',
|
16214
|
hidden: Hidden_,
|
16215
|
text: rec.HeaderTitle,
|
16216
|
dataIndex: rec.FieldName,
|
16217
|
valueField : valueField,
|
16218
|
displayField : displayValue,
|
16219
|
store : 'store_' + me.tableName + rec.FieldName,
|
16220
|
tpl: Ext.create('Ext.XTemplate',
|
16221
|
'<ul class="x-list-plain"><tpl for=".">',
|
16222
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
16223
|
'</tpl></ul>'),
|
16224
|
displayTpl: Ext.create('Ext.XTemplate',
|
16225
|
'<tpl for=".">',
|
16226
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
16227
|
'</tpl>'),
|
16228
|
editor: {
|
16229
|
allowBlank: null_,
|
16230
|
xtype: 'combobox',
|
16231
|
readOnly: ReadOnly_,
|
16232
|
id: rec.TableName + rec.FieldName,
|
16233
|
nameTable: rec.TableName,
|
16234
|
fieldGrid: rec.FieldName,
|
16235
|
valueField: valueField,
|
16236
|
displayField: displayValue,
|
16237
|
store: 'store_' + me.tableName + rec.FieldName,
|
16238
|
value: rec.DefaultValue,
|
16239
|
tpl: Ext.create('Ext.XTemplate',
|
16240
|
'<ul class="x-list-plain"><tpl for=".">',
|
16241
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
16242
|
'</tpl></ul>'),
|
16243
|
displayTpl: Ext.create('Ext.XTemplate',
|
16244
|
'<tpl for=".">',
|
16245
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
16246
|
'</tpl>')
|
16247
|
},
|
16248
|
renderer: function (value) {
|
16249
|
var store = Ext.data.StoreManager.lookup('store_' + me.tableName + rec.FieldName);
|
16250
|
var index = store.find(valueField, value);
|
16251
|
var val = "";
|
16252
|
if (index != -1) {
|
16253
|
var rc = store.getAt(index);
|
16254
|
//val = rc.get(displayValue);
|
16255
|
val = rc.get(AdditionaldisplayValue) + ' - ' + rc.get(displayValue);
|
16256
|
} else {
|
16257
|
val = value;
|
16258
|
}
|
16259
|
return val;
|
16260
|
},
|
16261
|
filter: {
|
16262
|
type: 'list',
|
16263
|
itemDefaults: {
|
16264
|
emptyText: 'Search for...'
|
16265
|
}
|
16266
|
}
|
16267
|
});
|
16268
|
} else if (rec.SearchType == '2') {
|
16269
|
var triger = (rec.TriggerCombo).split('$');
|
16270
|
var targetField_ = triger[0];
|
16271
|
var fieldValue_ = triger[1];
|
16272
|
cols.push({
|
16273
|
text: rec.HeaderTitle,
|
16274
|
hidden: Hidden_,
|
16275
|
dataIndex: rec.FieldName,
|
16276
|
filter: {
|
16277
|
itemDefaults: {
|
16278
|
emptyText: 'Search for...'
|
16279
|
}
|
16280
|
},
|
16281
|
editor: {
|
16282
|
allowBlank: null_,
|
16283
|
xtype: 'minovalookupgrid',
|
16284
|
readOnly: ReadOnly_,
|
16285
|
isGrid: true,
|
16286
|
fieldTarget: targetField_,
|
16287
|
fieldValue: fieldValue_,
|
16288
|
isGrid: true,
|
16289
|
id: tableName + rec.FieldName,
|
16290
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
16291
|
triggerCls: 'x-form-search-trigger',
|
16292
|
vtype: 'alphanum', // disable space
|
16293
|
nameTable: rec.TableName,
|
16294
|
fieldGrid: rec.FieldName,
|
16295
|
listeners: {
|
16296
|
change: function (val) {
|
16297
|
var custumFunc = rec.SelectFunction;
|
16298
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
16299
|
Ext.Ajax.request({
|
16300
|
async: false,
|
16301
|
method: 'POST',
|
16302
|
url: '/UserControl/GetStore',
|
16303
|
params: {
|
16304
|
tableName: 'PCMFUNC',
|
16305
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
16306
|
},
|
16307
|
success: function (response) {
|
16308
|
var results = Ext.decode(response.responseText);
|
16309
|
data_ = results.data[0];
|
16310
|
if (data_ != undefined) {
|
16311
|
custumFunc = data_.FunctionCode;
|
16312
|
}
|
16313
|
}
|
16314
|
});
|
16315
|
}
|
16316
|
if (custumFunc) {
|
16317
|
eval(custumFunc)
|
16318
|
}
|
16319
|
}
|
16320
|
}
|
16321
|
}
|
16322
|
});
|
16323
|
} else if (rec.SearchType == '3') {
|
16324
|
cols.push({
|
16325
|
text: rec.HeaderTitle,
|
16326
|
hidden: Hidden_,
|
16327
|
dataIndex: rec.FieldName,
|
16328
|
filter: {
|
16329
|
itemDefaults: {
|
16330
|
emptyText: 'Search for...'
|
16331
|
}
|
16332
|
},
|
16333
|
editor: {
|
16334
|
allowBlank: null_,
|
16335
|
// xtype: 'minovalookuptreePopup',
|
16336
|
xtype: 'MinovaLookupTree',
|
16337
|
readOnly: ReadOnly_,
|
16338
|
id: tableName + rec.FieldName,
|
16339
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
16340
|
triggerCls: 'x-form-search-trigger',
|
16341
|
vtype: 'alphanum', // disable space
|
16342
|
treeSructure: rec.SearchFunction, //'O-O-P',
|
16343
|
objClassValue: rec.ParamCombo, //'O',
|
16344
|
nameTable: rec.TableName,
|
16345
|
fieldGrid: rec.FieldName,
|
16346
|
listeners: {
|
16347
|
change: function (val) {
|
16348
|
var custumFunc = rec.SelectFunction;
|
16349
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
16350
|
Ext.Ajax.request({
|
16351
|
async: false,
|
16352
|
method: 'POST',
|
16353
|
url: '/UserControl/GetStore',
|
16354
|
params: {
|
16355
|
tableName: 'PCMFUNC',
|
16356
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
16357
|
},
|
16358
|
success: function (response) {
|
16359
|
var results = Ext.decode(response.responseText);
|
16360
|
data_ = results.data[0];
|
16361
|
if (data_ != undefined) {
|
16362
|
custumFunc = data_.FunctionCode;
|
16363
|
}
|
16364
|
}
|
16365
|
});
|
16366
|
}
|
16367
|
if (custumFunc) {
|
16368
|
eval(custumFunc)
|
16369
|
}
|
16370
|
}
|
16371
|
}
|
16372
|
}
|
16373
|
});
|
16374
|
} else if (rec.SearchType != '0' && rec.SearchType != '1' && rec.SearchType != '3' && (rec.FieldName == 'EmployeeID' || rec.FieldName == 'ApplicantID' || rec.FieldName == 'EmployeeIDFrom' || rec.FieldName == 'EmployeeIDTo') && isLookup != true) {
|
16375
|
var triger = (rec.TriggerCombo).split('&');
|
16376
|
var targetField_ = triger[0];
|
16377
|
var fieldValue_ = triger[0];
|
16378
|
cols.push({
|
16379
|
text: rec.HeaderTitle,
|
16380
|
hidden: Hidden_,
|
16381
|
dataIndex: rec.FieldName,
|
16382
|
filter: {
|
16383
|
itemDefaults: {
|
16384
|
emptyText: 'Search for...'
|
16385
|
}
|
16386
|
},
|
16387
|
editor: {
|
16388
|
allowBlank: null_,
|
16389
|
xtype: 'lookupemployee',
|
16390
|
readOnly: ReadOnly_,
|
16391
|
isGrid: true,
|
16392
|
fieldTarget: targetField_,
|
16393
|
fieldValue: fieldValue_,
|
16394
|
isGrid: true,
|
16395
|
id: tableName + rec.FieldName,
|
16396
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
16397
|
triggerCls: 'x-form-search-trigger',
|
16398
|
vtype: 'alphanum', // disable space
|
16399
|
nameTable: rec.TableName,
|
16400
|
fieldGrid: rec.FieldName,
|
16401
|
listeners: {
|
16402
|
change: function (val) {
|
16403
|
var custumFunc = rec.SelectFunction;
|
16404
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
16405
|
Ext.Ajax.request({
|
16406
|
async: false,
|
16407
|
method: 'POST',
|
16408
|
url: '/UserControl/GetStore',
|
16409
|
params: {
|
16410
|
tableName: 'PCMFUNC',
|
16411
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
16412
|
},
|
16413
|
success: function (response) {
|
16414
|
var results = Ext.decode(response.responseText);
|
16415
|
data_ = results.data[0];
|
16416
|
if (data_ != undefined) {
|
16417
|
custumFunc = data_.FunctionCode;
|
16418
|
}
|
16419
|
}
|
16420
|
});
|
16421
|
}
|
16422
|
if (custumFunc) {
|
16423
|
eval(custumFunc)
|
16424
|
}
|
16425
|
}
|
16426
|
}
|
16427
|
}
|
16428
|
});
|
16429
|
} else if (rec.SearchType == '4' && isLookup != true) {
|
16430
|
cols.push({
|
16431
|
|
16432
|
text: rec.HeaderTitle,
|
16433
|
hidden: Hidden_,
|
16434
|
dataIndex: rec.FieldName,
|
16435
|
filter: {
|
16436
|
itemDefaults: {
|
16437
|
emptyText: 'Search for...'
|
16438
|
}
|
16439
|
},
|
16440
|
editor: {
|
16441
|
allowBlank: null_,
|
16442
|
xtype: 'lookupemployee',
|
16443
|
readOnly: ReadOnly_,
|
16444
|
isGrid: true,
|
16445
|
fieldTarget: targetField_,
|
16446
|
fieldValue: fieldValue_,
|
16447
|
isGrid: true,
|
16448
|
id: tableName + rec.FieldName,
|
16449
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
16450
|
triggerCls: 'x-form-search-trigger',
|
16451
|
vtype: 'alphanum', // disable space
|
16452
|
nameTable: rec.TableName,
|
16453
|
fieldGrid: rec.FieldName,
|
16454
|
listeners: {
|
16455
|
change: function (val) {
|
16456
|
var custumFunc = rec.SelectFunction;
|
16457
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
16458
|
Ext.Ajax.request({
|
16459
|
async: false,
|
16460
|
method: 'POST',
|
16461
|
url: '/UserControl/GetStore',
|
16462
|
params: {
|
16463
|
tableName: 'PCMFUNC',
|
16464
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
16465
|
},
|
16466
|
success: function (response) {
|
16467
|
var results = Ext.decode(response.responseText);
|
16468
|
data_ = results.data[0];
|
16469
|
if (data_ != undefined) {
|
16470
|
custumFunc = data_.FunctionCode;
|
16471
|
}
|
16472
|
}
|
16473
|
});
|
16474
|
}
|
16475
|
if (custumFunc) {
|
16476
|
eval(custumFunc)
|
16477
|
}
|
16478
|
}
|
16479
|
}
|
16480
|
}
|
16481
|
});
|
16482
|
} else {
|
16483
|
cols.push({
|
16484
|
text: rec.HeaderTitle,
|
16485
|
hidden: Hidden_,
|
16486
|
dataIndex: rec.FieldName,
|
16487
|
filter: {
|
16488
|
itemDefaults: {
|
16489
|
emptyText: 'Search for...'
|
16490
|
}
|
16491
|
},
|
16492
|
editor: {
|
16493
|
allowBlank: null_,
|
16494
|
xtype: 'textfield',
|
16495
|
readOnly: ReadOnly_,
|
16496
|
id: tableName + rec.FieldName,
|
16497
|
nameTable: rec.TableName,
|
16498
|
fieldGrid: rec.FieldName,
|
16499
|
listeners: {
|
16500
|
change: function (val) {
|
16501
|
var custumFunc = null;
|
16502
|
Ext.Ajax.request({
|
16503
|
async: false,
|
16504
|
method: 'POST',
|
16505
|
url: '/UserControl/GetStore',
|
16506
|
params: {
|
16507
|
tableName: 'SDATATABLEFIELD',
|
16508
|
param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
|
16509
|
},
|
16510
|
success: function (response) {
|
16511
|
var results = Ext.decode(response.responseText);
|
16512
|
data_ = results.data[0];
|
16513
|
if (data_ != undefined) {
|
16514
|
custumFunc = data_.SelectFunction;
|
16515
|
//console.log(data_)
|
16516
|
}
|
16517
|
}
|
16518
|
});
|
16519
|
if (custumFunc) {
|
16520
|
eval(custumFunc)
|
16521
|
}
|
16522
|
}
|
16523
|
}
|
16524
|
}
|
16525
|
});
|
16526
|
}
|
16527
|
break
|
16528
|
}
|
16529
|
}
|
16530
|
} else {
|
16531
|
cols.push({
|
16532
|
text: rec.HeaderTitle,
|
16533
|
hidden: Hidden_,
|
16534
|
dataIndex: rec.FieldName,
|
16535
|
hidden: true,
|
16536
|
editor: {
|
16537
|
allowBlank: true,
|
16538
|
xtype: 'textfield',
|
16539
|
readOnly: ReadOnly_,
|
16540
|
id: tableName + rec.FieldName,
|
16541
|
nameTable: rec.TableName,
|
16542
|
fieldGrid: rec.FieldName,
|
16543
|
},
|
16544
|
filter: {
|
16545
|
itemDefaults: {
|
16546
|
emptyText: 'Search for...'
|
16547
|
}
|
16548
|
}
|
16549
|
});
|
16550
|
}
|
16551
|
})
|
16552
|
}
|
16553
|
addData = addData + "}";
|
16554
|
|
16555
|
cols.push({
|
16556
|
text: 'Action',
|
16557
|
width: 100,
|
16558
|
xtype: 'actioncolumn',
|
16559
|
tooltip: 'View Data',
|
16560
|
name: 'Action',
|
16561
|
itemId: 'Action',
|
16562
|
align: 'center',
|
16563
|
iconCls: 'fa-edit',
|
16564
|
renderer: function (value, metadata, record) {
|
16565
|
metadata.tdStyle = 'font-family: FontAwesome'
|
16566
|
},
|
16567
|
handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
|
16568
|
var main_ = Ext.ComponentQuery.query('[name=grid' + me.tableName + ']')[0];
|
16569
|
this.fireEvent("onEditClick");
|
16570
|
}
|
16571
|
});
|
16572
|
|
16573
|
Ext.applyIf(me, {
|
16574
|
|
16575
|
items: [{
|
16576
|
xtype: 'treepanel',
|
16577
|
id: gridName,
|
16578
|
name: gridName,
|
16579
|
height: height,
|
16580
|
width: 'fit',
|
16581
|
autoHeight: true,
|
16582
|
//store: 'gridStore',
|
16583
|
autoLoad: false,
|
16584
|
autoScroll: true,
|
16585
|
useArrows: true,
|
16586
|
animate: false,
|
16587
|
rootVisible: false,
|
16588
|
plugins: [
|
16589
|
Ext.create('Ext.grid.plugin.CellEditing', {
|
16590
|
clicksToEdit: 2
|
16591
|
})
|
16592
|
],
|
16593
|
root: {
|
16594
|
expanded: true,
|
16595
|
nodeType: 'async',
|
16596
|
ext: 'Favorites',
|
16597
|
id: 'null'
|
16598
|
},
|
16599
|
columns: cols,
|
16600
|
//selType: 'rowmodel',
|
16601
|
}
|
16602
|
]
|
16603
|
|
16604
|
});
|
16605
|
|
16606
|
me.callParent(arguments);
|
16607
|
}
|
16608
|
});
|
16609
|
/*Add by Taufan ( Tab List MasterData For ERP )*/
|
16610
|
Ext.define('MinovaUtil.MinovaES.MinovaTabListMasterData', {
|
16611
|
extend: 'Ext.tab.Panel',
|
16612
|
alias: ['widget.masterdatatablist'],
|
16613
|
moduleType: undefined,
|
16614
|
tablenameheader: undefined,
|
16615
|
langId: undefined,
|
16616
|
param: undefined,
|
16617
|
layout: 'fit',
|
16618
|
name: 'panelTab',
|
16619
|
id: 'mainTab',
|
16620
|
initComponent: function () {
|
16621
|
var me = this;
|
16622
|
var hasil = null;
|
16623
|
var action = "0";
|
16624
|
var _items = [];
|
16625
|
var act = getParam("action");
|
16626
|
if (act == 'add') {
|
16627
|
action = '0';
|
16628
|
}
|
16629
|
if (act == 'edit') {
|
16630
|
action = '1';
|
16631
|
}
|
16632
|
if (act == 'view') {
|
16633
|
action = '1';
|
16634
|
}
|
16635
|
if (act == 'copy') {
|
16636
|
action = '0';
|
16637
|
}
|
16638
|
Ext.Ajax.request({
|
16639
|
async: false,
|
16640
|
method: 'POST',
|
16641
|
url: '/UserControl/GetStore',
|
16642
|
params: {
|
16643
|
tableName: 'PCMEPMDLIST',
|
16644
|
param: 'ModuleType[=]' + me.moduleType + ',Language[=]' + me.langId
|
16645
|
},
|
16646
|
success: function (response) {
|
16647
|
var results = Ext.decode(response.responseText);
|
16648
|
hasil = results.data;
|
16649
|
}
|
16650
|
});
|
16651
|
hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
|
16652
|
if (hasil.length > 0) {
|
16653
|
Ext.each(hasil, function (rec) {
|
16654
|
if (rec.LayoutType == "L004") { // L004=Custom
|
16655
|
var pnl = Ext.create(rec.CustomLayout, {
|
16656
|
title: rec.LabelName,
|
16657
|
tableName: rec.TableName,
|
16658
|
height: 450,
|
16659
|
name: 'panelTab' + rec.TableName,
|
16660
|
tbl: rec.TableName,
|
16661
|
layoutType: rec.LayoutType
|
16662
|
});
|
16663
|
_items.push(pnl)
|
16664
|
} else if (rec.LayoutType == "L002" || rec.LayoutType == "L003") {
|
16665
|
_items.push({
|
16666
|
xtype: 'panel',
|
16667
|
title: rec.LabelName,
|
16668
|
name: 'panelTab' + rec.TableName,
|
16669
|
tbl: rec.TableName,
|
16670
|
layoutType: rec.LayoutType,
|
16671
|
items: [{
|
16672
|
xtype: 'minovagrid1',
|
16673
|
height: 450,
|
16674
|
tableName: rec.TableName,
|
16675
|
storename: 'store' + rec.TableName,
|
16676
|
pagesize: 25,
|
16677
|
name: 'GRID' + rec.TableName,
|
16678
|
margin: '0 0 10 0',
|
16679
|
autoLoad: false,
|
16680
|
tbar: [{
|
16681
|
xtype: 'button',
|
16682
|
text: 'Action',
|
16683
|
name: 'actionGrid' + rec.TableName,
|
16684
|
menu: [{
|
16685
|
text: 'Add',
|
16686
|
name: 'add' + rec.TableName,
|
16687
|
tbl: rec.TableName,
|
16688
|
style: 'font-family: FontAwesome',
|
16689
|
iconCls: 'fa-plus-circle',
|
16690
|
handler: function () {
|
16691
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
16692
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
16693
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
16694
|
var keyField = getParam("KeyID");
|
16695
|
var keyValue = getParam("KeyValue");
|
16696
|
frmDisplay.reset();
|
16697
|
frmForm.reset();
|
16698
|
var idseq = 0;
|
16699
|
var params = {
|
16700
|
apiController: 'api/Devt',
|
16701
|
methodName: 'GetLastSeqID',
|
16702
|
parameter: 'tableName=' + rec.TableName + '&keyField=' + keyField + '&keyValue=' + keyValue
|
16703
|
};
|
16704
|
MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
|
16705
|
var result = Ext.decode(xhr.responseText);
|
16706
|
var r = Ext.decode(result.data);
|
16707
|
idseq = r.data + 1;
|
16708
|
frmForm.getForm().findField(keyField).setValue(keyValue);
|
16709
|
frmForm.getForm().findField("SeqID").setValue(idseq);
|
16710
|
});
|
16711
|
frmDisplay.setHidden(true);
|
16712
|
frmForm.setHidden(false);
|
16713
|
grdPanel.setHidden(true);
|
16714
|
action = "0";
|
16715
|
}
|
16716
|
}, {
|
16717
|
text: 'Copy',
|
16718
|
name: 'copy' + rec.TableName,
|
16719
|
tbl: rec.TableName,
|
16720
|
iconCls: 'fa-copy',
|
16721
|
style: 'font-family: FontAwesome',
|
16722
|
handler: function () {
|
16723
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
16724
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
16725
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
16726
|
var dtrec = grdPanel.getView().getSelectionModel().getSelection()[0];
|
16727
|
var keyField = getParam("KeyID");
|
16728
|
if (dtrec) {
|
16729
|
frmDisplay.reset();
|
16730
|
frmForm.reset();
|
16731
|
frmForm.getForm().setValues(dtrec.data);
|
16732
|
frmDisplay.setHidden(true);
|
16733
|
frmForm.setHidden(false);
|
16734
|
grdPanel.setHidden(true);
|
16735
|
action = "0";
|
16736
|
frmForm.getForm().findField(keyField).setValue("");
|
16737
|
}
|
16738
|
}
|
16739
|
}, {
|
16740
|
text: 'Edit',
|
16741
|
name: 'edit' + rec.TableName,
|
16742
|
tbl: rec.TableName,
|
16743
|
iconCls: 'fa-edit',
|
16744
|
style: 'font-family: FontAwesome',
|
16745
|
handler: function () {
|
16746
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
16747
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
16748
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
16749
|
var dtrec = grdPanel.getView().getSelectionModel().getSelection()[0];
|
16750
|
if (dtrec) {
|
16751
|
frmDisplay.reset();
|
16752
|
frmForm.reset();
|
16753
|
frmForm.getForm().setValues(dtrec.data);
|
16754
|
frmDisplay.setHidden(true);
|
16755
|
frmForm.setHidden(false);
|
16756
|
grdPanel.setHidden(true);
|
16757
|
action = "1";
|
16758
|
}
|
16759
|
}
|
16760
|
}
|
16761
|
]
|
16762
|
}, {
|
16763
|
xtype: 'tbfill'
|
16764
|
}, {
|
16765
|
text: 'Clear Filters',
|
16766
|
tooltip: 'Clear all filters',
|
16767
|
name: 'clearbtn',
|
16768
|
handler: function () {}
|
16769
|
}
|
16770
|
],
|
16771
|
dockedItems: [{
|
16772
|
xtype: 'pagingtoolbar',
|
16773
|
store: 'store' + rec.TableName,
|
16774
|
dock: 'bottom',
|
16775
|
pageSize: me.pagesize,
|
16776
|
displayInfo: true
|
16777
|
}
|
16778
|
],
|
16779
|
listeners: {
|
16780
|
'itemdblclick': function (me, record, item, index, e, eOpts) {
|
16781
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
16782
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
16783
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
16784
|
frmDisplay.reset();
|
16785
|
frmForm.reset();
|
16786
|
frmDisplay.getForm().setValues(record.data);
|
16787
|
frmForm.getForm().setValues(record.data);
|
16788
|
frmDisplay.setHidden(false);
|
16789
|
frmForm.setHidden(true);
|
16790
|
grdPanel.setHidden(true);
|
16791
|
action = "1";
|
16792
|
}
|
16793
|
}
|
16794
|
}, {
|
16795
|
xtype: 'minovaform',
|
16796
|
name: 'DISPLAY' + rec.TableName,
|
16797
|
id: 'DISPLAY' + rec.TableName,
|
16798
|
itemId: 'DISPLAY' + rec.TableName,
|
16799
|
tableName: rec.TableName,
|
16800
|
isDisplay: true,
|
16801
|
hidden: true,
|
16802
|
buttons: [{
|
16803
|
text: 'Edit',
|
16804
|
name: 'editDISPLAY' + rec.TableName,
|
16805
|
iconCls: 'fa-edit',
|
16806
|
style: 'font-family: FontAwesome',
|
16807
|
handler: function () {
|
16808
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
16809
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
16810
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
16811
|
frmDisplay.setHidden(true);
|
16812
|
frmForm.setHidden(false);
|
16813
|
grdPanel.setHidden(true);
|
16814
|
}
|
16815
|
}, {
|
16816
|
text: 'Cancel',
|
16817
|
name: 'cancelDISPLAY' + rec.TableName,
|
16818
|
iconCls: 'fa-reply',
|
16819
|
style: 'font-family: FontAwesome',
|
16820
|
handler: function () {
|
16821
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
16822
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
16823
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
16824
|
frmDisplay.setHidden(true);
|
16825
|
frmForm.setHidden(true);
|
16826
|
grdPanel.setHidden(false);
|
16827
|
grdPanel.getStore().reload();
|
16828
|
}
|
16829
|
}
|
16830
|
]
|
16831
|
}, {
|
16832
|
xtype: 'minovaform',
|
16833
|
name: 'FORM' + rec.TableName,
|
16834
|
id: 'FORM' + rec.TableName,
|
16835
|
itemId: 'FORM' + rec.TableName,
|
16836
|
tableName: rec.TableName,
|
16837
|
isDisplay: false,
|
16838
|
hidden: true,
|
16839
|
buttons: [{
|
16840
|
text: 'Save',
|
16841
|
name: 'saveFORM' + rec.TableName,
|
16842
|
iconCls: 'fa-save',
|
16843
|
style: 'font-family: FontAwesome',
|
16844
|
handler: function () {
|
16845
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
16846
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
16847
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
16848
|
var frm = frmForm.getForm();
|
16849
|
console.log(frmForm);
|
16850
|
if (frm.isValid()) {
|
16851
|
var keyField = getParam("KeyID");
|
16852
|
var table = rec.TableName;
|
16853
|
var data = Ext.encode(frmForm.getValues());
|
16854
|
var token = MinovaUtil.SESSIONS.Token;
|
16855
|
var params = {
|
16856
|
apiController: 'api/Devt',
|
16857
|
methodName: 'SaveTableMaster',
|
16858
|
parameter: 'tableName=' + table + '&data=' + data + '&action=' + action + '&token=' + token
|
16859
|
};
|
16860
|
MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
|
16861
|
var result = Ext.decode(xhr.responseText);
|
16862
|
var r = Ext.decode(result.data);
|
16863
|
if (r.success) {
|
16864
|
frmDisplay.setHidden(true);
|
16865
|
frmForm.setHidden(true);
|
16866
|
grdPanel.setHidden(false);
|
16867
|
grdPanel.getStore().reload();
|
16868
|
MinovaMessage('Not Null', '000006', '', 'S');
|
16869
|
} else {
|
16870
|
MinovaMessage(' Not Null ', ' 000005 ', r.message.text, 'E');
|
16871
|
}
|
16872
|
});
|
16873
|
}
|
16874
|
}
|
16875
|
}, {
|
16876
|
text: 'Delete',
|
16877
|
name: 'deleteFORM' + rec.TableName,
|
16878
|
iconCls: 'fa-trash-o',
|
16879
|
style: 'font-family: FontAwesome ',
|
16880
|
handler: function () {
|
16881
|
alert('Delete Function');
|
16882
|
MinovaMessage(' Message ', ' 000007 ', ' ', 'C', function (respone) {
|
16883
|
if (respone == "yes") {
|
16884
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
16885
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
16886
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
16887
|
var frm = frmForm.getForm();
|
16888
|
if (frm.isValid()) {
|
16889
|
var keyField = getParam("KeyID");
|
16890
|
var table = rec.TableName;
|
16891
|
var data = Ext.encode(frmForm.getValues());
|
16892
|
var token = MinovaUtil.SESSIONS.Token;
|
16893
|
action = "2";
|
16894
|
var params = {
|
16895
|
apiController: 'api/Devt',
|
16896
|
methodName: 'SaveTableMaster',
|
16897
|
parameter: 'tableName=' + table + '&data=' + data + '&action=' + action + '&token=' + token
|
16898
|
};
|
16899
|
MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
|
16900
|
var result = Ext.decode(xhr.responseText);
|
16901
|
var r = Ext.decode(result.data);
|
16902
|
if (r.success) {
|
16903
|
frmDisplay.setHidden(true);
|
16904
|
frmForm.setHidden(true);
|
16905
|
grdPanel.setHidden(false);
|
16906
|
grdPanel.getStore().reload();
|
16907
|
MinovaMessage('Not Null', '000006', '', 'S');
|
16908
|
} else {
|
16909
|
MinovaMessage(' Not Null ', ' 000005 ', r.message.text, 'E');
|
16910
|
}
|
16911
|
});
|
16912
|
}
|
16913
|
}
|
16914
|
});
|
16915
|
}
|
16916
|
}, {
|
16917
|
text: 'Cancel',
|
16918
|
name: 'cancelFORM' + rec.TableName,
|
16919
|
iconCls: 'fa-reply',
|
16920
|
style: 'font-family: FontAwesome',
|
16921
|
handler: function () {
|
16922
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
16923
|
if (respone == "yes") {
|
16924
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
16925
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
16926
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
16927
|
frmDisplay.setHidden(true);
|
16928
|
frmForm.setHidden(true);
|
16929
|
grdPanel.setHidden(false);
|
16930
|
grdPanel.getStore().reload();
|
16931
|
}
|
16932
|
});
|
16933
|
}
|
16934
|
}
|
16935
|
]
|
16936
|
}
|
16937
|
]
|
16938
|
});
|
16939
|
} else if (rec.LayoutType == "L005") { // Grid View Only
|
16940
|
_items.push({
|
16941
|
xtype: 'panel',
|
16942
|
title: rec.LabelName,
|
16943
|
name: 'panelTab' + rec.TableName,
|
16944
|
tbl: rec.TableName,
|
16945
|
layoutType: rec.LayoutType,
|
16946
|
items: [{
|
16947
|
xtype: 'minovagrid1',
|
16948
|
height: 450,
|
16949
|
tableName: rec.TableName,
|
16950
|
storename: 'store' + rec.TableName,
|
16951
|
pagesize: 25,
|
16952
|
name: 'GRID' + rec.TableName,
|
16953
|
margin: '0 0 10 0',
|
16954
|
autoLoad: false,
|
16955
|
tbar: [{
|
16956
|
xtype: 'tbfill'
|
16957
|
}, {
|
16958
|
text: 'Clear Filters',
|
16959
|
tooltip: 'Clear all filters',
|
16960
|
name: 'clearbtn',
|
16961
|
handler: function () {}
|
16962
|
}
|
16963
|
],
|
16964
|
dockedItems: [{
|
16965
|
xtype: 'pagingtoolbar',
|
16966
|
store: 'store' + rec.TableName,
|
16967
|
dock: 'bottom',
|
16968
|
pageSize: me.pagesize,
|
16969
|
displayInfo: true
|
16970
|
}
|
16971
|
]
|
16972
|
}
|
16973
|
]
|
16974
|
});
|
16975
|
} else { // L001=Default Form Only
|
16976
|
_items.push({
|
16977
|
xtype: 'panel',
|
16978
|
title: rec.LabelName,
|
16979
|
name: 'panelTab' + rec.TableName,
|
16980
|
tbl: rec.TableName,
|
16981
|
layoutType: rec.LayoutType,
|
16982
|
items: [{
|
16983
|
xtype: 'minovaform',
|
16984
|
name: 'DISPLAY' + rec.TableName,
|
16985
|
id: 'DISPLAY' + rec.TableName,
|
16986
|
itemId: 'DISPLAY' + rec.TableName,
|
16987
|
tableName: rec.TableName,
|
16988
|
isDisplay: true,
|
16989
|
hidden: false,
|
16990
|
buttons: [{
|
16991
|
text: 'Edit',
|
16992
|
name: 'editDISPLAY' + rec.TableName,
|
16993
|
iconCls: 'fa-edit',
|
16994
|
style: 'font-family: FontAwesome',
|
16995
|
handler: function () {
|
16996
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
16997
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
16998
|
frmDisplay.setHidden(true);
|
16999
|
frmForm.setHidden(false);
|
17000
|
action = "1";
|
17001
|
}
|
17002
|
}, {
|
17003
|
text: 'Cancel',
|
17004
|
name: 'cancelDISPLAY' + rec.TableName,
|
17005
|
iconCls: 'fa-reply',
|
17006
|
style: 'font-family: FontAwesome',
|
17007
|
hidden: true
|
17008
|
}
|
17009
|
]
|
17010
|
}, {
|
17011
|
xtype: 'minovaform',
|
17012
|
name: 'FORM' + rec.TableName,
|
17013
|
id: 'FORM' + rec.TableName,
|
17014
|
itemId: 'FORM' + rec.TableName,
|
17015
|
tableName: rec.TableName,
|
17016
|
isDisplay: false,
|
17017
|
hidden: true,
|
17018
|
buttons: [{
|
17019
|
text: 'Save',
|
17020
|
name: 'saveDISPLAY' + rec.TableName,
|
17021
|
iconCls: 'fa-save',
|
17022
|
style: 'font-family: FontAwesome',
|
17023
|
handler: function () {
|
17024
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17025
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17026
|
var headerDisplay = Ext.ComponentQuery.query('[name=MainHeaderMDLogistic]')[0];
|
17027
|
var frm = frmForm.getForm();
|
17028
|
if (frm.isValid()) {
|
17029
|
var keyField = getParam("KeyID");
|
17030
|
var table = rec.TableName;
|
17031
|
var data = Ext.encode(frmForm.getValues());
|
17032
|
var token = MinovaUtil.SESSIONS.Token;
|
17033
|
var params = {
|
17034
|
apiController: 'api/Devt',
|
17035
|
methodName: 'SaveTableMaster',
|
17036
|
parameter: 'tableName=' + table + '&data=' + data + '&action=' + action + '&token=' + token
|
17037
|
};
|
17038
|
MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
|
17039
|
var result = Ext.decode(xhr.responseText);
|
17040
|
var r = Ext.decode(result.data);
|
17041
|
if (r.success) {
|
17042
|
headerDisplay.mask("Loading...");
|
17043
|
var idNo = r.data;
|
17044
|
frmForm.getForm().findField(keyField).setValue(idNo);
|
17045
|
frmDisplay.getForm().setValues(frmForm.getValues());
|
17046
|
headerDisplay.getForm().setValues(frmForm.getValues());
|
17047
|
frmDisplay.setHidden(false);
|
17048
|
frmForm.setHidden(true);
|
17049
|
MinovaMessage('Not Null', '000006', '', 'S');
|
17050
|
headerDisplay.unmask();
|
17051
|
} else {
|
17052
|
MinovaMessage(' Not Null ', ' 000005 ', r.message.text, 'E');
|
17053
|
}
|
17054
|
});
|
17055
|
}
|
17056
|
}
|
17057
|
}, {
|
17058
|
text: 'Delete',
|
17059
|
name: 'deleteDISPLAY' + rec.TableName,
|
17060
|
iconCls: 'fa-trash-o',
|
17061
|
style: 'font-family: FontAwesome',
|
17062
|
handler: function () {
|
17063
|
MinovaMessage(' Message ', ' 000007 ', ' ', 'C', function (respone) {
|
17064
|
if (respone == "yes") {
|
17065
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17066
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17067
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
17068
|
var frm = frmForm.getForm();
|
17069
|
if (frm.isValid()) {
|
17070
|
var keyField = getParam("KeyID");
|
17071
|
var table = rec.TableName;
|
17072
|
var data = Ext.encode(frmForm.getValues());
|
17073
|
var token = MinovaUtil.SESSIONS.Token;
|
17074
|
action = "2";
|
17075
|
var params = {
|
17076
|
apiController: 'api/Devt',
|
17077
|
methodName: 'SaveTableMaster',
|
17078
|
parameter: 'tableName=' + table + '&data=' + data + '&action=' + action + '&token=' + token
|
17079
|
};
|
17080
|
MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
|
17081
|
var result = Ext.decode(xhr.responseText);
|
17082
|
var r = Ext.decode(result.data);
|
17083
|
if (r.success) {
|
17084
|
frmDisplay.setHidden(true);
|
17085
|
frmForm.setHidden(true);
|
17086
|
grdPanel.setHidden(false);
|
17087
|
grdPanel.getStore().reload();
|
17088
|
MinovaMessage('Not Null', '000006', '', 'S');
|
17089
|
} else {
|
17090
|
MinovaMessage(' Not Null ', ' 000005 ', r.message.text, 'E');
|
17091
|
}
|
17092
|
});
|
17093
|
}
|
17094
|
}
|
17095
|
});
|
17096
|
}
|
17097
|
}, {
|
17098
|
text: 'Cancel',
|
17099
|
name: 'cancelDISPLAY' + rec.TableName,
|
17100
|
iconCls: 'fa-reply',
|
17101
|
style: 'font-family: FontAwesome',
|
17102
|
handler: function () {
|
17103
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
17104
|
if (respone == "yes") {
|
17105
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17106
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17107
|
frmDisplay.setHidden(false);
|
17108
|
frmForm.setHidden(true);
|
17109
|
}
|
17110
|
});
|
17111
|
}
|
17112
|
}
|
17113
|
]
|
17114
|
}
|
17115
|
]
|
17116
|
});
|
17117
|
}
|
17118
|
});
|
17119
|
}
|
17120
|
Ext.applyIf(me, {
|
17121
|
items: _items
|
17122
|
});
|
17123
|
me.callParent(arguments);
|
17124
|
}
|
17125
|
});
|
17126
|
/*Add by Taufan ( Tab List Doc Transaction For ERP )*/
|
17127
|
Ext.define('MinovaUtil.MinovaES.MinovaTabListDocTrans', {
|
17128
|
extend: 'Ext.tab.Panel',
|
17129
|
alias: ['widget.doctablist'],
|
17130
|
transType: undefined,
|
17131
|
docType: undefined,
|
17132
|
docNo: undefined,
|
17133
|
langId: undefined,
|
17134
|
param: undefined,
|
17135
|
layout: 'fit',
|
17136
|
name: 'panelTab',
|
17137
|
id: 'mainTab',
|
17138
|
action: undefined,
|
17139
|
initComponent: function () {
|
17140
|
var me = this;
|
17141
|
var documentType = me.docType;
|
17142
|
var transactionType = me.transType;
|
17143
|
var hasil = null;
|
17144
|
var _items = [];
|
17145
|
Ext.Ajax.request({
|
17146
|
async: false,
|
17147
|
method: 'POST',
|
17148
|
url: '/UserControl/GetStore',
|
17149
|
params: {
|
17150
|
tableName: 'PCMBSTRANSLIST',
|
17151
|
param: 'TransType[=]' + me.transType
|
17152
|
},
|
17153
|
success: function (response) {
|
17154
|
var results = Ext.decode(response.responseText);
|
17155
|
hasil = results.data;
|
17156
|
}
|
17157
|
});
|
17158
|
hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
|
17159
|
if (hasil.length > 0) {
|
17160
|
Ext.each(hasil, function (rec) {
|
17161
|
if (rec.LayoutType == "L004") { // L004=Custom
|
17162
|
var pnl = Ext.create(rec.CustomLayout, {
|
17163
|
title: rec.Title,
|
17164
|
tableName: rec.TableName,
|
17165
|
height: 400,
|
17166
|
name: 'panelTab' + rec.TableName,
|
17167
|
tbl: rec.TableName,
|
17168
|
layoutType: rec.LayoutType
|
17169
|
});
|
17170
|
_items.push(pnl)
|
17171
|
} else if (rec.LayoutType == "L002" || rec.LayoutType == "L003") {
|
17172
|
_items.push({
|
17173
|
xtype: 'panel',
|
17174
|
title: rec.Title,
|
17175
|
name: 'panelTab' + rec.TableName,
|
17176
|
tbl: rec.TableName,
|
17177
|
layoutType: rec.LayoutType,
|
17178
|
items: [{
|
17179
|
xtype: 'docgrid',
|
17180
|
height: 400,
|
17181
|
tableName: rec.TableName,
|
17182
|
docType: me.docType,
|
17183
|
transType: me.transType,
|
17184
|
storename: 'store' + rec.TableName,
|
17185
|
pagesize: 25,
|
17186
|
name: 'GRID' + rec.TableName,
|
17187
|
margin: '0 0 10 0',
|
17188
|
autoLoad: false,
|
17189
|
tbar: [{
|
17190
|
xtype: 'button',
|
17191
|
text: 'Action',
|
17192
|
name: 'actionGrid' + rec.TableName,
|
17193
|
menu: [{
|
17194
|
text: 'Add',
|
17195
|
name: 'add' + rec.TableName,
|
17196
|
tbl: rec.TableName,
|
17197
|
style: 'font-family: FontAwesome',
|
17198
|
iconCls: 'fa-plus-circle',
|
17199
|
handler: function () {
|
17200
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17201
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17202
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
17203
|
frmDisplay.reset();
|
17204
|
frmForm.reset();
|
17205
|
frmDisplay.setHidden(true);
|
17206
|
frmForm.setHidden(false);
|
17207
|
grdPanel.setHidden(true);
|
17208
|
action = "0";
|
17209
|
}
|
17210
|
}, {
|
17211
|
text: 'Delete',
|
17212
|
name: 'delete' + rec.TableName,
|
17213
|
tbl: rec.TableName,
|
17214
|
iconCls: 'fa-trash-o',
|
17215
|
style: 'font-family: FontAwesome',
|
17216
|
handler: function () {
|
17217
|
var me = this;
|
17218
|
var store = Ext.StoreMgr.lookup('store' + rec.TableName);
|
17219
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
17220
|
Ext.MessageBox.show({
|
17221
|
title: 'Remove tab',
|
17222
|
msg: "This will remove. Do you want to continue?",
|
17223
|
buttons: Ext.MessageBox.YESNO,
|
17224
|
fn: function (choice) {
|
17225
|
console.log(choice);
|
17226
|
if (choice === 'yes') {
|
17227
|
var selection = grdPanel.getView().getSelectionModel().getSelection()[0];
|
17228
|
if (selection) {
|
17229
|
store.remove(selection);
|
17230
|
}
|
17231
|
}
|
17232
|
}
|
17233
|
});
|
17234
|
}
|
17235
|
}
|
17236
|
]
|
17237
|
}, {
|
17238
|
xtype: 'tbfill'
|
17239
|
}, {
|
17240
|
text: 'Clear Filters',
|
17241
|
tooltip: 'Clear all filters',
|
17242
|
name: 'clearbtn',
|
17243
|
handler: function () {}
|
17244
|
}
|
17245
|
],
|
17246
|
dockedItems: [{
|
17247
|
xtype: 'pagingtoolbar',
|
17248
|
store: 'store' + rec.TableName,
|
17249
|
dock: 'bottom',
|
17250
|
pageSize: me.pagesize,
|
17251
|
displayInfo: true
|
17252
|
}
|
17253
|
],
|
17254
|
listeners: {
|
17255
|
'itemdblclick': function (me, record, item, index, e, eOpts) {
|
17256
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17257
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17258
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
17259
|
frmDisplay.reset();
|
17260
|
frmForm.reset();
|
17261
|
frmDisplay.getForm().setValues(record.data);
|
17262
|
frmForm.getForm().setValues(record.data);
|
17263
|
frmDisplay.setHidden(false);
|
17264
|
frmForm.setHidden(true);
|
17265
|
grdPanel.setHidden(true);
|
17266
|
action = "1";
|
17267
|
}
|
17268
|
}
|
17269
|
}, {
|
17270
|
xtype: 'minovadocform',
|
17271
|
name: 'DISPLAY' + rec.TableName,
|
17272
|
id: 'DISPLAY' + rec.TableName,
|
17273
|
itemId: 'DISPLAY' + rec.TableName,
|
17274
|
tableName: rec.TableName,
|
17275
|
docType: me.docType,
|
17276
|
transType: me.transType,
|
17277
|
isDisplay: true,
|
17278
|
hidden: true,
|
17279
|
buttons: [{
|
17280
|
text: 'Edit',
|
17281
|
name: 'editDISPLAY' + rec.TableName,
|
17282
|
handler: function () {
|
17283
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17284
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17285
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
17286
|
frmDisplay.setHidden(true);
|
17287
|
frmForm.setHidden(false);
|
17288
|
grdPanel.setHidden(true);
|
17289
|
}
|
17290
|
}, {
|
17291
|
text: 'Cancel',
|
17292
|
name: 'cancelDISPLAY' + rec.TableName,
|
17293
|
handler: function () {
|
17294
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17295
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17296
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
17297
|
frmDisplay.setHidden(true);
|
17298
|
frmForm.setHidden(true);
|
17299
|
grdPanel.setHidden(false);
|
17300
|
grdPanel.getStore().reload();
|
17301
|
}
|
17302
|
}
|
17303
|
]
|
17304
|
}, {
|
17305
|
xtype: 'minovadocform',
|
17306
|
name: 'FORM' + rec.TableName,
|
17307
|
id: 'FORM' + rec.TableName,
|
17308
|
itemId: 'FORM' + rec.TableName,
|
17309
|
tableName: rec.TableName,
|
17310
|
docType: me.docType,
|
17311
|
transType: me.transType,
|
17312
|
isDisplay: false,
|
17313
|
hidden: true,
|
17314
|
buttons: [{
|
17315
|
text: 'Submit',
|
17316
|
name: 'submitFORM' + rec.TableName,
|
17317
|
handler: function () {
|
17318
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17319
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17320
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
17321
|
var frm = frmForm.getForm();
|
17322
|
if (frm.isValid()) {
|
17323
|
var table = rec.TableName;
|
17324
|
var data = frmForm.getValues();
|
17325
|
var token = MinovaUtil.SESSIONS.Token;
|
17326
|
var str = grdPanel.getStore();
|
17327
|
var idx = str.getCount();
|
17328
|
str.insert(idx, data);
|
17329
|
frmDisplay.setHidden(true);
|
17330
|
frmForm.setHidden(true);
|
17331
|
grdPanel.setHidden(false);
|
17332
|
}
|
17333
|
}
|
17334
|
}, {
|
17335
|
text: 'Cancel',
|
17336
|
name: 'cancelFORM' + rec.TableName,
|
17337
|
handler: function () {
|
17338
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
17339
|
if (respone == "yes") {
|
17340
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17341
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17342
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
17343
|
frmDisplay.setHidden(true);
|
17344
|
frmForm.setHidden(true);
|
17345
|
grdPanel.setHidden(false);
|
17346
|
}
|
17347
|
});
|
17348
|
}
|
17349
|
}
|
17350
|
]
|
17351
|
}
|
17352
|
]
|
17353
|
});
|
17354
|
} else if (rec.LayoutType == "L005") { // Grid View Only
|
17355
|
_items.push({
|
17356
|
xtype: 'panel',
|
17357
|
title: rec.Title,
|
17358
|
name: 'panelTab' + rec.TableName,
|
17359
|
tbl: rec.TableName,
|
17360
|
layoutType: rec.LayoutType,
|
17361
|
items: [{
|
17362
|
xtype: 'docgrid',
|
17363
|
height: 400,
|
17364
|
tableName: rec.TableName,
|
17365
|
docType: me.docType,
|
17366
|
transType: me.transType,
|
17367
|
storename: 'store' + rec.TableName,
|
17368
|
pagesize: 25,
|
17369
|
name: 'GRID' + rec.TableName,
|
17370
|
margin: '0 0 10 0',
|
17371
|
autoLoad: false,
|
17372
|
tbar: [{
|
17373
|
xtype: 'tbfill'
|
17374
|
}, {
|
17375
|
text: 'Clear Filters',
|
17376
|
tooltip: 'Clear all filters',
|
17377
|
name: 'clearbtn',
|
17378
|
handler: function () {}
|
17379
|
}
|
17380
|
],
|
17381
|
dockedItems: [{
|
17382
|
xtype: 'pagingtoolbar',
|
17383
|
store: 'store' + rec.TableName,
|
17384
|
dock: 'bottom',
|
17385
|
pageSize: me.pagesize,
|
17386
|
displayInfo: true
|
17387
|
}
|
17388
|
]
|
17389
|
}
|
17390
|
]
|
17391
|
});
|
17392
|
} else if (rec.LayoutType == "L006") {
|
17393
|
_items.push({
|
17394
|
xtype: 'panel',
|
17395
|
title: rec.Title,
|
17396
|
name: 'panelTab' + rec.TableName,
|
17397
|
tbl: rec.TableName,
|
17398
|
layoutType: rec.LayoutType,
|
17399
|
items: [{
|
17400
|
xtype: 'docgridcelledit',
|
17401
|
name: 'CELLGRID' + rec.TableName,
|
17402
|
tableName: rec.TableName,
|
17403
|
docType: me.docType,
|
17404
|
transType: me.transType,
|
17405
|
docNo: me.docNo,
|
17406
|
height: 400,
|
17407
|
hideButton: false,
|
17408
|
margin: '0 0 10 0'
|
17409
|
}
|
17410
|
]
|
17411
|
});
|
17412
|
} else if (rec.LayoutType == "L007") {
|
17413
|
_items.push({
|
17414
|
xtype: 'panel',
|
17415
|
title: rec.Title,
|
17416
|
name: 'panelTab' + rec.TableName,
|
17417
|
tbl: rec.TableName,
|
17418
|
layoutType: rec.LayoutType,
|
17419
|
items: [{
|
17420
|
xtype: 'docgridcelleditsum',
|
17421
|
name: 'CELLGRID' + rec.TableName,
|
17422
|
tableName: rec.TableName,
|
17423
|
docType: me.docType,
|
17424
|
transType: me.transType,
|
17425
|
docNo: me.docNo,
|
17426
|
height: 400,
|
17427
|
hideButton: false,
|
17428
|
margin: '0 0 10 0'
|
17429
|
}, {
|
17430
|
xtype: 'summarydocform',
|
17431
|
name: 'SUM' + rec.TableName,
|
17432
|
id: 'SUM' + rec.TableName,
|
17433
|
itemId: 'SUM' + rec.TableName,
|
17434
|
tableName: rec.TableName,
|
17435
|
docType: me.docType,
|
17436
|
transType: me.transType,
|
17437
|
}
|
17438
|
]
|
17439
|
});
|
17440
|
} else { // L001=Default Form Only
|
17441
|
_items.push({
|
17442
|
xtype: 'panel',
|
17443
|
title: rec.LabelName,
|
17444
|
name: 'panelTab' + rec.TableName,
|
17445
|
tbl: rec.TableName,
|
17446
|
layoutType: rec.LayoutType,
|
17447
|
items: [{
|
17448
|
xtype: 'minovadocform',
|
17449
|
name: 'DISPLAY' + rec.TableName,
|
17450
|
id: 'DISPLAY' + rec.TableName,
|
17451
|
itemId: 'DISPLAY' + rec.TableName,
|
17452
|
tableName: rec.TableName,
|
17453
|
docType: me.docType,
|
17454
|
transType: me.transType,
|
17455
|
isDisplay: true,
|
17456
|
hidden: false,
|
17457
|
buttons: [{
|
17458
|
text: 'Edit',
|
17459
|
name: 'editDISPLAY' + rec.TableName,
|
17460
|
iconCls: 'fa-edit',
|
17461
|
style: 'font-family: FontAwesome',
|
17462
|
handler: function () {
|
17463
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17464
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17465
|
frmDisplay.setHidden(true);
|
17466
|
frmForm.setHidden(false);
|
17467
|
action = "1";
|
17468
|
}
|
17469
|
}, {
|
17470
|
text: 'Cancel',
|
17471
|
name: 'cancelDISPLAY' + rec.TableName,
|
17472
|
iconCls: 'fa-reply',
|
17473
|
style: 'font-family: FontAwesome',
|
17474
|
hidden: true
|
17475
|
}
|
17476
|
]
|
17477
|
}, {
|
17478
|
xtype: 'minovadocform',
|
17479
|
name: 'FORM' + rec.TableName,
|
17480
|
id: 'FORM' + rec.TableName,
|
17481
|
itemId: 'FORM' + rec.TableName,
|
17482
|
tableName: rec.TableName,
|
17483
|
docType: me.docType,
|
17484
|
transType: me.transType,
|
17485
|
isDisplay: false,
|
17486
|
hidden: true,
|
17487
|
buttons: [{
|
17488
|
text: 'Save',
|
17489
|
name: 'saveDISPLAY' + rec.TableName,
|
17490
|
iconCls: 'fa-save',
|
17491
|
style: 'font-family: FontAwesome',
|
17492
|
handler: function () {
|
17493
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17494
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17495
|
var headerDisplay = Ext.ComponentQuery.query('[name=MainHeaderMDLogistic]')[0];
|
17496
|
var frm = frmForm.getForm();
|
17497
|
if (frm.isValid()) {
|
17498
|
var table = rec.TableName;
|
17499
|
var data = Ext.encode(frmForm.getValues());
|
17500
|
var token = MinovaUtil.SESSIONS.Token;
|
17501
|
var params = {
|
17502
|
apiController: 'api/Devt',
|
17503
|
methodName: 'SaveTableMaster',
|
17504
|
parameter: 'tableName=' + table + '&data=' + data + '&action=' + action + '&token=' + token
|
17505
|
};
|
17506
|
MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
|
17507
|
var result = Ext.decode(xhr.responseText);
|
17508
|
var r = Ext.decode(result.data);
|
17509
|
if (r.success) {
|
17510
|
headerDisplay.mask("Loading...");
|
17511
|
var idNo = r.data;
|
17512
|
frmForm.getForm().findField("DocNo").setValue(idNo);
|
17513
|
frmDisplay.getForm().setValues(frmForm.getValues());
|
17514
|
headerDisplay.getForm().setValues(frmForm.getValues());
|
17515
|
frmDisplay.setHidden(false);
|
17516
|
frmForm.setHidden(true);
|
17517
|
MinovaMessage('Not Null', '000006', '', 'S');
|
17518
|
headerDisplay.unmask();
|
17519
|
} else {
|
17520
|
MinovaMessage(' Not Null ', ' 000005 ', r.message.text, 'E');
|
17521
|
}
|
17522
|
});
|
17523
|
}
|
17524
|
}
|
17525
|
}, {
|
17526
|
text: 'Delete',
|
17527
|
name: 'deleteDISPLAY' + rec.TableName,
|
17528
|
iconCls: 'fa-trash-o',
|
17529
|
style: 'font-family: FontAwesome',
|
17530
|
handler: function () {}
|
17531
|
}, {
|
17532
|
text: 'Cancel',
|
17533
|
name: 'cancelDISPLAY' + rec.TableName,
|
17534
|
iconCls: 'fa-reply',
|
17535
|
style: 'font-family: FontAwesome',
|
17536
|
handler: function () {
|
17537
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
17538
|
if (respone == "yes") {
|
17539
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
17540
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
17541
|
frmDisplay.setHidden(false);
|
17542
|
frmForm.setHidden(true);
|
17543
|
}
|
17544
|
});
|
17545
|
}
|
17546
|
}
|
17547
|
]
|
17548
|
}
|
17549
|
]
|
17550
|
});
|
17551
|
}
|
17552
|
});
|
17553
|
}
|
17554
|
Ext.applyIf(me, {
|
17555
|
items: _items
|
17556
|
});
|
17557
|
me.callParent(arguments);
|
17558
|
}
|
17559
|
});
|
17560
|
/*Add by Taufan ( Generate Doc Transaction Form For ERP )*/
|
17561
|
Ext.define('MinovaUtil.MinovaES.MinovaDocForm', {
|
17562
|
extend: 'Ext.form.Panel',
|
17563
|
alias: ['widget.MinovaDocForm', 'widget.minovadocform', 'widget.docform'],
|
17564
|
formname: this.name,
|
17565
|
tableName: undefined,
|
17566
|
docType: undefined,
|
17567
|
transType: undefined,
|
17568
|
resizable: true,
|
17569
|
border: false,
|
17570
|
autoScroll: true,
|
17571
|
isDisplay: undefined,
|
17572
|
isLookup: undefined,
|
17573
|
layout: 'column',
|
17574
|
defaults: {
|
17575
|
layout: 'form',
|
17576
|
xtype: 'container',
|
17577
|
defaultType: 'textfield',
|
17578
|
style: 'width: 50%',
|
17579
|
},
|
17580
|
initComponent: function () {
|
17581
|
var me = this;
|
17582
|
var col1 = [];
|
17583
|
var col2 = [];
|
17584
|
var LangID = localStorage.LangId;
|
17585
|
var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',DocType='" + me.docType + "'";
|
17586
|
var formname_ = me.name;
|
17587
|
var nameTable_ = me.tableName;
|
17588
|
Ext.Ajax.request({
|
17589
|
async: false,
|
17590
|
method: 'POST',
|
17591
|
url: '/UserControl/GetStore',
|
17592
|
params: {
|
17593
|
tableName: 'PDSDOCFIELD',
|
17594
|
param: parameter
|
17595
|
},
|
17596
|
success: function (response) {
|
17597
|
var results = Ext.decode(response.responseText);
|
17598
|
hasil = results.data;
|
17599
|
}
|
17600
|
});
|
17601
|
if (hasil.length > 0) {
|
17602
|
Ext.each(hasil, function (rec) {
|
17603
|
var isnull = null;
|
17604
|
if (rec.IsPrimaryKey == '1') {
|
17605
|
isnull = false;
|
17606
|
}
|
17607
|
if (rec.IsRequired == '1') {
|
17608
|
isnull = false;
|
17609
|
} else {
|
17610
|
isnull = true;
|
17611
|
}
|
17612
|
var formfield = MinovaUtil.FieldGenerator.Form(me.name, rec, isnull, me.isDisplay, me.tableName, me.isLookup);
|
17613
|
var descField = undefined;
|
17614
|
if (rec.ColumnNo == 1) {
|
17615
|
col1.push(formfield);
|
17616
|
if (descField) {
|
17617
|
col1.push(descField)
|
17618
|
}
|
17619
|
} else {
|
17620
|
col2.push(formfield);
|
17621
|
if (descField) {
|
17622
|
col2.push(descField)
|
17623
|
}
|
17624
|
}
|
17625
|
|
17626
|
if (rec.IsPrimaryKey == 1 && me.isLookup == undefined) {
|
17627
|
formfieldKey = new Ext.form.TextField({
|
17628
|
hidden: true,
|
17629
|
name: "Key_" + rec.FieldName,
|
17630
|
});
|
17631
|
col2.push(formfieldKey);
|
17632
|
}
|
17633
|
});
|
17634
|
}
|
17635
|
Ext.applyIf(me, {
|
17636
|
items: [{
|
17637
|
style: 'width: 50%',
|
17638
|
items: col1
|
17639
|
}, {
|
17640
|
style: 'width: 50%',
|
17641
|
items: col2
|
17642
|
}
|
17643
|
]
|
17644
|
});
|
17645
|
this.callParent();
|
17646
|
}
|
17647
|
});
|
17648
|
/*Add by Taufan ( Generate Doc Transaction Grid For ERP )*/
|
17649
|
Ext.define('MinovaUtil.MinovaES.MinovaDocGrid', {
|
17650
|
extend: 'Ext.grid.Panel',
|
17651
|
requires: ['Ext.grid.RowNumberer'],
|
17652
|
alias: 'widget.docgrid',
|
17653
|
alternateClassName: 'Ext.grid.MinovaGrid',
|
17654
|
tableName: undefined,
|
17655
|
docType: undefined,
|
17656
|
transType: undefined,
|
17657
|
isLookup: undefined,
|
17658
|
param: undefined,
|
17659
|
pagesize: undefined,
|
17660
|
storename: undefined,
|
17661
|
layoutType: undefined,
|
17662
|
enableLocking: true,
|
17663
|
autoLoad: undefined,
|
17664
|
multiSelect: undefined,
|
17665
|
getTableName: function () {
|
17666
|
return this.tableName;
|
17667
|
},
|
17668
|
initComponent: function () {
|
17669
|
var me = this;
|
17670
|
var cols_ = [];
|
17671
|
var fieldeditor = {};
|
17672
|
var hasil = null;
|
17673
|
var autoLoad = true;
|
17674
|
var LangID = localStorage.LangId;
|
17675
|
var fielGrid = 'rec.GridView == 1';
|
17676
|
var locking = true;
|
17677
|
var checkSelection = '';
|
17678
|
var widthLock = 250;
|
17679
|
if (me.multiSelect) {
|
17680
|
locking = false;
|
17681
|
checkSelection = 'checkboxmodel';
|
17682
|
widthLock = 40;
|
17683
|
}
|
17684
|
if (me.autoLoad == false) {
|
17685
|
autoLoad = false;
|
17686
|
}
|
17687
|
var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',DocType='" + me.docType + "'";
|
17688
|
Ext.Ajax.request({
|
17689
|
async: false,
|
17690
|
method: 'POST',
|
17691
|
url: '/UserControl/GetStore',
|
17692
|
params: {
|
17693
|
tableName: 'PDSDOCFIELD',
|
17694
|
param: parameter
|
17695
|
},
|
17696
|
success: function (response) {
|
17697
|
var results = Ext.decode(response.responseText);
|
17698
|
hasil = results.data;
|
17699
|
}
|
17700
|
});
|
17701
|
if (hasil.length > 0) {
|
17702
|
Ext.each(hasil, function (rec) {
|
17703
|
var null_ = null;
|
17704
|
if (rec.IsPrimaryKey == true) {
|
17705
|
null_ = false;
|
17706
|
}
|
17707
|
if (rec.IsRequired == true) {
|
17708
|
null_ = false;
|
17709
|
} else {
|
17710
|
null_ = true;
|
17711
|
}
|
17712
|
if (rec.GridView == 1) {
|
17713
|
switch (rec.FormatRef) {
|
17714
|
case "action":
|
17715
|
cols_.push({
|
17716
|
text: rec.HeaderTitle,
|
17717
|
width: 100,
|
17718
|
xtype: 'actioncolumn',
|
17719
|
tooltip: 'View Data',
|
17720
|
name: rec.FieldName,
|
17721
|
itemId: me.tableName + rec.FieldName,
|
17722
|
align: 'center',
|
17723
|
iconCls: 'fa-edit',
|
17724
|
renderer: function (value, metadata, record) {
|
17725
|
metadata.tdStyle = 'font-family: FontAwesome'
|
17726
|
},
|
17727
|
handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
|
17728
|
|
17729
|
this.fireEvent(me.tableName + rec.FieldName + "onActionClick", record);
|
17730
|
}
|
17731
|
});
|
17732
|
break
|
17733
|
case "file":
|
17734
|
cols_.push({
|
17735
|
xtype: 'minovapicturecolumn',
|
17736
|
text: rec.HeaderTitle,
|
17737
|
dataIndex: rec.FieldName,
|
17738
|
width: 100
|
17739
|
});
|
17740
|
break
|
17741
|
case "date":
|
17742
|
cols_.push({
|
17743
|
xtype: 'minovadatecolumn',
|
17744
|
text: rec.HeaderTitle,
|
17745
|
dataIndex: rec.FieldName,
|
17746
|
width: 100,
|
17747
|
filter: {
|
17748
|
type: 'date',
|
17749
|
itemDefaults: {
|
17750
|
emptyText: 'Search for...'
|
17751
|
}
|
17752
|
}
|
17753
|
});
|
17754
|
break
|
17755
|
case "amountencrypt":
|
17756
|
cols_.push({
|
17757
|
xtype: 'minovaamountcolumn',
|
17758
|
text: rec.HeaderTitle,
|
17759
|
dataIndex: rec.FieldName,
|
17760
|
align: 'right',
|
17761
|
width: 100,
|
17762
|
filter: {
|
17763
|
type: 'string',
|
17764
|
itemDefaults: {
|
17765
|
emptyText: 'Search for...'
|
17766
|
}
|
17767
|
}
|
17768
|
});
|
17769
|
break
|
17770
|
case "amount":
|
17771
|
cols_.push({
|
17772
|
xtype: 'minovacurrancycolumn',
|
17773
|
text: rec.HeaderTitle,
|
17774
|
dataIndex: rec.FieldName,
|
17775
|
align: 'right',
|
17776
|
width: 100,
|
17777
|
filter: {
|
17778
|
type: 'number',
|
17779
|
itemDefaults: {
|
17780
|
emptyText: 'Search for...'
|
17781
|
}
|
17782
|
}
|
17783
|
});
|
17784
|
break
|
17785
|
case "datetime":
|
17786
|
cols_.push({
|
17787
|
xtype: 'minovadatetimecolumn',
|
17788
|
text: rec.HeaderTitle,
|
17789
|
dataIndex: rec.FieldName,
|
17790
|
width: 140,
|
17791
|
filter: {
|
17792
|
type: 'string',
|
17793
|
itemDefaults: {
|
17794
|
emptyText: 'Search for...'
|
17795
|
}
|
17796
|
}
|
17797
|
});
|
17798
|
break
|
17799
|
default:
|
17800
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
|
17801
|
cols_.push({
|
17802
|
text: rec.HeaderTitle,
|
17803
|
dataIndex: rec.FieldName,
|
17804
|
width: 100,
|
17805
|
filter: {
|
17806
|
type: 'string',
|
17807
|
itemDefaults: {
|
17808
|
emptyText: 'Search for...'
|
17809
|
}
|
17810
|
}
|
17811
|
});
|
17812
|
} else if (rec.TableRef != "") {
|
17813
|
if (rec.TableRef != null) {
|
17814
|
var valueField = null;
|
17815
|
var displayValue = null;
|
17816
|
Ext.Ajax.request({
|
17817
|
async: false,
|
17818
|
method: 'POST',
|
17819
|
url: '/UserControl/GetStore',
|
17820
|
params: {
|
17821
|
tableName: 'SDATATABLEFIELD',
|
17822
|
param: 'TableName[equal]' + rec.TableRef
|
17823
|
},
|
17824
|
success: function (response) {
|
17825
|
var results = Ext.decode(response.responseText);
|
17826
|
data_ = results.data;
|
17827
|
if (data_.length > 0) {
|
17828
|
valueField_ = $.grep(data_, function (r) {
|
17829
|
return r.ValueField == '1'
|
17830
|
});
|
17831
|
valueField = valueField_[0].FieldName
|
17832
|
displayValue_ = $.grep(data_, function (r) {
|
17833
|
return r.DisplayValue == '1'
|
17834
|
});
|
17835
|
displayValue = displayValue_[0].FieldName
|
17836
|
} else {
|
17837
|
MinovaMessage('Not Null', 'BSNULLCOMBO', rec.TableRef, 'E');
|
17838
|
}
|
17839
|
}
|
17840
|
});
|
17841
|
var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
|
17842
|
var count_ = 0;
|
17843
|
if (store_) {
|
17844
|
count_ = store_.count();
|
17845
|
}
|
17846
|
if (count_ == 0) {
|
17847
|
Ext.create('Ext.data.Store', {
|
17848
|
storeId: 'store_' + rec.FieldName,
|
17849
|
autoLoad: false,
|
17850
|
proxy: {
|
17851
|
method: 'POST',
|
17852
|
type: 'ajax',
|
17853
|
url: '/UserControl/GetStore',
|
17854
|
extraParams: {
|
17855
|
tableName: rec.TableRef,
|
17856
|
param: rec.ParamCombo
|
17857
|
},
|
17858
|
reader: {
|
17859
|
type: 'json',
|
17860
|
root: 'data',
|
17861
|
totalProperty: 'data[0].TotalCount'
|
17862
|
}
|
17863
|
}
|
17864
|
})
|
17865
|
}
|
17866
|
cols_.push({
|
17867
|
xtype: 'minovacombocolumn',
|
17868
|
text: rec.HeaderTitle,
|
17869
|
dataIndex: rec.FieldName,
|
17870
|
valueField: valueField,
|
17871
|
displayField: displayValue,
|
17872
|
store: 'store_' + rec.FieldName,
|
17873
|
filter: {
|
17874
|
type: 'list',
|
17875
|
itemDefaults: {
|
17876
|
emptyText: 'Search for...'
|
17877
|
}
|
17878
|
}
|
17879
|
});
|
17880
|
}
|
17881
|
} else if (rec.FixedValue != "") {
|
17882
|
cols_.push({
|
17883
|
xtype: 'minovacombocolumnfixvalue',
|
17884
|
text: rec.HeaderTitle,
|
17885
|
dataIndex: rec.FieldName,
|
17886
|
fixedValue: rec.FixedValue,
|
17887
|
filter: {
|
17888
|
type: 'list',
|
17889
|
itemDefaults: {
|
17890
|
emptyText: 'Search for...'
|
17891
|
}
|
17892
|
}
|
17893
|
});
|
17894
|
} else {
|
17895
|
cols_.push({
|
17896
|
text: rec.HeaderTitle,
|
17897
|
dataIndex: rec.FieldName,
|
17898
|
filter: {
|
17899
|
itemDefaults: {
|
17900
|
emptyText: 'Search for...'
|
17901
|
}
|
17902
|
}
|
17903
|
});
|
17904
|
}
|
17905
|
break
|
17906
|
}
|
17907
|
} else {
|
17908
|
cols_.push({
|
17909
|
text: rec.HeaderTitle,
|
17910
|
dataIndex: rec.FieldName,
|
17911
|
hidden: true,
|
17912
|
filter: {
|
17913
|
itemDefaults: {
|
17914
|
emptyText: 'Search for...'
|
17915
|
}
|
17916
|
}
|
17917
|
});
|
17918
|
}
|
17919
|
|
17920
|
});
|
17921
|
};
|
17922
|
var param_ = me.param;
|
17923
|
if (param_ == undefined) {
|
17924
|
param_ = ''
|
17925
|
}
|
17926
|
var jsStoreGrid = new Ext.data.Store({
|
17927
|
storeId: me.storename,
|
17928
|
autoLoad: autoLoad,
|
17929
|
pageSize: me.pagesize,
|
17930
|
proxy: {
|
17931
|
method: 'POST',
|
17932
|
type: 'ajax',
|
17933
|
url: '/UserControl/GetStorePagingAuth',
|
17934
|
extraParams: {
|
17935
|
tableName: me.tableName,
|
17936
|
param: param_,
|
17937
|
menuId: MinovaUtil.GetMenuID()
|
17938
|
},
|
17939
|
reader: {
|
17940
|
type: 'json',
|
17941
|
root: 'data',
|
17942
|
totalProperty: 'totalRecords'
|
17943
|
}
|
17944
|
},
|
17945
|
});
|
17946
|
Ext.applyIf(me, {
|
17947
|
autoScroll: true,
|
17948
|
enableLocking: locking,
|
17949
|
lockedGridConfig: {
|
17950
|
header: false,
|
17951
|
collapsible: true,
|
17952
|
width: widthLock,
|
17953
|
forceFit: locking,
|
17954
|
listeners: {
|
17955
|
render: function (grid) {
|
17956
|
var pagingToolbar = grid.child('pagingtoolbar');
|
17957
|
if (pagingToolbar) {
|
17958
|
grid.remove(pagingToolbar, true);
|
17959
|
}
|
17960
|
}
|
17961
|
}
|
17962
|
},
|
17963
|
listeners: {
|
17964
|
viewready: function () {
|
17965
|
if (autoLoad == true) {
|
17966
|
this.getStore().loadPage(1);
|
17967
|
}
|
17968
|
},
|
17969
|
beforeedit: function () {
|
17970
|
return false;
|
17971
|
}
|
17972
|
},
|
17973
|
lockedViewConfig: {
|
17974
|
scroll: 'horizontal'
|
17975
|
},
|
17976
|
|
17977
|
//Add For Auto Size Coloum Mode
|
17978
|
viewConfig: {
|
17979
|
emptyText: 'No Data Display',
|
17980
|
deferEmptyText: false,
|
17981
|
listeners: {
|
17982
|
refresh: function (dataview) {
|
17983
|
Ext.each(dataview.panel.columns, function (column) {
|
17984
|
if (column.autoSizeColumn == false)
|
17985
|
column.autoSizeColumn = true;
|
17986
|
column.autoSize();
|
17987
|
})
|
17988
|
}
|
17989
|
}
|
17990
|
},
|
17991
|
selModel: {},
|
17992
|
selType: checkSelection,
|
17993
|
columns: cols_,
|
17994
|
store: jsStoreGrid,
|
17995
|
plugins: [{
|
17996
|
ptype: 'gridfilters'
|
17997
|
}
|
17998
|
]
|
17999
|
});
|
18000
|
me.callParent(arguments);
|
18001
|
}
|
18002
|
});
|
18003
|
/*Add by Taufan ( Generate Doc Transaction Cell Edit Grid For ERP )*/
|
18004
|
Ext.define('MinovaUtil.MinovaES.MinovaDocGridCellEdit', {
|
18005
|
extend: 'Ext.form.Panel',
|
18006
|
alias: 'widget.docgridcelledit',
|
18007
|
requires: [
|
18008
|
'Ext.grid.plugin.CellEditing',
|
18009
|
'Ext.grid.Panel'
|
18010
|
],
|
18011
|
autoScroll: true,
|
18012
|
anchor: '100%',
|
18013
|
tableName: undefined,
|
18014
|
docType: undefined,
|
18015
|
transType: undefined,
|
18016
|
docNo: undefined,
|
18017
|
hideButton: undefined,
|
18018
|
multiSelect: undefined,
|
18019
|
initComponent: function () {
|
18020
|
var me = this;
|
18021
|
var isLookup = me.isLookup;
|
18022
|
var hide_ = false;
|
18023
|
var hideLoad = true;
|
18024
|
var widthLock = 250;
|
18025
|
var checkSelection = '';
|
18026
|
|
18027
|
Ext.Ajax.request({
|
18028
|
async: false,
|
18029
|
method: 'POST',
|
18030
|
url: '/UserControl/GetStore',
|
18031
|
params: {
|
18032
|
tableName: "PCMBSTRANSLIST",
|
18033
|
param: 'TableName[=]' + me.tableName
|
18034
|
},
|
18035
|
success: function (response) {
|
18036
|
var results = Ext.decode(response.responseText);
|
18037
|
if (results.data[0].UploadDownloadEnable == '0') {
|
18038
|
hideUploadDownload = true;
|
18039
|
} else {
|
18040
|
hideUploadDownload = false;
|
18041
|
}
|
18042
|
}
|
18043
|
});
|
18044
|
|
18045
|
if (me.tableName == "CTRPURCHDETITEM") {
|
18046
|
hideLoad = false;
|
18047
|
}
|
18048
|
|
18049
|
|
18050
|
if (me.hideButton == true) {
|
18051
|
hide_ = true;
|
18052
|
}
|
18053
|
if (me.multiSelect) {
|
18054
|
locking = false;
|
18055
|
checkSelection = 'checkboxmodel';
|
18056
|
widthLock = 40;
|
18057
|
}
|
18058
|
var tableName = me.tableName;
|
18059
|
var cols = [];
|
18060
|
var fieldStore = [];
|
18061
|
var _url = 'GetAllField';
|
18062
|
var hasil = null;
|
18063
|
var height = me.height;
|
18064
|
var storeID = 'store' + me.tableName;
|
18065
|
var gridName = 'grid' + me.name;
|
18066
|
if (me.storeName) {
|
18067
|
storeID = me.storeName;
|
18068
|
}
|
18069
|
var LangID = MinovaUtil.GetLangID();
|
18070
|
var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',DocType='" + me.docType + "'";
|
18071
|
Ext.Ajax.request({
|
18072
|
async: false,
|
18073
|
method: 'POST',
|
18074
|
url: '/UserControl/GetStore',
|
18075
|
params: {
|
18076
|
tableName: 'PDSDOCFIELD',
|
18077
|
param: parameter
|
18078
|
},
|
18079
|
success: function (response) {
|
18080
|
var results = Ext.decode(response.responseText);
|
18081
|
hasil = results.data;
|
18082
|
}
|
18083
|
});
|
18084
|
cols.push({
|
18085
|
xtype: 'rownumberer'
|
18086
|
});
|
18087
|
var addData = '({';
|
18088
|
if (hasil.length > 0) {
|
18089
|
Ext.each(hasil, function (rec) {
|
18090
|
fieldStore.push(rec.FieldName);
|
18091
|
var defaultValue = rec.DefaultValue;
|
18092
|
if (defaultValue.substring(0, 2).toLowerCase() == 'fn') {
|
18093
|
Ext.Ajax.request({
|
18094
|
async: false,
|
18095
|
method: 'POST',
|
18096
|
url: '/UserControl/GetStore',
|
18097
|
params: {
|
18098
|
tableName: 'PCMFUNC',
|
18099
|
param: 'FuncName[equal]' + rec.DefaultValue
|
18100
|
},
|
18101
|
success: function (response) {
|
18102
|
var results = Ext.decode(response.responseText);
|
18103
|
data_ = results.data;
|
18104
|
if (data_.length > 0) {
|
18105
|
defaultValue = eval(data_[0].FunctionCode);
|
18106
|
}
|
18107
|
}
|
18108
|
});
|
18109
|
}
|
18110
|
addData = addData + rec.FieldName + ":" + "'" + defaultValue + "',";
|
18111
|
var null_ = null;
|
18112
|
var ReadOnly_ = false;
|
18113
|
if (rec.IsPrimaryKey == true) {
|
18114
|
null_ = false;
|
18115
|
}
|
18116
|
if (rec.IsRequired == true) {
|
18117
|
null_ = false;
|
18118
|
} else {
|
18119
|
null_ = true;
|
18120
|
}
|
18121
|
var Hidden_ = false;
|
18122
|
if (rec.ReadOnly == '1') {
|
18123
|
ReadOnly_ = true;
|
18124
|
}
|
18125
|
if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
|
18126
|
Hidden_ = true;
|
18127
|
null_ = true;
|
18128
|
}
|
18129
|
if (rec.GridView == 1) {
|
18130
|
switch (rec.FormatRef) {
|
18131
|
case "date":
|
18132
|
cols.push({
|
18133
|
xtype: 'minovadatecolumn',
|
18134
|
hidden: Hidden_,
|
18135
|
text: rec.HeaderTitle,
|
18136
|
dataIndex: rec.FieldName,
|
18137
|
filter: {
|
18138
|
itemDefaults: {
|
18139
|
emptyText: 'Search for...'
|
18140
|
}
|
18141
|
},
|
18142
|
editor: {
|
18143
|
allowBlank: null_,
|
18144
|
xtype: 'datefield',
|
18145
|
hideMode: 'visibility',
|
18146
|
readOnly: ReadOnly_,
|
18147
|
id: tableName + rec.FieldName,
|
18148
|
value: defaultValue
|
18149
|
}
|
18150
|
});
|
18151
|
break
|
18152
|
case "amount":
|
18153
|
cols.push({
|
18154
|
//xtype : 'minovacurrancycolumn',
|
18155
|
xtype: 'numbercolumn',
|
18156
|
text: rec.HeaderTitle,
|
18157
|
align: 'right',
|
18158
|
dataIndex: rec.FieldName,
|
18159
|
hidden: Hidden_,
|
18160
|
minWidth: 150,
|
18161
|
filter: {
|
18162
|
itemDefaults: {
|
18163
|
emptyText: 'Search for...'
|
18164
|
}
|
18165
|
},
|
18166
|
editor: {
|
18167
|
allowBlank: null_,
|
18168
|
xtype: 'textfield',
|
18169
|
readOnly: ReadOnly_,
|
18170
|
id: tableName + rec.FieldName,
|
18171
|
nameTable: rec.TableName,
|
18172
|
fieldGrid: rec.FieldName,
|
18173
|
fieldStyle: 'text-align:right;',
|
18174
|
vtype: 'validateMinovaNumber',
|
18175
|
value: '0',
|
18176
|
listeners: {
|
18177
|
change: function (val, recs) {
|
18178
|
var fvalue = val.getValue();
|
18179
|
var custumFunc = rec.SelectFunction;
|
18180
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
18181
|
Ext.Ajax.request({
|
18182
|
async: false,
|
18183
|
method: 'POST',
|
18184
|
url: '/UserControl/GetStore',
|
18185
|
params: {
|
18186
|
tableName: 'PCMFUNC',
|
18187
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
18188
|
},
|
18189
|
success: function (response) {
|
18190
|
var results = Ext.decode(response.responseText);
|
18191
|
var dt = results.data[0];
|
18192
|
if (dt != undefined) {
|
18193
|
custumFunc = dt.FunctionCode;
|
18194
|
}
|
18195
|
}
|
18196
|
});
|
18197
|
}
|
18198
|
if (custumFunc) {
|
18199
|
eval(custumFunc)
|
18200
|
}
|
18201
|
}
|
18202
|
}
|
18203
|
}
|
18204
|
});
|
18205
|
break
|
18206
|
default:
|
18207
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
|
18208
|
cols.push({
|
18209
|
text: rec.HeaderTitle,
|
18210
|
dataIndex: rec.FieldName,
|
18211
|
width: 100,
|
18212
|
minWidth: 150,
|
18213
|
filter: {
|
18214
|
type: 'string',
|
18215
|
itemDefaults: {
|
18216
|
emptyText: 'Search for...'
|
18217
|
}
|
18218
|
}
|
18219
|
});
|
18220
|
} else if (rec.SearchType == '0') {
|
18221
|
var valueField = null;
|
18222
|
var displayValue = null;
|
18223
|
var TableRef = undefined;
|
18224
|
if (rec.TableRef != '') {
|
18225
|
TableRef = rec.TableRef;
|
18226
|
Ext.Ajax.request({
|
18227
|
async: false,
|
18228
|
method: 'POST',
|
18229
|
url: '/UserControl/GetStore',
|
18230
|
params: {
|
18231
|
tableName: 'SDATATABLEFIELD',
|
18232
|
param: 'TableName[equal]' + rec.TableRef
|
18233
|
},
|
18234
|
success: function (response) {
|
18235
|
var results = Ext.decode(response.responseText);
|
18236
|
data_ = results.data;
|
18237
|
if (data_ != undefined) {
|
18238
|
valueField_ = $.grep(data_, function (r) {
|
18239
|
return r.ValueField == '1'
|
18240
|
});
|
18241
|
valueField = valueField_[0].FieldName
|
18242
|
displayValue_ = $.grep(data_, function (r) {
|
18243
|
return r.DisplayValue == '1'
|
18244
|
});
|
18245
|
displayValue = displayValue_[0].FieldName
|
18246
|
}
|
18247
|
}
|
18248
|
});
|
18249
|
}
|
18250
|
Ext.create('Ext.data.Store', {
|
18251
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
18252
|
autoLoad: true,
|
18253
|
proxy: {
|
18254
|
method: 'POST',
|
18255
|
type: 'ajax',
|
18256
|
url: '/UserControl/GetStoreAuth',
|
18257
|
extraParams: {
|
18258
|
tableName: TableRef,
|
18259
|
param: rec.ParamCombo,
|
18260
|
menuId: MinovaUtil.GetMenuID()
|
18261
|
},
|
18262
|
reader: {
|
18263
|
type: 'json',
|
18264
|
root: 'data',
|
18265
|
totalProperty: 'data[0].TotalCount'
|
18266
|
}
|
18267
|
}
|
18268
|
});
|
18269
|
cols.push({
|
18270
|
xtype: 'minovacombocolumn',
|
18271
|
hidden: Hidden_,
|
18272
|
text: rec.HeaderTitle,
|
18273
|
dataIndex: rec.FieldName,
|
18274
|
valueField: valueField,
|
18275
|
displayField: displayValue,
|
18276
|
store: 'store_' + me.tableName + rec.FieldName,
|
18277
|
minWidth: 150,
|
18278
|
editor: {
|
18279
|
allowBlank: null_,
|
18280
|
xtype: 'minovacombobox',
|
18281
|
readOnly: ReadOnly_,
|
18282
|
id: tableName + rec.FieldName,
|
18283
|
valueField: valueField,
|
18284
|
displayField: displayValue,
|
18285
|
store: 'store_' + me.tableName + rec.FieldName,
|
18286
|
forceSelection: false,
|
18287
|
lazyRender: true,
|
18288
|
listeners: {
|
18289
|
change: function (val) {
|
18290
|
var fvalue = val.getValue();
|
18291
|
var custumFunc = rec.SelectFunction;
|
18292
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
18293
|
Ext.Ajax.request({
|
18294
|
async: false,
|
18295
|
method: 'POST',
|
18296
|
url: '/UserControl/GetStore',
|
18297
|
params: {
|
18298
|
tableName: 'PCMFUNC',
|
18299
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
18300
|
},
|
18301
|
success: function (response) {
|
18302
|
var results = Ext.decode(response.responseText);
|
18303
|
var dt = results.data[0];
|
18304
|
if (dt != undefined) {
|
18305
|
custumFunc = dt.FunctionCode;
|
18306
|
}
|
18307
|
}
|
18308
|
});
|
18309
|
}
|
18310
|
if (custumFunc) {
|
18311
|
eval(custumFunc)
|
18312
|
}
|
18313
|
}
|
18314
|
}
|
18315
|
},
|
18316
|
filter: {
|
18317
|
type: 'list',
|
18318
|
itemDefaults: {
|
18319
|
emptyText: 'Search for...'
|
18320
|
}
|
18321
|
}
|
18322
|
});
|
18323
|
} else if (rec.SearchType == '5') {
|
18324
|
var valueField = null;
|
18325
|
var displayValue = null;
|
18326
|
var AdditionaldisplayValue = null;
|
18327
|
var TableRef = undefined;
|
18328
|
if (rec.TableRef != '') {
|
18329
|
TableRef = rec.TableRef;
|
18330
|
Ext.Ajax.request({
|
18331
|
async: false,
|
18332
|
method: 'POST',
|
18333
|
url: '/UserControl/GetStore',
|
18334
|
params: {
|
18335
|
tableName: 'SDATATABLEFIELD',
|
18336
|
param: 'TableName[equal]' + rec.TableRef
|
18337
|
},
|
18338
|
success: function (response) {
|
18339
|
var results = Ext.decode(response.responseText);
|
18340
|
data_ = results.data;
|
18341
|
if (data_ != undefined) {
|
18342
|
valueField_ = $.grep(data_, function (r) {
|
18343
|
return r.ValueField == '1'
|
18344
|
});
|
18345
|
if (valueField_.length > 0) {
|
18346
|
valueField = valueField_[0].FieldName
|
18347
|
}
|
18348
|
|
18349
|
displayValue_ = $.grep(data_, function (r) {
|
18350
|
return r.DisplayValue == '1' || r.DisplayValue == '2'
|
18351
|
});
|
18352
|
if (displayValue_.length > 0) {
|
18353
|
displayValue = displayValue_[0].FieldName;
|
18354
|
}
|
18355
|
if (displayValue_.length >= 2) {
|
18356
|
AdditionaldisplayValue = displayValue_[1].FieldName
|
18357
|
}
|
18358
|
}
|
18359
|
}
|
18360
|
});
|
18361
|
}
|
18362
|
Ext.create('Ext.data.Store', {
|
18363
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
18364
|
autoLoad: true,
|
18365
|
proxy: {
|
18366
|
method: 'POST',
|
18367
|
type: 'ajax',
|
18368
|
url: '/UserControl/GetStoreAuth',
|
18369
|
extraParams: {
|
18370
|
tableName: TableRef,
|
18371
|
param: rec.ParamCombo,
|
18372
|
menuId: MinovaUtil.GetMenuID()
|
18373
|
},
|
18374
|
reader: {
|
18375
|
type: 'json',
|
18376
|
root: 'data',
|
18377
|
totalProperty: 'data[0].TotalCount'
|
18378
|
}
|
18379
|
}
|
18380
|
});
|
18381
|
cols.push({
|
18382
|
xtype : 'minovacombocolumn',
|
18383
|
hidden: Hidden_,
|
18384
|
text: rec.HeaderTitle,
|
18385
|
dataIndex: rec.FieldName,
|
18386
|
valueField : valueField,
|
18387
|
displayField : displayValue,
|
18388
|
store : 'store_' + me.tableName + rec.FieldName,
|
18389
|
minWidth: 150,
|
18390
|
tpl: Ext.create('Ext.XTemplate',
|
18391
|
'<ul class="x-list-plain"><tpl for=".">',
|
18392
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
18393
|
'</tpl></ul>'),
|
18394
|
displayTpl: Ext.create('Ext.XTemplate',
|
18395
|
'<tpl for=".">',
|
18396
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
18397
|
'</tpl>'),
|
18398
|
editor: {
|
18399
|
allowBlank: null_,
|
18400
|
xtype: 'combobox',
|
18401
|
readOnly: ReadOnly_,
|
18402
|
id: rec.TableName + rec.FieldName,
|
18403
|
nameTable: rec.TableName,
|
18404
|
fieldGrid: rec.FieldName,
|
18405
|
valueField: valueField,
|
18406
|
displayField: displayValue,
|
18407
|
store: 'store_' + me.tableName + rec.FieldName,
|
18408
|
value: rec.DefaultValue,
|
18409
|
tpl: Ext.create('Ext.XTemplate',
|
18410
|
'<ul class="x-list-plain"><tpl for=".">',
|
18411
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
18412
|
'</tpl></ul>'),
|
18413
|
displayTpl: Ext.create('Ext.XTemplate',
|
18414
|
'<tpl for=".">',
|
18415
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
18416
|
'</tpl>')
|
18417
|
},
|
18418
|
renderer: function (value) {
|
18419
|
var store = Ext.data.StoreManager.lookup('store_' + me.tableName + rec.FieldName);
|
18420
|
var index = store.find(valueField, value);
|
18421
|
var val = "";
|
18422
|
if (index != -1) {
|
18423
|
var rc = store.getAt(index);
|
18424
|
//val = rc.get(displayValue);
|
18425
|
val = rc.get(AdditionaldisplayValue) + ' - ' + rc.get(displayValue);
|
18426
|
} else {
|
18427
|
val = value;
|
18428
|
}
|
18429
|
return val;
|
18430
|
},
|
18431
|
filter: {
|
18432
|
type: 'list',
|
18433
|
itemDefaults: {
|
18434
|
emptyText: 'Search for...'
|
18435
|
}
|
18436
|
}
|
18437
|
});
|
18438
|
} else if (rec.SearchType == '2') {
|
18439
|
var triger = (rec.TriggerCombo).split('$');
|
18440
|
var targetField_ = triger[0];
|
18441
|
var fieldValue_ = triger[1];
|
18442
|
cols.push({
|
18443
|
text: rec.HeaderTitle,
|
18444
|
hidden: Hidden_,
|
18445
|
dataIndex: rec.FieldName,
|
18446
|
filter: {
|
18447
|
itemDefaults: {
|
18448
|
emptyText: 'Search for...'
|
18449
|
}
|
18450
|
},
|
18451
|
editor: {
|
18452
|
allowBlank: null_,
|
18453
|
xtype: 'minovalookupgrid',
|
18454
|
readOnly: ReadOnly_,
|
18455
|
isGrid: true,
|
18456
|
fieldTarget: targetField_,
|
18457
|
fieldValue: fieldValue_,
|
18458
|
isGrid: true,
|
18459
|
id: tableName + rec.FieldName,
|
18460
|
tableName: rec.TableRef,
|
18461
|
triggerCls: 'x-form-search-trigger',
|
18462
|
vtype: 'alphanum',
|
18463
|
listeners: {
|
18464
|
change: function (val) {
|
18465
|
var custumFunc = rec.SelectFunction;
|
18466
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
18467
|
Ext.Ajax.request({
|
18468
|
async: false,
|
18469
|
method: 'POST',
|
18470
|
url: '/UserControl/GetStore',
|
18471
|
params: {
|
18472
|
tableName: 'PCMFUNC',
|
18473
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
18474
|
},
|
18475
|
success: function (response) {
|
18476
|
var results = Ext.decode(response.responseText);
|
18477
|
data_ = results.data[0];
|
18478
|
if (data_ != undefined) {
|
18479
|
custumFunc = data_.FunctionCode;
|
18480
|
}
|
18481
|
}
|
18482
|
});
|
18483
|
}
|
18484
|
if (custumFunc) {
|
18485
|
eval(custumFunc)
|
18486
|
}
|
18487
|
}
|
18488
|
}
|
18489
|
}
|
18490
|
});
|
18491
|
} else if (rec.SearchType == '3') {
|
18492
|
cols.push({
|
18493
|
text: rec.HeaderTitle,
|
18494
|
hidden: Hidden_,
|
18495
|
dataIndex: rec.FieldName,
|
18496
|
filter: {
|
18497
|
itemDefaults: {
|
18498
|
emptyText: 'Search for...'
|
18499
|
}
|
18500
|
},
|
18501
|
editor: {
|
18502
|
allowBlank: null_,
|
18503
|
xtype: 'MinovaLookupTree',
|
18504
|
readOnly: ReadOnly_,
|
18505
|
id: tableName + rec.FieldName,
|
18506
|
tableName: rec.TableRef,
|
18507
|
triggerCls: 'x-form-search-trigger',
|
18508
|
vtype: 'alphanum',
|
18509
|
treeSructure: rec.SearchFunction,
|
18510
|
objClassValue: rec.ParamCombo,
|
18511
|
listeners: {
|
18512
|
change: function (val) {
|
18513
|
var custumFunc = rec.SelectFunction;
|
18514
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
18515
|
Ext.Ajax.request({
|
18516
|
async: false,
|
18517
|
method: 'POST',
|
18518
|
url: '/UserControl/GetStore',
|
18519
|
params: {
|
18520
|
tableName: 'PCMFUNC',
|
18521
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
18522
|
},
|
18523
|
success: function (response) {
|
18524
|
var results = Ext.decode(response.responseText);
|
18525
|
data_ = results.data[0];
|
18526
|
if (data_ != undefined) {
|
18527
|
custumFunc = data_.FunctionCode;
|
18528
|
}
|
18529
|
}
|
18530
|
});
|
18531
|
}
|
18532
|
if (custumFunc) {
|
18533
|
eval(custumFunc)
|
18534
|
}
|
18535
|
}
|
18536
|
}
|
18537
|
}
|
18538
|
});
|
18539
|
} else if (rec.SearchType != '0' && rec.SearchType != '1' && rec.SearchType != '3' && (rec.FieldName == 'EmployeeID' || rec.FieldName == 'ApplicantID' || rec.FieldName == 'EmployeeIDFrom' || rec.FieldName == 'EmployeeIDTo') && isLookup != true) {
|
18540
|
var triger = (rec.TriggerCombo).split('&');
|
18541
|
var targetField_ = triger[0];
|
18542
|
var fieldValue_ = triger[0];
|
18543
|
cols.push({
|
18544
|
text: rec.HeaderTitle,
|
18545
|
hidden: Hidden_,
|
18546
|
dataIndex: rec.FieldName,
|
18547
|
filter: {
|
18548
|
itemDefaults: {
|
18549
|
emptyText: 'Search for...'
|
18550
|
}
|
18551
|
},
|
18552
|
editor: {
|
18553
|
allowBlank: null_,
|
18554
|
xtype: 'lookupemployee',
|
18555
|
readOnly: ReadOnly_,
|
18556
|
isGrid: true,
|
18557
|
fieldTarget: targetField_,
|
18558
|
fieldValue: fieldValue_,
|
18559
|
isGrid: true,
|
18560
|
id: tableName + rec.FieldName,
|
18561
|
tableName: rec.TableRef,
|
18562
|
triggerCls: 'x-form-search-trigger',
|
18563
|
vtype: 'alphanum',
|
18564
|
listeners: {
|
18565
|
change: function (val) {
|
18566
|
var custumFunc = rec.SelectFunction;
|
18567
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
18568
|
Ext.Ajax.request({
|
18569
|
async: false,
|
18570
|
method: 'POST',
|
18571
|
url: '/UserControl/GetStore',
|
18572
|
params: {
|
18573
|
tableName: 'PCMFUNC',
|
18574
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
18575
|
},
|
18576
|
success: function (response) {
|
18577
|
var results = Ext.decode(response.responseText);
|
18578
|
data_ = results.data[0];
|
18579
|
if (data_ != undefined) {
|
18580
|
custumFunc = data_.FunctionCode;
|
18581
|
}
|
18582
|
}
|
18583
|
});
|
18584
|
}
|
18585
|
if (custumFunc) {
|
18586
|
eval(custumFunc)
|
18587
|
}
|
18588
|
}
|
18589
|
}
|
18590
|
}
|
18591
|
});
|
18592
|
} else if (rec.SearchType == '4' && isLookup != true) {
|
18593
|
cols.push({
|
18594
|
text: rec.HeaderTitle,
|
18595
|
hidden: Hidden_,
|
18596
|
dataIndex: rec.FieldName,
|
18597
|
filter: {
|
18598
|
itemDefaults: {
|
18599
|
emptyText: 'Search for...'
|
18600
|
}
|
18601
|
},
|
18602
|
editor: {
|
18603
|
allowBlank: null_,
|
18604
|
xtype: 'lookupemployee',
|
18605
|
readOnly: ReadOnly_,
|
18606
|
isGrid: true,
|
18607
|
fieldTarget: targetField_,
|
18608
|
fieldValue: fieldValue_,
|
18609
|
isGrid: true,
|
18610
|
id: tableName + rec.FieldName,
|
18611
|
tableName: rec.TableRef,
|
18612
|
triggerCls: 'x-form-search-trigger',
|
18613
|
vtype: 'alphanum',
|
18614
|
listeners: {
|
18615
|
change: function (val) {
|
18616
|
var custumFunc = rec.SelectFunction;
|
18617
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
18618
|
Ext.Ajax.request({
|
18619
|
async: false,
|
18620
|
method: 'POST',
|
18621
|
url: '/UserControl/GetStore',
|
18622
|
params: {
|
18623
|
tableName: 'PCMFUNC',
|
18624
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
18625
|
},
|
18626
|
success: function (response) {
|
18627
|
var results = Ext.decode(response.responseText);
|
18628
|
data_ = results.data[0];
|
18629
|
if (data_ != undefined) {
|
18630
|
custumFunc = data_.FunctionCode;
|
18631
|
}
|
18632
|
}
|
18633
|
});
|
18634
|
}
|
18635
|
if (custumFunc) {
|
18636
|
eval(custumFunc)
|
18637
|
}
|
18638
|
}
|
18639
|
}
|
18640
|
}
|
18641
|
});
|
18642
|
} else if (rec.FixedValue != '') {
|
18643
|
cols.push({
|
18644
|
text: rec.HeaderTitle,
|
18645
|
hidden: Hidden_,
|
18646
|
dataIndex: rec.FieldName,
|
18647
|
|
18648
|
filter: {
|
18649
|
itemDefaults: {
|
18650
|
emptyText: 'Search for...'
|
18651
|
}
|
18652
|
},
|
18653
|
autoSizeColumn: true,
|
18654
|
width: 200,
|
18655
|
editor: {
|
18656
|
allowBlank: null_,
|
18657
|
xtype: 'minovafixvalue',
|
18658
|
readOnly: ReadOnly_,
|
18659
|
forceSelection: false,
|
18660
|
id: tableName + rec.FieldName,
|
18661
|
nameTable: tableName,
|
18662
|
fieldGrid: rec.FieldName,
|
18663
|
fixedValue: rec.FixedValue,
|
18664
|
valueField: 'code',
|
18665
|
displayField: 'desc',
|
18666
|
value: defaultValue,
|
18667
|
/*Add by Midi 12 Juni 2019*/
|
18668
|
listeners: {
|
18669
|
change: function (val) {
|
18670
|
var custumFunc = rec.SelectFunction;
|
18671
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
18672
|
Ext.Ajax.request({
|
18673
|
async: false,
|
18674
|
method: 'POST',
|
18675
|
url: '/UserControl/GetStore',
|
18676
|
params: {
|
18677
|
tableName: 'PCMFUNC',
|
18678
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
18679
|
},
|
18680
|
success: function (response) {
|
18681
|
var results = Ext.decode(response.responseText);
|
18682
|
var dt = results.data[0];
|
18683
|
if (dt != undefined) {
|
18684
|
custumFunc = dt.FunctionCode;
|
18685
|
}
|
18686
|
}
|
18687
|
});
|
18688
|
}
|
18689
|
if (custumFunc) {
|
18690
|
eval(custumFunc)
|
18691
|
}
|
18692
|
}
|
18693
|
}
|
18694
|
//
|
18695
|
},
|
18696
|
renderer: function (value) {
|
18697
|
var val = "";
|
18698
|
var storeData = [];
|
18699
|
var str = rec.FixedValue;
|
18700
|
var hasil = str.split('||');
|
18701
|
hasil.forEach(function (h) {
|
18702
|
store_ = h.split('=')
|
18703
|
storeData.push({
|
18704
|
code: store_[0],
|
18705
|
desc: store_[1]
|
18706
|
});
|
18707
|
});
|
18708
|
var item = storeData.find(x => x.code == value);
|
18709
|
if (item != undefined) {
|
18710
|
val = item.desc;
|
18711
|
}
|
18712
|
return val;
|
18713
|
}
|
18714
|
});
|
18715
|
} else if (rec.FieldDataType == 3) {
|
18716
|
cols.push({
|
18717
|
text: rec.HeaderTitle,
|
18718
|
hidden: Hidden_,
|
18719
|
dataIndex: rec.FieldName,
|
18720
|
isSummary:isSum,
|
18721
|
filter: {
|
18722
|
itemDefaults: {
|
18723
|
emptyText: 'Search for...'
|
18724
|
}
|
18725
|
},
|
18726
|
autoSizeColumn: true,
|
18727
|
width: 200,
|
18728
|
editor: {
|
18729
|
allowBlank: null_,
|
18730
|
xtype: 'textfield',
|
18731
|
readOnly: ReadOnly_,
|
18732
|
id: tableName + rec.FieldName,
|
18733
|
nameTable: rec.TableName,
|
18734
|
fieldGrid: rec.FieldName,
|
18735
|
vtype: 'validateDecimal',
|
18736
|
maxLength: rec.Length,
|
18737
|
precision: rec.Prec,
|
18738
|
fieldStyle: 'text-align:right;',
|
18739
|
value: defaultValue,
|
18740
|
listeners: {
|
18741
|
change: function (val) {
|
18742
|
var custumFunc = rec.SelectFunction;
|
18743
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
18744
|
Ext.Ajax.request({
|
18745
|
async: false,
|
18746
|
method: 'POST',
|
18747
|
url: '/UserControl/GetStore',
|
18748
|
params: {
|
18749
|
tableName: 'PCMFUNC',
|
18750
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
18751
|
},
|
18752
|
success: function (response) {
|
18753
|
var results = Ext.decode(response.responseText);
|
18754
|
var dt = results.data[0];
|
18755
|
if (dt != undefined) {
|
18756
|
custumFunc = dt.FunctionCode;
|
18757
|
}
|
18758
|
}
|
18759
|
});
|
18760
|
}
|
18761
|
if (custumFunc) {
|
18762
|
eval(custumFunc)
|
18763
|
}
|
18764
|
}
|
18765
|
}
|
18766
|
}
|
18767
|
});
|
18768
|
} else {
|
18769
|
cols.push({
|
18770
|
text: rec.HeaderTitle,
|
18771
|
hidden: Hidden_,
|
18772
|
dataIndex: rec.FieldName,
|
18773
|
// isSummary: isSum,
|
18774
|
filter: {
|
18775
|
itemDefaults: {
|
18776
|
emptyText: 'Search for...'
|
18777
|
}
|
18778
|
},
|
18779
|
autoSizeColumn: true,
|
18780
|
width: 200,
|
18781
|
minWidth: 150,
|
18782
|
editor: {
|
18783
|
allowBlank: null_,
|
18784
|
xtype: 'textfield',
|
18785
|
readOnly: ReadOnly_,
|
18786
|
id: tableName + rec.FieldName,
|
18787
|
value: defaultValue,
|
18788
|
listeners: {
|
18789
|
change: function (val) {
|
18790
|
var custumFunc = rec.SelectFunction;
|
18791
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
18792
|
Ext.Ajax.request({
|
18793
|
async: false,
|
18794
|
method: 'POST',
|
18795
|
url: '/UserControl/GetStore',
|
18796
|
params: {
|
18797
|
tableName: 'PCMFUNC',
|
18798
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
18799
|
},
|
18800
|
success: function (response) {
|
18801
|
var results = Ext.decode(response.responseText);
|
18802
|
data_ = results.data[0];
|
18803
|
if (data_ != undefined) {
|
18804
|
custumFunc = data_.FunctionCode;
|
18805
|
}
|
18806
|
}
|
18807
|
});
|
18808
|
}
|
18809
|
if (custumFunc) {
|
18810
|
eval(custumFunc)
|
18811
|
}
|
18812
|
}
|
18813
|
}
|
18814
|
}
|
18815
|
});
|
18816
|
}
|
18817
|
break
|
18818
|
}
|
18819
|
} else {
|
18820
|
cols.push({
|
18821
|
text: rec.HeaderTitle,
|
18822
|
hidden: Hidden_,
|
18823
|
dataIndex: rec.FieldName,
|
18824
|
hidden: true,
|
18825
|
editor: {
|
18826
|
allowBlank: true,
|
18827
|
xtype: 'textfield',
|
18828
|
readOnly: ReadOnly_,
|
18829
|
id: tableName + rec.FieldName,
|
18830
|
value: defaultValue
|
18831
|
},
|
18832
|
filter: {
|
18833
|
itemDefaults: {
|
18834
|
emptyText: 'Search for...'
|
18835
|
}
|
18836
|
}
|
18837
|
});
|
18838
|
}
|
18839
|
});
|
18840
|
};
|
18841
|
addData = addData + "})";
|
18842
|
this.cellEditing = new Ext.grid.plugin.CellEditing({
|
18843
|
clicksToEdit: 1
|
18844
|
});
|
18845
|
Ext.applyIf(me, {
|
18846
|
items: [{
|
18847
|
xtype: 'grid',
|
18848
|
autoScroll: true,
|
18849
|
id: gridName,
|
18850
|
name: gridName,
|
18851
|
height: height,
|
18852
|
store: Ext.create('Ext.data.Store', {
|
18853
|
storeId: storeID,
|
18854
|
fields: fieldStore,
|
18855
|
proxy: {
|
18856
|
method: 'POST',
|
18857
|
type: 'ajax',
|
18858
|
url: '',
|
18859
|
reader: {
|
18860
|
type: 'json',
|
18861
|
root: 'data'
|
18862
|
}
|
18863
|
}
|
18864
|
}),
|
18865
|
dockedItems: [{
|
18866
|
xtype: 'toolbar',
|
18867
|
items: [{
|
18868
|
text: 'Add',
|
18869
|
name: 'add' + tableName,
|
18870
|
iconCls: 'fa-plus-circle',
|
18871
|
style: 'font-family: FontAwesome',
|
18872
|
handler: function () {
|
18873
|
var store = Ext.StoreMgr.lookup(storeID);
|
18874
|
var data = eval(addData);
|
18875
|
if (me.transType == "FIN") {
|
18876
|
var fp = Ext.ComponentQuery.query("[name=FiscalPeriod]")[0].getValue();
|
18877
|
var fy = Ext.ComponentQuery.query("[name=FiscalYear]")[0].getValue();
|
18878
|
var cp = Ext.ComponentQuery.query("[name=CompanyID]")[0].getValue();
|
18879
|
var bu = Ext.ComponentQuery.query("[name=BusinessUnit]")[0].getValue();
|
18880
|
data["FiscalPeriod"] = fp;
|
18881
|
data["FiscalYear"] = fy;
|
18882
|
data["CompanyID"] = cp;
|
18883
|
data["BusinessUnit"] = bu;
|
18884
|
}
|
18885
|
idx = store.getCount();
|
18886
|
store.insert(idx, data);
|
18887
|
|
18888
|
|
18889
|
}
|
18890
|
}, {
|
18891
|
text: 'Delete',
|
18892
|
name: 'delete' + tableName,
|
18893
|
iconCls: 'fa-trash-o',
|
18894
|
style: 'font-family: FontAwesome',
|
18895
|
handler: function () {
|
18896
|
var me = this,
|
18897
|
store = Ext.StoreMgr.lookup(storeID);
|
18898
|
var grid = Ext.getCmp(gridName);
|
18899
|
Ext.MessageBox.show({
|
18900
|
title: 'Remove tab',
|
18901
|
msg: "This will remove. Do you want to continue?",
|
18902
|
buttons: Ext.MessageBox.YESNO,
|
18903
|
fn: function (choice) {
|
18904
|
console.log(choice);
|
18905
|
if (choice === 'yes') {
|
18906
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
18907
|
if (selection) {
|
18908
|
store.remove(selection);
|
18909
|
}
|
18910
|
}
|
18911
|
}
|
18912
|
});
|
18913
|
}
|
18914
|
} ,
|
18915
|
{
|
18916
|
text: 'Load',
|
18917
|
hidden: hideLoad,
|
18918
|
name: 'load' + tableName,
|
18919
|
iconCls: 'icon-arrow-down',
|
18920
|
style: 'font-family: FontAwesome',
|
18921
|
handler: function () {
|
18922
|
var getPnl = Ext.ComponentQuery.query('[name=panelTabPTRPURCHITEM]')[0];
|
18923
|
var getTbl = getPnl.query('[name=gridCELLGRIDPTRPURCHITEM]')[0];
|
18924
|
var recC = getTbl.getStore().data.items;
|
18925
|
var obj = [];
|
18926
|
for (var i = 0; i < recC.length; i++) {
|
18927
|
var temp = [];
|
18928
|
temp.push(recC[i]);
|
18929
|
Ext.each(temp, function (rec) {
|
18930
|
var x = Ext.decode(Ext.encode(rec.data));
|
18931
|
obj.push(x);
|
18932
|
});
|
18933
|
}
|
18934
|
store = Ext.StoreMgr.lookup(storeID);
|
18935
|
var afterCheck = store.getNewRecords();
|
18936
|
if (afterCheck.length != '0') {
|
18937
|
store.remove(afterCheck);
|
18938
|
}
|
18939
|
idx = store.getCount();
|
18940
|
var x = null;
|
18941
|
var y = [];
|
18942
|
var _data = [];
|
18943
|
Ext.each(obj , function (rec) {
|
18944
|
Ext.Ajax.request({
|
18945
|
async: false,
|
18946
|
method: 'POST',
|
18947
|
url: '/UserControl/GetStore',
|
18948
|
params: {
|
18949
|
//tableName: 'PMDMAT0001',
|
18950
|
//param: 'MaterialID[=]' + x.Material
|
18951
|
tableName: 'CDSCTRPURCHDETITEM', //'CTRPURCHDETITEM',
|
18952
|
param: rec.Material + "," + rec.ItemType//'Material[=]' + rec.MaterialID
|
18953
|
},
|
18954
|
success: function (response) {
|
18955
|
var results = Ext.decode(response.responseText);
|
18956
|
x = results.data;
|
18957
|
}
|
18958
|
});
|
18959
|
if (x.length != 0){
|
18960
|
y.push(x);
|
18961
|
}
|
18962
|
});
|
18963
|
Ext.each(y, function (dum) {
|
18964
|
Ext.each(dum, function (yuk) {
|
18965
|
_data.push(yuk);
|
18966
|
});
|
18967
|
});
|
18968
|
store.insert(idx, _data);
|
18969
|
}
|
18970
|
},
|
18971
|
]
|
18972
|
}
|
18973
|
],
|
18974
|
columns: cols,
|
18975
|
selModel: {
|
18976
|
type: 'cellmodel'
|
18977
|
},
|
18978
|
plugins: [this.cellEditing],
|
18979
|
//For Auto Size Coloum Mode - Nana
|
18980
|
viewConfig: {
|
18981
|
emptyText: 'No Data Display',
|
18982
|
deferEmptyText: false,
|
18983
|
listeners: {
|
18984
|
refresh: function (dataview) {
|
18985
|
Ext.each(dataview.panel.columns, function (column) {
|
18986
|
if (column.autoSizeColumn == false)
|
18987
|
column.autoSizeColumn = true;
|
18988
|
column.autoSize();
|
18989
|
})
|
18990
|
}
|
18991
|
}
|
18992
|
},listeners: {
|
18993
|
'beforeedit': function (editor, e, eOpts) {
|
18994
|
if (e.colIdx == 2 && tableName == 'PTRMATERIALITEM') {
|
18995
|
var store = Ext.StoreMgr.lookup('store_' + tableName + 'MaterialID');
|
18996
|
var itemType = e.record.get('ItemType');
|
18997
|
console.log(itemType);
|
18998
|
if (itemType == '0') {
|
18999
|
store.proxy.extraParams = {
|
19000
|
tableName: 'PDSTRANSITEMS',
|
19001
|
param: "TableName[=]PMDMAT0001",
|
19002
|
menuId: MinovaUtil.GetMenuID()
|
19003
|
};
|
19004
|
} else if (itemType == '1') {
|
19005
|
store.proxy.extraParams = {
|
19006
|
tableName: 'PDSTRANSITEMS',
|
19007
|
param: "TableName[=]PMDSRV0001",
|
19008
|
menuId: MinovaUtil.GetMenuID()
|
19009
|
};
|
19010
|
} else if (itemType == '2') {
|
19011
|
store.proxy.extraParams = {
|
19012
|
tableName: 'PDSTRANSITEMS',
|
19013
|
param: "TableName[=]PMDAST0001",
|
19014
|
menuId: MinovaUtil.GetMenuID()
|
19015
|
};
|
19016
|
} else {
|
19017
|
store.proxy.extraParams = {
|
19018
|
tableName: '',
|
19019
|
param: "",
|
19020
|
menuId: MinovaUtil.GetMenuID()
|
19021
|
};
|
19022
|
}
|
19023
|
store.removeAll();
|
19024
|
store.reload();
|
19025
|
}
|
19026
|
}
|
19027
|
}
|
19028
|
}
|
19029
|
]
|
19030
|
});
|
19031
|
me.callParent(arguments);
|
19032
|
}
|
19033
|
});
|
19034
|
/*Add by Taufan ( Generate Doc Transaction Cell Edit Grid Sum For ERP )*/
|
19035
|
Ext.define('MinovaUtil.MinovaES.MinovaDocGridCellEditSum', {
|
19036
|
extend: 'Ext.form.Panel',
|
19037
|
alias: 'widget.docgridcelleditsum',
|
19038
|
requires: [
|
19039
|
'Ext.grid.plugin.CellEditing',
|
19040
|
'Ext.grid.Panel',
|
19041
|
'Ext.grid.RowNumberer'
|
19042
|
],
|
19043
|
autoScroll: true,
|
19044
|
anchor: '100%',
|
19045
|
tableName: undefined,
|
19046
|
docType: undefined,
|
19047
|
transType: undefined,
|
19048
|
docNo: undefined,
|
19049
|
hideButton: undefined,
|
19050
|
multiSelect: undefined,
|
19051
|
initComponent: function () {
|
19052
|
var me = this;
|
19053
|
var isLookup = me.isLookup;
|
19054
|
var hide_ = false;
|
19055
|
var hideUploadDownload = false;
|
19056
|
var widthLock = 250;
|
19057
|
var checkSelection = '';
|
19058
|
|
19059
|
Ext.Ajax.request({
|
19060
|
async: false,
|
19061
|
method: 'POST',
|
19062
|
url: '/UserControl/GetStore',
|
19063
|
params: {
|
19064
|
tableName: "PCMBSTRANSLIST",
|
19065
|
param: 'TableName[=]' + me.tableName
|
19066
|
},
|
19067
|
success: function (response) {
|
19068
|
var results = Ext.decode(response.responseText);
|
19069
|
if (results.data[0].UploadDownloadEnable == '0') {
|
19070
|
hideUploadDownload = true;
|
19071
|
} else {
|
19072
|
hideUploadDownload = false;
|
19073
|
}
|
19074
|
}
|
19075
|
});
|
19076
|
|
19077
|
if (me.hideButton == true) {
|
19078
|
hide_ = true;
|
19079
|
}
|
19080
|
if (me.multiSelect) {
|
19081
|
locking = false;
|
19082
|
checkSelection = 'checkboxmodel';
|
19083
|
widthLock = 40;
|
19084
|
}
|
19085
|
var tableName = me.tableName;
|
19086
|
var cols = [];
|
19087
|
var fieldStore = [];
|
19088
|
var _url = 'GetAllField';
|
19089
|
var hasil = null;
|
19090
|
var height = me.height;
|
19091
|
var storeID = 'store' + me.tableName;
|
19092
|
var gridName = 'grid' + me.name;
|
19093
|
if (me.storeName) {
|
19094
|
storeID = me.storeName;
|
19095
|
}
|
19096
|
var LangID = MinovaUtil.GetLangID();
|
19097
|
var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',DocType='" + me.docType + "'";
|
19098
|
Ext.Ajax.request({
|
19099
|
async: false,
|
19100
|
method: 'POST',
|
19101
|
url: '/UserControl/GetStore',
|
19102
|
params: {
|
19103
|
tableName: 'PDSDOCFIELD',
|
19104
|
param: parameter
|
19105
|
},
|
19106
|
success: function (response) {
|
19107
|
var results = Ext.decode(response.responseText);
|
19108
|
hasil = results.data;
|
19109
|
}
|
19110
|
});
|
19111
|
cols.push({
|
19112
|
xtype: 'rownumberer'
|
19113
|
});
|
19114
|
var addData = '({';
|
19115
|
if (hasil.length > 0) {
|
19116
|
Ext.each(hasil, function (rec) {
|
19117
|
fieldStore.push(rec.FieldName);
|
19118
|
var defaultValue = rec.DefaultValue;
|
19119
|
if (defaultValue.substring(0, 2).toLowerCase() == 'fn') {
|
19120
|
Ext.Ajax.request({
|
19121
|
async: false,
|
19122
|
method: 'POST',
|
19123
|
url: '/UserControl/GetStore',
|
19124
|
params: {
|
19125
|
tableName: 'PCMFUNC',
|
19126
|
param: 'FuncName[equal]' + rec.DefaultValue
|
19127
|
},
|
19128
|
success: function (response) {
|
19129
|
var results = Ext.decode(response.responseText);
|
19130
|
data_ = results.data;
|
19131
|
if (data_.length > 0) {
|
19132
|
defaultValue = eval(data_[0].FunctionCode);
|
19133
|
}
|
19134
|
}
|
19135
|
});
|
19136
|
}
|
19137
|
addData = addData + rec.FieldName + ":" + "'" + defaultValue + "',";
|
19138
|
var null_ = null;
|
19139
|
var ReadOnly_ = false;
|
19140
|
if (rec.IsPrimaryKey == true) {
|
19141
|
null_ = false;
|
19142
|
}
|
19143
|
if (rec.IsRequired == true) {
|
19144
|
null_ = false;
|
19145
|
} else {
|
19146
|
null_ = true;
|
19147
|
}
|
19148
|
var Hidden_ = false;
|
19149
|
if (rec.ReadOnly == '1') {
|
19150
|
ReadOnly_ = true;
|
19151
|
}
|
19152
|
if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
|
19153
|
Hidden_ = true;
|
19154
|
null_ = true;
|
19155
|
}
|
19156
|
var isSum = rec.IsSummary;
|
19157
|
if (rec.GridView == 1) {
|
19158
|
switch (rec.FormatRef) {
|
19159
|
case "date":
|
19160
|
cols.push({
|
19161
|
xtype: 'minovadatecolumn',
|
19162
|
hidden: Hidden_,
|
19163
|
text: rec.HeaderTitle,
|
19164
|
dataIndex: rec.FieldName,
|
19165
|
filter: {
|
19166
|
itemDefaults: {
|
19167
|
emptyText: 'Search for...'
|
19168
|
}
|
19169
|
},
|
19170
|
isSummary: isSum,
|
19171
|
editor: {
|
19172
|
allowBlank: null_,
|
19173
|
xtype: 'datefield',
|
19174
|
hideMode: 'visibility',
|
19175
|
readOnly: ReadOnly_,
|
19176
|
id: tableName + rec.FieldName,
|
19177
|
value: defaultValue
|
19178
|
}
|
19179
|
});
|
19180
|
break
|
19181
|
case "amount":
|
19182
|
cols.push({
|
19183
|
xtype: 'numbercolumn',
|
19184
|
text: rec.HeaderTitle,
|
19185
|
align: 'right',
|
19186
|
dataIndex: rec.FieldName,
|
19187
|
isSummary: isSum,
|
19188
|
hidden: Hidden_,
|
19189
|
filter: {
|
19190
|
itemDefaults: {
|
19191
|
emptyText: 'Search for...'
|
19192
|
}
|
19193
|
},
|
19194
|
autoSizeColumn: false,
|
19195
|
width: 140,
|
19196
|
editor: {
|
19197
|
allowBlank: null_,
|
19198
|
xtype: 'textfield',
|
19199
|
readOnly: ReadOnly_,
|
19200
|
id: tableName + rec.FieldName,
|
19201
|
nameTable: rec.TableName,
|
19202
|
fieldGrid: rec.FieldName,
|
19203
|
fieldStyle: 'text-align:right;',
|
19204
|
vtype: 'validateMinovaNumber',
|
19205
|
value: '0',
|
19206
|
listeners: {
|
19207
|
change: function (val, recs) {
|
19208
|
var fvalue = val.getValue();
|
19209
|
var custumFunc = rec.SelectFunction;
|
19210
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
19211
|
Ext.Ajax.request({
|
19212
|
async: false,
|
19213
|
method: 'POST',
|
19214
|
url: '/UserControl/GetStore',
|
19215
|
params: {
|
19216
|
tableName: 'PCMFUNC',
|
19217
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
19218
|
},
|
19219
|
success: function (response) {
|
19220
|
var results = Ext.decode(response.responseText);
|
19221
|
var dt = results.data[0];
|
19222
|
if (dt != undefined) {
|
19223
|
custumFunc = dt.FunctionCode;
|
19224
|
}
|
19225
|
}
|
19226
|
});
|
19227
|
}
|
19228
|
if (custumFunc) {
|
19229
|
eval(custumFunc)
|
19230
|
}
|
19231
|
}
|
19232
|
}
|
19233
|
}
|
19234
|
});
|
19235
|
break
|
19236
|
default:
|
19237
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
|
19238
|
cols.push({
|
19239
|
text: rec.HeaderTitle,
|
19240
|
dataIndex: rec.FieldName,
|
19241
|
width: 100,
|
19242
|
isSummary: isSum,
|
19243
|
filter: {
|
19244
|
type: 'string',
|
19245
|
itemDefaults: {
|
19246
|
emptyText: 'Search for...'
|
19247
|
}
|
19248
|
}
|
19249
|
});
|
19250
|
} else if (rec.SearchType == '0') {
|
19251
|
var valueField = null;
|
19252
|
var displayValue = null;
|
19253
|
var TableRef = undefined;
|
19254
|
if (rec.TableRef != '') {
|
19255
|
TableRef = rec.TableRef;
|
19256
|
Ext.Ajax.request({
|
19257
|
async: false,
|
19258
|
method: 'POST',
|
19259
|
url: '/UserControl/GetStore',
|
19260
|
params: {
|
19261
|
tableName: 'SDATATABLEFIELD',
|
19262
|
param: 'TableName[equal]' + rec.TableRef
|
19263
|
},
|
19264
|
success: function (response) {
|
19265
|
var results = Ext.decode(response.responseText);
|
19266
|
data_ = results.data;
|
19267
|
if (data_ != undefined) {
|
19268
|
valueField_ = $.grep(data_, function (r) {
|
19269
|
return r.ValueField == '1'
|
19270
|
});
|
19271
|
valueField = valueField_[0].FieldName
|
19272
|
displayValue_ = $.grep(data_, function (r) {
|
19273
|
return r.DisplayValue == '1'
|
19274
|
});
|
19275
|
displayValue = displayValue_[0].FieldName
|
19276
|
}
|
19277
|
}
|
19278
|
});
|
19279
|
}
|
19280
|
Ext.create('Ext.data.Store', {
|
19281
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
19282
|
autoLoad: true,
|
19283
|
proxy: {
|
19284
|
method: 'POST',
|
19285
|
type: 'ajax',
|
19286
|
url: '/UserControl/GetStoreAuth',
|
19287
|
extraParams: {
|
19288
|
tableName: TableRef,
|
19289
|
param: rec.ParamCombo,
|
19290
|
menuId: MinovaUtil.GetMenuID()
|
19291
|
},
|
19292
|
reader: {
|
19293
|
type: 'json',
|
19294
|
root: 'data',
|
19295
|
totalProperty: 'data[0].TotalCount'
|
19296
|
}
|
19297
|
}
|
19298
|
});
|
19299
|
cols.push({
|
19300
|
xtype: 'minovacombocolumn',
|
19301
|
hidden: Hidden_,
|
19302
|
text: rec.HeaderTitle,
|
19303
|
dataIndex: rec.FieldName,
|
19304
|
valueField: valueField,
|
19305
|
displayField: displayValue,
|
19306
|
store: 'store_' + me.tableName + rec.FieldName,
|
19307
|
isSummary: isSum,
|
19308
|
autoSizeColumn: true,
|
19309
|
width: 200,
|
19310
|
minWidth: 150,
|
19311
|
editor: {
|
19312
|
allowBlank: null_,
|
19313
|
xtype: 'minovacombobox',
|
19314
|
readOnly: ReadOnly_,
|
19315
|
id: tableName + rec.FieldName,
|
19316
|
valueField: valueField,
|
19317
|
displayField: displayValue,
|
19318
|
store: 'store_' + me.tableName + rec.FieldName,
|
19319
|
forceSelection: false,
|
19320
|
lazyRender: true,
|
19321
|
listeners: {
|
19322
|
change: function (val) {
|
19323
|
var fvalue = val.getValue();
|
19324
|
var custumFunc = rec.SelectFunction;
|
19325
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
19326
|
Ext.Ajax.request({
|
19327
|
async: false,
|
19328
|
method: 'POST',
|
19329
|
url: '/UserControl/GetStore',
|
19330
|
params: {
|
19331
|
tableName: 'PCMFUNC',
|
19332
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
19333
|
},
|
19334
|
success: function (response) {
|
19335
|
var results = Ext.decode(response.responseText);
|
19336
|
var dt = results.data[0];
|
19337
|
if (dt != undefined) {
|
19338
|
custumFunc = dt.FunctionCode;
|
19339
|
}
|
19340
|
}
|
19341
|
});
|
19342
|
}
|
19343
|
if (custumFunc) {
|
19344
|
eval(custumFunc)
|
19345
|
}
|
19346
|
}
|
19347
|
}
|
19348
|
},
|
19349
|
filter: {
|
19350
|
type: 'list',
|
19351
|
itemDefaults: {
|
19352
|
emptyText: 'Search for...'
|
19353
|
}
|
19354
|
}
|
19355
|
});
|
19356
|
} else if (rec.SearchType == '5') {
|
19357
|
var valueField = null;
|
19358
|
var displayValue = null;
|
19359
|
var AdditionaldisplayValue = null;
|
19360
|
var TableRef = undefined;
|
19361
|
if (rec.TableRef != '') {
|
19362
|
TableRef = rec.TableRef;
|
19363
|
Ext.Ajax.request({
|
19364
|
async: false,
|
19365
|
method: 'POST',
|
19366
|
url: '/UserControl/GetStore',
|
19367
|
params: {
|
19368
|
tableName: 'SDATATABLEFIELD',
|
19369
|
param: 'TableName[equal]' + rec.TableRef
|
19370
|
},
|
19371
|
success: function (response) {
|
19372
|
var results = Ext.decode(response.responseText);
|
19373
|
data_ = results.data;
|
19374
|
if (data_ != undefined) {
|
19375
|
valueField_ = $.grep(data_, function (r) {
|
19376
|
return r.ValueField == '1'
|
19377
|
});
|
19378
|
if (valueField_.length > 0) {
|
19379
|
valueField = valueField_[0].FieldName
|
19380
|
}
|
19381
|
|
19382
|
displayValue_ = $.grep(data_, function (r) {
|
19383
|
return r.DisplayValue == '1' || r.DisplayValue == '2'
|
19384
|
});
|
19385
|
if (displayValue_.length > 0) {
|
19386
|
displayValue = displayValue_[0].FieldName;
|
19387
|
}
|
19388
|
if (displayValue_.length >= 2) {
|
19389
|
AdditionaldisplayValue = displayValue_[1].FieldName
|
19390
|
}
|
19391
|
}
|
19392
|
}
|
19393
|
});
|
19394
|
}
|
19395
|
Ext.create('Ext.data.Store', {
|
19396
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
19397
|
autoLoad: true,
|
19398
|
proxy: {
|
19399
|
method: 'POST',
|
19400
|
type: 'ajax',
|
19401
|
url: '/UserControl/GetStoreAuth',
|
19402
|
extraParams: {
|
19403
|
tableName: TableRef,
|
19404
|
param: rec.ParamCombo,
|
19405
|
menuId: MinovaUtil.GetMenuID()
|
19406
|
},
|
19407
|
reader: {
|
19408
|
type: 'json',
|
19409
|
root: 'data',
|
19410
|
totalProperty: 'data[0].TotalCount'
|
19411
|
}
|
19412
|
}
|
19413
|
});
|
19414
|
cols.push({
|
19415
|
xtype: 'minovacombocolumn',
|
19416
|
hidden: Hidden_,
|
19417
|
text: rec.HeaderTitle,
|
19418
|
dataIndex: rec.FieldName,
|
19419
|
valueField: valueField,
|
19420
|
displayField: displayValue,
|
19421
|
store: 'store_' + me.tableName + rec.FieldName,
|
19422
|
tpl: Ext.create('Ext.XTemplate',
|
19423
|
'<ul class="x-list-plain"><tpl for=".">',
|
19424
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
19425
|
'</tpl></ul>'),
|
19426
|
displayTpl: Ext.create('Ext.XTemplate',
|
19427
|
'<tpl for=".">',
|
19428
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
19429
|
'</tpl>'),
|
19430
|
editor: {
|
19431
|
allowBlank: null_,
|
19432
|
xtype: 'combobox',
|
19433
|
readOnly: ReadOnly_,
|
19434
|
id: rec.TableName + rec.FieldName,
|
19435
|
nameTable: rec.TableName,
|
19436
|
fieldGrid: rec.FieldName,
|
19437
|
valueField: valueField,
|
19438
|
displayField: displayValue,
|
19439
|
store: 'store_' + me.tableName + rec.FieldName,
|
19440
|
value: rec.DefaultValue,
|
19441
|
tpl: Ext.create('Ext.XTemplate',
|
19442
|
'<ul class="x-list-plain"><tpl for=".">',
|
19443
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
19444
|
'</tpl></ul>'),
|
19445
|
displayTpl: Ext.create('Ext.XTemplate',
|
19446
|
'<tpl for=".">',
|
19447
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
19448
|
'</tpl>'),
|
19449
|
listeners: {
|
19450
|
change: function (val) {
|
19451
|
var fvalue = val.getValue();
|
19452
|
var custumFunc = rec.SelectFunction;
|
19453
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
19454
|
Ext.Ajax.request({
|
19455
|
async: false,
|
19456
|
method: 'POST',
|
19457
|
url: '/UserControl/GetStore',
|
19458
|
params: {
|
19459
|
tableName: 'PCMFUNC',
|
19460
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
19461
|
},
|
19462
|
success: function (response) {
|
19463
|
var results = Ext.decode(response.responseText);
|
19464
|
var dt = results.data[0];
|
19465
|
if (dt != undefined) {
|
19466
|
custumFunc = dt.FunctionCode;
|
19467
|
}
|
19468
|
}
|
19469
|
});
|
19470
|
}
|
19471
|
if (custumFunc) {
|
19472
|
eval(custumFunc)
|
19473
|
}
|
19474
|
}
|
19475
|
}
|
19476
|
|
19477
|
},
|
19478
|
renderer: function (value) {
|
19479
|
var store = Ext.data.StoreManager.lookup('store_' + me.tableName + rec.FieldName);
|
19480
|
console.log(store);
|
19481
|
var index = store.find(valueField, value);
|
19482
|
var val = "";
|
19483
|
if (index != -1) {
|
19484
|
var rc = store.getAt(index);
|
19485
|
val = rc.get(AdditionaldisplayValue) + ' - ' + rc.get(displayValue);
|
19486
|
} else {
|
19487
|
val = value;
|
19488
|
}
|
19489
|
return val;
|
19490
|
},
|
19491
|
filter: {
|
19492
|
type: 'list',
|
19493
|
itemDefaults: {
|
19494
|
emptyText: 'Search for...'
|
19495
|
}
|
19496
|
},
|
19497
|
tpl: Ext.create('Ext.XTemplate',
|
19498
|
'<ul class="x-list-plain"><tpl for=".">',
|
19499
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
19500
|
'</tpl></ul>'),
|
19501
|
displayTpl: Ext.create('Ext.XTemplate',
|
19502
|
'<tpl for=".">',
|
19503
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
19504
|
'</tpl>')
|
19505
|
});
|
19506
|
} else if (rec.SearchType == '2') {
|
19507
|
var triger = (rec.TriggerCombo).split('$');
|
19508
|
var targetField_ = triger[0];
|
19509
|
var fieldValue_ = triger[1];
|
19510
|
cols.push({
|
19511
|
text: rec.HeaderTitle,
|
19512
|
hidden: Hidden_,
|
19513
|
dataIndex: rec.FieldName,
|
19514
|
isSummary: isSum,
|
19515
|
filter: {
|
19516
|
itemDefaults: {
|
19517
|
emptyText: 'Search for...'
|
19518
|
}
|
19519
|
},
|
19520
|
autoSizeColumn: true,
|
19521
|
width: 200,
|
19522
|
editor: {
|
19523
|
allowBlank: null_,
|
19524
|
xtype: 'minovalookupgrid',
|
19525
|
readOnly: ReadOnly_,
|
19526
|
isGrid: true,
|
19527
|
fieldTarget: targetField_,
|
19528
|
fieldValue: fieldValue_,
|
19529
|
isGrid: true,
|
19530
|
id: tableName + rec.FieldName,
|
19531
|
tableName: rec.TableRef,
|
19532
|
triggerCls: 'x-form-search-trigger',
|
19533
|
vtype: 'alphanum',
|
19534
|
listeners: {
|
19535
|
change: function (val) {
|
19536
|
var custumFunc = rec.SelectFunction;
|
19537
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
19538
|
Ext.Ajax.request({
|
19539
|
async: false,
|
19540
|
method: 'POST',
|
19541
|
url: '/UserControl/GetStore',
|
19542
|
params: {
|
19543
|
tableName: 'PCMFUNC',
|
19544
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
19545
|
},
|
19546
|
success: function (response) {
|
19547
|
var results = Ext.decode(response.responseText);
|
19548
|
var dt = results.data[0];
|
19549
|
if (dt != undefined) {
|
19550
|
custumFunc = dt.FunctionCode;
|
19551
|
}
|
19552
|
}
|
19553
|
});
|
19554
|
}
|
19555
|
if (custumFunc) {
|
19556
|
eval(custumFunc)
|
19557
|
}
|
19558
|
}
|
19559
|
}
|
19560
|
}
|
19561
|
});
|
19562
|
} else if (rec.SearchType == '3') {
|
19563
|
cols.push({
|
19564
|
text: rec.HeaderTitle,
|
19565
|
hidden: Hidden_,
|
19566
|
dataIndex: rec.FieldName,
|
19567
|
isSummary: isSum,
|
19568
|
filter: {
|
19569
|
itemDefaults: {
|
19570
|
emptyText: 'Search for...'
|
19571
|
}
|
19572
|
},
|
19573
|
autoSizeColumn: true,
|
19574
|
width: 200,
|
19575
|
editor: {
|
19576
|
allowBlank: null_,
|
19577
|
xtype: 'MinovaLookupTree',
|
19578
|
readOnly: ReadOnly_,
|
19579
|
id: tableName + rec.FieldName,
|
19580
|
tableName: rec.TableRef,
|
19581
|
triggerCls: 'x-form-search-trigger',
|
19582
|
vtype: 'alphanum',
|
19583
|
treeSructure: rec.SearchFunction,
|
19584
|
objClassValue: rec.ParamCombo,
|
19585
|
listeners: {
|
19586
|
change: function (val) {
|
19587
|
var custumFunc = rec.SelectFunction;
|
19588
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
19589
|
Ext.Ajax.request({
|
19590
|
async: false,
|
19591
|
method: 'POST',
|
19592
|
url: '/UserControl/GetStore',
|
19593
|
params: {
|
19594
|
tableName: 'PCMFUNC',
|
19595
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
19596
|
},
|
19597
|
success: function (response) {
|
19598
|
var results = Ext.decode(response.responseText);
|
19599
|
var dt = results.data[0];
|
19600
|
if (dt != undefined) {
|
19601
|
custumFunc = dt.FunctionCode;
|
19602
|
}
|
19603
|
}
|
19604
|
});
|
19605
|
}
|
19606
|
if (custumFunc) {
|
19607
|
eval(custumFunc)
|
19608
|
}
|
19609
|
}
|
19610
|
}
|
19611
|
}
|
19612
|
});
|
19613
|
} else if (rec.SearchType != '0' && rec.SearchType != '1' && rec.SearchType != '3' && (rec.FieldName == 'EmployeeID' || rec.FieldName == 'ApplicantID' || rec.FieldName == 'EmployeeIDFrom' || rec.FieldName == 'EmployeeIDTo') && isLookup != true) {
|
19614
|
var triger = (rec.TriggerCombo).split('&');
|
19615
|
var targetField_ = triger[0];
|
19616
|
var fieldValue_ = triger[0];
|
19617
|
cols.push({
|
19618
|
text: rec.HeaderTitle,
|
19619
|
hidden: Hidden_,
|
19620
|
dataIndex: rec.FieldName,
|
19621
|
isSummary: isSum,
|
19622
|
filter: {
|
19623
|
itemDefaults: {
|
19624
|
emptyText: 'Search for...'
|
19625
|
}
|
19626
|
},
|
19627
|
autoSizeColumn: true,
|
19628
|
width: 200,
|
19629
|
editor: {
|
19630
|
allowBlank: null_,
|
19631
|
xtype: 'lookupemployee',
|
19632
|
readOnly: ReadOnly_,
|
19633
|
isGrid: true,
|
19634
|
fieldTarget: targetField_,
|
19635
|
fieldValue: fieldValue_,
|
19636
|
isGrid: true,
|
19637
|
id: tableName + rec.FieldName,
|
19638
|
tableName: rec.TableRef,
|
19639
|
triggerCls: 'x-form-search-trigger',
|
19640
|
vtype: 'alphanum',
|
19641
|
listeners: {
|
19642
|
change: function (val) {
|
19643
|
var custumFunc = rec.SelectFunction;
|
19644
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
19645
|
Ext.Ajax.request({
|
19646
|
async: false,
|
19647
|
method: 'POST',
|
19648
|
url: '/UserControl/GetStore',
|
19649
|
params: {
|
19650
|
tableName: 'PCMFUNC',
|
19651
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
19652
|
},
|
19653
|
success: function (response) {
|
19654
|
var results = Ext.decode(response.responseText);
|
19655
|
var dt = results.data[0];
|
19656
|
if (dt != undefined) {
|
19657
|
custumFunc = dt.FunctionCode;
|
19658
|
}
|
19659
|
}
|
19660
|
});
|
19661
|
}
|
19662
|
if (custumFunc) {
|
19663
|
eval(custumFunc)
|
19664
|
}
|
19665
|
}
|
19666
|
}
|
19667
|
}
|
19668
|
});
|
19669
|
} else if (rec.SearchType == '4' && isLookup != true) {
|
19670
|
cols.push({
|
19671
|
text: rec.HeaderTitle,
|
19672
|
hidden: Hidden_,
|
19673
|
dataIndex: rec.FieldName,
|
19674
|
isSummary: isSum,
|
19675
|
filter: {
|
19676
|
itemDefaults: {
|
19677
|
emptyText: 'Search for...'
|
19678
|
}
|
19679
|
},
|
19680
|
autoSizeColumn: true,
|
19681
|
width: 200,
|
19682
|
editor: {
|
19683
|
allowBlank: null_,
|
19684
|
xtype: 'lookupemployee',
|
19685
|
readOnly: ReadOnly_,
|
19686
|
isGrid: true,
|
19687
|
fieldTarget: targetField_,
|
19688
|
fieldValue: fieldValue_,
|
19689
|
isGrid: true,
|
19690
|
id: tableName + rec.FieldName,
|
19691
|
tableName: rec.TableRef,
|
19692
|
triggerCls: 'x-form-search-trigger',
|
19693
|
vtype: 'alphanum',
|
19694
|
listeners: {
|
19695
|
change: function (val) {
|
19696
|
var custumFunc = rec.SelectFunction;
|
19697
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
19698
|
Ext.Ajax.request({
|
19699
|
async: false,
|
19700
|
method: 'POST',
|
19701
|
url: '/UserControl/GetStore',
|
19702
|
params: {
|
19703
|
tableName: 'PCMFUNC',
|
19704
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
19705
|
},
|
19706
|
success: function (response) {
|
19707
|
var results = Ext.decode(response.responseText);
|
19708
|
var dt = results.data[0];
|
19709
|
if (dt != undefined) {
|
19710
|
custumFunc = dt.FunctionCode;
|
19711
|
}
|
19712
|
}
|
19713
|
});
|
19714
|
}
|
19715
|
if (custumFunc) {
|
19716
|
eval(custumFunc)
|
19717
|
}
|
19718
|
}
|
19719
|
}
|
19720
|
}
|
19721
|
});
|
19722
|
} else if (rec.FixedValue != '') {
|
19723
|
cols.push({
|
19724
|
text: rec.HeaderTitle,
|
19725
|
hidden: Hidden_,
|
19726
|
dataIndex: rec.FieldName,
|
19727
|
isSummary: isSum,
|
19728
|
filter: {
|
19729
|
itemDefaults: {
|
19730
|
emptyText: 'Search for...'
|
19731
|
}
|
19732
|
},
|
19733
|
autoSizeColumn: true,
|
19734
|
width: 200,
|
19735
|
editor: {
|
19736
|
allowBlank: null_,
|
19737
|
xtype: 'minovafixvalue',
|
19738
|
readOnly: ReadOnly_,
|
19739
|
forceSelection: false,
|
19740
|
id: tableName + rec.FieldName,
|
19741
|
nameTable: tableName,
|
19742
|
fieldGrid: rec.FieldName,
|
19743
|
fixedValue: rec.FixedValue,
|
19744
|
valueField: 'code',
|
19745
|
displayField: 'desc',
|
19746
|
value: defaultValue,
|
19747
|
/*Add by Midi 12 Juni 2019*/
|
19748
|
listeners: {
|
19749
|
change: function (val) {
|
19750
|
var custumFunc = rec.SelectFunction;
|
19751
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
19752
|
Ext.Ajax.request({
|
19753
|
async: false,
|
19754
|
method: 'POST',
|
19755
|
url: '/UserControl/GetStore',
|
19756
|
params: {
|
19757
|
tableName: 'PCMFUNC',
|
19758
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
19759
|
},
|
19760
|
success: function (response) {
|
19761
|
var results = Ext.decode(response.responseText);
|
19762
|
var dt = results.data[0];
|
19763
|
if (dt != undefined) {
|
19764
|
custumFunc = dt.FunctionCode;
|
19765
|
}
|
19766
|
}
|
19767
|
});
|
19768
|
}
|
19769
|
if (custumFunc) {
|
19770
|
eval(custumFunc)
|
19771
|
}
|
19772
|
}
|
19773
|
}
|
19774
|
//
|
19775
|
},
|
19776
|
renderer: function (value) {
|
19777
|
var val = "";
|
19778
|
var storeData = [];
|
19779
|
var str = rec.FixedValue;
|
19780
|
var hasil = str.split('||');
|
19781
|
hasil.forEach(function (h) {
|
19782
|
store_ = h.split('=')
|
19783
|
storeData.push({
|
19784
|
code: store_[0],
|
19785
|
desc: store_[1]
|
19786
|
});
|
19787
|
});
|
19788
|
var item = storeData.find(x => x.code == value);
|
19789
|
if (item != undefined) {
|
19790
|
val = item.desc;
|
19791
|
}
|
19792
|
return val;
|
19793
|
}
|
19794
|
});
|
19795
|
} else if (rec.FieldDataType == 3) {
|
19796
|
cols.push({
|
19797
|
text: rec.HeaderTitle,
|
19798
|
hidden: Hidden_,
|
19799
|
dataIndex: rec.FieldName,
|
19800
|
isSummary: isSum,
|
19801
|
filter: {
|
19802
|
itemDefaults: {
|
19803
|
emptyText: 'Search for...'
|
19804
|
}
|
19805
|
},
|
19806
|
autoSizeColumn: true,
|
19807
|
width: 200,
|
19808
|
editor: {
|
19809
|
allowBlank: null_,
|
19810
|
xtype: 'textfield',
|
19811
|
readOnly: ReadOnly_,
|
19812
|
id: tableName + rec.FieldName,
|
19813
|
nameTable: rec.TableName,
|
19814
|
fieldGrid: rec.FieldName,
|
19815
|
vtype: 'validateDecimal',
|
19816
|
maxLength: rec.Length,
|
19817
|
precision: rec.Prec,
|
19818
|
fieldStyle: 'text-align:right;',
|
19819
|
value: defaultValue,
|
19820
|
listeners: {
|
19821
|
change: function (val) {
|
19822
|
var custumFunc = rec.SelectFunction;
|
19823
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
19824
|
Ext.Ajax.request({
|
19825
|
async: false,
|
19826
|
method: 'POST',
|
19827
|
url: '/UserControl/GetStore',
|
19828
|
params: {
|
19829
|
tableName: 'PCMFUNC',
|
19830
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
19831
|
},
|
19832
|
success: function (response) {
|
19833
|
var results = Ext.decode(response.responseText);
|
19834
|
var dt = results.data[0];
|
19835
|
if (dt != undefined) {
|
19836
|
custumFunc = dt.FunctionCode;
|
19837
|
}
|
19838
|
}
|
19839
|
});
|
19840
|
}
|
19841
|
if (custumFunc) {
|
19842
|
eval(custumFunc)
|
19843
|
}
|
19844
|
}
|
19845
|
}
|
19846
|
}
|
19847
|
});
|
19848
|
} else {
|
19849
|
cols.push({
|
19850
|
text: rec.HeaderTitle,
|
19851
|
hidden: Hidden_,
|
19852
|
dataIndex: rec.FieldName,
|
19853
|
isSummary: isSum,
|
19854
|
filter: {
|
19855
|
itemDefaults: {
|
19856
|
emptyText: 'Search for...'
|
19857
|
}
|
19858
|
},
|
19859
|
autoSizeColumn: true,
|
19860
|
width: 200,
|
19861
|
editor: {
|
19862
|
allowBlank: null_,
|
19863
|
xtype: 'textfield',
|
19864
|
readOnly: ReadOnly_,
|
19865
|
id: tableName + rec.FieldName,
|
19866
|
value: defaultValue,
|
19867
|
listeners: {
|
19868
|
change: function (val) {
|
19869
|
var custumFunc = rec.SelectFunction;
|
19870
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
19871
|
Ext.Ajax.request({
|
19872
|
async: false,
|
19873
|
method: 'POST',
|
19874
|
url: '/UserControl/GetStore',
|
19875
|
params: {
|
19876
|
tableName: 'PCMFUNC',
|
19877
|
param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
|
19878
|
},
|
19879
|
success: function (response) {
|
19880
|
var results = Ext.decode(response.responseText);
|
19881
|
var dt = results.data[0];
|
19882
|
if (dt != undefined) {
|
19883
|
custumFunc = dt.FunctionCode;
|
19884
|
}
|
19885
|
}
|
19886
|
});
|
19887
|
}
|
19888
|
if (custumFunc) {
|
19889
|
eval(custumFunc)
|
19890
|
}
|
19891
|
}
|
19892
|
}
|
19893
|
}
|
19894
|
});
|
19895
|
}
|
19896
|
break
|
19897
|
}
|
19898
|
} else {
|
19899
|
cols.push({
|
19900
|
text: rec.HeaderTitle,
|
19901
|
hidden: Hidden_,
|
19902
|
dataIndex: rec.FieldName,
|
19903
|
isSummary: isSum,
|
19904
|
hidden: true,
|
19905
|
editor: {
|
19906
|
allowBlank: true,
|
19907
|
xtype: 'textfield',
|
19908
|
readOnly: ReadOnly_,
|
19909
|
id: tableName + rec.FieldName,
|
19910
|
value: defaultValue
|
19911
|
},
|
19912
|
filter: {
|
19913
|
itemDefaults: {
|
19914
|
emptyText: 'Search for...'
|
19915
|
}
|
19916
|
}
|
19917
|
});
|
19918
|
}
|
19919
|
});
|
19920
|
};
|
19921
|
addData = addData + "})";
|
19922
|
Ext.applyIf(me, {
|
19923
|
items: [{
|
19924
|
xtype: 'grid',
|
19925
|
autoScroll: true,
|
19926
|
id: gridName,
|
19927
|
name: gridName,
|
19928
|
height: height,
|
19929
|
store: Ext.create('Ext.data.Store', {
|
19930
|
storeId: storeID,
|
19931
|
fields: fieldStore,
|
19932
|
proxy: {
|
19933
|
method: 'POST',
|
19934
|
type: 'ajax',
|
19935
|
url: '',
|
19936
|
reader: {
|
19937
|
type: 'json',
|
19938
|
root: 'data'
|
19939
|
}
|
19940
|
}
|
19941
|
}),
|
19942
|
dockedItems: [{
|
19943
|
xtype: 'toolbar',
|
19944
|
items: [{
|
19945
|
text: 'Add',
|
19946
|
hidden: hide_,
|
19947
|
name: 'add' + tableName,
|
19948
|
iconCls: 'fa-plus-circle',
|
19949
|
style: 'font-family: FontAwesome',
|
19950
|
handler: function () {
|
19951
|
var store = Ext.StoreMgr.lookup(storeID);
|
19952
|
var data = eval(addData);
|
19953
|
if (me.transType == "FIN") {
|
19954
|
var fp = Ext.ComponentQuery.query("[name=FiscalPeriod]")[0].getValue();
|
19955
|
var fy = Ext.ComponentQuery.query("[name=FiscalYear]")[0].getValue();
|
19956
|
var cp = Ext.ComponentQuery.query("[name=CompanyID]")[0].getValue();
|
19957
|
var bu = Ext.ComponentQuery.query("[name=BusinessUnit]")[0].getValue();
|
19958
|
// var cc = Ext.ComponentQuery.query("[name=CostCenter]")[0].getValue();
|
19959
|
// var desc = Ext.ComponentQuery.query("[name=Description]")[0].getValue();
|
19960
|
data["FiscalPeriod"] = fp;
|
19961
|
data["FiscalYear"] = fy;
|
19962
|
data["CompanyID"] = cp;
|
19963
|
data["BusinessUnit"] = bu;
|
19964
|
// data["CostCenter"] = cc;
|
19965
|
// data["Description"] = desc;
|
19966
|
}
|
19967
|
idx = store.getCount();
|
19968
|
store.insert(idx, data);
|
19969
|
|
19970
|
|
19971
|
|
19972
|
}
|
19973
|
}, {
|
19974
|
text: 'Delete',
|
19975
|
hidden: hide_,
|
19976
|
name: 'delete' + tableName,
|
19977
|
iconCls: 'fa-trash-o',
|
19978
|
style: 'font-family: FontAwesome',
|
19979
|
handler: function () {
|
19980
|
var me = this,
|
19981
|
store = Ext.StoreMgr.lookup(storeID)
|
19982
|
var grid = Ext.getCmp(gridName);
|
19983
|
Ext.MessageBox.show({
|
19984
|
title: 'Remove tab',
|
19985
|
msg: "This will remove. Do you want to continue?",
|
19986
|
buttons: Ext.MessageBox.YESNO,
|
19987
|
fn: function (choice) {
|
19988
|
if (choice === 'yes') {
|
19989
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
19990
|
if (selection) {
|
19991
|
store.remove(selection);
|
19992
|
}
|
19993
|
}
|
19994
|
}
|
19995
|
});
|
19996
|
}
|
19997
|
}, {
|
19998
|
xtype: 'filefield',
|
19999
|
buttonOnly: true,
|
20000
|
buttonConfig: {
|
20001
|
width: 160,
|
20002
|
text: 'Upload',
|
20003
|
ui: 'default-toolbar',
|
20004
|
iconCls: 'icon-arrow-up',
|
20005
|
style: 'font-family: FontAwesome',
|
20006
|
hidden: hideUploadDownload,
|
20007
|
name: 'upload' + tableName,
|
20008
|
html: "<input id='inputFile' type='file' name='uploaded'/>",
|
20009
|
},
|
20010
|
listeners: {
|
20011
|
change: function (f, value) {
|
20012
|
var store = Ext.StoreMgr.lookup(storeID);
|
20013
|
var newValue = '';
|
20014
|
var afterDot = '';
|
20015
|
var files = event.target.files;
|
20016
|
var fileName = files[0].name;
|
20017
|
var fileType = fileName.substr(fileName.indexOf('.'));
|
20018
|
if (!files || files.length == 0) {
|
20019
|
MinovaMessageError("File Error", "FILOFILE", "");
|
20020
|
} else {
|
20021
|
if (fileType == '.xls' || fileType == '.xlsx') {
|
20022
|
var reader = new FileReader();
|
20023
|
|
20024
|
//For Browsers other than IE.
|
20025
|
if (reader.readAsBinaryString) {
|
20026
|
reader.onload = function (e) {
|
20027
|
var data = e.target.result;
|
20028
|
//Read the Excel File data.
|
20029
|
var workbook = XLSX.read(data, {
|
20030
|
type: 'binary'
|
20031
|
});
|
20032
|
//Fetch the name of First Sheet.
|
20033
|
var firstSheet = workbook.SheetNames[0];
|
20034
|
|
20035
|
//Read all rows from First Sheet into an JSON array.
|
20036
|
var excelRows = XLSX.utils.sheet_to_row_object_array(workbook.Sheets[firstSheet]);
|
20037
|
var data = eval(excelRows);
|
20038
|
var dataLength = data.length;
|
20039
|
idx = store.getCount();
|
20040
|
var seq = idx + 1;
|
20041
|
var dn = Ext.ComponentQuery.query("[name=DocNo]")[0].getValue();
|
20042
|
for (var i = 0; i < dataLength; i++) {
|
20043
|
data[i]["DocNo"] = dn;
|
20044
|
data[i]["DocItemID"] = seq;
|
20045
|
if (me.transType == "MTR" || me.transType == "PUR") {
|
20046
|
data[i].ARAPID = "";
|
20047
|
data[i].DocItemRef = "";
|
20048
|
}
|
20049
|
if (me.transType == "MTR") {
|
20050
|
data[i].Storage = "";
|
20051
|
}
|
20052
|
seq = seq + 1;
|
20053
|
}
|
20054
|
|
20055
|
var fields = store.model.getFields();
|
20056
|
var gridFields = []
|
20057
|
for (var i = 0; i < fields.length; i++) {
|
20058
|
gridFields.push(fields[i].name);
|
20059
|
}
|
20060
|
|
20061
|
var index = [];
|
20062
|
// build the index
|
20063
|
for (var x in excelRows[0]) {
|
20064
|
index.push(x);
|
20065
|
}
|
20066
|
var excelFields = []
|
20067
|
for (var i = 0; i < index.length; i++) {
|
20068
|
excelFields.push(index[i]);
|
20069
|
}
|
20070
|
|
20071
|
var template = [];
|
20072
|
for (var i = 0; i < excelFields.length; i++) {
|
20073
|
for (var j = 0; j < gridFields.length; j++) {
|
20074
|
if (excelFields[i] === gridFields[j]) {
|
20075
|
template.push(excelFields[i]);
|
20076
|
}
|
20077
|
}
|
20078
|
}
|
20079
|
if (excelFields.length === template.length) {
|
20080
|
store.insert(idx, data);
|
20081
|
} else {
|
20082
|
MinovaMessageError("Template Error", "FILOFILETEMPLATE", "");
|
20083
|
}
|
20084
|
};
|
20085
|
reader.readAsBinaryString(files[0]);
|
20086
|
|
20087
|
} else {
|
20088
|
MinovaMessageError("FileReader Error", "FILOFILEREADER", "");
|
20089
|
}
|
20090
|
} else {
|
20091
|
MinovaMessageError("File Type Error", "FILOUPLOAD", "");
|
20092
|
}
|
20093
|
}
|
20094
|
}
|
20095
|
}
|
20096
|
}, {
|
20097
|
text: 'Download',
|
20098
|
hidden: hideUploadDownload,
|
20099
|
name: 'download' + tableName,
|
20100
|
iconCls: 'icon-arrow-down',
|
20101
|
style: 'font-family: FontAwesome',
|
20102
|
handler: function (b, e) {
|
20103
|
b.up('grid').downloadExcelXml();
|
20104
|
}
|
20105
|
}
|
20106
|
]
|
20107
|
}
|
20108
|
],
|
20109
|
columns: cols,
|
20110
|
selType: 'cellmodel',
|
20111
|
plugins: [
|
20112
|
Ext.create('Ext.grid.plugin.CellEditing', {
|
20113
|
clicksToEdit: 1
|
20114
|
})
|
20115
|
],
|
20116
|
//Add For Auto Size Coloum Mode - Nana
|
20117
|
viewConfig: {
|
20118
|
emptyText: 'No Data Display',
|
20119
|
deferEmptyText: false,
|
20120
|
listeners: {
|
20121
|
refresh: function (dataview) {
|
20122
|
Ext.each(dataview.panel.columns, function (column) {
|
20123
|
if (column.autoSizeColumn == true)
|
20124
|
column.autoSize();
|
20125
|
})
|
20126
|
}
|
20127
|
}
|
20128
|
},
|
20129
|
listeners: {
|
20130
|
'edit': function (editor, e, eOpts) {
|
20131
|
/*Update By Midi 13 Juni 2019*/
|
20132
|
var sumPanel = Ext.ComponentQuery.query('[name=SUM' + tableName + ']')[0];
|
20133
|
var sumForm = sumPanel.getForm();
|
20134
|
var grid = Ext.ComponentQuery.query('[name=' + gridName + ']')[0];
|
20135
|
var sumFields = sumForm.getFields();
|
20136
|
for (var i = 0; i < sumFields.length; i++) {
|
20137
|
var fField = sumFields.items[i].name;
|
20138
|
var fldValue = 0;
|
20139
|
Ext.each(grid.store.getRange(), function (r) {
|
20140
|
var fValue = r.data[fField];
|
20141
|
fldValue = fldValue + parseFloat(fValue);
|
20142
|
});
|
20143
|
|
20144
|
fldValue = Ext.util.Format.number(fldValue, '0,000.00');
|
20145
|
sumForm.findField(fField).setValue(fldValue);
|
20146
|
}
|
20147
|
// var grid = Ext.ComponentQuery.query('[name=' + gridName + ']')[0];
|
20148
|
// var fField = e.field;
|
20149
|
// if (e.column.isSummary == '1') {
|
20150
|
// var fldValue = 0;
|
20151
|
// Ext.each(grid.store.getRange(), function (r) {
|
20152
|
// var fValue = r.data[fField];
|
20153
|
// fldValue = fldValue + parseFloat(fValue);
|
20154
|
// });
|
20155
|
// var sumPanel = Ext.ComponentQuery.query('[name=SUM' + tableName + ']')[0];
|
20156
|
// var sumForm = sumPanel.getForm();
|
20157
|
// fldValue = Ext.util.Format.number(fldValue, '0,000.00');
|
20158
|
// sumForm.findField(fField).setValue(fldValue);
|
20159
|
// }
|
20160
|
}
|
20161
|
// ,
|
20162
|
/*Add By Midi For Store Combobox With Param In Grid */
|
20163
|
// 'beforeedit': function (editor, e, eOpts) {
|
20164
|
// if (e.colIdx == 1 && tableName == 'PTRPURCHITEM') {
|
20165
|
// var store = Ext.StoreMgr.lookup('store_' + tableName + 'Material');
|
20166
|
// var itemType = e.record.get('ItemType');
|
20167
|
// store.clearFilter();
|
20168
|
// store.filter('MaterialType', itemType);
|
20169
|
// }
|
20170
|
// // if (e.colIdx == 1 && tableName == 'PTRFINANCEITEM') {
|
20171
|
// // var store = Ext.StoreMgr.lookup('store_' + tableName + 'GLAccountID');
|
20172
|
// // var itemType = e.record.get('CompanyID');
|
20173
|
// // store.clearFilter();
|
20174
|
// // store.filter('CompanyID', itemType);
|
20175
|
// // }
|
20176
|
// }
|
20177
|
}
|
20178
|
}
|
20179
|
]
|
20180
|
});
|
20181
|
me.callParent(arguments);
|
20182
|
}
|
20183
|
});
|
20184
|
Ext.define('MinovaUtil.MinovaES.LookupDoc', {
|
20185
|
extend : 'Ext.window.Window',
|
20186
|
alias : 'widget.lookupdocument',
|
20187
|
requires : [],
|
20188
|
height : '87%',
|
20189
|
width : '41%',
|
20190
|
minWidth : '50%',
|
20191
|
maxWidth : '100%',
|
20192
|
bodyPadding : 0,
|
20193
|
formname : undefined,
|
20194
|
name : 'LookupDocumentTrans',
|
20195
|
test : undefined,
|
20196
|
vtype : 'validateMinovaXss',
|
20197
|
targetField : undefined,
|
20198
|
valueField : undefined,
|
20199
|
tableName : undefined,
|
20200
|
LookupFunction : undefined,
|
20201
|
isGrid : undefined,
|
20202
|
listeners : {
|
20203
|
afterrender : function (f) {
|
20204
|
f.setTitle('Lookup - Document');
|
20205
|
}
|
20206
|
},
|
20207
|
initComponent : function () {
|
20208
|
var me = this;
|
20209
|
var targetField_ = me.targetField;
|
20210
|
var valueField_ = me.valueField;
|
20211
|
var form = me.test;
|
20212
|
var tableName_ = me.tableName;
|
20213
|
var isGrid = me.isGrid_;
|
20214
|
var LookupFunction = me.LookupFunction;
|
20215
|
param_ = null;
|
20216
|
var filterParam_ = me.filterParam;
|
20217
|
var fieldLabel_ = 'Document No';
|
20218
|
Ext.applyIf(me, {
|
20219
|
items : [{
|
20220
|
items : [{
|
20221
|
xtype : 'tabpanel',
|
20222
|
items : [{
|
20223
|
xtype : 'form',
|
20224
|
title : 'Quick Search',
|
20225
|
height : '70%',
|
20226
|
items : [{
|
20227
|
xtype : 'form',
|
20228
|
name : 'frmSearch',
|
20229
|
width : '100%',
|
20230
|
height : 'auto',
|
20231
|
dockedItems : [{
|
20232
|
xtype : 'toolbar',
|
20233
|
dock : 'top',
|
20234
|
layout : 'vbox',
|
20235
|
bodyPadding : 10,
|
20236
|
border : 0,
|
20237
|
items : [{
|
20238
|
xtype : 'fieldset',
|
20239
|
layout : 'hbox',
|
20240
|
width : '100%',
|
20241
|
border : 0,
|
20242
|
padding : 0,
|
20243
|
items : [{
|
20244
|
xtype : 'textfield',
|
20245
|
name : 'DocSearch',
|
20246
|
fieldLabel : fieldLabel_,
|
20247
|
width : 470,
|
20248
|
labelWidth : 185,
|
20249
|
enableKeyEvents : true,
|
20250
|
filterParam : filterParam_,
|
20251
|
listeners : {
|
20252
|
specialkey : function (f, e) {
|
20253
|
if (e.getKey() == e.ENTER) {
|
20254
|
var doc = Ext.ComponentQuery.query('[name=DocSearch]')[0];
|
20255
|
var docNo = doc.getValue();
|
20256
|
var store = Ext.data.StoreManager.lookup('storeQC');
|
20257
|
param_ = 'DocNo[like]' + docNo
|
20258
|
if (this.filterParam) {
|
20259
|
param_ = param_ + ',' + this.filterParam_
|
20260
|
}
|
20261
|
store.proxy.extraParams = {
|
20262
|
tableName : tableName_,
|
20263
|
param : param_,
|
20264
|
menuId : MinovaUtil.GetMenuID()
|
20265
|
};
|
20266
|
store.removeAll();
|
20267
|
store.reload();
|
20268
|
store.loadPage(1);
|
20269
|
}
|
20270
|
}
|
20271
|
}
|
20272
|
}, {
|
20273
|
xtype : 'tbspacer',
|
20274
|
width : 5
|
20275
|
}, {
|
20276
|
xtype : 'button',
|
20277
|
name : 'Search',
|
20278
|
text : 'Search',
|
20279
|
filterParam : filterParam_,
|
20280
|
handler : function () {
|
20281
|
var doc = Ext.ComponentQuery.query('[name=DocSearch]')[0];
|
20282
|
var docNo = doc.getValue();
|
20283
|
var store = Ext.data.StoreManager.lookup('storeQC');
|
20284
|
param_ = 'DocNo[like]' + docNo
|
20285
|
if (this.filterParam) {
|
20286
|
param_ = param_ + ',' + this.filterParam
|
20287
|
}
|
20288
|
store.proxy.extraParams = {
|
20289
|
tableName : tableName_,
|
20290
|
param : param_,
|
20291
|
menuId : MinovaUtil.GetMenuID()
|
20292
|
};
|
20293
|
store.removeAll();
|
20294
|
store.reload();
|
20295
|
store.loadPage(1);
|
20296
|
}
|
20297
|
}
|
20298
|
]
|
20299
|
}
|
20300
|
]
|
20301
|
}
|
20302
|
]
|
20303
|
}, {
|
20304
|
items : [{
|
20305
|
xtype : "minovagrid1",
|
20306
|
name : "GridDocNo",
|
20307
|
storename : 'storeQC',
|
20308
|
tableName : tableName_,
|
20309
|
param : this.filterParam,
|
20310
|
isLookup : true,
|
20311
|
pagesize : 25,
|
20312
|
height : 398,
|
20313
|
LookupFunction : LookupFunction,
|
20314
|
valueField : valueField_,
|
20315
|
targetField : targetField_,
|
20316
|
isGrid : true,
|
20317
|
listeners : {
|
20318
|
beforeedit : function () {
|
20319
|
return false;
|
20320
|
},
|
20321
|
itemdblclick : function () {
|
20322
|
var grid = Ext.ComponentQuery.query('[name=GridDocNo]')[0];
|
20323
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
20324
|
var documentno = selection.data.DocNo;
|
20325
|
LookupFunction = this.LookupFunction;
|
20326
|
eval(LookupFunction);
|
20327
|
var target = Ext.ComponentQuery.query('[name=LookupDocumentTrans]')[0].targetField;
|
20328
|
Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(documentno);
|
20329
|
Ext.ComponentQuery.query('[name=LookupDocumentTrans]')[0].hide();
|
20330
|
}
|
20331
|
},
|
20332
|
}, {
|
20333
|
xtype : 'pagingtoolbar',
|
20334
|
store : 'storeQC',
|
20335
|
dock : 'bottom',
|
20336
|
displayInfo : true
|
20337
|
}
|
20338
|
]
|
20339
|
}
|
20340
|
]
|
20341
|
}, {
|
20342
|
title : 'Advance Search',
|
20343
|
items : [{
|
20344
|
xtype : 'form',
|
20345
|
name : 'formlookup',
|
20346
|
items : [{
|
20347
|
xtype : 'minovaform',
|
20348
|
name : 'frmlookup',
|
20349
|
tableName : tableName_,
|
20350
|
param : filterParam_,
|
20351
|
isLookup : true,
|
20352
|
buttons : [{
|
20353
|
text : 'Search',
|
20354
|
filterParam : filterParam_,
|
20355
|
listeners : {
|
20356
|
click : function () {
|
20357
|
var store = Ext.data.StoreManager.lookup('storeadvance');
|
20358
|
var form = Ext.ComponentQuery.query('[name=formlookup]')[0].getForm();
|
20359
|
grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
|
20360
|
var values_ = form.getValues();
|
20361
|
var fields_ = form.getFields().items;
|
20362
|
var param_ = '';
|
20363
|
for (var i = 0; i < fields_.length; i++) {
|
20364
|
var val_ = form.getFields().items[i].getValue();
|
20365
|
var xtype_ = form.getFields().items[i].xtype;
|
20366
|
var oprator_ = '[like]';
|
20367
|
if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
20368
|
oprator_ = '[Equal]';
|
20369
|
}
|
20370
|
if (xtype_ == 'datefield') {
|
20371
|
if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
20372
|
oprator_ = '[LessThanEqual]';
|
20373
|
} else {
|
20374
|
oprator_ = '[GreaterThanEqual]';
|
20375
|
}
|
20376
|
}
|
20377
|
if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
20378
|
param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
20379
|
}
|
20380
|
}
|
20381
|
if (this.filterParam_) {
|
20382
|
param_ = param_ + ',' + this.filterParam_
|
20383
|
}
|
20384
|
store.proxy.extraParams = {
|
20385
|
tableName : grid.tableName,
|
20386
|
param : param_,
|
20387
|
menuId : MinovaUtil.GetMenuID()
|
20388
|
};
|
20389
|
store.removeAll();
|
20390
|
store.reload();
|
20391
|
store.loadPage(1);
|
20392
|
}
|
20393
|
}
|
20394
|
}
|
20395
|
]
|
20396
|
}, {
|
20397
|
xtype : 'minovagrid1',
|
20398
|
name : 'gridlookup',
|
20399
|
minHeight : 312,
|
20400
|
height : 290,
|
20401
|
tableName : tableName_,
|
20402
|
param : this.filterParam,
|
20403
|
isLookup : true,
|
20404
|
storename : 'storeadvance',
|
20405
|
pagesize : 25,
|
20406
|
valueField : valueField_,
|
20407
|
targetField : targetField_,
|
20408
|
hidebutton : 0,
|
20409
|
isGrid : true,
|
20410
|
listeners : {
|
20411
|
beforeedit : function () {
|
20412
|
return false;
|
20413
|
},
|
20414
|
itemdblclick : function () {
|
20415
|
var grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
|
20416
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
20417
|
var documentno = selection.data.DocNo;
|
20418
|
LookupFunction = this.LookupFunction;
|
20419
|
eval(LookupFunction);
|
20420
|
var target = Ext.ComponentQuery.query('[name=LookupDocumentTrans]')[0].targetField;
|
20421
|
Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(documentno);
|
20422
|
Ext.ComponentQuery.query('[name=LookupDocumentTrans]')[0].hide();
|
20423
|
}
|
20424
|
},
|
20425
|
dockedItems : [{
|
20426
|
xtype : 'pagingtoolbar',
|
20427
|
store : 'storeadvance',
|
20428
|
dock : 'bottom',
|
20429
|
displayInfo : true
|
20430
|
}
|
20431
|
]
|
20432
|
}
|
20433
|
]
|
20434
|
}
|
20435
|
]
|
20436
|
}
|
20437
|
]
|
20438
|
}
|
20439
|
]
|
20440
|
}
|
20441
|
]
|
20442
|
});
|
20443
|
me.callParent(arguments);
|
20444
|
}
|
20445
|
});
|
20446
|
Ext.define('MinovaUtil.MinovaES.MinovaSummaryDocForm', {
|
20447
|
extend : 'Ext.form.Panel',
|
20448
|
alias : ['widget.summarydocform'],
|
20449
|
formname : this.name,
|
20450
|
tableName : undefined,
|
20451
|
docType : undefined,
|
20452
|
transType : undefined,
|
20453
|
resizable : true,
|
20454
|
border : false,
|
20455
|
autoScroll : true,
|
20456
|
layout : 'column',
|
20457
|
defaults : {
|
20458
|
layout : 'form',
|
20459
|
xtype : 'container',
|
20460
|
defaultType : 'textfield',
|
20461
|
style : 'width: 50%',
|
20462
|
},
|
20463
|
initComponent : function () {
|
20464
|
var me = this;
|
20465
|
var col1 = [];
|
20466
|
var col2 = [];
|
20467
|
var LangID = localStorage.LangId;
|
20468
|
var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',DocType='" + me.docType + "',IsSummary=1";
|
20469
|
var formname_ = me.name;
|
20470
|
var nameTable_ = me.tableName;
|
20471
|
Ext.Ajax.request({
|
20472
|
async : false,
|
20473
|
method : 'POST',
|
20474
|
url : '/UserControl/GetStore',
|
20475
|
params : {
|
20476
|
tableName : 'PDSDOCFIELD',
|
20477
|
param : parameter
|
20478
|
},
|
20479
|
success : function (response) {
|
20480
|
var results = Ext.decode(response.responseText);
|
20481
|
hasil = results.data;
|
20482
|
}
|
20483
|
});
|
20484
|
if (hasil.length > 0) {
|
20485
|
Ext.each(hasil, function (rec) {
|
20486
|
var formfield = MinovaUtil.FieldGenerator.Form(me.name, rec, false, true, me.tableName, false);
|
20487
|
var descField = undefined;
|
20488
|
if (rec.ColumnNo == 1) {
|
20489
|
col1.push(formfield);
|
20490
|
if (descField) {
|
20491
|
col1.push(descField)
|
20492
|
}
|
20493
|
} else {
|
20494
|
col2.push(formfield);
|
20495
|
if (descField) {
|
20496
|
col2.push(descField)
|
20497
|
}
|
20498
|
}
|
20499
|
});
|
20500
|
}
|
20501
|
Ext.applyIf(me, {
|
20502
|
items : [{
|
20503
|
style : 'width: 50%',
|
20504
|
items : col1
|
20505
|
}, {
|
20506
|
style : 'width: 50%',
|
20507
|
items : col2
|
20508
|
}
|
20509
|
]
|
20510
|
});
|
20511
|
this.callParent();
|
20512
|
}
|
20513
|
});
|
20514
|
Ext.define('MinovaUtil.MinovaES.LookupDocRef', {
|
20515
|
extend : 'Ext.window.Window',
|
20516
|
alias : 'widget.lookupdocumentref',
|
20517
|
requires : [],
|
20518
|
height : '87%',
|
20519
|
width : '41%',
|
20520
|
minWidth : '50%',
|
20521
|
maxWidth : '100%',
|
20522
|
bodyPadding : 0,
|
20523
|
formname : undefined,
|
20524
|
name : 'LookupDocRef',
|
20525
|
test : undefined,
|
20526
|
vtype : 'validateMinovaXss',
|
20527
|
targetField : undefined,
|
20528
|
valueField : undefined,
|
20529
|
tableName : 'PDSDOCREF',
|
20530
|
transType : undefined,
|
20531
|
docType : undefined,
|
20532
|
LookupFunction : undefined,
|
20533
|
datarecord : undefined,
|
20534
|
isGrid : undefined,
|
20535
|
filterParam : undefined,
|
20536
|
listeners : {
|
20537
|
afterrender : function (f) {
|
20538
|
f.setTitle('Lookup - Document');
|
20539
|
}
|
20540
|
},
|
20541
|
initComponent : function () {
|
20542
|
var me = this;
|
20543
|
var targetField_ = me.targetField;
|
20544
|
var valueField_ = me.valueField;
|
20545
|
var form = me.test;
|
20546
|
var tableName_ = me.tableName;
|
20547
|
var isGrid = me.isGrid_;
|
20548
|
var LookupFunction = me.LookupFunction;
|
20549
|
param_ = null;
|
20550
|
var filterParam_ = me.filterParam;
|
20551
|
var compselect = "";
|
20552
|
var buselect = "";
|
20553
|
Ext.applyIf(me, {
|
20554
|
items : [{
|
20555
|
xtype : 'form',
|
20556
|
name : 'formlookup',
|
20557
|
items : [{
|
20558
|
xtype : 'minovaform',
|
20559
|
name : 'frmlookup',
|
20560
|
tableName : tableName_,
|
20561
|
param : filterParam_,
|
20562
|
isLookup : true,
|
20563
|
buttons : [{
|
20564
|
text : 'Search',
|
20565
|
filterParam : filterParam_,
|
20566
|
listeners : {
|
20567
|
click : function () {
|
20568
|
var store = Ext.data.StoreManager.lookup('storeadvance');
|
20569
|
var form = Ext.ComponentQuery.query('[name=formlookup]')[0].getForm();
|
20570
|
grid = Ext.ComponentQuery.query('[name=gridlookupdocref]')[0];
|
20571
|
var values_ = form.getValues();
|
20572
|
var fields_ = form.getFields().items;
|
20573
|
var param_ = '';
|
20574
|
for (var i = 0; i < fields_.length; i++) {
|
20575
|
var val_ = form.getFields().items[i].getValue();
|
20576
|
var xtype_ = form.getFields().items[i].xtype;
|
20577
|
var oprator_ = '[like]';
|
20578
|
if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
|
20579
|
oprator_ = '[Equal]';
|
20580
|
}
|
20581
|
if (xtype_ == 'datefield') {
|
20582
|
if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
20583
|
oprator_ = '[LessThanEqual]';
|
20584
|
} else {
|
20585
|
oprator_ = '[GreaterThanEqual]';
|
20586
|
}
|
20587
|
}
|
20588
|
if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
20589
|
param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
20590
|
}
|
20591
|
}
|
20592
|
if (filterParam_) {
|
20593
|
param_ = param_ + ',' + filterParam_
|
20594
|
}
|
20595
|
store.proxy.extraParams = {
|
20596
|
tableName : grid.tableName,
|
20597
|
param : param_,
|
20598
|
menuId : MinovaUtil.GetMenuID()
|
20599
|
};
|
20600
|
store.removeAll();
|
20601
|
store.reload();
|
20602
|
store.loadPage(1);
|
20603
|
}
|
20604
|
}
|
20605
|
}
|
20606
|
]
|
20607
|
}, {
|
20608
|
xtype : 'minovagrid1',
|
20609
|
name : 'gridlookupdocref',
|
20610
|
minHeight : 312,
|
20611
|
height : 290,
|
20612
|
tableName : tableName_,
|
20613
|
param : this.filterParam,
|
20614
|
isLookup : true,
|
20615
|
storename : 'storeadvance',
|
20616
|
pagesize : 25,
|
20617
|
valueField : valueField_,
|
20618
|
targetField : targetField_,
|
20619
|
multiSelect : true,
|
20620
|
hidebutton : 0,
|
20621
|
isGrid : true,
|
20622
|
listeners : {
|
20623
|
beforeedit : function () {
|
20624
|
return false;
|
20625
|
},
|
20626
|
itemdblclick : function () {},
|
20627
|
select : function (t, record, index, eOpts) {
|
20628
|
if (compselect !== "") {
|
20629
|
if (compselect !== record.data.CompanyID) {
|
20630
|
// MinovaMessageError("", "FILO06", "");
|
20631
|
return;
|
20632
|
}
|
20633
|
}
|
20634
|
if (buselect !== "") {
|
20635
|
if (buselect !== record.data.BusinessUnit) {
|
20636
|
// MinovaMessageError("", "FILO07", "");
|
20637
|
return;
|
20638
|
}
|
20639
|
}
|
20640
|
compselect = record.data.CompanyID;
|
20641
|
buselect = record.data.BusinessUnit;
|
20642
|
}
|
20643
|
},
|
20644
|
dockedItems : [{
|
20645
|
xtype : 'pagingtoolbar',
|
20646
|
store : 'storeadvance',
|
20647
|
dock : 'bottom',
|
20648
|
displayInfo : true
|
20649
|
}, {
|
20650
|
xtype : 'button',
|
20651
|
name : 'select',
|
20652
|
text : 'Select',
|
20653
|
dock : 'bottom'
|
20654
|
}
|
20655
|
]
|
20656
|
}
|
20657
|
]
|
20658
|
}
|
20659
|
]
|
20660
|
});
|
20661
|
me.callParent(arguments);
|
20662
|
}
|
20663
|
});
|
20664
|
var Base64 = (function () {
|
20665
|
// Private property
|
20666
|
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
20667
|
|
20668
|
// Private method for UTF-8 encoding
|
20669
|
|
20670
|
function utf8Encode(string) {
|
20671
|
string = string.replace(/\r\n/g, "\n");
|
20672
|
var utftext = "";
|
20673
|
for (var n = 0; n < string.length; n++) {
|
20674
|
var c = string.charCodeAt(n);
|
20675
|
if (c < 128) {
|
20676
|
utftext += String.fromCharCode(c);
|
20677
|
} else if ((c > 127) && (c < 2048)) {
|
20678
|
utftext += String.fromCharCode((c >> 6) | 192);
|
20679
|
utftext += String.fromCharCode((c & 63) | 128);
|
20680
|
} else {
|
20681
|
utftext += String.fromCharCode((c >> 12) | 224);
|
20682
|
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
20683
|
utftext += String.fromCharCode((c & 63) | 128);
|
20684
|
}
|
20685
|
}
|
20686
|
return utftext;
|
20687
|
}
|
20688
|
|
20689
|
// Public method for encoding
|
20690
|
return {
|
20691
|
encode: (typeof btoa == 'function') ? function (input) {
|
20692
|
return btoa(utf8Encode(input));
|
20693
|
}
|
20694
|
: function (input) {
|
20695
|
var output = "";
|
20696
|
var chr1,
|
20697
|
chr2,
|
20698
|
chr3,
|
20699
|
enc1,
|
20700
|
enc2,
|
20701
|
enc3,
|
20702
|
enc4;
|
20703
|
var i = 0;
|
20704
|
input = utf8Encode(input);
|
20705
|
while (i < input.length) {
|
20706
|
chr1 = input.charCodeAt(i++);
|
20707
|
chr2 = input.charCodeAt(i++);
|
20708
|
chr3 = input.charCodeAt(i++);
|
20709
|
enc1 = chr1 >> 2;
|
20710
|
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
20711
|
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
20712
|
enc4 = chr3 & 63;
|
20713
|
if (isNaN(chr2)) {
|
20714
|
enc3 = enc4 = 64;
|
20715
|
} else if (isNaN(chr3)) {
|
20716
|
enc4 = 64;
|
20717
|
}
|
20718
|
output = output +
|
20719
|
keyStr.charAt(enc1) + keyStr.charAt(enc2) +
|
20720
|
keyStr.charAt(enc3) + keyStr.charAt(enc4);
|
20721
|
}
|
20722
|
return output;
|
20723
|
}
|
20724
|
};
|
20725
|
})();
|
20726
|
Ext.define('MyApp.view.override.Grid', {
|
20727
|
override: 'Ext.grid.GridPanel',
|
20728
|
requires: 'Ext.form.action.StandardSubmit',
|
20729
|
|
20730
|
/*
|
20731
|
Kick off process
|
20732
|
*/
|
20733
|
|
20734
|
downloadExcelXml: function (includeHidden, name) {
|
20735
|
|
20736
|
if (!name)
|
20737
|
title = this.name;
|
20738
|
|
20739
|
var vExportContent = this.getExcelXml(includeHidden, title);
|
20740
|
|
20741
|
var location = 'data:application/vnd.ms-excel;base64,' + Base64.encode(vExportContent);
|
20742
|
|
20743
|
/*
|
20744
|
dynamically create and anchor tag to force download with suggested filename
|
20745
|
note: download attribute is Google Chrome specific
|
20746
|
*/
|
20747
|
|
20748
|
if (Ext.isChrome) {
|
20749
|
var gridEl = this.getEl();
|
20750
|
|
20751
|
var el = Ext.DomHelper.append(gridEl, {
|
20752
|
tag: "a",
|
20753
|
download: title + "-" + Ext.Date.format(new Date(), 'Y-m-d Hi') + '.xls',
|
20754
|
href: location
|
20755
|
});
|
20756
|
|
20757
|
el.click();
|
20758
|
|
20759
|
Ext.fly(el).destroy();
|
20760
|
|
20761
|
} else {
|
20762
|
|
20763
|
var form = this.down('form#uploadForm');
|
20764
|
if (form) {
|
20765
|
form.destroy();
|
20766
|
}
|
20767
|
form = this.add({
|
20768
|
xtype: 'form',
|
20769
|
itemId: 'uploadForm',
|
20770
|
hidden: true,
|
20771
|
standardSubmit: true,
|
20772
|
url: 'http://webapps.figleaf.com/dataservices/Excel.cfc?method=echo&mimetype=application/vnd.ms-excel&filename=' + escape(title + ".xls"),
|
20773
|
items: [{
|
20774
|
xtype: 'hiddenfield',
|
20775
|
name: 'data',
|
20776
|
value: vExportContent
|
20777
|
}
|
20778
|
]
|
20779
|
});
|
20780
|
|
20781
|
form.getForm().submit();
|
20782
|
|
20783
|
}
|
20784
|
},
|
20785
|
|
20786
|
/*
|
20787
|
|
20788
|
Welcome to XML Hell
|
20789
|
See: http://msdn.microsoft.com/en-us/library/office/aa140066(v=office.10).aspx
|
20790
|
for more details
|
20791
|
|
20792
|
*/
|
20793
|
getExcelXml: function (includeHidden, title) {
|
20794
|
|
20795
|
var theTitle = title || this.title;
|
20796
|
|
20797
|
var worksheet = this.createWorksheet(includeHidden, theTitle);
|
20798
|
var totalWidth = this.columnManager.columns.length;
|
20799
|
|
20800
|
return ''.concat(
|
20801
|
'<?xml version="1.0"?>',
|
20802
|
'<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">',
|
20803
|
'<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"><Title>' + theTitle + '</Title></DocumentProperties>',
|
20804
|
'<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"><AllowPNG/></OfficeDocumentSettings>',
|
20805
|
'<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">',
|
20806
|
'<WindowHeight>' + worksheet.height + '</WindowHeight>',
|
20807
|
'<WindowWidth>' + worksheet.width + '</WindowWidth>',
|
20808
|
'<ProtectStructure>False</ProtectStructure>',
|
20809
|
'<ProtectWindows>False</ProtectWindows>',
|
20810
|
'</ExcelWorkbook>',
|
20811
|
|
20812
|
'<Styles>',
|
20813
|
|
20814
|
'<Style ss:ID="Default" ss:Name="Normal">',
|
20815
|
'<Alignment ss:Vertical="Bottom"/>',
|
20816
|
'<Borders/>',
|
20817
|
'<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="12" ss:Color="#000000"/>',
|
20818
|
'<Interior/>',
|
20819
|
'<NumberFormat/>',
|
20820
|
'<Protection/>',
|
20821
|
'</Style>',
|
20822
|
|
20823
|
'<Style ss:ID="title">',
|
20824
|
'<Borders />',
|
20825
|
'<Font ss:Bold="1" ss:Size="18" />',
|
20826
|
'<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1" />',
|
20827
|
'<NumberFormat ss:Format="@" />',
|
20828
|
'</Style>',
|
20829
|
|
20830
|
'<Style ss:ID="headercell">',
|
20831
|
'<Font ss:Bold="1" ss:Size="10" />',
|
20832
|
'<Alignment ss:Horizontal="Center" ss:WrapText="1" />',
|
20833
|
'<Interior ss:Color="#A3C9F1" ss:Pattern="Solid" />',
|
20834
|
'</Style>',
|
20835
|
|
20836
|
'<Style ss:ID="even">',
|
20837
|
'<Interior ss:Color="#CCFFFF" ss:Pattern="Solid" />',
|
20838
|
'</Style>',
|
20839
|
|
20840
|
'<Style ss:ID="evendate" ss:Parent="even">',
|
20841
|
'<NumberFormat ss:Format="yyyy-mm-dd" />',
|
20842
|
'</Style>',
|
20843
|
|
20844
|
'<Style ss:ID="evenint" ss:Parent="even">',
|
20845
|
'<Numberformat ss:Format="0" />',
|
20846
|
'</Style>',
|
20847
|
|
20848
|
'<Style ss:ID="evenfloat" ss:Parent="even">',
|
20849
|
'<Numberformat ss:Format="0.00" />',
|
20850
|
'</Style>',
|
20851
|
|
20852
|
'<Style ss:ID="odd">',
|
20853
|
'<Interior ss:Color="#CCCCFF" ss:Pattern="Solid" />',
|
20854
|
'</Style>',
|
20855
|
|
20856
|
'<Style ss:ID="groupSeparator">',
|
20857
|
'<Interior ss:Color="#D3D3D3" ss:Pattern="Solid" />',
|
20858
|
'</Style>',
|
20859
|
|
20860
|
'<Style ss:ID="odddate" ss:Parent="odd">',
|
20861
|
'<NumberFormat ss:Format="yyyy-mm-dd" />',
|
20862
|
'</Style>',
|
20863
|
|
20864
|
'<Style ss:ID="oddint" ss:Parent="odd">',
|
20865
|
'<NumberFormat Format="0" />',
|
20866
|
'</Style>',
|
20867
|
|
20868
|
'<Style ss:ID="oddfloat" ss:Parent="odd">',
|
20869
|
'<NumberFormat Format="0.00" />',
|
20870
|
'</Style>',
|
20871
|
|
20872
|
'</Styles>',
|
20873
|
worksheet.xml,
|
20874
|
'</Workbook>');
|
20875
|
},
|
20876
|
|
20877
|
/*
|
20878
|
|
20879
|
Support function to return field info from store based on fieldname
|
20880
|
|
20881
|
*/
|
20882
|
|
20883
|
getModelField: function (fieldName) {
|
20884
|
|
20885
|
var fields = this.store.model.getFields();
|
20886
|
for (var i = 0; i < fields.length; i++) {
|
20887
|
if (fields[i].name === fieldName) {
|
20888
|
return fields[i];
|
20889
|
}
|
20890
|
}
|
20891
|
},
|
20892
|
|
20893
|
/*
|
20894
|
|
20895
|
Convert store into Excel Worksheet
|
20896
|
|
20897
|
*/
|
20898
|
generateEmptyGroupRow: function (dataIndex, value, cellTypes, includeHidden) {
|
20899
|
|
20900
|
var cm = this.columnManager.columns;
|
20901
|
var colCount = cm.length;
|
20902
|
var rowTpl = '<Row ss:AutoFitHeight="0"><Cell ss:StyleID="groupSeparator" ss:MergeAcross="{0}"><Data ss:Type="String"><html:b>{1}</html:b></Data></Cell></Row>';
|
20903
|
var visibleCols = 0;
|
20904
|
|
20905
|
// rowXml += '<Cell ss:StyleID="groupSeparator">'
|
20906
|
|
20907
|
for (var j = 0; j < colCount; j++) {
|
20908
|
if (cm[j].xtype != 'actioncolumn' && (cm[j].dataIndex != '') && (includeHidden || !cm[j].hidden)) {
|
20909
|
// rowXml += '<Cell ss:StyleID="groupSeparator"/>';
|
20910
|
visibleCols++;
|
20911
|
}
|
20912
|
}
|
20913
|
|
20914
|
// rowXml += "</Row>";
|
20915
|
|
20916
|
return Ext.String.format(rowTpl, visibleCols - 1, value);
|
20917
|
},
|
20918
|
|
20919
|
createWorksheet: function (includeHidden, theTitle) {
|
20920
|
// Calculate cell data types and extra class names which affect formatting
|
20921
|
var cellType = [];
|
20922
|
var cellTypeClass = [];
|
20923
|
var cm = this.columnManager.columns;
|
20924
|
|
20925
|
var totalWidthInPixels = 0;
|
20926
|
var colXml = '';
|
20927
|
var headerXml = '';
|
20928
|
var visibleColumnCountReduction = 0;
|
20929
|
var colCount = cm.length;
|
20930
|
for (var i = 0; i < colCount; i++) {
|
20931
|
if (cm[i].xtype != 'actioncolumn' && (cm[i].dataIndex != '') && (includeHidden || !cm[i].hidden)) {
|
20932
|
var w = cm[i].getEl().getWidth();
|
20933
|
totalWidthInPixels += w;
|
20934
|
|
20935
|
if (cm[i].text === "") {
|
20936
|
cellType.push("None");
|
20937
|
cellTypeClass.push("");
|
20938
|
++visibleColumnCountReduction;
|
20939
|
} else {
|
20940
|
colXml += '<Column ss:AutoFitWidth="1" ss:Width="' + w + '" />';
|
20941
|
headerXml += '<Cell ss:StyleID="headercell">' +
|
20942
|
'<Data ss:Type="String">' + cm[i].dataIndex + '</Data>' +
|
20943
|
'<NamedCell ss:Name="Print_Titles"></NamedCell></Cell>';
|
20944
|
|
20945
|
var fld = this.getModelField(cm[i].dataIndex);
|
20946
|
switch (fld.type.type) {
|
20947
|
case "int":
|
20948
|
cellType.push("Number");
|
20949
|
cellTypeClass.push("int");
|
20950
|
break;
|
20951
|
case "float":
|
20952
|
cellType.push("Number");
|
20953
|
cellTypeClass.push("float");
|
20954
|
break;
|
20955
|
|
20956
|
case "bool":
|
20957
|
|
20958
|
case "boolean":
|
20959
|
cellType.push("String");
|
20960
|
cellTypeClass.push("");
|
20961
|
break;
|
20962
|
case "date":
|
20963
|
cellType.push("DateTime");
|
20964
|
cellTypeClass.push("date");
|
20965
|
break;
|
20966
|
default:
|
20967
|
cellType.push("String");
|
20968
|
cellTypeClass.push("");
|
20969
|
break;
|
20970
|
}
|
20971
|
}
|
20972
|
}
|
20973
|
}
|
20974
|
var visibleColumnCount = cellType.length - visibleColumnCountReduction;
|
20975
|
|
20976
|
var result = {
|
20977
|
height: 9000,
|
20978
|
width: Math.floor(totalWidthInPixels * 30) + 50
|
20979
|
};
|
20980
|
|
20981
|
// Generate worksheet header details.
|
20982
|
|
20983
|
// determine number of rows
|
20984
|
var numGridRows = this.store.getCount() + 2;
|
20985
|
if (!Ext.isEmpty(this.store.groupField)) {
|
20986
|
numGridRows = numGridRows + this.store.getGroups().length;
|
20987
|
}
|
20988
|
|
20989
|
// create header for worksheet
|
20990
|
var t = ''.concat(
|
20991
|
'<Worksheet ss:Name="' + theTitle + '">',
|
20992
|
|
20993
|
'<Names>',
|
20994
|
'<NamedRange ss:Name="Print_Titles" ss:RefersTo="=\'' + theTitle + '\'!R1:R2">',
|
20995
|
'</NamedRange></Names>',
|
20996
|
|
20997
|
'<Table ss:ExpandedColumnCount="' + (visibleColumnCount + 2),
|
20998
|
'" ss:ExpandedRowCount="' + numGridRows + '" x:FullColumns="1" x:FullRows="1" ss:DefaultColumnWidth="65" ss:DefaultRowHeight="15">',
|
20999
|
colXml,
|
21000
|
'<Row ss:AutoFitHeight="1">',
|
21001
|
headerXml +
|
21002
|
'</Row>');
|
21003
|
|
21004
|
// Generate the data rows from the data in the Store
|
21005
|
var groupVal = "";
|
21006
|
var groupField = "";
|
21007
|
|
21008
|
for (var i = 0, it = this.store.data.items, l = it.length; i < l; i++) {
|
21009
|
|
21010
|
if (!Ext.isEmpty(groupField)) {
|
21011
|
if (groupVal != this.store.getAt(i).get(groupField)) {
|
21012
|
groupVal = this.store.getAt(i).get(groupField);
|
21013
|
t += this.generateEmptyGroupRow(groupField, groupVal, cellType, includeHidden);
|
21014
|
}
|
21015
|
}
|
21016
|
t += '<Row>';
|
21017
|
var cellClass = (i & 1) ? 'odd' : 'even';
|
21018
|
r = it[i].data;
|
21019
|
var k = 0;
|
21020
|
for (var j = 0; j < colCount; j++) {
|
21021
|
if (cm[j].xtype != 'actioncolumn' && (cm[j].dataIndex != '') && (includeHidden || !cm[j].hidden)) {
|
21022
|
var v = r[cm[j].dataIndex];
|
21023
|
if (cellType[k] !== "None") {
|
21024
|
t += '<Cell ss:StyleID="' + cellClass + cellTypeClass[k] + '"><Data ss:Type="' + cellType[k] + '">';
|
21025
|
if (cellType[k] == 'DateTime') {
|
21026
|
t += Ext.Date.format(v, 'Y-m-d');
|
21027
|
} else {
|
21028
|
t += v;
|
21029
|
}
|
21030
|
t += '</Data></Cell>';
|
21031
|
}
|
21032
|
k++;
|
21033
|
}
|
21034
|
}
|
21035
|
t += '</Row>';
|
21036
|
}
|
21037
|
|
21038
|
result.xml = t.concat(
|
21039
|
'</Table>',
|
21040
|
'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">',
|
21041
|
'<PageLayoutZoom>0</PageLayoutZoom>',
|
21042
|
'<Selected/>',
|
21043
|
'<Panes>',
|
21044
|
'<Pane>',
|
21045
|
'<Number>3</Number>',
|
21046
|
'<ActiveRow>2</ActiveRow>',
|
21047
|
'</Pane>',
|
21048
|
'</Panes>',
|
21049
|
'<ProtectObjects>False</ProtectObjects>',
|
21050
|
'<ProtectScenarios>False</ProtectScenarios>',
|
21051
|
'</WorksheetOptions>',
|
21052
|
'</Worksheet>');
|
21053
|
return result;
|
21054
|
}
|
21055
|
});
|
21056
|
|
21057
|
/*Add Midi For Grid Mass Posting Filo*/
|
21058
|
Ext.define('MinovaUtil.MinovaES.MinovaEditAbleGridList', {
|
21059
|
extend: 'Ext.form.Panel',
|
21060
|
alias: ['widget.MinovaEditAbleGridList', 'widget.Minovaeditablegridlist', 'widget.minovaeditablegridlist'],
|
21061
|
requires: [
|
21062
|
'Ext.grid.plugin.CellEditing',
|
21063
|
'Ext.grid.RowNumberer',
|
21064
|
'Ext.grid.Panel',
|
21065
|
],
|
21066
|
|
21067
|
//renderTo: 'panel-extjs',
|
21068
|
anchor: '100%',
|
21069
|
tableName: undefined,
|
21070
|
hideButton: undefined,
|
21071
|
multiSelect: undefined,
|
21072
|
initComponent: function () {
|
21073
|
var me = this;
|
21074
|
var isLookup = me.isLookup;
|
21075
|
var hide_ = false;
|
21076
|
var widthLock = 250;
|
21077
|
var checkSelection = '';
|
21078
|
|
21079
|
if (me.hideButton == true) {
|
21080
|
hide_ = true;
|
21081
|
}
|
21082
|
if (me.multiSelect) {
|
21083
|
locking = false;
|
21084
|
checkSelection = 'checkboxmodel';
|
21085
|
widthLock = 40;
|
21086
|
}
|
21087
|
var tableName = me.tableName;
|
21088
|
var cols = [];
|
21089
|
var fieldStore = [];
|
21090
|
var _url = 'GetAllField';
|
21091
|
var hasil = null;
|
21092
|
var height = me.height;
|
21093
|
var storeID = 'store' + me.tableName;
|
21094
|
var gridName = 'grid' + me.name;
|
21095
|
if (me.storeName) {
|
21096
|
storeID = me.storeName;
|
21097
|
}
|
21098
|
var LangID = MinovaUtil.GetLangID();
|
21099
|
var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
|
21100
|
Ext.Ajax.request({
|
21101
|
async: false,
|
21102
|
method: 'POST',
|
21103
|
url: '/UserControl/GetStore',
|
21104
|
params: {
|
21105
|
tableName: 'PDSBS0007',
|
21106
|
param: parameter
|
21107
|
},
|
21108
|
success: function (response) {
|
21109
|
var results = Ext.decode(response.responseText);
|
21110
|
hasil = results.data;
|
21111
|
}
|
21112
|
});
|
21113
|
cols.push({
|
21114
|
xtype: 'rownumberer'
|
21115
|
});
|
21116
|
var addData = 'var data={';
|
21117
|
if (hasil.length > 0) {
|
21118
|
Ext.each(hasil, function (rec) {
|
21119
|
fieldStore.push(rec.FieldName);
|
21120
|
if (rec.FieldName != 'Sequence') {
|
21121
|
addData = addData + rec.FieldName + ":" + "'',";
|
21122
|
}
|
21123
|
|
21124
|
var null_ = null;
|
21125
|
var ReadOnly_ = false;
|
21126
|
if (rec.IsPrimaryKey == true) {
|
21127
|
null_ = false;
|
21128
|
}
|
21129
|
if (rec.IsRequired == true) {
|
21130
|
null_ = false;
|
21131
|
} else {
|
21132
|
null_ = true;
|
21133
|
}
|
21134
|
if (rec.ReadOnly == '1') {
|
21135
|
ReadOnly_ = true;
|
21136
|
}
|
21137
|
var Hidden_ = false;
|
21138
|
if (rec.ReadOnly == '1') {
|
21139
|
ReadOnly_ = true;
|
21140
|
}
|
21141
|
|
21142
|
if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
|
21143
|
Hidden_ = true;
|
21144
|
null_ = true;
|
21145
|
}
|
21146
|
|
21147
|
if (rec.GridView == 1) {
|
21148
|
switch (rec.FormatRef) {
|
21149
|
case "date":
|
21150
|
cols.push({
|
21151
|
xtype: 'minovadatecolumn',
|
21152
|
hidden: Hidden_,
|
21153
|
text: rec.HeaderTitle,
|
21154
|
dataIndex: rec.FieldName,
|
21155
|
filter: {
|
21156
|
itemDefaults: {
|
21157
|
emptyText: 'Search for...',
|
21158
|
|
21159
|
}
|
21160
|
},
|
21161
|
editor: {
|
21162
|
allowBlank: null_,
|
21163
|
xtype: 'datefield',
|
21164
|
hideMode: 'visibility',
|
21165
|
readOnly: ReadOnly_,
|
21166
|
id: tableName + rec.FieldName,
|
21167
|
fieldGrid: rec.FieldName,
|
21168
|
nameTable: rec.TableName,
|
21169
|
}
|
21170
|
});
|
21171
|
break
|
21172
|
case "amount":
|
21173
|
cols.push({
|
21174
|
xtype: 'minovacurrancycolumn',
|
21175
|
//renderer: Ext.util.Format.numberRenderer("0,0"),
|
21176
|
text: rec.HeaderTitle,
|
21177
|
align: 'right',
|
21178
|
dataIndex: rec.FieldName,
|
21179
|
hidden: Hidden_,
|
21180
|
filter: {
|
21181
|
itemDefaults: {
|
21182
|
emptyText: 'Search for...'
|
21183
|
}
|
21184
|
},
|
21185
|
editor: {
|
21186
|
allowBlank: null_,
|
21187
|
xtype: 'minovacurrencyfield',
|
21188
|
//renderer: Ext.util.Format.numberRenderer("0,0"),
|
21189
|
//vtype: 'validateDecimal',
|
21190
|
readOnly: ReadOnly_,
|
21191
|
id: tableName + rec.FieldName,
|
21192
|
nameTable: rec.TableName,
|
21193
|
fieldGrid: rec.FieldName,
|
21194
|
fieldStyle: 'text-align:right;',
|
21195
|
value: '0',
|
21196
|
|
21197
|
}
|
21198
|
});
|
21199
|
break
|
21200
|
case "time":
|
21201
|
var DefaultValue = rec.DefaultValue;
|
21202
|
if (DefaultValue == '') {
|
21203
|
defaultValue = '00:00';
|
21204
|
}
|
21205
|
cols.push({
|
21206
|
//xtype: 'minovatimecolumn',
|
21207
|
xtype: 'timefield',
|
21208
|
format: 'H:i',
|
21209
|
submitFormat: 'Hi',
|
21210
|
text: rec.HeaderTitle,
|
21211
|
dataIndex: rec.FieldName,
|
21212
|
hidden: Hidden_,
|
21213
|
//renderer: Ext.util.Format.dateRenderer('G:i'),
|
21214
|
filter: {
|
21215
|
itemDefaults: {
|
21216
|
emptyText: 'Search for...'
|
21217
|
}
|
21218
|
},
|
21219
|
editor: {
|
21220
|
allowBlank: null_,
|
21221
|
xtype: 'timefield',
|
21222
|
readOnly: ReadOnly_,
|
21223
|
id: tableName + rec.FieldName,
|
21224
|
format: 'H:i',
|
21225
|
submitFormat: 'Hi',
|
21226
|
increment: 5,
|
21227
|
value: DefaultValue,
|
21228
|
anchor: '100%',
|
21229
|
listeners: {}
|
21230
|
//renderer: Ext.util.Format.dateRenderer('G:i'),
|
21231
|
}
|
21232
|
});
|
21233
|
break
|
21234
|
//case "datetime":
|
21235
|
// if (rec.DataRef != 'CREATEDT' && rec.DataRef != 'CHANGEDT') {
|
21236
|
// cols.push({
|
21237
|
// xtype: 'minovadatetimecolumn',
|
21238
|
// text: rec.HeaderTitle,
|
21239
|
// dataIndex: rec.FieldName,
|
21240
|
// filter: {
|
21241
|
// itemDefaults: {
|
21242
|
// emptyText: 'Search for...'
|
21243
|
// }
|
21244
|
// },
|
21245
|
// editor: {
|
21246
|
// allowBlank: null_,
|
21247
|
// xtype: 'textfield',
|
21248
|
// }
|
21249
|
// });
|
21250
|
// }
|
21251
|
// break
|
21252
|
default:
|
21253
|
if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
|
21254
|
cols.push({
|
21255
|
text: rec.HeaderTitle,
|
21256
|
dataIndex: rec.FieldName,
|
21257
|
width: 100,
|
21258
|
filter: {
|
21259
|
type: 'string',
|
21260
|
itemDefaults: {
|
21261
|
emptyText: 'Search for...'
|
21262
|
}
|
21263
|
}
|
21264
|
});
|
21265
|
} else if (rec.SearchType == '0') {
|
21266
|
var valueField = null;
|
21267
|
var displayValue = null;
|
21268
|
var TableRef = undefined;
|
21269
|
if (rec.TableRef != '') {
|
21270
|
TableRef = rec.TableRef;
|
21271
|
|
21272
|
Ext.Ajax.request({
|
21273
|
async: false,
|
21274
|
method: 'POST',
|
21275
|
url: '/UserControl/GetStore',
|
21276
|
params: {
|
21277
|
tableName: 'SDATATABLEFIELD',
|
21278
|
param: 'TableName[equal]' + rec.TableRef
|
21279
|
},
|
21280
|
success: function (response) {
|
21281
|
var results = Ext.decode(response.responseText);
|
21282
|
data_ = results.data;
|
21283
|
if (data_ != undefined) {
|
21284
|
valueField_ = $.grep(data_, function (r) {
|
21285
|
return r.ValueField == '1'
|
21286
|
});
|
21287
|
valueField = valueField_[0].FieldName
|
21288
|
displayValue_ = $.grep(data_, function (r) {
|
21289
|
return r.DisplayValue == '1'
|
21290
|
});
|
21291
|
displayValue = displayValue_[0].FieldName
|
21292
|
}
|
21293
|
}
|
21294
|
});
|
21295
|
|
21296
|
//create Store
|
21297
|
Ext.create('Ext.data.Store', {
|
21298
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
21299
|
autoLoad: true,
|
21300
|
proxy: {
|
21301
|
method: 'POST',
|
21302
|
type: 'ajax',
|
21303
|
url: '/UserControl/GetStoreAuth',
|
21304
|
extraParams: {
|
21305
|
tableName: TableRef,
|
21306
|
param: rec.ParamCombo,
|
21307
|
menuId: MinovaUtil.GetMenuID()
|
21308
|
},
|
21309
|
reader: {
|
21310
|
type: 'json',
|
21311
|
root: 'data',
|
21312
|
totalProperty: 'data[0].TotalCount'
|
21313
|
}
|
21314
|
}
|
21315
|
});
|
21316
|
} else if (rec.FixedValue != '') {
|
21317
|
var storeData = [];
|
21318
|
var str = rec.FixedValue;
|
21319
|
var hasil = str.split('||');
|
21320
|
hasil.forEach(function (h) {
|
21321
|
store_ = h.split('=')
|
21322
|
storeData.push({
|
21323
|
code: store_[0],
|
21324
|
desc: store_[1],
|
21325
|
|
21326
|
});
|
21327
|
});
|
21328
|
|
21329
|
valueField = 'code';
|
21330
|
displayValue = 'desc';
|
21331
|
|
21332
|
Ext.create('Ext.data.Store', {
|
21333
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
21334
|
autoLoad: true,
|
21335
|
data: storeData
|
21336
|
})
|
21337
|
}
|
21338
|
|
21339
|
cols.push({
|
21340
|
xtype: 'minovacombocolumn',
|
21341
|
hidden: Hidden_,
|
21342
|
text: rec.HeaderTitle,
|
21343
|
dataIndex: rec.FieldName,
|
21344
|
valueField: valueField,
|
21345
|
displayField: displayValue,
|
21346
|
store: 'store_' + me.tableName + rec.FieldName,
|
21347
|
editor: {
|
21348
|
allowBlank: null_,
|
21349
|
xtype: 'combobox',
|
21350
|
readOnly: ReadOnly_,
|
21351
|
id: tableName + rec.FieldName,
|
21352
|
nameTable: rec.TableName,
|
21353
|
fieldGrid: rec.FieldName,
|
21354
|
valueField: valueField,
|
21355
|
displayField: displayValue,
|
21356
|
vtype: 'validateCombobox',
|
21357
|
store: 'store_' + me.tableName + rec.FieldName,
|
21358
|
},
|
21359
|
filter: {
|
21360
|
type: 'list',
|
21361
|
itemDefaults: {
|
21362
|
emptyText: 'Search for...'
|
21363
|
}
|
21364
|
}
|
21365
|
});
|
21366
|
|
21367
|
} else if (rec.SearchType == '5') {
|
21368
|
var valueField = null;
|
21369
|
var displayValue = null;
|
21370
|
var AdditionaldisplayValue = null;
|
21371
|
var TableRef = undefined;
|
21372
|
if (rec.TableRef != '') {
|
21373
|
TableRef = rec.TableRef;
|
21374
|
Ext.Ajax.request({
|
21375
|
async: false,
|
21376
|
method: 'POST',
|
21377
|
url: '/UserControl/GetStore',
|
21378
|
params: {
|
21379
|
tableName: 'SDATATABLEFIELD',
|
21380
|
param: 'TableName[equal]' + rec.TableRef
|
21381
|
},
|
21382
|
success: function (response) {
|
21383
|
var results = Ext.decode(response.responseText);
|
21384
|
data_ = results.data;
|
21385
|
if (data_ != undefined) {
|
21386
|
valueField_ = $.grep(data_, function (r) {
|
21387
|
return r.ValueField == '1'
|
21388
|
});
|
21389
|
if (valueField_.length > 0) {
|
21390
|
valueField = valueField_[0].FieldName
|
21391
|
}
|
21392
|
|
21393
|
displayValue_ = $.grep(data_, function (r) {
|
21394
|
return r.DisplayValue == '1' || r.DisplayValue == '2'
|
21395
|
});
|
21396
|
if (displayValue_.length > 0) {
|
21397
|
displayValue = displayValue_[0].FieldName;
|
21398
|
}
|
21399
|
if (displayValue_.length >= 2) {
|
21400
|
AdditionaldisplayValue = displayValue_[1].FieldName
|
21401
|
}
|
21402
|
}
|
21403
|
}
|
21404
|
});
|
21405
|
}
|
21406
|
Ext.create('Ext.data.Store', {
|
21407
|
storeId: 'store_' + me.tableName + rec.FieldName,
|
21408
|
autoLoad: true,
|
21409
|
proxy: {
|
21410
|
method: 'POST',
|
21411
|
type: 'ajax',
|
21412
|
url: '/UserControl/GetStoreAuth',
|
21413
|
extraParams: {
|
21414
|
tableName: TableRef,
|
21415
|
param: rec.ParamCombo,
|
21416
|
menuId: MinovaUtil.GetMenuID()
|
21417
|
},
|
21418
|
reader: {
|
21419
|
type: 'json',
|
21420
|
root: 'data',
|
21421
|
totalProperty: 'data[0].TotalCount'
|
21422
|
}
|
21423
|
}
|
21424
|
});
|
21425
|
cols.push({
|
21426
|
xtype : 'minovacombocolumn',
|
21427
|
hidden: Hidden_,
|
21428
|
text: rec.HeaderTitle,
|
21429
|
dataIndex: rec.FieldName,
|
21430
|
valueField : valueField,
|
21431
|
displayField : displayValue,
|
21432
|
store : 'store_' + me.tableName + rec.FieldName,
|
21433
|
tpl: Ext.create('Ext.XTemplate',
|
21434
|
'<ul class="x-list-plain"><tpl for=".">',
|
21435
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
21436
|
'</tpl></ul>'),
|
21437
|
displayTpl: Ext.create('Ext.XTemplate',
|
21438
|
'<tpl for=".">',
|
21439
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
21440
|
'</tpl>'),
|
21441
|
editor: {
|
21442
|
allowBlank: null_,
|
21443
|
xtype: 'combobox',
|
21444
|
readOnly: ReadOnly_,
|
21445
|
id: rec.TableName + rec.FieldName,
|
21446
|
nameTable: rec.TableName,
|
21447
|
fieldGrid: rec.FieldName,
|
21448
|
valueField: valueField,
|
21449
|
displayField: displayValue,
|
21450
|
store: 'store_' + me.tableName + rec.FieldName,
|
21451
|
value: rec.DefaultValue,
|
21452
|
tpl: Ext.create('Ext.XTemplate',
|
21453
|
'<ul class="x-list-plain"><tpl for=".">',
|
21454
|
'<li role="option" class="x-boundlist-item">{' + AdditionaldisplayValue + '} - {' + displayValue + '}</li>',
|
21455
|
'</tpl></ul>'),
|
21456
|
displayTpl: Ext.create('Ext.XTemplate',
|
21457
|
'<tpl for=".">',
|
21458
|
'{' + AdditionaldisplayValue + '} - {' + displayValue + '}',
|
21459
|
'</tpl>')
|
21460
|
},
|
21461
|
renderer: function (value) {
|
21462
|
var store = Ext.data.StoreManager.lookup('store_' + me.tableName + rec.FieldName);
|
21463
|
var index = store.find(valueField, value);
|
21464
|
var val = "";
|
21465
|
if (index != -1) {
|
21466
|
var rc = store.getAt(index);
|
21467
|
//val = rc.get(displayValue);
|
21468
|
val = rc.get(AdditionaldisplayValue) + ' - ' + rc.get(displayValue);
|
21469
|
} else {
|
21470
|
val = value;
|
21471
|
}
|
21472
|
return val;
|
21473
|
},
|
21474
|
filter: {
|
21475
|
type: 'list',
|
21476
|
itemDefaults: {
|
21477
|
emptyText: 'Search for...'
|
21478
|
}
|
21479
|
}
|
21480
|
});
|
21481
|
} else if (rec.SearchType == '2') {
|
21482
|
var triger = (rec.TriggerCombo).split('$');
|
21483
|
var targetField_ = triger[0];
|
21484
|
var fieldValue_ = triger[1];
|
21485
|
cols.push({
|
21486
|
text: rec.HeaderTitle,
|
21487
|
hidden: Hidden_,
|
21488
|
dataIndex: rec.FieldName,
|
21489
|
filter: {
|
21490
|
itemDefaults: {
|
21491
|
emptyText: 'Search for...'
|
21492
|
}
|
21493
|
},
|
21494
|
editor: {
|
21495
|
allowBlank: null_,
|
21496
|
xtype: 'minovalookupgrid',
|
21497
|
readOnly: ReadOnly_,
|
21498
|
isGrid: true,
|
21499
|
fieldTarget: targetField_,
|
21500
|
fieldValue: fieldValue_,
|
21501
|
isGrid: true,
|
21502
|
id: tableName + rec.FieldName,
|
21503
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
21504
|
triggerCls: 'x-form-search-trigger',
|
21505
|
vtype: 'alphanum', // disable space
|
21506
|
nameTable: rec.TableName,
|
21507
|
fieldGrid: rec.FieldName,
|
21508
|
LookupFunction: rec.LookupFunction,
|
21509
|
listeners: {
|
21510
|
change: function (val) {
|
21511
|
var custumFunc = rec.SelectFunction;
|
21512
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
21513
|
Ext.Ajax.request({
|
21514
|
async: false,
|
21515
|
method: 'POST',
|
21516
|
url: '/UserControl/GetStore',
|
21517
|
params: {
|
21518
|
tableName: 'PCMFUNC',
|
21519
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
21520
|
},
|
21521
|
success: function (response) {
|
21522
|
var results = Ext.decode(response.responseText);
|
21523
|
data_ = results.data[0];
|
21524
|
if (data_ != undefined) {
|
21525
|
custumFunc = data_.FunctionCode;
|
21526
|
}
|
21527
|
}
|
21528
|
});
|
21529
|
}
|
21530
|
if (custumFunc) {
|
21531
|
eval(custumFunc)
|
21532
|
}
|
21533
|
}
|
21534
|
}
|
21535
|
}
|
21536
|
});
|
21537
|
} else if (rec.SearchType == '3') {
|
21538
|
cols.push({
|
21539
|
text: rec.HeaderTitle,
|
21540
|
hidden: Hidden_,
|
21541
|
dataIndex: rec.FieldName,
|
21542
|
filter: {
|
21543
|
itemDefaults: {
|
21544
|
emptyText: 'Search for...'
|
21545
|
}
|
21546
|
},
|
21547
|
editor: {
|
21548
|
allowBlank: null_,
|
21549
|
// xtype: 'minovalookuptreePopup',
|
21550
|
xtype: 'MinovaLookupTree',
|
21551
|
readOnly: ReadOnly_,
|
21552
|
id: tableName + rec.FieldName,
|
21553
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
21554
|
triggerCls: 'x-form-search-trigger',
|
21555
|
vtype: 'alphanum', // disable space
|
21556
|
treeSructure: rec.SearchFunction, //'O-O-P',
|
21557
|
objClassValue: rec.ParamCombo, //'O',
|
21558
|
nameTable: rec.TableName,
|
21559
|
fieldGrid: rec.FieldName,
|
21560
|
listeners: {
|
21561
|
change: function (val) {
|
21562
|
var custumFunc = rec.SelectFunction;
|
21563
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
21564
|
Ext.Ajax.request({
|
21565
|
async: false,
|
21566
|
method: 'POST',
|
21567
|
url: '/UserControl/GetStore',
|
21568
|
params: {
|
21569
|
tableName: 'PCMFUNC',
|
21570
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
21571
|
},
|
21572
|
success: function (response) {
|
21573
|
var results = Ext.decode(response.responseText);
|
21574
|
data_ = results.data[0];
|
21575
|
if (data_ != undefined) {
|
21576
|
custumFunc = data_.FunctionCode;
|
21577
|
}
|
21578
|
}
|
21579
|
});
|
21580
|
}
|
21581
|
if (custumFunc) {
|
21582
|
eval(custumFunc)
|
21583
|
}
|
21584
|
}
|
21585
|
}
|
21586
|
}
|
21587
|
});
|
21588
|
} else if (rec.SearchType != '0' && rec.SearchType != '1' && rec.SearchType != '3' && (rec.FieldName == 'EmployeeID' || rec.FieldName == 'ApplicantID' || rec.FieldName == 'EmployeeIDFrom' || rec.FieldName == 'EmployeeIDTo') && isLookup != true) {
|
21589
|
var triger = (rec.TriggerCombo).split('&');
|
21590
|
var targetField_ = triger[0];
|
21591
|
var fieldValue_ = triger[0];
|
21592
|
cols.push({
|
21593
|
text: rec.HeaderTitle,
|
21594
|
hidden: Hidden_,
|
21595
|
dataIndex: rec.FieldName,
|
21596
|
filter: {
|
21597
|
itemDefaults: {
|
21598
|
emptyText: 'Search for...'
|
21599
|
}
|
21600
|
},
|
21601
|
editor: {
|
21602
|
allowBlank: null_,
|
21603
|
xtype: 'lookupemployee',
|
21604
|
readOnly: ReadOnly_,
|
21605
|
isGrid: true,
|
21606
|
fieldTarget: targetField_,
|
21607
|
fieldValue: fieldValue_,
|
21608
|
isGrid: true,
|
21609
|
id: tableName + rec.FieldName,
|
21610
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
21611
|
triggerCls: 'x-form-search-trigger',
|
21612
|
vtype: 'alphanum', // disable space
|
21613
|
nameTable: rec.TableName,
|
21614
|
fieldGrid: rec.FieldName,
|
21615
|
listeners: {
|
21616
|
change: function (val) {
|
21617
|
var custumFunc = rec.SelectFunction;
|
21618
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
21619
|
Ext.Ajax.request({
|
21620
|
async: false,
|
21621
|
method: 'POST',
|
21622
|
url: '/UserControl/GetStore',
|
21623
|
params: {
|
21624
|
tableName: 'PCMFUNC',
|
21625
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
21626
|
},
|
21627
|
success: function (response) {
|
21628
|
var results = Ext.decode(response.responseText);
|
21629
|
data_ = results.data[0];
|
21630
|
if (data_ != undefined) {
|
21631
|
custumFunc = data_.FunctionCode;
|
21632
|
}
|
21633
|
}
|
21634
|
});
|
21635
|
}
|
21636
|
if (custumFunc) {
|
21637
|
eval(custumFunc)
|
21638
|
}
|
21639
|
}
|
21640
|
}
|
21641
|
}
|
21642
|
});
|
21643
|
} else if (rec.SearchType == '4' && isLookup != true) {
|
21644
|
cols.push({
|
21645
|
|
21646
|
text: rec.HeaderTitle,
|
21647
|
hidden: Hidden_,
|
21648
|
dataIndex: rec.FieldName,
|
21649
|
filter: {
|
21650
|
itemDefaults: {
|
21651
|
emptyText: 'Search for...'
|
21652
|
}
|
21653
|
},
|
21654
|
editor: {
|
21655
|
allowBlank: null_,
|
21656
|
xtype: 'lookupemployee',
|
21657
|
readOnly: ReadOnly_,
|
21658
|
isGrid: true,
|
21659
|
fieldTarget: targetField_,
|
21660
|
fieldValue: fieldValue_,
|
21661
|
isGrid: true,
|
21662
|
id: tableName + rec.FieldName,
|
21663
|
tableName: rec.TableRef, //name tabel yang jadi ref-nya
|
21664
|
triggerCls: 'x-form-search-trigger',
|
21665
|
vtype: 'alphanum', // disable space
|
21666
|
nameTable: rec.TableName,
|
21667
|
fieldGrid: rec.FieldName,
|
21668
|
listeners: {
|
21669
|
change: function (val) {
|
21670
|
var custumFunc = rec.SelectFunction;
|
21671
|
if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
|
21672
|
Ext.Ajax.request({
|
21673
|
async: false,
|
21674
|
method: 'POST',
|
21675
|
url: '/UserControl/GetStore',
|
21676
|
params: {
|
21677
|
tableName: 'PCMFUNC',
|
21678
|
param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
|
21679
|
},
|
21680
|
success: function (response) {
|
21681
|
var results = Ext.decode(response.responseText);
|
21682
|
data_ = results.data[0];
|
21683
|
if (data_ != undefined) {
|
21684
|
custumFunc = data_.FunctionCode;
|
21685
|
}
|
21686
|
}
|
21687
|
});
|
21688
|
}
|
21689
|
if (custumFunc) {
|
21690
|
eval(custumFunc)
|
21691
|
}
|
21692
|
}
|
21693
|
}
|
21694
|
}
|
21695
|
});
|
21696
|
} else {
|
21697
|
if (rec.FieldDataType == 3) { //add by taufan
|
21698
|
cols.push({
|
21699
|
text: rec.HeaderTitle,
|
21700
|
hidden: Hidden_,
|
21701
|
dataIndex: rec.FieldName,
|
21702
|
filter: {
|
21703
|
itemDefaults: {
|
21704
|
emptyText: 'Search for...'
|
21705
|
}
|
21706
|
},
|
21707
|
editor: {
|
21708
|
allowBlank: null_,
|
21709
|
xtype: 'textfield',
|
21710
|
readOnly: ReadOnly_,
|
21711
|
id: tableName + rec.FieldName,
|
21712
|
nameTable: rec.TableName,
|
21713
|
fieldGrid: rec.FieldName,
|
21714
|
vtype: 'validateDecimal',
|
21715
|
maxLength: rec.Length,
|
21716
|
precision: rec.Prec,
|
21717
|
fieldStyle: 'text-align:right;',
|
21718
|
listeners: {
|
21719
|
change: function (val) {
|
21720
|
var custumFunc = null;
|
21721
|
Ext.Ajax.request({
|
21722
|
async: false,
|
21723
|
method: 'POST',
|
21724
|
url: '/UserControl/GetStore',
|
21725
|
params: {
|
21726
|
tableName: 'SDATATABLEFIELD',
|
21727
|
param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
|
21728
|
},
|
21729
|
success: function (response) {
|
21730
|
var results = Ext.decode(response.responseText);
|
21731
|
data_ = results.data[0];
|
21732
|
if (data_ != undefined) {
|
21733
|
custumFunc = data_.SelectFunction;
|
21734
|
//console.log(data_)
|
21735
|
}
|
21736
|
}
|
21737
|
});
|
21738
|
|
21739
|
if (custumFunc) {
|
21740
|
eval(custumFunc)
|
21741
|
}
|
21742
|
}
|
21743
|
}
|
21744
|
}
|
21745
|
});
|
21746
|
} else {
|
21747
|
cols.push({
|
21748
|
text: rec.HeaderTitle,
|
21749
|
hidden: Hidden_,
|
21750
|
dataIndex: rec.FieldName,
|
21751
|
filter: {
|
21752
|
itemDefaults: {
|
21753
|
emptyText: 'Search for...'
|
21754
|
}
|
21755
|
},
|
21756
|
editor: {
|
21757
|
allowBlank: null_,
|
21758
|
xtype: 'textfield',
|
21759
|
readOnly: ReadOnly_,
|
21760
|
id: tableName + rec.FieldName,
|
21761
|
nameTable: rec.TableName,
|
21762
|
fieldGrid: rec.FieldName,
|
21763
|
listeners: {
|
21764
|
change: function (val) {
|
21765
|
var custumFunc = null;
|
21766
|
Ext.Ajax.request({
|
21767
|
async: false,
|
21768
|
method: 'POST',
|
21769
|
url: '/UserControl/GetStore',
|
21770
|
params: {
|
21771
|
tableName: 'SDATATABLEFIELD',
|
21772
|
param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
|
21773
|
},
|
21774
|
success: function (response) {
|
21775
|
var results = Ext.decode(response.responseText);
|
21776
|
data_ = results.data[0];
|
21777
|
if (data_ != undefined) {
|
21778
|
custumFunc = data_.SelectFunction;
|
21779
|
//console.log(data_)
|
21780
|
}
|
21781
|
}
|
21782
|
});
|
21783
|
|
21784
|
if (custumFunc) {
|
21785
|
eval(custumFunc)
|
21786
|
}
|
21787
|
}
|
21788
|
}
|
21789
|
}
|
21790
|
});
|
21791
|
}
|
21792
|
}
|
21793
|
|
21794
|
break
|
21795
|
|
21796
|
}
|
21797
|
} else {
|
21798
|
cols.push({
|
21799
|
text: rec.HeaderTitle,
|
21800
|
hidden: Hidden_,
|
21801
|
dataIndex: rec.FieldName,
|
21802
|
hidden: true,
|
21803
|
editor: {
|
21804
|
allowBlank: true,
|
21805
|
xtype: 'textfield',
|
21806
|
readOnly: ReadOnly_,
|
21807
|
id: tableName + rec.FieldName,
|
21808
|
nameTable: rec.TableName,
|
21809
|
fieldGrid: rec.FieldName,
|
21810
|
},
|
21811
|
filter: {
|
21812
|
itemDefaults: {
|
21813
|
emptyText: 'Search for...'
|
21814
|
}
|
21815
|
}
|
21816
|
});
|
21817
|
}
|
21818
|
});
|
21819
|
|
21820
|
};
|
21821
|
addData = addData + "}";
|
21822
|
Ext.applyIf(me, {
|
21823
|
items: [{
|
21824
|
xtype: 'grid',
|
21825
|
id: gridName,
|
21826
|
name: gridName,
|
21827
|
height: height,
|
21828
|
viewConfig: {
|
21829
|
emptyText: 'No Data Display',
|
21830
|
deferEmptyText: false,
|
21831
|
//Add Nana For Autosize Column Mode
|
21832
|
listeners: {
|
21833
|
refresh: function (dataview) {
|
21834
|
Ext.each(dataview.panel.columns, function (column) {
|
21835
|
//if (column.autoSizeColumn == false)
|
21836
|
// column.autoSizeColumn = true;
|
21837
|
column.autoSize();
|
21838
|
//dataview.store.reload();
|
21839
|
})
|
21840
|
}
|
21841
|
},
|
21842
|
render: function (comp) {
|
21843
|
comp.getStore().reload();
|
21844
|
console.log(comp);
|
21845
|
}
|
21846
|
},
|
21847
|
//store: 'gridStore',
|
21848
|
store: Ext.create('Ext.data.Store', {
|
21849
|
storeId: storeID,
|
21850
|
fields: fieldStore,
|
21851
|
proxy: {
|
21852
|
method: 'POST',
|
21853
|
type: 'ajax',
|
21854
|
url: '',
|
21855
|
reader: {
|
21856
|
type: 'json',
|
21857
|
root: 'data'
|
21858
|
}
|
21859
|
}
|
21860
|
}),
|
21861
|
dockedItems: [{
|
21862
|
xtype: 'toolbar',
|
21863
|
items: [{
|
21864
|
text: 'Add',
|
21865
|
hidden: hide_,
|
21866
|
name: tableName + 'Add',
|
21867
|
iconCls: 'fa-plus-circle',
|
21868
|
style: 'font-family: FontAwesome',
|
21869
|
handler: function () {
|
21870
|
var store = Ext.StoreMgr.lookup(storeID)
|
21871
|
idx = store.getCount();
|
21872
|
var action = getParam('action');
|
21873
|
var data = '';
|
21874
|
var Sequence = 0;
|
21875
|
if (idx == 0) {
|
21876
|
Sequence = 1;
|
21877
|
} else {
|
21878
|
Sequence = 1 + idx;
|
21879
|
}
|
21880
|
//data = {
|
21881
|
// Sequence: Sequence
|
21882
|
//};
|
21883
|
|
21884
|
var seq = 'Sequence';
|
21885
|
var SequenceValue = Sequence;
|
21886
|
eval(addData);
|
21887
|
data[seq] = SequenceValue;
|
21888
|
|
21889
|
store.insert(idx, data);
|
21890
|
}
|
21891
|
|
21892
|
}, {
|
21893
|
text: 'Delete',
|
21894
|
hidden: hide_,
|
21895
|
name: tableName + 'DeleteText',
|
21896
|
iconCls: 'fa-trash-o',
|
21897
|
style: 'font-family: FontAwesome',
|
21898
|
//disabled: true
|
21899
|
handler: function () {
|
21900
|
var me = this,
|
21901
|
store = Ext.StoreMgr.lookup(storeID)
|
21902
|
|
21903
|
var grid = Ext.getCmp(gridName);
|
21904
|
|
21905
|
Ext.MessageBox.show({
|
21906
|
title: 'Remove tab',
|
21907
|
msg: "This will remove. Do you want to continue?",
|
21908
|
buttons: Ext.MessageBox.YESNO,
|
21909
|
fn: function (choice) {
|
21910
|
console.log(choice);
|
21911
|
if (choice === 'yes') {
|
21912
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
21913
|
if (selection) {
|
21914
|
store.remove(selection);
|
21915
|
}
|
21916
|
}
|
21917
|
//delete panel.pendingClose;
|
21918
|
}
|
21919
|
});
|
21920
|
}
|
21921
|
|
21922
|
}
|
21923
|
]
|
21924
|
}
|
21925
|
],
|
21926
|
columns: cols,
|
21927
|
selType: checkSelection,
|
21928
|
//selType: 'rowmodel',
|
21929
|
plugins: {
|
21930
|
ptype: 'rowediting',
|
21931
|
pluginId: 'rowEditing',
|
21932
|
clicksToEdit: 1,
|
21933
|
listeners: {
|
21934
|
//edit: 'onGridEditorEdit'
|
21935
|
}
|
21936
|
}
|
21937
|
}, ]
|
21938
|
|
21939
|
});
|
21940
|
|
21941
|
me.callParent(arguments);
|
21942
|
}
|
21943
|
});
|
21944
|
|
21945
|
/*Add by Midi ( Tab List Mass Posting ERP DocType AR)*/
|
21946
|
Ext.define('MinovaUtil.MinovaES.MinovaTabListDocTransAR', {
|
21947
|
extend: 'Ext.tab.Panel',
|
21948
|
alias: ['widget.doctablistAR'],
|
21949
|
transType: undefined,
|
21950
|
docType: undefined,
|
21951
|
docNo: undefined,
|
21952
|
langId: undefined,
|
21953
|
param: undefined,
|
21954
|
layout: 'fit',
|
21955
|
name: 'panelTabAR',
|
21956
|
id: 'mainTabAR',
|
21957
|
action: undefined,
|
21958
|
initComponent: function () {
|
21959
|
var me = this;
|
21960
|
var documentType = me.docType;
|
21961
|
var transactionType = me.transType;
|
21962
|
var hasil = null;
|
21963
|
var _items = [];
|
21964
|
Ext.Ajax.request({
|
21965
|
async: false,
|
21966
|
method: 'POST',
|
21967
|
url: '/UserControl/GetStore',
|
21968
|
params: {
|
21969
|
tableName: 'PCMBSTRANSLIST',
|
21970
|
param: 'TransType[=]' + me.transType
|
21971
|
},
|
21972
|
success: function (response) {
|
21973
|
var results = Ext.decode(response.responseText);
|
21974
|
hasil = results.data;
|
21975
|
}
|
21976
|
});
|
21977
|
hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
|
21978
|
if (hasil.length > 0) {
|
21979
|
Ext.each(hasil, function (rec) {
|
21980
|
if (rec.LayoutType == "L004") { // L004=Custom
|
21981
|
var pnl = Ext.create(rec.CustomLayout, {
|
21982
|
title: rec.Title,
|
21983
|
tableName: rec.TableName,
|
21984
|
height: 400,
|
21985
|
name: 'panelTab' + rec.TableName,
|
21986
|
tbl: rec.TableName,
|
21987
|
layoutType: rec.LayoutType
|
21988
|
});
|
21989
|
_items.push(pnl)
|
21990
|
} else if (rec.LayoutType == "L002" || rec.LayoutType == "L003") {
|
21991
|
_items.push({
|
21992
|
xtype: 'panel',
|
21993
|
title: rec.Title,
|
21994
|
name: 'panelTab' + rec.TableName,
|
21995
|
tbl: rec.TableName,
|
21996
|
layoutType: rec.LayoutType,
|
21997
|
items: [{
|
21998
|
xtype: 'docgrid',
|
21999
|
height: 400,
|
22000
|
tableName: rec.TableName,
|
22001
|
docType: me.docType,
|
22002
|
transType: me.transType,
|
22003
|
storename: 'store' + rec.TableName,
|
22004
|
pagesize: 25,
|
22005
|
name: 'GRID' + rec.TableName,
|
22006
|
margin: '0 0 10 0',
|
22007
|
autoLoad: false,
|
22008
|
tbar: [{
|
22009
|
xtype: 'button',
|
22010
|
text: 'Action',
|
22011
|
name: 'actionGrid' + rec.TableName,
|
22012
|
menu: [{
|
22013
|
text: 'Add',
|
22014
|
name: 'add' + rec.TableName,
|
22015
|
tbl: rec.TableName,
|
22016
|
style: 'font-family: FontAwesome',
|
22017
|
iconCls: 'fa-plus-circle',
|
22018
|
handler: function () {
|
22019
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
22020
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
22021
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
22022
|
frmDisplay.reset();
|
22023
|
frmForm.reset();
|
22024
|
frmDisplay.setHidden(true);
|
22025
|
frmForm.setHidden(false);
|
22026
|
grdPanel.setHidden(true);
|
22027
|
action = "0";
|
22028
|
}
|
22029
|
}, {
|
22030
|
text: 'Delete',
|
22031
|
name: 'delete' + rec.TableName,
|
22032
|
tbl: rec.TableName,
|
22033
|
iconCls: 'fa-trash-o',
|
22034
|
style: 'font-family: FontAwesome',
|
22035
|
handler: function () {
|
22036
|
var me = this;
|
22037
|
var store = Ext.StoreMgr.lookup('store' + rec.TableName);
|
22038
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
22039
|
Ext.MessageBox.show({
|
22040
|
title: 'Remove tab',
|
22041
|
msg: "This will remove. Do you want to continue?",
|
22042
|
buttons: Ext.MessageBox.YESNO,
|
22043
|
fn: function (choice) {
|
22044
|
console.log(choice);
|
22045
|
if (choice === 'yes') {
|
22046
|
var selection = grdPanel.getView().getSelectionModel().getSelection()[0];
|
22047
|
if (selection) {
|
22048
|
store.remove(selection);
|
22049
|
}
|
22050
|
}
|
22051
|
}
|
22052
|
});
|
22053
|
}
|
22054
|
}
|
22055
|
]
|
22056
|
}, {
|
22057
|
xtype: 'tbfill'
|
22058
|
}, {
|
22059
|
text: 'Clear Filters',
|
22060
|
tooltip: 'Clear all filters',
|
22061
|
name: 'clearbtn',
|
22062
|
handler: function () {}
|
22063
|
}
|
22064
|
],
|
22065
|
dockedItems: [{
|
22066
|
xtype: 'pagingtoolbar',
|
22067
|
store: 'store' + rec.TableName,
|
22068
|
dock: 'bottom',
|
22069
|
pageSize: me.pagesize,
|
22070
|
displayInfo: true
|
22071
|
}
|
22072
|
],
|
22073
|
listeners: {
|
22074
|
'itemdblclick': function (me, record, item, index, e, eOpts) {
|
22075
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
22076
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
22077
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
22078
|
frmDisplay.reset();
|
22079
|
frmForm.reset();
|
22080
|
frmDisplay.getForm().setValues(record.data);
|
22081
|
frmForm.getForm().setValues(record.data);
|
22082
|
frmDisplay.setHidden(false);
|
22083
|
frmForm.setHidden(true);
|
22084
|
grdPanel.setHidden(true);
|
22085
|
action = "1";
|
22086
|
}
|
22087
|
}
|
22088
|
}, {
|
22089
|
xtype: 'minovadocform',
|
22090
|
name: 'DISPLAY' + rec.TableName,
|
22091
|
id: 'DISPLAY' + rec.TableName,
|
22092
|
itemId: 'DISPLAY' + rec.TableName,
|
22093
|
tableName: rec.TableName,
|
22094
|
docType: me.docType,
|
22095
|
transType: me.transType,
|
22096
|
isDisplay: true,
|
22097
|
hidden: true,
|
22098
|
buttons: [{
|
22099
|
text: 'Edit',
|
22100
|
name: 'editDISPLAY' + rec.TableName,
|
22101
|
handler: function () {
|
22102
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
22103
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
22104
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
22105
|
frmDisplay.setHidden(true);
|
22106
|
frmForm.setHidden(false);
|
22107
|
grdPanel.setHidden(true);
|
22108
|
}
|
22109
|
}, {
|
22110
|
text: 'Cancel',
|
22111
|
name: 'cancelDISPLAY' + rec.TableName,
|
22112
|
handler: function () {
|
22113
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
22114
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
22115
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
22116
|
frmDisplay.setHidden(true);
|
22117
|
frmForm.setHidden(true);
|
22118
|
grdPanel.setHidden(false);
|
22119
|
grdPanel.getStore().reload();
|
22120
|
}
|
22121
|
}
|
22122
|
]
|
22123
|
}, {
|
22124
|
xtype: 'minovadocform',
|
22125
|
name: 'FORM' + rec.TableName,
|
22126
|
id: 'FORM' + rec.TableName,
|
22127
|
itemId: 'FORM' + rec.TableName,
|
22128
|
tableName: rec.TableName,
|
22129
|
docType: me.docType,
|
22130
|
transType: me.transType,
|
22131
|
isDisplay: false,
|
22132
|
hidden: true,
|
22133
|
buttons: [{
|
22134
|
text: 'Submit',
|
22135
|
name: 'submitFORM' + rec.TableName,
|
22136
|
handler: function () {
|
22137
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
22138
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
22139
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
22140
|
var frm = frmForm.getForm();
|
22141
|
if (frm.isValid()) {
|
22142
|
var table = rec.TableName;
|
22143
|
var data = frmForm.getValues();
|
22144
|
var token = MinovaUtil.SESSIONS.Token;
|
22145
|
var str = grdPanel.getStore();
|
22146
|
var idx = str.getCount();
|
22147
|
str.insert(idx, data);
|
22148
|
frmDisplay.setHidden(true);
|
22149
|
frmForm.setHidden(true);
|
22150
|
grdPanel.setHidden(false);
|
22151
|
}
|
22152
|
}
|
22153
|
}, {
|
22154
|
text: 'Cancel',
|
22155
|
name: 'cancelFORM' + rec.TableName,
|
22156
|
handler: function () {
|
22157
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
22158
|
if (respone == "yes") {
|
22159
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
22160
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
22161
|
var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
|
22162
|
frmDisplay.setHidden(true);
|
22163
|
frmForm.setHidden(true);
|
22164
|
grdPanel.setHidden(false);
|
22165
|
}
|
22166
|
});
|
22167
|
}
|
22168
|
}
|
22169
|
]
|
22170
|
}
|
22171
|
]
|
22172
|
});
|
22173
|
} else if (rec.LayoutType == "L005") { // Grid View Only
|
22174
|
_items.push({
|
22175
|
xtype: 'panel',
|
22176
|
title: rec.Title,
|
22177
|
name: 'panelTab' + rec.TableName,
|
22178
|
tbl: rec.TableName,
|
22179
|
layoutType: rec.LayoutType,
|
22180
|
items: [{
|
22181
|
xtype: 'docgrid',
|
22182
|
height: 400,
|
22183
|
tableName: rec.TableName,
|
22184
|
docType: me.docType,
|
22185
|
transType: me.transType,
|
22186
|
storename: 'store' + rec.TableName,
|
22187
|
pagesize: 25,
|
22188
|
name: 'GRID' + rec.TableName,
|
22189
|
margin: '0 0 10 0',
|
22190
|
autoLoad: false,
|
22191
|
tbar: [{
|
22192
|
xtype: 'tbfill'
|
22193
|
}, {
|
22194
|
text: 'Clear Filters',
|
22195
|
tooltip: 'Clear all filters',
|
22196
|
name: 'clearbtn',
|
22197
|
handler: function () {}
|
22198
|
}
|
22199
|
],
|
22200
|
dockedItems: [{
|
22201
|
xtype: 'pagingtoolbar',
|
22202
|
store: 'store' + rec.TableName,
|
22203
|
dock: 'bottom',
|
22204
|
pageSize: me.pagesize,
|
22205
|
displayInfo: true
|
22206
|
}
|
22207
|
]
|
22208
|
}
|
22209
|
]
|
22210
|
});
|
22211
|
} else if (rec.LayoutType == "L006") {
|
22212
|
_items.push({
|
22213
|
xtype: 'panel',
|
22214
|
title: rec.Title,
|
22215
|
name: 'panelTab' + rec.TableName,
|
22216
|
tbl: rec.TableName,
|
22217
|
layoutType: rec.LayoutType,
|
22218
|
items: [{
|
22219
|
xtype: 'docgridcelledit',
|
22220
|
name: 'CELLGRID' + rec.TableName,
|
22221
|
tableName: rec.TableName,
|
22222
|
docType: me.docType,
|
22223
|
transType: me.transType,
|
22224
|
docNo: me.docNo,
|
22225
|
height: 400,
|
22226
|
hideButton: false,
|
22227
|
margin: '0 0 10 0'
|
22228
|
}
|
22229
|
]
|
22230
|
});
|
22231
|
} else if (rec.LayoutType == "L007") {
|
22232
|
_items.push({
|
22233
|
xtype: 'panel',
|
22234
|
title: rec.Title,
|
22235
|
name: 'panelTab' + rec.TableName,
|
22236
|
tbl: rec.TableName,
|
22237
|
layoutType: rec.LayoutType,
|
22238
|
items: [{
|
22239
|
xtype: 'docgridcelleditsum',
|
22240
|
name: 'CELLGRID' + rec.TableName,
|
22241
|
tableName: rec.TableName,
|
22242
|
docType: me.docType,
|
22243
|
transType: me.transType,
|
22244
|
docNo: me.docNo,
|
22245
|
height: 400,
|
22246
|
hideButton: false,
|
22247
|
margin: '0 0 10 0'
|
22248
|
}, {
|
22249
|
xtype: 'summarydocform',
|
22250
|
name: 'SUM' + rec.TableName,
|
22251
|
id: 'SUM' + rec.TableName,
|
22252
|
itemId: 'SUM' + rec.TableName,
|
22253
|
tableName: rec.TableName,
|
22254
|
docType: me.docType,
|
22255
|
transType: me.transType,
|
22256
|
}
|
22257
|
]
|
22258
|
});
|
22259
|
} else { // L001=Default Form Only
|
22260
|
_items.push({
|
22261
|
xtype: 'panel',
|
22262
|
title: rec.LabelName,
|
22263
|
name: 'panelTab' + rec.TableName,
|
22264
|
tbl: rec.TableName,
|
22265
|
layoutType: rec.LayoutType,
|
22266
|
items: [{
|
22267
|
xtype: 'minovadocform',
|
22268
|
name: 'DISPLAY' + rec.TableName,
|
22269
|
id: 'DISPLAY' + rec.TableName,
|
22270
|
itemId: 'DISPLAY' + rec.TableName,
|
22271
|
tableName: rec.TableName,
|
22272
|
docType: me.docType,
|
22273
|
transType: me.transType,
|
22274
|
isDisplay: true,
|
22275
|
hidden: false,
|
22276
|
buttons: [{
|
22277
|
text: 'Edit',
|
22278
|
name: 'editDISPLAY' + rec.TableName,
|
22279
|
iconCls: 'fa-edit',
|
22280
|
style: 'font-family: FontAwesome',
|
22281
|
handler: function () {
|
22282
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
22283
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
22284
|
frmDisplay.setHidden(true);
|
22285
|
frmForm.setHidden(false);
|
22286
|
action = "1";
|
22287
|
}
|
22288
|
}, {
|
22289
|
text: 'Cancel',
|
22290
|
name: 'cancelDISPLAY' + rec.TableName,
|
22291
|
iconCls: 'fa-reply',
|
22292
|
style: 'font-family: FontAwesome',
|
22293
|
hidden: true
|
22294
|
}
|
22295
|
]
|
22296
|
}, {
|
22297
|
xtype: 'minovadocform',
|
22298
|
name: 'FORM' + rec.TableName,
|
22299
|
id: 'FORM' + rec.TableName,
|
22300
|
itemId: 'FORM' + rec.TableName,
|
22301
|
tableName: rec.TableName,
|
22302
|
docType: me.docType,
|
22303
|
transType: me.transType,
|
22304
|
isDisplay: false,
|
22305
|
hidden: true,
|
22306
|
buttons: [{
|
22307
|
text: 'Save',
|
22308
|
name: 'saveDISPLAY' + rec.TableName,
|
22309
|
iconCls: 'fa-save',
|
22310
|
style: 'font-family: FontAwesome',
|
22311
|
handler: function () {
|
22312
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
22313
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
22314
|
var headerDisplay = Ext.ComponentQuery.query('[name=MainHeaderMDLogistic]')[0];
|
22315
|
var frm = frmForm.getForm();
|
22316
|
if (frm.isValid()) {
|
22317
|
var table = rec.TableName;
|
22318
|
var data = Ext.encode(frmForm.getValues());
|
22319
|
var token = MinovaUtil.SESSIONS.Token;
|
22320
|
var params = {
|
22321
|
apiController: 'api/Devt',
|
22322
|
methodName: 'SaveTableMaster',
|
22323
|
parameter: 'tableName=' + table + '&data=' + data + '&action=' + action + '&token=' + token
|
22324
|
};
|
22325
|
MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
|
22326
|
var result = Ext.decode(xhr.responseText);
|
22327
|
var r = Ext.decode(result.data);
|
22328
|
if (r.success) {
|
22329
|
headerDisplay.mask("Loading...");
|
22330
|
var idNo = r.data;
|
22331
|
frmForm.getForm().findField("DocNo").setValue(idNo);
|
22332
|
frmDisplay.getForm().setValues(frmForm.getValues());
|
22333
|
headerDisplay.getForm().setValues(frmForm.getValues());
|
22334
|
frmDisplay.setHidden(false);
|
22335
|
frmForm.setHidden(true);
|
22336
|
MinovaMessage('Not Null', '000006', '', 'S');
|
22337
|
headerDisplay.unmask();
|
22338
|
} else {
|
22339
|
MinovaMessage(' Not Null ', ' 000005 ', r.message.text, 'E');
|
22340
|
}
|
22341
|
});
|
22342
|
}
|
22343
|
}
|
22344
|
}, {
|
22345
|
text: 'Delete',
|
22346
|
name: 'deleteDISPLAY' + rec.TableName,
|
22347
|
iconCls: 'fa-trash-o',
|
22348
|
style: 'font-family: FontAwesome',
|
22349
|
handler: function () {}
|
22350
|
}, {
|
22351
|
text: 'Cancel',
|
22352
|
name: 'cancelDISPLAY' + rec.TableName,
|
22353
|
iconCls: 'fa-reply',
|
22354
|
style: 'font-family: FontAwesome',
|
22355
|
handler: function () {
|
22356
|
MinovaMessage('Message', '000011', '', 'C', function (respone) {
|
22357
|
if (respone == "yes") {
|
22358
|
var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
|
22359
|
var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
|
22360
|
frmDisplay.setHidden(false);
|
22361
|
frmForm.setHidden(true);
|
22362
|
}
|
22363
|
});
|
22364
|
}
|
22365
|
}
|
22366
|
]
|
22367
|
}
|
22368
|
]
|
22369
|
});
|
22370
|
}
|
22371
|
});
|
22372
|
}
|
22373
|
Ext.applyIf(me, {
|
22374
|
items: _items
|
22375
|
});
|
22376
|
me.callParent(arguments);
|
22377
|
}
|
22378
|
});
|