Project

General

Profile

Feature #1371 » MinovaXtype.js

Tri Rizqiaty, 07/21/2022 02:51 PM

 
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: 'minovagrid1',
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: '&#160;',
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: '&#160;',
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
	anchor: '50%',
1321
	queryMode: 'local',
1322
	forceSelection: true, // cek data
1323
	initComponent: function () {
1324
		var me = this;
1325
		Ext.applyIf(me, {
1326

    
1327
			store: Ext.create('Ext.data.Store', {
1328
				storeId: 'store' + me.name,
1329
				autoLoad: true,
1330
				proxy: {
1331
					method: 'POST',
1332
					type: 'ajax',
1333
					url: '/UserControl/GetStoreAuth',
1334
					extraParams: {
1335
						tableName: me.tableName,
1336
						param: me.param,
1337
						menuId: MinovaUtil.GetMenuID()
1338
					},
1339
					reader: {
1340
						type: 'json',
1341
						root: 'data'
1342
					}
1343
				}
1344
			})
1345
		});
1346
		me.callParent(arguments);
1347
	}
1348
});
1349

    
1350
Ext.define('MinovaUtil.MinovaES.MinovaComboBoxTpl', {
1351
	extend: 'Ext.form.field.ComboBox',
1352
	alias: ['widget.minovacomboboxtpl', 'widget.minovacombotpl'],
1353
	tableName: undefined,
1354
	param: undefined,
1355
	dis1: undefined,
1356
	dis2: undefined,
1357
	anchor: '50%',
1358
	queryMode: 'local',
1359
	forceSelection: true,
1360
	tpl: Ext.create('Ext.XTemplate',
1361
		'<tpl for=".">',
1362
		'<div class="x-boundlist-item">' + this.dis1 + '</div>',
1363
		'</tpl>'),
1364
	displayTpl: Ext.create('Ext.XTemplate',
1365
		'<tpl for=".">',
1366
		+this.dis1,
1367
		'</tpl>'),
1368
	initComponent: function () {
1369
		var me = this;
1370
		Ext.applyIf(me, {
1371
			store: Ext.create('Ext.data.Store', {
1372
				storeId: 'store' + me.name,
1373
				autoLoad: true,
1374
				proxy: {
1375
					method: 'POST',
1376
					type: 'ajax',
1377
					url: '/UserControl/GetStore',
1378
					extraParams: {
1379
						tableName: me.tableName,
1380
						param: me.param
1381
					},
1382
					reader: {
1383
						type: 'json',
1384
						root: 'data'
1385
					}
1386
				}
1387
			})
1388
		});
1389
		me.callParent(arguments);
1390
	}
1391
});
1392
Ext.define('MinovaUtil.MinovaES.MinovaMultiComboBox', {
1393
	extend: 'Ext.form.field.ComboBox',
1394
	alias: ['widget.minovamulticombobox', 'widget.minovamulticombo'],
1395
	tableName: undefined,
1396
	param: undefined,
1397
	anchor: '50%',
1398
	queryMode: 'local',
1399
	forceSelection: true, // cek data
1400
	multiSelect: true,
1401
	getValue: function () {
1402
		var hasil = null;
1403
		var val = this.value;
1404
		if (val != undefined) {
1405
			hasil = val.toString();
1406
		}
1407
		return hasil;
1408
	},
1409
	initComponent: function () {
1410
		var me = this;
1411
		Ext.applyIf(me, {
1412
			store: Ext.create('Ext.data.Store', {
1413
				storeId: 'store' + me.name,
1414
				autoLoad: true,
1415
				proxy: {
1416
					method: 'POST',
1417
					type: 'ajax',
1418
					url: '/UserControl/GetStore',
1419
					extraParams: {
1420
						tableName: me.tableName,
1421
						param: me.param
1422
					},
1423
					reader: {
1424
						type: 'json',
1425
						root: 'data'
1426
					}
1427
				}
1428
			})
1429
		});
1430
		me.callParent(arguments);
1431
	}
1432
});
1433
Ext.define('Ext.ux.MinovaLookupGrid1', {
1434
	extend: 'Ext.form.field.Trigger',
1435
	alias: 'widget.minovalookupgrid1',
1436
	tableName: undefined,
1437
	param: undefined,
1438
	formtarget_: this.formtarget,
1439
	anchor: '50%',
1440
	pagesize: undefined,
1441
	initComponent: function () {
1442
		var target = this.formtarget;
1443
		this.callParent();
1444
	},
1445
	onTriggerClick: function () {
1446
		var count_lookup = Ext.ComponentQuery.query('[name=mainLookup]').length;
1447
		if (count_lookup == 1) {
1448
			Ext.ComponentQuery.query('[name=mainLookup]')[0].show();
1449
		} else {
1450
			var target_ = this.formtarget;
1451
			var fieldtarget = this.name;
1452
			var pagesize_ = this.pagesize;
1453
			if (pagesize_ == undefined) {
1454
				pagesize_ = 25;
1455
			}
1456
			var mainLookup = Ext.create('Ext.window.Window', {
1457
					name: 'mainLookup',
1458
					width: 500,
1459
					heigth: 300,
1460
					maxHeigth: 300,
1461
					minWidth: 400,
1462
					scroll: true,
1463
					modal: true,
1464
					title: 'Lookup - ' + this.fieldLabel,
1465
					items: [{
1466
							xtype: 'form',
1467
							collapsible: false,
1468
							items: [{
1469
									xtype: 'form',
1470
									//width: '90%',
1471
									name: 'formFilter',
1472
									layout: 'column',
1473
									dockedItems: [{
1474
											xtype: 'toolbar',
1475
											dock: 'bottom',
1476
											items: [{
1477
													xtype: 'tbfill'
1478
												}, {
1479
													text: 'Search',
1480
													scope: this,
1481
													handler: function () {
1482
														var store = Ext.data.StoreManager.lookup('lookupStore');
1483
														var form = Ext.ComponentQuery.query('[name=formFilter]')[0].getForm();
1484
														var values_ = form.getValues();
1485
														var fields_ = form.getFields().items;
1486
														var param_ = '';
1487
														for (var i = 0; i < fields_.length; i++) {
1488
															var val_ = form.getFields().items[i].getValue();
1489
															var xtype_ = form.getFields().items[i].xtype;
1490
															var oprator_ = '[like]';
1491
															if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
1492
																oprator_ = '[Equal]';
1493
															}
1494
															if (xtype_ == 'datefield') {
1495
																if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
1496
																	oprator_ = '[LessThanEqual]';
1497
																} else {
1498
																	oprator_ = '[GreaterThanEqual]';
1499
																}
1500
															}
1501
															if (val_ != 'undefined' && val_ != "") {
1502
																param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
1503
															}
1504
														}
1505
														store.proxy.extraParams = {
1506
															tableName: this.tableName,
1507
															param: param_
1508
														};
1509
														store.removeAll();
1510
														store.reload();
1511
														store.loadPage(1);
1512
													}
1513
												}, ]
1514
										}
1515
									],
1516
									defaults: {
1517
										xtype: 'container',
1518
										defaultType: 'textfield',
1519
										style: 'width: 50%'
1520
									},
1521
									items: [{
1522
											xtype: 'minovaform',
1523
											bodyBorder: false,
1524
											cls: 'borderLookup',
1525
											border: false,
1526
											MaxHeigth: '30',
1527
											scroll: true,
1528
											isLookup: 1,
1529
											name: "formLookupFilter",
1530
											tableName: this.tableName,
1531
										}
1532
									],
1533
								}
1534
							]
1535
						}, {
1536
							xtype: 'form',
1537
							name: 'formResult',
1538
							title: 'Result',
1539
							collapsible: true,
1540
							items: [{
1541
									xtype: "minovagrid",
1542
									name: "lookupgrid",
1543
									tableName: this.tableName,
1544
									param: '',
1545
									pagesize: pagesize_,
1546
									storename: 'lookupStore',
1547
									isLookup: 1,
1548
									border: false,
1549
									minHeight: 300,
1550
									maxHeight: 500,
1551
									height: 100,
1552
									columnLines: true,
1553
									scrollable: true,
1554
									listeners: {
1555
										itemdblclick: function (formtarget_) {
1556
											var me = this;
1557
											var selection = this.getView().getSelectionModel().getSelection()[0];
1558
											if (target_ == null || target_ == undefined) {
1559
												var formtarget_ = '[name=' + fieldtarget + ']';
1560
												var form_ = Ext.ComponentQuery.query(formtarget_)[0];
1561
											} else {
1562
												var formtarget_ = 'form[name=' + target_ + ']';
1563
												var form_ = Ext.ComponentQuery.query(formtarget_)[0].getForm();
1564
												form_.setValues(selection.data)
1565
											}
1566
											mainLookup.hide();
1567
										},
1568
										beforeedit: function (grid) {
1569
											return false;
1570
										}
1571
									},
1572
									dockedItems: [{
1573
											xtype: 'pagingtoolbar',
1574
											store: 'lookupStore',
1575
											dock: 'bottom',
1576
											pageSize: pagesize_,
1577
											displayInfo: true
1578
										}
1579
									],
1580
								}
1581
							]
1582
						}
1583
					]
1584
				}).show();
1585
		}
1586
	},
1587
});
1588
Ext.define('Ext.ux.MinovaLookupTree', {
1589
	extend: 'Ext.form.field.Trigger',
1590
	alias: 'widget.minovalookuptree',
1591
	tableName: undefined,
1592
	param: undefined,
1593
	onTriggerClick: function () {}
1594

    
1595
});
1596
Ext.define('Ext.ux.MinovaLookupFile', {
1597
	extend: 'Ext.form.field.Trigger',
1598
	alias: 'widget.minovalookupfile',
1599
	tableName: undefined,
1600
	param: undefined,
1601
	onTriggerClick: function () {}
1602

    
1603
});
1604
Ext.define('MinovaUtil.MinovaES.MinovaGrid1', {
1605
	extend: 'Ext.grid.Panel',
1606
	requires: ['Ext.grid.RowNumberer'],
1607
	alias: 'widget.minovagrid1',
1608
	//alias: ['widget.minovagrid1', 'widget.minovagrid'],
1609
	//alias: ['widget.minovagrid1', 'widget.minovagrid'],
1610
	alternateClassName: 'Ext.grid.MinovaGrid',
1611
	//controller:'orm-manage2-controller',
1612
	tableName: undefined,
1613
	isLookup: undefined,
1614
	param: undefined,
1615
	pagesize: undefined,
1616
	storename: undefined,
1617
	layoutType: undefined,
1618
	enableLocking: true,
1619
	autoLoad: undefined,
1620
	multiSelect: undefined,
1621
	getTableName: function () {
1622
		return this.tableName;
1623
	},
1624

    
1625
	initComponent: function () {
1626
		var me = this;
1627
		var cols_ = [];
1628
		var fieldeditor = {};
1629
		var hasil = null;
1630
		var autoLoad = true;
1631
		var LangID = localStorage.LangId;
1632
		var fielGrid = 'rec.GridView == 1';
1633
		var locking = true;
1634
		var checkSelection = '';
1635
		var widthLock = 250;
1636
		if (me.multiSelect) {
1637
			locking = false;
1638
			checkSelection = 'checkboxmodel';
1639
			widthLock = 40;
1640
		}
1641
		//var _url = 'GetAllField';
1642
		if (me.autoLoad == false) {
1643
			autoLoad = false;
1644
		}
1645
		parameter = null;
1646
		if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
1647
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupGrid='1'";
1648
			fielGrid = 'rec.LookupGrid == 1';
1649
			locking = false;
1650

    
1651
		} else {
1652
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
1653
				//autoLoad = false;
1654
				//_url = 'GetAllFieldGridLookUp';
1655
		};
1656

    
1657
		//Ext.Ajax.request({
1658
		//	async : false,
1659
		//	method : 'POST',
1660
		//	url : '/Devt/' + _url + '?tableName=' + me.tableName,
1661
		//	success : function (response) {
1662
		//		var results = Ext.decode(response.responseText);
1663
		//		hasil = results.data;
1664
		//	}
1665
		//});
1666
		//hamid03102016
1667

    
1668
		Ext.Ajax.request({
1669
			async: false,
1670
			method: 'POST',
1671
			url: '/UserControl/GetStore',
1672
			params: {
1673
				tableName: 'PDSBS0007',
1674
				param: parameter
1675
			},
1676
			success: function (response) {
1677
				var results = Ext.decode(response.responseText);
1678
				hasil = results.data;
1679
			}
1680
		});
1681
		//end
1682

    
1683
		if (hasil.length > 0) {
1684

    
1685
			Ext.each(hasil, function (rec) {
1686
				var null_ = null;
1687
				if (rec.IsPrimaryKey == true) {
1688
					null_ = false;
1689
				}
1690
				if (rec.IsRequired == true) {
1691
					null_ = false;
1692
				} else {
1693
					null_ = true;
1694
				}
1695

    
1696
				if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
1697
					if (rec.LookupGrid == 1) {
1698
						switch (rec.FormatRef) {
1699
						case "file":
1700
							cols_.push({
1701
								xtype: 'minovapicturecolumn',
1702
								text: rec.HeaderTitle,
1703
								dataIndex: rec.FieldName,
1704
								width: 100,
1705
								//filter: {
1706
								//    type: 'image',
1707
								//    itemDefaults: {
1708
								//        emptyText: 'Search for...'
1709
								//    }
1710
								//}
1711
							});
1712
							break
1713
						case "date":
1714
							cols_.push({
1715
								xtype: 'minovadatecolumn',
1716
								text: rec.HeaderTitle,
1717
								dataIndex: rec.FieldName,
1718
								width: 100,
1719
								filter: {
1720
									type: 'date',
1721
									itemDefaults: {
1722
										emptyText: 'Search for...'
1723
									}
1724
								}
1725
							});
1726
							break
1727
						case "amount":
1728
							cols_.push({
1729
								xtype: 'minovacurrancycolumn',
1730
								text: rec.HeaderTitle,
1731
								dataIndex: rec.FieldName,
1732
								align: 'right',
1733
								width: 300,
1734
								filter: {
1735
									type: 'number',
1736
									itemDefaults: {
1737
										emptyText: 'Search for...'
1738
									}
1739
								}
1740
							});
1741
							break
1742
						case "amountencrypt":
1743
							cols_.push({
1744
								xtype: 'minovaamountcolumn',
1745
								text: rec.HeaderTitle,
1746
								dataIndex: rec.FieldName,
1747
								align: 'right',
1748
								width: 300,
1749
								filter: {
1750
									type: 'string',
1751
									itemDefaults: {
1752
										emptyText: 'Search for...'
1753
									}
1754
								}
1755
							});
1756
							break
1757
						case "datetime":
1758
							cols_.push({
1759
								xtype: 'minovadatetimecolumn',
1760
								text: rec.HeaderTitle,
1761
								dataIndex: rec.FieldName,
1762
								width: 140,
1763
								filter: {
1764
									type: 'string',
1765
									itemDefaults: {
1766
										emptyText: 'Search for...'
1767
									}
1768
								}
1769
							});
1770
							break
1771
						default:
1772
							if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
1773
								cols_.push({
1774
									text: rec.HeaderTitle,
1775
									dataIndex: rec.FieldName,
1776
									width: 100,
1777
									filter: {
1778
										type: 'string',
1779
										itemDefaults: {
1780
											emptyText: 'Search for...'
1781
										}
1782
									}
1783
								});
1784
							} else if (rec.SearchType == '2') {
1785
								cols_.push({
1786
									xtype: 'minovalookupcolumn',
1787
									text: rec.HeaderTitle,
1788
									tableName: rec.TableRef,
1789
									dataIndex: rec.FieldName,
1790
									filter: {
1791
										itemDefaults: {
1792
											emptyText: 'Search for...'
1793
										}
1794
									}
1795
								});
1796
							} else if (rec.TableRef != "" && rec.SearchType != '2') {
1797
								if (rec.TableRef != null) {
1798
									var valueField = null;
1799
									var displayValue = null;
1800
									Ext.Ajax.request({
1801
										async: false,
1802
										method: 'POST',
1803
										url: '/UserControl/GetStore',
1804
										params: {
1805
											tableName: 'SDATATABLEFIELD',
1806
											param: 'TableName[equal]' + rec.TableRef
1807
										},
1808
										success: function (response) {
1809
											var results = Ext.decode(response.responseText);
1810
											data_ = results.data;
1811
											if (data_ != undefined) {
1812
												valueField_ = $.grep(data_, function (r) {
1813
														return r.ValueField == '1'
1814
													});
1815
												valueField = valueField_[0].FieldName
1816
													displayValue_ = $.grep(data_, function (r) {
1817
														return r.DisplayValue == '1'
1818
													});
1819
												displayValue = displayValue_[0].FieldName
1820
											}
1821
										}
1822
									});
1823
									var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
1824
									var count_ = 0;
1825
									if (store_) {
1826
										count_ = store_.count();
1827
									}
1828
									if (count_ == 0) {
1829
										Ext.create('Ext.data.Store', {
1830
											storeId: 'store_' + rec.FieldName,
1831
											//autoLoad: true,
1832
											proxy: {
1833
												method: 'POST',
1834
												type: 'ajax',
1835
												url: '/UserControl/GetStore',
1836
												extraParams: {
1837
													tableName: rec.TableRef,
1838
													param: rec.ParamCombo
1839
												},
1840
												reader: {
1841
													type: 'json',
1842
													root: 'data',
1843
													totalProperty: 'data[0].TotalCount'
1844
												}
1845
											}
1846
										})
1847
									}
1848
									cols_.push({
1849
										xtype: 'minovacombocolumn',
1850
										text: rec.HeaderTitle,
1851
										dataIndex: rec.FieldName,
1852
										valueField: valueField,
1853
										displayField: displayValue,
1854
										store: 'store_' + rec.FieldName,
1855
										filter: {
1856
											type: 'list',
1857
											itemDefaults: {
1858
												emptyText: 'Search for...'
1859
											}
1860
										}
1861
									});
1862
								}
1863

    
1864
							} else {
1865
								cols_.push({
1866
									text: rec.HeaderTitle,
1867
									dataIndex: rec.FieldName,
1868
									filter: {
1869
										itemDefaults: {
1870
											emptyText: 'Search for...'
1871
										}
1872
									}
1873
								});
1874
							}
1875
							break
1876
						}
1877
					} else {
1878
						cols_.push({
1879
							text: rec.HeaderTitle,
1880
							dataIndex: rec.FieldName,
1881
							hidden: true,
1882
							filter: {
1883
								itemDefaults: {
1884
									emptyText: 'Search for...'
1885
								}
1886
							}
1887
						});
1888
					}
1889

    
1890
				} else {
1891
					if (rec.GridView == 1) {
1892
						switch (rec.FormatRef) {
1893
						case "action":
1894
							cols_.push({
1895
								text: rec.HeaderTitle,
1896
								width: 100,
1897
								xtype: 'actioncolumn',
1898
								tooltip: 'View Data',
1899
								name: rec.FieldName,
1900
								itemId: me.tableName + rec.FieldName,
1901
								align: 'center',
1902
								iconCls: 'fa-edit',
1903
								renderer: function (value, metadata, record) {
1904
									metadata.tdStyle = 'font-family: FontAwesome'
1905
								},
1906
								handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
1907

    
1908
									this.fireEvent(me.tableName + rec.FieldName + "onActionClick", record);
1909
								}
1910
							});
1911
							break
1912
						case "file":
1913
							cols_.push({
1914
								xtype: 'minovapicturecolumn',
1915
								text: rec.HeaderTitle,
1916
								dataIndex: rec.FieldName,
1917
								width: 100,
1918
								//filter: {
1919
								//    type: '',
1920
								//    itemDefaults: {
1921
								//        emptyText: 'Search for...'
1922
								//    }
1923
								//}
1924
							});
1925
							break
1926
						case "date":
1927
							cols_.push({
1928
								xtype: 'minovadatecolumn',
1929
								text: rec.HeaderTitle,
1930
								dataIndex: rec.FieldName,
1931
								width: 100,
1932
								filter: {
1933
									type: 'date',
1934
									itemDefaults: {
1935
										emptyText: 'Search for...'
1936
									}
1937
								}
1938
							});
1939
							break
1940
						case "amountencrypt":
1941
							cols_.push({
1942
								xtype: 'minovaamountcolumn',
1943
								text: rec.HeaderTitle,
1944
								dataIndex: rec.FieldName,
1945
								align: 'right',
1946
								width: 300,
1947
								filter: {
1948
									type: 'string',
1949
									itemDefaults: {
1950
										emptyText: 'Search for...'
1951
									}
1952
								}
1953
							});
1954
							break
1955
						case "amountround":
1956
							cols_.push({
1957
								xtype: 'minovacurrancycolumnround',
1958
								text: rec.HeaderTitle,
1959
								dataIndex: rec.FieldName,
1960
								align: 'right',
1961
								width: 300,
1962
								filter: {
1963
									itemDefaults: {
1964
										emptyText: 'Search for...'
1965
									}
1966
								}
1967
							});
1968
							break
1969
						case "amount":
1970
							cols_.push({
1971
								xtype: 'minovacurrancycolumn',
1972
								text: rec.HeaderTitle,
1973
								dataIndex: rec.FieldName,
1974
								align: 'right',
1975
								width: 300,
1976
								filter: {
1977
									type: 'number',
1978
									itemDefaults: {
1979
										emptyText: 'Search for...'
1980
									}
1981
								}
1982
							});
1983
							break
1984
						case "datetime":
1985
							cols_.push({
1986
								xtype: 'minovadatetimecolumn',
1987
								text: rec.HeaderTitle,
1988
								dataIndex: rec.FieldName,
1989
								width: 140,
1990
								filter: {
1991
									type: 'string',
1992
									itemDefaults: {
1993
										emptyText: 'Search for...'
1994
									}
1995
								}
1996
							});
1997
							break
1998
						default:
1999
							if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
2000
								cols_.push({
2001
									text: rec.HeaderTitle,
2002
									dataIndex: rec.FieldName,
2003
									width: 100,
2004
									filter: {
2005
										type: 'string',
2006
										itemDefaults: {
2007
											emptyText: 'Search for...'
2008
										}
2009
									}
2010
								});
2011
							} else if (rec.TableRef != "") {
2012
								if (rec.TableRef != null) {
2013
									var valueField = null;
2014
									var displayValue = null;
2015
									Ext.Ajax.request({
2016
										async: false,
2017
										method: 'POST',
2018
										url: '/UserControl/GetStore',
2019
										params: {
2020
											tableName: 'SDATATABLEFIELD',
2021
											param: 'TableName[equal]' + rec.TableRef
2022
										},
2023
										success: function (response) {
2024
											var results = Ext.decode(response.responseText);
2025
											data_ = results.data;
2026
											//if (data_ != undefined) {
2027
											if (data_.length > 0) {
2028
												valueField_ = $.grep(data_, function (r) {
2029
														return r.ValueField == '1'
2030
													});
2031
												valueField = valueField_[0].FieldName
2032
													displayValue_ = $.grep(data_, function (r) {
2033
														return r.DisplayValue == '1'
2034
													});
2035
												displayValue = displayValue_[0].FieldName
2036
											} else {
2037
												MinovaMessage('Not Null', 'BSNULLCOMBO', rec.TableRef, 'E');
2038
											}
2039
										}
2040
									});
2041
									var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
2042
									var count_ = 0;
2043
									if (store_) {
2044
										count_ = store_.count();
2045
									}
2046
									if (count_ == 0) {
2047
										Ext.create('Ext.data.Store', {
2048
											storeId: 'store_' + rec.FieldName,
2049
											autoLoad: false,
2050
											proxy: {
2051
												method: 'POST',
2052
												type: 'ajax',
2053
												url: '/UserControl/GetStore',
2054
												extraParams: {
2055
													tableName: rec.TableRef,
2056
													param: rec.ParamCombo
2057
												},
2058
												reader: {
2059
													type: 'json',
2060
													root: 'data',
2061
													totalProperty: 'data[0].TotalCount'
2062
												}
2063
											}
2064
										})
2065
									}
2066
									cols_.push({
2067
										xtype: 'minovacombocolumn',
2068
										text: rec.HeaderTitle,
2069
										dataIndex: rec.FieldName,
2070
										valueField: valueField,
2071
										displayField: displayValue,
2072
										store: 'store_' + rec.FieldName,
2073
										filter: {
2074
											type: 'list',
2075
											itemDefaults: {
2076
												emptyText: 'Search for...'
2077
											}
2078
										}
2079
									});
2080
								}
2081

    
2082
							} else if (rec.FixedValue != "") {
2083
								cols_.push({
2084
									xtype: 'minovacombocolumnfixvalue',
2085
									text: rec.HeaderTitle,
2086
									dataIndex: rec.FieldName,
2087
									fixedValue: rec.FixedValue,
2088
									filter: {
2089
										type: 'list',
2090
										itemDefaults: {
2091
											emptyText: 'Search for...'
2092
										}
2093
									}
2094
								});
2095
							} else {
2096
								cols_.push({
2097
									text: rec.HeaderTitle,
2098
									dataIndex: rec.FieldName,
2099
									filter: {
2100
										itemDefaults: {
2101
											emptyText: 'Search for...'
2102
										}
2103
									}
2104
								});
2105
							}
2106
							break
2107
						}
2108
					} else {
2109
						cols_.push({
2110
							text: rec.HeaderTitle,
2111
							dataIndex: rec.FieldName,
2112
							hidden: true,
2113
							filter: {
2114
								itemDefaults: {
2115
									emptyText: 'Search for...'
2116
								}
2117
							}
2118
						});
2119
					}
2120

    
2121
				}
2122
			});
2123
		};
2124
		var param_ = me.param;
2125
		if (param_ == undefined) {
2126
			param_ = ''
2127
		}
2128
		var jsStoreGrid = new Ext.data.Store({
2129
				storeId: me.storename,
2130
				autoLoad: autoLoad,
2131
				pageSize: me.pagesize,
2132
				proxy: {
2133
					method: 'POST',
2134
					type: 'ajax',
2135
					url: '/UserControl/GetStorePagingAuth',
2136
					extraParams: {
2137
						tableName: me.tableName,
2138
						param: param_,
2139
						menuId: MinovaUtil.GetMenuID()
2140
					},
2141
					reader: {
2142
						type: 'json',
2143
						root: 'data',
2144
						totalProperty: 'totalRecords'
2145
					}
2146
				},
2147
			});
2148
		Ext.applyIf(me, {
2149
			autoScroll: true,
2150
			enableLocking: locking,
2151
			lockedGridConfig: {
2152
				header: false,
2153
				collapsible: true,
2154
				width: widthLock,
2155
				forceFit: locking,
2156
				listeners: {
2157
					render: function (grid) {
2158
						var pagingToolbar = grid.child('pagingtoolbar');
2159
						if (pagingToolbar) {
2160
							grid.remove(pagingToolbar, true);
2161
						}
2162
					}
2163
				}
2164
			},
2165
			listeners: {
2166
				viewready: function () {
2167
					if (autoLoad == true) {
2168
						this.getStore().loadPage(1);
2169
					}
2170
				},
2171
				beforeedit: function () {
2172
					return false;
2173
				},
2174
			},
2175
			lockedViewConfig: {
2176
				scroll: 'horizontal'
2177
			},
2178
			viewConfig: {
2179
				emptyText: 'No Data Display',
2180
				deferEmptyText: false,
2181
				//Add Nana For Autosize Column Mode
2182
				listeners: {
2183
					refresh: function (dataview) {
2184
						Ext.each(dataview.panel.columns, function (column) {
2185
							//if (column.autoSizeColumn == false)
2186
							//	column.autoSizeColumn = true;
2187
							column.autoSize();
2188
							//dataview.store.reload();
2189
						})
2190
					},
2191
					afterrender: function (dataview) {
2192
						Ext.defer(function () {
2193
							dataview.store.reload();
2194
						}, 2000, this);
2195
						//dataview.store.reload();
2196
					}
2197
				},
2198
				render: function (comp) {
2199
					comp.getStore().reload();
2200
					console.log(comp);
2201
				}
2202
			},
2203
			//for chekbox
2204
			selModel: {
2205
				//type: 'cellmodel'
2206
			},
2207
			selType: checkSelection,
2208
			columns: cols_,
2209

    
2210
			store: jsStoreGrid,
2211

    
2212
			plugins: [{
2213
					ptype: 'gridfilters'
2214
				}
2215
			],
2216

    
2217
		});
2218
		me.callParent(arguments);
2219
	}
2220

    
2221
});
2222

    
2223
Ext.define('MinovaUtil.MinovaES.MinovaGrid2', {
2224
	extend: 'Ext.grid.Panel',
2225
	requires: ['Ext.grid.RowNumberer'],
2226
	alias: 'widget.minovagrid2',
2227
	//alias: ['widget.minovagrid2', 'widget.minovagrid'],
2228
	//alias: ['widget.minovagrid2', 'widget.minovagrid'],
2229
	alternateClassName: 'Ext.grid.MinovaGrid',
2230
	//controller:'orm-manage2-controller',
2231
	tableName: undefined,
2232
	isLookup: undefined,
2233
	param: undefined,
2234
	pagesize: undefined,
2235
	storename: undefined,
2236
	layoutType: undefined,
2237
	enableLocking: true,
2238
	autoLoad: undefined,
2239
	multiSelect: undefined,
2240
	getTableName: function () {
2241
		return this.tableName;
2242
	},
2243

    
2244
	initComponent: function () {
2245
		var me = this;
2246
		var cols_ = [];
2247
		var fieldeditor = {};
2248
		var hasil = null;
2249
		var autoLoad = true;
2250
		var LangID = localStorage.LangId;
2251
		var fielGrid = 'rec.GridView == 1';
2252
		var locking = true;
2253
		var checkSelection = '';
2254
		var widthLock = 250;
2255
		if (me.multiSelect) {
2256
			locking = false;
2257
			checkSelection = 'checkboxmodel';
2258
			widthLock = 40;
2259
		}
2260
		//var _url = 'GetAllField';
2261
		if (me.autoLoad == false) {
2262
			autoLoad = false;
2263
		}
2264
		parameter = null;
2265
		if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
2266
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupGrid='1'";
2267
			fielGrid = 'rec.LookupGrid == 1';
2268
			locking = false;
2269

    
2270
		} else {
2271
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
2272
				//autoLoad = false;
2273
				//_url = 'GetAllFieldGridLookUp';
2274
		};
2275

    
2276
		//Ext.Ajax.request({
2277
		//	async : false,
2278
		//	method : 'POST',
2279
		//	url : '/Devt/' + _url + '?tableName=' + me.tableName,
2280
		//	success : function (response) {
2281
		//		var results = Ext.decode(response.responseText);
2282
		//		hasil = results.data;
2283
		//	}
2284
		//});
2285
		//hamid03102016
2286

    
2287
		Ext.Ajax.request({
2288
			async: false,
2289
			method: 'POST',
2290
			url: '/UserControl/GetStore',
2291
			params: {
2292
				tableName: 'PDSBS0007',
2293
				param: parameter
2294
			},
2295
			success: function (response) {
2296
				var results = Ext.decode(response.responseText);
2297
				hasil = results.data;
2298
			}
2299
		});
2300
		//end
2301

    
2302
		if (hasil.length > 0) {
2303

    
2304
			Ext.each(hasil, function (rec) {
2305
				var null_ = null;
2306
				if (rec.IsPrimaryKey == true) {
2307
					null_ = false;
2308
				}
2309
				if (rec.IsRequired == true) {
2310
					null_ = false;
2311
				} else {
2312
					null_ = true;
2313
				}
2314

    
2315
				if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
2316
					if (rec.LookupGrid == 1) {
2317
						switch (rec.FormatRef) {
2318
						case "file":
2319
							cols_.push({
2320
								xtype: 'minovapicturecolumn',
2321
								text: rec.HeaderTitle,
2322
								dataIndex: rec.FieldName,
2323
								width: 100,
2324
								//filter: {
2325
								//    type: 'image',
2326
								//    itemDefaults: {
2327
								//        emptyText: 'Search for...'
2328
								//    }
2329
								//}
2330
							});
2331
							break
2332
						case "date":
2333
							cols_.push({
2334
								xtype: 'minovadatecolumn',
2335
								text: rec.HeaderTitle,
2336
								dataIndex: rec.FieldName,
2337
								width: 100,
2338
								filter: {
2339
									type: 'date',
2340
									itemDefaults: {
2341
										emptyText: 'Search for...'
2342
									}
2343
								}
2344
							});
2345
							break
2346
						case "amount":
2347
							cols_.push({
2348
								xtype: 'minovacurrancycolumn',
2349
								text: rec.HeaderTitle,
2350
								dataIndex: rec.FieldName,
2351
								align: 'right',
2352
								width: 300,
2353
								filter: {
2354
									type: 'number',
2355
									itemDefaults: {
2356
										emptyText: 'Search for...'
2357
									}
2358
								}
2359
							});
2360
							break
2361
						case "amountencrypt":
2362
							cols_.push({
2363
								xtype: 'minovaamountcolumn',
2364
								text: rec.HeaderTitle,
2365
								dataIndex: rec.FieldName,
2366
								align: 'right',
2367
								width: 300,
2368
								filter: {
2369
									type: 'string',
2370
									itemDefaults: {
2371
										emptyText: 'Search for...'
2372
									}
2373
								}
2374
							});
2375
							break
2376
						case "datetime":
2377
							cols_.push({
2378
								xtype: 'minovadatetimecolumn',
2379
								text: rec.HeaderTitle,
2380
								dataIndex: rec.FieldName,
2381
								width: 140,
2382
								filter: {
2383
									type: 'string',
2384
									itemDefaults: {
2385
										emptyText: 'Search for...'
2386
									}
2387
								}
2388
							});
2389
							break
2390
						default:
2391
							if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
2392
								cols_.push({
2393
									text: rec.HeaderTitle,
2394
									dataIndex: rec.FieldName,
2395
									width: 100,
2396
									filter: {
2397
										type: 'string',
2398
										itemDefaults: {
2399
											emptyText: 'Search for...'
2400
										}
2401
									}
2402
								});
2403
							} else if (rec.SearchType == '2') {
2404
								cols_.push({
2405
									xtype: 'minovalookupcolumn',
2406
									text: rec.HeaderTitle,
2407
									tableName: rec.TableRef,
2408
									dataIndex: rec.FieldName,
2409
									filter: {
2410
										itemDefaults: {
2411
											emptyText: 'Search for...'
2412
										}
2413
									}
2414
								});
2415
							} else if (rec.TableRef != "" && rec.SearchType != '2') {
2416
								if (rec.TableRef != null) {
2417
									var valueField = null;
2418
									var displayValue = null;
2419
									Ext.Ajax.request({
2420
										async: false,
2421
										method: 'POST',
2422
										url: '/UserControl/GetStore',
2423
										params: {
2424
											tableName: 'SDATATABLEFIELD',
2425
											param: 'TableName[equal]' + rec.TableRef
2426
										},
2427
										success: function (response) {
2428
											var results = Ext.decode(response.responseText);
2429
											data_ = results.data;
2430
											if (data_ != undefined) {
2431
												valueField_ = $.grep(data_, function (r) {
2432
														return r.ValueField == '1'
2433
													});
2434
												valueField = valueField_[0].FieldName
2435
													displayValue_ = $.grep(data_, function (r) {
2436
														return r.DisplayValue == '1'
2437
													});
2438
												displayValue = displayValue_[0].FieldName
2439
											}
2440
										}
2441
									});
2442
									var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
2443
									var count_ = 0;
2444
									if (store_) {
2445
										count_ = store_.count();
2446
									}
2447
									if (count_ == 0) {
2448
										Ext.create('Ext.data.Store', {
2449
											storeId: 'store_' + rec.FieldName,
2450
											//autoLoad: true,
2451
											proxy: {
2452
												method: 'POST',
2453
												type: 'ajax',
2454
												url: '/UserControl/GetStore',
2455
												extraParams: {
2456
													tableName: rec.TableRef,
2457
													param: rec.ParamCombo
2458
												},
2459
												reader: {
2460
													type: 'json',
2461
													root: 'data',
2462
													totalProperty: 'data[0].TotalCount'
2463
												}
2464
											}
2465
										})
2466
									}
2467
									cols_.push({
2468
										xtype: 'minovacombocolumn',
2469
										text: rec.HeaderTitle,
2470
										dataIndex: rec.FieldName,
2471
										valueField: valueField,
2472
										displayField: displayValue,
2473
										store: 'store_' + rec.FieldName,
2474
										filter: {
2475
											type: 'list',
2476
											itemDefaults: {
2477
												emptyText: 'Search for...'
2478
											}
2479
										}
2480
									});
2481
								}
2482

    
2483
							} else {
2484
								cols_.push({
2485
									text: rec.HeaderTitle,
2486
									dataIndex: rec.FieldName,
2487
									filter: {
2488
										itemDefaults: {
2489
											emptyText: 'Search for...'
2490
										}
2491
									}
2492
								});
2493
							}
2494
							break
2495
						}
2496
					} else {
2497
						cols_.push({
2498
							text: rec.HeaderTitle,
2499
							dataIndex: rec.FieldName,
2500
							hidden: true,
2501
							filter: {
2502
								itemDefaults: {
2503
									emptyText: 'Search for...'
2504
								}
2505
							}
2506
						});
2507
					}
2508

    
2509
				} else {
2510
					if (rec.GridView == 1) {
2511
						switch (rec.FormatRef) {
2512
						case "action":
2513
							cols_.push({
2514
								text: rec.HeaderTitle,
2515
								width: 100,
2516
								xtype: 'actioncolumn',
2517
								tooltip: 'View Data',
2518
								name: rec.FieldName,
2519
								itemId: me.tableName + rec.FieldName,
2520
								align: 'center',
2521
								iconCls: 'fa-edit',
2522
								renderer: function (value, metadata, record) {
2523
									metadata.tdStyle = 'font-family: FontAwesome'
2524
								},
2525
								handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
2526

    
2527
									this.fireEvent(me.tableName + rec.FieldName + "onActionClick", record);
2528
								}
2529
							});
2530
							break
2531
						case "file":
2532
							cols_.push({
2533
								xtype: 'minovapicturecolumn',
2534
								text: rec.HeaderTitle,
2535
								dataIndex: rec.FieldName,
2536
								width: 100,
2537
								//filter: {
2538
								//    type: '',
2539
								//    itemDefaults: {
2540
								//        emptyText: 'Search for...'
2541
								//    }
2542
								//}
2543
							});
2544
							break
2545
						case "date":
2546
							cols_.push({
2547
								xtype: 'minovadatecolumn',
2548
								text: rec.HeaderTitle,
2549
								dataIndex: rec.FieldName,
2550
								width: 100,
2551
								filter: {
2552
									type: 'date',
2553
									itemDefaults: {
2554
										emptyText: 'Search for...'
2555
									}
2556
								}
2557
							});
2558
							break
2559
						case "amountencrypt":
2560
							cols_.push({
2561
								xtype: 'minovaamountcolumn',
2562
								text: rec.HeaderTitle,
2563
								dataIndex: rec.FieldName,
2564
								align: 'right',
2565
								width: 300,
2566
								filter: {
2567
									type: 'string',
2568
									itemDefaults: {
2569
										emptyText: 'Search for...'
2570
									}
2571
								}
2572
							});
2573
							break
2574
						case "amount":
2575
							cols_.push({
2576
								xtype: 'minovacurrancycolumn',
2577
								text: rec.HeaderTitle,
2578
								dataIndex: rec.FieldName,
2579
								align: 'right',
2580
								width: 300,
2581
								filter: {
2582
									type: 'number',
2583
									itemDefaults: {
2584
										emptyText: 'Search for...'
2585
									}
2586
								}
2587
							});
2588
							break
2589
						case "datetime":
2590
							cols_.push({
2591
								xtype: 'minovadatetimecolumn',
2592
								text: rec.HeaderTitle,
2593
								dataIndex: rec.FieldName,
2594
								width: 140,
2595
								filter: {
2596
									type: 'string',
2597
									itemDefaults: {
2598
										emptyText: 'Search for...'
2599
									}
2600
								}
2601
							});
2602
							break
2603
						default:
2604
							if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
2605
								cols_.push({
2606
									text: rec.HeaderTitle,
2607
									dataIndex: rec.FieldName,
2608
									width: 100,
2609
									filter: {
2610
										type: 'string',
2611
										itemDefaults: {
2612
											emptyText: 'Search for...'
2613
										}
2614
									}
2615
								});
2616
							} else if (rec.TableRef != "") {
2617
								if (rec.TableRef != null) {
2618
									var valueField = null;
2619
									var displayValue = null;
2620
									Ext.Ajax.request({
2621
										async: false,
2622
										method: 'POST',
2623
										url: '/UserControl/GetStore',
2624
										params: {
2625
											tableName: 'SDATATABLEFIELD',
2626
											param: 'TableName[equal]' + rec.TableRef
2627
										},
2628
										success: function (response) {
2629
											var results = Ext.decode(response.responseText);
2630
											data_ = results.data;
2631
											//if (data_ != undefined) {
2632
											if (data_.length > 0) {
2633
												valueField_ = $.grep(data_, function (r) {
2634
														return r.ValueField == '1'
2635
													});
2636
												valueField = valueField_[0].FieldName
2637
													displayValue_ = $.grep(data_, function (r) {
2638
														return r.DisplayValue == '1'
2639
													});
2640
												displayValue = displayValue_[0].FieldName
2641
											} else {
2642
												MinovaMessage('Not Null', 'BSNULLCOMBO', rec.TableRef, 'E');
2643
											}
2644
										}
2645
									});
2646
									var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
2647
									var count_ = 0;
2648
									if (store_) {
2649
										count_ = store_.count();
2650
									}
2651
									if (count_ == 0) {
2652
										Ext.create('Ext.data.Store', {
2653
											storeId: 'store_' + rec.FieldName,
2654
											autoLoad: false,
2655
											proxy: {
2656
												method: 'POST',
2657
												type: 'ajax',
2658
												url: '/UserControl/GetStore',
2659
												extraParams: {
2660
													tableName: rec.TableRef,
2661
													param: rec.ParamCombo
2662
												},
2663
												reader: {
2664
													type: 'json',
2665
													root: 'data',
2666
													totalProperty: 'data[0].TotalCount'
2667
												}
2668
											}
2669
										})
2670
									}
2671
									cols_.push({
2672
										xtype: 'minovacombocolumn',
2673
										text: rec.HeaderTitle,
2674
										dataIndex: rec.FieldName,
2675
										valueField: valueField,
2676
										displayField: displayValue,
2677
										store: 'store_' + rec.FieldName,
2678
										filter: {
2679
											type: 'list',
2680
											itemDefaults: {
2681
												emptyText: 'Search for...'
2682
											}
2683
										}
2684
									});
2685
								}
2686

    
2687
							} else if (rec.FixedValue != "") {
2688
								cols_.push({
2689
									xtype: 'minovacombocolumnfixvalue',
2690
									text: rec.HeaderTitle,
2691
									dataIndex: rec.FieldName,
2692
									fixedValue: rec.FixedValue,
2693
									filter: {
2694
										type: 'list',
2695
										itemDefaults: {
2696
											emptyText: 'Search for...'
2697
										}
2698
									}
2699
								});
2700
							} else {
2701
								cols_.push({
2702
									text: rec.HeaderTitle,
2703
									dataIndex: rec.FieldName,
2704
									filter: {
2705
										itemDefaults: {
2706
											emptyText: 'Search for...'
2707
										}
2708
									}
2709
								});
2710
							}
2711
							break
2712
						}
2713
					} else {
2714
						cols_.push({
2715
							text: rec.HeaderTitle,
2716
							dataIndex: rec.FieldName,
2717
							hidden: true,
2718
							filter: {
2719
								itemDefaults: {
2720
									emptyText: 'Search for...'
2721
								}
2722
							}
2723
						});
2724
					}
2725

    
2726
				}
2727
			});
2728
		};
2729
		var param_ = me.param;
2730
		if (param_ == undefined) {
2731
			param_ = ''
2732
		}
2733
		var jsStoreGrid = new Ext.data.Store({
2734
				storeId: me.storename,
2735
				autoLoad: autoLoad,
2736
				pageSize: me.pagesize,
2737
				proxy: {
2738
					method: 'POST',
2739
					type: 'ajax',
2740
					url: '/UserControl/GetStorePagingAuth',
2741
					extraParams: {
2742
						tableName: me.tableName,
2743
						param: param_,
2744
						menuId: MinovaUtil.GetMenuID()
2745
					},
2746
					reader: {
2747
						type: 'json',
2748
						root: 'data',
2749
						totalProperty: 'totalRecords'
2750
					}
2751
				},
2752
			});
2753
		Ext.applyIf(me, {
2754
			autoScroll: true,
2755
			enableLocking: locking,
2756
			lockedGridConfig: {
2757
				header: false,
2758
				collapsible: true,
2759
				width: widthLock,
2760
				forceFit: locking,
2761
				listeners: {
2762
					render: function (grid) {
2763
						var pagingToolbar = grid.child('pagingtoolbar');
2764
						if (pagingToolbar) {
2765
							grid.remove(pagingToolbar, true);
2766
						}
2767
					}
2768
				}
2769
			},
2770
			listeners: {
2771
				viewready: function () {
2772
					if (autoLoad == true) {
2773
						this.getStore().loadPage(1);
2774
					}
2775
				},
2776
				beforeedit: function () {
2777
					return false;
2778
				},
2779
			},
2780
			lockedViewConfig: {
2781
				scroll: 'horizontal'
2782
			},
2783
			viewConfig: {
2784
				emptyText: 'No Data Display',
2785
				deferEmptyText: false,
2786
				//Add Nana For Autosize Column Mode
2787
				listeners: {
2788
					refresh: function (dataview) {
2789
						Ext.each(dataview.panel.columns, function (column) {
2790
							//if (column.autoSizeColumn == false)
2791
							//	column.autoSizeColumn = true;
2792
							column.autoSize();
2793
							//dataview.store.reload();
2794
						})
2795
					}
2796
				},
2797
				render: function (comp) {
2798
					comp.getStore().reload();
2799
					console.log(comp);
2800
				}
2801
			},
2802
			//for chekbox
2803
			selModel: {
2804
				//type: 'cellmodel'
2805
			},
2806
			selType: checkSelection,
2807
			columns: cols_,
2808

    
2809
			store: jsStoreGrid,
2810

    
2811
			plugins: [{
2812
					ptype: 'gridfilters'
2813
				}
2814
			],
2815

    
2816
		});
2817
		me.callParent(arguments);
2818
	}
2819

    
2820
});
2821
Ext.define('MinovaUtil.MinovaES.MinovaGrid', {
2822
	extend: 'Ext.grid.Panel',
2823
	requires: ['Ext.grid.RowNumberer'],
2824
	alias: 'widget.minovagrid',
2825
	//alternateClassName : 'Ext.grid.MinovaGrid',
2826
	tableName: undefined,
2827
	isLookup: undefined,
2828
	param: undefined,
2829
	pagesize: undefined,
2830
	storename: undefined,
2831
	layoutType: undefined,
2832
	enableLocking: true,
2833

    
2834
	tbar: [{
2835
			xtype: 'button',
2836
			text: 'Action',
2837
			name: 'actionBtn',
2838
			//scale: 'medium',
2839
			menu: [{
2840
					text: 'Add',
2841
					name: 'Add_',
2842
					action: 'CRUDaddNewRecord',
2843
					style: 'font-family: FontAwesome',
2844
					iconCls: 'fa-plus-circle',
2845
					handler: function () {
2846
						var layout = null;
2847
						var tolbar = this.up();
2848
						var name = '';
2849
						var tableName = tolbar.up().up().up().tableName;
2850
						var mpnl = Ext.ComponentQuery.query('[name=DetailMD]')[0];
2851
						var titleMain = mpnl.getTitle();
2852
						var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
2853
						if (pnl) {
2854
							layout = pnl.getLayoutType();
2855
							pnl.setLastpage('MinovaGridFormGrid' + tableName);
2856
							pnl.setLastTitle(titleMain);
2857
							mpnl.setTitle('Add ' + titleMain);
2858
						} else {
2859
							pnl = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
2860
							layout = pnl.getLayoutType();
2861
							pnl.setLastpage('MinovaGridFormGrid' + tableName);
2862
							pnl.setLastTitle(titleMain);
2863
							mpnl.setTitle('Add ' + titleMain);
2864
						}
2865
						if (layout == 'L003') {
2866
							var _grid = "MinovaGridFormGrid" + tableName;
2867
							var _formDisplay = "MinovaGridFormDisplay" + tableName;
2868
							var _formEdit = "MinovaGridFormEdit" + tableName;
2869
							var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
2870
							var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
2871
							var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
2872
							g.setHidden(true);
2873
							formDisplay.setHidden(true);
2874
							formEdit.reset();
2875
							formEdit.setActionSubmit(0)
2876
							formEdit.setSubmitProc(true)
2877
							formEdit.setHidden(false);
2878
							var heigh = pnl.getLastheightform();
2879
							var pDetail = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
2880
								if (pDetail) {
2881
									// pDetail.setHeight(heigh + 100);
2882
								} else {
2883
									pDetail = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0];
2884
									var mainPnl_ = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]
2885
										var mainPnl = mainPnl_.getHeight();
2886
									//pDetail.setHeight(mainPnl + 100);
2887

    
2888
								}
2889

    
2890
								var emp = formEdit.getForm().findField("EmployeeID");
2891
							if (emp) {
2892
								emp.setValue(getParam("EmployeeID"))
2893
								emp.setHidden(true);
2894
							}
2895

    
2896
						} else {
2897
							var _grid = "MinovaGridFormGrid" + tableName;
2898
							var _formDisplay = "MinovaGridFormDisplay" + tableName;
2899
							var _formEdit = "MinovaGridFormEdit" + tableName;
2900
							var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
2901
							var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
2902
							var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
2903
							formEdit.setActionSubmit(0)
2904
							formDisplay.setHidden(true);
2905
							formDisplay.setTitle("Add");
2906

    
2907
							formEdit.setTitle("Add - " + titleMain);
2908
							formEdit.reset();
2909
							formEdit.setSubmitProc(true)
2910
							formEdit.setHidden(false);
2911
							var emp = formEdit.getForm().findField("EmployeeID");
2912
							if (emp) {
2913
								emp.setValue(Ext.ComponentQuery.query('[name=EmployeeID]')[0].getValue())
2914
								emp.setHidden(true);
2915
							}
2916

    
2917
						}
2918
					}
2919
				}, {
2920
					text: 'Copy',
2921
					name: 'Copy_',
2922
					iconCls: 'fa-copy',
2923
					style: 'font-family: FontAwesome',
2924
					handler: function () {
2925
						var layout = null;
2926
						var tolbar = this.up();
2927
						var name = '';
2928
						var tableName = tolbar.up().up().up().tableName;
2929
						var mpnl = Ext.ComponentQuery.query('[name=DetailMD]')[0];
2930
						var titleMain = mpnl.getTitle();
2931
						var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
2932

    
2933
						if (pnl) {
2934
							layout = pnl.getLayoutType();
2935
							pnl.setLastpage('MinovaGridFormGrid' + tableName);
2936
							pnl.setLastTitle(titleMain);
2937
							mpnl.setTitle('Copy ' + titleMain);
2938
						} else {
2939
							pnl = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
2940
							layout = pnl.getLayoutType();
2941
							pnl.setLastpage('MinovaGridFormGrid' + tableName);
2942
							pnl.setLastTitle(titleMain);
2943
							mpnl.setTitle('Copy ' + titleMain);
2944
						}
2945
						if (layout == 'L003') {
2946
							var _grid = "MinovaGridFormGrid" + tableName;
2947
							var _formDisplay = "MinovaGridFormDisplay" + tableName;
2948
							var _formEdit = "MinovaGridFormEdit" + tableName;
2949
							var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
2950
							var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
2951
							var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
2952
							g.setHidden(true);
2953
							formDisplay.setHidden(true);
2954
							formEdit.reset();
2955
							formEdit.setActionSubmit(0)
2956
							formEdit.setSubmitProc(true)
2957
							formEdit.setHidden(false);
2958
							var heigh = pnl.getLastheightform();
2959
							var pDetail = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
2960
								if (pDetail) {
2961
									//pDetail.setHeight(heigh + 100);
2962
								} else {
2963
									pDetail = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0];
2964
									var mainPnl_ = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]
2965
										var mainPnl = mainPnl_.getHeight();
2966
									//pDetail.setHeight(mainPnl + 100);
2967

    
2968
								}
2969
								Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]
2970

    
2971
								var emp = formEdit.getForm().findField("EmployeeID");
2972
							if (emp) {
2973
								emp.setValue(getParam("EmployeeID"))
2974
								emp.setHidden(true);
2975
							}
2976
							var selection = tolbar.up().up().up().getView().getSelectionModel().getSelection()[0];
2977
							if (selection) {
2978
								formDisplay.getForm().setValues(selection.data);
2979
								formEdit.getForm().setValues(selection.data);
2980
							}
2981

    
2982
						} else {
2983
							var _grid = "MinovaGridFormGrid" + tableName;
2984
							var _formDisplay = "MinovaGridFormDisplay" + tableName;
2985
							var _formEdit = "MinovaGridFormEdit" + tableName;
2986
							var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
2987
							var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
2988
							var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
2989
							formEdit.setActionSubmit(0)
2990
							formDisplay.setHidden(true);
2991
							formDisplay.setTitle("Add");
2992

    
2993
							formEdit.setTitle("Copy - " + titleMain);
2994
							formEdit.reset();
2995
							formEdit.setSubmitProc(true)
2996
							formEdit.setHidden(false);
2997
							var emp = formEdit.getForm().findField("EmployeeID");
2998
							if (emp) {
2999
								emp.setValue(Ext.ComponentQuery.query('[name=EmployeeID]')[0].getValue())
3000
								emp.setHidden(true);
3001
							}
3002
							var selection = tolbar.up().up().up().getView().getSelectionModel().getSelection()[0];
3003
							if (selection) {
3004
								formDisplay.getForm().setValues(selection.data);
3005
								formEdit.getForm().setValues(selection.data);
3006
								formEdit.setSubmitProc(true);
3007
								formEdit.setActionSubmit(0);
3008
							}
3009

    
3010
						}
3011
					}
3012
				}, {
3013
					text: 'Edit',
3014
					name: 'Edit_',
3015
					iconCls: 'fa-edit',
3016
					style: 'font-family: FontAwesome',
3017
					handler: function () {
3018
						var layout = null;
3019
						var tolbar = this.up();
3020
						var name = '';
3021
						var tableName = tolbar.up().up().up().tableName;
3022

    
3023
						var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
3024
						if (pnl) {
3025
							layout = pnl.getLayoutType();
3026
							pnl.setLastpage('MinovaGridFormGrid' + tableName);
3027

    
3028
						} else {
3029
							pnl = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
3030
							layout = pnl.getLayoutType();
3031
							pnl.setLastpage('MinovaGridFormGrid' + tableName);
3032
						}
3033

    
3034
						if (layout == 'L003') {
3035
							var _grid = "MinovaGridFormGrid" + tableName;
3036
							var _formDisplay = "MinovaGridFormDisplay" + tableName;
3037
							var _formEdit = "MinovaGridFormEdit" + tableName;
3038
							var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
3039
							var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
3040
							var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
3041

    
3042
							var selection = tolbar.up().up().up().getView().getSelectionModel().getSelection()[0];
3043
							if (selection) {
3044
								formDisplay.getForm().setValues(selection.data);
3045
								formEdit.getForm().setValues(selection.data);
3046
								formDisplay.setHidden(true);
3047
								formEdit.setSubmitProc(true);
3048
								formEdit.setActionSubmit(1);
3049
								formEdit.setHidden(false);
3050
								formEdit.setHidden(false);
3051
								g.setHidden(true);
3052
								var heigh = pnl.getLastheightform();
3053
								var pDetail = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
3054
									if (pDetail) {
3055
										pDetail.setHeight(heigh + 100);
3056
									} else {
3057
										pDetail = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0];
3058
										var mainPnl_ = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]
3059
											var mainPnl = mainPnl_.getHeight();
3060
										//pDetail.setHeight(mainPnl + 100);
3061

    
3062
									}
3063

    
3064
									var p = Ext.ComponentQuery.query('[name=DetailMD]')[0];
3065
								if (p) {
3066
									var lastTitile = p.getTitle();
3067
									pnl.setLastTitle(lastTitile);
3068
									p.setTitle('Edit - ' + lastTitile)
3069

    
3070
								}
3071
							}
3072
						} else {
3073
							var _grid = "MinovaGridFormGrid" + tableName;
3074
							var _formDisplay = "MinovaGridFormDisplay" + tableName;
3075
							var _formEdit = "MinovaGridFormEdit" + tableName;
3076
							var g = Ext.ComponentQuery.query('[name=' + _grid + ']')[0];
3077
							var formDisplay = Ext.ComponentQuery.query('[name=' + _formDisplay + ']')[0];
3078
							var formEdit = Ext.ComponentQuery.query('[name=' + _formEdit + ']')[0];
3079

    
3080
							var selection = tolbar.up().up().up().getView().getSelectionModel().getSelection()[0];
3081
							if (selection) {
3082
								formDisplay.getForm().setValues(selection.data);
3083
								formEdit.getForm().setValues(selection.data);
3084
								formDisplay.setTitle("Edit");
3085
								formEdit.setTitle("Edit");
3086
								if (layout == 'L003') {
3087
									g.setHidden(true);
3088
								}
3089

    
3090
								formDisplay.setHidden(true);
3091
								formEdit.setActionSubmit(1)
3092
								formEdit.setSubmitProc(true)
3093
								formEdit.setHidden(false);
3094

    
3095
								var mpnl = Ext.ComponentQuery.query('[name=DetailMD]')[0]
3096
									var lastTitile = mpnl.getTitle();
3097
								formEdit.setTitle('Edit - ' + lastTitile);
3098
								//mpnl.setTitle('Edit ' + lastTitile);
3099
							}
3100
						}
3101
					}
3102
				}, {
3103
					text: 'Delete',
3104
					name: 'Delete_',
3105
					iconCls: 'fa-trash-o',
3106
					style: 'font-family: FontAwesome',
3107
				}
3108
			]
3109
		}, {
3110
			xtype: 'tbfill'
3111
		}, {
3112
			text: 'Clear Filters',
3113
			tooltip: 'Clear all filters',
3114
			name: 'clearbtn',
3115
			handler: function () {
3116
				var tolbar = this.up()
3117
					var grid_ = tolbar.up()
3118
					grid_.filters.clearFilters()
3119
			},hidden:true
3120
		}, ],
3121

    
3122
	getTableName: function () {
3123
		return this.tableName;
3124
	},
3125

    
3126
	initComponent: function () {
3127
		var me = this;
3128
		var cols_ = [];
3129
		var fieldeditor = {};
3130
		var hasil = null;
3131
		var autoLoad = true;
3132
		var LangID = MinovaUtil.GetLangID();
3133
		//var _url = 'GetAllField';
3134

    
3135
		//if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
3136
		//	autoLoad = false;
3137
		//    _url = 'GetAllFieldGridLookUp';
3138

    
3139
		//};
3140
		//Ext.Ajax.request({
3141
		//	async : false,
3142
		//	method : 'POST',
3143
		//	url : '/Devt/' + _url + '?tableName=' + me.tableName,
3144
		//	success : function (response) {
3145
		//		var results = Ext.decode(response.responseText);
3146
		//		hasil = results.data;
3147
		//	}
3148
		//});
3149
		//hamid03102016
3150
		//if (me.isLookup == 1 || isLookup == true || isLookup == 'Y') {
3151
		parameter = null;
3152
		if (me.isLookup == true || isLookup == 1 || isLookup == 'Y') {
3153
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupGrid='1'"
3154
		} else {
3155
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
3156
		}
3157
		Ext.Ajax.request({
3158
			async: false,
3159
			method: 'POST',
3160
			url: '/UserControl/GetStore',
3161
			params: {
3162
				tableName: 'PDSBS0007',
3163
				param: parameter
3164
			},
3165
			success: function (response) {
3166
				var results = Ext.decode(response.responseText);
3167
				hasil = results.data;
3168
			}
3169
		});
3170
		//end
3171
		if (hasil.length > 0) {
3172
			Ext.each(hasil, function (rec) {
3173
				var null_ = null;
3174
				if (rec.IsPrimaryKey == true) {
3175
					null_ = false;
3176
				}
3177
				if (rec.IsRequired == true) {
3178
					null_ = false;
3179
				} else {
3180
					null_ = true;
3181
				}
3182
				if (rec.GridView == 1) {
3183
					switch (rec.FormatRef) {
3184
					case "date":
3185
						cols_.push({
3186
							xtype: 'minovadatecolumn',
3187
							text: rec.HeaderTitle,
3188
							dataIndex: rec.FieldName,
3189
							width: 100,
3190
							filter: {
3191
								type: 'date',
3192
								itemDefaults: {
3193
									emptyText: 'Search for...'
3194
								}
3195
							}
3196
						});
3197
						break
3198
					case "amountencrypt":
3199
						cols_.push({
3200
							xtype: 'minovaamountcolumn',
3201
							text: rec.HeaderTitle,
3202
							dataIndex: rec.FieldName,
3203
							align: 'right',
3204
							width: 100,
3205
							filter: {
3206
								type: 'string',
3207
								itemDefaults: {
3208
									emptyText: 'Search for...'
3209
								}
3210
							}
3211
						});
3212
						break
3213
					case "amount":
3214
						cols_.push({
3215
							xtype: 'minovacurrancycolumn',
3216
							text: rec.HeaderTitle,
3217
							dataIndex: rec.FieldName,
3218
							align: 'right',
3219
							width: 100,
3220
							filter: {
3221
								type: 'number',
3222
								itemDefaults: {
3223
									emptyText: 'Search for...'
3224
								}
3225
							}
3226
						});
3227
						break
3228
					case "datetime":
3229
						cols_.push({
3230
							xtype: 'minovadatetimecolumn',
3231
							text: rec.HeaderTitle,
3232
							dataIndex: rec.FieldName,
3233
							width: 140,
3234
							filter: {
3235
								type: 'string',
3236
								itemDefaults: {
3237
									emptyText: 'Search for...'
3238
								}
3239
							}
3240
						});
3241
						break
3242
					default:
3243
						if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
3244
							cols_.push({
3245
								text: rec.HeaderTitle,
3246
								dataIndex: rec.FieldName,
3247
								width: 100,
3248
								filter: {
3249
									type: 'string',
3250
									itemDefaults: {
3251
										emptyText: 'Search for...'
3252
									}
3253
								}
3254
							});
3255
						} else if (rec.SearchType == '2') {
3256
							cols_.push({
3257
								xtype: 'minovalookupcolumn',
3258
								text: rec.HeaderTitle,
3259
								tableName: rec.TableRef,
3260
								dataIndex: rec.FieldName,
3261
								filter: {
3262
									itemDefaults: {
3263
										emptyText: 'Search for...'
3264
									}
3265
								}
3266
							});
3267
						} else if (rec.TableRef != "") {
3268
							if (rec.TableRef != null) {
3269
								var valueField = null;
3270
								Ext.Ajax.request({
3271
									async: false,
3272
									method: 'POST',
3273
									url: '/UserControl/GetStore',
3274
									params: {
3275
										tableName: 'SDATATABLEFIELD',
3276
										param: 'ValueField[equal]1,TableName[equal]' + rec.TableRef
3277
									},
3278
									success: function (response) {
3279
										var results = Ext.decode(response.responseText);
3280
										data_ = results.data[0];
3281
										if (data_ != undefined) {
3282
											valueField = data_.FieldName;
3283
										}
3284
									}
3285
								});
3286

    
3287
								displayValue = null;
3288
								Ext.Ajax.request({
3289
									async: false,
3290
									method: 'POST',
3291
									url: '/UserControl/GetStore',
3292
									params: {
3293
										tableName: 'SDATATABLEFIELD',
3294
										param: 'DisplayValue[equal]1,TableName[equal]' + rec.TableRef
3295
									},
3296
									success: function (response) {
3297
										var results = Ext.decode(response.responseText);
3298
										data_ = results.data[0];
3299
										if (data_ != undefined) {
3300
											displayValue = data_.FieldName;
3301
											//console.log(data_)
3302
										}
3303
									}
3304
								});
3305
								var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
3306
								var count_ = 0;
3307
								if (store_) {
3308
									count_ = store_.count();
3309
								}
3310
								if (count_ == 0) {
3311
									Ext.create('Ext.data.Store', {
3312
										storeId: 'store_' + rec.FieldName,
3313
										autoLoad: true,
3314
										proxy: {
3315
											method: 'POST',
3316
											type: 'ajax',
3317
											url: '/UserControl/GetStore',
3318
											extraParams: {
3319
												tableName: rec.TableRef,
3320
												param: rec.ParamCombo
3321
											},
3322
											reader: {
3323
												type: 'json',
3324
												root: 'data',
3325
												totalProperty: 'data[0].TotalCount'
3326
											}
3327
										}
3328
									})
3329
								}
3330
								cols_.push({
3331
									xtype: 'minovacombocolumn',
3332
									text: rec.HeaderTitle,
3333
									dataIndex: rec.FieldName,
3334
									valueField: valueField,
3335
									displayField: displayValue,
3336
									store: 'store_' + rec.FieldName,
3337
									filter: {
3338
										type: 'list',
3339
										itemDefaults: {
3340
											emptyText: 'Search for...'
3341
										}
3342
									}
3343
								});
3344
							}
3345

    
3346
						} else {
3347
							cols_.push({
3348
								text: rec.HeaderTitle,
3349
								dataIndex: rec.FieldName,
3350
								filter: {
3351
									itemDefaults: {
3352
										emptyText: 'Search for...'
3353
									}
3354
								}
3355
							});
3356
						}
3357
						break
3358
					}
3359
				} else {
3360
					cols_.push({
3361
						text: rec.HeaderTitle,
3362
						dataIndex: rec.FieldName,
3363
						hidden: true,
3364
						filter: {
3365
							itemDefaults: {
3366
								emptyText: 'Search for...'
3367
							}
3368
						}
3369
					});
3370
				}
3371
			});
3372
		};
3373
		var param_ = me.param;
3374
		if (param_ == undefined) {
3375
			param_ = ''
3376
		}
3377
		var jsStoreGrid = new Ext.data.Store({
3378
				storeId: me.storename,
3379
				autoLoad: autoLoad,
3380
				pageSize: me.pagesize,
3381
				proxy: {
3382
					method: 'POST',
3383
					type: 'ajax',
3384
					url: '/UserControl/GetStorePaging',
3385
					extraParams: {
3386
						tableName: me.tableName,
3387
						param: param_
3388
					},
3389
					reader: {
3390
						type: 'json',
3391
						root: 'data',
3392
						totalProperty: 'totalRecords'
3393
					}
3394
				}
3395
			});
3396
		Ext.applyIf(me, {
3397
			autoScroll: true,
3398
			enableLocking: true,
3399
			lockedGridConfig: {
3400
				header: false,
3401
				collapsible: true,
3402
				width: 250,
3403
				forceFit: true,
3404
				listeners: {
3405
					render: function (grid) {
3406
						var pagingToolbar = grid.child('pagingtoolbar');
3407
						if (pagingToolbar) {
3408
							grid.remove(pagingToolbar, true);
3409
						}
3410
					}
3411
				}
3412
			},
3413
			listeners: {
3414
				viewready: function () {
3415
					if (autoLoad == true) {
3416
						this.getStore().loadPage(1);
3417
					}
3418

    
3419
				},
3420
				beforeedit: function () {
3421
					return false;
3422
				}
3423
			},
3424
			lockedViewConfig: {
3425
				scroll: 'horizontal'
3426
			},
3427
			viewConfig: {
3428
				emptyText: 'No Data Display',
3429
				deferEmptyText: false,
3430
				//add Nana for Autosize Column Mode
3431
				listeners: {
3432
					refresh: function (dataview) {
3433
						Ext.each(dataview.panel.columns, function (column) {
3434
							if (column.autoSizeColumn == false)
3435
								column.autoSizeColumn = true;
3436
							column.autoSize();
3437
						})
3438
					}
3439
				}
3440
			},
3441
			columns: cols_,
3442

    
3443
			store: jsStoreGrid,
3444

    
3445
			plugins: [{
3446
					ptype: 'gridfilters'
3447
				}, {
3448
					ptype: 'rowediting',
3449
					clicksToEdit: 2,
3450
					listeners: {
3451
						edit: function (editor, context, eOpts) {}
3452
					}
3453
				}, ]
3454
		});
3455
		me.callParent(arguments);
3456
	}
3457

    
3458
});
3459
/*MinovaGrid Report Generator*/
3460
Ext.define('MinovaUtil.MinovaES.MinovaRptGeneratorGrid', {
3461
	extend: 'Ext.grid.Panel',
3462
	requires: ['Ext.grid.RowNumberer', 'Ext.grid.feature.Grouping'],
3463
	alias: 'widget.minovareportgeneratorgrid',
3464
	storeOutput: undefined,
3465
	storeName: undefined,
3466
	filter: undefined,
3467
	tableName: undefined,
3468
	pagesize: undefined,
3469
	autoLoad: undefined,
3470
	initComponent: function () {
3471
		var me = this;
3472
		var store = me.storeOutput;
3473
		var cols = [];
3474
		var groupField = '';
3475
		var autoLoad = true;
3476
		if (me.autoLoad == false) {
3477
			autoLoad = false;
3478
		}
3479
		if (store.length > 0) {
3480
			Ext.each(store, function (rec) {
3481
				var isHide = false;
3482
				if (rec.IsGrouping == "YES") {
3483
					groupField = rec.FieldName;
3484
					isHide = true;
3485
				}
3486
				var format = rec.FormatRef;
3487
				if (format != null && format != undefined)
3488
					format = format.toLowerCase();
3489
				switch (format) {
3490
				case "file":
3491
					cols.push({
3492
						xtype: 'minovapicturecolumn',
3493
						text: rec.HeaderTitle,
3494
						dataIndex: rec.FieldName,
3495
						hidden: isHide,
3496
						width: 100
3497
					});
3498
					break
3499
				case "date":
3500
					cols.push({
3501
						xtype: 'minovadatecolumn',
3502
						text: rec.HeaderTitle,
3503
						dataIndex: rec.FieldName,
3504
						hidden: isHide,
3505
						width: 100
3506
					});
3507
					break
3508
				case "amount":
3509
					cols.push({
3510
						xtype: 'minovacurrancycolumn',
3511
						text: rec.HeaderTitle,
3512
						align: 'right',
3513
						dataIndex: rec.FieldName,
3514
						width: 150,
3515
						hidden: isHide,
3516
						summaryType: rec.Aggregator,
3517
						summaryRenderer: function (value) {
3518
							return Ext.util.Format.number(value, '0,000.00');
3519
						}
3520
					});
3521
					break
3522
				case "amountencrypt":
3523
					cols.push({
3524
						xtype: 'minovaamountcolumn',
3525
						align: 'right',
3526
						text: rec.HeaderTitle,
3527
						dataIndex: rec.FieldName,
3528
						width: 150,
3529
						hidden: isHide,
3530
						summaryType: rec.Aggregator,
3531
						summaryRenderer: function (value) {
3532
							if (rec.Aggregator == "sum") {
3533
								var str = Ext.StoreManager.lookup("store" + me.tableName);
3534
								var records = str.data.items;
3535
								var total = 0,
3536
								len = records.length;
3537
								if (len > 0) {
3538
									for (var i = 0; i < len; ++i) {
3539
										var nilai = records[i].get(rec.FieldName);
3540
										Ext.Ajax.request({
3541
											async: false,
3542
											method: 'POST',
3543
											url: '/Devt/DecryptData',
3544
											params: {
3545
												dt: nilai
3546
											},
3547
											success: function (response) {
3548
												var results = Ext.decode(response.responseText);
3549
												nilai = results.data;
3550
												total += parseFloat(nilai);
3551
											}
3552
										});
3553
									}
3554
									Ext.util.Format.thousandSeparator = ".";
3555
									return Ext.util.Format.number(total, '0,000');
3556
								}
3557
								return 0;
3558
							} else if (rec.Aggregator == "average") {
3559
								var str = Ext.StoreManager.lookup("store" + me.tableName);
3560
								var records = str.data.items;
3561
								var len = records.length,
3562
								sum = 0;
3563
								if (len > 0) {
3564
									for (var i = 0; i < len; ++i) {
3565
										var nilai = records[i].get(rec.FieldName);
3566
										Ext.Ajax.request({
3567
											async: false,
3568
											method: 'POST',
3569
											url: '/Devt/DecryptData',
3570
											params: {
3571
												dt: nilai
3572
											},
3573
											success: function (response) {
3574
												var results = Ext.decode(response.responseText);
3575
												nilai = results.data;
3576
												sum += parseFloat(nilai);
3577
											}
3578
										});
3579
									}
3580
									var rs = sum / len;
3581
									Ext.util.Format.thousandSeparator = ".";
3582
									return Ext.util.Format.number(rs, '0,000');
3583
								}
3584
								return 0;
3585
							} else {
3586
								return value;
3587
							}
3588
						}
3589
					});
3590
					break
3591
				case "datetime":
3592
					cols.push({
3593
						xtype: 'minovadatetimecolumn',
3594
						text: rec.HeaderTitle,
3595
						dataIndex: rec.FieldName,
3596
						width: 150,
3597
						hidden: isHide
3598
					});
3599
					break
3600
				default:
3601
					if (rec.TableRef != "" && rec.TableRef != null) {
3602
						var valueField = null;
3603
						var displayValue = null;
3604
						Ext.Ajax.request({
3605
							async: false,
3606
							method: 'POST',
3607
							url: '/UserControl/GetStore',
3608
							params: {
3609
								tableName: 'SDATATABLEFIELD',
3610
								param: 'TableName[equal]' + rec.TableRef
3611
							},
3612
							success: function (response) {
3613
								var results = Ext.decode(response.responseText);
3614
								data_ = results.data;
3615
								if (data_.length > 0) {
3616
									valueField_ = $.grep(data_, function (r) {
3617
											return r.ValueField == '1'
3618
										});
3619
									valueField = valueField_[0].FieldName
3620
										displayValue_ = $.grep(data_, function (r) {
3621
											return r.DisplayValue == '1'
3622
										});
3623
									displayValue = displayValue_[0].FieldName
3624
								} else {
3625
									MinovaMessage('Not Null', 'BSNULLCOMBO', rec.TableRef, 'E');
3626
								}
3627
							}
3628
						});
3629
						var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
3630
						var count_ = 0;
3631
						if (store_) {
3632
							count_ = store_.count();
3633
						}
3634
						if (count_ == 0) {
3635
							Ext.create('Ext.data.Store', {
3636
								storeId: 'store_' + rec.FieldName,
3637
								autoLoad: false,
3638
								proxy: {
3639
									method: 'POST',
3640
									type: 'ajax',
3641
									url: '/UserControl/GetStore',
3642
									extraParams: {
3643
										tableName: rec.TableRef,
3644
										param: ""
3645
									},
3646
									reader: {
3647
										type: 'json',
3648
										root: 'data',
3649
										totalProperty: 'data[0].TotalCount'
3650
									}
3651
								}
3652
							})
3653
						}
3654
						Ext.StoreMgr.lookup('store_' + rec.FieldName).load();
3655
						var stror = Ext.StoreMgr.lookup('store_' + rec.FieldName);
3656
						cols.push({
3657
							xtype: 'minovacombocolumn',
3658
							text: rec.HeaderTitle,
3659
							dataIndex: rec.FieldName,
3660
							valueField: valueField,
3661
							displayField: displayValue,
3662
							store: 'store_' + rec.FieldName,
3663
							width: 200,
3664
							hidden: isHide,
3665
							renderer: function (val) {
3666
								var stor = stror;
3667
								if (stor.getCount() === 0) {}
3668
								var index = stor.find(valueField, val);
3669
								if (index != -1) {
3670
									var rec = stor.getAt(index);
3671
									return val + ' - ' + rec.get(displayValue);
3672
								} else {
3673
									return val;
3674
								}
3675
							}
3676
						});
3677
					} else if (rec.FixedValue != "" && rec.FixedValue != null) {
3678
						cols.push({
3679
							xtype: 'minovacombocolumnfixvalue',
3680
							text: rec.HeaderTitle,
3681
							dataIndex: rec.FieldName,
3682
							fixedValue: rec.FixedValue,
3683
							width: 100,
3684
							hidden: isHide
3685
						});
3686
					} else {
3687
						if (rec.DataType == "0") {
3688
							cols.push({
3689
								text: rec.HeaderTitle,
3690
								dataIndex: rec.FieldName,
3691
								width: 150,
3692
								hidden: isHide
3693
							});
3694
						} else {
3695
							cols.push({
3696
								text: rec.HeaderTitle,
3697
								dataIndex: rec.FieldName,
3698
								width: 150,
3699
								hidden: isHide,
3700
								summaryType: rec.Aggregator,
3701
							});
3702
						}
3703
					}
3704
					break
3705
				}
3706
			});
3707
			var featuretype = "summary";
3708
			if (groupField != "") {
3709
				featuretype = "groupingsummary";
3710
			}
3711
			var param = me.filter;
3712
			if (param == undefined) {
3713
				param = ''
3714
			}
3715
			var jsStoreGrid = new Ext.data.Store({
3716
					storeId: me.storeName,
3717
					autoLoad: autoLoad,
3718
					pageSize: me.pagesize,
3719
					proxy: {
3720
						method: 'POST',
3721
						type: 'ajax',
3722
						url: '/UserControl/GetStorePagingAuth',
3723
						extraParams: {
3724
							tableName: me.tableName,
3725
							param: param,
3726
							menuId: MinovaUtil.GetMenuID()
3727
						},
3728
						reader: {
3729
							type: 'json',
3730
							root: 'data',
3731
							totalProperty: 'totalRecords'
3732
						}
3733
					},
3734
					groupField: groupField
3735
				});
3736
			Ext.applyIf(me, {
3737
				autoScroll: true,
3738
				enableLocking: false,
3739
				lockedGridConfig: {
3740
					header: false,
3741
					collapsible: true,
3742
					width: 250,
3743
					forceFit: false,
3744
					listeners: {
3745
						render: function (grid) {
3746
							var pagingToolbar = grid.child('pagingtoolbar');
3747
							if (pagingToolbar) {
3748
								grid.remove(pagingToolbar, true);
3749
							}
3750
						}
3751
					}
3752
				},
3753
				listeners: {
3754
					viewready: function () {
3755
						if (autoLoad == true) {
3756
							this.getStore().loadPage(1);
3757
						}
3758
					},
3759
					beforeedit: function () {
3760
						return false;
3761
					}
3762
				},
3763
				lockedViewConfig: {
3764
					scroll: 'horizontal'
3765
				},
3766
				viewConfig: {
3767
					emptyText: 'No Data Display',
3768
					deferEmptyText: false
3769
				},
3770
				selModel: {},
3771
				columns: cols,
3772
				store: jsStoreGrid,
3773
				features: [{
3774
						ftype: 'groupingsummary'
3775
					}
3776
				],
3777
				plugins: [{
3778
						ptype: 'gridfilters'
3779
					}
3780
				]
3781
			});
3782
		}
3783
		me.callParent(arguments);
3784
	}
3785
});
3786
/*MinovaGrouping Grid*/
3787
Ext.define('MinovaUtil.MinovaES.MinovaGroupingGrid', {
3788
	extend: 'Ext.grid.Panel',
3789
	requires: ['Ext.grid.RowNumberer', 'Ext.grid.feature.Grouping'],
3790
	alias: 'widget.minovagroupinggrid',
3791
	tableName: undefined,
3792
	isLookup: undefined,
3793
	param: undefined,
3794
	pagesize: undefined,
3795
	storeName: undefined,
3796
	layoutType: undefined,
3797
	enableLocking: true,
3798
	autoLoad: undefined,
3799
	multiSelect: undefined,
3800
	getTableName: function () {
3801
		return this.tableName;
3802
	},
3803
	initComponent: function () {
3804
		var me = this;
3805
		var cols_ = [];
3806
		var fieldeditor = {};
3807
		var hasil = null;
3808
		var autoLoad = true;
3809
		var LangID = localStorage.LangId;
3810
		var fielGrid = 'rec.GridView == 1';
3811
		var locking = true;
3812
		var checkSelection = '';
3813
		var widthLock = 250;
3814
		var GroupField = '';
3815
		if (me.multiSelect) {
3816
			locking = false;
3817
			checkSelection = 'checkboxmodel';
3818
			widthLock = 40;
3819
		}
3820
		if (me.autoLoad == false) {
3821
			autoLoad = false;
3822
		}
3823
		parameter = null;
3824
		if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
3825
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupGrid='1'";
3826
			fielGrid = 'rec.LookupGrid == 1';
3827
			locking = false;
3828
		} else {
3829
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
3830
		};
3831

    
3832
		Ext.Ajax.request({
3833
			async: false,
3834
			method: 'POST',
3835
			url: '/UserControl/GetStore',
3836
			params: {
3837
				tableName: 'PDSBS0007',
3838
				param: parameter
3839
			},
3840
			success: function (response) {
3841
				var results = Ext.decode(response.responseText);
3842
				hasil = results.data;
3843
			}
3844
		});
3845
		if (hasil.length > 0) {
3846
			Ext.each(hasil, function (rec) {
3847
				var null_ = null;
3848
				if (rec.SearchFunction == "group") {
3849
					GroupField = rec.FieldName;
3850
				}
3851
				if (rec.IsPrimaryKey == true) {
3852
					null_ = false;
3853
				}
3854
				if (rec.IsRequired == true) {
3855
					null_ = false;
3856
				} else {
3857
					null_ = true;
3858
				}
3859
				if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
3860
					if (rec.LookupGrid == 1) {
3861
						switch (rec.FormatRef) {
3862
						case "date":
3863
							cols_.push({
3864
								xtype: 'minovadatecolumn',
3865
								text: rec.HeaderTitle,
3866
								dataIndex: rec.FieldName,
3867
								width: 100,
3868
								filter: {
3869
									type: 'date',
3870
									itemDefaults: {
3871
										emptyText: 'Search for...'
3872
									}
3873
								}
3874
							});
3875
							break
3876
						case "amount":
3877
							cols_.push({
3878
								xtype: 'minovacurrancycolumn',
3879
								text: rec.HeaderTitle,
3880
								align: 'right',
3881
								dataIndex: rec.FieldName,
3882
								width: 100,
3883
								filter: {
3884
									type: 'number',
3885
									itemDefaults: {
3886
										emptyText: 'Search for...'
3887
									}
3888
								}
3889
							});
3890
							break
3891
						case "amountencrypt":
3892
							cols_.push({
3893
								xtype: 'minovaamountcolumn',
3894
								align: 'right',
3895
								text: rec.HeaderTitle,
3896
								dataIndex: rec.FieldName,
3897
								width: 100,
3898
								filter: {
3899
									type: 'string',
3900
									itemDefaults: {
3901
										emptyText: 'Search for...'
3902
									}
3903
								}
3904
							});
3905
							break
3906
						case "datetime":
3907
							cols_.push({
3908
								xtype: 'minovadatetimecolumn',
3909
								text: rec.HeaderTitle,
3910
								dataIndex: rec.FieldName,
3911
								width: 140,
3912
								filter: {
3913
									type: 'string',
3914
									itemDefaults: {
3915
										emptyText: 'Search for...'
3916
									}
3917
								}
3918
							});
3919
							break
3920
						default:
3921
							if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
3922
								cols_.push({
3923
									text: rec.HeaderTitle,
3924
									dataIndex: rec.FieldName,
3925
									width: 100,
3926
									filter: {
3927
										type: 'string',
3928
										itemDefaults: {
3929
											emptyText: 'Search for...'
3930
										}
3931
									}
3932
								});
3933
							} else if (rec.TableRef != "") {
3934
								if (rec.TableRef != null) {
3935
									var valueField = null;
3936
									var displayValue = null;
3937
									Ext.Ajax.request({
3938
										async: false,
3939
										method: 'POST',
3940
										url: '/UserControl/GetStore',
3941
										params: {
3942
											tableName: 'SDATATABLEFIELD',
3943
											param: 'TableName[equal]' + rec.TableRef
3944
										},
3945
										success: function (response) {
3946
											var results = Ext.decode(response.responseText);
3947
											data_ = results.data;
3948
											if (data_ != undefined) {
3949
												valueField_ = $.grep(data_, function (r) {
3950
														return r.ValueField == '1'
3951
													});
3952
												valueField = valueField_[0].FieldName
3953
													displayValue_ = $.grep(data_, function (r) {
3954
														return r.DisplayValue == '1'
3955
													});
3956
												displayValue = displayValue_[0].FieldName
3957
											}
3958
										}
3959
									});
3960
									var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
3961
									var count_ = 0;
3962
									if (store_) {
3963
										count_ = store_.count();
3964
									}
3965
									if (count_ == 0) {
3966
										Ext.create('Ext.data.Store', {
3967
											storeId: 'store_' + rec.FieldName,
3968
											//autoLoad: true,
3969
											proxy: {
3970
												method: 'POST',
3971
												type: 'ajax',
3972
												url: '/UserControl/GetStore',
3973
												extraParams: {
3974
													tableName: rec.TableRef,
3975
													param: rec.ParamCombo
3976
												},
3977
												reader: {
3978
													type: 'json',
3979
													root: 'data',
3980
													totalProperty: 'data[0].TotalCount'
3981
												}
3982
											}
3983
										})
3984
									}
3985
									cols_.push({
3986
										xtype: 'minovacombocolumn',
3987
										text: rec.HeaderTitle,
3988
										dataIndex: rec.FieldName,
3989
										valueField: valueField,
3990
										displayField: displayValue,
3991
										store: 'store_' + rec.FieldName,
3992
										filter: {
3993
											type: 'list',
3994
											itemDefaults: {
3995
												emptyText: 'Search for...'
3996
											}
3997
										}
3998
									});
3999
								}
4000
							} else {
4001
								cols_.push({
4002
									text: rec.HeaderTitle,
4003
									dataIndex: rec.FieldName,
4004
									filter: {
4005
										itemDefaults: {
4006
											emptyText: 'Search for...'
4007
										}
4008
									}
4009
								});
4010
							}
4011
							break
4012
						}
4013
					} else {
4014
						cols_.push({
4015
							text: rec.HeaderTitle,
4016
							dataIndex: rec.FieldName,
4017
							hidden: true,
4018
							filter: {
4019
								itemDefaults: {
4020
									emptyText: 'Search for...'
4021
								}
4022
							}
4023
						});
4024
					}
4025

    
4026
				} else {
4027
					if (rec.GridView == 1) {
4028
						switch (rec.FormatRef) {
4029
						case "date":
4030
							cols_.push({
4031
								xtype: 'minovadatecolumn',
4032
								text: rec.HeaderTitle,
4033
								dataIndex: rec.FieldName,
4034
								width: 100,
4035
								flex: 1,
4036
								filter: {
4037
									type: 'date',
4038
									itemDefaults: {
4039
										emptyText: 'Search for...'
4040
									}
4041
								}
4042
							});
4043
							break
4044
						case "amountencrypt":
4045
							cols_.push({
4046
								xtype: 'minovaamountcolumn',
4047
								align: 'right',
4048
								text: rec.HeaderTitle,
4049
								dataIndex: rec.FieldName,
4050
								width: 100,
4051
								flex: 1,
4052
								filter: {
4053
									type: 'string',
4054
									itemDefaults: {
4055
										emptyText: 'Search for...'
4056
									}
4057
								}
4058
							});
4059
							break
4060
						case "amount":
4061
							cols_.push({
4062
								xtype: 'minovacurrancycolumn',
4063
								text: rec.HeaderTitle,
4064
								align: 'right',
4065
								dataIndex: rec.FieldName,
4066
								width: 100,
4067
								flex: 1,
4068
								filter: {
4069
									type: 'number',
4070
									itemDefaults: {
4071
										emptyText: 'Search for...'
4072
									}
4073
								}
4074
							});
4075
							break
4076
						case "datetime":
4077
							cols_.push({
4078
								xtype: 'minovadatetimecolumn',
4079
								text: rec.HeaderTitle,
4080
								dataIndex: rec.FieldName,
4081
								width: 140,
4082
								flex: 1,
4083
								filter: {
4084
									type: 'string',
4085
									itemDefaults: {
4086
										emptyText: 'Search for...'
4087
									}
4088
								}
4089
							});
4090
							break
4091
						default:
4092
							if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
4093
								cols_.push({
4094
									text: rec.HeaderTitle,
4095
									dataIndex: rec.FieldName,
4096
									width: 100,
4097
									flex: 1,
4098
									filter: {
4099
										type: 'string',
4100
										itemDefaults: {
4101
											emptyText: 'Search for...'
4102
										}
4103
									}
4104
								});
4105
							} else if (rec.TableRef != "") {
4106
								if (rec.TableRef != null) {
4107
									var valueField = null;
4108
									var displayValue = null;
4109
									Ext.Ajax.request({
4110
										async: false,
4111
										method: 'POST',
4112
										url: '/UserControl/GetStore',
4113
										params: {
4114
											tableName: 'SDATATABLEFIELD',
4115
											param: 'TableName[equal]' + rec.TableRef
4116
										},
4117
										success: function (response) {
4118
											var results = Ext.decode(response.responseText);
4119
											data_ = results.data;
4120
											if (data_ != undefined) {
4121
												valueField_ = $.grep(data_, function (r) {
4122
														return r.ValueField == '1'
4123
													});
4124
												valueField = valueField_[0].FieldName
4125
													displayValue_ = $.grep(data_, function (r) {
4126
														return r.DisplayValue == '1'
4127
													});
4128
												displayValue = displayValue_[0].FieldName
4129
											}
4130
										}
4131
									});
4132
									var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
4133
									var count_ = 0;
4134
									if (store_) {
4135
										count_ = store_.count();
4136
									}
4137
									if (count_ == 0) {
4138
										Ext.create('Ext.data.Store', {
4139
											storeId: 'store_' + rec.FieldName,
4140
											autoLoad: false,
4141
											proxy: {
4142
												method: 'POST',
4143
												type: 'ajax',
4144
												url: '/UserControl/GetStore',
4145
												extraParams: {
4146
													tableName: rec.TableRef,
4147
													param: rec.ParamCombo
4148
												},
4149
												reader: {
4150
													type: 'json',
4151
													root: 'data',
4152
													totalProperty: 'data[0].TotalCount'
4153
												}
4154
											}
4155
										})
4156
									}
4157
									cols_.push({
4158
										xtype: 'minovacombocolumn',
4159
										text: rec.HeaderTitle,
4160
										dataIndex: rec.FieldName,
4161
										valueField: valueField,
4162
										displayField: displayValue,
4163
										store: 'store_' + rec.FieldName,
4164
										flex: 1,
4165
										filter: {
4166
											type: 'list',
4167
											itemDefaults: {
4168
												emptyText: 'Search for...'
4169
											}
4170
										}
4171
									});
4172
								}
4173

    
4174
							} else {
4175
								cols_.push({
4176
									text: rec.HeaderTitle,
4177
									dataIndex: rec.FieldName,
4178
									flex: 1,
4179
									filter: {
4180
										itemDefaults: {
4181
											emptyText: 'Search for...'
4182
										}
4183
									}
4184
								});
4185
							}
4186
							break
4187
						}
4188
					} else {
4189
						cols_.push({
4190
							text: rec.HeaderTitle,
4191
							dataIndex: rec.FieldName,
4192
							hidden: true,
4193
							filter: {
4194
								itemDefaults: {
4195
									emptyText: 'Search for...'
4196
								}
4197
							}
4198
						});
4199
					}
4200

    
4201
				}
4202
			});
4203
		}
4204
		var param_ = me.param;
4205
		if (param_ == undefined) {
4206
			param_ = ''
4207
		}
4208
		var jsStoreGrid = new Ext.data.Store({
4209
				storeId: me.storeName,
4210
				autoLoad: autoLoad,
4211
				pageSize: me.pagesize,
4212
				proxy: {
4213
					method: 'POST',
4214
					type: 'ajax',
4215
					url: '/UserControl/GetStorePagingAuth',
4216
					extraParams: {
4217
						tableName: me.tableName,
4218
						param: param_,
4219
						menuId: MinovaUtil.GetMenuID()
4220
					},
4221
					reader: {
4222
						type: 'json',
4223
						root: 'data',
4224
						totalProperty: 'totalRecords'
4225
					}
4226
				},
4227
				groupField: GroupField,
4228
				//sorters: ['tipe','cuisine','name'],
4229
			});
4230
		Ext.applyIf(me, {
4231
			autoScroll: true,
4232
			enableLocking: locking,
4233
			lockedGridConfig: {
4234
				header: false,
4235
				collapsible: true,
4236
				width: widthLock,
4237
				forceFit: locking,
4238
				listeners: {
4239
					render: function (grid) {
4240
						var pagingToolbar = grid.child('pagingtoolbar');
4241
						if (pagingToolbar) {
4242
							grid.remove(pagingToolbar, true);
4243
						}
4244
					}
4245
				}
4246
			},
4247
			listeners: {
4248
				viewready: function () {
4249
					if (autoLoad == true) {
4250
						this.getStore().loadPage(1);
4251
					}
4252

    
4253
				},
4254
				beforeedit: function () {
4255
					return false;
4256
				}
4257
			},
4258
			lockedViewConfig: {
4259
				scroll: 'horizontal'
4260
			},
4261
			viewConfig: {
4262
				emptyText: 'No Data Display',
4263
				deferEmptyText: false,
4264
				listeners: {
4265
					refresh: function (dataview) {
4266
						Ext.each(dataview.panel.columns, function (column) {
4267
							if (column.autoSizeColumn == false)
4268
								column.autoSizeColumn = true;
4269
							column.autoSize();
4270
						})
4271
					}
4272
				}
4273
			},
4274
			selModel: {},
4275
			selType: checkSelection,
4276
			columns: cols_,
4277
			store: jsStoreGrid,
4278
			features: [{
4279
					ftype: 'grouping'
4280
				}
4281
			],
4282
			plugins: [{
4283
					ptype: 'gridfilters'
4284
				}
4285
			]
4286
		});
4287
		me.callParent(arguments);
4288
	}
4289
});
4290
/*Form ESS Generator*/
4291
Ext.define('MinovaUtil.MinovaES.MinovaWorkflowForm', {
4292
	extend: 'Ext.form.Panel',
4293
	alias: ['widget.MinovaWorkflowForm', 'widget.minovaworkflowform', 'widget.workflowform'],
4294
	formname: this.name,
4295
	bizprocid: undefined,
4296
	taskid: undefined,
4297
	tableName: undefined,
4298
	titleform: undefined,
4299
	resizable: true,
4300
	border: false,
4301
	autoScroll: true,
4302
	minHeight: 20,
4303
	layout: 'column',
4304
	listeners: {
4305
		render: function () {
4306
			if (this.titleform != undefined) {
4307
				this.setTitle(this.titleform);
4308
			}
4309
		},
4310
	},
4311
	defaults: {
4312
		layout: 'form',
4313
		xtype: 'container',
4314
		defaultType: 'textfield',
4315
		style: 'width: 50%',
4316
	},
4317
	initComponent: function () {
4318
		var col1 = [];
4319
		var col2 = [];
4320
		var me = this;
4321
		var LangID = localStorage.LangId;
4322
		var parameter = "LangID='" + LangID + "',BizProcessID='" + me.bizprocid + "',TaskID='" + me.taskid + "',TableName='" + me.tableName + "'";
4323
		var formname_ = me.name;
4324
		var nameTable_ = me.tableName;
4325
		Ext.Ajax.request({
4326
			async: false,
4327
			method: 'POST',
4328
			url: '/UserControl/GetStore',
4329
			params: {
4330
				tableName: 'PDSWFSTRUCTUREFIELD',
4331
				param: parameter
4332
			},
4333
			success: function (response) {
4334
				var results = Ext.decode(response.responseText);
4335
				hasil = results.data;
4336
			}
4337
		});
4338
		if (hasil.length > 0) {
4339
			Ext.each(hasil, function (rec) {
4340
				var formfield = undefined;
4341
				var readonly = false;
4342
				var ishidden = false;
4343
				var allowblank = true;
4344
				var startDt = null;
4345
				var endDt = null;
4346
				if (rec.FieldName == 'StartDate' || rec.FieldName == 'EndDate') {
4347
					startDt = 'StartDate';
4348
					endDt = 'EndDate';
4349
				}
4350
				if (rec.IsReadOnly == '1') {
4351
					readonly = true;
4352
				}
4353
				if (rec.IsRequired == '1') {
4354
					allowblank = false;
4355
				}
4356
				if (rec.IsVisible == '0') {
4357
					ishidden = true;
4358
				}
4359
				if (rec.SearchType == "") //textfield
4360
				{
4361
					switch (rec.FormatRef) {
4362
					case "date":
4363
						if (rec.FieldName == 'StartDate' || rec.FieldName == 'EndDate') {
4364
							formfield = new Ext.form.DateField({
4365
									allowBlank: allowblank,
4366
									fieldLabel: rec.ScreenCaption,
4367
									readOnly: readonly,
4368
									msgTarget: 'side',
4369
									labelCls: 'label-minova',
4370
									labelWidth: 150,
4371
									hidden: ishidden,
4372
									name: rec.FieldName,
4373
									submitFormat: 'Ymd',
4374
									value: rec.DefaultValue,
4375
									anchor: '100%',
4376
									vtype: 'daterange',
4377
									start: startDt,
4378
									end: endDt,
4379
									formname: formname_,
4380
									nameTable: nameTable_,
4381
									hideMode: 'visibility',
4382
									listeners: {
4383
										change: function (val) {
4384
											var _label = val.name;
4385
											var _form = val.formname;
4386
											var _Value = val.getValue();
4387
											var target = rec.TriggerCombo;
4388
											var custumFunc = rec.SelectFunction;
4389
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
4390
												Ext.Ajax.request({
4391
													async: false,
4392
													method: 'POST',
4393
													url: '/UserControl/GetStore',
4394
													params: {
4395
														tableName: 'PCMFUNC',
4396
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
4397
													},
4398
													success: function (response) {
4399
														var results = Ext.decode(response.responseText);
4400
														data_ = results.data[0];
4401
														if (data_ != undefined) {
4402
															custumFunc = data_.FunctionCode;
4403
														}
4404
													}
4405
												});
4406
											}
4407
											var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
4408
											if (frm) {
4409
												if (custumFunc) {
4410
													eval(custumFunc)
4411
												}
4412
											}
4413
										}
4414
									}
4415
								});
4416
						} else {
4417
							formfield = new Ext.form.DateField({
4418
									allowBlank: allowblank,
4419
									fieldLabel: rec.ScreenCaption,
4420
									readOnly: readonly,
4421
									msgTarget: 'side',
4422
									labelCls: 'label-minova',
4423
									labelWidth: 150,
4424
									hidden: ishidden,
4425
									name: rec.FieldName,
4426
									submitFormat: 'Ymd',
4427
									value: rec.DefaultValue,
4428
									anchor: '100%',
4429
									formname: formname_,
4430
									nameTable: nameTable_,
4431
									hideMode: 'visibility',
4432
									listeners: {
4433
										change: function (val) {
4434
											var _label = val.name;
4435
											var _form = val.formname;
4436
											var _Value = val.getValue();
4437
											var target = rec.TriggerCombo;
4438
											var custumFunc = rec.SelectFunction;
4439
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
4440
												Ext.Ajax.request({
4441
													async: false,
4442
													method: 'POST',
4443
													url: '/UserControl/GetStore',
4444
													params: {
4445
														tableName: 'PCMFUNC',
4446
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
4447
													},
4448
													success: function (response) {
4449
														var results = Ext.decode(response.responseText);
4450
														data_ = results.data[0];
4451
														if (data_ != undefined) {
4452
															custumFunc = data_.FunctionCode;
4453
														}
4454
													}
4455
												});
4456
											}
4457
											var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
4458
											if (frm) {
4459
												if (custumFunc) {
4460
													eval(custumFunc)
4461
												}
4462
											}
4463
										}
4464
									}
4465
								});
4466
						}
4467
						break;
4468
					case "time":
4469
						formfield = new Ext.form.TimeField({
4470
								allowBlank: allowblank,
4471
								fieldLabel: rec.ScreenCaption,
4472
								readOnly: readonly,
4473
								labelCls: 'label-minova',
4474
								labelWidth: 150,
4475
								hidden: ishidden,
4476
								name: rec.FieldName,
4477
								msgTarget: 'side',
4478
								format: 'H:i',
4479
								submitFormat: 'Hi',
4480
								increment: 5,
4481
								value: rec.DefaultValue,
4482
								anchor: '100%',
4483
								formname: formname_,
4484
								nameTable: nameTable_,
4485
								listeners: {
4486
									change: function (val) {
4487
										var _label = val.name;
4488
										var _form = val.formname;
4489
										var _Value = val.getValue();
4490
										var target = rec.TriggerCombo;
4491
										var custumFunc = rec.SelectFunction;
4492
										if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
4493
											Ext.Ajax.request({
4494
												async: false,
4495
												method: 'POST',
4496
												url: '/UserControl/GetStore',
4497
												params: {
4498
													tableName: 'PCMFUNC',
4499
													param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
4500
												},
4501
												success: function (response) {
4502
													var results = Ext.decode(response.responseText);
4503
													data_ = results.data[0];
4504
													if (data_ != undefined) {
4505
														custumFunc = data_.FunctionCode;
4506
													}
4507
												}
4508
											});
4509
										}
4510
										var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
4511
										if (frm) {
4512
											if (custumFunc) {
4513
												eval(custumFunc)
4514
											}
4515
										}
4516
									}
4517
								}
4518
							});
4519
						break;
4520
					case "amount":
4521
						formfield = new MinovaUtil.MinovaES.MinovaNumberField({
4522
								allowBlank: allowblank,
4523
								fieldLabel: rec.ScreenCaption,
4524
								readOnly: readonly,
4525
								labelCls: 'label-minova',
4526
								labelWidth: 150,
4527
								hidden: ishidden,
4528
								name: rec.FieldName,
4529
								msgTarget: 'side',
4530
								value: rec.DefaultValue,
4531
								maxLength: rec.Length,
4532
								anchor: '100%',
4533
								formname: formname_,
4534
								nameTable: nameTable_,
4535
								fieldStyle: 'text-align:right;',
4536
								hideTrigger:true,
4537
								listeners: {
4538
									change: function (val) {
4539
										var _label = val.name;
4540
										var _form = val.formname;
4541
										var _Value = val.getValue();
4542
										var target = rec.TriggerCombo;
4543
										var custumFunc = rec.SelectFunction;
4544
										if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
4545
											Ext.Ajax.request({
4546
												async: false,
4547
												method: 'POST',
4548
												url: '/UserControl/GetStore',
4549
												params: {
4550
													tableName: 'PCMFUNC',
4551
													param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
4552
												},
4553
												success: function (response) {
4554
													var results = Ext.decode(response.responseText);
4555
													data_ = results.data[0];
4556
													if (data_ != undefined) {
4557
														custumFunc = data_.FunctionCode;
4558
													}
4559
												}
4560
											});
4561
										}
4562
										var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
4563
										if (frm) {
4564
											if (custumFunc) {
4565
												eval(custumFunc)
4566
											}
4567
										}
4568
									}
4569
								}
4570
							});
4571
						break;
4572
					case "file":
4573
						formfield = new MinovaUtil.MinovaES.UploadFile({
4574
								allowBlank: allowblank,
4575
								fieldLabel: rec.ScreenCaption,
4576
								readOnly: readonly,
4577
								readOnlyCls: 'minova-readonly',
4578
								hidden: ishidden,
4579
								labelCls: 'label-minova',
4580
								name: rec.FieldName,
4581
								msgTarget: 'side',
4582
								fieldname: rec.FieldName,
4583
								IsPrimaryKey: rec.IsPrimaryKey,
4584
								tableName: rec.TableRef,
4585
								triggerCls: 'x-form-search-trigger',
4586
								formtarget: me.formname,
4587
								anchor: '100%',
4588
								formname: formname_,
4589
								nameTable: nameTable_,
4590
								listeners: {
4591
									change: function (val) {
4592
										var _label = val.name;
4593
										var _form = val.formname;
4594
										var _Value = val.getValue();
4595
										var target = rec.TriggerCombo;
4596
										var custumFunc = rec.SelectFunction;
4597
										if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
4598
											Ext.Ajax.request({
4599
												async: false,
4600
												method: 'POST',
4601
												url: '/UserControl/GetStore',
4602
												params: {
4603
													tableName: 'PCMFUNC',
4604
													param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
4605
												},
4606
												success: function (response) {
4607
													var results = Ext.decode(response.responseText);
4608
													data_ = results.data[0];
4609
													if (data_ != undefined) {
4610
														custumFunc = data_.FunctionCode;
4611
													}
4612
												}
4613
											});
4614
										}
4615
										var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
4616
										if (frm) {
4617
											if (target) {
4618
												var f = frm.getForm().findField(target)
4619
													_store = f.getStore();
4620
												var _tbl = _store.proxy.extraParams.tableName;
4621
												var oldParam = _store.proxy.extraParams.param;
4622
												_store.proxy.extraParams = {
4623
													tableName: _tbl,
4624
													param: _label + '[=]' + _Value
4625
												};
4626
												_store.load();
4627
											}
4628
											if (custumFunc) {
4629
												eval(custumFunc)
4630
											}
4631
										}
4632
									}
4633
								}
4634
							});
4635
						break;
4636
					default:
4637
						if (rec.DataType == 0) {
4638
							if (rec.Length > 250) {
4639
								formfield = new Ext.form.TextArea({
4640
										allowBlank: allowblank,
4641
										fieldLabel: rec.ScreenCaption,
4642
										readOnly: readonly,
4643
										labelCls: 'label-minova',
4644
										labelWidth: 150,
4645
										hidden: ishidden,
4646
										name: rec.FieldName,
4647
										msgTarget: 'side',
4648
										value: rec.DefaultValue,
4649
										maxLength: rec.Length,
4650
										anchor: '100%',
4651
										formname: formname_,
4652
										nameTable: nameTable_,
4653
										listeners: {
4654
											change: function (val) {
4655
												var _label = val.name;
4656
												var _form = val.formname;
4657
												var _Value = val.getValue();
4658
												var target = rec.TriggerCombo;
4659
												var custumFunc = rec.SelectFunction;
4660
												if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
4661
													Ext.Ajax.request({
4662
														async: false,
4663
														method: 'POST',
4664
														url: '/UserControl/GetStore',
4665
														params: {
4666
															tableName: 'PCMFUNC',
4667
															param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
4668
														},
4669
														success: function (response) {
4670
															var results = Ext.decode(response.responseText);
4671
															data_ = results.data[0];
4672
															if (data_ != undefined) {
4673
																custumFunc = data_.FunctionCode;
4674
															}
4675
														}
4676
													});
4677
												}
4678
												var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
4679
												if (frm) {
4680
													if (custumFunc) {
4681
														eval(custumFunc)
4682
													}
4683
												}
4684
											}
4685
										}
4686
									});
4687
							} else {
4688
								if (rec.FixedValue != '') {
4689
									var storeData = [];
4690
									var str = rec.FixedValue;
4691
									var hasil = str.split('||');
4692
									hasil.forEach(function (h) {
4693
										store_ = h.split('=')
4694
											storeData.push({
4695
												code: store_[0],
4696
												desc: store_[1],
4697
											});
4698
									});
4699
									formfield = new Ext.form.ComboBox({
4700
											allowBlank: allowblank,
4701
											fieldLabel: rec.ScreenCaption,
4702
											forceSelection: true,
4703
											readOnly: readonly,
4704
											labelCls: 'label-minova',
4705
											labelWidth: 150,
4706
											hidden: ishidden,
4707
											name: rec.FieldName,
4708
											msgTarget: 'side',
4709
											value: rec.DefaultValue,
4710
											anchor: '100%',
4711
											formname: formname_,
4712
											nameTable: nameTable_,
4713
											formtarget: me.formname,
4714
											store: Ext.create('Ext.data.Store', {
4715
												storeId: 'store' + rec.FieldName,
4716
												autoLoad: true,
4717
												data: storeData
4718

    
4719
											}),
4720
											listeners: {
4721
												change: function (val) {
4722
													var _label = val.name;
4723
													var _form = val.formtarget;
4724
													var _Value = val.getValue();
4725
													var target = rec.TriggerCombo;
4726
													var custumFunc = rec.SelectFunction;
4727
													var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
4728
													if (frm) {
4729
														if (target) {
4730
															var f = frm.getForm().findField(target)
4731
																_store = f.getStore();
4732
															var _tbl = _store.proxy.extraParams.tableName;
4733
															var oldParam = _store.proxy.extraParams.param;
4734
															_store.proxy.extraParams = {
4735
																tableName: _tbl,
4736
																param: _label + '[=]' + _Value
4737
															};
4738
															_store.load();
4739
														}
4740
														if (custumFunc) {
4741
															eval(custumFunc)
4742
														}
4743
													}
4744
												}
4745
											},
4746
											queryMode: 'local',
4747
											valueField: 'code',
4748
											displayField: 'desc',
4749
										});
4750
								} else {
4751
									formfield = new Ext.form.TextField({
4752
											allowBlank: allowblank,
4753
											fieldLabel: rec.ScreenCaption,
4754
											readOnly: readonly,
4755
											labelCls: 'label-minova',
4756
											labelWidth: 150,
4757
											hidden: ishidden,
4758
											name: rec.FieldName,
4759
											msgTarget: 'side',
4760
											value: rec.DefaultValue,
4761
											maxLength: rec.Length,
4762
											anchor: '100%',
4763
											formname: formname_,
4764
											nameTable: nameTable_,
4765
											listeners: {
4766
												change: function (val) {
4767
													var _label = val.name;
4768
													var _form = val.formname;
4769
													var _Value = val.getValue();
4770
													var target = rec.TriggerCombo;
4771
													var custumFunc = rec.SelectFunction;
4772
													if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
4773
														Ext.Ajax.request({
4774
															async: false,
4775
															method: 'POST',
4776
															url: '/UserControl/GetStore',
4777
															params: {
4778
																tableName: 'PCMFUNC',
4779
																param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
4780
															},
4781
															success: function (response) {
4782
																var results = Ext.decode(response.responseText);
4783
																data_ = results.data[0];
4784
																if (data_ != undefined) {
4785
																	custumFunc = data_.FunctionCode;
4786
																}
4787
															}
4788
														});
4789
													}
4790
													var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
4791
													if (frm) {
4792
														if (custumFunc) {
4793
															eval(custumFunc)
4794
														}
4795
													}
4796
												}
4797
											}
4798
										});
4799
								}
4800
							}
4801
						} else if (rec.DataType == 1 || rec.DataType == 2) {
4802
							formfield = new MinovaUtil.MinovaES.MinovaNumberField({
4803
									allowBlank: allowblank,
4804
									fieldLabel: rec.ScreenCaption,
4805
									readOnly: readonly,
4806
									labelCls: 'label-minova',
4807
									labelWidth: 150,
4808
									msgTarget: 'side',
4809
									hidden: ishidden,
4810
									name: rec.FieldName,
4811
									value: rec.DefaultValue,
4812
									maxLength: rec.Length,
4813
									anchor: '100%',
4814
									formname: formname_,
4815
									nameTable: nameTable_,
4816
									fieldStyle: 'text-align:right;',
4817
									listeners: {
4818
										change: function (val) {
4819
											var _label = val.name;
4820
											var _form = val.formname;
4821
											var _Value = val.getValue();
4822
											var target = rec.TriggerCombo;
4823
											var custumFunc = rec.SelectFunction;
4824
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
4825
												Ext.Ajax.request({
4826
													async: false,
4827
													method: 'POST',
4828
													url: '/UserControl/GetStore',
4829
													params: {
4830
														tableName: 'PCMFUNC',
4831
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
4832
													},
4833
													success: function (response) {
4834
														var results = Ext.decode(response.responseText);
4835
														data_ = results.data[0];
4836
														if (data_ != undefined) {
4837
															custumFunc = data_.FunctionCode;
4838
														}
4839
													}
4840
												});
4841
											}
4842
											var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
4843
											if (frm) {
4844
												if (target) {
4845
													var f = frm.getForm().findField(target)
4846
														_store = f.getStore();
4847
													var _tbl = _store.proxy.extraParams.tableName;
4848
													var oldParam = _store.proxy.extraParams.param;
4849
													_store.proxy.extraParams = {
4850
														tableName: _tbl,
4851
														param: _label + '[=]' + _Value
4852
													};
4853
													_store.load();
4854
												}
4855
												if (custumFunc) {
4856
													eval(custumFunc)
4857
												}
4858
											}
4859
										}
4860
									}
4861
								});
4862
						} else if (rec.DataType == 3) {
4863
							formfield = new Ext.form.TextField({
4864
									allowBlank: allowblank,
4865
									fieldLabel: rec.ScreenCaption,
4866
									readOnly: readonly,
4867
									labelCls: 'label-minova',
4868
									labelWidth: 150,
4869
									msgTarget: 'side',
4870
									hidden: ishidden,
4871
									name: rec.FieldName,
4872
									value: rec.DefaultValue,
4873
									maxLength: rec.Length,
4874
									precision: rec.Prec,
4875
									anchor: '100%',
4876
									formname: formname_,
4877
									nameTable: nameTable_,
4878
									fieldStyle: 'text-align:right;',
4879
									maskRe: '^[0-9]+(\.[0-9]{1,2})?$',
4880
									listeners: {
4881
										change: function (val) {
4882
											var _label = val.name;
4883
											var _form = val.formname;
4884
											var _Value = val.getValue();
4885
											var target = rec.TriggerCombo;
4886
											var custumFunc = rec.SelectFunction;
4887
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
4888
												Ext.Ajax.request({
4889
													async: false,
4890
													method: 'POST',
4891
													url: '/UserControl/GetStore',
4892
													params: {
4893
														tableName: 'PCMFUNC',
4894
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
4895
													},
4896
													success: function (response) {
4897
														var results = Ext.decode(response.responseText);
4898
														data_ = results.data[0];
4899
														if (data_ != undefined) {
4900
															custumFunc = data_.FunctionCode;
4901
														}
4902
													}
4903
												});
4904
											}
4905
											var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
4906
											if (frm) {
4907
												if (target) {
4908
													var f = frm.getForm().findField(target)
4909
														_store = f.getStore();
4910
													var _tbl = _store.proxy.extraParams.tableName;
4911
													var oldParam = _store.proxy.extraParams.param;
4912
													_store.proxy.extraParams = {
4913
														tableName: _tbl,
4914
														param: _label + '[=]' + _Value
4915
													};
4916
													_store.load();
4917
												}
4918
												if (custumFunc) {
4919
													eval(custumFunc)
4920
												}
4921
											}
4922
										}
4923
									}
4924
								});
4925
						}
4926
					}
4927
				} else if (rec.SearchType != "") {
4928
					if (rec.SearchType == "0") //combobox
4929
					{
4930
						valueField = null;
4931
						displayValue = null;
4932
						Ext.Ajax.request({
4933
							async: false,
4934
							method: 'POST',
4935
							url: '/UserControl/GetStore',
4936
							params: {
4937
								tableName: 'SDATATABLEFIELD',
4938
								param: 'TableName[equal]' + rec.TableRef
4939
							},
4940
							success: function (response) {
4941
								var results = Ext.decode(response.responseText);
4942
								data_ = results.data;
4943
								if (data_ != undefined) {
4944
									valueField_ = $.grep(data_, function (r) {
4945
											return r.ValueField == '1'
4946
										});
4947
									if (valueField_.length > 0) {
4948
										valueField = valueField_[0].FieldName
4949
									}
4950
									displayValue_ = $.grep(data_, function (r) {
4951
											return r.DisplayValue == '1'
4952
										});
4953
									if (displayValue_.length > 0) {
4954
										displayValue = displayValue_[0].FieldName
4955
									}
4956
								}
4957
							}
4958
						});
4959
						formfield = new Ext.form.ComboBox({
4960
								allowBlank: allowblank,
4961
								fieldLabel: rec.ScreenCaption,
4962
								forceSelection: true,
4963
								readOnly: readonly,
4964
								labelCls: 'label-minova',
4965
								labelWidth: 150,
4966
								hidden: ishidden,
4967
								msgTarget: 'side',
4968
								name: rec.FieldName,
4969
								formname: formname_,
4970
								nameTable: nameTable_,
4971
								value: rec.DefaultValue,
4972
								width: '95%',
4973
								store: Ext.create('Ext.data.Store', {
4974
									storeId: 'store' + rec.FieldName,
4975
									autoLoad: false,
4976
									proxy: {
4977
										method: 'POST',
4978
										type: 'ajax',
4979
										url: '/UserControl/GetStore',
4980
										extraParams: {
4981
											tableName: rec.TableRef,
4982
											param: rec.ParamCombo
4983
										},
4984
										reader: {
4985
											type: 'json',
4986
											root: 'data',
4987
											totalProperty: 'data[0].TotalCount'
4988
										}
4989
									}
4990
								}),
4991
								formtarget: formname_,
4992
								listeners: {
4993
									afterrender: function (f) {
4994
										var store_ = f.getStore();
4995
										store_.load();
4996
									},
4997
									change: function (val) {
4998
										var _label = val.name;
4999
										var _form = val.formtarget;
5000
										var _Value = val.getValue();
5001
										var target = rec.TriggerCombo;
5002
										var custumFunc = rec.SelectFunction;
5003
										var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
5004
										if (frm) {
5005

    
5006
											if (target) {
5007
												var f = frm.getForm().findField(target)
5008
													_store = f.getStore();
5009
												var _tbl = _store.proxy.extraParams.tableName;
5010
												var oldParam = _store.proxy.extraParams.param;
5011
												_store.proxy.extraParams = {
5012
													tableName: _tbl,
5013
													param: _label + '[=]' + _Value
5014
												};
5015
												_store.load();
5016
											}
5017
											if (custumFunc) {
5018
												eval(custumFunc)
5019
											}
5020
										}
5021
									}
5022
								},
5023
								queryMode: 'local',
5024
								displayField: displayValue,
5025
								valueField: valueField,
5026
							});
5027
					} else if (rec.SearchType == '2') //Lookup
5028
					{
5029
						formfield = new MinovaUtil.MinovaES.MinovaLookupGrid({
5030
								allowBlank: allowblank,
5031
								fieldLabel: rec.ScreenCaption,
5032
								readOnly: readonly,
5033
								IsPrimaryKey: rec.IsPrimaryKey,
5034
								msgTarget: 'side',
5035
								labelCls: 'label-minova',
5036
								labelWidth: 150,
5037
								hidden: ishidden,
5038
								name: rec.FieldName,
5039
								tableName: rec.TableRef, //name tabel yang jadi ref-nya
5040
								triggerCls: 'x-form-search-trigger',
5041
								vtype: 'alphanum', // disable space
5042
								formtarget: me.formname, // nama form  yang akan di set value-nya
5043
								anchor: '100%',
5044
								formname: formname_,
5045
								nameTable: nameTable_,
5046
								LookupFunction: rec.LookupFunction,
5047
								SearchFunction: rec.SearchFunction,
5048
								fieldTarget: rec.FieldName,
5049
								fieldValue: rec.FieldName,
5050
								listeners: {
5051
									change: function (val) {
5052
										var _label = val.name;
5053
										var _form = val.formname;
5054
										var _Value = val.getValue();
5055
										var target = rec.TriggerCombo;
5056
										var custumFunc = rec.SelectFunction;
5057
										if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
5058
											Ext.Ajax.request({
5059
												async: false,
5060
												method: 'POST',
5061
												url: '/UserControl/GetStore',
5062
												params: {
5063
													tableName: 'PCMFUNC',
5064
													param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
5065
												},
5066
												success: function (response) {
5067
													var results = Ext.decode(response.responseText);
5068
													data_ = results.data[0];
5069
													if (data_ != undefined) {
5070
														custumFunc = data_.FunctionCode;
5071
													}
5072
												}
5073
											});
5074
										}
5075
										var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
5076
										if (frm) {
5077

    
5078
											if (target) {
5079
												var f = frm.getForm().findField(target)
5080
													_store = f.getStore();
5081
												var _tbl = _store.proxy.extraParams.tableName;
5082
												var oldParam = _store.proxy.extraParams.param;
5083
												_store.proxy.extraParams = {
5084
													tableName: _tbl,
5085
													param: _label + '[=]' + _Value
5086
												};
5087
												_store.load();
5088
											}
5089

    
5090
											if (custumFunc) {
5091
												eval(custumFunc)
5092
											}
5093

    
5094
										}
5095

    
5096
									},
5097

    
5098
								},
5099
							});
5100
					} else if (rec.SearchType == '3') //lookup tree
5101
					{
5102
						formfield = new MinovaUtil.MinovaES.MinovaLookupTree({
5103
								allowBlank: allowblank,
5104
								fieldLabel: rec.ScreenCaption,
5105
								readOnly: readonly,
5106
								IsPrimaryKey: rec.IsPrimaryKey,
5107
								labelCls: 'label-minova',
5108
								labelWidth: 150,
5109
								hidden: ishidden,
5110
								name: rec.FieldName,
5111
								msgTarget: 'side',
5112
								triggerCls: 'x-form-search-trigger',
5113
								treeSructure: rec.SearchFunction, //'O-O-P',
5114
								objClassValue: rec.ParamCombo, //'O',
5115
								formname: formname_,
5116
								targetField: rec.FieldName,
5117
								nameTable: nameTable_,
5118
								editable: false,
5119
								anchor: '100%',
5120
								listeners: {
5121
									change3: function (val) {
5122
										var _label = val.name;
5123
										var _form = val.formname;
5124
										var _Value = val.getValue();
5125
										var target = rec.TriggerCombo;
5126
										var custumFunc = rec.SelectFunction;
5127
										if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
5128
											Ext.Ajax.request({
5129
												async: false,
5130
												method: 'POST',
5131
												url: '/UserControl/GetStore',
5132
												params: {
5133
													tableName: 'PCMFUNC',
5134
													param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
5135
												},
5136
												success: function (response) {
5137
													var results = Ext.decode(response.responseText);
5138
													data_ = results.data[0];
5139
													if (data_ != undefined) {
5140
														custumFunc = data_.FunctionCode;
5141
													}
5142
												}
5143
											});
5144
										}
5145
										var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
5146
										if (frm) {
5147

    
5148
											if (target) {
5149
												var f = frm.getForm().findField(target)
5150
													_store = f.getStore();
5151
												var _tbl = _store.proxy.extraParams.tableName;
5152
												var oldParam = _store.proxy.extraParams.param;
5153
												_store.proxy.extraParams = {
5154
													tableName: _tbl,
5155
													param: _label + '[=]' + _Value
5156
												};
5157
												_store.load();
5158
											}
5159
											if (custumFunc) {
5160
												eval(custumFunc)
5161
											}
5162
										}
5163
									},
5164
									blur: function (val) {
5165
										//if(val.value.split('-').length != 2){
5166
										var _label = val.name;
5167
										var _form = val.formname;
5168
										var _Value = val.getValue();
5169
										var target = rec.TriggerCombo;
5170
										var custumFunc = rec.SelectFunction;
5171
										if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
5172
											Ext.Ajax.request({
5173
												async: false,
5174
												method: 'POST',
5175
												url: '/UserControl/GetStore',
5176
												params: {
5177
													tableName: 'PCMFUNC',
5178
													param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
5179
												},
5180
												success: function (response) {
5181
													var results = Ext.decode(response.responseText);
5182
													data_ = results.data[0];
5183
													if (data_ != undefined) {
5184
														custumFunc = data_.FunctionCode;
5185
													}
5186
												}
5187
											});
5188
										}
5189
										var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
5190
										if (frm) {
5191

    
5192
											if (target) {
5193
												var f = frm.getForm().findField(target)
5194
													_store = f.getStore();
5195
												var _tbl = _store.proxy.extraParams.tableName;
5196
												var oldParam = _store.proxy.extraParams.param;
5197
												_store.proxy.extraParams = {
5198
													tableName: _tbl,
5199
													param: _label + '[=]' + _Value
5200
												};
5201
												_store.load();
5202
											}
5203
											if (custumFunc) {
5204
												eval(custumFunc)
5205
											}
5206
										}
5207
										//}
5208
									}
5209

    
5210
								}
5211
							});
5212
					}
5213
				}
5214
				if (isDesk) {
5215
					if (rec.ColumnNo == 1) {
5216
						col1.push(formfield);
5217
					} else {
5218
						col2.push(formfield);
5219
					}
5220
				} else {
5221
					col1.push(formfield);
5222
				}
5223

    
5224
			});
5225
		}
5226
		Ext.applyIf(me, {
5227
			items: [{
5228
					//width: 450,
5229
					style: 'width: 50%',
5230
					items: col1
5231
				}, {
5232
					//width: 450,
5233
					style: 'width: 50%',
5234
					items: col2
5235
				}
5236
			],
5237
		});
5238
		this.callParent();
5239
	}
5240
});
5241
/*Gird ESS Generator*/
5242
Ext.define('MinovaUtil.MinovaES.MinovaWorkflowGrid', {
5243
	extend: 'Ext.grid.Panel',
5244
	requires: ['Ext.grid.RowNumberer'],
5245
	alias: 'widget.minovaworkflowgrid',
5246
	alternateClassName: 'Ext.grid.MinovaGrid',
5247
	tableName: undefined,
5248
	param: undefined,
5249
	pagesize: undefined,
5250
	storeName: undefined,
5251
	enableLocking: true,
5252
	autoLoad: undefined,
5253
	multiSelect: undefined,
5254
	formname: this.name,
5255
	bizprocid: undefined,
5256
	taskid: undefined,
5257
	initComponent: function () {
5258
		var me = this;
5259
		var cols_ = [];
5260
		var fieldeditor = {};
5261
		var hasil = null;
5262
		var autoLoad = true;
5263
		var locking = true;
5264
		var widthLock = 250;
5265
		if (me.autoLoad == false) {
5266
			autoLoad = false;
5267
		}
5268
		var LangID = MinovaUtil.GetLangID();
5269
		var parameter = "LangID='" + LangID + "',BizProcessID='" + me.bizprocid + "',TaskID='" + me.taskid + "',TableName='" + me.tableName + "'";
5270
		Ext.Ajax.request({
5271
			async: false,
5272
			method: 'POST',
5273
			url: '/UserControl/GetStore',
5274
			params: {
5275
				tableName: 'PDSWFSTRUCTUREFIELD',
5276
				param: parameter
5277
			},
5278
			success: function (response) {
5279
				var results = Ext.decode(response.responseText);
5280
				hasil = results.data;
5281
			}
5282
		});
5283

    
5284
		if (hasil.length > 0) {
5285
			Ext.each(hasil, function (rec) {
5286
				var readonly = false;
5287
				var ishidden = false;
5288
				var allowblank = true;
5289
				var null_ = null;
5290
				if (rec.IsReadOnly == '1') {
5291
					readonly = true;
5292
				}
5293
				if (rec.IsRequired == '1') {
5294
					allowblank = false;
5295
				}
5296
				if (rec.IsVisible == '1') {
5297
					switch (rec.FormatRef) {
5298
					case "date":
5299
						cols_.push({
5300
							xtype: 'minovadatecolumn',
5301
							text: rec.HeaderTitle,
5302
							dataIndex: rec.FieldName,
5303
							width: 100
5304
						});
5305
						break
5306
					case "amountencrypt":
5307
						cols_.push({
5308
							xtype: 'minovaamountcolumn',
5309
							align: 'right',
5310
							text: rec.HeaderTitle,
5311
							dataIndex: rec.FieldName,
5312
							width: 100
5313
						});
5314
						break
5315
					case "amountround":
5316
						cols_.push({
5317
							xtype: 'minovacurrancycolumnround',
5318
							align: 'right',
5319
							text: rec.HeaderTitle,
5320
							dataIndex: rec.FieldName,
5321
							width: 100,
5322
							filter: {
5323
								itemDefaults: {
5324
									emptyText: 'Search for...'
5325
								}
5326
							}
5327
						});
5328
						break
5329
					case "amount":
5330
						cols_.push({
5331
							xtype: 'minovacurrancycolumn',
5332
							align: 'right',
5333
							text: rec.HeaderTitle,
5334
							dataIndex: rec.FieldName,
5335
							width: 100,
5336
							filter: {
5337
								type: 'number',
5338
								itemDefaults: {
5339
									emptyText: 'Search for...'
5340
								}
5341
							}
5342
						});
5343
						break
5344
					case "datetime":
5345
						cols_.push({
5346
							xtype: 'minovadatetimecolumn',
5347
							text: rec.HeaderTitle,
5348
							dataIndex: rec.FieldName,
5349
							width: 140,
5350
							filter: {
5351
								type: 'string',
5352
								itemDefaults: {
5353
									emptyText: 'Search for...'
5354
								}
5355
							}
5356
						});
5357
						break
5358
					default:
5359
						if (rec.TableRef != "") {
5360
							if (rec.TableRef != null) {
5361
								var valueField = null;
5362
								var displayValue = null;
5363
								Ext.Ajax.request({
5364
									async: false,
5365
									method: 'POST',
5366
									url: '/UserControl/GetStore',
5367
									params: {
5368
										tableName: 'SDATATABLEFIELD',
5369
										param: 'TableName[equal]' + rec.TableRef
5370
									},
5371
									success: function (response) {
5372
										var results = Ext.decode(response.responseText);
5373
										data_ = results.data;
5374

    
5375
										if (data_ != undefined) {
5376
											if (data_.length > 0) {
5377
												valueField_ = $.grep(data_, function (r) {
5378
														return r.ValueField == '1'
5379
													});
5380
												valueField = valueField_[0].FieldName
5381
													displayValue_ = $.grep(data_, function (r) {
5382
														return r.DisplayValue == '1'
5383
													});
5384
												displayValue = displayValue_[0].FieldName
5385
											}
5386
										}
5387
									}
5388
								});
5389
								var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
5390
								var count_ = 0;
5391
								if (store_) {
5392
									count_ = store_.count();
5393
								}
5394
								if (count_ == 0) {
5395
									Ext.create('Ext.data.Store', {
5396
										storeId: 'store_' + rec.FieldName,
5397
										autoLoad: false,
5398
										proxy: {
5399
											method: 'POST',
5400
											type: 'ajax',
5401
											url: '/UserControl/GetStore',
5402
											extraParams: {
5403
												tableName: rec.TableRef,
5404
												param: rec.ParamCombo
5405
											},
5406
											reader: {
5407
												type: 'json',
5408
												root: 'data',
5409
												totalProperty: 'data[0].TotalCount'
5410
											}
5411
										}
5412
									})
5413
								}
5414
								cols_.push({
5415
									xtype: 'minovacombocolumn',
5416
									text: rec.HeaderTitle,
5417
									dataIndex: rec.FieldName,
5418
									valueField: valueField,
5419
									displayField: displayValue,
5420
									store: 'store_' + rec.FieldName,
5421
									filter: {
5422
										type: 'list',
5423
										itemDefaults: {
5424
											emptyText: 'Search for...'
5425
										}
5426
									}
5427
								});
5428
							}
5429
						} else {
5430
							cols_.push({
5431
								text: rec.HeaderTitle,
5432
								dataIndex: rec.FieldName,
5433
								filter: {
5434
									itemDefaults: {
5435
										emptyText: 'Search for...'
5436
									}
5437
								}
5438
							});
5439
						}
5440
						break
5441
					}
5442
				} else {
5443
					cols_.push({
5444
						text: rec.HeaderTitle,
5445
						dataIndex: rec.FieldName,
5446
						hidden: true,
5447
						filter: {
5448
							itemDefaults: {
5449
								emptyText: 'Search for...'
5450
							}
5451
						}
5452
					});
5453
				}
5454
			});
5455
		};
5456
		var param_ = me.param;
5457
		if (param_ == undefined) {
5458
			param_ = ''
5459
		}
5460
		var jsStoreGrid = new Ext.data.Store({
5461
				storeId: me.storeName,
5462
				autoLoad: autoLoad,
5463
				pageSize: 10,
5464
				proxy: {
5465
					method: 'POST',
5466
					type: 'ajax',
5467
					url: '/UserControl/GetStorePagingAuth',
5468
					extraParams: {
5469
						tableName: me.tableName,
5470
						param: param_,
5471
						menuId: MinovaUtil.GetMenuID()
5472
					},
5473
					reader: {
5474
						type: 'json',
5475
						root: 'data',
5476
						totalProperty: 'totalRecords'
5477
					}
5478
				}
5479
			});
5480
		Ext.applyIf(me, {
5481
			autoScroll: true,
5482
			enableLocking: locking,
5483
			lockedGridConfig: {
5484
				header: false,
5485
				collapsible: true,
5486
				width: widthLock,
5487
				forceFit: locking,
5488
				listeners: {
5489
					render: function (grid) {
5490
						var pagingToolbar = grid.child('pagingtoolbar');
5491
						if (pagingToolbar) {
5492
							grid.remove(pagingToolbar, true);
5493
						}
5494
					}
5495
				}
5496
			},
5497
			listeners: {
5498
				viewready: function () {
5499
					if (autoLoad == true) {
5500
						this.getStore().loadPage(1);
5501
					}
5502

    
5503
				},
5504
				beforeedit: function () {
5505
					return false;
5506
				}
5507
			},
5508
			lockedViewConfig: {
5509
				scroll: 'horizontal'
5510
			},
5511
			viewConfig: {
5512
				emptyText: 'No Data Display',
5513
				deferEmptyText: false,
5514
				listeners: {
5515
					refresh: function (dataview) {
5516
						Ext.each(dataview.panel.columns, function (column) {
5517
							if (column.autoSizeColumn == false)
5518
								column.autoSizeColumn = true;
5519
							column.autoSize();
5520
						})
5521
					}
5522
				}
5523
			},
5524
			columns: cols_,
5525
			store: jsStoreGrid,
5526
			plugins: [{
5527
					ptype: 'gridfilters'
5528
				}
5529
			]
5530
		});
5531
		this.callParent();
5532
	}
5533
});
5534
/*EditableGrid ESS Generator*/
5535
Ext.define('MinovaUtil.MinovaES.MinovaWorkflowEditableGrid', {
5536
	extend: 'Ext.form.Panel',
5537
	alias: ['widget.minovaworkfloweditablegrid', 'widget.workfloweditablegrid1'],
5538
	requires: [
5539
		'Ext.grid.plugin.CellEditing',
5540
		'Ext.grid.RowNumberer',
5541
		'Ext.grid.Panel',
5542
	],
5543
	anchor: '100%',
5544
	tableName: undefined,
5545
	hideButton: undefined,
5546
	multiSelect: undefined,
5547
	formname: this.name,
5548
	bizprocid: undefined,
5549
	bizflowid: undefined,
5550
	taskid: undefined,
5551
	initComponent: function () {
5552
		var me = this;
5553
		var isLookup = me.isLookup;
5554
		var hide_ = false;
5555
		var widthLock = 250;
5556
		var checkSelection = '';
5557
		if (me.hideButton == true) {
5558
			hide_ = true;
5559
		}
5560
		if (me.multiSelect) {
5561
			locking = false;
5562
			checkSelection = 'checkboxmodel';
5563
			widthLock = 40;
5564
		}
5565
		var tableName = me.tableName;
5566
		var cols = [];
5567
		var fieldStore = [];
5568
		var _url = 'GetAllField';
5569
		var hasil = null;
5570
		var height = me.height;
5571
		var storeID = 'store' + me.tableName;
5572
		var gridName = 'grid' + me.name;
5573
		if (me.storeName) {
5574
			storeID = me.storeName;
5575
		}
5576
		var LangID = MinovaUtil.GetLangID();
5577
		var parameter = "LangID='" + LangID + "',BizProcessID='" + me.bizprocid + "',TaskID='" + me.taskid + "',TableName='" + me.tableName + "'";
5578
		Ext.Ajax.request({
5579
			async: false,
5580
			method: 'POST',
5581
			url: '/UserControl/GetStore',
5582
			params: {
5583
				tableName: 'PDSWFSTRUCTUREFIELD',
5584
				param: parameter
5585
			},
5586
			success: function (response) {
5587
				var results = Ext.decode(response.responseText);
5588
				hasil = results.data;
5589
			}
5590
		});
5591
		cols.push({
5592
			xtype: 'rownumberer'
5593
		});
5594
		var addData = 'var data={';
5595
		if (hasil.length > 0) {
5596
			Ext.each(hasil, function (rec) {
5597
				fieldStore.push(rec.FieldName);
5598
				if (rec.FieldName != 'Sequence') {
5599
					addData = addData + rec.FieldName + ":" + "'',";
5600
				}
5601
				var null_ = null;
5602
				var ReadOnly_ = false;
5603
				if (rec.IsRequired == '1') {
5604
					null_ = false;
5605
				} else {
5606
					null_ = true;
5607
				}
5608
				var Hidden_ = false;
5609
				if (rec.IsReadOnly == '1') {
5610
					ReadOnly_ = true;
5611
				}
5612
				if (rec.IsVisible == '1') {
5613
					switch (rec.FormatRef) {
5614
					case "date":
5615
						cols.push({
5616
							xtype: 'minovadatecolumn',
5617
							hidden: Hidden_,
5618
							text: rec.HeaderTitle,
5619
							dataIndex: rec.FieldName,
5620
							filter: {
5621
								itemDefaults: {
5622
									emptyText: 'Search for...',
5623
								}
5624
							},
5625
							editor: {
5626
								allowBlank: null_,
5627
								xtype: 'datefield',
5628
								hideMode: 'visibility',
5629
								readOnly: ReadOnly_,
5630
								id: tableName + rec.FieldName,
5631
								fieldGrid: rec.FieldName,
5632
								nameTable: rec.TableName,
5633
								value: rec.DefaultValue
5634
							}
5635
						});
5636
						break
5637
					case "amount":
5638
						cols.push({
5639
							xtype: 'minovacurrancycolumn',
5640
							align: 'right',
5641
							text: rec.HeaderTitle,
5642
							dataIndex: rec.FieldName,
5643
							hidden: Hidden_,
5644
							filter: {
5645
								itemDefaults: {
5646
									emptyText: 'Search for...'
5647
								}
5648
							},
5649
							editor: {
5650
								allowBlank: null_,
5651
								xtype: 'minovacurrencyfield',
5652
								readOnly: ReadOnly_,
5653
								id: tableName + rec.FieldName,
5654
								nameTable: rec.TableName,
5655
								fieldGrid: rec.FieldName,
5656
								fieldStyle: 'text-align:right;',
5657
								value: '0'
5658
							}
5659
						});
5660
						break
5661
					default:
5662
						if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
5663
							cols.push({
5664
								text: rec.HeaderTitle,
5665
								dataIndex: rec.FieldName,
5666
								width: 100,
5667
								filter: {
5668
									type: 'string',
5669
									itemDefaults: {
5670
										emptyText: 'Search for...'
5671
									}
5672
								}
5673
							});
5674
						} else if (rec.SearchType == '0') {
5675
							var valueField = null;
5676
							var displayValue = null;
5677
							var TableRef = undefined;
5678
							if (rec.TableRef != '') {
5679
								TableRef = rec.TableRef;
5680
								Ext.Ajax.request({
5681
									async: false,
5682
									method: 'POST',
5683
									url: '/UserControl/GetStore',
5684
									params: {
5685
										tableName: 'SDATATABLEFIELD',
5686
										param: 'TableName[equal]' + rec.TableRef
5687
									},
5688
									success: function (response) {
5689
										var results = Ext.decode(response.responseText);
5690
										data_ = results.data;
5691
										if (data_ != undefined) {
5692
											valueField_ = $.grep(data_, function (r) {
5693
													return r.ValueField == '1'
5694
												});
5695
											valueField = valueField_[0].FieldName
5696
												displayValue_ = $.grep(data_, function (r) {
5697
													return r.DisplayValue == '1'
5698
												});
5699
											displayValue = displayValue_[0].FieldName
5700
										}
5701
									}
5702
								});
5703
							}
5704
							Ext.create('Ext.data.Store', {
5705
								storeId: 'store_' + me.tableName + rec.FieldName,
5706
								autoLoad: true,
5707
								proxy: {
5708
									method: 'POST',
5709
									type: 'ajax',
5710
									url: '/UserControl/GetStoreAuth',
5711
									extraParams: {
5712
										tableName: TableRef,
5713
										param: rec.ParamCombo,
5714
										menuId: MinovaUtil.GetMenuID()
5715
									},
5716
									reader: {
5717
										type: 'json',
5718
										root: 'data',
5719
										totalProperty: 'data[0].TotalCount'
5720
									}
5721
								}
5722
							});
5723
							cols.push({
5724
								//xtype : 'minovacombocolumn',
5725
								hidden: Hidden_,
5726
								text: rec.HeaderTitle,
5727
								dataIndex: rec.FieldName,
5728
								//valueField : valueField,
5729
								//displayField : displayValue,
5730
								//store : 'store_' + me.tableName + rec.FieldName,
5731
								editor: {
5732
									allowBlank: null_,
5733
									xtype: 'combobox',
5734
									readOnly: ReadOnly_,
5735
									id: rec.TableName + rec.FieldName,
5736
									nameTable: rec.TableName,
5737
									fieldGrid: rec.FieldName,
5738
									valueField: valueField,
5739
									displayField: displayValue,
5740
									store: 'store_' + me.tableName + rec.FieldName,
5741
									value: rec.DefaultValue
5742
								},
5743
								renderer: function (value) {
5744
									var store = Ext.data.StoreManager.lookup('store_' + me.tableName + rec.FieldName);
5745
									var index = store.find(valueField, value);
5746
									var val = "";
5747
									if (index != -1) {
5748
										var rc = store.getAt(index);
5749
										val = rc.get(displayValue);
5750
									} else {
5751
										val = value;
5752
									}
5753
									return val;
5754
								},
5755
								filter: {
5756
									type: 'list',
5757
									itemDefaults: {
5758
										emptyText: 'Search for...'
5759
									}
5760
								}
5761
							});
5762
						} else if (rec.SearchType == '2') {
5763
							var triger = (rec.TriggerCombo).split('$');
5764
							var targetField_ = triger[0];
5765
							var fieldValue_ = triger[1];
5766
							cols.push({
5767
								text: rec.HeaderTitle,
5768
								hidden: Hidden_,
5769
								dataIndex: rec.FieldName,
5770
								filter: {
5771
									itemDefaults: {
5772
										emptyText: 'Search for...'
5773
									}
5774
								},
5775
								editor: {
5776
									allowBlank: null_,
5777
									xtype: 'minovalookupgrid',
5778
									readOnly: ReadOnly_,
5779
									isGrid: true,
5780
									fieldTarget: targetField_,
5781
									fieldValue: fieldValue_,
5782
									isGrid: true,
5783
									id: tableName + rec.FieldName,
5784
									tableName: rec.TableRef,
5785
									triggerCls: 'x-form-search-trigger',
5786
									vtype: 'alphanum',
5787
									nameTable: rec.TableName,
5788
									fieldGrid: rec.FieldName,
5789
									listeners: {
5790
										change: function (val) {
5791
											var custumFunc = rec.SelectFunction;
5792
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
5793
												Ext.Ajax.request({
5794
													async: false,
5795
													method: 'POST',
5796
													url: '/UserControl/GetStore',
5797
													params: {
5798
														tableName: 'PCMFUNC',
5799
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
5800
													},
5801
													success: function (response) {
5802
														var results = Ext.decode(response.responseText);
5803
														data_ = results.data[0];
5804
														if (data_ != undefined) {
5805
															custumFunc = data_.FunctionCode;
5806
														}
5807
													}
5808
												});
5809
											}
5810
											if (custumFunc) {
5811
												eval(custumFunc)
5812
											}
5813
										}
5814
									}
5815
								}
5816
							});
5817
						} else if (rec.SearchType == '3') {
5818
							cols.push({
5819
								text: rec.HeaderTitle,
5820
								hidden: Hidden_,
5821
								dataIndex: rec.FieldName,
5822
								filter: {
5823
									itemDefaults: {
5824
										emptyText: 'Search for...'
5825
									}
5826
								},
5827
								editor: {
5828
									allowBlank: null_,
5829
									xtype: 'MinovaLookupTree',
5830
									readOnly: ReadOnly_,
5831
									id: tableName + rec.FieldName,
5832
									tableName: rec.TableRef,
5833
									triggerCls: 'x-form-search-trigger',
5834
									vtype: 'alphanum',
5835
									treeSructure: rec.SearchFunction,
5836
									objClassValue: rec.ParamCombo,
5837
									nameTable: rec.TableName,
5838
									fieldGrid: rec.FieldName,
5839
									listeners: {
5840
										change: function (val) {
5841
											var custumFunc = rec.SelectFunction;
5842
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
5843
												Ext.Ajax.request({
5844
													async: false,
5845
													method: 'POST',
5846
													url: '/UserControl/GetStore',
5847
													params: {
5848
														tableName: 'PCMFUNC',
5849
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
5850
													},
5851
													success: function (response) {
5852
														var results = Ext.decode(response.responseText);
5853
														data_ = results.data[0];
5854
														if (data_ != undefined) {
5855
															custumFunc = data_.FunctionCode;
5856
														}
5857
													}
5858
												});
5859
											}
5860
											if (custumFunc) {
5861
												eval(custumFunc)
5862
											}
5863
										}
5864
									}
5865
								}
5866
							});
5867
						} 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) {
5868
							var triger = (rec.TriggerCombo).split('&');
5869
							var targetField_ = triger[0];
5870
							var fieldValue_ = triger[0];
5871
							cols.push({
5872
								text: rec.HeaderTitle,
5873
								hidden: Hidden_,
5874
								dataIndex: rec.FieldName,
5875
								filter: {
5876
									itemDefaults: {
5877
										emptyText: 'Search for...'
5878
									}
5879
								},
5880
								editor: {
5881
									allowBlank: null_,
5882
									xtype: 'lookupemployee',
5883
									readOnly: ReadOnly_,
5884
									isGrid: true,
5885
									fieldTarget: targetField_,
5886
									fieldValue: fieldValue_,
5887
									isGrid: true,
5888
									id: tableName + rec.FieldName,
5889
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
5890
									triggerCls: 'x-form-search-trigger',
5891
									vtype: 'alphanum', // disable space
5892
									nameTable: rec.TableName,
5893
									fieldGrid: rec.FieldName,
5894
									listeners: {
5895
										change: function (val) {
5896
											var custumFunc = rec.SelectFunction;
5897
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
5898
												Ext.Ajax.request({
5899
													async: false,
5900
													method: 'POST',
5901
													url: '/UserControl/GetStore',
5902
													params: {
5903
														tableName: 'PCMFUNC',
5904
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
5905
													},
5906
													success: function (response) {
5907
														var results = Ext.decode(response.responseText);
5908
														data_ = results.data[0];
5909
														if (data_ != undefined) {
5910
															custumFunc = data_.FunctionCode;
5911
														}
5912
													}
5913
												});
5914
											}
5915
											if (custumFunc) {
5916
												eval(custumFunc)
5917
											}
5918
										}
5919
									}
5920
								}
5921
							});
5922
						} else if (rec.SearchType == '4' && isLookup != true) {
5923
							cols.push({
5924
								text: rec.HeaderTitle,
5925
								hidden: Hidden_,
5926
								dataIndex: rec.FieldName,
5927
								filter: {
5928
									itemDefaults: {
5929
										emptyText: 'Search for...'
5930
									}
5931
								},
5932
								editor: {
5933
									allowBlank: null_,
5934
									xtype: 'lookupemployee',
5935
									readOnly: ReadOnly_,
5936
									isGrid: true,
5937
									fieldTarget: targetField_,
5938
									fieldValue: fieldValue_,
5939
									isGrid: true,
5940
									id: tableName + rec.FieldName,
5941
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
5942
									triggerCls: 'x-form-search-trigger',
5943
									vtype: 'alphanum', // disable space
5944
									nameTable: rec.TableName,
5945
									fieldGrid: rec.FieldName,
5946
									listeners: {
5947
										change: function (val) {
5948
											var custumFunc = rec.SelectFunction;
5949
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
5950
												Ext.Ajax.request({
5951
													async: false,
5952
													method: 'POST',
5953
													url: '/UserControl/GetStore',
5954
													params: {
5955
														tableName: 'PCMFUNC',
5956
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
5957
													},
5958
													success: function (response) {
5959
														var results = Ext.decode(response.responseText);
5960
														data_ = results.data[0];
5961
														if (data_ != undefined) {
5962
															custumFunc = data_.FunctionCode;
5963
														}
5964
													}
5965
												});
5966
											}
5967
											if (custumFunc) {
5968
												eval(custumFunc)
5969
											}
5970
										}
5971
									}
5972
								}
5973
							});
5974
						} else if (rec.FixedValue != '') { // add by taufan
5975
							cols.push({
5976
								text: rec.HeaderTitle,
5977
								hidden: Hidden_,
5978
								dataIndex: rec.FieldName,
5979
								filter: {
5980
									itemDefaults: {
5981
										emptyText: 'Search for...'
5982
									}
5983
								},
5984
								editor: {
5985
									allowBlank: null_,
5986
									xtype: 'minovafixvalue',
5987
									readOnly: ReadOnly_,
5988
									id: rec.TableName + rec.FieldName,
5989
									name: rec.TableName + rec.FieldName,
5990
									nameTable: rec.TableName,
5991
									fieldGrid: rec.FieldName,
5992
									fixedValue: rec.FixedValue,
5993
									valueField: 'code',
5994
									displayField: 'desc',
5995
									value: rec.DefaultValue
5996
								},
5997
								renderer: function (value) {
5998
									var val = "";
5999
									var storeData = [];
6000
									var str = rec.FixedValue;
6001
									var hasil = str.split('||');
6002
									hasil.forEach(function (h) {
6003
										store_ = h.split('=')
6004
											storeData.push({
6005
												code: store_[0],
6006
												desc: store_[1]
6007
											});
6008
									});
6009
									var item = storeData.find(x => x.code == value);
6010
									if (item != undefined) {
6011
										val = item.desc;
6012
									}
6013
									return val;
6014
								}
6015
							});
6016
						} else {
6017
							cols.push({
6018
								text: rec.HeaderTitle,
6019
								hidden: Hidden_,
6020
								dataIndex: rec.FieldName,
6021
								filter: {
6022
									itemDefaults: {
6023
										emptyText: 'Search for...'
6024
									}
6025
								},
6026
								editor: {
6027
									allowBlank: null_,
6028
									xtype: 'textfield',
6029
									readOnly: ReadOnly_,
6030
									id: tableName + rec.FieldName,
6031
									nameTable: rec.TableName,
6032
									fieldGrid: rec.FieldName,
6033
									value: rec.DefaultValue,
6034
									listeners: {
6035
										change: function (val) {
6036
											var custumFunc = null;
6037
											Ext.Ajax.request({
6038
												async: false,
6039
												method: 'POST',
6040
												url: '/UserControl/GetStore',
6041
												params: {
6042
													tableName: 'SDATATABLEFIELD',
6043
													param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
6044
												},
6045
												success: function (response) {
6046
													var results = Ext.decode(response.responseText);
6047
													data_ = results.data[0];
6048
													if (data_ != undefined) {
6049
														custumFunc = data_.SelectFunction;
6050
														//console.log(data_)
6051
													}
6052
												}
6053
											});
6054

    
6055
											if (custumFunc) {
6056
												eval(custumFunc)
6057
											}
6058
										}
6059
									}
6060
								}
6061
							});
6062
						}
6063
						break
6064
					}
6065
				} else {
6066
					cols.push({
6067
						text: rec.HeaderTitle,
6068
						hidden: Hidden_,
6069
						dataIndex: rec.FieldName,
6070
						hidden: true,
6071
						editor: {
6072
							allowBlank: true,
6073
							xtype: 'textfield',
6074
							readOnly: ReadOnly_,
6075
							id: tableName + rec.FieldName,
6076
							nameTable: rec.TableName,
6077
							fieldGrid: rec.FieldName,
6078
							value: rec.DefaultValue
6079
						},
6080
						filter: {
6081
							itemDefaults: {
6082
								emptyText: 'Search for...'
6083
							}
6084
						}
6085
					});
6086
				}
6087
			});
6088

    
6089
		};
6090
		addData = addData + "}";
6091
		Ext.applyIf(me, {
6092
			items: [{
6093
					xtype: 'grid',
6094
					id: gridName,
6095
					name: gridName,
6096
					height: height,
6097
					addFlag: true,
6098
					deleteFlag: true,
6099
					store: Ext.create('Ext.data.Store', {
6100
						storeId: storeID,
6101
						fields: fieldStore,
6102
						proxy: {
6103
							method: 'POST',
6104
							type: 'ajax',
6105
							url: '',
6106
							reader: {
6107
								type: 'json',
6108
								root: 'data'
6109
							}
6110
						}
6111
					}),
6112
					dockedItems: [{
6113
							xtype: 'toolbar',
6114
							items: [{
6115
									text: 'Add',
6116
									hidden: hide_,
6117
									name: tableName + 'Add',
6118
									iconCls: 'fa-plus-circle',
6119
									style: 'font-family: FontAwesome',
6120
									handler: function () {
6121
										var grid = Ext.getCmp(gridName);
6122
										if (grid.addFlag === true) {
6123
											var store = Ext.StoreMgr.lookup(storeID)
6124
												idx = store.getCount();
6125
											var action = getParam('action');
6126
											var data = '';
6127
											var Sequence = 0;
6128
											if (idx == 0) {
6129
												Sequence = 1;
6130
											} else {
6131
												Sequence = 1 + idx;
6132
											}
6133
											var seq = 'Sequence';
6134
											var SequenceValue = Sequence;
6135
											eval(addData);
6136
											data[seq] = SequenceValue;
6137
											store.insert(idx, data);
6138
										}
6139
									}
6140
								}, {
6141
									text: 'Delete',
6142
									hidden: hide_,
6143
									name: tableName + 'DeleteText',
6144
									iconCls: 'fa-trash-o',
6145
									style: 'font-family: FontAwesome',
6146
									handler: function () {
6147
										var grid = Ext.getCmp(gridName);
6148
										if (grid.deleteFlag === true) {
6149
											var me = this,
6150
											store = Ext.StoreMgr.lookup(storeID)
6151
												var grid = Ext.getCmp(gridName);
6152
											Ext.MessageBox.show({
6153
												title: 'Remove tab',
6154
												msg: "This will remove. Do you want to continue?",
6155
												buttons: Ext.MessageBox.YESNO,
6156
												fn: function (choice) {
6157
													console.log(choice);
6158
													if (choice === 'yes') {
6159
														var selection = grid.getView().getSelectionModel().getSelection()[0];
6160
														if (selection) {
6161
															store.remove(selection);
6162
														}
6163
													}
6164
												}
6165
											});
6166
										}
6167
									}
6168
								}
6169
							]
6170
						}
6171
					],
6172
					columns: cols,
6173
					selType: checkSelection,
6174
					plugins: {
6175
						ptype: 'rowediting',
6176
						pluginId: 'rowEditing',
6177
						clicksToEdit: 0,
6178
						listeners: {}
6179
					}
6180
				}
6181
			]
6182
		});
6183
		me.callParent(arguments);
6184
	}
6185
});
6186
Ext.define('MinovaUtil.MinovaES.MinovaWorkflowEditableGrid1', {
6187
	extend: 'Ext.form.Panel',
6188
	alias: ['widget.minovaworkfloweditablegrid1', 'widget.workfloweditablegrid1'],
6189
	requires: [
6190
		'Ext.grid.plugin.CellEditing',
6191
		'Ext.grid.Panel',
6192
	],
6193
	anchor: '100%',
6194
	tableName: undefined,
6195
	hideButton: undefined,
6196
	multiSelect: undefined,
6197
	formname: this.name,
6198
	bizprocid: undefined,
6199
	bizflowid: undefined,
6200
	taskid: undefined,
6201
	initComponent: function () {
6202
		var me = this;
6203
		var hide_ = false;
6204
		var widthLock = 250;
6205
		var checkSelection = '';
6206

    
6207
		if (me.hideButton == true) {
6208
			hide_ = true;
6209
		}
6210
		if (me.multiSelect) {
6211
			locking = false;
6212
			checkSelection = 'checkboxmodel';
6213
			widthLock = 40;
6214
		}
6215
		var tableName = me.tableName;
6216
		var cols = [];
6217
		var fieldStore = [];
6218
		var _url = 'GetAllField';
6219
		var hasil = null;
6220
		var height = me.height;
6221
		var storeID = 'store' + me.tableName;
6222
		var gridName = 'grid' + me.name;
6223
		if (me.storeName) {
6224
			storeID = me.storeName;
6225
		}
6226
		var LangID = MinovaUtil.GetLangID();
6227
		var parameter = "LangID='" + LangID + "',BizProcessID='" + me.bizprocid + "',TaskID='" + me.taskid + "',TableName='" + me.tableName + "'";
6228
		Ext.Ajax.request({
6229
			async: false,
6230
			method: 'POST',
6231
			url: '/UserControl/GetStore',
6232
			params: {
6233
				tableName: 'PDSWFSTRUCTUREFIELD',
6234
				param: parameter
6235
			},
6236
			success: function (response) {
6237
				var results = Ext.decode(response.responseText);
6238
				hasil = results.data;
6239
			}
6240
		});
6241
		if (hasil.length > 0) {
6242
			Ext.each(hasil, function (rec) {
6243
				fieldStore.push(rec.FieldName)
6244
				var readonly = false;
6245
				var ishidden = false;
6246
				var allowblank = true;
6247
				if (rec.IsReadOnly == '1') {
6248
					readonly = true;
6249
				}
6250
				if (rec.IsRequired == '1') {
6251
					allowblank = false;
6252
				}
6253
				if (rec.IsVisible == '1') {
6254
					switch (rec.FormatRef) {
6255
					case "date":
6256
						cols.push({
6257
							xtype: 'minovadatecolumn',
6258
							text: rec.HeaderTitle,
6259
							dataIndex: rec.FieldName,
6260
							editor: {
6261
								allowBlank: allowblank,
6262
								xtype: 'datefield',
6263
								hideMode: 'visibility',
6264
								readOnly: readonly,
6265
								name: 'grid' + tableName + rec.FieldName,
6266
								id: 'grid' + tableName + rec.FieldName,
6267
								value: rec.DefaultValue,
6268
								formname: me.formname,
6269
								listeners: {
6270
									change: function (val) {
6271
										var _label = val.name;
6272
										var _form = val.formname;
6273
										var _Value = val.getValue();
6274
										var target = rec.TriggerCombo;
6275
										var custumFunc = rec.SelectFunction;
6276
										if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
6277
											Ext.Ajax.request({
6278
												async: false,
6279
												method: 'POST',
6280
												url: '/UserControl/GetStore',
6281
												params: {
6282
													tableName: 'PCMFUNC',
6283
													param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
6284
												},
6285
												success: function (response) {
6286
													var results = Ext.decode(response.responseText);
6287
													data_ = results.data[0];
6288
													if (data_ != undefined) {
6289
														custumFunc = data_.FunctionCode;
6290
													}
6291
												}
6292
											});
6293
										}
6294
										var frm = Ext.ComponentQuery.query('[name=' + _form + ']')[0];
6295
										if (frm) {
6296
											if (custumFunc) {
6297
												eval(custumFunc)
6298
											}
6299
										}
6300
									}
6301
								}
6302
							}
6303
						});
6304
						break;
6305
					case "amount":
6306
						cols.push({
6307
							xtype: 'minovacurrancycolumn',
6308
							align: 'right',
6309
							text: rec.HeaderTitle,
6310
							dataIndex: rec.FieldName,
6311
							editor: {
6312
								allowBlank: allowblank,
6313
								xtype: 'textfield',
6314
								readOnly: readonly,
6315
								name: 'grid' + tableName + rec.FieldName,
6316
								id: 'grid' + tableName + rec.FieldName,
6317
								value: rec.DefaultValue
6318
							}
6319
						});
6320
						break;
6321
					case "time":
6322
						cols.push({
6323
							text: rec.HeaderTitle,
6324
							dataIndex: rec.FieldName,
6325
							editor: {
6326
								allowBlank: allowblank,
6327
								xtype: 'timefield',
6328
								readOnly: readonly,
6329
								name: 'grid' + tableName + rec.FieldName,
6330
								id: 'grid' + tableName + rec.FieldName,
6331
								msgTarget: 'side',
6332
								format: 'Hi',
6333
								submitFormat: 'Hi',
6334
								increment: 5,
6335
								value: rec.DefaultValue,
6336
								formname: me.formname,
6337
								listeners: {
6338
									change: function (val) {
6339
										var _label = val.name;
6340
										var _form = val.formname;
6341
										var _Value = val.getValue();
6342
										var target = rec.TriggerCombo;
6343
										var custumFunc = rec.SelectFunction;
6344
										if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
6345
											Ext.Ajax.request({
6346
												async: false,
6347
												method: 'POST',
6348
												url: '/UserControl/GetStore',
6349
												params: {
6350
													tableName: 'PCMFUNC',
6351
													param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
6352
												},
6353
												success: function (response) {
6354
													var results = Ext.decode(response.responseText);
6355
													data_ = results.data[0];
6356
													if (data_ != undefined) {
6357
														custumFunc = data_.FunctionCode;
6358
													}
6359
												}
6360
											});
6361
										}
6362
										var frm = Ext.ComponentQuery.query('[name=' + _form + ']')[0];
6363
										if (frm) {
6364
											if (custumFunc) {
6365
												eval(custumFunc)
6366
											}
6367
										}
6368
									}
6369
								}
6370
							}
6371
						});
6372
						break;
6373
					default:
6374
						if (rec.SearchType != "") {
6375
							if (rec.SearchType == "0") {
6376
								var valueField = null;
6377
								var displayValue = null;
6378
								var TableRef = undefined;
6379
								if (rec.TableRef != '') {
6380
									TableRef = rec.TableRef;
6381
									Ext.Ajax.request({
6382
										async: false,
6383
										method: 'POST',
6384
										url: '/UserControl/GetStore',
6385
										params: {
6386
											tableName: 'SDATATABLEFIELD',
6387
											param: 'TableName[equal]' + rec.TableRef
6388
										},
6389
										success: function (response) {
6390
											var results = Ext.decode(response.responseText);
6391
											data_ = results.data;
6392
											if (data_ != undefined) {
6393
												valueField_ = $.grep(data_, function (r) {
6394
														return r.ValueField == '1'
6395
													});
6396
												valueField = valueField_[0].FieldName
6397
													displayValue_ = $.grep(data_, function (r) {
6398
														return r.DisplayValue == '1'
6399
													});
6400
												displayValue = displayValue_[0].FieldName
6401
											}
6402
										}
6403
									});
6404
								}
6405
								//create Store
6406
								Ext.create('Ext.data.Store', {
6407
									storeId: 'store_' + me.tableName + rec.FieldName,
6408
									autoLoad: true,
6409
									proxy: {
6410
										method: 'POST',
6411
										type: 'ajax',
6412
										url: '/UserControl/GetStore',
6413
										extraParams: {
6414
											tableName: TableRef,
6415
											param: rec.ParamCombo
6416
										},
6417
										reader: {
6418
											type: 'json',
6419
											root: 'data',
6420
											totalProperty: 'data[0].TotalCount'
6421
										}
6422
									}
6423
								});
6424
								cols.push({
6425
									xtype: 'minovacombocolumn',
6426
									text: rec.HeaderTitle,
6427
									dataIndex: rec.FieldName,
6428
									valueField: valueField,
6429
									displayField: displayValue,
6430
									store: 'store_' + me.tableName + rec.FieldName,
6431
									editor: {
6432
										allowBlank: allowblank,
6433
										xtype: 'combobox',
6434
										readOnly: readonly,
6435
										name: 'grid' + tableName + rec.FieldName,
6436
										id: 'grid' + tableName + rec.FieldName,
6437
										valueField: valueField,
6438
										displayField: displayValue,
6439
										store: 'store_' + me.tableName + rec.FieldName,
6440
										value: rec.DefaultValue,
6441
										formname: me.formname,
6442
										listeners: {
6443
											change: function (val) {
6444
												var _label = val.name;
6445
												var _form = val.formname;
6446
												var _Value = val.getValue();
6447
												var target = rec.TriggerCombo;
6448
												var custumFunc = rec.SelectFunction;
6449
												if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
6450
													Ext.Ajax.request({
6451
														async: false,
6452
														method: 'POST',
6453
														url: '/UserControl/GetStore',
6454
														params: {
6455
															tableName: 'PCMFUNC',
6456
															param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
6457
														},
6458
														success: function (response) {
6459
															var results = Ext.decode(response.responseText);
6460
															data_ = results.data[0];
6461
															if (data_ != undefined) {
6462
																custumFunc = data_.FunctionCode;
6463
															}
6464
														}
6465
													});
6466
												}
6467
												var frm = Ext.ComponentQuery.query('[name=' + _form + ']')[0];
6468
												if (frm) {
6469
													if (custumFunc) {
6470
														eval(custumFunc)
6471
													}
6472
												}
6473
											}
6474
										}
6475
									}
6476
								});
6477
							} else if (rec.SearchType == "2") {
6478
								cols.push({
6479
									text: rec.HeaderTitle,
6480
									dataIndex: rec.FieldName,
6481
									editor: {
6482
										xtype: 'minovalookupgrid',
6483
										allowBlank: allowblank,
6484
										readOnly: readonly,
6485
										msgTarget: 'side',
6486
										labelCls: 'label-minova',
6487
										labelWidth: 150,
6488
										name: 'grid' + tableName + rec.FieldName,
6489
										id: 'grid' + tableName + rec.FieldName,
6490
										tableName: rec.TableRef, //name tabel yang jadi ref-nya
6491
										triggerCls: 'x-form-search-trigger',
6492
										vtype: 'alphanum', // disable space
6493
										formtarget: me.formname, // nama form  yang akan di set value-nya
6494
										anchor: '100%',
6495
										formname: me.formname,
6496
										listeners: {
6497
											change: function (val) {
6498
												var _label = val.name;
6499
												var _form = val.formname;
6500
												var _Value = val.getValue();
6501
												var target = rec.TriggerCombo;
6502
												var custumFunc = rec.SelectFunction;
6503
												if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
6504
													Ext.Ajax.request({
6505
														async: false,
6506
														method: 'POST',
6507
														url: '/UserControl/GetStore',
6508
														params: {
6509
															tableName: 'PCMFUNC',
6510
															param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
6511
														},
6512
														success: function (response) {
6513
															var results = Ext.decode(response.responseText);
6514
															data_ = results.data[0];
6515
															if (data_ != undefined) {
6516
																custumFunc = data_.FunctionCode;
6517
															}
6518
														}
6519
													});
6520
												}
6521
												var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
6522
												if (frm) {
6523
													if (target) {
6524
														var f = frm.getForm().findField(target)
6525
															_store = f.getStore();
6526
														var _tbl = _store.proxy.extraParams.tableName;
6527
														var oldParam = _store.proxy.extraParams.param;
6528
														_store.proxy.extraParams = {
6529
															tableName: _tbl,
6530
															param: _label + '[=]' + _Value
6531
														};
6532
														_store.load();
6533
													}
6534
													if (custumFunc) {
6535
														eval(custumFunc)
6536
													}
6537

    
6538
												}
6539

    
6540
											},
6541

    
6542
										}
6543
									}
6544
								});
6545
							} else if (rec.SearchType == "3") {
6546
								cols.push({
6547
									text: rec.HeaderTitle,
6548
									dataIndex: rec.FieldName,
6549
									editor: {
6550
										xtype: 'minovalookuptree',
6551
										allowBlank: allowblank,
6552
										fieldLabel: rec.ScreenCaption,
6553
										readOnly: readonly,
6554
										labelCls: 'label-minova',
6555
										labelWidth: 150,
6556
										name: 'grid' + tableName + rec.FieldName,
6557
										id: 'grid' + tableName + rec.FieldName,
6558
										msgTarget: 'side',
6559
										triggerCls: 'x-form-search-trigger',
6560
										treeSructure: rec.SearchFunction, //'O-O-P',
6561
										objClassValue: rec.ParamCombo, //'O',
6562
										formname: me.formname,
6563
										targetField: rec.FieldName,
6564
										anchor: '100%',
6565
										listeners: {
6566
											change: function (val) {
6567
												var _label = val.name;
6568
												var _form = val.formname;
6569
												var _Value = val.getValue();
6570
												var target = rec.TriggerCombo;
6571
												var custumFunc = rec.SelectFunction;
6572
												if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
6573
													Ext.Ajax.request({
6574
														async: false,
6575
														method: 'POST',
6576
														url: '/UserControl/GetStore',
6577
														params: {
6578
															tableName: 'PCMFUNC',
6579
															param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
6580
														},
6581
														success: function (response) {
6582
															var results = Ext.decode(response.responseText);
6583
															data_ = results.data[0];
6584
															if (data_ != undefined) {
6585
																custumFunc = data_.FunctionCode;
6586
															}
6587
														}
6588
													});
6589
												}
6590
												var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
6591
												if (frm) {
6592

    
6593
													if (target) {
6594
														var f = frm.getForm().findField(target)
6595
															_store = f.getStore();
6596
														var _tbl = _store.proxy.extraParams.tableName;
6597
														var oldParam = _store.proxy.extraParams.param;
6598
														_store.proxy.extraParams = {
6599
															tableName: _tbl,
6600
															param: _label + '[=]' + _Value
6601
														};
6602
														_store.load();
6603
													}
6604
													if (custumFunc) {
6605
														eval(custumFunc)
6606
													}
6607
												}
6608
											}
6609
										}
6610
									}
6611
								});
6612
							} else if (rec.SearchType == "4") {
6613
								cols.push({
6614
									text: rec.HeaderTitle,
6615
									dataIndex: rec.FieldName,
6616
									editor: {
6617
										xtype: 'lookupemployee',
6618
										allowBlank: allowblank,
6619
										fieldLabel: rec.ScreenCaption,
6620
										readOnly: readonly,
6621
										labelCls: 'label-minova',
6622
										name: 'grid' + tableName + rec.FieldName,
6623
										id: 'grid' + tableName + rec.FieldName,
6624
										msgTarget: 'side',
6625
										fieldname: rec.FieldName,
6626
										tableName: rec.TableRef, //name tabel yang jadi ref-nya
6627
										triggerCls: 'x-form-search-trigger',
6628
										vtype: 'alphanum', // disable space
6629
										formtarget: formname, // nama form  yang akan di set value-nya
6630
										isLookup: isLookup,
6631
										anchor: '100%',
6632
										formname: formname,
6633
										listeners: {
6634
											change: function (val) {
6635
												var _label = val.name;
6636
												var _form = val.formname;
6637
												var _Value = val.getValue();
6638
												var target = rec.TriggerCombo;
6639
												var custumFunc = rec.SelectFunction;
6640
												if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
6641
													Ext.Ajax.request({
6642
														async: false,
6643
														method: 'POST',
6644
														url: '/UserControl/GetStore',
6645
														params: {
6646
															tableName: 'PCMFUNC',
6647
															param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
6648
														},
6649
														success: function (response) {
6650
															var results = Ext.decode(response.responseText);
6651
															data_ = results.data[0];
6652
															if (data_ != undefined) {
6653
																custumFunc = data_.FunctionCode;
6654
															}
6655
														}
6656
													});
6657
												}
6658
												var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
6659
												if (frm) {
6660

    
6661
													if (target) {
6662
														var f = frm.getForm().findField(target)
6663
															_store = f.getStore();
6664
														var _tbl = _store.proxy.extraParams.tableName;
6665
														var oldParam = _store.proxy.extraParams.param;
6666
														_store.proxy.extraParams = {
6667
															tableName: _tbl,
6668
															param: _label + '[=]' + _Value
6669
														};
6670
														_store.load();
6671
													}
6672
													if (custumFunc) {
6673
														eval(custumFunc)
6674
													}
6675

    
6676
												}
6677

    
6678
											},
6679

    
6680
										},
6681
									}
6682
								});
6683
							}
6684
						} else {
6685
							if (rec.FixedValue != "") {
6686
								var storeData = [];
6687
								var str = rec.FixedValue;
6688
								var hasil = str.split('||');
6689
								hasil.forEach(function (h) {
6690
									store_ = h.split('=')
6691
										storeData.push({
6692
											code: store_[0],
6693
											desc: store_[1],
6694
										});
6695
								});
6696
								cols.push({
6697
									xtype: 'minovacombocolumn',
6698
									text: rec.HeaderTitle,
6699
									dataIndex: rec.FieldName,
6700
									valueField: valueField,
6701
									displayField: displayValue,
6702
									store: Ext.create('Ext.data.Store', {
6703
										storeId: 'store' + rec.FieldName,
6704
										autoLoad: true,
6705
										data: storeData
6706

    
6707
									}),
6708
									editor: {
6709
										xtype: 'combobox',
6710
										allowBlank: allowblank,
6711
										forceSelection: true,
6712
										readOnly: readonly,
6713
										labelCls: 'label-minova',
6714
										labelWidth: 150,
6715
										name: 'grid' + tableName + rec.FieldName,
6716
										id: 'grid' + tableName + rec.FieldName,
6717
										msgTarget: 'side',
6718
										value: rec.DefaultValue,
6719
										anchor: '100%',
6720
										formname: me.formname,
6721
										formtarget: me.formname,
6722
										store: Ext.create('Ext.data.Store', {
6723
											storeId: 'store' + rec.FieldName,
6724
											autoLoad: true,
6725
											data: storeData
6726

    
6727
										}),
6728
										listeners: {
6729
											change: function (val) {
6730
												var _label = val.name;
6731
												var _form = val.formtarget;
6732
												var _Value = val.getValue();
6733
												var target = rec.TriggerCombo;
6734
												var custumFunc = rec.SelectFunction;
6735
												var frm = Ext.ComponentQuery.query('form[name=' + _form + ']')[0];
6736
												if (frm) {
6737
													if (target) {
6738
														var f = frm.getForm().findField(target)
6739
															_store = f.getStore();
6740
														var _tbl = _store.proxy.extraParams.tableName;
6741
														var oldParam = _store.proxy.extraParams.param;
6742
														_store.proxy.extraParams = {
6743
															tableName: _tbl,
6744
															param: _label + '[=]' + _Value
6745
														};
6746
														_store.load();
6747
													}
6748
													if (custumFunc) {
6749
														eval(custumFunc)
6750
													}
6751
												}
6752
											}
6753
										},
6754
										queryMode: 'local',
6755
										valueField: 'code',
6756
										displayField: 'desc',
6757
									}
6758
								})
6759
							} else {
6760
								cols.push({
6761
									text: rec.HeaderTitle,
6762
									dataIndex: rec.FieldName,
6763
									editor: {
6764
										allowBlank: allowblank,
6765
										xtype: 'textfield',
6766
										readOnly: readonly,
6767
										name: 'grid' + tableName + rec.FieldName,
6768
										id: 'grid' + tableName + rec.FieldName,
6769
										value: rec.DefaultValue
6770
									}
6771
								});
6772
							}
6773
						}
6774
						break;
6775
					}
6776
				} else {
6777
					cols.push({
6778
						text: rec.HeaderTitle,
6779
						dataIndex: rec.FieldName,
6780
						hidden: true,
6781
						editor: {
6782
							allowBlank: true,
6783
							xtype: 'textfield',
6784
							readOnly: false,
6785
							name: 'grid' + tableName + rec.FieldName,
6786
							id: 'grid' + tableName + rec.FieldName,
6787
						}
6788
					});
6789
				}
6790
			});
6791
		};
6792

    
6793
		this.editing = Ext.create('Ext.grid.plugin.CellEditing');
6794
		Ext.applyIf(me, {
6795
			items: [{
6796
					xtype: 'grid',
6797
					id: gridName,
6798
					name: gridName,
6799
					height: height,
6800
					store: Ext.create('Ext.data.Store', {
6801
						storeId: storeID,
6802
						fields: fieldStore,
6803
						proxy: {
6804
							method: 'POST',
6805
							type: 'ajax',
6806
							url: '',
6807
							reader: {
6808
								type: 'json',
6809
								root: 'data'
6810
							}
6811
						}
6812
					}),
6813
					dockedItems: [{
6814
							xtype: 'toolbar',
6815
							items: [{
6816
									text: 'Add',
6817
									hidden: hide_,
6818
									name: tableName + 'Add',
6819
									iconCls: 'fa-plus-circle',
6820
									style: 'font-family: FontAwesome',
6821
									handler: function () {
6822
										var store = Ext.StoreMgr.lookup(storeID)
6823
											idx = store.getCount();
6824
										var action = getParam('action');
6825
										var data = '';
6826
										var Sequence = 0;
6827
										if (idx == 0) {
6828
											Sequence = 1;
6829
										} else {
6830
											Sequence = 1 + idx;
6831
										}
6832
										data = {
6833
											Sequence: Sequence
6834
										};
6835
										store.insert(idx, data);
6836
									}
6837
								}, {
6838
									text: 'Delete',
6839
									hidden: hide_,
6840
									name: tableName + 'DeleteText',
6841
									iconCls: 'fa-trash-o',
6842
									style: 'font-family: FontAwesome',
6843
									handler: function () {
6844
										var me = this,
6845
										store = Ext.StoreMgr.lookup(storeID);
6846
										var grid = Ext.getCmp(gridName);
6847
										Ext.MessageBox.show({
6848
											title: 'Remove tab',
6849
											msg: "This will remove. Do you want to continue?",
6850
											buttons: Ext.MessageBox.YESNO,
6851
											fn: function (choice) {
6852
												console.log(choice);
6853
												if (choice === 'yes') {
6854
													var selection = grid.getView().getSelectionModel().getSelection()[0];
6855
													if (selection) {
6856
														store.remove(selection);
6857
													}
6858
												}
6859
											}
6860
										});
6861
									}
6862
								}
6863
							]
6864
						}
6865
					],
6866
					columns: cols,
6867
					selType: checkSelection,
6868
					plugins: [this.editing],
6869
					// plugins: {
6870
					// ptype: 'rowediting',
6871
					// pluginId: 'rowEditing',
6872
					// clicksToEdit: 0,
6873
					// listeners: {
6874
					// }
6875
					// }
6876
				}
6877
			]
6878
		});
6879
		me.callParent(arguments);
6880
	}
6881
});
6882
Ext.define('MinovaUtil.MinovaES.MinovaForm', {
6883
	extend: 'Ext.form.Panel',
6884
	alias: ['widget.minovaForm', 'widget.minovaform'],
6885
	tableName: undefined,
6886
	param: undefined,
6887
	titleform: undefined,
6888
	formname: this.name,
6889
	isLookup: undefined,
6890
	hidebutton: undefined,
6891
	//frame: true,
6892
	resizable: true,
6893
	border: false,
6894
	autoScroll: true,
6895
	minHeight: 20,
6896
	layout: 'column',
6897
	submitproc: undefined, //true if stil edit ,add
6898
	actionsubmit: undefined,
6899
	iseditform: undefined,
6900
	isFormReadOnly: undefined, // true== form di read only default false
6901
	isDisplay: undefined, // true if display only and false or undefined or empety if form can be edit
6902
	searchcustomization: undefined,
6903
	getIsFormReadOnly: function () {
6904
		return this.isFormReadOnly;
6905
	},
6906
	setIsFormReadOnly: function (value) {
6907
		var me = this;
6908
		me.isFormReadOnly = value;
6909
		return me;
6910
	},
6911
	getIsEditform: function () {
6912
		return this.iseditform;
6913
	},
6914
	setIsEditform: function (value) {
6915
		var me = this;
6916
		me.iseditform = value;
6917
		return me;
6918
	},
6919
	getActionSubmit: function () {
6920
		return this.actionsubmit;
6921
	},
6922
	setActionSubmit: function (value) {
6923
		var me = this;
6924
		me.actionsubmit = value;
6925
		return me;
6926
	},
6927
	getSubmitProc: function () {
6928
		return this.submitnproc;
6929
	},
6930
	setSubmitProc: function (value) {
6931
		var me = this;
6932
		me.submitnproc = value;
6933
		return me;
6934
	},
6935
	listeners: {
6936
		render: function () {
6937
			if (this.isLookup == 1 || this.isLookup == 'Y' || this.hidebutton == 1 || this.hidebutton == 'Y') {
6938
				var v = Ext.ComponentQuery.query('[name=formLookupFilter]')[0];
6939
				if (v) {
6940
					v.setMaxHeight(200);
6941
				}
6942

    
6943
			}
6944
			if (this.titleform != undefined) {
6945
				this.setTitle(this.titleform);
6946
			}
6947
		},
6948

    
6949
	},
6950
	defaults: {
6951
		layout: 'form',
6952
		xtype: 'container',
6953
		defaultType: 'textfield',
6954
		style: 'width: 50%',
6955
		//height: 1000
6956
	},
6957
	initComponent: function () {
6958
		var col1 = [];
6959
		var col2 = [];
6960
		var me = this;
6961
		LangID = localStorage.LangId;
6962
		isLookup = me.isLookup;
6963
		//var _url = 'GetAllField';
6964

    
6965
		if (isLookup == 1 || isLookup == true || isLookup == 'Y') {}
6966
		isDisplay = me.isDisplay;
6967
		var hasil = null;
6968
		//hamid 200916
6969
		//Ext.Ajax.request({
6970
		//	async : false,
6971
		//	method : 'POST',
6972
		//	url : '/Devt/' + _url + '?tableName=' + me.tableName,
6973
		//	success : function (response) {
6974
		//		var results = Ext.decode(response.responseText);
6975
		//		hasil = results.data;
6976
		//	}
6977
		//});
6978
		//end
6979

    
6980

    
6981
		//hamid
6982
		//if (me.isLookup == 1 || isLookup == true || isLookup == 'Y') {
6983
		parameter = null;
6984
		if (me.isLookup == true || isLookup == 1 || isLookup == 'Y') {
6985
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupFilter='1'"
6986
		} else if (me.searchcustomization == true) {
6987
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',IsCustomizationFilter='1'"
6988
		} else {
6989
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
6990
		}
6991
		Ext.Ajax.request({
6992
			async: false,
6993
			method: 'POST',
6994
			url: '/UserControl/GetStore',
6995
			params: {
6996
				tableName: 'PDSBS0007',
6997
				param: parameter
6998
			},
6999
			success: function (response) {
7000
				var results = Ext.decode(response.responseText);
7001
				hasil = results.data;
7002
			}
7003
		});
7004
		//end
7005
		if (hasil.length > 0) {
7006
			// hasil = hasil.sort(MinovaUtil.SortBy("Sequence"))
7007
			var me = this;
7008
			Ext.each(hasil, function (rec) {
7009
				var null_ = null;
7010
				if (rec.IsPrimaryKey == true) {
7011
					null_ = false;
7012
				}
7013
				if (rec.IsRequired == true) {
7014
					null_ = false;
7015
				} else {
7016
					null_ = true;
7017
				}
7018
				var formfield = MinovaUtil.FieldGenerator.Form(me.name, rec, null_, isDisplay, me.tableName, me.isLookup);
7019
				var descField = undefined;
7020
				//if (isDisplay == true && rec.SearchType !='') {
7021
				//    descField = new Ext.form.Display({
7022
				//        fieldCode:'codeDisplay'+rec.name+rec.tableName,
7023
				//        allowBlank: true,
7024
				//        fieldLabel: 'Desc ' + rec.ScreenCaption,
7025
				//        readOnly: true,
7026
				//        maxLength: rec.Length,
7027
				//        anchor: '100%',
7028
				//        submitValue: false
7029
				//    });
7030
				//}
7031
				//else {
7032
				//    if (rec.SearchType == '2') {// lookup
7033
				//        descField = new Ext.form.TextField({
7034
				//            fieldCode: 'codeEdit' + rec.name + rec.tableName,
7035
				//            allowBlank: true,
7036
				//            fieldLabel: 'Desc ' + rec.ScreenCaption,
7037
				//            readOnly: true,
7038
				//            maxLength: rec.Length,
7039
				//            anchor: '100%',
7040
				//            submitValue: false
7041
				//        });
7042
				//    }
7043
				//    if (rec.SearchType == '3') {// tree
7044
				//        descField = new Ext.form.TextField({
7045
				//            fieldCode: 'codeEdit' + rec.name + rec.tableName,
7046
				//            allowBlank: true,
7047
				//            fieldLabel: 'Desc ' + rec.ScreenCaption,
7048
				//            readOnly: true,
7049
				//            maxLength: rec.Length,
7050
				//            anchor: '100%',
7051
				//            submitValue: false
7052
				//        });
7053
				//    }
7054
				//    if (rec.SearchType == '4' && me.isLookup != true) {
7055
				//        descField = new Ext.form.TextField({
7056
				//            fieldCode: 'codeEdit' + rec.name + rec.tableName,
7057
				//            allowBlank: true,
7058
				//            fieldLabel: 'Full Name',
7059
				//            readOnly: true,
7060
				//            maxLength: rec.Length,
7061
				//            anchor: '100%',
7062
				//            submitValue: false
7063
				//        });
7064
				//    }
7065

    
7066
				//}
7067

    
7068
				if (me.isLookup == true || isLookup == 1 || isLookup == 'Y') {
7069
					col1.push(formfield);
7070
					if (descField) {
7071
						col1.push(descField)
7072
					}
7073
				} else {
7074
					if (isDesk) {
7075
						if (rec.ColumnNo == 1) {
7076
							col1.push(formfield);
7077
							if (descField) {
7078
								col1.push(descField)
7079
							}
7080
						} else {
7081
							col2.push(formfield);
7082
							if (descField) {
7083
								col2.push(descField)
7084
							}
7085
						}
7086
					} else {
7087
						col1.push(formfield);
7088
						if (descField) {
7089
							col1.push(descField)
7090
						}
7091
					}
7092

    
7093
				}
7094

    
7095
				if (rec.IsPrimaryKey == 1 && me.isLookup == undefined) {
7096
					formfieldKey = new Ext.form.TextField({
7097
							hidden: true,
7098
							name: "Key_" + rec.FieldName,
7099
						});
7100
					col2.push(formfieldKey);
7101
				}
7102

    
7103
			});
7104
			//console.log(col1);
7105
		}
7106
		Ext.applyIf(me, {
7107
			items: [{
7108
					//width: 450,
7109
					style: 'width: 50%',
7110
					items: col1
7111
				}, {
7112
					//width: 450,
7113
					style: 'width: 50%',
7114
					items: col2
7115
				}
7116
			],
7117
		});
7118
		this.callParent();
7119
	}
7120
});
7121

    
7122
Ext.define('MinovaUtil.MinovaES.MinovaGridForm', {
7123
	extend: 'Ext.form.Panel',
7124
	alias: ['widget.minovagridform', 'widget.MinovaGridForm'],
7125
	tableName: undefined, //nama tabel
7126
	param: undefined, //param query
7127
	pagesize: undefined,
7128
	storename: undefined,
7129
	titleform: undefined,
7130
	titlegrid: undefined,
7131
	heightgrid: undefined,
7132
	heightform: undefined,
7133
	iseditform: undefined,
7134
	lastheightform: undefined,
7135
	layoutType: undefined,
7136
	lastpage: undefined,
7137
	lastTitle: undefined,
7138
	getLastTitle: function () {
7139
		return this.lastTitle;
7140
	},
7141
	setLastTitle: function (value) {
7142
		var me = this;
7143
		me.lastTitle = value;
7144
		return me;
7145
	},
7146
	getLastpage: function () {
7147
		return this.lastpage;
7148
	},
7149
	setLastpage: function (value) {
7150
		var me = this;
7151
		me.lastpage = value;
7152
		return me;
7153
	},
7154
	getLayoutType: function () {
7155
		return this.layoutType;
7156
	},
7157
	setLayoutType: function (value) {
7158
		var me = this;
7159
		me.layoutType = value;
7160
		return me;
7161
	},
7162
	getLastheightform: function () {
7163
		return this.lastheightform;
7164
	},
7165
	setLastheightform: function (value) {
7166
		var me = this;
7167
		me.lastheightform = value;
7168
		return me;
7169
	},
7170

    
7171
	getIsEditform: function () {
7172
		return this.iseditform;
7173
	},
7174
	setIsEditform: function (value) {
7175
		var me = this;
7176
		me.iseditform = value;
7177
		return me;
7178
	},
7179
	initComponent: function () {
7180
		var me = this;
7181
		var storename = me.storename;
7182
		if (storename == "" || storename == undefined) {
7183
			storename = "store" + me.tableName;
7184
		}
7185
		var tableName = me.tableName;
7186
		Ext.applyIf(me, {
7187
			items: [{
7188
					layoutType: "MinovaGridForm",
7189
					title: me.titlegrid,
7190
					xtype: "minovagrid",
7191
					tableName: tableName, // nama tebel/dataset
7192
					name: "MinovaGridFormGrid" + tableName, //name bebeas
7193
					param: me.param, // parameter filteran
7194
					pagesize: me.pagesize, // jumlah record yang muncul per page
7195
					storename: storename, //nama store bebas
7196
					isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
7197
					height: 330,
7198
					bodyPadding: 0,
7199
					dockedItems: [{
7200
							xtype: 'pagingtoolbar',
7201
							store: storename, // harus sama dengan naa store diatas
7202
							dock: 'bottom', //posisi paging
7203
							pageSize: me.pagesize,
7204
							displayInfo: true
7205
						}
7206
					],
7207

    
7208
					listeners: {
7209
						viewready: function () {
7210
							//alert('ready')
7211
							var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + this.tableName + ']')[0];
7212
							formEdit.setHidden(true);
7213

    
7214
							if (MinovaUtil.GetActionMenu() == 0 || MinovaUtil.GetActionMenu() == undefined || MinovaUtil.GetActionMenu() == "") {
7215
								Ext.ComponentQuery.query('[name=actionBtn]')[0].setHidden(true)
7216
								Ext.ComponentQuery.query('[name=Edit' + me.tableName + ']')[0].setHidden(true)
7217
								Ext.ComponentQuery.query('[name=Delete_]')[0].setHidden(true)
7218
							} else {
7219
								Ext.ComponentQuery.query('[name=actionBtn]')[0].setHidden(false)
7220
								//Ext.ComponentQuery.query('[name=Edit_]')[0].setHidden(true)
7221
								Ext.ComponentQuery.query('[name=Delete_]')[0].setHidden(true)
7222
								Ext.ComponentQuery.query('[name=Edit' + me.tableName + ']')[0].setHidden(false)
7223
							}
7224
						},
7225
						selectionchange: function () {
7226
							//case md
7227
							var layout = null;
7228
							var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
7229
							if (pnl) {
7230
								layout = pnl.getLayoutType();
7231

    
7232
							}
7233
							//end case
7234

    
7235
							if (layout == 'L003') {
7236
								var selection = this.getView().getSelectionModel().getSelection()[0];
7237
								var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + this.tableName + ']')[0];
7238
								var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + this.tableName + ']')[0];
7239
								if (selection) {
7240
									formDisplay.getForm().setValues(selection.data);
7241
									formEdit.getForm().setValues(selection.data);
7242
								}
7243

    
7244
							}
7245
						},
7246
						itemdblclick: function () {
7247
							var me = this;
7248
							//case md
7249
							var layout = null;
7250
							var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
7251
							if (pnl) {
7252
								layout = pnl.getLayoutType();
7253

    
7254
							} else {
7255
								pnl = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
7256
								layout = pnl.getLayoutType();
7257
							}
7258
							//end case
7259
							var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + this.tableName + ']')[0];
7260
							var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + this.tableName + ']')[0];
7261
							var submit_ = formEdit.getSubmitProc();
7262
							var selection = me.getView().getSelectionModel().getSelection()[0];
7263
							if (submit_ == undefined) {
7264
								submit_ = false;
7265
							}
7266
							if (submit_ == false) {
7267

    
7268
								formDisplay.getForm().setValues(selection.data);
7269
								formEdit.getForm().setValues(selection.data);
7270
								if (layout == 'L003') {
7271
									formDisplay.setHidden(false);
7272
									Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + this.tableName + ']')[0].setHidden(true);
7273
									var heigh = pnl.getLastheightform();
7274

    
7275
									var pDetail = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
7276
										if (pDetail) {
7277
											pDetail.setHeight(heigh + 100);
7278
										} else {
7279
											pDetail = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0];
7280
											var mainPnl_ = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]
7281
												var mainPnl = mainPnl_.getHeight();
7282
											//pDetail.setHeight(mainPnl + 100);
7283

    
7284
										}
7285
								} else {
7286
									formDisplay.setTitle("View")
7287
									formEdit.setTitle("Edit")
7288
								}
7289
							} else {
7290
								alert('still process')
7291
							}
7292

    
7293
						},
7294
						beforeedit: function () {
7295
							return false;
7296
						}
7297
					}
7298
				}, {
7299
					xtype: 'minovaform',
7300
					name: "MinovaGridFormDisplay" + tableName,
7301
					tableName: tableName, // nama tabel /dataset
7302
					isLookup: '', // 1 or 'Y' for lookup
7303
					isDisplay: true, // true== form is displayfield
7304
					buttons: [{
7305
							text: 'Edit',
7306
							name: 'Edit' + tableName,
7307
							iconCls: 'fa-edit',
7308
							style: 'font-family: FontAwesome',
7309
							handler: function () {
7310

    
7311
								f = this.up().up();
7312
								f.setSubmitProc(false);
7313
								f.setHidden(true);
7314
								//f.setActionSubmit(1);
7315
								Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(true);
7316
								var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0];
7317
								formEdit.setSubmitProc(true);
7318
								formEdit.setHidden(false);
7319
								formEdit.setActionSubmit(1);
7320
								var p = Ext.ComponentQuery.query('[name=DetailMD]')[0];
7321
								if (p) {
7322
									var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
7323
									var lastTitile = p.getTitle();
7324
									pnl.setLastTitle(lastTitile);
7325
									p.setTitle('Edit - ' + lastTitile)
7326

    
7327
								}
7328

    
7329
							}
7330
						}, {
7331
							text: 'Back to Grid',
7332
							name: 'Edit' + tableName,
7333
							iconCls: 'fa-reply',
7334
							style: 'font-family: FontAwesome',
7335
							handler: function () {
7336
								var layout = null;
7337
								var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
7338
								if (pnl) {
7339
									layout = pnl.getLayoutType();
7340

    
7341
								}
7342

    
7343
								f = this.up().up();
7344
								f.setSubmitProc(false);
7345
								f.setHidden(true);
7346
								Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(false);
7347
								Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0].setHidden(true);
7348

    
7349
								if (layout == 'L003') {
7350
									var grid_ = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + f.tableName + ']')[0];
7351
									grid_.setHidden(false);
7352
									Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(true);
7353
									Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(grid_.getHeight() + 100)
7354
								}
7355
							}
7356
						}
7357
					],
7358
				}, {
7359
					xtype: 'minovaform',
7360
					name: "MinovaGridFormEdit" + tableName,
7361
					tableName: tableName, // nama tabel /dataset
7362
					isLookup: '', // 1 or 'Y' for lookup
7363
					isDisplay: false, // true== form is displayfield
7364
					buttons: [{
7365
							text: 'Save',
7366
							name: 'btnSaveMD',
7367
							name: 'Save' + tableName,
7368
							iconCls: 'fa-save',
7369
							style: 'font-family: FontAwesome',
7370
							handler: function () {
7371
								f = this.up().up();
7372
								var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0];
7373

    
7374
								if (formEdit.getForm().isValid()) {
7375

    
7376
									if (Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0]) {
7377
										var action_ = formEdit.getActionSubmit();
7378
										var main_ = Ext.ComponentQuery.query('[name=mainORM]')[0];
7379
										var record = main_.getRecordSelect();
7380

    
7381
										if (record == undefined) {
7382
											var treeDetail = Ext.ComponentQuery.query('[name=treeDetail]')[0];
7383
											treeDetail.getSelectionModel().select(0);
7384
											record = treeDetail.getView().getSelectionModel().getSelection()[0];
7385

    
7386
										}
7387
										var frmValue = formEdit.getValues();
7388
										var InitStartDate = 'InitStartDate';
7389
										var InitStartDateValue = record.get('StartDate');
7390
										frmValue[InitStartDate] = InitStartDateValue;
7391

    
7392
										var InitEndDate = 'InitEndDate';
7393
										var InitEndDateValue = record.get('EndDate');
7394
										frmValue[InitEndDate] = InitEndDateValue;
7395

    
7396
										var InitParentObject = 'InitParentObject';
7397
										var InitParentObjectValue = record.get('ObjectId');
7398
										if (InitParentObjectValue == undefined) {
7399
											InitParentObjectValue = "";
7400
										}
7401
										frmValue[InitParentObject] = InitParentObjectValue;
7402

    
7403
										var InitParentClass = 'InitParentClass';
7404
										var InitParentClassValue = record.get('ObjectType');
7405
										if (InitParentClassValue == undefined) {
7406
											InitParentClassValue = "";
7407
										}
7408
										frmValue[InitParentClass] = InitParentClassValue;
7409
										var frmValue_ = Ext.encode(frmValue);
7410

    
7411
										Ext.Ajax.request({
7412
											method: 'POST',
7413
											url: '/Devt/SaveMaintainORM',
7414
											params: {
7415
												tableName: f.tableName,
7416
												data: frmValue_,
7417
												action: action_,
7418
												/*
7419
												InitStartDate: InitStartDate,
7420
												InitEndaDate: InitEndaDate,
7421
												InitParentObject: InitParentObject,
7422
												InitParentClass: InitParentClass
7423
												 */
7424
											},
7425
											waitMsg: 'Saving Data...',
7426
											success: function (response) {
7427
												var result = Ext.decode(response.responseText);
7428
												if (result.success) {
7429
													MinovaMessage('Not Null', '000006', '', 'S')
7430

    
7431
													var pnl = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
7432
													if (pnl) {
7433
														Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0].setHeight(394);
7434
														layout = pnl.getLayoutType();
7435
														pnl.setLastpage(undefined);
7436
														var last = 'MinovaGridFormGrid' + f.tableName;
7437
														var grid_ = Ext.ComponentQuery.query('[name=' + last + ']')[0]
7438

    
7439
															var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0];
7440
														formEdit.setSubmitProc(false);
7441
														formEdit.setHidden(true);
7442
														grid_.setHidden(false);
7443
														grid_.getStore().reload()
7444

    
7445
													}
7446
													if (layout == 'L003') {
7447
														var grid_ = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + f.tableName + ']')[0];
7448
														grid_.setHidden(false);
7449
														Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(true);
7450
														var detail = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
7451
															if (detail) {
7452
																detail.setHeight(grid_.getHeight() + 100)
7453
															} else {
7454
																var p = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
7455
																var p_ = Ext.ComponentQuery.query('[name=DetailMD]')[0];
7456
																p_.setTitle(p.getLastTitle());
7457
															}
7458

    
7459
													}
7460

    
7461
												} else {
7462
													MinovaMessage('Not Null', '000005', result.message.text, 'E')
7463
												}
7464
												var grid = Ext.ComponentQuery.query('[name=gridMenuMDOrm]')[0];
7465
												var s = grid.getStore();
7466
												s.removeAll();
7467
												var ObjectType = getParam("ObjectType");
7468
												var Lang = null;
7469
												Ext.Ajax.request({
7470
													async: false,
7471
													method: 'POST',
7472
													url: '/Devt/GetLangID',
7473
													success: function (response) {
7474
														Lang = response.responseText;
7475
													}
7476
												});
7477
												Ext.Ajax.request({
7478
													async: true,
7479
													method: 'POST',
7480
													url: '/UserControl/GetStore',
7481
													params: {
7482
														tableName: 'PHRCM0006',
7483
														param: 'Language[equal]' + Lang + ',ObjectClass[equal]' + ObjectType
7484

    
7485
													},
7486
													success: function (response) {
7487
														var results = Ext.decode(response.responseText);
7488
														var data_ = results.data;
7489
														s.loadData(results.data);
7490
														// console.log(data_)
7491
													}
7492
												});
7493
											},
7494
											failure: function (response) {
7495
												var result = Ext.decode(response.responseText);
7496
												console.log(result);
7497
											}
7498
										});
7499
									} else {
7500
										var frmValue = Ext.encode(formEdit.getValues());
7501
										Ext.Ajax.request({
7502
											method: 'POST',
7503
											url: '/Devt/SaveTable',
7504
											params: {
7505
												tableName: f.tableName,
7506
												data: frmValue,
7507
												action: formEdit.getActionSubmit()
7508
											},
7509
											waitMsg: 'Saving Data...',
7510
											success: function (response) {
7511
												var result = Ext.decode(response.responseText);
7512
												if (result.success) {
7513
													MinovaMessage('Not Null', '000006', '', 'S')
7514

    
7515
													var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
7516

    
7517
													if (pnl) {
7518
														Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(394);
7519
														layout = pnl.getLayoutType();
7520
														pnl.setLastpage(undefined);
7521
														var last = 'MinovaGridFormGrid' + f.tableName;
7522
														var grid_ = Ext.ComponentQuery.query('[name=' + last + ']')[0]
7523

    
7524
															var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0];
7525
														formEdit.setSubmitProc(false);
7526
														formEdit.setHidden(true);
7527
														grid_.setHidden(false);
7528
														grid_.getStore().reload()
7529
														var mpnl = Ext.ComponentQuery.query('[name=DetailMD]')[0]
7530
															mpnl.setTitle(pnl.getLastTitle());
7531

    
7532
													}
7533
													if (layout == 'L003') {
7534
														var grid_ = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + f.tableName + ']')[0];
7535
														grid_.setHidden(false);
7536
														Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(true);
7537
														Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(grid_.getHeight() + 100)
7538
													}
7539

    
7540
												} else {
7541
													MinovaMessage('Not Null', '000005', result.message.text, 'E')
7542
												}
7543
											},
7544
											failure: function (response) {
7545
												var result = Ext.decode(response.responseText);
7546
												//console.log(result);
7547
											}
7548
										});
7549
									}
7550

    
7551
								}
7552
							}
7553
						}, {
7554
							text: 'Delete',
7555
							iconCls: 'fa-trash-o',
7556
							name: 'Delete',
7557
							style: 'font-family: FontAwesome',
7558
							action: 'CRUDdelete',
7559
							handler: function () {
7560
								//add fungsi Delete
7561
								f = this.up().up();
7562
								var formEdit = Ext.ComponentQuery.query('[name=MinovaGridFormEdit' + f.tableName + ']')[0];
7563
								var frmValue = Ext.encode(formEdit.getValues());
7564
								if (formEdit.getForm().isValid()) {
7565
									Ext.Ajax.request({
7566
										method: 'POST',
7567
										url: '/Devt/SaveTable',
7568
										params: {
7569
											tableName: f.tableName,
7570
											data: frmValue,
7571
											action: 2
7572
										},
7573
										waitMsg: 'Saving Data...',
7574
										success: function (response) {
7575
											var result = Ext.decode(response.responseText);
7576
											if (result.success) {
7577
												MinovaMessage('Not Null', '000006', '', 'S')
7578

    
7579
												var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
7580
												if (pnl) {
7581
													layout = pnl.getLayoutType();
7582
													pnl.setLastpage(undefined);
7583

    
7584
												}
7585
												if (layout == 'L003') {
7586
													var grid_ = Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + f.tableName + ']')[0];
7587
													grid_.setHidden(false);
7588
													Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(true);
7589
													Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(grid_.getHeight() + 100)
7590
												}
7591

    
7592
											} else {
7593
												MinovaMessage('Not Null', '000005', result.message.text, 'E')
7594
											}
7595
										},
7596
										failure: function (response) {
7597
											var result = Ext.decode(response.responseText);
7598
											//console.log(result);
7599
										}
7600
									});
7601
								}
7602
							}
7603

    
7604
						}, {
7605
							text: 'Cancel',
7606
							iconCls: 'fa-reply',
7607
							style: 'font-family: FontAwesome',
7608
							handler: function () {
7609
								f = this.up().up();
7610
								f.setSubmitProc(false);
7611
								f.setHidden(true);
7612
								var pnl = Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0];
7613

    
7614
								if (pnl) {
7615
									//'L001'=grid L002 =heder detail L003=card L004=custom
7616
									layout = pnl.getLayoutType();
7617
									var last = 'MinovaGridFormGrid' + f.tableName;
7618
									var grid_ = Ext.ComponentQuery.query('[name=' + last + ']')[0];
7619
									grid_.setHidden(false);
7620
									pnl.setLastpage(undefined);
7621
									var mpnl = Ext.ComponentQuery.query('[name=DetailMD]')[0]
7622
										mpnl.setTitle(pnl.getLastTitle());
7623
									if (layout == 'L003') {
7624
										Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(400);
7625
									} else {
7626
										Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(false);
7627
									}
7628
								} else {
7629
									// Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(false);
7630
									var mdDetail = Ext.ComponentQuery.query('[name=MinovaORMDetail]')[0];
7631
									layout = mdDetail.getLayoutType();
7632
									if (layout == 'L003') {
7633
										var panelDetail = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0];
7634
										Ext.ComponentQuery.query('[name=MinovaGridFormGrid' + tableName + ']')[0].setHidden(false)
7635

    
7636
										panelDetail.setHeight(400);
7637
									} else {
7638
										Ext.ComponentQuery.query('[name=MinovaGridFormDisplay' + f.tableName + ']')[0].setHidden(false);
7639
									}
7640
								}
7641

    
7642
							}
7643
						}
7644
					],
7645
				}
7646
			]
7647
		});
7648
		me.callParent(arguments);
7649
	}
7650
});
7651

    
7652
Ext.define('MinovaUtil.MinovaES.MinovaGridCard', {
7653
	extend: 'Ext.form.Panel',
7654
	alias: ['widget.minovagridcard', 'widget.MinovaGridCard'],
7655
	tableName: undefined, //nama tabel
7656
	param: undefined, //param query
7657
	//hidebutton: undefined,
7658
	pagesize: undefined,
7659
	storename: undefined,
7660
	titleform: undefined,
7661
	titlegrid: undefined,
7662
	heightgrid: undefined,
7663
	heightform: undefined,
7664
	iseditform: undefined,
7665

    
7666
	getIsEditform: function () {
7667
		return this.iseditform;
7668
	},
7669
	setIsEditform: function (value) {
7670
		var me = this;
7671
		me.iseditform = value;
7672
		return me;
7673
	},
7674
	initComponent: function () {
7675
		var me = this;
7676
		var storename = me.storename;
7677
		if (storename == "" || storename == undefined) {
7678
			storename = "store" + me.tableName;
7679
		}
7680
		var tableName = me.tableName;
7681
		Ext.applyIf(me, {
7682
			items: [{
7683
					layoutType: "MinovaGridCard",
7684
					//title: me.titlegrid,
7685
					xtype: "minovagrid",
7686
					tableName: tableName, // nama tebel/dataset
7687
					name: "MinovaGridCardGrid" + tableName, //name bebeas
7688
					param: me.param, // parameter filteran
7689
					pagesize: me.pagesize, // jumlah record yang muncul per page
7690
					storename: storename, //nama store bebas
7691
					isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
7692
					height: 330,
7693
					bodyPadding: 0,
7694
					dockedItems: [{
7695
							xtype: 'pagingtoolbar',
7696
							store: storename, // harus sama dengan naa store diatas
7697
							dock: 'bottom', //posisi paging
7698
							pageSize: me.pagesize,
7699
							displayInfo: true
7700
						}
7701
					],
7702

    
7703
					listeners: {
7704
						viewready: function () {
7705
							if (MinovaUtil.GetActionMenu() == 0 || MinovaUtil.GetActionMenu() == undefined || MinovaUtil.GetActionMenu() == "") {
7706
								Ext.ComponentQuery.query('[name=actionBtn]')[0].setHidden(true)
7707
								Ext.ComponentQuery.query('[name=Edit' + me.tableName + ']')[0].setHidden(true)
7708
							} else {
7709
								Ext.ComponentQuery.query('[name=actionBtn]')[0].setHidden(false)
7710
								//Ext.ComponentQuery.query('[name=Edit_]')[0].setHidden(true)
7711
								Ext.ComponentQuery.query('[name=Delete_]')[0].setHidden(true)
7712
								Ext.ComponentQuery.query('[name=Edit' + me.tableName + ']')[0].setHidden(false)
7713
							}
7714
							//case orm
7715
							if (this.layoutType == "MinovaGridCard") {
7716
								var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + this.tableName + ']')[0];
7717
								var formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
7718
								formDisplay.setHidden(true);
7719
								formEdit.setHidden(true);
7720
							} else if (this.layoutType == "MinovaGridForm") {
7721
								var formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
7722
								formEdit.setHidden(true);
7723
							} else {
7724
								var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + this.tableName + ']')[0];
7725
								var formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
7726
								formDisplay.setHidden(true);
7727
								formEdit.setHidden(true);
7728
							}
7729

    
7730
						},
7731
						itemdblclick: function () {
7732
							//alert('a')
7733
							var me = this;
7734

    
7735
							var formDisplay = undefined;
7736
							var formEdit = undefined;
7737
							//case md orm
7738

    
7739
							if (this.layoutType == "MinovaGridCard") {
7740
								formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + this.tableName + ']')[0];
7741
								formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
7742
							} else if (this.layoutType == "MinovaGridForm") {
7743
								formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + this.tableName + ']')[0];
7744
								formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
7745
								// formDisplay.setHidden(true);
7746

    
7747
							} else {
7748
								formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + this.tableName + ']')[0];
7749
								formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + this.tableName + ']')[0];
7750

    
7751
							}
7752
							var submit_ = formEdit.getSubmitProc();
7753
							var selection = me.getView().getSelectionModel().getSelection()[0];
7754
							if (submit_ == undefined) {
7755
								submit_ = false;
7756
							}
7757
							if (submit_ == false) {
7758

    
7759
								if (this.layoutType == "MinovaGridCard") {
7760

    
7761
									formDisplay.getForm().setValues(selection.data);
7762
									formEdit.getForm().setValues(selection.data);
7763
									formDisplay.setHidden(false);
7764
									formEdit.setHidden(true);
7765
									this.setHidden(true);
7766
								} else if (this.layoutType == "MinovaGridForm") {
7767
									formEdit.setHidden(true);
7768
									formDisplay.getForm().setValues(selection.data);
7769
									formEdit.getForm().setValues(selection.data);
7770
								} else {
7771
									formDisplay.setHidden(true);
7772
									formEdit.setHidden(true);
7773

    
7774
									formDisplay.getForm().setValues(selection.data);
7775
									formEdit.getForm().setValues(selection.data);
7776
								}
7777
								// untuk case ORM
7778
								var display_ = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + tableName + ']')[0].getHeight();
7779
								if (display_) {
7780
									var pnlORM = Ext.ComponentQuery.query('[name=PanelOrmMdDetail]')[0]
7781
										var pnlMD = Ext.ComponentQuery.query('[name=PanelMdDetail]')[0]
7782
										if (pnlORM) {
7783
											pnlORM.setHeight(pnl + 100);
7784
										}
7785
										if (pnlMD) {
7786
											Ext.ComponentQuery.query('[name=MinovaMdDetail]')[0].setHeight(pnlMD + 600);
7787
											Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].setHeight(pnlMD + 600);
7788
										}
7789
								}
7790
								//end case ORM and MD
7791
							} else {
7792
								alert('still process')
7793
							}
7794

    
7795
						},
7796
						beforeedit: function () {
7797
							return false;
7798
						}
7799
					}
7800
				}, {
7801
					xtype: 'minovaform',
7802
					name: "MinovaGridCardDisplay" + tableName,
7803
					tableName: tableName, // nama tabel /dataset
7804
					isLookup: '', // 1 or 'Y' for lookup
7805
					isDisplay: true, // true== form is displayfield
7806
					buttons: [{
7807
							text: 'Edit',
7808
							name: 'Edit' + tableName,
7809
							iconCls: 'fa-edit',
7810
							style: 'font-family: FontAwesome',
7811
							handler: function () {
7812
								f = this.up().up();
7813
								f.setSubmitProc(false);
7814
								f.setHidden(true);
7815
								var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + f.tableName + ']')[0].setHidden(true);
7816
								Ext.ComponentQuery.query('[name=MinovaGridCardGrid' + f.tableName + ']')[0].setHidden(true);
7817
								Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + f.tableName + ']')[0].setHidden(false);
7818

    
7819
							}
7820
						}, {
7821
							text: 'Back to Grid',
7822
							name: 'Cancel' + tableName,
7823
							iconCls: 'fa-reply',
7824
							style: 'font-family: FontAwesome',
7825
							handler: function () {
7826
								f = this.up().up();
7827
								f.setSubmitProc(false);
7828
								f.setHidden(true);
7829
								var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + f.tableName + ']')[0].setHidden(true);
7830
								Ext.ComponentQuery.query('[name=MinovaGridCardGrid' + f.tableName + ']')[0].setHidden(false);
7831
								Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + f.tableName + ']')[0].setHidden(true);
7832

    
7833
							}
7834
						}
7835
					],
7836
				}, {
7837
					xtype: 'minovaform',
7838
					name: "MinovaGridCardEdit" + tableName,
7839
					tableName: tableName, // nama tabel /dataset
7840
					isLookup: '', // 1 or 'Y' for lookup
7841
					isDisplay: false, // true== form is displayfield
7842
					buttons: [{
7843
							text: 'Save',
7844
							name: 'Save' + tableName,
7845
							iconCls: 'fa-save',
7846
							style: 'font-family: FontAwesome',
7847
							handler: function () {
7848
								f = this.up().up();
7849
								var formEdit = Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + f.tableName + ']')[0];
7850
							}
7851
						}, {
7852
							text: 'Delete',
7853
							iconCls: 'fa-trash-o',
7854
							name: 'Delete',
7855
							style: 'font-family: FontAwesome',
7856
							action: 'CRUDdelete'
7857
						}, {
7858
							text: 'Back to Grid',
7859
							name: 'EditForm' + tableName,
7860
							iconCls: 'fa-reply',
7861
							style: 'font-family: FontAwesome',
7862
							handler: function () {
7863
								f = this.up().up();
7864
								f.setSubmitProc(false);
7865
								f.setHidden(true);
7866
								var formDisplay = Ext.ComponentQuery.query('[name=MinovaGridCardDisplay' + f.tableName + ']')[0].setHidden(true);
7867
								Ext.ComponentQuery.query('[name=MinovaGridCardGrid' + f.tableName + ']')[0].setHidden(false);
7868
								Ext.ComponentQuery.query('[name=MinovaGridCardEdit' + f.tableName + ']')[0].setHidden(true);
7869

    
7870
							}
7871
						}
7872
					],
7873
				}
7874
			]
7875
		});
7876
		me.callParent(arguments);
7877
	}
7878
});
7879

    
7880
Ext.define('MinovaUtil.MinovaES.MinovaFloatField', {
7881
	extend: 'Ext.form.field.Number',
7882
	alias: 'widget.minovafloatfield',
7883
	hideTrigger: true,
7884
	allowDecimals: true,
7885
	precision: undefined,
7886
	isValid: function () {
7887
		var b = this,
7888
		a = b.disabled,
7889
		c = b.forceValidation || !a;
7890
		return c ? b.validateValue(b.processRawValue(b.getValue())) : a
7891
	},
7892
	setValue: function (v) {
7893
		this.setRawValue(this.getFormattedValue(v));
7894
	},
7895
	getValue: function () {
7896
		var val = this.removeFormat(this.getRawValue());
7897
		this.value = val;
7898
		return val;
7899
	},
7900
	getSubmitValue: function () {
7901
		return this.removeFormat(this.getRawValue());
7902
	},
7903
	removeFormat: function (v) {
7904
		if (Ext.isEmpty(v))
7905
			return v;
7906
		else {
7907
			v = v.replace(Ext.util.Format.currencySign, '');
7908
			v = v.replace(new RegExp('[' + Ext.util.Format.thousandSeparator + ']', 'g'), '');
7909
			return v;
7910
		}
7911
	},
7912
	onFocus: function () {
7913
		this.setRawValue(this.removeFormat(this.getRawValue()));
7914
	},
7915
	onBlur: function () {
7916
		this.setRawValue(this.getFormattedValue(this.getValue()));
7917
	},
7918
	getFormattedValue: function (v) {
7919
		var prec = '';
7920
		if (this.precision != '' && this.precision > 0) {
7921
			for (var i = 0; i < this.precision; i++) {
7922
				prec = prec + '0'
7923
			}
7924
		}
7925
		return Ext.util.Format.number(v, '0,000.' + prec);
7926
	}
7927
});
7928
Ext.define('MinovaUtil.MinovaES.MinovaNumberField', {
7929
	extend: 'Ext.form.field.Number',
7930
	alias: 'widget.minovanumberfield',
7931
	//hideTrigger: true,
7932
	isValid: function () {
7933
		var b = this,
7934
		a = b.disabled,
7935
		c = b.forceValidation || !a;
7936
		return c ? b.validateValue(b.processRawValue(b.getValue())) : a
7937
	},
7938
	setValue: function (v) {
7939
		this.setRawValue(this.getFormattedValue(v));
7940
	},
7941
	getValue: function () {
7942
		var val = this.removeFormat(this.getRawValue());
7943
		this.value = val;
7944
		return val;
7945
	},
7946
	getSubmitValue: function () {
7947
		return this.removeFormat(this.getRawValue());
7948
	},
7949
	removeFormat: function (v) {
7950
		if (Ext.isEmpty(v))
7951
			return v;
7952
		else {
7953
			v = v.replace(Ext.util.Format.currencySign, '');
7954
			v = v.replace(new RegExp('[' + Ext.util.Format.thousandSeparator + ']', 'g'), '');
7955
			return v;
7956
		}
7957
	},
7958
	onFocus: function () {
7959
		this.setRawValue(this.removeFormat(this.getRawValue()));
7960
	},
7961
	onBlur: function () {
7962
		this.setRawValue(this.getFormattedValue(this.getValue()));
7963
	},
7964
	getFormattedValue: function (v) {
7965
		return Ext.util.Format.number(v, '0,000');
7966
	}
7967
});
7968

    
7969
Ext.define('MinovaUtil.MinovaES.SysDateTime', {
7970
	extend: 'Ext.form.field.Text',
7971
	alias: ['widget.minovasysdatetime'],
7972
	undefinedText: '&#160;',
7973
	setValue: function (v) {
7974
		var value = v;
7975
		var hasil = null;
7976
		/*
7977
		if (value === undefined) {
7978
		return this.undefinedText;
7979
		}
7980
		if (value === null) {
7981
		return this.setRawValue(null);
7982
		}
7983
		 */
7984
		//hamid 200916
7985
		//if (value != null || value != "" || value != undefined) {
7986
		//    return this.setRawValue(null);
7987
		if (value == "" || value == null) {
7988
			return this.setRawValue("");
7989
			//end
7990
		} else {
7991
			var d = value.substring(6, 8);
7992
			var m = value.substring(4, 6);
7993
			var y = value.substring(0, 4);
7994
			var h = value.substring(8, 10);
7995
			var mt = value.substring(10, 12);
7996
			var s = value.substring(12, 14);
7997
			hasil = d + '/' + m + '/' + y + '  ' + '  ' + h + ':' + mt + ':' + s;
7998
		}
7999

    
8000
		this.setRawValue(hasil);
8001
	},
8002
	getRawValue: function () {
8003
		return this.getValue();
8004
	},
8005
	getValue: function () {
8006
		var value = this.rawValue;
8007
		var hasil = null;
8008
		if (value != undefined) {
8009
			var d = value.substring(0, 2);
8010
			var m = value.substring(3, 5);
8011
			var y = value.substring(6, 10);
8012
			var h = value.substring(14, 16);
8013
			var mt = value.substring(17, 19);
8014
			var s = value.substring(20, 22);
8015
			hasil = y + m + d + h + mt + s;
8016
		}
8017
		return hasil;
8018
	}
8019
});
8020
Ext.define('MinovaUtil.MinovaES.MinovaDateTime', {
8021
	extend: 'Ext.form.field.Trigger',
8022
	alias: ['widget.minovadatetime', 'widget.MinovaDateTime'],
8023
	tableName: undefined,
8024
	param: undefined,
8025
	anchor: '50%',
8026
	initComponent: function () {
8027
		var me = this;
8028
		Ext.applyIf(me, {});
8029
		me.callParent(arguments);
8030
	},
8031
	onTriggerClick: function () {
8032
		Ext.create('Ext.window.Window', {
8033
			title: 'Hello',
8034
			modal: true,
8035
			layout: 'fit',
8036
			dockedItems: [{
8037
					xtype: 'toolbar',
8038
					dock: 'bottom',
8039
					align: 'center',
8040
					items: [{
8041
							xtype: 'tbspacer'
8042
						}, {
8043
							xtype: 'button',
8044
							text: 'Today'
8045
						}, {
8046
							xtype: 'tbspacer'
8047
						}, ]
8048
				}
8049
			],
8050
			items: [{
8051
					xtype: 'panel',
8052
					layout: 'hbox',
8053
					items: [{
8054
							xtype: 'datepicker',
8055
							name: 'date',
8056
							showToday: false,
8057
							handler: function (picker, date) {}
8058

    
8059
						}, {
8060
							xtype: 'sliderfield',
8061
							width: 60,
8062
							name: 'hour',
8063
							labelAlign: 'top',
8064
							fieldLabel: 'Hour',
8065
							value: 0,
8066
							increment: 1,
8067
							minValue: 0,
8068
							maxValue: 24,
8069
							margin: '10 5 3 20',
8070
							renderTo: Ext.getBody(),
8071
						}, {
8072
							xtype: 'sliderfield',
8073
							width: 60,
8074
							name: 'minute',
8075
							labelAlign: 'top',
8076
							fieldLabel: 'Minute',
8077
							value: 0,
8078
							increment: 1,
8079
							minValue: 0,
8080
							maxValue: 60,
8081
							margin: '10 5 3 20',
8082
							renderTo: Ext.getBody(),
8083
						}, {
8084
							xtype: 'sliderfield',
8085
							width: 60,
8086
							name: 'second',
8087
							labelAlign: 'top',
8088
							fieldLabel: 'Second',
8089
							value: 0,
8090
							increment: 1,
8091
							minValue: 0,
8092
							maxValue: 60,
8093
							margin: '10 5 3 20',
8094
							renderTo: Ext.getBody(),
8095
						}
8096
					]
8097
				}
8098
			]
8099
		}).show();
8100
	}
8101
});
8102

    
8103
Ext.define('MinovaUtil.MinovaES.MinovaMDORM', {
8104
	extend: 'Ext.form.Panel',
8105
	alias: ['widget.minovamdorm'],
8106

    
8107
	//controller: 'sample',
8108
	controller: 'orm-manage-controller',
8109
	tableName: undefined, //nama tabel
8110
	param: undefined, //param query
8111
	pagesize: undefined,
8112
	storename: undefined,
8113
	titleform: undefined,
8114
	titlegrid: undefined,
8115
	heightgrid: undefined,
8116
	heightform: undefined,
8117
	iseditform: undefined,
8118
	lastheightform: undefined,
8119
	layoutType: undefined,
8120
	lastpage: undefined,
8121
	lastTitle: undefined,
8122
	getLastTitle: function () {
8123
		return this.lastTitle;
8124
	},
8125
	setLastTitle: function (value) {
8126
		var me = this;
8127
		me.lastTitle = value;
8128
		return me;
8129
	},
8130
	getLastpage: function () {
8131
		return this.lastpage;
8132
	},
8133
	setLastpage: function (value) {
8134
		var me = this;
8135
		me.lastpage = value;
8136
		return me;
8137
	},
8138
	getLayoutType: function () {
8139
		return this.layoutType;
8140
	},
8141
	setLayoutType: function (value) {
8142
		var me = this;
8143
		me.layoutType = value;
8144
		return me;
8145
	},
8146
	getLastheightform: function () {
8147
		return this.lastheightform;
8148
	},
8149
	setLastheightform: function (value) {
8150
		var me = this;
8151
		me.lastheightform = value;
8152
		return me;
8153
	},
8154

    
8155
	getIsEditform: function () {
8156
		return this.iseditform;
8157
	},
8158
	setIsEditform: function (value) {
8159
		var me = this;
8160
		me.iseditform = value;
8161
		return me;
8162
	},
8163
	initComponent: function () {
8164
		var me = this;
8165
		var userAction = MinovaUtil.GetActionMenu();
8166
		var crudBtn = true;
8167
		if (userAction == '1') {
8168
			crudBtn = false
8169
		}
8170
		var storename = me.storename;
8171
		if (storename == "" || storename == undefined) {
8172
			storename = "store" + me.tableName;
8173
		}
8174
		var tableName = me.tableName;
8175
		Ext.applyIf(me, {
8176
			items: [{
8177
					layoutType: "MinovaGridForm",
8178
					title: me.titlegrid,
8179
					xtype: "minovagridmd",
8180
					tableName: tableName, // nama tebel/dataset
8181
					name: "MinovaGridFormGrid", //name bebeas
8182
					param: me.param, // parameter filteran
8183
					pagesize: me.pagesize, // jumlah record yang muncul per page
8184
					storename: storename, //nama store bebas
8185
					isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
8186
					height: 330,
8187
					bodyPadding: 0,
8188
					tbar: [{
8189
							xtype: 'button',
8190
							text: 'Action',
8191
							hidden: crudBtn,
8192
							name: 'actionGrid',
8193
							menu: [{
8194
									text: 'Add',
8195
									action: 'addGrid',
8196
									name: 'addGridORM',
8197
									action: 'CRUDaddNewRecord',
8198
									style: 'font-family: FontAwesome',
8199
									itemId: 'AddData',
8200
									iconCls: 'fa-plus-circle',
8201

    
8202
								}, {
8203
									text: 'Copy',
8204
									action: 'copyGrid',
8205
									name: 'CopyGridORM',
8206
									iconCls: 'fa-copy',
8207
									style: 'font-family: FontAwesome',
8208
								}, {
8209
									text: 'Edit',
8210
									action: 'editGrid',
8211
									name: 'EditGridORM',
8212
									iconCls: 'fa-edit',
8213
									style: 'font-family: FontAwesome',
8214
								}, {
8215
									text: 'Delete',
8216
									name: 'DeleteGridORM',
8217
									hidden: true,
8218
									iconCls: 'fa-trash-o',
8219
									style: 'font-family: FontAwesome',
8220
								}
8221
							]
8222
						}, {
8223
							xtype: 'tbfill'
8224
						}, {
8225
							text: 'Clear Filters',
8226
							tooltip: 'Clear all filters',
8227
							name: 'clearbtn',
8228
							handler: function () {
8229
								var tolbar = this.up()
8230
									var grid_ = tolbar.up()
8231
									grid_.filters.clearFilters()
8232
							},hidden:true
8233
						}, ],
8234

    
8235
					dockedItems: [{
8236
							xtype: 'pagingtoolbar',
8237
							store: storename, // harus sama dengan naa store diatas
8238
							dock: 'bottom', //posisi paging
8239
							pageSize: me.pagesize,
8240
							displayInfo: true
8241
						}
8242
					],
8243
					listeners: {
8244
						afterrender: function (me) {
8245
							if (MinovaUtil.GetActionMenu() == "1") {}
8246
							else {}
8247
						},
8248

    
8249
					},
8250

    
8251
				}, {
8252
					xtype: 'minovaform',
8253
					name: "MinovaGridFormDisplay",
8254
					//name: "MinovaGridFormEdit",
8255
					border: false,
8256
					tableName: tableName, // nama tabel /dataset
8257
					isLookup: '', // 1 or 'Y' for lookup
8258
					isDisplay: true, // true== form is displayfield
8259
					/*
8260
					buttons: [{
8261
					text: 'Edit',
8262
					name: 'EditDisplay',
8263
					iconCls: 'fa-edit',
8264
					style: 'font-family: FontAwesome',
8265
					}, {
8266
					text: 'Back to Grid',
8267
					name: 'BackGrid',
8268
					iconCls: 'fa-reply',
8269
					style: 'font-family: FontAwesome',
8270
					}
8271
					],
8272
					 */
8273
				}, {
8274
					xtype: 'minovaform',
8275
					//name: "MinovaGridFormDisplay",
8276
					name: "MinovaGridFormEdit",
8277
					border: false,
8278
					tableName: tableName, // nama tabel /dataset
8279
					isLookup: '', // 1 or 'Y' for lookup
8280
					isDisplay: false, // true== form is displayfield
8281
					/*
8282
					buttons: [{
8283
					text: 'Save',
8284
					name: 'btnSaveMD',
8285
					iconCls: 'fa-save',
8286
					style: 'font-family: FontAwesome',
8287
					}, {
8288
					text: 'Delete',
8289
					iconCls: 'fa-trash-o',
8290
					name: 'btnDeleteMD',
8291
					style: 'font-family: FontAwesome',
8292
					action: 'CRUDdelete',
8293
					}, {
8294
					text: 'Cancel',
8295
					name: 'btnCancelMD',
8296
					iconCls: 'fa-reply',
8297
					style: 'font-family: FontAwesome',
8298
					}
8299
					],
8300
					 */
8301
				}
8302
			]
8303

    
8304
		});
8305
		me.callParent(arguments);
8306
	}
8307
});
8308

    
8309
Ext.define('MinovaUtil.MinovaES.MinovaHeaderMD', {
8310
	extend: 'Ext.form.Panel',
8311
	alias: ['widget.MinovaHeadermd', 'widget.MinovaHeaderMD'],
8312
	allTableName: undefined,
8313
	param: undefined,
8314
	//frame: true,
8315
	resizable: true,
8316
	autoScroll: true,
8317
	minHeight: 20,
8318
	layout: 'column',
8319
	name: 'HeaderMD',
8320
	getAllTableName: function () {
8321
		return this.allTableName;
8322
	},
8323
	setAllTableName: function (value) {
8324
		var me = this;
8325
		me.allTableName = value;
8326
		return me;
8327
	},
8328
	listeners: {
8329
		afterrender: function (me) {
8330

    
8331
			var nowDate = MinovaUtil.GetNowDate()
8332
				var allTbl = me.getAllTableName();
8333
			//alert(allTbl);
8334
			var splitTable = allTbl.split(',')
8335
				splitTable.forEach(function (tbl) {
8336
					// console.log(tbl);
8337
					//set values form
8338
					var nowDate = MinovaUtil.GetNowDate();
8339
					parameter = null;
8340
					if (me.isEmployee == true) {
8341
						parameter = 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("EmployeeID")
8342
					} else {
8343
						parameter = 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("ApplicantID")
8344
					}
8345
					Ext.Ajax.request({
8346
						method: 'POST',
8347
						//async: false,
8348
						url: '/UserControl/GetStore',
8349
						params: {
8350
							tableName: tbl,
8351
							param: parameter
8352
						},
8353
						success: function (response) {
8354
							var results = Ext.decode(response.responseText);
8355
							hasil = results.data;
8356
							//console.log(hasil)
8357
							if (hasil.length > 0) {
8358
								me.getForm().setValues(hasil[0]);
8359

    
8360
								//console.log(me)
8361
							}
8362

    
8363
						}
8364
					});
8365
				});
8366

    
8367
			//setTimeout(function () {
8368
			//    // var me_ = Ext.ComponentQuery.query('[name=Header]')[0];
8369
			//    // me_.setTitle(me_.getTitle() + ' - ' + Ext.ComponentQuery.query('[name=FullName]')[0].getValue());
8370
			//}, 100);
8371

    
8372
		},
8373

    
8374
	},
8375

    
8376
	initComponent: function () {
8377
		var me = this;
8378
		var col1 = [];
8379
		var col2 = [];
8380
		var hasil = null;
8381
		//get moduletype
8382
		//var ModuleType = 'PA';
8383
		//var ModuleType = MinovaUtil.GetModuleType()
8384
		//get Lang
8385
		var LangId = localStorage.LangId;
8386
		var allTable = null;
8387
		var tbl = null;
8388
		var tblTemp = null;
8389
		var nowDate = MinovaUtil.GetNowDate();
8390
		//var Photo_ = 'nophoto.gif';
8391
		var Photo = 'nophoto.gif';
8392
		tableName = null;
8393
		parameter = null;
8394
		// get Photo
8395
		//hamid200916
8396
		if (me.isEmployee == true) {
8397
			tableName = 'PHRPA0001';
8398
			parameter = 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("EmployeeID");
8399
		} else {
8400
			tableName = 'PHRRC0001';
8401
			parameter = 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("ApplicantID")
8402
		}
8403
		Ext.Ajax.request({
8404
			method: 'POST',
8405
			async: false,
8406
			url: '/UserControl/GetStore',
8407
			params: {
8408
				tableName: tableName,
8409
				param: parameter
8410
			},
8411
			success: function (response) {
8412
				var results = Ext.decode(response.responseText);
8413
				hasil = results.data;
8414
				if (hasil.length > 0) {
8415
					dataPhoto = hasil[0].Picture
8416
						if (dataPhoto != "") {
8417
							Photo = dataPhoto;
8418
						}
8419
				}
8420

    
8421
			}
8422
		});
8423

    
8424
		var hasil = undefined;
8425
		Ext.Ajax.request({
8426
			async: false,
8427
			method: 'POST',
8428
			url: '/UserControl/GetStore',
8429
			params: {
8430
				tableName: 'PDSBS0009',
8431
				param: 'MenuID[=]' + MinovaUtil.GetMenuID() + ',LangId[=]' + LangId
8432
			},
8433
			success: function (response) {
8434
				hasil = Ext.decode(response.responseText).data;
8435

    
8436
			}
8437
		});
8438

    
8439
		//sorting results
8440
		hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
8441
		if (hasil.length > 0) {
8442
			Ext.each(hasil, function (rec) {
8443
				tblTemp = rec.TableName;
8444
				if (tbl != tblTemp) {
8445
					tbl = tblTemp;
8446
					if (allTable == null) {
8447
						allTable = tbl
8448
					} else {
8449
						allTable = allTable + ',' + tbl
8450
					}
8451

    
8452
				}
8453
				// build form
8454
				if (rec.TableRef != '') {
8455
					valueField = null;
8456
					displayValue = null;
8457
					Ext.Ajax.request({
8458
						async: false,
8459
						method: 'POST',
8460
						url: '/UserControl/GetStore',
8461
						params: {
8462
							tableName: 'SDATATABLEFIELD',
8463
							param: 'TableName[equal]' + rec.TableRef
8464
						},
8465
						success: function (response) {
8466
							var results = Ext.decode(response.responseText);
8467
							data_ = results.data;
8468
							if (data_ != undefined) {
8469
								valueField_ = $.grep(data_, function (r) {
8470
										return r.ValueField == '1'
8471
									});
8472
								if (valueField_.length > 0) {
8473
									valueField = valueField_[0].FieldName
8474
								}
8475

    
8476
								displayValue_ = $.grep(data_, function (r) {
8477
										return r.DisplayValue == '1'
8478
									});
8479
								if (displayValue_.length > 0) {
8480
									displayValue = displayValue_[0].FieldName
8481
								}
8482
							}
8483
						}
8484
					});
8485

    
8486
					formfield = new Ext.form.Display({
8487
							fieldLabel: rec.ScreenCaption,
8488
							name: rec.FieldName,
8489
							//value: rec.DefaultValue,
8490
							padding: 0,
8491
							labelCls: 'label-minova',
8492
							labelWidth: 150,
8493
							anchor: '80%',
8494
							store: Ext.create('Ext.data.Store', {
8495
								storeId: 'storeDisplay' + rec.FieldName,
8496
								//autoLoad: true,
8497
								proxy: {
8498
									method: 'POST',
8499
									type: 'ajax',
8500
									extraParams: {
8501
										tableName: rec.TableRef,
8502
										param: ''
8503
									},
8504
									reader: {
8505
										type: 'json',
8506
										root: 'data',
8507
										totalProperty: 'data[0].TotalCount'
8508
									}
8509
								}
8510
							}),
8511
							listeners: {
8512
								afterrender: function (f) {
8513
									var store = Ext.StoreMgr.lookup('storeDisplay' + rec.FieldName);
8514
									var ParamCombo = rec.ParamCombo;
8515
									var param = '';
8516
									//if (ParamCombo != '') {
8517
									if ((rec.TableRef).toLowerCase() == 'phrom0001') {
8518
										var splitParam = ParamCombo.split(']');
8519
										switch (rec.FieldName) {
8520
										case 'Position':
8521
											ParamCombo = 'P'
8522
												break;
8523
										case 'CostCenter':
8524
											ParamCombo = 'CC'
8525
												break;
8526
										case 'Organization':
8527
											ParamCombo = 'O'
8528
												break;
8529
										case 'Job':
8530
											ParamCombo = 'J'
8531
												break;
8532
										}
8533
										//if (splitParam.length == 1) {
8534
										param = 'StartDate[<=]' + MinovaUtil.GetNowDate() + 'EndDate[>=]' + MinovaUtil.GetNowDate() + ',ObjectClass[=]' + ParamCombo
8535
											//} else {
8536
											//    param = ParamCombo;
8537
											//}
8538
									}
8539
									//}
8540
									Ext.Ajax.request({
8541
										method: 'POST',
8542
										async: false,
8543
										url: '/UserControl/GetStore',
8544
										params: {
8545
											tableName: rec.TableRef,
8546
											param: param
8547
										},
8548
										success: function (response) {
8549
											var results = Ext.decode(response.responseText);
8550

    
8551
											//dt = results.data;
8552
											store.loadData(results.data);
8553

    
8554
										}
8555
									});
8556
								},
8557
								change: function (f) {
8558
									//alert(this.valueField, value);
8559
									var display = this.displayField;
8560
									var value = this.getValue();
8561
									var st = f.store
8562
										var r = st.findRecord(f.valueField, f.value)
8563
										if (r != null) {
8564
											f.setRawValue(r.get(f.displayField))
8565
										} else {
8566
											f.setRawValue(f.value);
8567

    
8568
										}
8569
								}
8570

    
8571
							},
8572
							queryMode: 'local',
8573
							displayField: displayValue,
8574
							valueField: valueField,
8575
						});
8576
				} else {
8577
					formfield = new Ext.form.Display({
8578
							fieldLabel: rec.ScreenCaption,
8579
							name: rec.FieldName,
8580
							labelCls: 'label-minova',
8581
							labelWidth: 150,
8582
							//value: rec.DefaultValue,
8583
							padding: 0,
8584
							anchor: '80%'
8585
						});
8586
				}
8587
				if (isDesk) {
8588
					if (rec.Column == 1) {
8589
						col1.push(formfield);
8590
					} else {
8591
						col2.push(formfield);
8592
					}
8593
				} else {
8594
					col1.push(formfield);
8595
				}
8596

    
8597
			});
8598
			//set allTable
8599
			this.setAllTableName(allTable);
8600
		}
8601

    
8602
		Ext.applyIf(me, {
8603
			items: [{
8604
					bodyPadding: 0,
8605
					width: 400,
8606
					margin: '10 5 3 30',
8607
					items: col1
8608
				}, {
8609
					bodyPadding: 0,
8610
					width: 400,
8611
					margin: '10 5 3 30',
8612
					items: col2
8613
				}, {
8614
					width: 150,
8615
					//margin: '10 5 3 30',
8616
					items: [{
8617
							xtype: 'image',
8618
							id: 'imageusermd',
8619
							name: 'imageusermd',
8620
							width: 120,
8621
							height: 150,
8622
							padding: 5,
8623
							border: true,
8624
							src: '/Devt/GetFileData?FileName=' + Photo + '&download=false',
8625
						}
8626
					]
8627
				}
8628
			],
8629
		});
8630
		me.callParent(arguments);
8631

    
8632
	}
8633
});
8634
/*Add Taufan (Header Master Data For ERP)*/
8635
Ext.define('MinovaUtil.MinovaES.MinovaHeaderMDLogistic', {
8636
	extend: 'Ext.form.Panel',
8637
	alias: ['widget.MinovaHeadermdLogistic', 'widget.MinovaHeaderMDLogistic', 'widget.minovaheadermdlogistic'],
8638
	tablenameheader: undefined,
8639
	keyid: undefined,
8640
	allTableName: undefined,
8641
	param: undefined,
8642
	resizable: true,
8643
	autoScroll: true,
8644
	minHeight: 20,
8645
	layout: 'column',
8646
	name: 'HeaderMDLogistic',
8647
	getAllTableName: function () {
8648
		return this.allTableName;
8649
	},
8650
	setAllTableName: function (value) {
8651
		var me = this;
8652
		me.allTableName = value;
8653
		return me;
8654
	},
8655
	listeners: {
8656
		afterrender: function (me) {
8657
			var nowDate = MinovaUtil.GetNowDate()
8658
				var allTbl = me.getAllTableName();
8659
			var splitTable = allTbl.split(',')
8660
				splitTable.forEach(function (tbl) {
8661
					var nowDate = MinovaUtil.GetNowDate();
8662
					var parameter = me.keyid + '[=]' + getParam("KeyValue");
8663
					Ext.Ajax.request({
8664
						method: 'POST',
8665
						url: '/UserControl/GetStore',
8666
						params: {
8667
							tableName: tbl,
8668
							param: parameter
8669
						},
8670
						success: function (response) {
8671
							var results = Ext.decode(response.responseText);
8672
							hasil = results.data;
8673
							if (hasil.length > 0) {
8674
								me.getForm().setValues(hasil[0]);
8675
							}
8676
						}
8677
					});
8678
				});
8679
		}
8680
	},
8681
	initComponent: function () {
8682
		var me = this;
8683
		var col1 = [];
8684
		var col2 = [];
8685
		var hasil = null;
8686
		var LangId = localStorage.LangId;
8687
		var allTable = null;
8688
		var tbl = null;
8689
		var tblTemp = null;
8690
		var nowDate = MinovaUtil.GetNowDate();
8691
		var Photo = 'nophoto.gif';
8692
		var hasil = undefined;
8693
		var parameter = me.keyid + '[=]' + getParam("KeyValue");
8694
		Ext.Ajax.request({
8695
			method: 'POST',
8696
			async: false,
8697
			url: '/UserControl/GetStore',
8698
			params: {
8699
				tableName: me.tablenameheader,
8700
				param: parameter
8701
			},
8702
			success: function (response) {
8703
				var results = Ext.decode(response.responseText);
8704
				hasil = results.data;
8705
				if (hasil.length > 0) {
8706
					dataPhoto = hasil[0].Photo
8707
						if (dataPhoto != "") {
8708
							Photo = dataPhoto;
8709
						}
8710
				}
8711
			}
8712
		});
8713
		Ext.Ajax.request({
8714
			async: false,
8715
			method: 'POST',
8716
			url: '/UserControl/GetStore',
8717
			params: {
8718
				tableName: 'PDSBS0009',
8719
				param: 'MenuID[=]' + MinovaUtil.GetMenuID() + ',LangId[=]' + LangId
8720
			},
8721
			success: function (response) {
8722
				hasil = Ext.decode(response.responseText).data;
8723
			}
8724
		});
8725
		hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
8726
		if (hasil.length > 0) {
8727
			Ext.each(hasil, function (rec) {
8728
				tblTemp = rec.TableName;
8729
				if (tbl != tblTemp) {
8730
					tbl = tblTemp;
8731
					if (allTable == null) {
8732
						allTable = tbl
8733
					} else {
8734
						allTable = allTable + ',' + tbl
8735
					}
8736
				}
8737
				if (rec.TableRef != '') {
8738
					valueField = null;
8739
					displayValue = null;
8740
					Ext.Ajax.request({
8741
						async: false,
8742
						method: 'POST',
8743
						url: '/UserControl/GetStore',
8744
						params: {
8745
							tableName: 'SDATATABLEFIELD',
8746
							param: 'TableName[equal]' + rec.TableRef
8747
						},
8748
						success: function (response) {
8749
							var results = Ext.decode(response.responseText);
8750
							data_ = results.data;
8751
							if (data_ != undefined) {
8752
								valueField_ = $.grep(data_, function (r) {
8753
										return r.ValueField == '1'
8754
									});
8755
								if (valueField_.length > 0) {
8756
									valueField = valueField_[0].FieldName
8757
								}
8758
								displayValue_ = $.grep(data_, function (r) {
8759
										return r.DisplayValue == '1'
8760
									});
8761
								if (displayValue_.length > 0) {
8762
									displayValue = displayValue_[0].FieldName
8763
								}
8764
							}
8765
						}
8766
					});
8767

    
8768
					formfield = new Ext.form.Display({
8769
							fieldLabel: rec.ScreenCaption,
8770
							name: rec.FieldName,
8771
							padding: 0,
8772
							labelCls: 'label-minova',
8773
							labelWidth: 150,
8774
							anchor: '80%',
8775
							store: Ext.create('Ext.data.Store', {
8776
								storeId: 'storeDisplay' + rec.FieldName,
8777
								proxy: {
8778
									method: 'POST',
8779
									type: 'ajax',
8780
									extraParams: {
8781
										tableName: rec.TableRef,
8782
										param: ''
8783
									},
8784
									reader: {
8785
										type: 'json',
8786
										root: 'data',
8787
										totalProperty: 'data[0].TotalCount'
8788
									}
8789
								}
8790
							}),
8791
							listeners: {
8792
								afterrender: function (f) {
8793
									var store = Ext.StoreMgr.lookup('storeDisplay' + rec.FieldName);
8794
									var ParamCombo = rec.ParamCombo;
8795
									var param = '';
8796
									Ext.Ajax.request({
8797
										method: 'POST',
8798
										async: false,
8799
										url: '/UserControl/GetStore',
8800
										params: {
8801
											tableName: rec.TableRef,
8802
											param: param
8803
										},
8804
										success: function (response) {
8805
											var results = Ext.decode(response.responseText);
8806
											store.loadData(results.data);
8807
										}
8808
									});
8809
								},
8810
								change: function (f) {
8811
									var display = this.displayField;
8812
									var value = this.getValue();
8813
									var st = f.store
8814
										var r = st.findRecord(f.valueField, f.value)
8815
										if (r != null) {
8816
											f.setRawValue(r.get(f.displayField))
8817
										} else {
8818
											f.setRawValue(f.value);
8819
										}
8820
								}
8821
							},
8822
							queryMode: 'local',
8823
							displayField: displayValue,
8824
							valueField: valueField,
8825
						});
8826
				} else {
8827
					formfield = new Ext.form.Display({
8828
							fieldLabel: rec.ScreenCaption,
8829
							name: rec.FieldName,
8830
							labelCls: 'label-minova',
8831
							labelWidth: 150,
8832
							padding: 0,
8833
							anchor: '80%'
8834
						});
8835
				}
8836
				if (isDesk) {
8837
					if (rec.Column == 1) {
8838
						col1.push(formfield);
8839
					} else {
8840
						col2.push(formfield);
8841
					}
8842
				} else {
8843
					col1.push(formfield);
8844
				}
8845

    
8846
			});
8847
			this.setAllTableName(allTable);
8848
		}
8849
		Ext.applyIf(me, {
8850
			items: [{
8851
					bodyPadding: 0,
8852
					width: 400,
8853
					margin: '10 5 3 30',
8854
					items: col1
8855
				}, {
8856
					bodyPadding: 0,
8857
					width: 400,
8858
					margin: '10 5 3 30',
8859
					items: col2
8860
				}, {
8861
					width: 150,
8862
					items: [{
8863
							xtype: 'image',
8864
							id: 'imageusermd',
8865
							name: 'imageusermd',
8866
							width: 120,
8867
							height: 150,
8868
							padding: 5,
8869
							border: true,
8870
							src: '/Devt/GetFileData?FileName=' + Photo + '&download=false',
8871
						}
8872
					]
8873
				}
8874
			]
8875
		});
8876
		me.callParent(arguments);
8877
	}
8878
});
8879
Ext.define('MinovaUtil.MinovaES.Column.MinovaDateTimeColumn', {
8880
	extend: 'Ext.grid.column.Column',
8881
	alias: ['widget.minovadatetimecolumn'],
8882
	alternateClassName: 'Ext.grid.MinovaDateTimeColumn',
8883
	undefinedText: '&#160;',
8884
	defaultRenderer: function (value) {
8885
		//hamid200916
8886
		//if (value === undefined) {
8887
		if (value === "") {
8888
			return this.undefinedText;
8889
			//end
8890
		}
8891

    
8892
		var d = value.substring(6, 8);
8893
		var m = value.substring(4, 6);
8894
		var y = value.substring(0, 4);
8895
		var h = value.substring(8, 10);
8896
		var mt = value.substring(10, 12);
8897
		var s = value.substring(12, 14);
8898
		var hasil = d + '/' + m + '/' + y + '  ' + '  ' + h + ':' + mt + ':' + s;
8899
		return hasil;
8900
	}
8901
});
8902
Ext.define('MinovaUtil.MinovaES.Column.MinovaDateColumn', {
8903
	extend: 'Ext.grid.column.Column',
8904
	alias: ['widget.minovadatecolumn'],
8905
	alternateClassName: 'Ext.grid.MinovaDateColumn',
8906
	undefinedText: '&#160;',
8907
	defaultRenderer: function (value) {
8908
		if (value === "" || value === undefined || value === null) {
8909
			return "";
8910
		}
8911
		var d = value.substring(6, 8);
8912
		var m = value.substring(4, 6);
8913
		var y = value.substring(0, 4);
8914
		var hasil = d + '/' + m + '/' + y;
8915
		return hasil;
8916
	}
8917
});
8918
Ext.define('MinovaUtil.MinovaES.MinovaComboColumn', {
8919
	extend: 'Ext.grid.column.Column',
8920
	alias: ['widget.minovacombocolumn'],
8921
	initComponent: function () {
8922
		this.callParent(arguments);
8923
	},
8924
	defaultRenderer: function (value) {
8925
		if (typeof(this.store) !== 'object') {
8926
			Ext.data.StoreManager.lookup(this.store).load();
8927
			this.store = Ext.data.StoreManager.lookup(this.store);
8928
		}
8929
		var idx = this.store.findExact(this.valueField, value);
8930
		if (this.store.getAt(idx)) {
8931
			var result = this.store.getAt(idx).get(this.displayField);
8932
			value = result ? result : value;
8933
		}
8934
		return value;
8935
	}
8936
});
8937
//atien
8938
Ext.define('MinovaUtil.MinovaES.MinovaAmountColumn', {
8939
	extend: 'Ext.grid.column.Column',
8940
	alias: ['widget.minovaamountcolumn'],
8941
	initComponent: function () {
8942
		this.callParent(arguments);
8943
	},
8944
	defaultRenderer: function (value) {
8945
		if (value != "") {
8946
			Ext.Ajax.request({
8947
				async: false,
8948
				method: 'POST',
8949
				url: '/Devt/DecryptData',
8950
				params: {
8951
					dt: value
8952

    
8953
				},
8954
				success: function (response) {
8955
					var results = Ext.decode(response.responseText);
8956
					value = results.data;
8957
					Ext.util.Format.thousandSeparator = "."
8958

    
8959
						value = Ext.util.Format.number(value, '0,000');
8960
				}
8961
			});
8962
		}
8963

    
8964
		return value;
8965
	}
8966
});
8967
//end amount column
8968
//hamid200916
8969
Ext.define('MinovaUtil.MinovaES.MinovaMDApplicant', {
8970
	extend: 'Ext.form.Panel',
8971
	alias: ['widget.minovamdApp', 'widget.MinovaMDApplicant'],
8972
	controller: 'recruitment-controller',
8973
	tableName: undefined, //nama tabel
8974
	param: undefined, //param query
8975
	pagesize: undefined,
8976
	storename: undefined,
8977
	titleform: undefined,
8978
	titlegrid: undefined,
8979
	heightgrid: undefined,
8980
	heightform: undefined,
8981
	iseditform: undefined,
8982
	lastheightform: undefined,
8983
	layoutType: undefined,
8984
	lastpage: undefined,
8985
	lastTitle: undefined,
8986
	getLastTitle: function () {
8987
		return this.lastTitle;
8988
	},
8989
	setLastTitle: function (value) {
8990
		var me = this;
8991
		me.lastTitle = value;
8992
		return me;
8993
	},
8994
	getLastpage: function () {
8995
		return this.lastpage;
8996
	},
8997
	setLastpage: function (value) {
8998
		var me = this;
8999
		me.lastpage = value;
9000
		return me;
9001
	},
9002
	getLayoutType: function () {
9003
		return this.layoutType;
9004
	},
9005
	setLayoutType: function (value) {
9006
		var me = this;
9007
		me.layoutType = value;
9008
		return me;
9009
	},
9010
	getLastheightform: function () {
9011
		return this.lastheightform;
9012
	},
9013
	setLastheightform: function (value) {
9014
		var me = this;
9015
		me.lastheightform = value;
9016
		return me;
9017
	},
9018

    
9019
	getIsEditform: function () {
9020
		return this.iseditform;
9021
	},
9022
	setIsEditform: function (value) {
9023
		var me = this;
9024
		me.iseditform = value;
9025
		return me;
9026
	},
9027
	initComponent: function () {
9028
		var me = this;
9029
		var storename = me.storename;
9030
		if (storename == "" || storename == undefined) {
9031
			storename = "store" + me.tableName;
9032
		}
9033
		var isHired = false;
9034
		nowDate = MinovaUtil.GetNowDate();
9035
		Ext.Ajax.request({
9036
			async: false,
9037
			method: 'POST',
9038
			url: '/UserControl/GetStore',
9039
			params: {
9040
				tableName: 'PHRRC0002',
9041
				param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("ApplicantID")
9042

    
9043
			},
9044
			success: function (response) {
9045
				var results = Ext.decode(response.responseText);
9046
				dataForm = results.data;
9047
				//cek is hired or blacklist
9048
				dataForm_ = $.grep(dataForm, function (r) {
9049
						return r.ApplicantStatus == '05'
9050
					});
9051
				if (dataForm_.length == 0) {
9052
					dataForm_ = $.grep(dataForm, function (r) {
9053
							return r.ApplicantStatus == '99'
9054
						});
9055
				}
9056
				if (dataForm_ != null && dataForm_.length > 0) {
9057
					isHired = true;
9058
				}
9059
			}
9060
		});
9061

    
9062
		var tableName = me.tableName;
9063
		Ext.applyIf(me, {
9064
			items: [{
9065
					layoutType: "MinovaGridForm",
9066
					title: me.titlegrid,
9067
					xtype: "minovagrid1",
9068
					tableName: tableName, // nama tebel/dataset
9069
					name: "MinovaGridFormGrid",
9070
					param: me.param, // parameter filteran
9071
					pagesize: me.pagesize, // jumlah record yang muncul per page
9072
					storename: storename, //nama store bebas
9073
					isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
9074
					height: 330,
9075
					bodyPadding: 0,
9076
					tbar: [{
9077

    
9078
							xtype: 'button',
9079
							text: 'Action',
9080
							name: 'actionGrid',
9081
							hidden: isHired,
9082
							menu: [{
9083
									text: 'Add',
9084
									name: 'addGrid',
9085
									action: 'CRUDaddNewRecord',
9086
									style: 'font-family: FontAwesome',
9087
									itemId: 'AddData',
9088
									iconCls: 'fa-plus-circle',
9089
									hidden: isHired
9090

    
9091
								}, {
9092
									text: 'Copy',
9093
									name: 'CopyGrid',
9094
									iconCls: 'fa-copy',
9095
									style: 'font-family: FontAwesome',
9096
									hidden: isHired
9097
								}, {
9098
									text: 'Edit',
9099
									name: 'EditGrid',
9100
									iconCls: 'fa-edit',
9101
									style: 'font-family: FontAwesome',
9102
									hidden: isHired
9103
								}, {
9104
									text: 'Delete',
9105
									name: 'DeleteGrid',
9106
									hidden: true,
9107
									iconCls: 'fa-trash-o',
9108
									style: 'font-family: FontAwesome',
9109
								}
9110
							],
9111
							listeners: {
9112
								afterender: function () {
9113
									var me = this;
9114
									nowDate = MinovaUtil.GetNowDate();
9115
									var isHired = false;
9116
									Ext.Ajax.request({
9117
										async: false,
9118
										method: 'POST',
9119
										url: '/UserControl/GetStore',
9120
										params: {
9121
											tableName: 'PHRRC0027',
9122
											param: 'StartDate[<=]' + nowDate + ',EndDate[>=]' + nowDate + ',EmployeeID[=]' + getParam("ApplicantID") + ',ActivityType[=]8'
9123

    
9124
										},
9125
										success: function (response) {
9126
											var results = Ext.decode(response.responseText);
9127
											dataForm = results.data;
9128
											if (dataForm != null) {
9129
												isHired = true;
9130
											}
9131
										}
9132
									});
9133
									if (isHired) {
9134
										me.setHidden(true);
9135
									} else {
9136
										me.setHidden(false);
9137
									}
9138

    
9139
								},
9140

    
9141
							},
9142
						}, {
9143
							xtype: 'tbfill'
9144
						}, {
9145
							text: 'Clear Filters',
9146
							tooltip: 'Clear all filters',
9147
							name: 'clearbtn',
9148
							handler: function () {
9149
								var tolbar = this.up()
9150
									var grid_ = tolbar.up()
9151
									grid_.filters.clearFilters()
9152
							},hidden:true
9153
						}, ],
9154

    
9155
					dockedItems: [{
9156
							xtype: 'pagingtoolbar',
9157
							store: storename, // harus sama dengan naa store diatas
9158
							dock: 'bottom', //posisi paging
9159
							pageSize: me.pagesize,
9160
							displayInfo: true
9161
						}
9162
					],
9163

    
9164
				}, {
9165
					xtype: 'minovaform',
9166
					name: "MinovaGridFormDisplay",
9167
					tableName: tableName, // nama tabel /dataset
9168
					isLookup: '', // 1 or 'Y' for lookup
9169
					isDisplay: true, // true== form is displayfield
9170
				}, {
9171
					xtype: 'minovaform',
9172
					name: "MinovaGridFormEdit",
9173
					tableName: tableName, // nama tabel /dataset
9174
					isLookup: '', // 1 or 'Y' for lookup
9175
					isDisplay: false, // true== form is displayfield
9176
				}
9177
			]
9178
		});
9179
		me.callParent(arguments);
9180
	}
9181
});
9182
//end
9183

    
9184
Ext.define('MinovaUtil.MinovaES.MinovaMD', {
9185
	extend: 'Ext.form.Panel',
9186
	alias: ['widget.minovamd', 'widget.MinovaMD'],
9187
	controller: 'pa-controller',
9188
	tableName: undefined, //nama tabel
9189
	param: undefined, //param query
9190
	pagesize: undefined,
9191
	storename: undefined,
9192
	titleform: undefined,
9193
	titlegrid: undefined,
9194
	heightgrid: undefined,
9195
	heightform: undefined,
9196
	iseditform: undefined,
9197
	lastheightform: undefined,
9198
	layoutType: undefined,
9199
	lastpage: undefined,
9200
	lastTitle: undefined,
9201
	getLastTitle: function () {
9202
		return this.lastTitle;
9203
	},
9204
	setLastTitle: function (value) {
9205
		var me = this;
9206
		me.lastTitle = value;
9207
		return me;
9208
	},
9209
	getLastpage: function () {
9210
		return this.lastpage;
9211
	},
9212
	setLastpage: function (value) {
9213
		var me = this;
9214
		me.lastpage = value;
9215
		return me;
9216
	},
9217
	getLayoutType: function () {
9218
		return this.layoutType;
9219
	},
9220
	setLayoutType: function (value) {
9221
		var me = this;
9222
		me.layoutType = value;
9223
		return me;
9224
	},
9225
	getLastheightform: function () {
9226
		return this.lastheightform;
9227
	},
9228
	setLastheightform: function (value) {
9229
		var me = this;
9230
		me.lastheightform = value;
9231
		return me;
9232
	},
9233

    
9234
	getIsEditform: function () {
9235
		return this.iseditform;
9236
	},
9237
	setIsEditform: function (value) {
9238
		var me = this;
9239
		me.iseditform = value;
9240
		return me;
9241
	},
9242
	initComponent: function () {
9243
		var me = this;
9244
		var storename = me.storename;
9245
		if (storename == "" || storename == undefined) {
9246
			storename = "store" + me.tableName;
9247
		}
9248
		var tableName = me.tableName;
9249
		Ext.applyIf(me, {
9250
			items: [{
9251
					layoutType: "MinovaGridForm",
9252
					title: me.titlegrid,
9253
					xtype: "minovagrid1",
9254
					tableName: tableName, // nama tebel/dataset
9255
					name: "MinovaGridFormGrid",
9256
					param: me.param, // parameter filteran
9257
					pagesize: me.pagesize, // jumlah record yang muncul per page
9258
					storename: storename, //nama store bebas
9259
					isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
9260
					height: 330,
9261
					bodyPadding: 0,
9262
					tbar: [{
9263
							xtype: 'button',
9264
							text: 'Action',
9265
							name: 'actionGrid',
9266
							menu: [{
9267
									text: 'Add',
9268
									name: 'addGrid',
9269
									action: 'CRUDaddNewRecord',
9270
									style: 'font-family: FontAwesome',
9271
									itemId: 'AddData',
9272
									iconCls: 'fa-plus-circle',
9273

    
9274
								}, {
9275
									text: 'Copy',
9276
									name: 'CopyGrid',
9277
									iconCls: 'fa-copy',
9278
									style: 'font-family: FontAwesome',
9279
								}, {
9280
									text: 'Edit',
9281
									name: 'EditGrid',
9282
									iconCls: 'fa-edit',
9283
									style: 'font-family: FontAwesome',
9284
								}, {
9285
									text: 'Delete',
9286
									name: 'DeleteGrid',
9287
									hidden: true,
9288
									iconCls: 'fa-trash-o',
9289
									style: 'font-family: FontAwesome',
9290
								}
9291
							]
9292
						}, {
9293
							xtype: 'tbfill'
9294
						}, {
9295
							text: 'Clear Filters',
9296
							tooltip: 'Clear all filters',
9297
							name: 'clearbtn',
9298
							handler: function () {
9299
								var tolbar = this.up()
9300
									var grid_ = tolbar.up()
9301
									grid_.filters.clearFilters()
9302
							},hidden:true
9303
						}, ],
9304

    
9305
					dockedItems: [{
9306
							xtype: 'pagingtoolbar',
9307
							store: storename, // harus sama dengan naa store diatas
9308
							dock: 'bottom', //posisi paging
9309
							pageSize: me.pagesize,
9310
							displayInfo: true
9311
						}
9312
					],
9313

    
9314
				}, {
9315
					xtype: 'minovaform',
9316
					name: "MinovaGridFormDisplay",
9317
					tableName: tableName, // nama tabel /dataset
9318
					isLookup: '', // 1 or 'Y' for lookup
9319
					isDisplay: true, // true== form is displayfield
9320
				}, {
9321
					xtype: 'minovaform',
9322
					name: "MinovaGridFormEdit",
9323
					tableName: tableName, // nama tabel /dataset
9324
					isLookup: '', // 1 or 'Y' for lookup
9325
					isDisplay: false, // true== form is displayfield
9326
				}
9327
			]
9328
		});
9329
		me.callParent(arguments);
9330
	}
9331
});
9332

    
9333
Ext.define('MinovaUtil.MinovaES.MinovaCustomization', {
9334
	extend: 'Ext.form.Panel',
9335
	alias: ['widget.minovacustomization', 'widget.MinovaCustomization'],
9336
	controller: 'treeCustomization',
9337
	tableName: undefined, //nama tabel
9338
	param: undefined, //param query
9339
	pagesize: undefined,
9340
	storename: undefined,
9341
	titleform: undefined,
9342
	titlegrid: undefined,
9343
	heightgrid: undefined,
9344
	heightform: undefined,
9345
	iseditform: undefined,
9346
	lastheightform: undefined,
9347
	layoutType: undefined,
9348
	lastpage: undefined,
9349
	lastTitle: undefined,
9350
	collapsibleForm: undefined,
9351
	getLastTitle: function () {
9352
		return this.lastTitle;
9353
	},
9354
	setLastTitle: function (value) {
9355
		var me = this;
9356
		me.lastTitle = value;
9357
		return me;
9358
	},
9359
	getLastpage: function () {
9360
		return this.lastpage;
9361
	},
9362
	setLastpage: function (value) {
9363
		var me = this;
9364
		me.lastpage = value;
9365
		return me;
9366
	},
9367
	getLayoutType: function () {
9368
		return this.layoutType;
9369
	},
9370
	setLayoutType: function (value) {
9371
		var me = this;
9372
		me.layoutType = value;
9373
		return me;
9374
	},
9375
	getLastheightform: function () {
9376
		return this.lastheightform;
9377
	},
9378
	setLastheightform: function (value) {
9379
		var me = this;
9380
		me.lastheightform = value;
9381
		return me;
9382
	},
9383

    
9384
	getIsEditform: function () {
9385
		return this.iseditform;
9386
	},
9387
	setIsEditform: function (value) {
9388
		var me = this;
9389
		me.iseditform = value;
9390
		return me;
9391
	},
9392
	initComponent: function () {
9393
		var me = this;
9394
		var storename = me.storename;
9395
		if (storename == "" || storename == undefined) {
9396
			storename = "store" + me.tableName;
9397
		}
9398
		var tableName = me.tableName;
9399
		var collapsibleForm_ = me.collapsibleForm;
9400
		// if (!collapsibleForm_) {
9401
		//  collapsibleForm_ = false;
9402
		//}
9403
		Ext.applyIf(me, {
9404
			items: [{
9405
					layoutType: "MinovaGridForm",
9406
					title: me.titlegrid,
9407
					xtype: "minovagrid1",
9408
					tableName: tableName, // nama tebel/dataset
9409
					name: "MinovaGridFormGrid",
9410
					param: me.param, // parameter filteran
9411
					pagesize: me.pagesize, // jumlah record yang muncul per page
9412
					storename: storename, //nama store bebas
9413
					isLookup: me.isLookup, // apakah grid untuk look up? jika ya isi dengan 1 atau 'Y' kalau bukan isi string kosong
9414
					height: 480,
9415
					bodyPadding: 0,
9416
					tbar: [{
9417
							xtype: 'button',
9418
							text: 'Action',
9419
							name: 'actionGrid',
9420
							menu: [{
9421
									text: 'Add',
9422
									name: 'addGrid',
9423
									action: 'CRUDaddNewRecord',
9424
									style: 'font-family: FontAwesome',
9425
									itemId: 'AddData',
9426
									iconCls: 'fa-plus-circle',
9427

    
9428
								}, {
9429
									text: 'Copy',
9430
									name: 'CopyGrid',
9431
									iconCls: 'fa-copy',
9432
									style: 'font-family: FontAwesome',
9433
								}, {
9434
									text: 'Edit',
9435
									name: 'EditGrid',
9436
									iconCls: 'fa-edit',
9437
									style: 'font-family: FontAwesome',
9438
								}, {
9439
									text: 'Delete',
9440
									name: 'DeleteGrid',
9441
									hidden: true,
9442
									iconCls: 'fa-trash-o',
9443
									style: 'font-family: FontAwesome',
9444
								}
9445
							]
9446
						}, {
9447
							xtype: 'tbfill'
9448
						}, {
9449
							text: 'Search',
9450
							tooltip: 'Search',
9451
							tableName: tableName,
9452
							name: 'btnSearchCust',
9453
							handler: function () {
9454
								//var tolbar = this.up()
9455
								//var grid_ = tolbar.up()
9456
								//alert(this.tableName)
9457

    
9458
							}
9459

    
9460
						}, {
9461
							text: 'Import/Export',
9462
							tooltip: 'Import/Export',
9463
							name: 'Import/Exportbtn',
9464

    
9465
						}, {
9466
							text: 'Clear Filters',
9467
							tooltip: 'Clear all filters',
9468
							name: 'clearbtn',
9469
							handler: function () {
9470
								var tolbar = this.up()
9471
									var grid_ = tolbar.up()
9472
									grid_.filters.clearFilters()
9473
							},hidden:true
9474
						}
9475
					],
9476

    
9477
					dockedItems: [{
9478
							xtype: 'pagingtoolbar',
9479
							store: storename, // harus sama dengan naa store diatas
9480
							dock: 'bottom', //posisi paging
9481
							pageSize: me.pagesize,
9482
							displayInfo: true
9483
						}
9484
					],
9485

    
9486
				}, {
9487
					xtype: 'minovaform',
9488
					//layout: 'anchor',
9489
					height: '200',
9490
					collapsible: collapsibleForm_,
9491
					name: "MinovaGridFormDisplay",
9492
					tableName: tableName, // nama tabel /dataset
9493
					isLookup: '', // 1 or 'Y' for lookup
9494
					isDisplay: true, // true== form is displayfield
9495
				}, {
9496
					xtype: 'minovaform',
9497
					//layout:'anchor',
9498
					collapsible: collapsibleForm_,
9499
					name: "MinovaGridFormEdit",
9500
					tableName: tableName, // nama tabel /dataset
9501
					isLookup: '', // 1 or 'Y' for lookup
9502
					isDisplay: false, // true== form is displayfield
9503
				}
9504
			]
9505
		});
9506
		me.callParent(arguments);
9507
	}
9508
});
9509

    
9510
Ext.define('MinovaUtil.view.override.Panel', {
9511
	override: 'Ext.panel.Panel',
9512

    
9513
	print: function (pnl) {
9514

    
9515
		if (!pnl) {
9516
			pnl = this;
9517
		}
9518

    
9519
		// instantiate hidden iframe
9520

    
9521
		var iFrameId = "printerFrame";
9522
		var printFrame = Ext.get(iFrameId);
9523

    
9524
		if (printFrame == null) {
9525
			printFrame = Ext.getBody().appendChild({
9526
					id: iFrameId,
9527
					tag: 'iframe',
9528
					cls: 'x-hidden',
9529
					style: {
9530
						display: "none"
9531
					}
9532
				});
9533
		}
9534

    
9535
		var cw = printFrame.dom.contentWindow;
9536

    
9537
		// instantiate application stylesheets in the hidden iframe
9538

    
9539
		var stylesheets = "";
9540
		for (var i = 0; i < document.styleSheets.length; i++) {
9541
			stylesheets += Ext.String.format('<link rel="stylesheet" href="{0}" />', document.styleSheets[i].href);
9542
		}
9543

    
9544
		// various style overrides
9545
		stylesheets += ''.concat(
9546
			"<style>",
9547
			".x-panel-body {overflow: visible !important;}",
9548
			// experimental - page break after embedded panels
9549
			// .x-panel {page-break-after: always; margin-top: 10px}",
9550
			"</style>");
9551

    
9552
		// get the contents of the panel and remove hardcoded overflow properties
9553
		var markup = pnl.getEl().dom.innerHTML;
9554
		while (markup.indexOf('overflow: auto;') >= 0) {
9555
			markup = markup.replace('overflow: auto;', '');
9556
		}
9557

    
9558
		var str = Ext.String.format('<html><head>{0}</head><body>{1}</body></html>', stylesheets, markup);
9559

    
9560
		// output to the iframe
9561
		cw.document.open();
9562
		cw.document.write(str);
9563
		cw.document.close();
9564

    
9565
		// remove style attrib that has hardcoded height property
9566
		cw.document.getElementsByTagName('DIV')[0].removeAttribute('style');
9567

    
9568
		// print the iframe
9569
		cw.print();
9570

    
9571
		// destroy the iframe
9572
		Ext.fly(iFrameId).destroy();
9573

    
9574
	}
9575
});
9576

    
9577
Ext.define('MinovaUtil.MinovaES.MinovaRptForm', {
9578
	extend: 'Ext.form.Panel',
9579
	alias: ['widget.MinovaRptForm', 'widget.minovarptform'],
9580
	ReportID: undefined,
9581
	SelectionType: undefined,
9582
	layout: 'column',
9583
	//frame : true,
9584
	defaults: {
9585
		layout: 'form',
9586
		xtype: 'container',
9587
		defaultType: 'textfield',
9588
		style: 'width: 50%',
9589
		//height: 1000
9590
	},
9591
	initComponent: function () {
9592
		var col1 = [];
9593
		var col2 = [];
9594
		var me = this;
9595
		var hasil = null;
9596
		var hideButton_ = me.hideButton;
9597
		Ext.Ajax.request({
9598
			async: false,
9599
			method: 'POST',
9600
			url: '/UserControl/GetStore',
9601
			params: {
9602
				tableName: 'PDSBS0006',
9603
				//param : "ReportID='" + me.ReportID + "' and SelectionType='" + me.SelectionType + "' and LangId='" + localStorage.LangId + "'"
9604
				param: "ReportID='" + me.ReportID + "',SelectionType='" + me.SelectionType + "',LangId='" + localStorage.LangId + "'"
9605
			},
9606
			success: function (response) {
9607
				var results = Ext.decode(response.responseText);
9608
				hasil = results.data;
9609
				//count = hasil.length
9610
			}
9611
		});
9612
		if (hasil.length > 0) {
9613
			hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
9614
			var me = this;
9615
			Ext.each(hasil, function (rec) {
9616
				var null_ = true;
9617
				if (rec.IsRequired == '1') {
9618
					null_ = false;
9619
				} else {
9620
					null_ = true;
9621
				}
9622
				var formfield = MinovaUtil.FieldGenerator.Form(me.name, rec, null_, false, me.tableName, me.isLookup);
9623
				if (isDesk) {
9624
					if (rec.ColumnNo == 1) {
9625
						col1.push(formfield);
9626
					} else {
9627
						col2.push(formfield);
9628
					}
9629
				} else {
9630
					col1.push(formfield);
9631
				}
9632
			});
9633

    
9634
		}
9635
		Ext.applyIf(me, {
9636
			items: [{
9637
					style: 'width: 50%',
9638
					items: col1
9639
				}, {
9640
					style: 'width: 50%',
9641
					items: col2
9642
				}
9643
			],
9644
		});
9645
		this.callParent();
9646
	}
9647
});
9648

    
9649
Ext.define('MinovaUtil.MinovaES.MinovaRptSimple', {
9650
	extend: 'Ext.form.Panel',
9651
	alias: ['widget.MinovaRptSimple', 'widget.minovarptsimple'],
9652
	//layout: 'column',
9653
	controller: 'basereports-controller',
9654
	ReportID: undefined,
9655
	hideButton: undefined,
9656
	reportLayout: 'simple',
9657
	getReportLayout: function () {
9658
		return this.reportLayout;
9659
	},
9660
	setReportLayout: function (value) {
9661
		var me = this;
9662
		me.reportLayout = value;
9663
		return me;
9664
	},
9665

    
9666
	initComponent: function () {
9667
		var me = this;
9668
		var ReportID = me.ReportID;
9669
		var hideButton_ = me.hideButton;
9670
		var hide_ = false;
9671
		if (hideButton_) {
9672
			hide_ = true;
9673
		}
9674
		Ext.applyIf(me, {
9675
			items: [{
9676
					//title: 'Report Selection',
9677
					xtype: 'minovarptform',
9678
					hideButton: hide_,
9679
					name: 'minovarptsimple',
9680
					ReportID: ReportID,
9681
					SelectionType: '1',
9682
					bodyPadding: 10,
9683
					buttons: [{
9684
							text: 'Search',
9685
							name: 'SearchRpt',
9686
							hidden: hide_
9687
						}, {
9688
							text: 'Variant',
9689
							style: 'font-family: FontAwesome',
9690
							hidden: hide_,
9691
							menu: [{
9692
									text: 'Load Variant',
9693
									name: 'loadvariant',
9694

    
9695
								}, {
9696
									text: 'Save Variant',
9697
									name: 'savevariant',
9698

    
9699
								}
9700
							],
9701

    
9702
						}
9703
					],
9704

    
9705
				},
9706
				//{
9707
				//    title: 'Result',
9708
				//    height: 530,
9709
				//    collapsible: false,
9710
				//    name: 'resultPanel',
9711
				//    layout: 'fit',
9712
				//    html: '<div  id="formMdDiv"></div>',
9713
				//}
9714
			],
9715
		});
9716
		this.callParent();
9717
	}
9718
});
9719

    
9720
Ext.define('MinovaUtil.MinovaES.MinovaRptAdvance', {
9721
	extend: 'Ext.form.Panel',
9722
	alias: ['widget.MinovaRptAdvance', 'widget.minovarptadvance'],
9723
	//layout: 'column',
9724
	controller: 'basereports-controller',
9725
	ReportID: undefined,
9726
	reportLayout: 'advance',
9727
	hideButton: undefined,
9728
	getReportLayout: function () {
9729
		return this.reportLayout;
9730
	},
9731
	setReportLayout: function (value) {
9732
		var me = this;
9733
		me.reportLayout = value;
9734
		return me;
9735
	},
9736

    
9737
	initComponent: function () {
9738
		var me = this;
9739
		var ReportID = me.ReportID;
9740
		var hideButton_ = me.hideButton;
9741
		var hide_ = false;
9742
		if (hideButton_) {
9743
			hide_ = true;
9744
		}
9745
		Ext.applyIf(me, {
9746
			items: [{
9747
					//title: 'Report Selection',
9748
					xtype: 'minovarptform',
9749
					hideButton: hide_,
9750
					name: 'minovarptadvance',
9751
					ReportID: ReportID,
9752
					SelectionType: '2',
9753
					bodyPadding: 10,
9754
					buttons: [{
9755
							text: 'Search',
9756
							name: 'SearchRpt',
9757
							hidden: hide_
9758
						}, {
9759
							text: 'Variant',
9760
							hidden: hide_,
9761
							style: 'font-family: FontAwesome',
9762
							menu: [{
9763
									text: 'Load Variant',
9764
									name: 'loadvariant',
9765

    
9766
								}, {
9767
									text: 'Save Variant',
9768
									name: 'savevariant',
9769

    
9770
								}
9771
							],
9772

    
9773
						}
9774
					],
9775

    
9776
				},
9777
				//{
9778
				//    title: 'Result',
9779
				//    height: 530,
9780
				//    collapsible: false,
9781
				//    name: 'resultPanel',
9782
				//    layout: 'fit',
9783
				//    html: '<div  id="formMdDiv"></div>',
9784
				//}
9785
			],
9786
		});
9787
		this.callParent();
9788
	}
9789
});
9790

    
9791
Ext.define('MinovaUtil.MinovaES.MinovaRptAll', {
9792
	extend: 'Ext.form.Panel',
9793
	alias: ['widget.MinovaRptAll', 'widget.minovarptall'],
9794
	//layout: 'column',
9795
	controller: 'basereports-controller',
9796
	ReportID: undefined,
9797
	titleSimle: undefined,
9798
	titleAdvance: undefined,
9799
	reportLayout: 'all',
9800
	hideButton: undefined,
9801
	getReportLayout: function () {
9802
		return this.reportLayout;
9803
	},
9804
	setReportLayout: function (value) {
9805
		var me = this;
9806
		me.reportLayout = value;
9807
		return me;
9808
	},
9809

    
9810
	initComponent: function () {
9811
		var me = this;
9812
		var ReportID = me.ReportID;
9813
		var hideButton_ = me.hideButton;
9814
		var hide_ = false;
9815
		if (hideButton_) {
9816
			hide_ = true;
9817
		}
9818
		Ext.applyIf(me, {
9819
			items: [{
9820
					xtype: 'tabpanel',
9821
					name: 'mainTab',
9822
					buttons: [{
9823
							text: 'Search',
9824
							name: 'SearchRpt',
9825
							hidden: hide_,
9826
						}, {
9827
							text: 'Variant',
9828
							hidden: hide_,
9829
							style: 'font-family: FontAwesome',
9830
							menu: [{
9831
									text: 'Load Variant',
9832
									name: 'loadvariant',
9833

    
9834
								}, {
9835
									text: 'Save Variant',
9836
									name: 'savevariant',
9837

    
9838
								}
9839
							],
9840

    
9841
						}
9842
					],
9843

    
9844
					items: [{
9845
							title: 'Simple',
9846
							xtype: 'minovarptform',
9847
							hideButton: hide_,
9848
							name: 'simpleForm',
9849
							ReportID: ReportID,
9850
							SelectionType: '1',
9851
							bodyPadding: 10,
9852

    
9853
						}, {
9854
							title: 'Advance',
9855
							xtype: 'minovarptform',
9856
							hideButton: hide_,
9857
							name: 'advanceForm',
9858
							ReportID: ReportID,
9859
							SelectionType: '2',
9860
							bodyPadding: 10,
9861

    
9862
						}
9863
					]
9864
				},
9865
				//{
9866
				//    title: 'Result',
9867
				//    height: 530,
9868
				//    collapsible: false,
9869
				//    name: 'resultPanel',
9870
				//    layout: 'fit',
9871
				//    html: '<div  id="formMdDiv"></div>',
9872
				//}
9873

    
9874
			],
9875
		});
9876
		this.callParent();
9877
	}
9878
});
9879

    
9880
Ext.define('MinovaUtil.MinovaES.MinovaGridRpt', {
9881
	extend: 'Ext.grid.Panel',
9882
	requires: ['Ext.grid.RowNumberer'],
9883
	alias: 'widget.minovagridrpt',
9884
	alternateClassName: 'Ext.grid.MinovaGridRpt',
9885
	tableName: undefined,
9886
	param: undefined,
9887
	//pagesize: undefined,
9888
	storename: undefined,
9889
	//layoutType: undefined,
9890
	enableLocking: true,
9891
	tbar: [{
9892
			xtype: 'tbfill'
9893
		}, {
9894
			text: 'Clear Filters',
9895
			tooltip: 'Clear all filters',
9896
			name: 'clearbtn',
9897
			handler: function () {
9898
				var tolbar = this.up()
9899
					var grid_ = tolbar.up()
9900
					grid_.filters.clearFilters()
9901
			},hidden:true
9902
		}, ],
9903
	getTableName: function () {
9904
		return this.tableName;
9905
	},
9906

    
9907
	initComponent: function () {
9908
		var me = this;
9909
		var cols_ = [];
9910
		var fieldeditor = {};
9911
		var hasil = null;
9912
		var autoLoad = true;
9913
		var _url = 'GetAllField';
9914

    
9915
		Ext.Ajax.request({
9916
			async: false,
9917
			method: 'POST',
9918
			url: '/Devt/' + _url + '?tableName=' + me.tableName,
9919
			success: function (response) {
9920
				var results = Ext.decode(response.responseText);
9921
				hasil = results.data;
9922
			}
9923
		});
9924
		var structure = undefined;
9925
		Ext.Ajax.request({
9926
			async: false,
9927
			method: 'POST',
9928
			url: '/UserControl/GetStore',
9929
			params: {
9930
				tableName: 'SDATATABLEFIELD',
9931
				param: 'TableName[equal]' + me.tableName
9932

    
9933
			},
9934
			success: function (response) {
9935
				var results = Ext.decode(response.responseText);
9936
				data_ = results.data;
9937
				if (data_ != undefined) {
9938
					structure = data_;
9939
				}
9940
			}
9941
		});
9942
		if (hasil.length > 0) {
9943
			Ext.each(hasil, function (rec) {
9944
				// get field will be summary
9945

    
9946
				var summaryType = undefined;
9947
				if (structure != undefined) {
9948
					_field = $.grep(structure, function (r) {
9949
							return r.FieldName == rec.FieldName
9950
						});
9951
					summaryType = _field[0].SummaryType
9952
				}
9953

    
9954
				var null_ = null;
9955
				if (rec.IsPrimaryKey == true) {
9956
					null_ = false;
9957
				}
9958
				if (rec.IsRequired == true) {
9959
					null_ = false;
9960
				} else {
9961
					null_ = true;
9962
				}
9963
				if (rec.GridView == 1) {
9964
					switch (rec.FormatRef) {
9965
					case "date":
9966
						cols_.push({
9967
							xtype: 'minovadatecolumn',
9968
							text: rec.HeaderTitle,
9969
							dataIndex: rec.FieldName,
9970
							summaryType: summaryType,
9971
							width: 100,
9972
							filter: {
9973
								type: 'date',
9974
								itemDefaults: {
9975
									emptyText: 'Search for...'
9976
								}
9977
							}
9978
						});
9979
						break
9980
					case "amount":
9981
						cols_.push({
9982
							xtype: 'minovacurrancycolumn',
9983
							align: 'right',
9984
							text: rec.HeaderTitle,
9985
							dataIndex: rec.FieldName,
9986
							summaryType: summaryType,
9987
							width: 100,
9988
							filter: {
9989
								type: 'number',
9990
								itemDefaults: {
9991
									emptyText: 'Search for...'
9992
								}
9993
							}
9994
						});
9995
						break
9996
					case "datetime":
9997
						cols_.push({
9998
							xtype: 'minovadatetimecolumn',
9999
							text: rec.HeaderTitle,
10000
							dataIndex: rec.FieldName,
10001
							summaryType: summaryType,
10002
							width: 140,
10003
							filter: {
10004
								type: 'string',
10005
								itemDefaults: {
10006
									emptyText: 'Search for...'
10007
								}
10008
							}
10009
						});
10010
						break
10011
					default:
10012
						if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
10013
							cols_.push({
10014
								text: rec.HeaderTitle,
10015
								dataIndex: rec.FieldName,
10016
								summaryType: summaryType,
10017
								width: 100,
10018
								filter: {
10019
									type: 'string',
10020
									itemDefaults: {
10021
										emptyText: 'Search for...'
10022
									}
10023
								}
10024
							});
10025
						} else if (rec.TableRef != "") {
10026
							if (rec.TableRef != null) {
10027
								var valueField = null;
10028
								var displayValue = null;
10029
								Ext.Ajax.request({
10030
									async: false,
10031
									method: 'POST',
10032
									url: '/UserControl/GetStore',
10033
									params: {
10034
										tableName: 'SDATATABLEFIELD',
10035
										param: 'TableName[equal]' + rec.TableRef
10036
									},
10037
									success: function (response) {
10038
										var results = Ext.decode(response.responseText);
10039
										data_ = results.data;
10040
										if (data_ != undefined) {
10041
											valueField_ = $.grep(data_, function (r) {
10042
													return r.ValueField == '1'
10043
												});
10044
											valueField = valueField_[0].FieldName
10045
												displayValue_ = $.grep(data_, function (r) {
10046
													return r.DisplayValue == '1'
10047
												});
10048
											displayValue = displayValue_[0].FieldName
10049

    
10050
										}
10051
									}
10052
								});
10053
								var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
10054
								var count_ = 0;
10055
								if (store_) {
10056
									count_ = store_.count();
10057
								}
10058
								if (count_ == 0) {
10059
									Ext.create('Ext.data.Store', {
10060
										storeId: 'store_' + rec.FieldName,
10061
										autoLoad: true,
10062
										proxy: {
10063
											method: 'POST',
10064
											type: 'ajax',
10065
											url: '/UserControl/GetStore',
10066
											extraParams: {
10067
												tableName: rec.TableRef,
10068
												param: rec.ParamCombo
10069
											},
10070
											reader: {
10071
												type: 'json',
10072
												root: 'data',
10073
												totalProperty: 'data[0].TotalCount'
10074
											}
10075
										}
10076
									})
10077
								}
10078
								cols_.push({
10079
									xtype: 'minovacombocolumn',
10080
									TableRef: rec.TableRef,
10081
									text: rec.HeaderTitle,
10082
									summaryType: summaryType,
10083
									dataIndex: rec.FieldName,
10084
									valueField: valueField,
10085
									displayField: displayValue,
10086
									store: 'store_' + rec.FieldName,
10087
									filter: {
10088
										type: 'list',
10089
										itemDefaults: {
10090
											emptyText: 'Search for...'
10091
										}
10092
									}
10093
								});
10094
							}
10095

    
10096
						} else {
10097
							cols_.push({
10098
								text: rec.HeaderTitle,
10099
								dataIndex: rec.FieldName,
10100
								summaryType: summaryType,
10101
								filter: {
10102
									itemDefaults: {
10103
										emptyText: 'Search for...'
10104
									}
10105
								}
10106
							});
10107
						}
10108
						break
10109
					}
10110
				} else {
10111
					cols_.push({
10112
						text: rec.HeaderTitle,
10113
						dataIndex: rec.FieldName,
10114
						hidden: true,
10115
						filter: {
10116
							itemDefaults: {
10117
								emptyText: 'Search for...'
10118
							}
10119
						}
10120
					});
10121
				}
10122
			});
10123
		};
10124
		var param_ = me.param;
10125
		if (param_ == undefined) {
10126
			param_ = ''
10127
		}
10128
		var jsStoreGrid = new Ext.data.Store({
10129
				storeId: me.storename,
10130
				autoLoad: false,
10131
				//pageSize: me.pagesize,
10132
				proxy: {
10133
					method: 'POST',
10134
					type: 'ajax',
10135
					url: '/UserControl/GetStore',
10136
					//extraParams: {
10137
					//    tableName: me.tableName,
10138
					//    param: param_
10139
					//},
10140
					reader: {
10141
						type: 'json',
10142
						root: 'data',
10143
						totalProperty: 'totalRecords'
10144
					}
10145
				}
10146
			});
10147
		Ext.applyIf(me, {
10148
			autoScroll: true,
10149
			enableLocking: true,
10150
			lockedGridConfig: {
10151
				header: false,
10152
				collapsible: true,
10153
				width: 250,
10154
				forceFit: true,
10155
				listeners: {
10156
					render: function (grid) {
10157
						var pagingToolbar = grid.child('pagingtoolbar');
10158
						if (pagingToolbar) {
10159
							grid.remove(pagingToolbar, true);
10160
						}
10161
					}
10162
				}
10163
			},
10164
			listeners: {
10165
				viewready: function () {
10166
					if (autoLoad == true) {
10167
						this.getStore().loadPage(1);
10168
					}
10169

    
10170
				},
10171
				beforeedit: function () {
10172
					return false;
10173
				}
10174
			},
10175
			lockedViewConfig: {
10176
				scroll: 'horizontal'
10177
			},
10178
			viewConfig: {
10179
				emptyText: 'No Data Display',
10180
				deferEmptyText: false
10181
			},
10182
			//features: [{
10183
			//    ftype: 'summary'
10184
			//}],
10185
			columns: cols_,
10186

    
10187
			store: jsStoreGrid,
10188

    
10189
			plugins: [{
10190
					ptype: 'gridfilters'
10191
				},
10192

    
10193
			],
10194

    
10195
		});
10196
		me.callParent(arguments);
10197
	}
10198

    
10199
});
10200

    
10201
Ext.define('MinovaUtil.MinovaES.MinovaEditAbleGrid', {
10202
	extend: 'Ext.form.Panel',
10203
	alias: ['widget.MinovaEditAbleGrid', 'widget.Minovaeditablegrid', 'widget.minovaeditablegrid'],
10204
	requires: [
10205
		'Ext.grid.plugin.CellEditing',
10206
		'Ext.grid.RowNumberer',
10207
		'Ext.grid.Panel',
10208
	],
10209

    
10210
	//renderTo: 'panel-extjs',
10211
	anchor: '100%',
10212
	tableName: undefined,
10213
	hideButton: undefined,
10214
	multiSelect: undefined,
10215
	initComponent: function () {
10216
		var me = this;
10217
		var isLookup = me.isLookup;
10218
		var hide_ = false;
10219
		var widthLock = 250;
10220
		var checkSelection = '';
10221

    
10222
		if (me.hideButton == true) {
10223
			hide_ = true;
10224
		}
10225
		if (me.multiSelect) {
10226
			locking = false;
10227
			checkSelection = 'checkboxmodel';
10228
			widthLock = 40;
10229
		}
10230
		var tableName = me.tableName;
10231
		var cols = [];
10232
		var fieldStore = [];
10233
		var _url = 'GetAllField';
10234
		var hasil = null;
10235
		var height = me.height;
10236
		var storeID = 'store' + me.tableName;
10237
		var gridName = 'grid' + me.name;
10238
		if (me.storeName) {
10239
			storeID = me.storeName;
10240
		}
10241
		var LangID = MinovaUtil.GetLangID();
10242
		var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
10243
			Ext.Ajax.request({
10244
				async: false,
10245
				method: 'POST',
10246
				url: '/UserControl/GetStore',
10247
				params: {
10248
					tableName: 'PDSBS0007',
10249
					param: parameter
10250
				},
10251
				success: function (response) {
10252
					var results = Ext.decode(response.responseText);
10253
					hasil = results.data;
10254
				}
10255
			});
10256
		cols.push({
10257
			xtype: 'rownumberer'
10258
		});
10259
		var addData = 'var data={';
10260
		if (hasil.length > 0) {
10261
			Ext.each(hasil, function (rec) {
10262
				fieldStore.push(rec.FieldName);
10263
				if (rec.FieldName != 'Sequence') {
10264
					addData = addData + rec.FieldName + ":" + "'',";
10265
				}
10266

    
10267
				var null_ = null;
10268
				var ReadOnly_ = false;
10269
				if (rec.IsPrimaryKey == true) {
10270
					null_ = false;
10271
				}
10272
				if (rec.IsRequired == true) {
10273
					null_ = false;
10274
				} else {
10275
					null_ = true;
10276
				}
10277
				if (rec.ReadOnly == '1') {
10278
					ReadOnly_ = true;
10279
				}
10280
				var Hidden_ = false;
10281
				if (rec.ReadOnly == '1') {
10282
					ReadOnly_ = true;
10283
				}
10284

    
10285
				if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
10286
					Hidden_ = true;
10287
					null_ = true;
10288
				}
10289

    
10290
				if (rec.GridView == 1) {
10291
					switch (rec.FormatRef) {
10292
					case "date":
10293
						cols.push({
10294
							xtype: 'minovadatecolumn',
10295
							hidden: Hidden_,
10296
							text: rec.HeaderTitle,
10297
							dataIndex: rec.FieldName,
10298
							filter: {
10299
								itemDefaults: {
10300
									emptyText: 'Search for...',
10301

    
10302
								}
10303
							},
10304
							editor: {
10305
								allowBlank: null_,
10306
								xtype: 'datefield',
10307
								hideMode: 'visibility',
10308
								readOnly: ReadOnly_,
10309
								id: tableName + rec.FieldName,
10310
								fieldGrid: rec.FieldName,
10311
								nameTable: rec.TableName,
10312
							}
10313
						});
10314
						break
10315
					case "amount":
10316
						cols.push({
10317
							xtype: 'minovacurrancycolumnround',
10318
							//renderer: Ext.util.Format.numberRenderer("0,0"),
10319
							text: rec.HeaderTitle,
10320
							align: 'right',
10321
							dataIndex: rec.FieldName,
10322
							hidden: Hidden_,
10323
							filter: {
10324
								itemDefaults: {
10325
									emptyText: 'Search for...'
10326
								}
10327
							},
10328
							editor: {
10329
								allowBlank: null_,
10330
								xtype: 'minovacurrencyfield',
10331
								//renderer: Ext.util.Format.numberRenderer("0,0"),
10332
								//vtype: 'validateDecimal',
10333
								readOnly: ReadOnly_,
10334
								id: tableName + rec.FieldName,
10335
								nameTable: rec.TableName,
10336
								fieldGrid: rec.FieldName,
10337
								fieldStyle: 'text-align:right;',
10338
								value: '0',
10339
								listeners: { //// add by Tri nwh 20220711
10340
										change: function (val, recs) {
10341
											var fvalue = val.getValue();
10342
											var custumFunc = rec.SelectFunction;
10343
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
10344
												Ext.Ajax.request({
10345
													async: false,
10346
													method: 'POST',
10347
													url: '/UserControl/GetStore',
10348
													params: {
10349
														tableName: 'PCMFUNC',
10350
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
10351
													},
10352
													success: function (response) {
10353
														var results = Ext.decode(response.responseText);
10354
														var dt = results.data[0];
10355
														if (dt != undefined) {
10356
															custumFunc = dt.FunctionCode;
10357
														}
10358
													}
10359
												});
10360
											}
10361
											if (custumFunc) {
10362
												eval(custumFunc)
10363
											}
10364
										}
10365
									}
10366
							}
10367
						});
10368
						break
10369
					case "time":
10370
						var DefaultValue = rec.DefaultValue;
10371
						if (DefaultValue == '') {
10372
							defaultValue = '00:00';
10373
						}
10374
						cols.push({
10375
							//xtype: 'minovatimecolumn',
10376
							xtype: 'timefield',
10377
							format: 'H:i',
10378
							submitFormat: 'Hi',
10379
							text: rec.HeaderTitle,
10380
							dataIndex: rec.FieldName,
10381
							hidden: Hidden_,
10382
							//renderer: Ext.util.Format.dateRenderer('G:i'),
10383
							filter: {
10384
								itemDefaults: {
10385
									emptyText: 'Search for...'
10386
								}
10387
							},
10388
							editor: {
10389
								allowBlank: null_,
10390
								xtype: 'timefield',
10391
								readOnly: ReadOnly_,
10392
								id: tableName + rec.FieldName,
10393
								format: 'H:i',
10394
								submitFormat: 'Hi',
10395
								increment: 5,
10396
								value: DefaultValue,
10397
								anchor: '100%',
10398
								listeners: {}
10399
								//renderer: Ext.util.Format.dateRenderer('G:i'),
10400
							}
10401
						});
10402
						break
10403
						//case "datetime":
10404
						//    if (rec.DataRef != 'CREATEDT' && rec.DataRef != 'CHANGEDT') {
10405
						//        cols.push({
10406
						//            xtype: 'minovadatetimecolumn',
10407
						//            text: rec.HeaderTitle,
10408
						//            dataIndex: rec.FieldName,
10409
						//            filter: {
10410
						//                itemDefaults: {
10411
						//                    emptyText: 'Search for...'
10412
						//                }
10413
						//            },
10414
						//            editor: {
10415
						//                allowBlank: null_,
10416
						//                xtype: 'textfield',
10417
						//            }
10418
						//        });
10419
						//    }
10420
						//    break
10421
					default:
10422
						if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
10423
							cols.push({
10424
								text: rec.HeaderTitle,
10425
								dataIndex: rec.FieldName,
10426
								width: 100,
10427
								filter: {
10428
									type: 'string',
10429
									itemDefaults: {
10430
										emptyText: 'Search for...'
10431
									}
10432
								}
10433
							});
10434
						} else if (rec.SearchType == '0') {
10435
							var valueField = null;
10436
							var displayValue = null;
10437
							var TableRef = undefined;
10438
							if (rec.TableRef != '') {
10439
								TableRef = rec.TableRef;
10440

    
10441
								Ext.Ajax.request({
10442
									async: false,
10443
									method: 'POST',
10444
									url: '/UserControl/GetStore',
10445
									params: {
10446
										tableName: 'SDATATABLEFIELD',
10447
										param: 'TableName[equal]' + rec.TableRef
10448
									},
10449
									success: function (response) {
10450
										var results = Ext.decode(response.responseText);
10451
										data_ = results.data;
10452
										if (data_ != undefined) {
10453
											valueField_ = $.grep(data_, function (r) {
10454
													return r.ValueField == '1'
10455
												});
10456
											valueField = valueField_[0].FieldName
10457
												displayValue_ = $.grep(data_, function (r) {
10458
													return r.DisplayValue == '1'
10459
												});
10460
											displayValue = displayValue_[0].FieldName
10461
										}
10462
									}
10463
								});
10464

    
10465
								//create Store
10466
								Ext.create('Ext.data.Store', {
10467
									storeId: 'store_' + me.tableName + rec.FieldName,
10468
									autoLoad: true,
10469
									proxy: {
10470
										method: 'POST',
10471
										type: 'ajax',
10472
										url: '/UserControl/GetStoreAuth',
10473
										extraParams: {
10474
											tableName: TableRef,
10475
											param: rec.ParamCombo,
10476
											menuId: MinovaUtil.GetMenuID()
10477
										},
10478
										reader: {
10479
											type: 'json',
10480
											root: 'data',
10481
											totalProperty: 'data[0].TotalCount'
10482
										}
10483
									}
10484
								});
10485
							} else if (rec.FixedValue != '') {
10486
								var storeData = [];
10487
								var str = rec.FixedValue;
10488
								var hasil = str.split('||');
10489
								hasil.forEach(function (h) {
10490
									store_ = h.split('=')
10491
										storeData.push({
10492
											code: store_[0],
10493
											desc: store_[1],
10494

    
10495
										});
10496
								});
10497

    
10498
								valueField = 'code';
10499
								displayValue = 'desc';
10500

    
10501
								Ext.create('Ext.data.Store', {
10502
									storeId: 'store_' + me.tableName + rec.FieldName,
10503
									autoLoad: true,
10504
									data: storeData
10505
								})
10506
							}
10507

    
10508
							cols.push({
10509
								xtype: 'minovacombocolumn',
10510
								hidden: Hidden_,
10511
								text: rec.HeaderTitle,
10512
								dataIndex: rec.FieldName,
10513
								valueField: valueField,
10514
								displayField: displayValue,
10515
								store: 'store_' + me.tableName + rec.FieldName,
10516
								editor: {
10517
									allowBlank: null_,
10518
									xtype: 'combobox',
10519
									readOnly: ReadOnly_,
10520
									id: tableName + rec.FieldName,
10521
									nameTable: rec.TableName,
10522
									fieldGrid: rec.FieldName,
10523
									valueField: valueField,
10524
									displayField: displayValue,
10525
									vtype: 'validateCombobox',
10526
									store: 'store_' + me.tableName + rec.FieldName,
10527
								},
10528
								filter: {
10529
									type: 'list',
10530
									itemDefaults: {
10531
										emptyText: 'Search for...'
10532
									}
10533
								}
10534
							});
10535

    
10536
						} else if (rec.SearchType == '2') {
10537
							var triger = (rec.TriggerCombo).split('$');
10538
							var targetField_ = triger[0];
10539
							var fieldValue_ = triger[1];
10540
							cols.push({
10541
								text: rec.HeaderTitle,
10542
								hidden: Hidden_,
10543
								dataIndex: rec.FieldName,
10544
								filter: {
10545
									itemDefaults: {
10546
										emptyText: 'Search for...'
10547
									}
10548
								},
10549
								editor: {
10550
									allowBlank: null_,
10551
									xtype: 'minovalookupgrid',
10552
									readOnly: ReadOnly_,
10553
									isGrid: true,
10554
									fieldTarget: targetField_,
10555
									fieldValue: fieldValue_,
10556
									isGrid: true,
10557
									id: tableName + rec.FieldName,
10558
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
10559
									triggerCls: 'x-form-search-trigger',
10560
									vtype: 'alphanum', // disable space
10561
									nameTable: rec.TableName,
10562
									fieldGrid: rec.FieldName,
10563
									LookupFunction: rec.LookupFunction,
10564
									listeners: {
10565
										change: function (val) {
10566
											var custumFunc = rec.SelectFunction;
10567
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
10568
												Ext.Ajax.request({
10569
													async: false,
10570
													method: 'POST',
10571
													url: '/UserControl/GetStore',
10572
													params: {
10573
														tableName: 'PCMFUNC',
10574
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
10575
													},
10576
													success: function (response) {
10577
														var results = Ext.decode(response.responseText);
10578
														data_ = results.data[0];
10579
														if (data_ != undefined) {
10580
															custumFunc = data_.FunctionCode;
10581
														}
10582
													}
10583
												});
10584
											}
10585
											if (custumFunc) {
10586
												eval(custumFunc)
10587
											}
10588
										}
10589
									}
10590
								}
10591
							});
10592
						} else if (rec.SearchType == '3') {
10593
							cols.push({
10594
								text: rec.HeaderTitle,
10595
								hidden: Hidden_,
10596
								dataIndex: rec.FieldName,
10597
								filter: {
10598
									itemDefaults: {
10599
										emptyText: 'Search for...'
10600
									}
10601
								},
10602
								editor: {
10603
									allowBlank: null_,
10604
									// xtype: 'minovalookuptreePopup',
10605
									xtype: 'MinovaLookupTree',
10606
									readOnly: ReadOnly_,
10607
									id: tableName + rec.FieldName,
10608
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
10609
									triggerCls: 'x-form-search-trigger',
10610
									vtype: 'alphanum', // disable space
10611
									treeSructure: rec.SearchFunction, //'O-O-P',
10612
									objClassValue: rec.ParamCombo, //'O',
10613
									nameTable: rec.TableName,
10614
									fieldGrid: rec.FieldName,
10615
									listeners: {
10616
										change: function (val) {
10617
											var custumFunc = rec.SelectFunction;
10618
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
10619
												Ext.Ajax.request({
10620
													async: false,
10621
													method: 'POST',
10622
													url: '/UserControl/GetStore',
10623
													params: {
10624
														tableName: 'PCMFUNC',
10625
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
10626
													},
10627
													success: function (response) {
10628
														var results = Ext.decode(response.responseText);
10629
														data_ = results.data[0];
10630
														if (data_ != undefined) {
10631
															custumFunc = data_.FunctionCode;
10632
														}
10633
													}
10634
												});
10635
											}
10636
											if (custumFunc) {
10637
												eval(custumFunc)
10638
											}
10639
										}
10640
									}
10641
								}
10642
							});
10643
						} 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) {
10644
							var triger = (rec.TriggerCombo).split('&');
10645
							var targetField_ = triger[0];
10646
							var fieldValue_ = triger[0];
10647
							cols.push({
10648
								text: rec.HeaderTitle,
10649
								hidden: Hidden_,
10650
								dataIndex: rec.FieldName,
10651
								filter: {
10652
									itemDefaults: {
10653
										emptyText: 'Search for...'
10654
									}
10655
								},
10656
								editor: {
10657
									allowBlank: null_,
10658
									xtype: 'lookupemployee',
10659
									readOnly: ReadOnly_,
10660
									isGrid: true,
10661
									fieldTarget: targetField_,
10662
									fieldValue: fieldValue_,
10663
									isGrid: true,
10664
									id: tableName + rec.FieldName,
10665
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
10666
									triggerCls: 'x-form-search-trigger',
10667
									vtype: 'alphanum', // disable space
10668
									nameTable: rec.TableName,
10669
									fieldGrid: rec.FieldName,
10670
									listeners: {
10671
										change: function (val) {
10672
											var custumFunc = rec.SelectFunction;
10673
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
10674
												Ext.Ajax.request({
10675
													async: false,
10676
													method: 'POST',
10677
													url: '/UserControl/GetStore',
10678
													params: {
10679
														tableName: 'PCMFUNC',
10680
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
10681
													},
10682
													success: function (response) {
10683
														var results = Ext.decode(response.responseText);
10684
														data_ = results.data[0];
10685
														if (data_ != undefined) {
10686
															custumFunc = data_.FunctionCode;
10687
														}
10688
													}
10689
												});
10690
											}
10691
											if (custumFunc) {
10692
												eval(custumFunc)
10693
											}
10694
										}
10695
									}
10696
								}
10697
							});
10698
						} else if (rec.SearchType == '4' && isLookup != true) {
10699
							cols.push({
10700

    
10701
								text: rec.HeaderTitle,
10702
								hidden: Hidden_,
10703
								dataIndex: rec.FieldName,
10704
								filter: {
10705
									itemDefaults: {
10706
										emptyText: 'Search for...'
10707
									}
10708
								},
10709
								editor: {
10710
									allowBlank: null_,
10711
									xtype: 'lookupemployee',
10712
									readOnly: ReadOnly_,
10713
									isGrid: true,
10714
									fieldTarget: targetField_,
10715
									fieldValue: fieldValue_,
10716
									isGrid: true,
10717
									id: tableName + rec.FieldName,
10718
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
10719
									triggerCls: 'x-form-search-trigger',
10720
									vtype: 'alphanum', // disable space
10721
									nameTable: rec.TableName,
10722
									fieldGrid: rec.FieldName,
10723
									listeners: {
10724
										change: function (val) {
10725
											var custumFunc = rec.SelectFunction;
10726
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
10727
												Ext.Ajax.request({
10728
													async: false,
10729
													method: 'POST',
10730
													url: '/UserControl/GetStore',
10731
													params: {
10732
														tableName: 'PCMFUNC',
10733
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
10734
													},
10735
													success: function (response) {
10736
														var results = Ext.decode(response.responseText);
10737
														data_ = results.data[0];
10738
														if (data_ != undefined) {
10739
															custumFunc = data_.FunctionCode;
10740
														}
10741
													}
10742
												});
10743
											}
10744
											if (custumFunc) {
10745
												eval(custumFunc)
10746
											}
10747
										}
10748
									}
10749
								}
10750
							});
10751
						} else {
10752
							if (rec.FieldDataType == 3) { //add by taufan
10753
								cols.push({
10754
									text: rec.HeaderTitle,
10755
									hidden: Hidden_,
10756
									dataIndex: rec.FieldName,
10757
									filter: {
10758
										itemDefaults: {
10759
											emptyText: 'Search for...'
10760
										}
10761
									},
10762
									editor: {
10763
										allowBlank: null_,
10764
										xtype: 'textfield',
10765
										readOnly: ReadOnly_,
10766
										id: tableName + rec.FieldName,
10767
										nameTable: rec.TableName,
10768
										fieldGrid: rec.FieldName,
10769
										vtype: 'validateDecimal',
10770
										maxLength: rec.Length,
10771
										precision: rec.Prec,
10772
										fieldStyle: 'text-align:right;',
10773
										listeners: {
10774
											change: function (val) {
10775
												var custumFunc = null;
10776
												Ext.Ajax.request({
10777
													async: false,
10778
													method: 'POST',
10779
													url: '/UserControl/GetStore',
10780
													params: {
10781
														tableName: 'SDATATABLEFIELD',
10782
														param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
10783
													},
10784
													success: function (response) {
10785
														var results = Ext.decode(response.responseText);
10786
														data_ = results.data[0];
10787
														if (data_ != undefined) {
10788
															custumFunc = data_.SelectFunction;
10789
															//console.log(data_)
10790
														}
10791
													}
10792
												});
10793

    
10794
												if (custumFunc) {
10795
													eval(custumFunc)
10796
												}
10797
											}
10798
										}
10799
									}
10800
								});
10801
							} else {
10802
								cols.push({
10803
									text: rec.HeaderTitle,
10804
									hidden: Hidden_,
10805
									dataIndex: rec.FieldName,
10806
									filter: {
10807
										itemDefaults: {
10808
											emptyText: 'Search for...'
10809
										}
10810
									},
10811
									editor: {
10812
										allowBlank: null_,
10813
										xtype: 'textfield',
10814
										readOnly: ReadOnly_,
10815
										id: tableName + rec.FieldName,
10816
										nameTable: rec.TableName,
10817
										fieldGrid: rec.FieldName,
10818
										listeners: {
10819
											change: function (val) {
10820
												var custumFunc = null;
10821
												Ext.Ajax.request({
10822
													async: false,
10823
													method: 'POST',
10824
													url: '/UserControl/GetStore',
10825
													params: {
10826
														tableName: 'SDATATABLEFIELD',
10827
														param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
10828
													},
10829
													success: function (response) {
10830
														var results = Ext.decode(response.responseText);
10831
														data_ = results.data[0];
10832
														if (data_ != undefined) {
10833
															custumFunc = data_.SelectFunction;
10834
															//console.log(data_)
10835
														}
10836
													}
10837
												});
10838

    
10839
												if (custumFunc) {
10840
													eval(custumFunc)
10841
												}
10842
											}
10843
										}
10844
									}
10845
								});
10846
							}
10847
						}
10848

    
10849
						break
10850

    
10851
					}
10852
				} else {
10853
					cols.push({
10854
						text: rec.HeaderTitle,
10855
						hidden: Hidden_,
10856
						dataIndex: rec.FieldName,
10857
						hidden: true,
10858
						editor: {
10859
							allowBlank: true,
10860
							xtype: 'textfield',
10861
							readOnly: ReadOnly_,
10862
							id: tableName + rec.FieldName,
10863
							nameTable: rec.TableName,
10864
							fieldGrid: rec.FieldName,
10865
						},
10866
						filter: {
10867
							itemDefaults: {
10868
								emptyText: 'Search for...'
10869
							}
10870
						}
10871
					});
10872
				}
10873
			});
10874

    
10875
		};
10876
		addData = addData + "}";
10877
		Ext.applyIf(me, {
10878
			items: [{
10879
					xtype: 'grid',
10880
					id: gridName,
10881
					name: gridName,
10882
					height: height,
10883
					viewConfig: {
10884
						emptyText: 'No Data Display',
10885
						deferEmptyText: false,
10886
						//Add Nana For Autosize Column Mode
10887
						listeners: {
10888
							refresh: function (dataview) {
10889
								Ext.each(dataview.panel.columns, function (column) {
10890
									//if (column.autoSizeColumn == false)
10891
									//	column.autoSizeColumn = true;
10892
									column.autoSize();
10893
									//dataview.store.reload();
10894
								})
10895
							}
10896
						},
10897
						render: function (comp) {
10898
							comp.getStore().reload();
10899
							console.log(comp);
10900
						}
10901
					},
10902
					//store: 'gridStore',
10903
					store: Ext.create('Ext.data.Store', {
10904
						storeId: storeID,
10905
						fields: fieldStore,
10906
						proxy: {
10907
							method: 'POST',
10908
							type: 'ajax',
10909
							url: '',
10910
							reader: {
10911
								type: 'json',
10912
								root: 'data'
10913
							}
10914
						}
10915
					}),
10916
					dockedItems: [{
10917
							xtype: 'toolbar',
10918
							items: [{
10919
									text: 'Add',
10920
									hidden: hide_,
10921
									name: tableName + 'Add',
10922
									iconCls: 'fa-plus-circle',
10923
									style: 'font-family: FontAwesome',
10924
									handler: function () {
10925
										var store = Ext.StoreMgr.lookup(storeID)
10926
											idx = store.getCount();
10927
										var action = getParam('action');
10928
										var data = '';
10929
										var Sequence = 0;
10930
										if (idx == 0) {
10931
											Sequence = 1;
10932
										} else {
10933
											Sequence = 1 + idx;
10934
										}
10935
										//data = {
10936
										//    Sequence: Sequence
10937
										//};
10938

    
10939
										var seq = 'Sequence';
10940
										var SequenceValue = Sequence;
10941
										eval(addData);
10942
										data[seq] = SequenceValue;
10943

    
10944
										store.insert(idx, data);
10945
									}
10946

    
10947
								}, {
10948
									text: 'Delete',
10949
									hidden: hide_,
10950
									name: tableName + 'DeleteText',
10951
									iconCls: 'fa-trash-o',
10952
									style: 'font-family: FontAwesome',
10953
									//disabled: true
10954
									handler: function () {
10955
										var me = this,
10956
										store = Ext.StoreMgr.lookup(storeID)
10957

    
10958
											var grid = Ext.getCmp(gridName);
10959

    
10960
										Ext.MessageBox.show({
10961
											title: 'Remove tab',
10962
											msg: "This will remove. Do you want to continue?",
10963
											buttons: Ext.MessageBox.YESNO,
10964
											fn: function (choice) {
10965
												console.log(choice);
10966
												if (choice === 'yes') {
10967
													var selection = grid.getView().getSelectionModel().getSelection()[0];
10968
													if (selection) {
10969
														store.remove(selection);
10970
													}
10971
												}
10972
												//delete panel.pendingClose;
10973
											}
10974
										});
10975
									}
10976

    
10977
								}
10978
							]
10979
						}
10980
					],
10981
					columns: cols,
10982
					selType: checkSelection,
10983
					//selType: 'rowmodel',
10984
					plugins: {
10985
						ptype: 'rowediting',
10986
						pluginId: 'rowEditing',
10987
						clicksToEdit: 0,
10988
						listeners: {
10989
							//edit: 'onGridEditorEdit'
10990
						}
10991
					}
10992
				}, ]
10993

    
10994
		});
10995

    
10996
		me.callParent(arguments);
10997
	}
10998
});
10999

    
11000
Ext.define('MinovaUtil.MinovaES.MinovaCellEditGrid', {
11001
	extend: 'Ext.form.Panel',
11002
	alias: ['widget.MinovaCellEditGrid', 'widget.minovacelleditgrid'],
11003
	requires: [
11004
		'Ext.grid.plugin.CellEditing',
11005
		'Ext.grid.Panel',
11006
	],
11007

    
11008
	//renderTo: 'panel-extjs',
11009
	anchor: '100%',
11010
	tableName: undefined,
11011
	hideButton: undefined,
11012
	multiSelect: undefined,
11013
	initComponent: function () {
11014
		var me = this;
11015
		var isLookup = me.isLookup;
11016
		var hide_ = false;
11017
		var widthLock = 250;
11018
		var checkSelection = '';
11019

    
11020
		if (me.hideButton == true) {
11021
			hide_ = true;
11022
		}
11023
		if (me.multiSelect) {
11024
			locking = false;
11025
			checkSelection = 'checkboxmodel';
11026
			widthLock = 40;
11027
		}
11028
		var tableName = me.tableName;
11029
		var cols = [];
11030
		var fieldStore = [];
11031
		var _url = 'GetAllField';
11032
		var hasil = null;
11033
		var height = me.height;
11034
		var storeID = 'store' + me.tableName;
11035
		var gridName = 'grid' + me.name;
11036
		if (me.storeName) {
11037
			storeID = me.storeName;
11038
		}
11039
		var LangID = MinovaUtil.GetLangID();
11040
		var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
11041
			Ext.Ajax.request({
11042
				async: false,
11043
				method: 'POST',
11044
				url: '/UserControl/GetStore',
11045
				params: {
11046
					tableName: 'PDSBS0007',
11047
					param: parameter
11048
				},
11049
				success: function (response) {
11050
					var results = Ext.decode(response.responseText);
11051
					hasil = results.data;
11052
				}
11053
			});
11054
		if (hasil.length > 0) {
11055
			Ext.each(hasil, function (rec) {
11056
				fieldStore.push(rec.FieldName)
11057

    
11058
				var null_ = null;
11059
				var ReadOnly_ = false;
11060
				if (rec.IsPrimaryKey == true) {
11061
					null_ = false;
11062
				}
11063
				if (rec.IsRequired == true) {
11064
					null_ = false;
11065
				} else {
11066
					null_ = true;
11067
				}
11068
				if (rec.ReadOnly == '1') {
11069
					ReadOnly_ = true;
11070
				}
11071
				var Hidden_ = false;
11072
				if (rec.ReadOnly == '1') {
11073
					ReadOnly_ = true;
11074
				}
11075

    
11076
				if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
11077
					Hidden_ = true;
11078
					null_ = true;
11079
				}
11080

    
11081
				if (rec.GridView == 1) {
11082
					switch (rec.FormatRef) {
11083
					case "date":
11084
						cols.push({
11085
							xtype: 'minovadatecolumn',
11086
							hidden: Hidden_,
11087
							text: rec.HeaderTitle,
11088
							dataIndex: rec.FieldName,
11089
							filter: {
11090
								itemDefaults: {
11091
									emptyText: 'Search for...',
11092

    
11093
								}
11094
							},
11095
							editor: {
11096
								allowBlank: null_,
11097
								xtype: 'datefield',
11098
								hideMode: 'visibility',
11099
								readOnly: ReadOnly_,
11100
								id: tableName + rec.FieldName,
11101
							}
11102
						});
11103
						break
11104
					case "amount":
11105
						cols.push({
11106
							xtype: 'minovacurrancycolumn',
11107
							text: rec.HeaderTitle,
11108
							align: 'right',
11109
							dataIndex: rec.FieldName,
11110
							hidden: Hidden_,
11111
							filter: {
11112
								itemDefaults: {
11113
									emptyText: 'Search for...'
11114
								}
11115
							},
11116
							editor: {
11117
								allowBlank: null_,
11118
								xtype: 'textfield',
11119
								readOnly: ReadOnly_,
11120
								id: tableName + rec.FieldName,
11121
							}
11122
						});
11123
						break
11124
						//case "datetime":
11125
						//    if (rec.DataRef != 'CREATEDT' && rec.DataRef != 'CHANGEDT') {
11126
						//        cols.push({
11127
						//            xtype: 'minovadatetimecolumn',
11128
						//            text: rec.HeaderTitle,
11129
						//            dataIndex: rec.FieldName,
11130
						//            filter: {
11131
						//                itemDefaults: {
11132
						//                    emptyText: 'Search for...'
11133
						//                }
11134
						//            },
11135
						//            editor: {
11136
						//                allowBlank: null_,
11137
						//                xtype: 'textfield',
11138
						//            }
11139
						//        });
11140
						//    }
11141
						//    break
11142
					default:
11143
						if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
11144
							cols.push({
11145
								text: rec.HeaderTitle,
11146
								dataIndex: rec.FieldName,
11147
								width: 100,
11148
								filter: {
11149
									type: 'string',
11150
									itemDefaults: {
11151
										emptyText: 'Search for...'
11152
									}
11153
								}
11154
							});
11155
						} else if (rec.SearchType == '0') {
11156
							var valueField = null;
11157
							var displayValue = null;
11158
							var TableRef = undefined;
11159
							if (rec.TableRef != '') {
11160
								TableRef = rec.TableRef;
11161

    
11162
								Ext.Ajax.request({
11163
									async: false,
11164
									method: 'POST',
11165
									url: '/UserControl/GetStore',
11166
									params: {
11167
										tableName: 'SDATATABLEFIELD',
11168
										param: 'TableName[equal]' + rec.TableRef
11169
									},
11170
									success: function (response) {
11171
										var results = Ext.decode(response.responseText);
11172
										data_ = results.data;
11173
										if (data_ != undefined) {
11174
											valueField_ = $.grep(data_, function (r) {
11175
													return r.ValueField == '1'
11176
												});
11177
											valueField = valueField_[0].FieldName
11178
												displayValue_ = $.grep(data_, function (r) {
11179
													return r.DisplayValue == '1'
11180
												});
11181
											displayValue = displayValue_[0].FieldName
11182
										}
11183
									}
11184
								});
11185

    
11186
								//create Store
11187
								Ext.create('Ext.data.Store', {
11188
									storeId: 'store_' + me.tableName + rec.FieldName,
11189
									autoLoad: true,
11190
									proxy: {
11191
										method: 'POST',
11192
										type: 'ajax',
11193
										url: '/UserControl/GetStoreAuth',
11194
										extraParams: {
11195
											tableName: TableRef,
11196
											param: rec.ParamCombo,
11197
											menuId: MinovaUtil.GetMenuID()
11198
										},
11199
										reader: {
11200
											type: 'json',
11201
											root: 'data',
11202
											totalProperty: 'data[0].TotalCount'
11203
										}
11204
									}
11205
								});
11206

    
11207
							} else if (rec.FixedValue != '') {
11208
								var storeData = [];
11209
								var str = rec.FixedValue;
11210
								var hasil = str.split('||');
11211
								hasil.forEach(function (h) {
11212
									store_ = h.split('=')
11213
										storeData.push({
11214
											code: store_[0],
11215
											desc: store_[1],
11216

    
11217
										});
11218
								});
11219

    
11220
								valueField = 'code';
11221
								displayValue = 'desc';
11222

    
11223
								Ext.create('Ext.data.Store', {
11224
									storeId: 'store_' + me.tableName + rec.FieldName,
11225
									autoLoad: true,
11226
									data: storeData
11227
								})
11228
							}
11229

    
11230
							cols.push({
11231
								xtype: 'minovacombocolumn',
11232
								hidden: Hidden_,
11233
								text: rec.HeaderTitle,
11234
								dataIndex: rec.FieldName,
11235
								valueField: valueField,
11236
								displayField: displayValue,
11237
								store: 'store_' + me.tableName + rec.FieldName,
11238
								editor: {
11239
									allowBlank: null_,
11240
									xtype: 'combobox',
11241
									readOnly: ReadOnly_,
11242
									id: tableName + rec.FieldName,
11243
									valueField: valueField,
11244
									displayField: displayValue,
11245
									store: 'store_' + me.tableName + rec.FieldName,
11246
								},
11247
								filter: {
11248
									type: 'list',
11249
									itemDefaults: {
11250
										emptyText: 'Search for...'
11251
									}
11252
								}
11253
							});
11254

    
11255
						} else if (rec.SearchType == '2') {
11256
							var triger = (rec.TriggerCombo).split('$');
11257
							var targetField_ = triger[0];
11258
							var fieldValue_ = triger[1];
11259
							cols.push({
11260
								text: rec.HeaderTitle,
11261
								hidden: Hidden_,
11262
								dataIndex: rec.FieldName,
11263
								filter: {
11264
									itemDefaults: {
11265
										emptyText: 'Search for...'
11266
									}
11267
								},
11268
								editor: {
11269
									allowBlank: null_,
11270
									xtype: 'minovalookupgrid',
11271
									readOnly: ReadOnly_,
11272
									isGrid: true,
11273
									fieldTarget: targetField_,
11274
									fieldValue: fieldValue_,
11275
									isGrid: true,
11276
									id: tableName + rec.FieldName,
11277
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
11278
									triggerCls: 'x-form-search-trigger',
11279
									vtype: 'alphanum', // disable space
11280

    
11281
									listeners: {
11282
										change: function (val) {
11283
											var custumFunc = rec.SelectFunction;
11284
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
11285
												Ext.Ajax.request({
11286
													async: false,
11287
													method: 'POST',
11288
													url: '/UserControl/GetStore',
11289
													params: {
11290
														tableName: 'PCMFUNC',
11291
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
11292
													},
11293
													success: function (response) {
11294
														var results = Ext.decode(response.responseText);
11295
														data_ = results.data[0];
11296
														if (data_ != undefined) {
11297
															custumFunc = data_.FunctionCode;
11298
														}
11299
													}
11300
												});
11301
											}
11302
											if (custumFunc) {
11303
												eval(custumFunc)
11304
											}
11305
										}
11306
									}
11307
								}
11308
							});
11309
						} else if (rec.SearchType == '3') {
11310
							cols.push({
11311
								text: rec.HeaderTitle,
11312
								hidden: Hidden_,
11313
								dataIndex: rec.FieldName,
11314
								filter: {
11315
									itemDefaults: {
11316
										emptyText: 'Search for...'
11317
									}
11318
								},
11319
								editor: {
11320
									allowBlank: null_,
11321
									// xtype: 'minovalookuptreePopup',
11322
									xtype: 'MinovaLookupTree',
11323
									readOnly: ReadOnly_,
11324
									id: tableName + rec.FieldName,
11325
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
11326
									triggerCls: 'x-form-search-trigger',
11327
									vtype: 'alphanum', // disable space
11328
									treeSructure: rec.SearchFunction, //'O-O-P',
11329
									objClassValue: rec.ParamCombo, //'O',
11330
									listeners: {
11331
										change: function (val) {
11332
											var custumFunc = rec.SelectFunction;
11333
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
11334
												Ext.Ajax.request({
11335
													async: false,
11336
													method: 'POST',
11337
													url: '/UserControl/GetStore',
11338
													params: {
11339
														tableName: 'PCMFUNC',
11340
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
11341
													},
11342
													success: function (response) {
11343
														var results = Ext.decode(response.responseText);
11344
														data_ = results.data[0];
11345
														if (data_ != undefined) {
11346
															custumFunc = data_.FunctionCode;
11347
														}
11348
													}
11349
												});
11350
											}
11351
											if (custumFunc) {
11352
												eval(custumFunc)
11353
											}
11354
										}
11355
									}
11356
								}
11357
							});
11358
						} 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) {
11359
							var triger = (rec.TriggerCombo).split('&');
11360
							var targetField_ = triger[0];
11361
							var fieldValue_ = triger[0];
11362
							cols.push({
11363
								text: rec.HeaderTitle,
11364
								hidden: Hidden_,
11365
								dataIndex: rec.FieldName,
11366
								filter: {
11367
									itemDefaults: {
11368
										emptyText: 'Search for...'
11369
									}
11370
								},
11371
								editor: {
11372
									allowBlank: null_,
11373
									xtype: 'lookupemployee',
11374
									readOnly: ReadOnly_,
11375
									isGrid: true,
11376
									fieldTarget: targetField_,
11377
									fieldValue: fieldValue_,
11378
									isGrid: true,
11379
									id: tableName + rec.FieldName,
11380
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
11381
									triggerCls: 'x-form-search-trigger',
11382
									vtype: 'alphanum', // disable space
11383
									listeners: {
11384
										change: function (val) {
11385
											var custumFunc = rec.SelectFunction;
11386
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
11387
												Ext.Ajax.request({
11388
													async: false,
11389
													method: 'POST',
11390
													url: '/UserControl/GetStore',
11391
													params: {
11392
														tableName: 'PCMFUNC',
11393
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
11394
													},
11395
													success: function (response) {
11396
														var results = Ext.decode(response.responseText);
11397
														data_ = results.data[0];
11398
														if (data_ != undefined) {
11399
															custumFunc = data_.FunctionCode;
11400
														}
11401
													}
11402
												});
11403
											}
11404
											if (custumFunc) {
11405
												eval(custumFunc)
11406
											}
11407
										}
11408
									}
11409
								}
11410
							});
11411
						} else if (rec.SearchType == '4' && isLookup != true) {
11412
							cols.push({
11413

    
11414
								text: rec.HeaderTitle,
11415
								hidden: Hidden_,
11416
								dataIndex: rec.FieldName,
11417
								filter: {
11418
									itemDefaults: {
11419
										emptyText: 'Search for...'
11420
									}
11421
								},
11422
								editor: {
11423
									allowBlank: null_,
11424
									xtype: 'lookupemployee',
11425
									readOnly: ReadOnly_,
11426
									isGrid: true,
11427
									fieldTarget: targetField_,
11428
									fieldValue: fieldValue_,
11429
									isGrid: true,
11430
									id: tableName + rec.FieldName,
11431
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
11432
									triggerCls: 'x-form-search-trigger',
11433
									vtype: 'alphanum', // disable space
11434
									listeners: {
11435
										change: function (val) {
11436
											var custumFunc = rec.SelectFunction;
11437
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
11438
												Ext.Ajax.request({
11439
													async: false,
11440
													method: 'POST',
11441
													url: '/UserControl/GetStore',
11442
													params: {
11443
														tableName: 'PCMFUNC',
11444
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
11445
													},
11446
													success: function (response) {
11447
														var results = Ext.decode(response.responseText);
11448
														data_ = results.data[0];
11449
														if (data_ != undefined) {
11450
															custumFunc = data_.FunctionCode;
11451
														}
11452
													}
11453
												});
11454
											}
11455
											if (custumFunc) {
11456
												eval(custumFunc)
11457
											}
11458
										}
11459
									}
11460
								}
11461
							});
11462
						} else {
11463
							cols.push({
11464
								text: rec.HeaderTitle,
11465
								hidden: Hidden_,
11466
								dataIndex: rec.FieldName,
11467
								filter: {
11468
									itemDefaults: {
11469
										emptyText: 'Search for...'
11470
									}
11471
								},
11472
								editor: {
11473
									allowBlank: null_,
11474
									xtype: 'textfield',
11475
									readOnly: ReadOnly_,
11476
									id: tableName + rec.FieldName,
11477
									listeners: {
11478
										change: function (val) {
11479
											var custumFunc = null;
11480
											Ext.Ajax.request({
11481
												async: false,
11482
												method: 'POST',
11483
												url: '/UserControl/GetStore',
11484
												params: {
11485
													tableName: 'SDATATABLEFIELD',
11486
													param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
11487
												},
11488
												success: function (response) {
11489
													var results = Ext.decode(response.responseText);
11490
													data_ = results.data[0];
11491
													if (data_ != undefined) {
11492
														custumFunc = data_.SelectFunction;
11493
														//console.log(data_)
11494
													}
11495
												}
11496
											});
11497

    
11498
											if (custumFunc) {
11499
												eval(custumFunc)
11500
											}
11501
										}
11502
									}
11503
								}
11504
							});
11505
						}
11506

    
11507
						break
11508

    
11509
					}
11510
				} else {
11511
					cols.push({
11512
						text: rec.HeaderTitle,
11513
						hidden: Hidden_,
11514
						dataIndex: rec.FieldName,
11515
						hidden: true,
11516
						editor: {
11517
							allowBlank: true,
11518
							xtype: 'textfield',
11519
							readOnly: ReadOnly_,
11520
							id: tableName + rec.FieldName,
11521
						},
11522
						filter: {
11523
							itemDefaults: {
11524
								emptyText: 'Search for...'
11525
							}
11526
						}
11527
					});
11528
				}
11529
			});
11530
		};
11531

    
11532
		this.cellEditing = new Ext.grid.plugin.CellEditing({
11533
				clicksToEdit: 1
11534
			});
11535
		Ext.applyIf(me, {
11536
			items: [{
11537
					xtype: 'grid',
11538
					id: gridName,
11539
					name: gridName,
11540
					height: height,
11541
					//store: 'gridStore',
11542
					store: Ext.create('Ext.data.Store', {
11543
						storeId: storeID,
11544
						fields: fieldStore,
11545
						proxy: {
11546
							method: 'POST',
11547
							type: 'ajax',
11548
							url: '',
11549
							reader: {
11550
								type: 'json',
11551
								root: 'data'
11552
							}
11553
						}
11554
					}),
11555
					viewConfig: {
11556
						emptyText: 'No Data Display',
11557
						deferEmptyText: false,
11558
						//Add Nana For Autosize Column Mode
11559
						listeners: {
11560
							refresh: function (dataview) {
11561
								Ext.each(dataview.panel.columns, function (column) {
11562
									if (column.autoSizeColumn == false)
11563
										column.autoSizeColumn = true;
11564
									column.autoSize();
11565
									//dataview.store.reload();
11566
								})
11567
							}
11568
						},
11569
						render: function (comp) {
11570
							comp.getStore().reload();
11571
							console.log(comp);
11572
						}
11573
					},
11574
					dockedItems: [{
11575
							xtype: 'toolbar',
11576
							items: [{
11577
									text: 'Add',
11578
									hidden: hide_,
11579
									name: tableName + 'Add',
11580
									iconCls: 'fa-plus-circle',
11581
									style: 'font-family: FontAwesome',
11582
									handler: function () {
11583
										var store = Ext.StoreMgr.lookup(storeID)
11584
											idx = store.getCount();
11585
										var action = getParam('action');
11586
										var data = '';
11587
										var Sequence = 0;
11588
										if (idx == 0) {
11589
											Sequence = 1;
11590
										} else {
11591
											Sequence = 1 + idx;
11592
										}
11593
										data = {
11594
											Sequence: Sequence
11595
										};
11596

    
11597
										store.insert(idx, data);
11598
									}
11599

    
11600
								}, {
11601
									text: 'Delete',
11602
									hidden: hide_,
11603
									name: tableName + 'DeleteText',
11604
									iconCls: 'fa-trash-o',
11605
									style: 'font-family: FontAwesome',
11606
									//disabled: true
11607
									handler: function () {
11608
										var me = this,
11609
										store = Ext.StoreMgr.lookup(storeID)
11610

    
11611
											var grid = Ext.getCmp(gridName);
11612

    
11613
										Ext.MessageBox.show({
11614
											title: 'Remove tab',
11615
											msg: "This will remove. Do you want to continue?",
11616
											buttons: Ext.MessageBox.YESNO,
11617
											fn: function (choice) {
11618
												console.log(choice);
11619
												if (choice === 'yes') {
11620
													var selection = grid.getView().getSelectionModel().getSelection()[0];
11621
													if (selection) {
11622
														store.remove(selection);
11623
													}
11624
												}
11625
												//delete panel.pendingClose;
11626
											}
11627
										});
11628
									}
11629

    
11630
								}
11631
							]
11632
						}
11633
					],
11634
					columns: cols,
11635
					selModel: {
11636
						type: 'cellmodel'
11637
					},
11638
					plugins: [this.cellEditing],
11639
				}, ]
11640

    
11641
		});
11642

    
11643
		me.callParent(arguments);
11644
	}
11645
});
11646
//hamid200916
11647
Ext.define('MinovaUtil.MinovaES.MinovaLookupEmployeelama', {
11648
	extend: 'Ext.panel.Panel',
11649
	alias: 'widget.lookupemployeelama',
11650
	requires: [
11651
		'Ext.data.*',
11652
		'Ext.grid.*',
11653
		'Ext.tree.*',
11654
		'Ext.ux.CheckColumn',
11655
		//'MinovaES.View.sample.samplepopupEMPID'
11656

    
11657
	],
11658
	formname: undefined,
11659
	fieldname: undefined,
11660
	allowBlank: undefined,
11661
	width: undefined,
11662
	tableName: undefined,
11663
	//bodyStyle: 'padding-left: -20px; padding-bottom: -20px; padding-top: -20px; padding-right: -20px;',
11664
	//padding: '-40px',
11665
	//bodyStyle: 'margin:-20px;',
11666
	//margin: '-20 -20 -20 -20',
11667
	//fieldLabel: undefined,
11668
	//name: undefined,
11669
	//pnl: this.name,
11670
	initComponent: function () {
11671
		var me = this;
11672
		targetField_ = me.fieldname;
11673
		//var nameField_ = me.name;
11674
		//var panelform = this.pnl;
11675
		var nameField_ = me.fieldname;
11676
		var blank = me.allowBlank;
11677
		var width_ = me.width;
11678
		var tableName_ = me.tableName;
11679
		var panelform = "form" + me.name;
11680
		//var fieldLabel_ = me.fieldLabel;
11681
		Ext.applyIf(me, {
11682
			items: [{
11683
					xtype: 'form',
11684
					name: panelform,
11685
					items: [{
11686
							xtype: 'fieldcontainer',
11687
							layout: 'hbox',
11688
							fieldLabel: me.fieldLabel,
11689
							items: [{
11690
									xtype: "triggerfield",
11691
									name: nameField_,
11692
									width: width_,
11693
									//anchor: '50%',
11694
									//editable: true,
11695
									allowBlank: blank,
11696
									triggerCls: 'x-form-search-trigger',
11697
									onTriggerClick: function (e) {
11698
										//var tableName_ = this.tableName;
11699
										var count_lookup = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
11700
										var lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0];
11701
										var EmployeeID = Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0];
11702
										var EmployeeID_ = EmployeeID.getValue();
11703
										//var params = "EmployeeID[=]" + EmployeeID.getValue();
11704
										//var Url = "sample?EmployeeID=" + EmployeeID.getValue();
11705
										//window.open(Url, "_self");
11706
										//var selection_ = selection.getValue();
11707
										//var EmployeeSearch = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
11708
										//var lokup = EmployeeSearch.setValue(selection_);
11709

    
11710
										var popup_lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
11711
										if (count_lookup == 1) {
11712
											Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField = this.name;
11713
											Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].show();
11714
										} else {
11715
											//var _popUploadView = Ext.create("MinovaUtil.MinovaES.LookupEmployeeQuickSearch");
11716
											Ext.create('MinovaUtil.MinovaES.LookupEmployeeQuickSearch', {
11717
												//    tableName: tableName_,
11718

    
11719
												//}).show()
11720
												//_popUploadView.tableName = tableName_;
11721
												tableName: tableName_,
11722
												targetField: this.name,
11723
											}).show()
11724
										}
11725

    
11726
										//var _popUploadView = Ext.create("MinovaES.view.sample.samplepopupEMPID");
11727
										//var a = _popUploadView.show();
11728
										var text = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
11729
										text.setValue(EmployeeID_);
11730

    
11731
										if (EmployeeID_ !== "") {
11732
											var store = Ext.data.StoreManager.lookup('lookupEMPID');
11733
											var grid = Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0];
11734
											store.proxy.extraParams = {
11735
												tableName: tableName_, //'PDSEMP0002',
11736
												param: 'EmpID_ExternalID_FullName[like]' + EmployeeID_
11737
											};
11738
											store.reload();
11739
										}
11740
									},
11741
									listeners: {
11742
										specialkey: function (f, e) {
11743
											if (e.getKey() == e.ENTER) {
11744
												//alert("about to submit");
11745
												var count_lookup = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
11746
												var lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0];
11747
												var EmployeeID = Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0];
11748
												var EmployeeID_ = EmployeeID.getValue();
11749

    
11750
												var popup_lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
11751
												if (count_lookup == 1) {
11752
													Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField = this.name;
11753
													Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].show();
11754
												} else {
11755
													Ext.create('MinovaUtil.MinovaES.LookupEmployeeQuickSearch', {
11756
														tableName: tableName_,
11757
														targetField: this.name,
11758
													}).show()
11759
													//var _popUploadView = Ext.create("MinovaUtil.MinovaES.LookupEmployeeQuickSearch");
11760
													//_popUploadView.targetField = this.name;
11761
													//_popUploadView.show();
11762

    
11763
												}
11764
												//var _popUploadView = Ext.create("MinovaES.view.sample.samplepopupEMPID");
11765
												//var a = _popUploadView.show();
11766
												var text = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
11767
												text.setValue(EmployeeID_);
11768

    
11769
												if (EmployeeID_ !== "") {
11770
													var store = Ext.data.StoreManager.lookup('lookupEMPID');
11771
													var grid = Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0];
11772
													store.proxy.extraParams = {
11773
														tableName: tableName_, //'PDSEMP0002',
11774
														param: 'EmpID_ExternalID_FullName[like]' + EmployeeID_
11775
													};
11776
													store.reload();
11777
												}
11778
												//myform.getForm().submit();
11779
											}
11780
										}
11781
									}
11782

    
11783
								}, {
11784
									xtype: 'tbspacer',
11785
									width: 5
11786
								}, {
11787
									xtype: 'button',
11788
									name: nameField_,
11789
									anchor: '50%',
11790
									text: 'Advance',
11791
									listeners: {
11792
										click: function () {
11793
											var count_lookup = Ext.ComponentQuery.query('[name=popup_lookupEmployee]').length;
11794
											if (count_lookup == 1) {
11795
												Ext.ComponentQuery.query('[name=popup_lookupEmployee]')[0].targetField = this.name;
11796
												Ext.ComponentQuery.query('[name=popup_lookupEmployee]')[0].show();
11797
											} else {
11798
												Ext.create('MinovaUtil.MinovaES.LookupEmployeeAdvance', {
11799
													tableName: tableName_,
11800
													targetField: this.name,
11801
												}).show()
11802
												//var _popUploadView = Ext.create("MinovaUtil.MinovaES.LookupEmployeeAdvance");
11803
												//_popUploadView.targetField = this.name;
11804
												//_popUploadView.show();
11805

    
11806
											}
11807
										}
11808
									},
11809
								}
11810
							]
11811
						}
11812
					]
11813
				}
11814
			]
11815
		});
11816
		me.callParent(arguments);
11817
	}
11818
});
11819

    
11820
Ext.define('MinovaUtil.MinovaES.LookupEmployeeQuickSearch', {
11821
	extend: 'Ext.window.Window',
11822
	alias: 'widget.popup_employeequicksearch',
11823
	requires: [
11824
		// 'MinovaES.controller.sample.ctrlsample',
11825
		//'MinovaES.store.data.TableType',
11826
	],
11827
	//controller: 'ctrlsample',
11828
	height: '85%',
11829
	width: '42%',
11830
	minWidth: '50%',
11831
	maxWidth: '100%',
11832
	bodyPadding: 0,
11833
	formname: undefined,
11834
	//modal: true,
11835
	title: 'Lookup - EmployeeID',
11836
	name: 'popup_lookupEMPID',
11837
	test: undefined,
11838
	targetField: undefined,
11839
	tableName: undefined,
11840
	afterender: function () {
11841
		test = nameform;
11842
	},
11843
	initComponent: function () {
11844

    
11845
		var me = this;
11846
		var targetField_ = me.targetField;
11847
		var form = me.test;
11848
		var tableName_ = me.tableName;
11849
		Ext.applyIf(me, {
11850
			items: [{
11851
					xtype: 'form',
11852
					name: 'frmSearch',
11853
					width: '100%',
11854
					height: 'auto',
11855
					dockedItems: [{
11856
							xtype: 'toolbar',
11857
							dock: 'top',
11858
							layout: 'vbox',
11859
							bodyPadding: 10,
11860
							border: 0,
11861
							items: [{
11862
									xtype: 'fieldset',
11863
									layout: 'hbox',
11864
									width: '100%',
11865
									border: 0,
11866
									padding: 0,
11867
									items: [{
11868
											xtype: 'textfield',
11869
											name: 'EmployeeSearch',
11870
											fieldLabel: 'Emp ID/ External ID/ Full Name',
11871
											width: 475,
11872
											labelWidth: 185,
11873
											enableKeyEvents: true,
11874
											listeners: {
11875
												specialkey: function (f, e) {
11876
													if (e.getKey() == e.ENTER) {
11877
														var emp = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
11878
														var emp_ = emp.getValue();
11879
														var store = Ext.data.StoreManager.lookup('lookupEMPID');
11880
														var grid = Ext.ComponentQuery.query('[name=EmployeeID]')[0];
11881
														store.proxy.extraParams = {
11882
															tableName: tableName_, //'PDSEMP0002',
11883
															param: 'EmpID_ExternalID_FullName[like]' + emp_
11884
														};
11885
														store.reload();
11886
													}
11887
												}
11888
											}
11889
										}, {
11890
											xtype: 'tbspacer',
11891
											width: 5
11892
										}, {
11893
											xtype: 'button',
11894
											name: 'Search',
11895
											text: 'Search',
11896
											handler: function () {
11897
												var emp = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
11898
												var emp_ = emp.getValue();
11899
												var store = Ext.data.StoreManager.lookup('lookupEMPID');
11900
												var grid = Ext.ComponentQuery.query('[name=EmployeeID]')[0];
11901
												store.proxy.extraParams = {
11902
													tableName: tableName_, //'PDSEMP0002',
11903
													param: 'EmpID_ExternalID_FullName[like]' + emp_
11904
												};
11905
												store.reload();
11906
											},
11907

    
11908
										}
11909
									]
11910
								}
11911
							]
11912
						}
11913
					],
11914
				}, {
11915
					items: [{
11916
							xtype: "minovagrid1",
11917
							name: "GridEmployeeID",
11918
							storename: 'lookupEMPID',
11919
							tableName: tableName_, //'PDSEMP0002',
11920
							param: '',
11921
							isLookup: true,
11922
							pagesize: 25,
11923
							height: 425,
11924
							listeners: {
11925
								beforeedit: function () {
11926
									return false;
11927
								},
11928
								itemdblclick: function () {
11929
									var grid = Ext.ComponentQuery.query('[name=GridEmployeeID]')[0];
11930
									var selection = grid.getView().getSelectionModel().getSelection()[0];
11931
									var Emp_ = selection.data.EmployeeID;
11932
									//var formSelection = Ext.ComponentQuery.query('[name=' + form + ']')[0];
11933
									//formSelection.getForm().setValues(grid.getSelectionModel().getSelection()[0].data);
11934

    
11935
									var target = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField;
11936
									Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(Emp_);
11937
									//Ext.ComponentQuery.query('[name=EmployeeiD]')[0].setValue(selection.data.EmployeeID);;
11938
									Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].hide();
11939
								}
11940
							},
11941
						}, {
11942
							xtype: 'pagingtoolbar',
11943
							store: 'lookupEMPID',
11944
							dock: 'bottom',
11945
							displayInfo: true
11946
						}
11947
					]
11948
				}
11949
			]
11950
		});
11951
		me.callParent(arguments);
11952
	}
11953
});
11954
Ext.define('MinovaUtil.MinovaES.LookupEmployeeAdvance', {
11955
	extend: 'Ext.window.Window',
11956
	alias: 'widget.popup_employeeadvance',
11957
	requires: [
11958
		//'MinovaES.controller.sample.ctrlsample',
11959
		//'MinovaES.store.data.TableType',
11960
	],
11961
	//controller: 'ctrlsample',
11962
	height: '85%',
11963
	width: '42%',
11964
	minWidth: '50%',
11965
	maxWidth: '100%',
11966
	bodyPadding: 10,
11967
	anchor: '50%',
11968
	formname: undefined,
11969
	//modal: true,
11970
	title: 'Lookup - EmployeeID',
11971
	name: 'popup_lookupEmployee',
11972
	test: undefined,
11973
	targetField: undefined,
11974
	tableName: undefined,
11975
	initComponent: function () {
11976
		var me = this;
11977
		var targetField_ = me.targetField;
11978
		var form = me.test;
11979
		var tableName_ = me.tableName;
11980
		Ext.applyIf(me, {
11981
			items: [{
11982
					xtype: 'form',
11983
					name: 'formlookup',
11984
					items: [{
11985
							xtype: 'minovaform',
11986
							name: 'frmlookup',
11987
							tableName: tableName_, //'PDSEMP0001',
11988
							param: '',
11989
							isLookup: true,
11990
							listeners: {
11991
								onStockFormKeyPress: function (textfield, event, options) {
11992
									if (event.getKey() == event.ENTER) {
11993
										alert("test");
11994
										//Ext.Msg.alert('Keys', 'You pressed the Enter key');
11995
									}
11996
								}
11997
							},
11998
							buttons: [{
11999
									text: 'Search',
12000
									//iconCls : 'fa-edit',
12001
									//style : 'font-family: FontAwesome',
12002
									listeners: {
12003
										click: function () {
12004
											var store = Ext.data.StoreManager.lookup('lookupStore');
12005
											var form = Ext.ComponentQuery.query('[name=formlookup]')[0].getForm();
12006
											grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
12007
											var values_ = form.getValues();
12008
											var fields_ = form.getFields().items;
12009
											var param_ = '';
12010
											for (var i = 0; i < fields_.length; i++) {
12011
												var val_ = form.getFields().items[i].getValue();
12012
												var xtype_ = form.getFields().items[i].xtype;
12013
												var oprator_ = '[like]';
12014
												if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
12015
													oprator_ = '[Equal]';
12016
												}
12017
												if (xtype_ == 'datefield') {
12018
													if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
12019
														oprator_ = '[LessThanEqual]';
12020
													} else {
12021
														oprator_ = '[GreaterThanEqual]';
12022
													}
12023
												}
12024
												if (val_ != 'undefined' && val_ != "" && val_ != null) {
12025
													param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
12026
												}
12027
											}
12028
											store.proxy.extraParams = {
12029
												tableName: grid.tableName,
12030
												param: param_
12031
											};
12032
											store.removeAll();
12033
											store.reload();
12034
											store.loadPage(1);
12035
										},
12036

    
12037
									}
12038
								}
12039
							]
12040
						}, {
12041
							xtype: 'minovagrid',
12042
							name: 'gridlookup',
12043
							minHeight: 320,
12044
							height: 250,
12045
							tableName: tableName_, //'PDSEMP0001',
12046
							param: '',
12047
							isLookup: true,
12048
							storename: 'lookupStore',
12049
							pagesize: 25,
12050
							listeners: {
12051
								beforeedit: function () {
12052
									return false;
12053
								},
12054
								itemdblclick: function () {
12055
									var grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
12056
									var selection = grid.getView().getSelectionModel().getSelection()[0];
12057
									var Emp_ = selection.data.EmployeeID;
12058
									//var formSelection = Ext.ComponentQuery.query('[name=EmployeeSelection]')[0];
12059
									//formSelection.getForm().setValues(grid.getSelectionModel().getSelection()[0].data);
12060
									var target = Ext.ComponentQuery.query('[name=popup_lookupEmployee]')[0].targetField;
12061
									Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(Emp_);
12062
									Ext.ComponentQuery.query('[name=popup_lookupEmployee]')[0].hide();
12063

    
12064
								}
12065
							},
12066
							dockedItems: [{
12067
									xtype: 'pagingtoolbar',
12068
									store: 'lookupStore',
12069
									dock: 'bottom',
12070
									displayInfo: true
12071
								}
12072
							]
12073
						}
12074
					]
12075
				}
12076
			]
12077
		});
12078
		me.callParent(arguments);
12079
	}
12080
});
12081
//end hamid
12082

    
12083

    
12084
// lookup tree
12085
Ext.define('MinovaES.view.orm.lookup.minovalookuptreePopup', {
12086
	extend: 'Ext.window.Window',
12087
	alias: 'widget.minovalookuptreePopup',
12088
	requires: [
12089

    
12090
	],
12091
	height: '80%',
12092
	width: '40%',
12093
	minWidth: '50%',
12094
	maxWidth: '100%',
12095
	bodyPadding: 5,
12096
	modal: true,
12097
	name: 'mainlookupTree',
12098
	objFilter: undefined,
12099
	treeSructure: undefined, // object relationship
12100
	objClassValue: undefined, // object yang akan di input ke field
12101
	formname: undefined, // nama form
12102
	targetField: undefined, // nama field yang akan diset value
12103
	//title:'judul',
12104
	bodyPadding: 0,
12105
	initComponent: function () {
12106
		var me = this;
12107
		var objFilter_ = me.objFilter;
12108
		var treeSructure_ = me.treeSructure;
12109
		var formname_ = me.formname;
12110
		var objClassValue_ = me.objClassValue;
12111
		var targetField_ = me.targetField;
12112
		var AllObjectClass = treeSructure_.split('-');
12113
		var form_ = Ext.ComponentQuery.query('[name=' + formname_ + ']')[0];
12114
		var StartDate_ = '';
12115
		if (form_) {
12116

    
12117
			if (form_.getForm().findField('StartDate')) {
12118
				StartDate_ = form_.getForm().findField('StartDate').getValue();
12119
			} else {
12120
				StartDate_ = MinovaUtil.GetNowDate();
12121
			}
12122

    
12123
		}
12124

    
12125
		Ext.applyIf(me, {
12126
			items: [{
12127
					//xtype : 'panel',
12128
					items: [{
12129
							xtype: 'tabpanel',
12130
							items: [{
12131

    
12132
									xtype: 'form',
12133
									title: 'Structured Search',
12134
									height: '70%',
12135
									tabConfig: {
12136
										tooltip: 'Search by tree'
12137
									},
12138
									items: [{
12139
											xtype: 'form',
12140
											items: [{
12141

    
12142
													xtype: 'treepanel',
12143
													rootVisible: false,
12144
													height: 400,
12145

    
12146
													name: 'searchByTreePopUp',
12147
													useArrows: true,
12148
													animate: false,
12149
													targetField: targetField_,
12150
													formname: formname_,
12151
													root: {
12152
														expanded: true,
12153
														nodeType: 'async',
12154
														ext: 'Favorites',
12155
														id: 'null'
12156
													},
12157
													listeners: {
12158
														afterrender: function (me_) {
12159
															me_.mask();
12160
															if (treeSructure_ != 'O-O-P') {
12161
																var countCol = me_.columns.length;
12162
																me_.columns[countCol - 1].setHidden(true);
12163

    
12164
															}
12165
															if (StartDate_ != '') {
12166
																var node = "root";
12167
																var ObjectClass_ = treeSructure_.split('-');
12168
																//Ext.Ajax.request({
12169
																//    method: 'POST',
12170
																//    async: false,
12171
																//    url: '/UserControl/GetStoreAuth',
12172
																//    params: {
12173
																//        tableName: "PHROM0001",
12174
																//        param: "ObjectClass[=]" + ObjectClass_[0],
12175
																//        menuId: MinovaUtil.GetMenuID()
12176
																//    },
12177
																//    success: function (response) {
12178
																//        var results = Ext.decode(response.responseText);
12179
																//        var data_ = results.data;
12180
																//        if (data_.length > 0 && data_.length == 1) {
12181
																//            node = ObjectClass_[0] + data_[0].ObjectID;
12182
																//        }
12183

    
12184
																//    }
12185
																//});
12186

    
12187
																Ext.Ajax.request({
12188
																	async: false,
12189
																	//url: '/ORM/GetRelObjectTreeAsync?node=' + node + '&tree_struct_code=' + treeSructure_ + '&keyDate=' + StartDate_,
12190
																	url: '/ORM/GetRelObjectTreeAsyncAuth?node=' + 'root' + '&tree_struct_code=' + treeSructure_ + '&keyDate=' + StartDate_ + '&ObjectClass=' + ObjectClass_[0] + '&MenuID=' + MinovaUtil.GetMenuID(),
12191
																	success: function (response) {
12192
																		var results = Ext.decode(response.responseText);
12193
																		var data_ = results.results;
12194
																		//console.log(data_)
12195
																		var pnl = Ext.ComponentQuery.query('[name=searchByTreePopUp]')[0];
12196
																		pnl.store.setRootNode({
12197
																			expanded: true,
12198
																			nodetype: 'async',
12199
																			children: data_
12200
																			//[]
12201
																		});
12202
																	}
12203
																});
12204

    
12205
															}
12206
															me_.unmask();
12207
														},
12208
														afteritemexpand: function (node, index, item, eOpts) {
12209
															var me = this;
12210
															var data_ = null;
12211
															var idx = 0;
12212
															var tree_ = Ext.ComponentQuery.query('treepanel[name=searchByTreePopUp]')[0];
12213
															var v = tree_.getView();
12214
															tree_.mask('Expanding tree...');
12215
															var main_ = Ext.ComponentQuery.query('[name=ORMMain]')[0];
12216
															Ext.Ajax.request({
12217
																async: false,
12218
																url: '/ORM/GetRelObjectTreeAsync?node=' + node.get('Id') + '&tree_struct_code=' + treeSructure_ + '&keyDate=' + StartDate_,
12219
																success: function (response) {
12220
																	var results = Ext.decode(response.responseText);
12221
																	data_ = results.results;
12222
																	console.log(data_)
12223
																}
12224
															});
12225

    
12226
															if (data_.length > 0) {
12227
																data_.forEach(function (rec) {
12228

    
12229
																	console.log(rec.Id)
12230
																	if (v.store.data.find('Id', rec.Id) == null) {
12231
																		node.appendChild(data_[idx])
12232
																	}
12233
																	idx++;
12234
																})
12235
															}
12236

    
12237
															setTimeout(function () {
12238

    
12239
																tree_.unmask();
12240
															}, 200);
12241

    
12242
														},
12243
														itemdblclick: function (this_, record, item, index, e, eOpts) {
12244
															var cek = false;
12245
															var class_ = objClassValue_;
12246
															var classDt = class_.split(']');
12247
															var classVal = "";
12248
															if (classDt.length == 1) {
12249
																classVal = classDt[0];
12250
															}
12251
															if (classDt.length > 1) {
12252
																classVal = classDt[1];
12253
															}
12254
															if (classVal == record.data.ObjectType) {
12255
																var form_ = Ext.ComponentQuery.query('[name=' + formname_ + ']')[0].getForm();
12256
																var type = 'rc';
12257
																if (form_.findField(targetField_).nameTable) {
12258
																	type = form_.findField(targetField_).nameTable.substr(3, 2).toLowerCase();
12259
																}
12260
																if (type != "rc") {
12261
																	if (classVal == 'P' && MinovaUtil.GetMenuID() == 'PA02') {
12262
																		// cek apakah posisis sudah di assign
12263
																		var hasil = null;
12264
																		Ext.Ajax.request({
12265
																			async: false,
12266
																			method: 'POST',
12267
																			url: '/UserControl/GetStore',
12268
																			params: {
12269
																				tableName: 'PHROM0002',
12270
																				param: 'ObjectClass[=]P,RelationshipDirectory[=]A,RelationshipClass[=]E,StartDate[LessThanEqual]' + StartDate_ + ',EndDate[GreaterThanEqual]' + StartDate_ + ',ObjectID[=]' + record.data.ObjectId
12271
																			},
12272
																			success: function (response) {
12273
																				var results = Ext.decode(response.responseText);
12274
																				//hasil = results.data[0].RelationshipObject;
12275
																				hasil = results.data.length;
12276
																				if (hasil == 0) {
12277
																					cek = true;
12278
																				} else {
12279
																					//Ext.Msg.show({
12280
																					//    title: 'Warning',
12281
																					//    message: MinovaMessageData('OM0001', ''),
12282
																					//    buttons: Ext.Msg.OK,
12283
																					//     fn: function (choice) {
12284
																					//        console.log(choice);
12285
																					//        if (choice === 'ok') {
12286
																					//        }
12287

    
12288
																					//    }
12289
																					//});
12290
																					if (Ext.ComponentQuery.query('[name=PanelMdDetail]')[0].nameTable == 'PHRPA0055'){
12291
																						cek = true;
12292
																					}
12293
																					else{
12294
																						alert(MinovaMessageData('OM0001', ''));
12295
																					}
12296
																				}
12297
																				//count = hasil.length
12298
																			}
12299
																		});
12300
																	} else {
12301
																		cek = true;
12302
																	}
12303
																} else {
12304
																	cek = true;
12305
																}
12306
															}
12307
															if (cek) {
12308
																// set value to form
12309
																var form_ = Ext.ComponentQuery.query('[name=' + formname_ + ']')[0].getForm();
12310
																form_.findField(targetField_).setValue('a');
12311
																form_.findField(targetField_).valData = 'a';
12312
																form_.findField(targetField_).setValue(record.data.Text);
12313
																form_.findField(targetField_).valData = record.data.ObjectId;
12314
																form_.findField(targetField_).focus();
12315
																if (form_.findField(targetField_).nextSibling()) {
12316
																	form_.findField(targetField_).nextSibling().focus();
12317
																} else {
12318
																	form_.findField(targetField_).blur();
12319
																}
12320
																Ext.ComponentQuery.query('[name=' + targetField_ + 'lookUp' + ']')[0].destroy();
12321
															}
12322

    
12323
														}
12324
													},
12325

    
12326
													columns: [{
12327
															xtype: 'treecolumn',
12328
															text: 'Organization Structure',
12329
															flex: 2,
12330
															sortable: true,
12331
															dataIndex: 'TextObject'
12332
														}, {
12333
															text: 'Object ID',
12334
															flex: 1,
12335
															sortable: true,
12336
															dataIndex: 'ObjectId',
12337
														}, {
12338
															text: 'Object Class',
12339
															flex: 1,
12340
															sortable: true,
12341
															dataIndex: 'ObjectType',
12342
														}, {
12343
															text: 'Object Abbr',
12344
															flex: 1,
12345
															sortable: true,
12346
															dataIndex: 'TextObject',
12347
														}, {
12348
															text: 'Start Date',
12349
															flex: 1,
12350
															sortable: true,
12351
															dataIndex: 'StartDate',
12352
														}, {
12353
															text: 'End Date',
12354
															flex: 1,
12355
															sortable: true,
12356
															dataIndex: 'EndDate',
12357
														}, {
12358
															xtype: 'actioncolumn',
12359
															text: 'Vacant Status',
12360
															flex: 1,
12361
															dataIndex: 'IsVacant',
12362
															sortable: true,
12363
															iconCls: 'fa-child',
12364
															renderer: function (value, metadata, record) {
12365
																if (record.data.ObjectType == "P") {
12366
																	var Vacant = record.data.IsVacant;
12367
																	if (!Vacant) {
12368
																		metadata.tdStyle = 'font-family: FontAwesome';
12369
																	}
12370

    
12371
																}
12372

    
12373
															},
12374
														}
12375
													]
12376

    
12377
												}
12378
											]
12379
										}
12380
									]
12381
								}, {
12382
									title: 'Search by Object',
12383
									height: 400,
12384
									autoScroll: true,
12385
									items: [{
12386
											xtype: 'form',
12387
											name: 'filterbyObj',
12388
											margin: '5 5 5 5',
12389
											buttons: [{
12390
													text: 'Search',
12391
													name: 'SearchAssign',
12392
													handler: function () {
12393
														var storeGrid = Ext.StoreMgr.lookup("gridObj");
12394
														var form = Ext.ComponentQuery.query('[name=filterbyObj]')[0].getForm();
12395
														if (form.isValid()) {
12396
															var values_ = form.getValues();
12397
															storeGrid.proxy.url = '/ORM/SearchByObject?StartDate=' + values_.StartDate + "&EndDate=99991231" + "&ObjectID=" + values_.ObjectID + "&ObjectClass=" + values_.ObjectClass +
12398
																"&ObjectClassTarget=" + values_.ObjectClassTarget + "&ObjectDescription=" + values_.ObjectDescription +
12399
																"&Abbreviation=" + values_.Abbreviation + "&MenuID=" + MinovaUtil.GetMenuID() +
12400
																"&TreeStructCode=" + values_.TreeStructCode;
12401
															storeGrid.load({});
12402
															storeGrid.loadPage(1);
12403

    
12404
														}
12405

    
12406
													}
12407
												}
12408
											],
12409
											items: [{
12410
													xtype: "datefield",
12411
													fieldLabel: "Date",
12412
													name: 'StartDate',
12413
													submitFormat: 'Ymd',
12414
													format: 'd/m/Y',
12415
													value: new Date(),
12416
													anchor: '50%',
12417
												}, {
12418
													xtype: "hidden",
12419
													fieldLabel: "Date",
12420
													name: 'ObjectClass',
12421
													value: AllObjectClass[0],
12422
													anchor: '50%',
12423
												}, {
12424
													xtype: "hidden",
12425
													fieldLabel: "Date",
12426
													name: 'EndDate',
12427
													value: '99991231',
12428
													anchor: '50%',
12429
												}, {
12430
													xtype: "combobox",
12431
													fieldLabel: "Object Class",
12432
													name: 'ObjectClassTarget',
12433
													allowBlank: false,
12434
													anchor: '50%',
12435
													displayField: 'desc',
12436
													valueField: 'code',
12437
													store: Ext.create('Ext.data.Store', {
12438
														storeId: 'storeYesNo',
12439
														fields: ['code', 'desc'],
12440
														data: [{
12441
																"desc": AllObjectClass[0],
12442
																"code": AllObjectClass[0]
12443
															}, {
12444
																"desc": AllObjectClass[2],
12445
																"code": AllObjectClass[2]
12446
															}
12447
														]
12448
													}),
12449
													queryMode: 'local',
12450
												}, {
12451
													xtype: "textfield",
12452
													fieldLabel: "Object ID",
12453
													name: 'ObjectID',
12454
													anchor: '50%',
12455
												}, {
12456
													xtype: "textfield",
12457
													fieldLabel: "Object Description",
12458
													name: 'ObjectDescription',
12459
													anchor: '50%',
12460
												}, {
12461
													xtype: "textfield",
12462
													fieldLabel: "Abbreviation",
12463
													name: 'Abbreviation',
12464
													anchor: '50%',
12465
												}, {
12466
													xtype: "hidden",
12467
													fieldLabel: "MenuID",
12468
													name: 'MenuID',
12469
													anchor: '50%',
12470
													value: MinovaUtil.GetMenuID()
12471
												}, {
12472
													xtype: "hidden",
12473
													fieldLabel: "TreeStructCode",
12474
													name: 'TreeStructCode',
12475
													anchor: '50%',
12476
													value: treeSructure_
12477
												},
12478
											],
12479
										}, {
12480
											xtype: "minovagrid1",
12481
											tableName: 'PDSBS0008',
12482
											name: "gridbyObject",
12483
											param: '',
12484
											autoLoad: false,
12485
											pagesize: 5,
12486
											storename: 'gridObj',
12487
											isLookup: true,
12488
											height: 250,
12489
											targetField: targetField_,
12490
											formname: formname_,
12491
											bodyPadding: 0,
12492
											listeners: {
12493
												afterrender: function (me_) {
12494
													if (treeSructure_ != 'O-O-P') {
12495
														var countCol = me_.columns.length;
12496
														me_.columns[countCol - 1].setHidden(true);
12497

    
12498
													}
12499
												},
12500
												itemdblclick: function (this_, record, item, index, e, eOpts) {
12501
													console.log(record.data);
12502
													var cek = false;
12503
													if (objClassValue_ == record.data.ObjectClass) {
12504
														var form_ = Ext.ComponentQuery.query('[name=' + formname_ + ']')[0].getForm();
12505
														if (form_.findField(targetField_).nameTable.substr(3, 2).toLowerCase() != "rc") {
12506
															if (objClassValue_ == 'P') {
12507
																// cek apakah posisis sudah di assign
12508
																var hasil = null;
12509
																Ext.Ajax.request({
12510
																	async: false,
12511
																	method: 'POST',
12512
																	url: '/UserControl/GetStore',
12513
																	params: {
12514
																		tableName: 'PHROM0002',
12515
																		param: 'ObjectClass[=]P,RelationshipDirectory[=]A,RelationshipClass[=]E,StartDate[GreaterThanEqual]' + StartDate_ + ',ObjectID[=]' + record.data.ObjectID
12516
																	},
12517
																	success: function (response) {
12518
																		var results = Ext.decode(response.responseText);
12519
																		//hasil = results.data[0].RelationshipObject;
12520
																		hasil = results.data.length;
12521
																		if (hasil == 0) {
12522
																			cek = true;
12523
																		}
12524
																		//count = hasil.length
12525
																	}
12526
																});
12527

    
12528
															} else {
12529
																cek = true;
12530
															}
12531
														} else {
12532
															cek = true;
12533
														}
12534
													}
12535
													if (cek) {
12536
														var form_ = Ext.ComponentQuery.query('[name=' + formname_ + ']')[0].getForm();
12537
														//form_.findField(targetField_).setValue(record.data.ObjectID);
12538
														//form_.findField(targetField_).valData = record.data.ObjectID + ' - ' + record.data.ObjectDescription;
12539
														form_.findField(targetField_).setValue('-');
12540
														form_.findField(targetField_).valData = '-';
12541
														form_.findField(targetField_).setValue(record.data.ObjectID);
12542
														form_.findField(targetField_).valData = record.data.ObjectID;
12543
														form_.findField(targetField_).setRawValue(record.data.ObjectID + ' - ' + record.data.ObjectDescription);
12544
														Ext.ComponentQuery.query('[name=' + targetField_ + 'lookUp' + ']')[0].destroy();
12545
													} else {
12546
														alert(MinovaMessageData('OM0001', ''))
12547
													}
12548
												},
12549
												beforeclick: function () {
12550
													return false;
12551
												}
12552

    
12553
											},
12554
											dockedItems: [{
12555
													xtype: 'pagingtoolbar',
12556
													store: 'gridObj',
12557
													dock: 'bottom',
12558
													displayInfo: true
12559
												}
12560

    
12561
											]
12562
										},
12563
									]
12564

    
12565
								}
12566
							]
12567

    
12568
						}
12569
					]
12570
				},
12571
			]
12572

    
12573
		});
12574
		me.callParent(arguments);
12575
	}
12576
});
12577

    
12578
Ext.define('MinovaUtil.MinovaES.MinovaLookupTree', {
12579
	extend: 'Ext.form.field.Trigger',
12580
	alias: ['widget.minovalookuptree', 'widget.MinovaLookupTree'],
12581
	treeSructure: undefined, // object relationship
12582
	objClassValue: undefined, // object yang akan di input ke field
12583
	formname: undefined, // nama form
12584
	targetField: undefined, // nama field yang akan diset value
12585
	initComponent: function () {
12586

    
12587
		this.callParent();
12588
	},
12589
	getValue: function () {
12590
		var me = this;
12591
		var hasil = '';
12592
		if (this.valData) {
12593
			hasil = this.valData.split('-')[0].replace(' ', '');
12594

    
12595
		} else {
12596
			if (me.rawValue != '' && me.rawValue != undefined) {
12597
				hasil = me.rawValue.split('-')[0].replace(' ', '');
12598
			}
12599
		}
12600

    
12601
		return hasil;
12602
	},
12603
	getSubmitValue: function () {
12604
		var me = this;
12605
		var hasil = '';
12606
		if (this.valData) {
12607
			hasil = this.valData.split('-')[0].replace(' ', '');
12608
		} else {
12609
			if (me.rawValue != '' && me.rawValue != undefined) {
12610
				hasil = me.rawValue.split('-')[0].replace(' ', '');
12611
			}
12612
		}
12613

    
12614
		return hasil;
12615
	},
12616
	onTriggerClick: function () {
12617
		var _treeSructure = this.treeSructure;
12618
		var _objClassValue = this.objClassValue;
12619
		var _formname = this.formname;
12620
		var _targetField = this.name;
12621
		var _fieldLabel = this.fieldLabel;
12622
		var _objFilter = this.objFilter;
12623
		var Mainform = Ext.ComponentQuery.query('[name=' + _formname + ']')[0];
12624
		var _StartDate = MinovaUtil.GetNowDate();
12625
		if (Mainform) {
12626
			if (Mainform.getForm().findField('StartDate')) {
12627
				_StartDate = Mainform.getForm().findField('StartDate').getValue();
12628
			}
12629
		}
12630
		//alert(treeSructure_ + ',' + objClassValue_ + ',' + formname_ + ',' + targetField_)
12631
		if (_StartDate != "") {
12632
			Ext.create('MinovaES.view.orm.lookup.minovalookuptreePopup', {
12633
				name: _targetField + 'lookUp',
12634
				treeSructure: _treeSructure, // object relationship
12635
				objClassValue: _objClassValue, // object yang akan di input ke field
12636
				formname: _formname, // nama form
12637
				targetField: _targetField,
12638
				objFilter: _objFilter,
12639
				title: 'Lookup ' + _fieldLabel
12640
			}).show()
12641
		} else {
12642
			MinovaMessage('', 'BS0001', 'Start Date', 'E')
12643
		}
12644

    
12645
	},
12646
});
12647

    
12648
Ext.define('MinovaUtil.MinovaES.LookupEmployee', {
12649
	extend: 'Ext.window.Window',
12650
	alias: 'widget.minovalookupemployee',
12651
	requires: [],
12652
	height: '87%',
12653
	width: '41%',
12654
	minWidth: '50%',
12655
	maxWidth: '100%',
12656
	bodyPadding: 0,
12657
	formname: undefined,
12658
	name: 'popup_lookupEMPID',
12659
	test: undefined,
12660
	vtype: 'validateMinovaXss',
12661
	targetField: undefined,
12662
	valueField: undefined,
12663
	tableName: undefined,
12664
	LookupFunction: undefined,
12665
	isGrid: undefined,
12666
	listeners: {
12667
		afterrender: function (f) {
12668
			f.setTitle('Lookup - ' + f.targetField);
12669
		}
12670
	},
12671
	initComponent: function () {
12672
		var me = this;
12673
		var targetField_ = me.targetField;
12674
		var valueField_ = me.valueField;
12675
		var form = me.test;
12676
		var tableName_ = me.tableName;
12677
		var isGrid = me.isGrid_;
12678
		var LookupFunction = me.LookupFunction;
12679
		param_ = null;
12680

    
12681
		var filterParam_ = me.filterParam;
12682
		if (tableName_ == "PDSRC0002") {
12683
			fieldLabel_ = 'App ID/ External ID/ Full Name';
12684
		} else {
12685
			fieldLabel_ = 'Emp ID/ External ID/ Full Name';
12686
		}
12687
		Ext.applyIf(me, {
12688
			items: [{
12689
					items: [{
12690
							xtype: 'tabpanel',
12691
							items: [{
12692
									xtype: 'form',
12693
									title: 'Quick Search',
12694
									height: '70%',
12695
									items: [{
12696
											xtype: 'form',
12697
											name: 'frmSearch',
12698
											width: '100%',
12699
											height: 'auto',
12700
											dockedItems: [{
12701
													xtype: 'toolbar',
12702
													dock: 'top',
12703
													layout: 'vbox',
12704
													bodyPadding: 10,
12705
													border: 0,
12706
													items: [{
12707
															xtype: 'fieldset',
12708
															layout: 'hbox',
12709
															width: '100%',
12710
															border: 0,
12711
															padding: 0,
12712
															items: [{
12713
																	xtype: 'textfield',
12714
																	name: 'EmployeeSearch',
12715
																	fieldLabel: fieldLabel_,
12716
																	width: 470,
12717
																	labelWidth: 185,
12718
																	enableKeyEvents: true,
12719
																	filterParam: filterParam_,
12720
																	listeners: {
12721
																		specialkey: function (f, e) {
12722
																			if (e.getKey() == e.ENTER) {
12723
																				var emp = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
12724
																				var emp_ = emp.getValue();
12725
																				var store = Ext.data.StoreManager.lookup('storeQC');
12726
																				var grid = Ext.ComponentQuery.query('[name=EmployeeID]')[0];
12727
																				if (tableName_ == 'PDSRC0002') {
12728
																					param_ = 'AppIDExternalIDFullName[like]' + emp_
12729
																				} else {
12730
																					param_ = 'EmpIDExternalIDFullName[like]' + emp_
12731
																				}
12732
																				if (this.filterParam) {
12733
																					param_ = param_ + ',' + this.filterParam_
12734
																				}
12735

    
12736
																				store.proxy.extraParams = {
12737
																					tableName: tableName_,
12738
																					param: param_,
12739
																					menuId: MinovaUtil.GetMenuID()
12740
																				};
12741
																				store.removeAll();
12742
																				store.reload();
12743
																				store.loadPage(1);
12744
																			}
12745
																		}
12746
																	}
12747
																}, {
12748
																	xtype: 'tbspacer',
12749
																	width: 5
12750
																}, {
12751
																	xtype: 'button',
12752
																	name: 'Search',
12753
																	text: 'Search',
12754
																	filterParam: filterParam_,
12755
																	handler: function () {
12756
																		var emp = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
12757
																		var emp_ = emp.getValue();
12758
																		var store = Ext.data.StoreManager.lookup('storeQC');
12759
																		var grid = Ext.ComponentQuery.query('[name=EmployeeID]')[0];
12760

    
12761
																		if (tableName_ == 'PDSRC0002') {
12762
																			param_ = 'AppIDExternalIDFullName[like]' + emp_
12763
																		} else {
12764
																			param_ = 'EmpIDExternalIDFullName[like]' + emp_
12765
																		}
12766
																		if (this.filterParam) {
12767
																			param_ = param_ + ',' + this.filterParam
12768
																		}
12769
																		store.proxy.extraParams = {
12770
																			tableName: tableName_,
12771
																			param: param_,
12772
																			menuId: MinovaUtil.GetMenuID()
12773
																		};
12774
																		store.removeAll();
12775
																		store.reload();
12776
																		store.loadPage(1);
12777
																	}
12778
																}
12779
															]
12780
														}
12781
													]
12782
												}
12783
											]
12784
										}, {
12785
											items: [{
12786
													xtype: "minovagrid1",
12787
													name: "GridEmployeeID",
12788
													storename: 'storeQC',
12789
													tableName: tableName_,
12790
													param: '',
12791
													isLookup: true,
12792
													pagesize: 25,
12793
													height: 398,
12794
													LookupFunction: LookupFunction,
12795
													valueField: valueField_,
12796
													targetField: targetField_,
12797
													isGrid: true,
12798
													listeners: {
12799
														beforeedit: function () {
12800
															return false;
12801
														},
12802
														itemdblclick: function () {
12803
															var grid = Ext.ComponentQuery.query('[name=GridEmployeeID]')[0];
12804
															var selection = grid.getView().getSelectionModel().getSelection()[0];
12805
															var Emp_ = selection.data.EmployeeID;
12806
															LookupFunction = this.LookupFunction;
12807
															eval(LookupFunction);
12808
															var target = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField;
12809
															Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(Emp_);
12810
															Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].destroy();
12811
														}
12812
													},
12813
												}, {
12814
													xtype: 'pagingtoolbar',
12815
													store: 'storeQC',
12816
													dock: 'bottom',
12817
													displayInfo: true
12818
												}
12819
											]
12820
										}
12821
									]
12822
								}, {
12823
									title: 'Advance Search',
12824
									items: [{
12825
											xtype: 'form',
12826
											name: 'formlookup',
12827
											items: [{
12828
													xtype: 'minovaform',
12829
													name: 'frmlookup',
12830
													tableName: tableName_,
12831
													param: filterParam_,
12832
													isLookup: true,
12833
													listeners: {
12834
														onStockFormKeyPress: function (textfield, event, options) {
12835
															if (event.getKey() == event.ENTER) {
12836
																alert("test");
12837
															}
12838
														}
12839
													},
12840
													buttons: [{
12841
															text: 'Search',
12842
															filterParam: filterParam_,
12843
															listeners: {
12844
																click: function () {
12845
																	var store = Ext.data.StoreManager.lookup('storeadvance');
12846
																	var form = Ext.ComponentQuery.query('[name=formlookup]')[0].getForm();
12847
																	grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
12848
																	var values_ = form.getValues();
12849
																	var fields_ = form.getFields().items;
12850
																	var param_ = '';
12851
																	for (var i = 0; i < fields_.length; i++) {
12852
																		var val_ = form.getFields().items[i].getValue();
12853
																		var xtype_ = form.getFields().items[i].xtype;
12854
																		var oprator_ = '[like]';
12855
																		if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
12856
																			oprator_ = '[Equal]';
12857
																		}
12858
																		if (xtype_ == 'datefield') {
12859
																			if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
12860
																				oprator_ = '[LessThanEqual]';
12861
																			} else {
12862
																				oprator_ = '[GreaterThanEqual]';
12863
																			}
12864
																		}
12865
																		if (val_ != 'undefined' && val_ != "" && val_ != null) {
12866
																			param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
12867
																		}
12868
																	}
12869
																	if (this.filterParam_) {
12870
																		param_ = param_ + ',' + this.filterParam_
12871
																	}
12872
																	store.proxy.extraParams = {
12873
																		tableName: grid.tableName,
12874
																		param: param_,
12875
																		menuId: MinovaUtil.GetMenuID()
12876
																	};
12877
																	store.removeAll();
12878
																	store.reload();
12879
																	store.loadPage(1);
12880
																},
12881

    
12882
															}
12883
														}
12884
													]
12885
												}, {
12886
													xtype: 'minovagrid1', // update by hamid 20170208
12887
													name: 'gridlookup',
12888
													minHeight: 312,
12889
													height: 290,
12890
													tableName: tableName_, //'PDSEMP0001',
12891
													param: '',
12892
													isLookup: true,
12893
													storename: 'storeadvance',
12894
													pagesize: 25,
12895
													valueField: valueField_,
12896
													targetField: targetField_,
12897
													hidebutton: 0, // update by hamid 20170208
12898
													isGrid: true,
12899
													listeners: {
12900
														beforeedit: function () {
12901
															return false;
12902
														},
12903
														itemdblclick: function () {
12904
															var grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
12905
															var selection = grid.getView().getSelectionModel().getSelection()[0];
12906
															var Emp_ = selection.data.EmployeeID;
12907
															LookupFunction = this.LookupFunction;
12908
															eval(LookupFunction);
12909
															var target = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField;
12910
															Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(Emp_);
12911
															Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].destroy();
12912
														}
12913
													},
12914
													dockedItems: [{
12915
															xtype: 'pagingtoolbar',
12916
															store: 'storeadvance',
12917
															dock: 'bottom',
12918
															displayInfo: true
12919
														}
12920
													]
12921
												}
12922
											]
12923

    
12924
										}
12925
									]
12926

    
12927
								}
12928
							]
12929

    
12930
						}
12931
					]
12932
				}
12933
			]
12934
		});
12935
		me.callParent(arguments);
12936
	}
12937
});
12938

    
12939
Ext.define('MinovaUtil.MinovaES.MinovaLookupEmployee', {
12940
	extend: 'Ext.form.field.Trigger',
12941
	alias: 'widget.lookupemployee',
12942

    
12943
	formname: undefined,
12944
	fieldname: undefined,
12945
	allowBlank: undefined,
12946
	width: undefined,
12947
	tableName: undefined,
12948
	LookupFunction: undefined,
12949
	targetField: undefined,
12950
	vtype: 'validateMinovaXss',
12951
	fieldValue: undefined,
12952
	initComponent: function () {
12953

    
12954
		this.callParent();
12955
	},
12956
	onTriggerClick: function () {
12957
		var nameField_ = this.fieldname;
12958
		var blank = this.allowBlank;
12959
		var width_ = this.width;
12960
		var tableName_ = this.tableName;
12961
		var panelform = "form" + this.name;
12962
		//add filer by atin
12963
		var filterParam_ = this.filterParam;
12964
		// and add by atin
12965
		var _targetField = this.name;
12966
		if (this.targetField) {
12967
			_targetField = targetField
12968
		}
12969
		var fieldValue_ = this.fieldValue;
12970
		var _fieldLabel = this.fieldLabel;
12971

    
12972
		//var tableName_ = this.tableName;
12973
		var count_lookup = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
12974
		var lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0];
12975
		var EmployeeID = Ext.ComponentQuery.query('[name=' + _targetField + ']')[0];
12976
		var EmployeeID_ = EmployeeID.getValue();
12977
		var LookupFunction = this.LookupFunction;
12978
		var popup_lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
12979
		if (count_lookup == 1) {
12980
			Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField = this.name;
12981
			Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].show();
12982
		} else {
12983
			Ext.create('MinovaUtil.MinovaES.LookupEmployee', {
12984
				tableName: tableName_,
12985
				targetField: this.name,
12986
				fieldValue: fieldValue_,
12987
				LookupFunction: LookupFunction,
12988
				filterParam: filterParam_,
12989
			}).show()
12990
		}
12991
		var text = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
12992
		text.setValue(EmployeeID_);
12993
		var store = Ext.data.StoreManager.lookup('storeQC');
12994
		if (EmployeeID_ !== "") {
12995

    
12996
			var grid = Ext.ComponentQuery.query('[name=' + _targetField + ']')[0];
12997
			if (tableName_ == 'PDSEMP0002') {
12998
				param_ = 'EmpIDExternalIDFullName[like]' + EmployeeID_
12999
			} else {
13000
				param_ = 'AppIDExternalIDFullName[like]' + EmployeeID_
13001
			}
13002
			if (filterParam_) {
13003
				param_ = param_ + ',' + filterParam_;
13004
			}
13005
			store.proxy.extraParams = {
13006
				tableName: tableName_, //'PDSEMP0002',
13007
				param: param_,
13008
				menuId: MinovaUtil.GetMenuID()
13009
			};
13010
			store.reload();
13011
		} else {
13012
			store.proxy.extraParams = {
13013
				tableName: tableName_, //'PDSEMP0002',
13014
				param: filterParam_,
13015
				menuId: MinovaUtil.GetMenuID()
13016
			};
13017
			store.reload();
13018
		}
13019

    
13020
	},
13021
	listeners: {
13022
		specialkey: function (f, e) {
13023
			if (e.getKey() == e.ENTER) {
13024
				//alert("about to submit");
13025
				var nameField_ = this.fieldname;
13026
				var blank = this.allowBlank;
13027
				var width_ = this.width;
13028
				var tableName_ = this.tableName;
13029
				var panelform = "form" + this.name;
13030
				//add filer by atin
13031
				var filterParam = this.filterParam;
13032
				// and add by atin
13033
				var _targetField = this.name;
13034
				var _fieldLabel = this.fieldLabel;
13035
				var count_lookup = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
13036
				var lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0];
13037
				var EmployeeID = Ext.ComponentQuery.query('[name=' + _targetField + ']')[0];
13038
				var EmployeeID_ = EmployeeID.getValue();
13039

    
13040
				var popup_lookupEMPID = Ext.ComponentQuery.query('[name=popup_lookupEMPID]').length;
13041
				if (count_lookup == 1) {
13042
					Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].targetField = this.name;
13043
					Ext.ComponentQuery.query('[name=popup_lookupEMPID]')[0].show();
13044
				} else {
13045
					Ext.create('MinovaUtil.MinovaES.LookupEmployee', {
13046
						tableName: tableName_,
13047
						targetField: this.name,
13048
						fieldValue: this.fieldValue,
13049
						LookupFunction: this.LookupFunction,
13050
						filterParam: filterParam,
13051
					}).show()
13052
				}
13053
				var text = Ext.ComponentQuery.query('[name=EmployeeSearch]')[0];
13054
				text.setValue(EmployeeID_);
13055

    
13056
				if (EmployeeID_ !== "") {
13057
					var store = Ext.data.StoreManager.lookup('storeQC');
13058
					var grid = Ext.ComponentQuery.query('[name=' + _targetField + ']')[0];
13059
					if (tableName_ == 'PDSEMP0002') {
13060
						param_ = 'EmpIDExternalIDFullName[like]' + EmployeeID_
13061
					} else {
13062
						param_ = 'AppIDExternalIDFullName[like]' + EmployeeID_
13063
					}
13064
					if (filterParam_) {
13065
						param_ = param_ + ',' + filterParam_;
13066
					}
13067
					store.proxy.extraParams = {
13068
						tableName: tableName_, //'PDSEMP0002',
13069
						param: param_,
13070
						menuId: MinovaUtil.GetMenuID()
13071
					};
13072
					store.reload();
13073
				}
13074
			}
13075
		}
13076
	}
13077

    
13078
});
13079
Ext.define('MinovaUtil.MinovaES.UploadFile', {
13080
	extend: 'Ext.form.field.Trigger',
13081
	alias: 'widget.uploadfile',
13082

    
13083
	//fieldLabel: undefined,
13084
	uploadName: 'uploadName',
13085
	formname: undefined,
13086
	fieldname: undefined,
13087
	allowBlank: undefined,
13088
	width: undefined,
13089
	tableName: undefined,
13090
	initComponent: function () {
13091

    
13092
		this.callParent();
13093
	},
13094
	onTriggerClick: function () {
13095
		var nameField_ = this.fieldname;
13096
		var blank = this.allowBlank;
13097
		var width_ = this.width;
13098
		var tableName_ = this.tableName;
13099
		var panelform = "form" + this.name;
13100
		var val_ = this.value;
13101
		var _targetField = this.name;
13102
		var _fieldLabel = this.fieldLabel;
13103

    
13104
		//var tableName_ = this.tableName;
13105
		var count_lookup = Ext.ComponentQuery.query('[name=FormFileUpload]').length;
13106
		var lookupEMPID = Ext.ComponentQuery.query('[name=FormFileUpload]')[0];
13107
		var EmployeeID = Ext.ComponentQuery.query('[name=' + _targetField + ']')[0];
13108
		var EmployeeID_ = EmployeeID.getValue();
13109

    
13110
		var FormFileUpload = Ext.ComponentQuery.query('[name=FormFileUpload]').length;
13111
		Ext.create('MinovaES.view.uploadfile.fileupload', {
13112
			tableName: tableName_,
13113
			targetField: this.name,
13114
			valueFile: val_,
13115
			titleLookup: _fieldLabel,
13116
		}).show()
13117

    
13118
	}
13119

    
13120
});
13121

    
13122
//atien
13123
Ext.define('MinovaES.view.uploadfile.fileupload', {
13124
	extend: 'Ext.window.Window',
13125
	alias: 'widget.fileupload',
13126
	requires: [
13127

    
13128
	],
13129
	//height: '67%',
13130
	width: '35%',
13131
	minWidth: '50%',
13132
	maxWidth: '100%',
13133
	bodyPadding: 0,
13134
	formname: undefined,
13135
	fieldname: undefined,
13136
	modal: true,
13137
	title: 'Upload ',
13138
	name: 'FormLookup',
13139
	test: undefined,
13140
	targetField: undefined,
13141
	tableName: undefined,
13142
	listeners: {
13143
		afterrender: function (f) {
13144
			f.setTitle('Upload ' + f.titleLookup);
13145
			var id_ = Ext.ComponentQuery.query('minovanumberfield[name=FileID]')[0];
13146
			if (id_) {
13147
				var valID = id_.getValue();
13148
				Ext.ComponentQuery.query('textfield[name=FileID_]')[0].setValue(valID);
13149
			}
13150
		},
13151
	},
13152
	initComponent: function () {
13153
		var me = this;
13154
		var targetField_ = me.targetField;
13155
		var titleLookup_ = me.titleLookup;
13156
		var maxFileSize = me.maxFileSize;
13157
		var fileName = me.valueFile;
13158
		Ext.applyIf(me, {
13159
			items: [{
13160
					xtype: 'form',
13161
					name: 'FormFileUpload',
13162
					valueFile: fileName,
13163
					buttons: [{
13164
							xtype: 'button',
13165
							iconCls: 'fa-upload',
13166
							style: 'font-family: FontAwesome',
13167
							text: 'Upload',
13168
							action: 'Upload',
13169
							name: 'Upload',
13170
							handler: function () {
13171
								maxFileSize = Ext.ComponentQuery.query('uploadfile[name=' + targetField_ + ']')[0].maxFileSize;
13172
								Ext.ComponentQuery.query('[name=FileMax]')[0].setValue(maxFileSize);
13173
								var form = Ext.ComponentQuery.query('form[name=FormFileUpload]')[0].getForm();
13174
								pnl = Ext.ComponentQuery.query('[name=FormLookup]')[0]; // by hamid 20170206
13175
								if (form.isValid()) {
13176
									form.submit({
13177
										url: '/Devt/UploadFile',
13178
										waitMsg: 'Uploading your file...',
13179
										success: function (fp, o) {
13180
											var result = o.result;
13181
											Ext.ComponentQuery.query('uploadfile[name=' + targetField_ + ']')[0].setValue(result.FileName);
13182
											Ext.ComponentQuery.query('[name=FormFileUpload]')[0].valueFile = result.FileName;
13183
											Ext.ComponentQuery.query('[name=download]')[0].fileName = result.FileName;
13184
											var fileID = Ext.ComponentQuery.query('minovanumberfield[name=FileID]')[0]
13185
												if (fileID) {
13186
													fileID.setValue(result.ID);
13187
												}
13188

    
13189
												if (result.msg === "") {
13190
													if (me.onSuccess !== undefined)
13191
														me.onSuccess(result.FileName, result.content_type);
13192
													pnl.destroy(); // by hamid 20170206
13193
												} else
13194
													alert(result.msg);
13195
										}
13196
									});
13197
								}
13198
							}
13199
						}, {
13200
							xtype: 'button',
13201
							text: 'Clear',
13202
							width: 60,
13203
							handler: function () {
13204
								//Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0].setValue('');
13205
								Ext.ComponentQuery.query('[name=' + targetField_ + ']')[0].setValue(''); // by hamid 20170206
13206
							}
13207
						}, {
13208
							xtype: 'button',
13209
							text: 'Download',
13210
							name: 'download',
13211
							width: 60,
13212
							fileName: fileName,
13213
							handler: function (f) {
13214
								var url = '/Devt/GetFileData?FileName=' + f.fileName + '&download=true';
13215
								window.open(url, '_blank');
13216
							}
13217
							//href: '/Devt/GetFileData?FileName=' + me.valueFile + '&download=true',
13218

    
13219
						}
13220
					],
13221
					items: [{
13222
							xtype: 'filefield',
13223
							name: 'File',
13224
							fieldLabel: 'Select File',
13225
							//allowBlank: false,
13226
							//width: 270,
13227
							//labelWidth: 85,
13228
						}, {
13229
							xtype: 'textfield',
13230
							name: 'FileID_',
13231
							hidden: true,
13232
						}, {
13233
							xtype: 'textfield',
13234
							name: 'FileMax',
13235
							hidden: true,
13236
						}
13237
					]
13238
				}
13239
			]
13240
		});
13241
		me.callParent(arguments);
13242
	}
13243
});
13244
//atien
13245

    
13246

    
13247
//update by hamid 12012017
13248
Ext.define('MinovaES.view.uploadfile.fileupload1', {
13249
	extend: 'Ext.window.Window',
13250
	alias: 'widget.fileupload1',
13251
	requires: [
13252

    
13253
	],
13254
	height: '67%',
13255
	width: '21%',
13256
	minWidth: '50%',
13257
	maxWidth: '100%',
13258
	bodyPadding: 0,
13259
	formname: undefined,
13260
	fieldname: undefined,
13261
	//modal: true,
13262
	title: 'Lookup - Photo',
13263
	name: 'FormLookup',
13264
	test: undefined,
13265
	targetField: undefined,
13266
	tableName: undefined,
13267
	initComponent: function () {
13268
		var me = this;
13269
		var targetField_ = me.targetField;
13270
		var nameField_ = this.fieldname;
13271
		var form = me.test;
13272
		var tableName_ = me.tableName;
13273
		//var img_ = Ext.ComponentQuery.query('[name=Photo]')[0].getValue()
13274
		var img_ = Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0];
13275
		Ext.applyIf(me, {
13276
			// items: [{
13277
			//xtype : 'panel',
13278
			items: [{
13279
					xtype: 'tabpanel',
13280
					//name: 'mainTab',
13281
					items: [{
13282
							xtype: 'form',
13283
							title: 'Upload File',
13284
							height: '70%',
13285
							name: 'FormFileUpload',
13286
							buttons: [{
13287
									xtype: 'button',
13288
									iconCls: 'fa-upload',
13289
									style: 'font-family: FontAwesome',
13290
									text: 'Upload',
13291
									action: 'Upload',
13292
									name: 'Upload',
13293
									handler: function () {
13294
										//var Tab = Ext.ComponentQuery.query('[name=mainTab]')[0].getActiveTab();
13295
										var form = Ext.ComponentQuery.query('form[name=FormFileUpload]')[0].getForm();
13296
										pnl = Ext.ComponentQuery.query('[name=FormLookup]')[0];
13297
										if (form.isValid()) {
13298
											form.submit({
13299
												url: '/Devt/UploadFile',
13300
												waitMsg: 'Uploading your file...',
13301
												success: function (fp, o) {
13302
													var result = o.result;
13303
													Ext.ComponentQuery.query('[name=' + targetField_ + ']')[0].setValue(result.FileName)
13304
													//Ext.ComponentQuery.query('[name=Photo]')[0].setValue(result.FileName)
13305
													if (result.msg === "") {
13306
														//alert('success');
13307
														if (me.onSuccess !== undefined)
13308
															me.onSuccess(result.FileName, result.content_type);
13309
														pnl.destroy();
13310
													} else
13311
														alert(result.msg);
13312
												}
13313
											});
13314
										}
13315
									}
13316
								}, {
13317
									xtype: 'button',
13318
									text: 'Clear',
13319
									width: 60,
13320
									handler: function () {
13321
										Ext.ComponentQuery.query('[name=' + nameField_ + ']')[0].setValue('');
13322
										//Ext.ComponentQuery.query('[name=Photo]')[0].setValue('');
13323

    
13324
									}
13325
								}
13326
							],
13327
							items: [{
13328
									xtype: 'fieldset',
13329
									layout: 'hbox',
13330
									width: '100%',
13331
									bodyPadding: 10,
13332
									border: 0,
13333
									padding: 0,
13334
									items: [{
13335
											xtype: 'filefield',
13336
											name: 'File',
13337
											fieldLabel: 'Select File',
13338
											//allowBlank: false,
13339
											width: 270,
13340
											labelWidth: 85,
13341
										}
13342
									]
13343
								}
13344
							]
13345
							//items: [{
13346
							//    xtype: 'form',
13347
							//    name: 'Photo',
13348
							//    width: '100%',
13349
							//    height: 'auto',
13350
							//    dockedItems: [{
13351
							//        xtype: 'toolbar',
13352
							//        dock: 'top',
13353
							//        layout: 'vbox',
13354
							//        bodyPadding: 10,
13355
							//        border: 0,
13356
							//        items: [{
13357
							//            xtype: 'fieldset',
13358
							//            layout: 'hbox',
13359
							//            width: '100%',
13360
							//            border: 0,
13361
							//            padding: 0,
13362
							//            items: [{
13363
							//                xtype: 'filefield',
13364
							//                name: 'SelectFile',
13365
							//                fieldLabel: 'Select File',
13366
							//                width: 270,
13367
							//                labelWidth: 85,
13368
							//                enableKeyEvents: true,
13369
							//                buttonText: 'Browse',
13370
							//            }]
13371

    
13372
							//        }
13373
							//        ]
13374
							//    }
13375
							//    ]
13376
							//}]
13377
						}, {
13378
							title: 'View Image',
13379
							//height: 400,
13380
							//autoScroll: true,
13381
							items: [{
13382
									xtype: 'form',
13383
									name: 'ViewImage',
13384
									//margin: '5 5 5 5',
13385
									items: [{
13386
											xtype: 'form',
13387
											buttons: [{
13388
													text: 'Download',
13389
													handler: function () {},
13390
													href: '/Devt/GetFileData?FileName=' + img_ + '&download=true'
13391

    
13392
												}
13393
											],
13394
											items: [{
13395
													xtype: 'image',
13396
													//id: 'imageuser',
13397
													src: '/Devt/GetFileData?FileName=' + img_ + '&download=false'
13398
												},
13399
											]
13400
										}
13401
									]
13402

    
13403
								}
13404
							]
13405

    
13406
						}
13407
					]
13408

    
13409
				}
13410
			]
13411

    
13412
		});
13413
		me.callParent(arguments);
13414
	}
13415
});
13416

    
13417
Ext.define('MinovaUtil.MinovaES.Column.MinovaPictureColumn', {
13418
	extend: 'Ext.grid.column.Column',
13419
	alias: ['widget.minovapicturecolumn'],
13420
	alternateClassName: 'Ext.grid.MinovaPictureColumn',
13421
	//undefinedText: '&#160;',
13422
	defaultRenderer: function (value) {
13423
		return '<img alt="" class="icon-imagecolumn" src = "/Devt/GetFileData?FileName=' + value + '&download=false"  id="">'
13424
	}
13425
});
13426

    
13427
Ext.define('MinovaUtil.MinovaES.MinovaFixValue', {
13428
	extend: 'Ext.form.field.ComboBox',
13429
	alias: ['widget.MinovaFixValue', 'widget.minovafixvalue'],
13430
	fixedValue: undefined,
13431
	anchor: '50%',
13432
	queryMode: 'local',
13433
	forceSelection: true, // cek data
13434
	getValue: function () {
13435
		var value = this.value;
13436

    
13437
		return value;
13438
	},
13439
	getSubmitValue: function () {
13440
		var value = this.value;
13441

    
13442
		return value;
13443
	},
13444
	initComponent: function () {
13445
		var me = this;
13446
		var storeData = [];
13447
		//var str= "y=yes|| n=no";
13448
		var str = me.fixedValue;
13449
		var hasil = str.split('||');
13450
		hasil.forEach(function (h) {
13451
			store_ = h.split('=')
13452
				storeData.push({
13453
					code: store_[0],
13454
					desc: store_[1],
13455

    
13456
				});
13457
		});
13458
		Ext.applyIf(me, {
13459

    
13460
			store: Ext.create('Ext.data.Store', {
13461
				storeId: 'store' + name,
13462
				autoLoad: true,
13463
				data: storeData
13464

    
13465
			}),
13466
		});
13467
		me.callParent(arguments);
13468
	}
13469
});
13470

    
13471
Ext.define('MinovaUtil.MinovaES.MinovaDecimal', {
13472
	extend: 'Ext.form.field.Text',
13473
	alias: ['widget.MinovaDecimal', 'widget.minovadecimal'],
13474
	fixedValue: undefined,
13475
	anchor: '50%',
13476
	getValue: function () {
13477
		var value = this.value;
13478

    
13479
		return value.replace(',', '.');
13480
	},
13481
	getSubmitValue: function () {
13482
		var value = this.value;
13483
		return value.replace(',', '.');
13484
	},
13485
	initComponent: function () {
13486
		var me = this;
13487
		Ext.applyIf(me, {});
13488
		me.callParent(arguments);
13489
	}
13490
});
13491

    
13492
Ext.define('MinovaUtil.com.xtype.MinovaWorflowEditor', {
13493
	extend: 'Ext.panel.Panel',
13494
	alias: ['widget.minovawfeditor', 'widget.minovafloweditor'],
13495
	title: undefined,
13496
	initComponent: function () {
13497
		// this.layout = 'fit';
13498
		this.readOnly = this.readOnly ? this.readOnly : false;
13499
		this.autoScroll = true;
13500
		this.height = 480;
13501
		this.title = this.title ? this.title : 'Workflow editor';
13502
		this.html = '<div id="minovaGraphContainer" title="' + this.title
13503
			 + '" style="background:url(\'' + mxBasePath
13504
			 + '/editors/images/grid.gif\')"></div>';
13505
		this.tbar = [{
13506
				xtype: 'button',
13507
				hidden: true,
13508
				text: 'add Task',
13509
				handler: this.addTask
13510

    
13511
			}, {
13512
				xtype: 'button',
13513
				text: 'Remove',
13514
				hidden: true,
13515
				handler: this.removeCells
13516
			},
13517
			'->', {
13518
				xtype: 'cycle',
13519
				text: 'layout',
13520
				menu: {
13521
					// id : 'view-type-menu',
13522
					items: [{
13523
							text: 'mxCircleLayout'
13524
						}, {
13525
							text: 'mxCompactTreeLayout'
13526
						}, {
13527
							text: 'mxCompositeLayout'
13528
						}, {
13529
							text: 'mxEdgeLabelLayout'
13530
						}, {
13531
							text: 'mxFastOrganicLayout'
13532
						}, {
13533
							text: 'mxGraphLayout'
13534
						}, {
13535
							text: 'mxHierarchicalLayout'
13536
						}
13537
						// , {
13538
						// text : 'mxParallelEdgeLayout'
13539
						// }
13540
						// , {
13541
						// text : 'mxPartitionLayout'
13542
						// },
13543
						// {
13544
						// text : 'mxStackLayout'
13545
						// }
13546
					]
13547
				},
13548
				changeHandler: function (cycleBtn, activeItem) {
13549
					// Ext.Msg.alert('Change View', activeItem.text);
13550
					try {
13551
						switch (activeItem.text) {
13552
						case 'mxCircleLayout':
13553
							var layout = new mxCircleLayout(graph);
13554
							layout.execute(graph.getDefaultParent());
13555
							break;
13556
						case 'mxCompactTreeLayout':
13557
							var layout = new mxCompactTreeLayout(graph,
13558
									false);
13559
							layout.execute(graph.getDefaultParent());
13560
							break;
13561
						case 'mxCompositeLayout':
13562
							var first = new mxFastOrganicLayout(graph);
13563
							var second = new mxParallelEdgeLayout(graph);
13564
							var layout = new mxCompositeLayout(graph, [
13565
										first, second], first);
13566
							layout.execute(graph.getDefaultParent());
13567
							break;
13568
						case 'mxEdgeLabelLayout':
13569
							var layout = new mxEdgeLabelLayout(graph);
13570
							layout.execute(graph.getDefaultParent());
13571
							break;
13572
						case 'mxFastOrganicLayout':
13573
							var layout = new mxCircleLayout(graph);
13574
							layout.execute(graph.getDefaultParent());
13575
							break;
13576
						case 'mxGraphLayout':
13577
							var layout = new mxFastOrganicLayout(graph);
13578
							layout.execute(graph.getDefaultParent());
13579
							break;
13580
						case 'mxParallelEdgeLayout':
13581
							var layout = new mxParallelEdgeLayout(graph);
13582
							layout.execute(graph.getDefaultParent());
13583
							break;
13584
						case 'mxPartitionLayout':
13585
							var layout = new mxPartitionLayout(graph,
13586
									true, 10, 20);
13587
							layout.execute(graph.getDefaultParent());
13588
							break;
13589
						case 'mxStackLayout':
13590
							var layout = new mxStackLayout(graph, false);
13591
							layout.execute(graph.getDefaultParent());
13592
							break;
13593
						case 'mxHierarchicalLayout':
13594
							var layout = new mxHierarchicalLayout(graph);
13595
							layout.parallelEdgeSpacing = 100;
13596
							layout.moveParent = true;
13597
							layout.parentBorder = 100;
13598
							layout.intraCellSpacing = 100;
13599
							layout.interRankCellSpacing = 100;
13600
							layout.interHierarchySpacing = 0;
13601
							layout.orientation = mxConstants.DIRECTION_NORTH;
13602
							//layout.traverseAncestors = false;
13603
							layout.execute(parent);
13604
							break;
13605

    
13606
						}
13607
					} catch (e) {}
13608
				}
13609
			}, {
13610
				xtype: 'tbseparator'
13611
			}, {
13612
				text: 'In',
13613
				name: 'zoomin',
13614
				handler: function () {
13615
					graph.zoomIn();
13616
					graph.fit();
13617
				}
13618
			}, {
13619
				text: 'Out',
13620
				name: 'zoomout',
13621
				handler: function () {
13622
					graph.zoomOut();
13623
					graph.fit();
13624
				}
13625
			}
13626
			// , {
13627
			// text : 'Fit',
13628
			// name : 'zoomfit',
13629
			// handler : function() {
13630
			// graph.fit();
13631
			// }
13632
			// }
13633
		, {
13634
				xtype: 'tbseparator'
13635
			}, {
13636
				xtype: 'button',
13637
				text: 'print',
13638
				name: 'print',
13639
				handler: this.printPreview
13640
			}
13641
		]
13642

    
13643
		this.autoScroll = true;
13644
		this.listeners = {
13645
			afterrender: this.onAfterRender,
13646
			resize: this.onResize
13647
		}
13648

    
13649
		this.callParent(arguments);
13650
	},
13651
	printPreview: function () {
13652
		var preview = new mxPrintPreview(graph);
13653
		preview.print();
13654
	},
13655
	onAfterRender: function (_this) {
13656
		this.main(document.getElementById('minovaGraphContainer'));
13657
	},
13658
	removeCells: function () {
13659
		graph.removeCells();
13660
	},
13661
	onResize: function () {
13662
		try {
13663
			graph.sizeDidChange();
13664
		} catch (e) {}
13665
	},
13666
	addTask: function () {
13667
		graph.insertVertex(graph.getDefaultParent(), null, 'Task-' + Ext.id(),
13668
			0, 0, 80, 30);
13669
	},
13670
	main: function (container) {
13671
		// Checks if the browser is supported
13672
		if (!mxClient.isBrowserSupported()) {
13673
			// Displays an error message if the browser is not supported.
13674
			// mxUtils.error('Browser is not supported!', 200, false);
13675
			alert('Browser is not supported!');
13676
		} else {
13677
			// // Creates the graph inside the given container
13678
			// graph = new mxGraph(container);
13679
			// var keyHandler = new mxKeyHandler(graph);
13680
			// // keyHandler.bindKey(46, function(evt) {
13681
			// // if (graph.isEnabled()) {
13682
			// // graph.removeCells();
13683
			// // }
13684
			// // });
13685
			// wfEditor = new mxEditor();
13686
			//
13687
			// // Enables rubberband selection
13688
			//
13689
			// new mxRubberband(graph);
13690
			// graph.setPanning(true);
13691
			// graph.setTooltips(true);
13692
			//
13693
			// // graph.setConnectable(true);
13694
			// // graph.setDropEnabled(true);
13695
			// // graph.connectionHandler.setCreateTarget(true);
13696
			//
13697
			// // Gets the default parent for inserting new cells. This
13698
			// // is normally the first child of the root (ie. layer 0).
13699
			// var parent = graph.getDefaultParent();
13700

    
13701
			// Enables crisp rendering in SVG
13702
			// mxShape.prototype.crisp = true;
13703

    
13704
			// Enables guides
13705
			// mxGraphHandler.prototype.guidesEnabled = true;
13706

    
13707
			// Alt disables guides
13708
			// mxGuide.prototype.isEnabledForEvent = function(evt) {
13709
			// return !mxEvent.isAltDown(evt);
13710
			// };
13711

    
13712
			// Enables snapping waypoints to terminals
13713
			// mxEdgeHandler.prototype.snapToTerminals = true;
13714

    
13715
			// Enables orthogonal connect preview in IE
13716
			// mxConnectionHandler.prototype.movePreviewAway = true;
13717

    
13718
			// Creates the graph inside the given container
13719
			graph = new mxGraph(container);
13720
			// graph.disconnectOnMove = false;
13721
			// graph.foldingEnabled = false;
13722
			// graph.cellsResizable = false;
13723
			// graph.extendParents = false;
13724
			// graph.setConnectable(true);
13725
			graph.setAllowDanglingEdges(false);
13726

    
13727
			// Implements perimeter-less connection points as fixed points
13728
			// (computed before the edge style).
13729
			// graph.view.updateFixedTerminalPoint = function(edge, terminal,
13730
			// source, constraint) {
13731
			// mxGraphView.prototype.updateFixedTerminalPoint.apply(this,
13732
			// arguments);
13733
			//
13734
			// var pts = edge.absolutePoints;
13735
			// var pt = pts[(source) ? 0 : pts.length - 1];
13736
			//
13737
			// if (terminal != null && pt == null
13738
			// && this.getPerimeterFunction(terminal) == null) {
13739
			// edge.setAbsoluteTerminalPoint(new mxPoint(this
13740
			// .getRoutingCenterX(terminal), this
13741
			// .getRoutingCenterY(terminal)),
13742
			// source)
13743
			// }
13744
			// };
13745

    
13746
			// Changes the default edge style
13747
			graph.getStylesheet().getDefaultEdgeStyle()['edgeStyle'] = 'orthogonalEdgeStyle';
13748
			// delete graph.getStylesheet().getDefaultEdgeStyle()['endArrow'];
13749

    
13750
			// Implements the connect preview
13751
			graph.connectionHandler.createEdgeState = function (me) {
13752
				var edge = graph.createEdge(null, null, null, null, null);
13753

    
13754
				return new mxCellState(this.graph.view, edge, this.graph
13755
					.getCellStyle(edge));
13756
			};
13757

    
13758
			// Uncomment the following if you want the container
13759
			// to fit the size of the graph
13760
			// graph.setResizeContainer(true);
13761

    
13762
			// Enables rubberband selection
13763
			new mxRubberband(graph);
13764

    
13765
			// Disables basic selection and cell handling
13766
			graph.setEnabled(false);
13767

    
13768
			// Gets the default parent for inserting new cells. This
13769
			// is normally the first child of the root (ie. layer 0).
13770
			var parent = graph.getDefaultParent();
13771

    
13772
			// Enables HTML labels as wrapping is only available for those
13773
			graph.htmlLabels = true;
13774

    
13775
			// Disables in-place editing for edges
13776
			// graph.isCellEditable = function(cell) {
13777
			// return !this.model.isEdge(cell);
13778
			// };
13779

    
13780
			// Changes the default vertex style in-place
13781
			var style = graph.getStylesheet().getDefaultVertexStyle();
13782
			style[mxConstants.STYLE_PERIMETER] = mxPerimeter.RectanglePerimeter;
13783
			style[mxConstants.STYLE_GRADIENTCOLOR] = 'white';
13784
			style[mxConstants.STYLE_PERIMETER_SPACING] = 1; // 6;
13785
			style[mxConstants.STYLE_ROUNDED] = true;
13786
			style[mxConstants.STYLE_SHADOW] = true;
13787

    
13788
			style = graph.getStylesheet().getDefaultEdgeStyle();
13789
			style[mxConstants.STYLE_ROUNDED] = true;
13790
			style[mxConstants.STYLE_EDGE] = mxEdgeStyle.SegmentConnector;
13791

    
13792
			var style2 = new Object();
13793
			style2[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_RHOMBUS;
13794
			style2[mxConstants.STYLE_PERIMETER] = mxPerimeter.RhombusPerimeter;
13795
			style2[mxConstants.STYLE_GRADIENTCOLOR] = 'white';
13796
			style2[mxConstants.STYLE_PERIMETER_SPACING] = 1;
13797
			style2[mxConstants.STYLE_ROUNDED] = true;
13798
			style2[mxConstants.STYLE_SHADOW] = true;
13799
			style2[mxConstants.STYLE_STROKECOLOR] = '#B3BFD7';
13800
			style2[mxConstants.STYLE_FILLCOLOR] = '#C4DAFF';
13801
			style2[mxConstants.STYLE_ALIGN] = 'center';
13802
			style2[mxConstants.STYLE_VERTICALALIGN] = 'middle';
13803
			graph.getStylesheet().putCellStyle('RHOMBUS', style2);
13804

    
13805
			style2 = new Object();
13806
			style2[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_ELLIPSE;
13807
			style2[mxConstants.STYLE_PERIMETER] = mxPerimeter.EllipsePerimeter;
13808
			style2[mxConstants.STYLE_GRADIENTCOLOR] = 'white';
13809
			style2[mxConstants.STYLE_PERIMETER_SPACING] = 1;
13810
			style2[mxConstants.STYLE_ROUNDED] = true;
13811
			style2[mxConstants.STYLE_SHADOW] = true;
13812
			style2[mxConstants.STYLE_STROKECOLOR] = '#B3BFD7';
13813
			style2[mxConstants.STYLE_FILLCOLOR] = '#C4DAFF';
13814
			style2[mxConstants.STYLE_ALIGN] = 'center';
13815
			style2[mxConstants.STYLE_VERTICALALIGN] = 'middle';
13816
			graph.getStylesheet().putCellStyle('ELLIPSE', style2);
13817

    
13818
			style2 = new Object();
13819
			style2[mxConstants.STYLE_SHAPE] = 'label';
13820
			style2[mxConstants.STYLE_VERTICAL_ALIGN] = 'bottom';
13821
			style2[mxConstants.STYLE_INDICATOR_SHAPE] = 'ellipse';
13822
			style2[mxConstants.STYLE_INDICATOR_WIDTH] = 34;
13823
			style2[mxConstants.STYLE_INDICATOR_HEIGHT] = 34;
13824
			style2[mxConstants.STYLE_IMAGE_VERTICAL_ALIGN] = 'top'; // indicator v-alignment
13825
			style2[mxConstants.STYLE_IMAGE_ALIGN] = 'center';
13826
			graph.getStylesheet().putCellStyle('LABEL', style2);
13827

    
13828
			style2 = new Object();
13829
			style2[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_RECTANGLE;
13830
			style2[mxConstants.STYLE_PERIMETER] = mxPerimeter.RectanglePerimeter;
13831
			style2[mxConstants.STYLE_GRADIENTCOLOR] = 'white';
13832
			style2[mxConstants.STYLE_PERIMETER_SPACING] = 1;
13833
			style2[mxConstants.STYLE_ROUNDED] = false;
13834
			style2[mxConstants.STYLE_SHADOW] = true;
13835
			style2[mxConstants.STYLE_STROKECOLOR] = '#B3BFD7';
13836
			style2[mxConstants.STYLE_FILLCOLOR] = '#C4DAFF';
13837
			graph.getStylesheet().putCellStyle('RECTANGLE', style2);
13838
			// Adds cells to the model in a single step
13839
			graph.getModel().beginUpdate();
13840
			try {
13841
				// var v1 = graph.insertVertex(parent, null, '1', 20, 0, 150,
13842
				// 80);
13843
				// var v2 = graph.insertVertex(parent, null, '2', 20, 50, 150,
13844
				// 80);
13845
				// var v3 = graph
13846
				// .insertVertex(parent, null, '3', 20, 100, 150, 80);
13847
				// var v4 = graph
13848
				// .insertVertex(parent, null, '4', 120, 50, 150, 80);
13849
				// var v5 = graph.insertVertex(parent, null, '5', 120, 100, 150,
13850
				// 80);
13851
				//
13852
				// var e1 = graph.insertEdge(parent, null, '', v1, v2);
13853
				// var e2 = graph.insertEdge(parent, null, '', v2, v3);
13854
				// var e3 = graph.insertEdge(parent, null, '', v2, v4);
13855
				// var e4 = graph.insertEdge(parent, null, '', v4, v5);
13856
				// var e5 = graph.insertEdge(parent, null, '', v3, v5);
13857
			}
13858
			finally {
13859
				// Updates the display
13860
				graph.getModel().endUpdate();
13861
			}
13862

    
13863
		}
13864
	}
13865
});
13866

    
13867
Ext.define('MinovaUtil.MinovaES.MinovaMonthPicker', {
13868
	extend: 'Ext.form.field.Text',
13869
	alias: ['widget.minovamonthpicker', 'widget.minovamonthpicker'],
13870
	tableName: undefined,
13871
	param: undefined,
13872
	formtarget_: this.formtarget,
13873
	Sequence: this.Sequence,
13874
	anchor: '50%',
13875
	pagesize: undefined,
13876
	triggerCls: 'x-form-date-trigger',
13877
	getValue: function () {
13878
		var Sequence = this.Sequence;
13879
		var me = this;
13880
		var _e = Ext.ComponentQuery.query('[name=' + Sequence + 'monthselect]')[0];
13881
		var hasil = "";
13882
		if (_e != undefined) {
13883
			if (_e.value[0] >= 0) {
13884
				if (_e.value[0].toString() != '') {
13885
					var _m = (_e.value[0] + 1).toString();
13886
					if (_m.length == 1) {
13887
						_m = '0' + _m;
13888
					}
13889
					hasil = _e.value[1].toString() + _m;
13890
				}
13891
			}
13892
		}
13893
		if (hasil == "") {
13894
			me.value = null;
13895
			me.submitValue = null;
13896
		} else {
13897
			me.submitValue = hasil;
13898
		}
13899
		return hasil;
13900
	},
13901
	clearValue: function () {
13902
		var Sequence = this.Sequence;
13903
		var _e = Ext.ComponentQuery.query('[name=' + Sequence + 'monthselect]')[0];
13904
		_e.value[0] = '';
13905
		_e.value[1] = '';
13906
		return this.setValue('');
13907
	},
13908
	getRawValue: function () {
13909
		var Sequence = this.Sequence;
13910
		var _e = Ext.ComponentQuery.query('[name=' + Sequence + 'monthselect]')[0];
13911
		var hasil = null;
13912
		if (_e != undefined) {
13913
			var _m = (_e.value[0] + 1).toString();
13914
			if (_m.length == 1) {
13915
				_m = '0' + _m;
13916
			}
13917
			hasil = _e.value[1].toString() + _m;
13918
		}
13919
		return hasil;
13920
	},
13921
	initComponent: function () {
13922
		var target = this.formtarget;
13923
		this.callParent();
13924
	},
13925
	onTriggerClick: function () {
13926
		var Sequence = this.Sequence;
13927
		var count_lookup = Ext.ComponentQuery.query('[name=' + Sequence + 'monthLookup]').length;
13928
		if (count_lookup == 1) {
13929
			Ext.ComponentQuery.query('[name=' + Sequence + 'monthLookup]')[0].show();
13930
		} else {
13931
			var target_ = this.formtarget;
13932
			var fieldtarget = this.name;
13933
			Ext.create('Ext.window.Window', {
13934
				title: 'Select Period',
13935
				name: Sequence + 'monthLookup',
13936
				layout: 'fit',
13937
				bodyPadding: 0,
13938
				border: false,
13939
				items: [{
13940
						xtype: 'monthpicker',
13941
						name: Sequence + 'monthselect',
13942
						listeners: {
13943
							afterrender: function () {
13944
								var _e = Ext.ComponentQuery.query('[name=' + Sequence + 'monthselect]')[0];
13945

    
13946
								_e.setValue(new Date());
13947
							}
13948
						},
13949
						onOkClick: function () {
13950
							var _e = Ext.ComponentQuery.query('[name=' + Sequence + 'monthselect]')[0];
13951
							if (_e.value[0] == null || _e.value[1] == null) {
13952
								alert('Pilih Tanggal!');
13953
								return;
13954
							}
13955

    
13956
							var _m = (_e.value[0] + 1).toString();
13957
							if (_m.length == 1) {
13958
								_m = '0' + _m;
13959
							}
13960
							var _period = _m + ' - ' + _e.value[1].toString();
13961

    
13962
							var _f = Ext.ComponentQuery.query('[name=' + fieldtarget + ']')[0];
13963
							_f.setValue(_period);
13964

    
13965
							Ext.ComponentQuery.query('[name=' + Sequence + 'monthLookup]')[0].hide();
13966
						},
13967
						onCancelClick: function () {
13968
							Ext.ComponentQuery.query('[name=' + Sequence + 'monthLookup]')[0].hide();
13969
						}
13970
					}
13971
				]
13972
			}).show();
13973
		}
13974
	}
13975
});
13976

    
13977
Ext.define('MinovaUtil.MinovaES.Column.MinovaTimeColumn', {
13978
	extend: 'Ext.grid.column.Column',
13979
	alias: ['widget.minovatimecolumn'],
13980
	alternateClassName: 'Ext.grid.MinovaTimeColumn',
13981
	undefinedText: '&#160;',
13982
	defaultRenderer: function (value) {
13983
		if (value === "") {
13984
			return "";
13985
		}
13986
		return hasil;
13987
	}
13988
});
13989

    
13990
Ext.define('MinovaUtil.MinovaES.Column.MinovaCurrencyColumn', {
13991
	extend: 'Ext.grid.column.Column',
13992
	alias: ['widget.minovacurrancycolumn'],
13993
	undefinedText: '&#160;',
13994
	defaultRenderer: function (value) {
13995
		if (value === "" || value === undefined || value === null) {
13996
			return this.undefinedText;
13997
		}
13998

    
13999
		Ext.util.Format.thousandSeparator = ",";
14000
		Ext.util.Format.decimalSeparator = ".";
14001
		value = value.toString().replace(',', '.');
14002
		return Ext.util.Format.number(value, '0,000.00');
14003
	}
14004
});
14005

    
14006

    
14007
Ext.define('MinovaUtil.MinovaES.Column.MinovaCurrencyColumnRound', {
14008
	extend: 'Ext.grid.column.Column',
14009
	alias: ['widget.minovacurrancycolumnround'],
14010
	undefinedText: '&#160;',
14011
	defaultRenderer: function (value) {
14012
		if (value === "" || value === undefined || value === null) {
14013
			return this.undefinedText;
14014
		}
14015

    
14016
		Ext.util.Format.thousandSeparator = ",";
14017
		value = value.toString().replace(',', '.');
14018
		return Ext.util.Format.number(value, '0,000');
14019
	}
14020
});
14021

    
14022
Ext.define('MinovaUtil.MinovaES.Field.MinovaCurrencyField', {
14023
	extend: 'Ext.form.field.Text',
14024
	alias: ['widget.MinovaCurrencyField', 'widget.minovacurrencyfield'],
14025
	undefinedText: '&#160;',
14026
	defaultRenderer: function (value) {
14027
		if (value === "" || value === undefined || value === null) {
14028
			return this.undefinedText;
14029
		}
14030

    
14031
		Ext.util.Format.thousandSeparator = ",";
14032
		Ext.util.Format.decimalSeparator = ".";
14033
		value = value.toString().replace(',', '.');
14034
		return Ext.util.Format.number(value, '0000.00');
14035
	}
14036
});
14037

    
14038
Ext.define('MinovaUtil.MinovaES.MinovaGridMD', {
14039
	extend: 'Ext.grid.Panel',
14040
	requires: ['Ext.grid.RowNumberer'],
14041
	alias: 'widget.minovagridmd',
14042
	//alias: ['widget.minovagrid1', 'widget.minovagrid'],
14043
	//alias: ['widget.minovagrid1', 'widget.minovagrid'],
14044
	alternateClassName: 'Ext.grid.MinovaGrid',
14045
	//controller:'orm-manage2-controller',
14046
	tableName: undefined,
14047
	isLookup: undefined,
14048
	param: undefined,
14049
	pagesize: undefined,
14050
	storename: undefined,
14051
	layoutType: undefined,
14052
	enableLocking: true,
14053
	autoLoad: undefined,
14054
	multiSelect: undefined,
14055
	getTableName: function () {
14056
		return this.tableName;
14057
	},
14058

    
14059
	initComponent: function () {
14060
		var me = this;
14061
		var cols_ = [];
14062
		var fieldeditor = {};
14063
		var hasil = null;
14064
		var autoLoad = true;
14065
		var LangID = localStorage.LangId;
14066
		var fielGrid = 'rec.GridView == 1';
14067
		var locking = true;
14068
		var checkSelection = '';
14069
		var widthLock = 250;
14070
		if (me.multiSelect) {
14071
			locking = false;
14072
			checkSelection = 'checkboxmodel';
14073
			widthLock = 40;
14074
		}
14075
		//var _url = 'GetAllField';
14076
		if (me.autoLoad == false) {
14077
			autoLoad = false;
14078
		}
14079
		parameter = null;
14080
		if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
14081
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',LookupGrid='1'";
14082
			fielGrid = 'rec.LookupGrid == 1';
14083
			locking = false;
14084

    
14085
		} else {
14086
			parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'"
14087
				//autoLoad = false;
14088
				//_url = 'GetAllFieldGridLookUp';
14089
		};
14090

    
14091
		//Ext.Ajax.request({
14092
		//	async : false,
14093
		//	method : 'POST',
14094
		//	url : '/Devt/' + _url + '?tableName=' + me.tableName,
14095
		//	success : function (response) {
14096
		//		var results = Ext.decode(response.responseText);
14097
		//		hasil = results.data;
14098
		//	}
14099
		//});
14100
		//hamid03102016
14101

    
14102
		Ext.Ajax.request({
14103
			async: false,
14104
			method: 'POST',
14105
			url: '/UserControl/GetStore',
14106
			params: {
14107
				tableName: 'PDSBS0007',
14108
				param: parameter
14109
			},
14110
			success: function (response) {
14111
				var results = Ext.decode(response.responseText);
14112
				hasil = results.data;
14113
			}
14114
		});
14115
		//end
14116

    
14117
		if (hasil.length > 0) {
14118

    
14119
			Ext.each(hasil, function (rec) {
14120
				var null_ = null;
14121
				if (rec.IsPrimaryKey == true) {
14122
					null_ = false;
14123
				}
14124
				if (rec.IsRequired == true) {
14125
					null_ = false;
14126
				} else {
14127
					null_ = true;
14128
				}
14129

    
14130
				if (me.isLookup == 1 || me.isLookup == 'Y' || me.isLookup == true) {
14131
					if (rec.LookupGrid == 1) {
14132
						switch (rec.FormatRef) {
14133
						case "file":
14134
							cols_.push({
14135
								xtype: 'minovapicturecolumn',
14136
								text: rec.HeaderTitle,
14137
								dataIndex: rec.FieldName,
14138
								width: 100,
14139
								//filter: {
14140
								//    type: 'image',
14141
								//    itemDefaults: {
14142
								//        emptyText: 'Search for...'
14143
								//    }
14144
								//}
14145
							});
14146
							break
14147
						case "date":
14148
							cols_.push({
14149
								xtype: 'minovadatecolumn',
14150
								text: rec.HeaderTitle,
14151
								dataIndex: rec.FieldName,
14152
								width: 100,
14153
								filter: {
14154
									type: 'date',
14155
									itemDefaults: {
14156
										emptyText: 'Search for...'
14157
									}
14158
								}
14159
							});
14160
							break
14161
						case "amount":
14162
							cols_.push({
14163
								xtype: 'minovacurrancycolumn',
14164
								text: rec.HeaderTitle,
14165
								align: 'right',
14166
								dataIndex: rec.FieldName,
14167
								width: 100,
14168
								filter: {
14169
									type: 'number',
14170
									itemDefaults: {
14171
										emptyText: 'Search for...'
14172
									}
14173
								}
14174
							});
14175
							break
14176
						case "amountencrypt":
14177
							cols_.push({
14178
								xtype: 'minovaamountcolumn',
14179
								align: 'right',
14180
								text: rec.HeaderTitle,
14181
								dataIndex: rec.FieldName,
14182
								width: 100,
14183
								filter: {
14184
									type: 'string',
14185
									itemDefaults: {
14186
										emptyText: 'Search for...'
14187
									}
14188
								}
14189
							});
14190
							break
14191
						case "datetime":
14192
							cols_.push({
14193
								xtype: 'minovadatetimecolumn',
14194
								text: rec.HeaderTitle,
14195
								dataIndex: rec.FieldName,
14196
								width: 140,
14197
								filter: {
14198
									type: 'string',
14199
									itemDefaults: {
14200
										emptyText: 'Search for...'
14201
									}
14202
								}
14203
							});
14204
							break
14205
						default:
14206
							if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
14207
								cols_.push({
14208
									text: rec.HeaderTitle,
14209
									dataIndex: rec.FieldName,
14210
									width: 100,
14211
									filter: {
14212
										type: 'string',
14213
										itemDefaults: {
14214
											emptyText: 'Search for...'
14215
										}
14216
									}
14217
								});
14218
							} else if (rec.SearchType == '2') {
14219
								cols_.push({
14220
									xtype: 'minovalookupcolumn',
14221
									text: rec.HeaderTitle,
14222
									tableName: rec.TableRef,
14223
									dataIndex: rec.FieldName,
14224
									filter: {
14225
										itemDefaults: {
14226
											emptyText: 'Search for...'
14227
										}
14228
									}
14229
								});
14230
							} else if (rec.TableRef != "") {
14231
								if (rec.TableRef != null) {
14232
									var valueField = null;
14233
									var displayValue = null;
14234
									Ext.Ajax.request({
14235
										async: false,
14236
										method: 'POST',
14237
										url: '/UserControl/GetStore',
14238
										params: {
14239
											tableName: 'SDATATABLEFIELD',
14240
											param: 'TableName[equal]' + rec.TableRef
14241
										},
14242
										success: function (response) {
14243
											var results = Ext.decode(response.responseText);
14244
											data_ = results.data;
14245
											if (data_ != undefined) {
14246
												valueField_ = $.grep(data_, function (r) {
14247
														return r.ValueField == '1'
14248
													});
14249
												valueField = valueField_[0].FieldName
14250
													displayValue_ = $.grep(data_, function (r) {
14251
														return r.DisplayValue == '1'
14252
													});
14253
												displayValue = displayValue_[0].FieldName
14254
											}
14255
										}
14256
									});
14257
									var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
14258
									var count_ = 0;
14259
									if (store_) {
14260
										count_ = store_.count();
14261
									}
14262
									if (count_ == 0) {
14263
										Ext.create('Ext.data.Store', {
14264
											storeId: 'store_' + rec.FieldName,
14265
											//autoLoad: true,
14266
											proxy: {
14267
												method: 'POST',
14268
												type: 'ajax',
14269
												url: '/UserControl/GetStore',
14270
												extraParams: {
14271
													tableName: rec.TableRef,
14272
													param: rec.ParamCombo
14273
												},
14274
												reader: {
14275
													type: 'json',
14276
													root: 'data',
14277
													totalProperty: 'data[0].TotalCount'
14278
												}
14279
											}
14280
										})
14281
									}
14282
									cols_.push({
14283
										xtype: 'minovacombocolumn',
14284
										text: rec.HeaderTitle,
14285
										dataIndex: rec.FieldName,
14286
										valueField: valueField,
14287
										displayField: displayValue,
14288
										store: 'store_' + rec.FieldName,
14289
										filter: {
14290
											type: 'list',
14291
											itemDefaults: {
14292
												emptyText: 'Search for...'
14293
											}
14294
										}
14295
									});
14296
								}
14297

    
14298
							} else {
14299
								cols_.push({
14300
									text: rec.HeaderTitle,
14301
									dataIndex: rec.FieldName,
14302
									filter: {
14303
										itemDefaults: {
14304
											emptyText: 'Search for...'
14305
										}
14306
									}
14307
								});
14308
							}
14309
							break
14310
						}
14311
					} else {
14312
						cols_.push({
14313
							text: rec.HeaderTitle,
14314
							dataIndex: rec.FieldName,
14315
							hidden: true,
14316
							filter: {
14317
								itemDefaults: {
14318
									emptyText: 'Search for...'
14319
								}
14320
							}
14321
						});
14322
					}
14323

    
14324
				} else {
14325
					if (rec.GridView == 1) {
14326
						switch (rec.FormatRef) {
14327
						case "file":
14328
							cols_.push({
14329
								xtype: 'minovapicturecolumn',
14330
								text: rec.HeaderTitle,
14331
								dataIndex: rec.FieldName,
14332
								width: 100,
14333
								//filter: {
14334
								//    type: '',
14335
								//    itemDefaults: {
14336
								//        emptyText: 'Search for...'
14337
								//    }
14338
								//}
14339
							});
14340
							break
14341
						case "date":
14342
							cols_.push({
14343
								xtype: 'minovadatecolumn',
14344
								text: rec.HeaderTitle,
14345
								dataIndex: rec.FieldName,
14346
								width: 100,
14347
								filter: {
14348
									type: 'date',
14349
									itemDefaults: {
14350
										emptyText: 'Search for...'
14351
									}
14352
								}
14353
							});
14354
							break
14355
						case "amountencrypt":
14356
							cols_.push({
14357
								xtype: 'minovaamountcolumn',
14358
								align: 'right',
14359
								text: rec.HeaderTitle,
14360
								dataIndex: rec.FieldName,
14361
								width: 100,
14362
								filter: {
14363
									type: 'string',
14364
									itemDefaults: {
14365
										emptyText: 'Search for...'
14366
									}
14367
								}
14368
							});
14369
							break
14370
						case "amount":
14371
							cols_.push({
14372
								text: rec.HeaderTitle,
14373
								dataIndex: rec.FieldName,
14374
								width: 100,
14375
								filter: {
14376
									type: 'number',
14377
									itemDefaults: {
14378
										emptyText: 'Search for...'
14379
									}
14380
								}
14381
							});
14382
							break
14383
						case "datetime":
14384
							cols_.push({
14385
								xtype: 'minovadatetimecolumn',
14386
								text: rec.HeaderTitle,
14387
								dataIndex: rec.FieldName,
14388
								width: 140,
14389
								filter: {
14390
									type: 'string',
14391
									itemDefaults: {
14392
										emptyText: 'Search for...'
14393
									}
14394
								}
14395
							});
14396
							break
14397
						default:
14398
							if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
14399
								cols_.push({
14400
									text: rec.HeaderTitle,
14401
									dataIndex: rec.FieldName,
14402
									width: 100,
14403
									filter: {
14404
										type: 'string',
14405
										itemDefaults: {
14406
											emptyText: 'Search for...'
14407
										}
14408
									}
14409
								});
14410
							} else if (rec.SearchType == '2') {
14411
								cols_.push({
14412
									xtype: 'minovalookupcolumn',
14413
									text: rec.HeaderTitle,
14414
									tableName: rec.TableRef,
14415
									dataIndex: rec.FieldName,
14416
									filter: {
14417
										itemDefaults: {
14418
											emptyText: 'Search for...'
14419
										}
14420
									}
14421
								});
14422
							} else if (rec.TableRef != "" && rec.SearchType != '2') {
14423
								if (rec.TableRef != null) {
14424
									var valueField = null;
14425
									var displayValue = null;
14426
									Ext.Ajax.request({
14427
										async: false,
14428
										method: 'POST',
14429
										url: '/UserControl/GetStore',
14430
										params: {
14431
											tableName: 'SDATATABLEFIELD',
14432
											param: 'TableName[equal]' + rec.TableRef
14433
										},
14434
										success: function (response) {
14435
											var results = Ext.decode(response.responseText);
14436
											data_ = results.data;
14437
											//if (data_ != undefined) {
14438
											if (data_.length > 0) {
14439
												valueField_ = $.grep(data_, function (r) {
14440
														return r.ValueField == '1'
14441
													});
14442
												valueField = valueField_[0].FieldName
14443
													displayValue_ = $.grep(data_, function (r) {
14444
														return r.DisplayValue == '1'
14445
													});
14446
												displayValue = displayValue_[0].FieldName
14447
											} else {
14448
												MinovaMessage('Not Null', 'BSNULLCOMBO', rec.TableRef, 'E');
14449
											}
14450
										}
14451
									});
14452
									var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
14453
									var count_ = 0;
14454
									if (store_) {
14455
										count_ = store_.count();
14456
									}
14457
									if (count_ == 0) {
14458
										var paramFilter = rec.ParamCombo;
14459
										if (rec.TableRef.toLowerCase() == 'phrom0001' && rec.ParamCombo.length == 1) {
14460
											paramFilter = 'ObjectClass[=]' + paramFilter;
14461
										}
14462
										Ext.create('Ext.data.Store', {
14463
											storeId: 'store_' + rec.FieldName,
14464
											autoLoad: false,
14465
											proxy: {
14466
												method: 'POST',
14467
												type: 'ajax',
14468
												url: '/UserControl/GetStore',
14469
												extraParams: {
14470
													tableName: rec.TableRef,
14471
													param: paramFilter
14472
												},
14473
												reader: {
14474
													type: 'json',
14475
													root: 'data',
14476
													totalProperty: 'data[0].TotalCount'
14477
												}
14478
											}
14479
										})
14480
									}
14481
									cols_.push({
14482
										xtype: 'minovacombocolumn',
14483
										text: rec.HeaderTitle,
14484
										dataIndex: rec.FieldName,
14485
										valueField: valueField,
14486
										displayField: displayValue,
14487
										store: 'store_' + rec.FieldName,
14488
										filter: {
14489
											type: 'list',
14490
											itemDefaults: {
14491
												emptyText: 'Search for...'
14492
											}
14493
										}
14494
									});
14495
								}
14496

    
14497
							} else if (rec.FixedValue != "") {
14498
								cols_.push({
14499
									xtype: 'minovacombocolumnfixvalue',
14500
									text: rec.HeaderTitle,
14501
									dataIndex: rec.FieldName,
14502
									fixedValue: rec.FixedValue,
14503
									filter: {
14504
										type: 'list',
14505
										itemDefaults: {
14506
											emptyText: 'Search for...'
14507
										}
14508
									}
14509
								});
14510
							} else {
14511
								cols_.push({
14512
									text: rec.HeaderTitle,
14513
									dataIndex: rec.FieldName,
14514
									filter: {
14515
										itemDefaults: {
14516
											emptyText: 'Search for...'
14517
										}
14518
									}
14519
								});
14520
							}
14521
							break
14522
						}
14523
					} else {
14524
						cols_.push({
14525
							text: rec.HeaderTitle,
14526
							dataIndex: rec.FieldName,
14527
							hidden: true,
14528
							filter: {
14529
								itemDefaults: {
14530
									emptyText: 'Search for...'
14531
								}
14532
							}
14533
						});
14534
					}
14535

    
14536
				}
14537
			});
14538
		};
14539
		var param_ = me.param;
14540
		if (param_ == undefined) {
14541
			param_ = ''
14542
		}
14543
		var jsStoreGrid = new Ext.data.Store({
14544
				storeId: me.storename,
14545
				autoLoad: autoLoad,
14546
				pageSize: me.pagesize,
14547
				proxy: {
14548
					method: 'POST',
14549
					type: 'ajax',
14550
					url: '/UserControl/GetStorePaging',
14551
					extraParams: {
14552
						tableName: me.tableName,
14553
						param: param_,
14554
						//menuId: MinovaUtil.GetMenuID()
14555
					},
14556
					reader: {
14557
						type: 'json',
14558
						root: 'data',
14559
						totalProperty: 'totalRecords'
14560
					}
14561
				},
14562
			});
14563
		Ext.applyIf(me, {
14564
			autoScroll: true,
14565
			enableLocking: locking,
14566
			lockedGridConfig: {
14567
				header: false,
14568
				collapsible: true,
14569
				width: widthLock,
14570
				forceFit: locking,
14571
				listeners: {
14572
					render: function (grid) {
14573
						var pagingToolbar = grid.child('pagingtoolbar');
14574
						if (pagingToolbar) {
14575
							grid.remove(pagingToolbar, true);
14576
						}
14577
					}
14578
				}
14579
			},
14580
			listeners: {
14581
				viewready: function () {
14582
					if (autoLoad == true) {
14583
						this.getStore().loadPage(1);
14584
					}
14585

    
14586
				},
14587
				beforeedit: function () {
14588
					return false;
14589
				}
14590
			},
14591
			lockedViewConfig: {
14592
				scroll: 'horizontal'
14593
			},
14594
			viewConfig: {
14595
				emptyText: 'No Data Display',
14596
				deferEmptyText: false,
14597
				//Add Nana For Autosize Column Mode Grid MD
14598
				listeners: {
14599
					refresh: function (dataview) {
14600
						Ext.each(dataview.panel.columns, function (column) {
14601
							if (column.autoSizeColumn == false)
14602
								column.autoSizeColumn = true;
14603
							column.autoSize();
14604
							console.log('GridMD');
14605
						})
14606
					},
14607
					//afterrender: function (dataview) {
14608
					//	console.log(dataview);
14609
					//	dataview.getStore().reload();
14610
					//}
14611
					afterrender: function (dataview) {
14612
						Ext.defer(function () {
14613
							dataview.store.reload();
14614
						}, 2500, this);
14615
					}
14616
				}
14617
			},
14618
			//for chekbox
14619
			selModel: {
14620
				//type: 'cellmodel'
14621
			},
14622
			selType: checkSelection,
14623
			columns: cols_,
14624
			store: jsStoreGrid,
14625
			plugins: [{
14626
					ptype: 'gridfilters'
14627
				}
14628
			],
14629

    
14630
		});
14631
		me.callParent(arguments);
14632
	}
14633

    
14634
});
14635

    
14636
Ext.define('MinovaUtil.MinovaES.MinovaPMSEditAbleGrid', {
14637
	extend: 'Ext.form.Panel',
14638
	alias: ['widget.MinovaPMSEditAbleGrid', 'widget.Minovapmseditablegrid', 'widget.minovapmseditablegrid'],
14639
	requires: [
14640
		'Ext.grid.plugin.CellEditing',
14641
		'Ext.grid.Panel',
14642
	],
14643
	anchor: '100%',
14644
	tableName: undefined,
14645
	apprasalType: undefined,
14646
	empID: undefined,
14647
	hideButton: undefined,
14648
	multiSelect: undefined,
14649
	initComponent: function () {
14650
		var me = this;
14651
		var isLookup = me.isLookup;
14652
		var hide_ = false;
14653
		var widthLock = 250;
14654
		var checkSelection = '';
14655
		if (me.hideButton == true) {
14656
			hide_ = true;
14657
		}
14658
		if (me.multiSelect) {
14659
			locking = false;
14660
			checkSelection = 'checkboxmodel';
14661
			widthLock = 40;
14662
		}
14663
		var tableName = me.tableName;
14664
		var cols = [];
14665
		var fieldStore = [];
14666
		var _url = 'GetAllField';
14667
		var hasil = null;
14668
		var height = me.height;
14669
		var storeID = 'store' + me.tableName;
14670
		var gridName = 'grid' + me.name;
14671
		if (me.storeName) {
14672
			storeID = me.storeName;
14673
		}
14674
		var empID = me.empID;
14675
		var apprasalType = me.apprasalType;
14676
		var LangID = MinovaUtil.GetLangID();
14677
		var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'" + "," + empID + "," + apprasalType
14678
			Ext.Ajax.request({
14679
				async: false,
14680
				method: 'POST',
14681
				url: '/Performance/getFieldPMS',
14682
				params: {
14683
					tableName: 'PDSPMS001',
14684
					_param: parameter
14685
				},
14686
				success: function (response) {
14687
					var results = Ext.decode(response.responseText);
14688
					hasil = Ext.decode(results.data);
14689
				}
14690
			});
14691
		var addData = 'var data={';
14692
		if (hasil.length > 0) {
14693
			Ext.each(hasil, function (rec) {
14694
				fieldStore.push(rec.FieldName)
14695
				if (rec.FieldName != 'Sequence') {
14696
					addData = addData + rec.FieldName + ":" + "'',";
14697
				}
14698
				var null_ = null;
14699
				var ReadOnly_ = false;
14700
				if (rec.IsPrimaryKey == true) {
14701
					null_ = false;
14702
				}
14703
				if (rec.IsRequired == true) {
14704
					null_ = false;
14705
				} else {
14706
					null_ = true;
14707
				}
14708
				if (rec.ReadOnly == '1') {
14709
					ReadOnly_ = true;
14710
				}
14711
				var Hidden_ = false;
14712
				if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
14713
					Hidden_ = true;
14714
					null_ = true;
14715
				}
14716
				if (rec.GridView == 1) {
14717
					switch (rec.FormatRef) {
14718
					case "date":
14719
						cols.push({
14720
							xtype: 'minovadatecolumn',
14721
							hidden: Hidden_,
14722
							text: rec.HeaderTitle,
14723
							dataIndex: rec.FieldName,
14724
							filter: {
14725
								itemDefaults: {
14726
									emptyText: 'Search for...',
14727
								}
14728
							},
14729
							editor: {
14730
								allowBlank: null_,
14731
								xtype: 'datefield',
14732
								hideMode: 'visibility',
14733
								readOnly: ReadOnly_,
14734
								id: tableName + rec.FieldName,
14735
								fieldGrid: rec.FieldName,
14736
								nameTable: rec.TableName,
14737
							}
14738
						});
14739
						break
14740
					case "amount":
14741
						cols.push({
14742
							xtype: 'minovacurrancycolumn',
14743
							//renderer: Ext.util.Format.numberRenderer("0,0"),
14744
							text: rec.HeaderTitle,
14745
							align: 'right',
14746
							dataIndex: rec.FieldName,
14747
							hidden: Hidden_,
14748
							filter: {
14749
								itemDefaults: {
14750
									emptyText: 'Search for...'
14751
								}
14752
							},
14753
							editor: {
14754
								allowBlank: null_,
14755
								xtype: 'minovacurrencyfield',
14756
								//renderer: Ext.util.Format.numberRenderer("0,0"),
14757
								//vtype: 'validateDecimal',
14758
								readOnly: ReadOnly_,
14759
								id: tableName + rec.FieldName,
14760
								nameTable: rec.TableName,
14761
								fieldGrid: rec.FieldName,
14762
								fieldStyle: 'text-align:right;',
14763
								value: '0',
14764

    
14765
							}
14766
						});
14767
						break
14768
					case "time":
14769
						var DefaultValue = rec.DefaultValue;
14770
						if (DefaultValue == '') {
14771
							defaultValue = '00:00';
14772
						}
14773
						cols.push({
14774
							//xtype: 'minovatimecolumn',
14775
							xtype: 'timefield',
14776
							format: 'H:i',
14777
							submitFormat: 'Hi',
14778
							text: rec.HeaderTitle,
14779
							dataIndex: rec.FieldName,
14780
							hidden: Hidden_,
14781
							//renderer: Ext.util.Format.dateRenderer('G:i'),
14782
							filter: {
14783
								itemDefaults: {
14784
									emptyText: 'Search for...'
14785
								}
14786
							},
14787
							editor: {
14788
								allowBlank: null_,
14789
								xtype: 'timefield',
14790
								readOnly: ReadOnly_,
14791
								id: tableName + rec.FieldName,
14792
								format: 'H:i',
14793
								submitFormat: 'Hi',
14794
								increment: 5,
14795
								value: DefaultValue,
14796
								anchor: '100%',
14797
								listeners: {}
14798
								//renderer: Ext.util.Format.dateRenderer('G:i'),
14799
							}
14800
						});
14801
						break
14802
					default:
14803
						if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
14804
							cols.push({
14805
								text: rec.HeaderTitle,
14806
								dataIndex: rec.FieldName,
14807
								width: 100,
14808
								filter: {
14809
									type: 'string',
14810
									itemDefaults: {
14811
										emptyText: 'Search for...'
14812
									}
14813
								}
14814
							});
14815
						} else if (rec.SearchType == '0') {
14816
							var valueField = null;
14817
							var displayValue = null;
14818
							var TableRef = undefined;
14819
							if (rec.TableRef != '') {
14820
								TableRef = rec.TableRef;
14821

    
14822
								Ext.Ajax.request({
14823
									async: false,
14824
									method: 'POST',
14825
									url: '/UserControl/GetStore',
14826
									params: {
14827
										tableName: 'SDATATABLEFIELD',
14828
										param: 'TableName[equal]' + rec.TableRef
14829
									},
14830
									success: function (response) {
14831
										var results = Ext.decode(response.responseText);
14832
										data_ = results.data;
14833
										if (data_ != undefined) {
14834
											valueField_ = $.grep(data_, function (r) {
14835
													return r.ValueField == '1'
14836
												});
14837
											valueField = valueField_[0].FieldName
14838
												displayValue_ = $.grep(data_, function (r) {
14839
													return r.DisplayValue == '1'
14840
												});
14841
											displayValue = displayValue_[0].FieldName
14842
										}
14843
									}
14844
								});
14845

    
14846
								//create Store
14847
								Ext.create('Ext.data.Store', {
14848
									storeId: 'store_' + me.tableName + rec.FieldName,
14849
									autoLoad: true,
14850
									proxy: {
14851
										method: 'POST',
14852
										type: 'ajax',
14853
										url: '/UserControl/GetStore',
14854
										extraParams: {
14855
											tableName: TableRef,
14856
											param: rec.ParamCombo
14857
										},
14858
										reader: {
14859
											type: 'json',
14860
											root: 'data',
14861
											totalProperty: 'data[0].TotalCount'
14862
										}
14863
									}
14864
								});
14865
							} else if (rec.FixedValue != '') {
14866
								var storeData = [];
14867
								var str = rec.FixedValue;
14868
								var hasil = str.split('||');
14869
								hasil.forEach(function (h) {
14870
									store_ = h.split('=')
14871
										storeData.push({
14872
											code: store_[0],
14873
											desc: store_[1],
14874

    
14875
										});
14876
								});
14877

    
14878
								valueField = 'code';
14879
								displayValue = 'desc';
14880

    
14881
								Ext.create('Ext.data.Store', {
14882
									storeId: 'store_' + me.tableName + rec.FieldName,
14883
									autoLoad: true,
14884
									data: storeData
14885
								})
14886
							}
14887

    
14888
							cols.push({
14889
								xtype: 'minovacombocolumn',
14890
								hidden: Hidden_,
14891
								text: rec.HeaderTitle,
14892
								dataIndex: rec.FieldName,
14893
								valueField: valueField,
14894
								displayField: displayValue,
14895
								store: 'store_' + me.tableName + rec.FieldName,
14896
								editor: {
14897
									allowBlank: null_,
14898
									xtype: 'combobox',
14899
									readOnly: ReadOnly_,
14900
									id: tableName + rec.FieldName,
14901
									nameTable: rec.TableName,
14902
									fieldGrid: rec.FieldName,
14903
									valueField: valueField,
14904
									displayField: displayValue,
14905

    
14906
									store: 'store_' + me.tableName + rec.FieldName,
14907
								},
14908
								filter: {
14909
									type: 'list',
14910
									itemDefaults: {
14911
										emptyText: 'Search for...'
14912
									}
14913
								}
14914
							});
14915

    
14916
						} else if (rec.SearchType == '2') {
14917
							var triger = (rec.TriggerCombo).split('$');
14918
							var targetField_ = triger[0];
14919
							var fieldValue_ = triger[1];
14920
							cols.push({
14921
								text: rec.HeaderTitle,
14922
								hidden: Hidden_,
14923
								dataIndex: rec.FieldName,
14924
								filter: {
14925
									itemDefaults: {
14926
										emptyText: 'Search for...'
14927
									}
14928
								},
14929
								editor: {
14930
									allowBlank: null_,
14931
									xtype: 'minovalookupgrid',
14932
									readOnly: ReadOnly_,
14933
									isGrid: true,
14934
									fieldTarget: targetField_,
14935
									fieldValue: fieldValue_,
14936
									isGrid: true,
14937
									id: tableName + rec.FieldName,
14938
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
14939
									triggerCls: 'x-form-search-trigger',
14940
									vtype: 'alphanum', // disable space
14941
									nameTable: rec.TableName,
14942
									fieldGrid: rec.FieldName,
14943
									LookupFunction: rec.LookupFunction,
14944
									listeners: {
14945
										change: function (val) {
14946
											var custumFunc = rec.SelectFunction;
14947
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
14948
												Ext.Ajax.request({
14949
													async: false,
14950
													method: 'POST',
14951
													url: '/UserControl/GetStore',
14952
													params: {
14953
														tableName: 'PCMFUNC',
14954
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
14955
													},
14956
													success: function (response) {
14957
														var results = Ext.decode(response.responseText);
14958
														data_ = results.data[0];
14959
														if (data_ != undefined) {
14960
															custumFunc = data_.FunctionCode;
14961
														}
14962
													}
14963
												});
14964
											}
14965
											if (custumFunc) {
14966
												eval(custumFunc)
14967
											}
14968
										}
14969
									}
14970
								}
14971
							});
14972
						} else if (rec.SearchType == '3') {
14973
							cols.push({
14974
								text: rec.HeaderTitle,
14975
								hidden: Hidden_,
14976
								dataIndex: rec.FieldName,
14977
								filter: {
14978
									itemDefaults: {
14979
										emptyText: 'Search for...'
14980
									}
14981
								},
14982
								editor: {
14983
									allowBlank: null_,
14984
									// xtype: 'minovalookuptreePopup',
14985
									xtype: 'MinovaLookupTree',
14986
									readOnly: ReadOnly_,
14987
									id: tableName + rec.FieldName,
14988
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
14989
									triggerCls: 'x-form-search-trigger',
14990
									vtype: 'alphanum', // disable space
14991
									treeSructure: rec.SearchFunction, //'O-O-P',
14992
									objClassValue: rec.ParamCombo, //'O',
14993
									nameTable: rec.TableName,
14994
									fieldGrid: rec.FieldName,
14995
									listeners: {
14996
										change: function (val) {
14997
											var custumFunc = rec.SelectFunction;
14998
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
14999
												Ext.Ajax.request({
15000
													async: false,
15001
													method: 'POST',
15002
													url: '/UserControl/GetStore',
15003
													params: {
15004
														tableName: 'PCMFUNC',
15005
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
15006
													},
15007
													success: function (response) {
15008
														var results = Ext.decode(response.responseText);
15009
														data_ = results.data[0];
15010
														if (data_ != undefined) {
15011
															custumFunc = data_.FunctionCode;
15012
														}
15013
													}
15014
												});
15015
											}
15016
											if (custumFunc) {
15017
												eval(custumFunc)
15018
											}
15019
										}
15020
									}
15021
								}
15022
							});
15023
						} 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) {
15024
							var triger = (rec.TriggerCombo).split('&');
15025
							var targetField_ = triger[0];
15026
							var fieldValue_ = triger[0];
15027
							cols.push({
15028
								text: rec.HeaderTitle,
15029
								hidden: Hidden_,
15030
								dataIndex: rec.FieldName,
15031
								filter: {
15032
									itemDefaults: {
15033
										emptyText: 'Search for...'
15034
									}
15035
								},
15036
								editor: {
15037
									allowBlank: null_,
15038
									xtype: 'lookupemployee',
15039
									readOnly: ReadOnly_,
15040
									isGrid: true,
15041
									fieldTarget: targetField_,
15042
									fieldValue: fieldValue_,
15043
									isGrid: true,
15044
									id: tableName + rec.FieldName,
15045
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
15046
									triggerCls: 'x-form-search-trigger',
15047
									vtype: 'alphanum', // disable space
15048
									nameTable: rec.TableName,
15049
									fieldGrid: rec.FieldName,
15050
									listeners: {
15051
										change: function (val) {
15052
											var custumFunc = rec.SelectFunction;
15053
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
15054
												Ext.Ajax.request({
15055
													async: false,
15056
													method: 'POST',
15057
													url: '/UserControl/GetStore',
15058
													params: {
15059
														tableName: 'PCMFUNC',
15060
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
15061
													},
15062
													success: function (response) {
15063
														var results = Ext.decode(response.responseText);
15064
														data_ = results.data[0];
15065
														if (data_ != undefined) {
15066
															custumFunc = data_.FunctionCode;
15067
														}
15068
													}
15069
												});
15070
											}
15071
											if (custumFunc) {
15072
												eval(custumFunc)
15073
											}
15074
										}
15075
									}
15076
								}
15077
							});
15078
						} else if (rec.SearchType == '4' && isLookup != true) {
15079
							cols.push({
15080

    
15081
								text: rec.HeaderTitle,
15082
								hidden: Hidden_,
15083
								dataIndex: rec.FieldName,
15084
								filter: {
15085
									itemDefaults: {
15086
										emptyText: 'Search for...'
15087
									}
15088
								},
15089
								editor: {
15090
									allowBlank: null_,
15091
									xtype: 'lookupemployee',
15092
									readOnly: ReadOnly_,
15093
									isGrid: true,
15094
									fieldTarget: targetField_,
15095
									fieldValue: fieldValue_,
15096
									isGrid: true,
15097
									id: tableName + rec.FieldName,
15098
									tableName: rec.TableRef, //name tabel yang jadi ref-nya
15099
									triggerCls: 'x-form-search-trigger',
15100
									vtype: 'alphanum', // disable space
15101
									nameTable: rec.TableName,
15102
									fieldGrid: rec.FieldName,
15103
									listeners: {
15104
										change: function (val) {
15105
											var custumFunc = rec.SelectFunction;
15106
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
15107
												Ext.Ajax.request({
15108
													async: false,
15109
													method: 'POST',
15110
													url: '/UserControl/GetStore',
15111
													params: {
15112
														tableName: 'PCMFUNC',
15113
														param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
15114
													},
15115
													success: function (response) {
15116
														var results = Ext.decode(response.responseText);
15117
														data_ = results.data[0];
15118
														if (data_ != undefined) {
15119
															custumFunc = data_.FunctionCode;
15120
														}
15121
													}
15122
												});
15123
											}
15124
											if (custumFunc) {
15125
												eval(custumFunc)
15126
											}
15127
										}
15128
									}
15129
								}
15130
							});
15131
						} else {
15132
							cols.push({
15133
								text: rec.HeaderTitle,
15134
								hidden: Hidden_,
15135
								dataIndex: rec.FieldName,
15136
								filter: {
15137
									itemDefaults: {
15138
										emptyText: 'Search for...'
15139
									}
15140
								},
15141
								editor: {
15142
									allowBlank: null_,
15143
									xtype: 'textfield',
15144
									readOnly: ReadOnly_,
15145
									id: tableName + rec.FieldName,
15146
									nameTable: rec.TableName,
15147
									fieldGrid: rec.FieldName,
15148
									listeners: {
15149
										change: function (val) {
15150
											var custumFunc = null;
15151
											Ext.Ajax.request({
15152
												async: false,
15153
												method: 'POST',
15154
												url: '/UserControl/GetStore',
15155
												params: {
15156
													tableName: 'SDATATABLEFIELD',
15157
													param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
15158
												},
15159
												success: function (response) {
15160
													var results = Ext.decode(response.responseText);
15161
													data_ = results.data[0];
15162
													if (data_ != undefined) {
15163
														custumFunc = data_.SelectFunction;
15164
														//console.log(data_)
15165
													}
15166
												}
15167
											});
15168
											if (custumFunc) {
15169
												eval(custumFunc)
15170
											}
15171
										}
15172
									}
15173
								}
15174
							});
15175
						}
15176
						break
15177
					}
15178
				} else {
15179
					cols.push({
15180
						text: rec.HeaderTitle,
15181
						hidden: Hidden_,
15182
						dataIndex: rec.FieldName,
15183
						hidden: true,
15184
						editor: {
15185
							allowBlank: true,
15186
							xtype: 'textfield',
15187
							readOnly: ReadOnly_,
15188
							id: tableName + rec.FieldName,
15189
							nameTable: rec.TableName,
15190
							fieldGrid: rec.FieldName,
15191
						},
15192
						filter: {
15193
							itemDefaults: {
15194
								emptyText: 'Search for...'
15195
							}
15196
						}
15197
					});
15198
				}
15199
			});
15200
		};
15201
		addData = addData + "}";
15202
		Ext.applyIf(me, {
15203

    
15204
			items: [{
15205
					xtype: 'grid',
15206
					id: gridName,
15207
					name: gridName,
15208
					height: height,
15209
					autoHeight: true,
15210
					//store: 'gridStore',
15211
					autoScroll: true,
15212
					store: Ext.create('Ext.data.Store', {
15213
						storeId: storeID,
15214
						fields: fieldStore,
15215
						proxy: {
15216
							method: 'POST',
15217
							type: 'ajax',
15218
							url: '',
15219
							reader: {
15220
								type: 'json',
15221
								root: 'data'
15222
							}
15223
						}
15224
					}),
15225
					dockedItems: [{
15226
							xtype: 'toolbar',
15227
							items: [{
15228
									text: 'Add',
15229
									hidden: hide_,
15230
									name: tableName + 'Add',
15231
									iconCls: 'fa-plus-circle',
15232
									style: 'font-family: FontAwesome',
15233
									handler: function () {
15234
										var store = Ext.StoreMgr.lookup(storeID)
15235
											idx = store.getCount();
15236
										var action = getParam('action');
15237
										var data = '';
15238
										var Sequence = 0;
15239
										if (idx == 0) {
15240
											Sequence = 1;
15241
										} else {
15242
											Sequence = 1 + idx;
15243
										}
15244
										//data = {
15245
										//    Sequence: Sequence
15246
										//};
15247

    
15248
										var seq = 'Sequence';
15249
										var SequenceValue = Sequence;
15250
										eval(addData);
15251
										data[seq] = SequenceValue;
15252

    
15253
										store.insert(idx, data);
15254
									}
15255

    
15256
								}, {
15257
									text: 'Delete',
15258
									hidden: hide_,
15259
									name: tableName + 'DeleteText',
15260
									iconCls: 'fa-trash-o',
15261
									style: 'font-family: FontAwesome',
15262
									//disabled: true
15263
									handler: function () {
15264
										var me = this,
15265
										store = Ext.StoreMgr.lookup(storeID)
15266

    
15267
											var grid = Ext.getCmp(gridName);
15268

    
15269
										Ext.MessageBox.show({
15270
											title: 'Remove tab',
15271
											msg: "This will remove. Do you want to continue?",
15272
											buttons: Ext.MessageBox.YESNO,
15273
											fn: function (choice) {
15274
												console.log(choice);
15275
												if (choice === 'yes') {
15276
													var selection = grid.getView().getSelectionModel().getSelection()[0];
15277
													if (selection) {
15278
														store.remove(selection);
15279
													}
15280
												}
15281
												//delete panel.pendingClose;
15282
											}
15283
										});
15284
									}
15285

    
15286
								}
15287
							]
15288
						}
15289
					],
15290
					columns: cols,
15291
					selType: checkSelection,
15292
					//selType: 'rowmodel',
15293
					plugins: {
15294
						ptype: 'rowediting',
15295
						pluginId: 'rowEditing',
15296
						clicksToEdit: 0,
15297
						listeners: {
15298
							//edit: 'onGridEditorEdit'
15299
						}
15300
					}
15301
				}, ]
15302

    
15303
		});
15304

    
15305
		me.callParent(arguments);
15306
	}
15307
});
15308

    
15309
Ext.define('MinovaUtil.MinovaES.Minovatimefield', {
15310
	extend: 'Ext.form.field.Time',
15311
	alias: ['widget.minovatimefield'],
15312
	undefinedText: '&#160;',
15313
	setValue: function (v) {
15314
		hasil = '';
15315
		if (v != this.getValue()) {
15316
			if (v) {
15317
				if (v.length == 4) {
15318

    
15319
					var h = v.substring(0, 2);
15320
					var m = v.substring(2, 4)
15321
						//this.setValue(h +':'+m);
15322
						hasil = h + ':' + m;
15323
				}
15324
				if (v.length == 5) {
15325
					this.setValue(v);
15326
					hasil = v;
15327
				}
15328
			}
15329
			this.setValue(hasil);
15330
		}
15331

    
15332
	},
15333
});
15334

    
15335
Ext.define('MinovaUtil.MinovaES.MinovaFixValueLabel', {
15336
	extend: 'Ext.form.Label',
15337
	alias: ['widget.MinovaFixValueLabel', 'widget.minovafixvaluelabel'],
15338
	anchor: '50%',
15339
	defaultRenderer: function (value) {
15340
		if (typeof(this.store) !== 'object') {
15341
			this.store = Ext.data.StoreManager.lookup(this.store);
15342
		}
15343
		var idx = this.store.findExact('code', value);
15344
		if (this.store.getAt(idx)) {
15345
			var result = this.store.getAt(idx).get('desc');
15346
			value = result ? result : value;
15347
		}
15348
		this.setRawValue(value);
15349

    
15350
	},
15351
	initComponent: function () {
15352
		var me = this;
15353
		var storeData = [];
15354
		var str = me.fixedValue;
15355
		var hasil = str.split('||');
15356
		hasil.forEach(function (h) {
15357
			store_ = h.split('=')
15358
				storeData.push({
15359
					code: store_[0],
15360
					desc: store_[1],
15361

    
15362
				});
15363
		});
15364
		Ext.applyIf(me, {
15365

    
15366
			store: Ext.create('Ext.data.Store', {
15367
				storeId: 'store' + name,
15368
				autoLoad: true,
15369
				data: storeData
15370

    
15371
			}),
15372

    
15373
		});
15374
		me.callParent(arguments);
15375
	}
15376
});
15377

    
15378
Ext.define('MinovaUtil.MinovaES.MinovaComboColumnFixValueLabel', {
15379
	extend: 'Ext.grid.column.Column',
15380
	alias: ['widget.minovacombocolumnfixvalue'],
15381
	initComponent: function () {
15382
		var me = this;
15383
		var storeData = [];
15384
		var str = me.fixedValue;
15385
		var hasil = str.split('||');
15386
		hasil.forEach(function (h) {
15387
			store_ = h.split('=')
15388
				storeData.push({
15389
					code: store_[0],
15390
					desc: store_[1],
15391

    
15392
				});
15393
		});
15394
		Ext.applyIf(me, {
15395

    
15396
			store: Ext.create('Ext.data.Store', {
15397
				storeId: 'store' + name,
15398
				autoLoad: true,
15399
				data: storeData
15400

    
15401
			}),
15402

    
15403
		});
15404
		this.callParent(arguments);
15405
	},
15406
	defaultRenderer: function (value) {
15407
		if (typeof(this.store) !== 'object') {
15408
			Ext.data.StoreManager.lookup(this.store).load();
15409
			this.store = Ext.data.StoreManager.lookup(this.store);
15410
		}
15411
		var idx = this.store.findExact('code', value);
15412
		if (this.store.getAt(idx)) {
15413
			var result = this.store.getAt(idx).get('desc');
15414
			value = result ? result : value;
15415
		}
15416
		return value;
15417
	}
15418
});
15419

    
15420
Ext.define('MinovaUtil.MinovaES.MinovaLookupColumn', {
15421
	extend: 'Ext.grid.column.Column',
15422
	alias: ['widget.minovalookupcolumn'],
15423
	initComponent: function () {
15424
		this.callParent(arguments);
15425
	},
15426
	defaultRenderer: function (value) {
15427
		data_ = undefined;
15428
		Ext.Ajax.request({
15429
			async: false,
15430
			method: 'POST',
15431
			url: '/UserControl/GetStore',
15432
			params: {
15433
				tableName: 'PDSCMTABLE',
15434
				param: this.tableName + ',' + value + ',hasil'
15435
			},
15436
			success: function (response) {
15437
				var results = Ext.decode(response.responseText);
15438
				data_ = results.data;
15439
				if (data_ != null) {
15440
					if (data_.length > 0) {
15441
						value = value + '-' + data_[0].hasil;
15442
					}
15443
				}
15444
			}
15445
		});
15446
		return value;
15447
	}
15448
});
15449

    
15450
Ext.define('MinovaUtil.MinovaES.MinovaPMSTreeEditAbleGrid', {
15451
	extend: 'Ext.form.Panel',
15452
	alias: ['widget.MinovaPMSTreeEditAbleGrid', 'widget.Minovapmstreeeditablegrid', 'widget.minovapmstreeeeditablegrid'],
15453
	requires: [
15454
		'Ext.grid.plugin.CellEditing',
15455
		'Ext.grid.Panel',
15456
	],
15457
	anchor: '100%',
15458
	tableName: undefined,
15459
	apprasalType: undefined,
15460
	empID: undefined,
15461
	hideButton: undefined,
15462
	multiSelect: undefined,
15463
	height: undefined,
15464
	initComponent: function () {
15465
		var me = this;
15466
		var isLookup = me.isLookup;
15467
		var hide_ = false;
15468
		var widthLock = 250;
15469
		var checkSelection = '';
15470
		if (me.hideButton == true) {
15471
			hide_ = true;
15472
		}
15473
		if (me.multiSelect) {
15474
			locking = false;
15475
			checkSelection = 'checkboxmodel';
15476
			widthLock = 40;
15477
		}
15478
		var tableName = me.tableName;
15479
		var cols = [];
15480
		var fieldStore = [];
15481
		var _url = 'GetAllField';
15482
		var hasil = null;
15483
		var height = me.height;
15484
		var storeID = 'store' + me.tableName;
15485
		var gridName = 'grid' + me.tableName;
15486
		if (me.storeName) {
15487
			storeID = me.storeName;
15488
		}
15489
		var empID = me.empID;
15490
		var apprasalType = me.apprasalType;
15491
		var LangID = MinovaUtil.GetLangID();
15492
		var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "'" + "," + empID + "," + apprasalType
15493
			Ext.Ajax.request({
15494
				async: false,
15495
				method: 'POST',
15496
				url: '/Performance/getFieldPMS',
15497
				params: {
15498
					tableName: 'PDSPMS001',
15499
					_param: parameter
15500
				},
15501
				success: function (response) {
15502
					var results = Ext.decode(response.responseText);
15503
					hasil = Ext.decode(results.data);
15504
				}
15505
			});
15506
		var addData = 'var data={';
15507
		if (hasil.length > 0) {
15508
			Ext.each(hasil, function (rec) {
15509
				fieldStore.push(rec.FieldName)
15510
				if (rec.FieldName != 'Sequence') {
15511
					addData = addData + rec.FieldName + ":" + "'',";
15512
				}
15513
				var null_ = null;
15514
				var ReadOnly_ = false;
15515
				if (rec.IsPrimaryKey == true) {
15516
					null_ = false;
15517
				}
15518
				if (rec.IsRequired == true) {
15519
					null_ = false;
15520
				} else {
15521
					null_ = true;
15522
				}
15523
				if (rec.ReadOnly == '1') {
15524
					ReadOnly_ = true;
15525
				}
15526
				var Hidden_ = false;
15527
				if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
15528
					Hidden_ = true;
15529
					null_ = true;
15530
				}
15531
				if (rec.GridView != 0) {
15532
					if (rec.GridView == 3) {
15533
						cols.push({
15534
							xtype: 'treecolumn',
15535
							text: rec.HeaderTitle,
15536
							dataIndex: rec.FieldName,
15537
							hidden: Hidden_,
15538
							width: 200,
15539
							sortable: true,
15540
							filter: {
15541
								itemDefaults: {
15542
									emptyText: 'Search for...'
15543
								}
15544
							}
15545
						});
15546
					} else {
15547
						switch (rec.FormatRef) {
15548
						case "date":
15549
							cols.push({
15550
								xtype: 'minovadatecolumn',
15551
								hidden: Hidden_,
15552
								text: rec.HeaderTitle,
15553
								dataIndex: rec.FieldName,
15554
								filter: {
15555
									itemDefaults: {
15556
										emptyText: 'Search for...',
15557
									}
15558
								},
15559
								editor: {
15560
									allowBlank: null_,
15561
									xtype: 'datefield',
15562
									hideMode: 'visibility',
15563
									readOnly: ReadOnly_,
15564
									id: tableName + rec.FieldName,
15565
									fieldGrid: rec.FieldName,
15566
									nameTable: rec.TableName,
15567
								}
15568
							});
15569
							break
15570
						case "amount":
15571
							cols.push({
15572
								xtype: 'minovacurrancycolumn',
15573
								//renderer: Ext.util.Format.numberRenderer("0,0"),
15574
								text: rec.HeaderTitle,
15575
								align: 'right',
15576
								dataIndex: rec.FieldName,
15577
								hidden: Hidden_,
15578
								filter: {
15579
									itemDefaults: {
15580
										emptyText: 'Search for...'
15581
									}
15582
								},
15583
								editor: {
15584
									allowBlank: null_,
15585
									xtype: 'minovacurrencyfield',
15586
									//renderer: Ext.util.Format.numberRenderer("0,0"),
15587
									//vtype: 'validateDecimal',
15588
									readOnly: ReadOnly_,
15589
									id: tableName + rec.FieldName,
15590
									nameTable: rec.TableName,
15591
									fieldGrid: rec.FieldName,
15592
									fieldStyle: 'text-align:right;',
15593
									value: '0',
15594

    
15595
								}
15596
							});
15597
							break
15598
						case "time":
15599
							var DefaultValue = rec.DefaultValue;
15600
							if (DefaultValue == '') {
15601
								defaultValue = '00:00';
15602
							}
15603
							cols.push({
15604
								//xtype: 'minovatimecolumn',
15605
								xtype: 'timefield',
15606
								format: 'H:i',
15607
								submitFormat: 'Hi',
15608
								text: rec.HeaderTitle,
15609
								dataIndex: rec.FieldName,
15610
								hidden: Hidden_,
15611
								//renderer: Ext.util.Format.dateRenderer('G:i'),
15612
								filter: {
15613
									itemDefaults: {
15614
										emptyText: 'Search for...'
15615
									}
15616
								},
15617
								editor: {
15618
									allowBlank: null_,
15619
									xtype: 'timefield',
15620
									readOnly: ReadOnly_,
15621
									id: tableName + rec.FieldName,
15622
									format: 'H:i',
15623
									submitFormat: 'Hi',
15624
									increment: 5,
15625
									value: DefaultValue,
15626
									anchor: '100%',
15627
									listeners: {}
15628
									//renderer: Ext.util.Format.dateRenderer('G:i'),
15629
								}
15630
							});
15631
							break
15632
						default:
15633
							if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
15634
								cols.push({
15635
									text: rec.HeaderTitle,
15636
									dataIndex: rec.FieldName,
15637
									width: 100,
15638
									filter: {
15639
										type: 'string',
15640
										itemDefaults: {
15641
											emptyText: 'Search for...'
15642
										}
15643
									}
15644
								});
15645
							} else if (rec.SearchType == '0') {
15646
								var valueField = null;
15647
								var displayValue = null;
15648
								var TableRef = undefined;
15649
								if (rec.TableRef != '') {
15650
									TableRef = rec.TableRef;
15651

    
15652
									Ext.Ajax.request({
15653
										async: false,
15654
										method: 'POST',
15655
										url: '/UserControl/GetStore',
15656
										params: {
15657
											tableName: 'SDATATABLEFIELD',
15658
											param: 'TableName[equal]' + rec.TableRef
15659
										},
15660
										success: function (response) {
15661
											var results = Ext.decode(response.responseText);
15662
											data_ = results.data;
15663
											if (data_ != undefined) {
15664
												valueField_ = $.grep(data_, function (r) {
15665
														return r.ValueField == '1'
15666
													});
15667
												valueField = valueField_[0].FieldName
15668
													displayValue_ = $.grep(data_, function (r) {
15669
														return r.DisplayValue == '1'
15670
													});
15671
												displayValue = displayValue_[0].FieldName
15672
											}
15673
										}
15674
									});
15675

    
15676
									//create Store
15677
									Ext.create('Ext.data.Store', {
15678
										storeId: 'store_' + me.tableName + rec.FieldName,
15679
										autoLoad: true,
15680
										proxy: {
15681
											method: 'POST',
15682
											type: 'ajax',
15683
											url: '/UserControl/GetStore',
15684
											extraParams: {
15685
												tableName: TableRef,
15686
												param: rec.ParamCombo
15687
											},
15688
											reader: {
15689
												type: 'json',
15690
												root: 'data',
15691
												totalProperty: 'data[0].TotalCount'
15692
											}
15693
										}
15694
									});
15695
								} else if (rec.FixedValue != '') {
15696
									var storeData = [];
15697
									var str = rec.FixedValue;
15698
									var hasil = str.split('||');
15699
									hasil.forEach(function (h) {
15700
										store_ = h.split('=')
15701
											storeData.push({
15702
												code: store_[0],
15703
												desc: store_[1],
15704

    
15705
											});
15706
									});
15707

    
15708
									valueField = 'code';
15709
									displayValue = 'desc';
15710

    
15711
									Ext.create('Ext.data.Store', {
15712
										storeId: 'store_' + me.tableName + rec.FieldName,
15713
										autoLoad: true,
15714
										data: storeData
15715
									})
15716
								}
15717

    
15718
								cols.push({
15719
									xtype: 'minovacombocolumn',
15720
									hidden: Hidden_,
15721
									text: rec.HeaderTitle,
15722
									dataIndex: rec.FieldName,
15723
									valueField: valueField,
15724
									displayField: displayValue,
15725
									store: 'store_' + me.tableName + rec.FieldName,
15726
									editor: {
15727
										allowBlank: null_,
15728
										xtype: 'combobox',
15729
										readOnly: ReadOnly_,
15730
										id: tableName + rec.FieldName,
15731
										nameTable: rec.TableName,
15732
										fieldGrid: rec.FieldName,
15733
										valueField: valueField,
15734
										displayField: displayValue,
15735

    
15736
										store: 'store_' + me.tableName + rec.FieldName,
15737
									},
15738
									filter: {
15739
										type: 'list',
15740
										itemDefaults: {
15741
											emptyText: 'Search for...'
15742
										}
15743
									}
15744
								});
15745

    
15746
							} else if (rec.SearchType == '2') {
15747
								var triger = (rec.TriggerCombo).split('$');
15748
								var targetField_ = triger[0];
15749
								var fieldValue_ = triger[1];
15750
								cols.push({
15751
									text: rec.HeaderTitle,
15752
									hidden: Hidden_,
15753
									dataIndex: rec.FieldName,
15754
									filter: {
15755
										itemDefaults: {
15756
											emptyText: 'Search for...'
15757
										}
15758
									},
15759
									editor: {
15760
										allowBlank: null_,
15761
										xtype: 'minovalookupgrid',
15762
										readOnly: ReadOnly_,
15763
										isGrid: true,
15764
										fieldTarget: targetField_,
15765
										fieldValue: fieldValue_,
15766
										isGrid: true,
15767
										id: tableName + rec.FieldName,
15768
										tableName: rec.TableRef, //name tabel yang jadi ref-nya
15769
										triggerCls: 'x-form-search-trigger',
15770
										vtype: 'alphanum', // disable space
15771
										nameTable: rec.TableName,
15772
										fieldGrid: rec.FieldName,
15773
										listeners: {
15774
											change: function (val) {
15775
												var custumFunc = rec.SelectFunction;
15776
												if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
15777
													Ext.Ajax.request({
15778
														async: false,
15779
														method: 'POST',
15780
														url: '/UserControl/GetStore',
15781
														params: {
15782
															tableName: 'PCMFUNC',
15783
															param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
15784
														},
15785
														success: function (response) {
15786
															var results = Ext.decode(response.responseText);
15787
															data_ = results.data[0];
15788
															if (data_ != undefined) {
15789
																custumFunc = data_.FunctionCode;
15790
															}
15791
														}
15792
													});
15793
												}
15794
												if (custumFunc) {
15795
													eval(custumFunc)
15796
												}
15797
											}
15798
										}
15799
									}
15800
								});
15801
							} else if (rec.SearchType == '3') {
15802
								cols.push({
15803
									text: rec.HeaderTitle,
15804
									hidden: Hidden_,
15805
									dataIndex: rec.FieldName,
15806
									filter: {
15807
										itemDefaults: {
15808
											emptyText: 'Search for...'
15809
										}
15810
									},
15811
									editor: {
15812
										allowBlank: null_,
15813
										// xtype: 'minovalookuptreePopup',
15814
										xtype: 'MinovaLookupTree',
15815
										readOnly: ReadOnly_,
15816
										id: tableName + rec.FieldName,
15817
										tableName: rec.TableRef, //name tabel yang jadi ref-nya
15818
										triggerCls: 'x-form-search-trigger',
15819
										vtype: 'alphanum', // disable space
15820
										treeSructure: rec.SearchFunction, //'O-O-P',
15821
										objClassValue: rec.ParamCombo, //'O',
15822
										nameTable: rec.TableName,
15823
										fieldGrid: rec.FieldName,
15824
										listeners: {
15825
											change: function (val) {
15826
												var custumFunc = rec.SelectFunction;
15827
												if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
15828
													Ext.Ajax.request({
15829
														async: false,
15830
														method: 'POST',
15831
														url: '/UserControl/GetStore',
15832
														params: {
15833
															tableName: 'PCMFUNC',
15834
															param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
15835
														},
15836
														success: function (response) {
15837
															var results = Ext.decode(response.responseText);
15838
															data_ = results.data[0];
15839
															if (data_ != undefined) {
15840
																custumFunc = data_.FunctionCode;
15841
															}
15842
														}
15843
													});
15844
												}
15845
												if (custumFunc) {
15846
													eval(custumFunc)
15847
												}
15848
											}
15849
										}
15850
									}
15851
								});
15852
							} 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) {
15853
								var triger = (rec.TriggerCombo).split('&');
15854
								var targetField_ = triger[0];
15855
								var fieldValue_ = triger[0];
15856
								cols.push({
15857
									text: rec.HeaderTitle,
15858
									hidden: Hidden_,
15859
									dataIndex: rec.FieldName,
15860
									filter: {
15861
										itemDefaults: {
15862
											emptyText: 'Search for...'
15863
										}
15864
									},
15865
									editor: {
15866
										allowBlank: null_,
15867
										xtype: 'lookupemployee',
15868
										readOnly: ReadOnly_,
15869
										isGrid: true,
15870
										fieldTarget: targetField_,
15871
										fieldValue: fieldValue_,
15872
										isGrid: true,
15873
										id: tableName + rec.FieldName,
15874
										tableName: rec.TableRef, //name tabel yang jadi ref-nya
15875
										triggerCls: 'x-form-search-trigger',
15876
										vtype: 'alphanum', // disable space
15877
										nameTable: rec.TableName,
15878
										fieldGrid: rec.FieldName,
15879
										listeners: {
15880
											change: function (val) {
15881
												var custumFunc = rec.SelectFunction;
15882
												if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
15883
													Ext.Ajax.request({
15884
														async: false,
15885
														method: 'POST',
15886
														url: '/UserControl/GetStore',
15887
														params: {
15888
															tableName: 'PCMFUNC',
15889
															param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
15890
														},
15891
														success: function (response) {
15892
															var results = Ext.decode(response.responseText);
15893
															data_ = results.data[0];
15894
															if (data_ != undefined) {
15895
																custumFunc = data_.FunctionCode;
15896
															}
15897
														}
15898
													});
15899
												}
15900
												if (custumFunc) {
15901
													eval(custumFunc)
15902
												}
15903
											}
15904
										}
15905
									}
15906
								});
15907
							} else if (rec.SearchType == '4' && isLookup != true) {
15908
								cols.push({
15909

    
15910
									text: rec.HeaderTitle,
15911
									hidden: Hidden_,
15912
									dataIndex: rec.FieldName,
15913
									filter: {
15914
										itemDefaults: {
15915
											emptyText: 'Search for...'
15916
										}
15917
									},
15918
									editor: {
15919
										allowBlank: null_,
15920
										xtype: 'lookupemployee',
15921
										readOnly: ReadOnly_,
15922
										isGrid: true,
15923
										fieldTarget: targetField_,
15924
										fieldValue: fieldValue_,
15925
										isGrid: true,
15926
										id: tableName + rec.FieldName,
15927
										tableName: rec.TableRef, //name tabel yang jadi ref-nya
15928
										triggerCls: 'x-form-search-trigger',
15929
										vtype: 'alphanum', // disable space
15930
										nameTable: rec.TableName,
15931
										fieldGrid: rec.FieldName,
15932
										listeners: {
15933
											change: function (val) {
15934
												var custumFunc = rec.SelectFunction;
15935
												if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
15936
													Ext.Ajax.request({
15937
														async: false,
15938
														method: 'POST',
15939
														url: '/UserControl/GetStore',
15940
														params: {
15941
															tableName: 'PCMFUNC',
15942
															param: 'FuncName[equal]' + rec.custumFunc + ',Active[=]1'
15943
														},
15944
														success: function (response) {
15945
															var results = Ext.decode(response.responseText);
15946
															data_ = results.data[0];
15947
															if (data_ != undefined) {
15948
																custumFunc = data_.FunctionCode;
15949
															}
15950
														}
15951
													});
15952
												}
15953
												if (custumFunc) {
15954
													eval(custumFunc)
15955
												}
15956
											}
15957
										}
15958
									}
15959
								});
15960
							} else {
15961
								cols.push({
15962
									text: rec.HeaderTitle,
15963
									hidden: Hidden_,
15964
									dataIndex: rec.FieldName,
15965
									filter: {
15966
										itemDefaults: {
15967
											emptyText: 'Search for...'
15968
										}
15969
									},
15970
									editor: {
15971
										allowBlank: null_,
15972
										xtype: 'textfield',
15973
										readOnly: ReadOnly_,
15974
										id: tableName + rec.FieldName,
15975
										nameTable: rec.TableName,
15976
										fieldGrid: rec.FieldName,
15977
										listeners: {
15978
											change: function (val) {
15979
												var custumFunc = null;
15980
												Ext.Ajax.request({
15981
													async: false,
15982
													method: 'POST',
15983
													url: '/UserControl/GetStore',
15984
													params: {
15985
														tableName: 'SDATATABLEFIELD',
15986
														param: 'FieldName[equal]' + rec.FieldName + ',TableName[equal]' + me.tableName
15987
													},
15988
													success: function (response) {
15989
														var results = Ext.decode(response.responseText);
15990
														data_ = results.data[0];
15991
														if (data_ != undefined) {
15992
															custumFunc = data_.SelectFunction;
15993
															//console.log(data_)
15994
														}
15995
													}
15996
												});
15997
												if (custumFunc) {
15998
													eval(custumFunc)
15999
												}
16000
											}
16001
										}
16002
									}
16003
								});
16004
							}
16005
							break
16006
						}
16007
					}
16008
				} else {
16009
					cols.push({
16010
						text: rec.HeaderTitle,
16011
						hidden: Hidden_,
16012
						dataIndex: rec.FieldName,
16013
						hidden: true,
16014
						editor: {
16015
							allowBlank: true,
16016
							xtype: 'textfield',
16017
							readOnly: ReadOnly_,
16018
							id: tableName + rec.FieldName,
16019
							nameTable: rec.TableName,
16020
							fieldGrid: rec.FieldName,
16021
						},
16022
						filter: {
16023
							itemDefaults: {
16024
								emptyText: 'Search for...'
16025
							}
16026
						}
16027
					});
16028
				}
16029
			})
16030
		}
16031
		addData = addData + "}";
16032

    
16033
		cols.push({
16034
			text: 'Action',
16035
			width: 100,
16036
			xtype: 'actioncolumn',
16037
			tooltip: 'View Data',
16038
			name: 'Action',
16039
			itemId: 'Action',
16040
			align: 'center',
16041
			iconCls: 'fa-edit',
16042
			renderer: function (value, metadata, record) {
16043
				metadata.tdStyle = 'font-family: FontAwesome'
16044
			},
16045
			handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
16046
				var main_ = Ext.ComponentQuery.query('[name=grid' + me.tableName + ']')[0];
16047
				this.fireEvent("onEditClick");
16048
			}
16049
		});
16050

    
16051
		Ext.applyIf(me, {
16052

    
16053
			items: [{
16054
					xtype: 'treepanel',
16055
					id: gridName,
16056
					name: gridName,
16057
					height: height,
16058
					width: 'fit',
16059
					autoHeight: true,
16060
					//store: 'gridStore',
16061
					autoLoad: false,
16062
					autoScroll: true,
16063
					useArrows: true,
16064
					animate: false,
16065
					rootVisible: false,
16066
					plugins: [
16067
						Ext.create('Ext.grid.plugin.CellEditing', {
16068
							clicksToEdit: 2
16069
						})
16070
					],
16071
					root: {
16072
						expanded: true,
16073
						nodeType: 'async',
16074
						ext: 'Favorites',
16075
						id: 'null'
16076
					},
16077
					columns: cols,
16078
					//selType: 'rowmodel',
16079
				}
16080
			]
16081

    
16082
		});
16083

    
16084
		me.callParent(arguments);
16085
	}
16086
});
16087
/*Add by Taufan ( Tab List MasterData For ERP )*/
16088
Ext.define('MinovaUtil.MinovaES.MinovaTabListMasterData', {
16089
	extend: 'Ext.tab.Panel',
16090
	alias: ['widget.masterdatatablist'],
16091
	moduleType: undefined,
16092
	tablenameheader: undefined,
16093
	langId: undefined,
16094
	param: undefined,
16095
	layout: 'fit',
16096
	name: 'panelTab',
16097
	id: 'mainTab',
16098
	initComponent: function () {
16099
		var me = this;
16100
		var hasil = null;
16101
		var action = "0";
16102
		var _items = [];
16103
		var act = getParam("action");
16104
		if (act == 'add') {
16105
			action = '0';
16106
		}
16107
		if (act == 'edit') {
16108
			action = '1';
16109
		}
16110
		if (act == 'view') {
16111
			action = '1';
16112
		}
16113
		if (act == 'copy') {
16114
			action = '0';
16115
		}
16116
		Ext.Ajax.request({
16117
			async: false,
16118
			method: 'POST',
16119
			url: '/UserControl/GetStore',
16120
			params: {
16121
				tableName: 'PCMEPMDLIST',
16122
				param: 'ModuleType[=]' + me.moduleType + ',Language[=]' + me.langId
16123
			},
16124
			success: function (response) {
16125
				var results = Ext.decode(response.responseText);
16126
				hasil = results.data;
16127
			}
16128
		});
16129
		hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
16130
		if (hasil.length > 0) {
16131
			Ext.each(hasil, function (rec) {
16132
				if (rec.LayoutType == "L004") { // L004=Custom
16133
					var pnl = Ext.create(rec.CustomLayout, {
16134
							title: rec.LabelName,
16135
							tableName: rec.TableName,
16136
							height: 450,
16137
							name: 'panelTab' + rec.TableName,
16138
							tbl: rec.TableName,
16139
							layoutType: rec.LayoutType
16140
						});
16141
					_items.push(pnl)
16142
				} else if (rec.LayoutType == "L002" || rec.LayoutType == "L003") {
16143
					_items.push({
16144
						xtype: 'panel',
16145
						title: rec.LabelName,
16146
						name: 'panelTab' + rec.TableName,
16147
						tbl: rec.TableName,
16148
						layoutType: rec.LayoutType,
16149
						items: [{
16150
								xtype: 'minovagrid1',
16151
								height: 450,
16152
								tableName: rec.TableName,
16153
								storename: 'store' + rec.TableName,
16154
								pagesize: 25,
16155
								name: 'GRID' + rec.TableName,
16156
								margin: '0 0 10 0',
16157
								autoLoad: false,
16158
								tbar: [{
16159
										xtype: 'button',
16160
										text: 'Action',
16161
										name: 'actionGrid' + rec.TableName,
16162
										menu: [{
16163
												text: 'Add',
16164
												name: 'add' + rec.TableName,
16165
												tbl: rec.TableName,
16166
												style: 'font-family: FontAwesome',
16167
												iconCls: 'fa-plus-circle',
16168
												handler: function () {
16169
													var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16170
													var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16171
													var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16172
													var keyField = getParam("KeyID");
16173
													var keyValue = getParam("KeyValue");
16174
													frmDisplay.reset();
16175
													frmForm.reset();
16176
													var idseq = 0;
16177
													var params = {
16178
														apiController: 'api/Devt',
16179
														methodName: 'GetLastSeqID',
16180
														parameter: 'tableName=' + rec.TableName + '&keyField=' + keyField + '&keyValue=' + keyValue
16181
													};
16182
													MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
16183
														var result = Ext.decode(xhr.responseText);
16184
														var r = Ext.decode(result.data);
16185
														idseq = r.data + 1;
16186
														frmForm.getForm().findField(keyField).setValue(keyValue);
16187
														frmForm.getForm().findField("SeqID").setValue(idseq);
16188
													});
16189
													frmDisplay.setHidden(true);
16190
													frmForm.setHidden(false);
16191
													grdPanel.setHidden(true);
16192
													action = "0";
16193
												}
16194
											}, {
16195
												text: 'Copy',
16196
												name: 'copy' + rec.TableName,
16197
												tbl: rec.TableName,
16198
												iconCls: 'fa-copy',
16199
												style: 'font-family: FontAwesome',
16200
												handler: function () {
16201
													var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16202
													var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16203
													var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16204
													var dtrec = grdPanel.getView().getSelectionModel().getSelection()[0];
16205
													var keyField = getParam("KeyID");
16206
													if (dtrec) {
16207
														frmDisplay.reset();
16208
														frmForm.reset();
16209
														frmForm.getForm().setValues(dtrec.data);
16210
														frmDisplay.setHidden(true);
16211
														frmForm.setHidden(false);
16212
														grdPanel.setHidden(true);
16213
														action = "0";
16214
														frmForm.getForm().findField(keyField).setValue("");
16215
													}
16216
												}
16217
											}, {
16218
												text: 'Edit',
16219
												name: 'edit' + rec.TableName,
16220
												tbl: rec.TableName,
16221
												iconCls: 'fa-edit',
16222
												style: 'font-family: FontAwesome',
16223
												handler: function () {
16224
													var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16225
													var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16226
													var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16227
													var dtrec = grdPanel.getView().getSelectionModel().getSelection()[0];
16228
													if (dtrec) {
16229
														frmDisplay.reset();
16230
														frmForm.reset();
16231
														frmForm.getForm().setValues(dtrec.data);
16232
														frmDisplay.setHidden(true);
16233
														frmForm.setHidden(false);
16234
														grdPanel.setHidden(true);
16235
														action = "1";
16236
													}
16237
												}
16238
											}
16239
										]
16240
									}, {
16241
										xtype: 'tbfill'
16242
									}, {
16243
										text: 'Clear Filters',
16244
										tooltip: 'Clear all filters',
16245
										name: 'clearbtn',
16246
										handler: function () {},hidden:true
16247
									}
16248
								],
16249
								dockedItems: [{
16250
										xtype: 'pagingtoolbar',
16251
										store: 'store' + rec.TableName,
16252
										dock: 'bottom',
16253
										pageSize: me.pagesize,
16254
										displayInfo: true
16255
									}
16256
								],
16257
								listeners: {
16258
									'itemdblclick': function (me, record, item, index, e, eOpts) {
16259
										var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16260
										var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16261
										var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16262
										frmDisplay.reset();
16263
										frmForm.reset();
16264
										frmDisplay.getForm().setValues(record.data);
16265
										frmForm.getForm().setValues(record.data);
16266
										frmDisplay.setHidden(false);
16267
										frmForm.setHidden(true);
16268
										grdPanel.setHidden(true);
16269
										action = "1";
16270
									}
16271
								}
16272
							}, {
16273
								xtype: 'minovaform',
16274
								name: 'DISPLAY' + rec.TableName,
16275
								id: 'DISPLAY' + rec.TableName,
16276
								itemId: 'DISPLAY' + rec.TableName,
16277
								tableName: rec.TableName,
16278
								isDisplay: true,
16279
								hidden: true,
16280
								buttons: [{
16281
										text: 'Edit',
16282
										name: 'editDISPLAY' + rec.TableName,
16283
										iconCls: 'fa-edit',
16284
										style: 'font-family: FontAwesome',
16285
										handler: function () {
16286
											var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16287
											var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16288
											var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16289
											frmDisplay.setHidden(true);
16290
											frmForm.setHidden(false);
16291
											grdPanel.setHidden(true);
16292
										}
16293
									}, {
16294
										text: 'Cancel',
16295
										name: 'cancelDISPLAY' + rec.TableName,
16296
										iconCls: 'fa-reply',
16297
										style: 'font-family: FontAwesome',
16298
										handler: function () {
16299
											var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16300
											var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16301
											var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16302
											frmDisplay.setHidden(true);
16303
											frmForm.setHidden(true);
16304
											grdPanel.setHidden(false);
16305
											grdPanel.getStore().reload();
16306
										}
16307
									}
16308
								]
16309
							}, {
16310
								xtype: 'minovaform',
16311
								name: 'FORM' + rec.TableName,
16312
								id: 'FORM' + rec.TableName,
16313
								itemId: 'FORM' + rec.TableName,
16314
								tableName: rec.TableName,
16315
								isDisplay: false,
16316
								hidden: true,
16317
								buttons: [{
16318
										text: 'Save',
16319
										name: 'saveFORM' + rec.TableName,
16320
										iconCls: 'fa-save',
16321
										style: 'font-family: FontAwesome',
16322
										handler: function () {
16323
											var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16324
											var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16325
											var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16326
											var frm = frmForm.getForm();
16327
											if (frm.isValid()) {
16328
												var keyField = getParam("KeyID");
16329
												var table = rec.TableName;
16330
												var data = Ext.encode(frmForm.getValues());
16331
												var token = MinovaUtil.SESSIONS.Token;
16332
												var params = {
16333
													apiController: 'api/Devt',
16334
													methodName: 'SaveTableMaster',
16335
													parameter: 'tableName=' + table + '&data=' + data + '&action=' + action + '&token=' + token
16336
												};
16337
												MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
16338
													var result = Ext.decode(xhr.responseText);
16339
													var r = Ext.decode(result.data);
16340
													if (r.success) {
16341
														frmDisplay.setHidden(true);
16342
														frmForm.setHidden(true);
16343
														grdPanel.setHidden(false);
16344
														grdPanel.getStore().reload();
16345
														MinovaMessage('Not Null', '000006', '', 'S');
16346
													} else {
16347
														MinovaMessage(' Not Null ', ' 000005 ', r.message.text, 'E');
16348
													}
16349
												});
16350
											}
16351
										}
16352
									}, {
16353
										text: 'Delete',
16354
										name: 'deleteFORM' + rec.TableName,
16355
										iconCls: 'fa-trash-o',
16356
										style: 'font-family: FontAwesome ',
16357
										handler: function () {
16358
											MinovaMessage(' Message ', ' 000007 ', ' ', 'C', function (respone) {
16359
												if (respone == "yes") {
16360
													var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16361
													var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16362
													var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16363
													var frm = frmForm.getForm();
16364
													if (frm.isValid()) {
16365
														var keyField = getParam("KeyID");
16366
														var table = rec.TableName;
16367
														var data = Ext.encode(frmForm.getValues());
16368
														var token = MinovaUtil.SESSIONS.Token;
16369
														action = "2";
16370
														var params = {
16371
															apiController: 'api/Devt',
16372
															methodName: 'SaveTableMaster',
16373
															parameter: 'tableName=' + table + '&data=' + data + '&action=' + action + '&token=' + token
16374
														};
16375
														MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
16376
															var result = Ext.decode(xhr.responseText);
16377
															var r = Ext.decode(result.data);
16378
															if (r.success) {
16379
																frmDisplay.setHidden(true);
16380
																frmForm.setHidden(true);
16381
																grdPanel.setHidden(false);
16382
																grdPanel.getStore().reload();
16383
																MinovaMessage('Not Null', '000006', '', 'S');
16384
															} else {
16385
																MinovaMessage(' Not Null ', ' 000005 ', r.message.text, 'E');
16386
															}
16387
														});
16388
													}
16389
												}
16390
											});
16391
										}
16392
									}, {
16393
										text: 'Cancel',
16394
										name: 'cancelFORM' + rec.TableName,
16395
										iconCls: 'fa-reply',
16396
										style: 'font-family: FontAwesome',
16397
										handler: function () {
16398
											MinovaMessage('Message', '000011', '', 'C', function (respone) {
16399
												if (respone == "yes") {
16400
													var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16401
													var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16402
													var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16403
													frmDisplay.setHidden(true);
16404
													frmForm.setHidden(true);
16405
													grdPanel.setHidden(false);
16406
													grdPanel.getStore().reload();
16407
												}
16408
											});
16409
										}
16410
									}
16411
								]
16412
							}
16413
						]
16414
					});
16415
				} else if (rec.LayoutType == "L005") { // Grid View Only
16416
					_items.push({
16417
						xtype: 'panel',
16418
						title: rec.LabelName,
16419
						name: 'panelTab' + rec.TableName,
16420
						tbl: rec.TableName,
16421
						layoutType: rec.LayoutType,
16422
						items: [{
16423
								xtype: 'minovagrid1',
16424
								height: 450,
16425
								tableName: rec.TableName,
16426
								storename: 'store' + rec.TableName,
16427
								pagesize: 25,
16428
								name: 'GRID' + rec.TableName,
16429
								margin: '0 0 10 0',
16430
								autoLoad: false,
16431
								tbar: [{
16432
										xtype: 'tbfill'
16433
									}, {
16434
										text: 'Clear Filters',
16435
										tooltip: 'Clear all filters',
16436
										name: 'clearbtn',
16437
										handler: function () {},hidden:true
16438
									}
16439
								],
16440
								dockedItems: [{
16441
										xtype: 'pagingtoolbar',
16442
										store: 'store' + rec.TableName,
16443
										dock: 'bottom',
16444
										pageSize: me.pagesize,
16445
										displayInfo: true
16446
									}
16447
								]
16448
							}
16449
						]
16450
					});
16451
				} else { // L001=Default Form Only
16452
					_items.push({
16453
						xtype: 'panel',
16454
						title: rec.LabelName,
16455
						name: 'panelTab' + rec.TableName,
16456
						tbl: rec.TableName,
16457
						layoutType: rec.LayoutType,
16458
						items: [{
16459
								xtype: 'minovaform',
16460
								name: 'DISPLAY' + rec.TableName,
16461
								id: 'DISPLAY' + rec.TableName,
16462
								itemId: 'DISPLAY' + rec.TableName,
16463
								tableName: rec.TableName,
16464
								isDisplay: true,
16465
								hidden: false,
16466
								buttons: [{
16467
										text: 'Edit',
16468
										name: 'editDISPLAY' + rec.TableName,
16469
										iconCls: 'fa-edit',
16470
										style: 'font-family: FontAwesome',
16471
										handler: function () {
16472
											var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16473
											var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16474
											frmDisplay.setHidden(true);
16475
											frmForm.setHidden(false);
16476
											action = "1";
16477
										}
16478
									}, {
16479
										text: 'Cancel',
16480
										name: 'cancelDISPLAY' + rec.TableName,
16481
										iconCls: 'fa-reply',
16482
										style: 'font-family: FontAwesome',
16483
										hidden: true
16484
									}
16485
								]
16486
							}, {
16487
								xtype: 'minovaform',
16488
								name: 'FORM' + rec.TableName,
16489
								id: 'FORM' + rec.TableName,
16490
								itemId: 'FORM' + rec.TableName,
16491
								tableName: rec.TableName,
16492
								isDisplay: false,
16493
								hidden: true,
16494
								buttons: [{
16495
										text: 'Save',
16496
										name: 'saveDISPLAY' + rec.TableName,
16497
										iconCls: 'fa-save',
16498
										style: 'font-family: FontAwesome',
16499
										handler: function () {
16500
											var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16501
											var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16502
											var headerDisplay = Ext.ComponentQuery.query('[name=MainHeaderMDLogistic]')[0];
16503
											var frm = frmForm.getForm();
16504
											if (frm.isValid()) {
16505
												var keyField = getParam("KeyID");
16506
												var table = rec.TableName;
16507
												var data = Ext.encode(frmForm.getValues());
16508
												var token = MinovaUtil.SESSIONS.Token;
16509
												var params = {
16510
													apiController: 'api/Devt',
16511
													methodName: 'SaveTableMaster',
16512
													parameter: 'tableName=' + table + '&data=' + data + '&action=' + action + '&token=' + token
16513
												};
16514
												MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
16515
													var result = Ext.decode(xhr.responseText);
16516
													var r = Ext.decode(result.data);
16517
													if (r.success) {
16518
														headerDisplay.mask("Loading...");
16519
														var idNo = r.data;
16520
														frmForm.getForm().findField(keyField).setValue(idNo);
16521
														frmDisplay.getForm().setValues(frmForm.getValues());
16522
														headerDisplay.getForm().setValues(frmForm.getValues());
16523
														frmDisplay.setHidden(false);
16524
														frmForm.setHidden(true);
16525
														MinovaMessage('Not Null', '000006', '', 'S');
16526
														headerDisplay.unmask();
16527
													} else {
16528
														MinovaMessage(' Not Null ', ' 000005 ', r.message.text, 'E');
16529
													}
16530
												});
16531
											}
16532
										}
16533
									}, {
16534
										text: 'Delete',
16535
										name: 'deleteDISPLAY' + rec.TableName,
16536
										iconCls: 'fa-trash-o',
16537
										style: 'font-family: FontAwesome',
16538
										handler: function () {}
16539
									}, {
16540
										text: 'Cancel',
16541
										name: 'cancelDISPLAY' + rec.TableName,
16542
										iconCls: 'fa-reply',
16543
										style: 'font-family: FontAwesome',
16544
										handler: function () {
16545
											MinovaMessage('Message', '000011', '', 'C', function (respone) {
16546
												if (respone == "yes") {
16547
													var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16548
													var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16549
													frmDisplay.setHidden(false);
16550
													frmForm.setHidden(true);
16551
												}
16552
											});
16553
										}
16554
									}
16555
								]
16556
							}
16557
						]
16558
					});
16559
				}
16560
			});
16561
		}
16562
		Ext.applyIf(me, {
16563
			items: _items
16564
		});
16565
		me.callParent(arguments);
16566
	}
16567
});
16568
/*Add by Taufan ( Tab List Doc Transaction For ERP )*/
16569
Ext.define('MinovaUtil.MinovaES.MinovaTabListDocTrans', {
16570
	extend: 'Ext.tab.Panel',
16571
	alias: ['widget.doctablist'],
16572
	transType: undefined,
16573
	docType: undefined,
16574
	docNo: undefined,
16575
	langId: undefined,
16576
	param: undefined,
16577
	layout: 'fit',
16578
	name: 'panelTab',
16579
	id: 'mainTab',
16580
	action: undefined,
16581
	initComponent: function () {
16582
		var me = this;
16583
		var documentType = me.docType;
16584
		var transactionType = me.transType;
16585
		var hasil = null;
16586
		var _items = [];
16587
		Ext.Ajax.request({
16588
			async: false,
16589
			method: 'POST',
16590
			url: '/UserControl/GetStore',
16591
			params: {
16592
				tableName: 'PCMBSTRANSLIST',
16593
				param: 'TransType[=]' + me.transType
16594
			},
16595
			success: function (response) {
16596
				var results = Ext.decode(response.responseText);
16597
				hasil = results.data;
16598
			}
16599
		});
16600
		hasil = hasil.sort(MinovaUtil.SortBy("Sequence"));
16601
		if (hasil.length > 0) {
16602
			Ext.each(hasil, function (rec) {
16603
				if (rec.LayoutType == "L004") { // L004=Custom
16604
					var pnl = Ext.create(rec.CustomLayout, {
16605
							title: rec.Title,
16606
							tableName: rec.TableName,
16607
							height: 400,
16608
							name: 'panelTab' + rec.TableName,
16609
							tbl: rec.TableName,
16610
							layoutType: rec.LayoutType
16611
						});
16612
					_items.push(pnl)
16613
				} else if (rec.LayoutType == "L002" || rec.LayoutType == "L003") {
16614
					_items.push({
16615
						xtype: 'panel',
16616
						title: rec.Title,
16617
						name: 'panelTab' + rec.TableName,
16618
						tbl: rec.TableName,
16619
						layoutType: rec.LayoutType,
16620
						items: [{
16621
								xtype: 'docgrid',
16622
								height: 400,
16623
								tableName: rec.TableName,
16624
								docType: me.docType,
16625
								transType: me.transType,
16626
								storename: 'store' + rec.TableName,
16627
								pagesize: 25,
16628
								name: 'GRID' + rec.TableName,
16629
								margin: '0 0 10 0',
16630
								autoLoad: false,
16631
								tbar: [{
16632
										xtype: 'button',
16633
										text: 'Action',
16634
										name: 'actionGrid' + rec.TableName,
16635
										menu: [{
16636
												text: 'Add',
16637
												name: 'add' + rec.TableName,
16638
												tbl: rec.TableName,
16639
												style: 'font-family: FontAwesome',
16640
												iconCls: 'fa-plus-circle',
16641
												handler: function () {
16642
													var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16643
													var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16644
													var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16645
													frmDisplay.reset();
16646
													frmForm.reset();
16647
													frmDisplay.setHidden(true);
16648
													frmForm.setHidden(false);
16649
													grdPanel.setHidden(true);
16650
													action = "0";
16651
												}
16652
											}, {
16653
												text: 'Delete',
16654
												name: 'delete' + rec.TableName,
16655
												tbl: rec.TableName,
16656
												iconCls: 'fa-trash-o',
16657
												style: 'font-family: FontAwesome',
16658
												handler: function () {
16659
													var me = this;
16660
													var store = Ext.StoreMgr.lookup('store' + rec.TableName);
16661
													var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16662
													Ext.MessageBox.show({
16663
														title: 'Remove tab',
16664
														msg: "This will remove. Do you want to continue?",
16665
														buttons: Ext.MessageBox.YESNO,
16666
														fn: function (choice) {
16667
															console.log(choice);
16668
															if (choice === 'yes') {
16669
																var selection = grdPanel.getView().getSelectionModel().getSelection()[0];
16670
																if (selection) {
16671
																	store.remove(selection);
16672
																}
16673
															}
16674
														}
16675
													});
16676
												}
16677
											}
16678
										]
16679
									}, {
16680
										xtype: 'tbfill'
16681
									}, {
16682
										text: 'Clear Filters',
16683
										tooltip: 'Clear all filters',
16684
										name: 'clearbtn',
16685
										handler: function () {},hidden:true
16686
									}
16687
								],
16688
								dockedItems: [{
16689
										xtype: 'pagingtoolbar',
16690
										store: 'store' + rec.TableName,
16691
										dock: 'bottom',
16692
										pageSize: me.pagesize,
16693
										displayInfo: true
16694
									}
16695
								],
16696
								listeners: {
16697
									'itemdblclick': function (me, record, item, index, e, eOpts) {
16698
										var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16699
										var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16700
										var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16701
										frmDisplay.reset();
16702
										frmForm.reset();
16703
										frmDisplay.getForm().setValues(record.data);
16704
										frmForm.getForm().setValues(record.data);
16705
										frmDisplay.setHidden(false);
16706
										frmForm.setHidden(true);
16707
										grdPanel.setHidden(true);
16708
										action = "1";
16709
									}
16710
								}
16711
							}, {
16712
								xtype: 'minovadocform',
16713
								name: 'DISPLAY' + rec.TableName,
16714
								id: 'DISPLAY' + rec.TableName,
16715
								itemId: 'DISPLAY' + rec.TableName,
16716
								tableName: rec.TableName,
16717
								docType: me.docType,
16718
								transType: me.transType,
16719
								isDisplay: true,
16720
								hidden: true,
16721
								buttons: [{
16722
										text: 'Edit',
16723
										name: 'editDISPLAY' + rec.TableName,
16724
										handler: function () {
16725
											var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16726
											var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16727
											var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16728
											frmDisplay.setHidden(true);
16729
											frmForm.setHidden(false);
16730
											grdPanel.setHidden(true);
16731
										}
16732
									}, {
16733
										text: 'Cancel',
16734
										name: 'cancelDISPLAY' + rec.TableName,
16735
										handler: function () {
16736
											var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16737
											var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16738
											var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16739
											frmDisplay.setHidden(true);
16740
											frmForm.setHidden(true);
16741
											grdPanel.setHidden(false);
16742
											grdPanel.getStore().reload();
16743
										}
16744
									}
16745
								]
16746
							}, {
16747
								xtype: 'minovadocform',
16748
								name: 'FORM' + rec.TableName,
16749
								id: 'FORM' + rec.TableName,
16750
								itemId: 'FORM' + rec.TableName,
16751
								tableName: rec.TableName,
16752
								docType: me.docType,
16753
								transType: me.transType,
16754
								isDisplay: false,
16755
								hidden: true,
16756
								buttons: [{
16757
										text: 'Submit',
16758
										name: 'submitFORM' + rec.TableName,
16759
										handler: function () {
16760
											var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16761
											var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16762
											var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16763
											var frm = frmForm.getForm();
16764
											if (frm.isValid()) {
16765
												var table = rec.TableName;
16766
												var data = frmForm.getValues();
16767
												var token = MinovaUtil.SESSIONS.Token;
16768
												var str = grdPanel.getStore();
16769
												var idx = str.getCount();
16770
												str.insert(idx, data);
16771
												frmDisplay.setHidden(true);
16772
												frmForm.setHidden(true);
16773
												grdPanel.setHidden(false);
16774
											}
16775
										}
16776
									}, {
16777
										text: 'Cancel',
16778
										name: 'cancelFORM' + rec.TableName,
16779
										handler: function () {
16780
											MinovaMessage('Message', '000011', '', 'C', function (respone) {
16781
												if (respone == "yes") {
16782
													var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16783
													var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16784
													var grdPanel = Ext.ComponentQuery.query('[name=GRID' + rec.TableName + ']')[0];
16785
													frmDisplay.setHidden(true);
16786
													frmForm.setHidden(true);
16787
													grdPanel.setHidden(false);
16788
												}
16789
											});
16790
										}
16791
									}
16792
								]
16793
							}
16794
						]
16795
					});
16796
				} else if (rec.LayoutType == "L005") { // Grid View Only
16797
					_items.push({
16798
						xtype: 'panel',
16799
						title: rec.Title,
16800
						name: 'panelTab' + rec.TableName,
16801
						tbl: rec.TableName,
16802
						layoutType: rec.LayoutType,
16803
						items: [{
16804
								xtype: 'docgrid',
16805
								height: 400,
16806
								tableName: rec.TableName,
16807
								docType: me.docType,
16808
								transType: me.transType,
16809
								storename: 'store' + rec.TableName,
16810
								pagesize: 25,
16811
								name: 'GRID' + rec.TableName,
16812
								margin: '0 0 10 0',
16813
								autoLoad: false,
16814
								tbar: [{
16815
										xtype: 'tbfill'
16816
									}, {
16817
										text: 'Clear Filters',
16818
										tooltip: 'Clear all filters',
16819
										name: 'clearbtn',
16820
										handler: function () {},hidden:true
16821
									}
16822
								],
16823
								dockedItems: [{
16824
										xtype: 'pagingtoolbar',
16825
										store: 'store' + rec.TableName,
16826
										dock: 'bottom',
16827
										pageSize: me.pagesize,
16828
										displayInfo: true
16829
									}
16830
								]
16831
							}
16832
						]
16833
					});
16834
				} else if (rec.LayoutType == "L006") {
16835
					_items.push({
16836
						xtype: 'panel',
16837
						title: rec.Title,
16838
						name: 'panelTab' + rec.TableName,
16839
						tbl: rec.TableName,
16840
						layoutType: rec.LayoutType,
16841
						items: [{
16842
								xtype: 'docgridcelledit',
16843
								name: 'CELLGRID' + rec.TableName,
16844
								tableName: rec.TableName,
16845
								docType: me.docType,
16846
								transType: me.transType,
16847
								docNo: me.docNo,
16848
								height: 400,
16849
								hideButton: false,
16850
								margin: '0 0 10 0'
16851
							}
16852
						]
16853
					});
16854
				} else if (rec.LayoutType == "L007") {
16855
					_items.push({
16856
						xtype: 'panel',
16857
						title: rec.Title,
16858
						name: 'panelTab' + rec.TableName,
16859
						tbl: rec.TableName,
16860
						layoutType: rec.LayoutType,
16861
						items: [{
16862
								xtype: 'docgridcelleditsum',
16863
								name: 'CELLGRID' + rec.TableName,
16864
								tableName: rec.TableName,
16865
								docType: me.docType,
16866
								transType: me.transType,
16867
								docNo: me.docNo,
16868
								height: 400,
16869
								hideButton: false,
16870
								margin: '0 0 10 0'
16871
							}, {
16872
								xtype: 'summarydocform',
16873
								name: 'SUM' + rec.TableName,
16874
								id: 'SUM' + rec.TableName,
16875
								itemId: 'SUM' + rec.TableName,
16876
								tableName: rec.TableName,
16877
								docType: me.docType,
16878
								transType: me.transType,
16879
							}
16880
						]
16881
					});
16882
				} else { // L001=Default Form Only
16883
					_items.push({
16884
						xtype: 'panel',
16885
						title: rec.LabelName,
16886
						name: 'panelTab' + rec.TableName,
16887
						tbl: rec.TableName,
16888
						layoutType: rec.LayoutType,
16889
						items: [{
16890
								xtype: 'minovadocform',
16891
								name: 'DISPLAY' + rec.TableName,
16892
								id: 'DISPLAY' + rec.TableName,
16893
								itemId: 'DISPLAY' + rec.TableName,
16894
								tableName: rec.TableName,
16895
								docType: me.docType,
16896
								transType: me.transType,
16897
								isDisplay: true,
16898
								hidden: false,
16899
								buttons: [{
16900
										text: 'Edit',
16901
										name: 'editDISPLAY' + rec.TableName,
16902
										iconCls: 'fa-edit',
16903
										style: 'font-family: FontAwesome',
16904
										handler: function () {
16905
											var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16906
											var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16907
											frmDisplay.setHidden(true);
16908
											frmForm.setHidden(false);
16909
											action = "1";
16910
										}
16911
									}, {
16912
										text: 'Cancel',
16913
										name: 'cancelDISPLAY' + rec.TableName,
16914
										iconCls: 'fa-reply',
16915
										style: 'font-family: FontAwesome',
16916
										hidden: true
16917
									}
16918
								]
16919
							}, {
16920
								xtype: 'minovadocform',
16921
								name: 'FORM' + rec.TableName,
16922
								id: 'FORM' + rec.TableName,
16923
								itemId: 'FORM' + rec.TableName,
16924
								tableName: rec.TableName,
16925
								docType: me.docType,
16926
								transType: me.transType,
16927
								isDisplay: false,
16928
								hidden: true,
16929
								buttons: [{
16930
										text: 'Save',
16931
										name: 'saveDISPLAY' + rec.TableName,
16932
										iconCls: 'fa-save',
16933
										style: 'font-family: FontAwesome',
16934
										handler: function () {
16935
											var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16936
											var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16937
											var headerDisplay = Ext.ComponentQuery.query('[name=MainHeaderMDLogistic]')[0];
16938
											var frm = frmForm.getForm();
16939
											if (frm.isValid()) {
16940
												var table = rec.TableName;
16941
												var data = Ext.encode(frmForm.getValues());
16942
												var token = MinovaUtil.SESSIONS.Token;
16943
												var params = {
16944
													apiController: 'api/Devt',
16945
													methodName: 'SaveTableMaster',
16946
													parameter: 'tableName=' + table + '&data=' + data + '&action=' + action + '&token=' + token
16947
												};
16948
												MinovaAjaxPost('/ApiService/Api/', params, function (xhr) {
16949
													var result = Ext.decode(xhr.responseText);
16950
													var r = Ext.decode(result.data);
16951
													if (r.success) {
16952
														headerDisplay.mask("Loading...");
16953
														var idNo = r.data;
16954
														frmForm.getForm().findField("DocNo").setValue(idNo);
16955
														frmDisplay.getForm().setValues(frmForm.getValues());
16956
														headerDisplay.getForm().setValues(frmForm.getValues());
16957
														frmDisplay.setHidden(false);
16958
														frmForm.setHidden(true);
16959
														MinovaMessage('Not Null', '000006', '', 'S');
16960
														headerDisplay.unmask();
16961
													} else {
16962
														MinovaMessage(' Not Null ', ' 000005 ', r.message.text, 'E');
16963
													}
16964
												});
16965
											}
16966
										}
16967
									}, {
16968
										text: 'Delete',
16969
										name: 'deleteDISPLAY' + rec.TableName,
16970
										iconCls: 'fa-trash-o',
16971
										style: 'font-family: FontAwesome',
16972
										handler: function () {}
16973
									}, {
16974
										text: 'Cancel',
16975
										name: 'cancelDISPLAY' + rec.TableName,
16976
										iconCls: 'fa-reply',
16977
										style: 'font-family: FontAwesome',
16978
										handler: function () {
16979
											MinovaMessage('Message', '000011', '', 'C', function (respone) {
16980
												if (respone == "yes") {
16981
													var frmDisplay = Ext.ComponentQuery.query('[name=DISPLAY' + rec.TableName + ']')[0];
16982
													var frmForm = Ext.ComponentQuery.query('[name=FORM' + rec.TableName + ']')[0];
16983
													frmDisplay.setHidden(false);
16984
													frmForm.setHidden(true);
16985
												}
16986
											});
16987
										}
16988
									}
16989
								]
16990
							}
16991
						]
16992
					});
16993
				}
16994
			});
16995
		}
16996
		Ext.applyIf(me, {
16997
			items: _items
16998
		});
16999
		me.callParent(arguments);
17000
	}
17001
});
17002
/*Add by Taufan ( Generate Doc Transaction Form For ERP )*/
17003
Ext.define('MinovaUtil.MinovaES.MinovaDocForm', {
17004
	extend: 'Ext.form.Panel',
17005
	alias: ['widget.MinovaDocForm', 'widget.minovadocform', 'widget.docform'],
17006
	formname: this.name,
17007
	tableName: undefined,
17008
	docType: undefined,
17009
	transType: undefined,
17010
	resizable: true,
17011
	border: false,
17012
	autoScroll: true,
17013
	isDisplay: undefined,
17014
	isLookup: undefined,
17015
	layout: 'column',
17016
	defaults: {
17017
		layout: 'form',
17018
		xtype: 'container',
17019
		defaultType: 'textfield',
17020
		style: 'width: 50%',
17021
	},
17022
	initComponent: function () {
17023
		var me = this;
17024
		var col1 = [];
17025
		var col2 = [];
17026
		var LangID = localStorage.LangId;
17027
		var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',DocType='" + me.docType + "'";
17028
		var formname_ = me.name;
17029
		var nameTable_ = me.tableName;
17030
		Ext.Ajax.request({
17031
			async: false,
17032
			method: 'POST',
17033
			url: '/UserControl/GetStore',
17034
			params: {
17035
				tableName: 'PDSDOCFIELD',
17036
				param: parameter
17037
			},
17038
			success: function (response) {
17039
				var results = Ext.decode(response.responseText);
17040
				hasil = results.data;
17041
			}
17042
		});
17043
		if (hasil.length > 0) {
17044
			Ext.each(hasil, function (rec) {
17045
				var isnull = null;
17046
				if (rec.IsPrimaryKey == '1') {
17047
					isnull = false;
17048
				}
17049
				if (rec.IsRequired == '1') {
17050
					isnull = false;
17051
				} else {
17052
					isnull = true;
17053
				}
17054
				var formfield = MinovaUtil.FieldGenerator.Form(me.name, rec, isnull, me.isDisplay, me.tableName, me.isLookup);
17055
				var descField = undefined;
17056
				if (rec.ColumnNo == 1) {
17057
					col1.push(formfield);
17058
					if (descField) {
17059
						col1.push(descField)
17060
					}
17061
				} else {
17062
					col2.push(formfield);
17063
					if (descField) {
17064
						col2.push(descField)
17065
					}
17066
				}
17067

    
17068
				if (rec.IsPrimaryKey == 1 && me.isLookup == undefined) {
17069
					formfieldKey = new Ext.form.TextField({
17070
							hidden: true,
17071
							name: "Key_" + rec.FieldName,
17072
						});
17073
					col2.push(formfieldKey);
17074
				}
17075
			});
17076
		}
17077
		Ext.applyIf(me, {
17078
			items: [{
17079
					style: 'width: 50%',
17080
					items: col1
17081
				}, {
17082
					style: 'width: 50%',
17083
					items: col2
17084
				}
17085
			]
17086
		});
17087
		this.callParent();
17088
	}
17089
});
17090
/*Add by Taufan ( Generate Doc Transaction Grid For ERP )*/
17091
Ext.define('MinovaUtil.MinovaES.MinovaDocGrid', {
17092
	extend: 'Ext.grid.Panel',
17093
	requires: ['Ext.grid.RowNumberer'],
17094
	alias: 'widget.docgrid',
17095
	alternateClassName: 'Ext.grid.MinovaGrid',
17096
	tableName: undefined,
17097
	docType: undefined,
17098
	transType: undefined,
17099
	isLookup: undefined,
17100
	param: undefined,
17101
	pagesize: undefined,
17102
	storename: undefined,
17103
	layoutType: undefined,
17104
	enableLocking: true,
17105
	autoLoad: undefined,
17106
	multiSelect: undefined,
17107
	getTableName: function () {
17108
		return this.tableName;
17109
	},
17110
	initComponent: function () {
17111
		var me = this;
17112
		var cols_ = [];
17113
		var fieldeditor = {};
17114
		var hasil = null;
17115
		var autoLoad = true;
17116
		var LangID = localStorage.LangId;
17117
		var fielGrid = 'rec.GridView == 1';
17118
		var locking = true;
17119
		var checkSelection = '';
17120
		var widthLock = 250;
17121
		if (me.multiSelect) {
17122
			locking = false;
17123
			checkSelection = 'checkboxmodel';
17124
			widthLock = 40;
17125
		}
17126
		if (me.autoLoad == false) {
17127
			autoLoad = false;
17128
		}
17129
		var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',DocType='" + me.docType + "'";
17130
		Ext.Ajax.request({
17131
			async: false,
17132
			method: 'POST',
17133
			url: '/UserControl/GetStore',
17134
			params: {
17135
				tableName: 'PDSDOCFIELD',
17136
				param: parameter
17137
			},
17138
			success: function (response) {
17139
				var results = Ext.decode(response.responseText);
17140
				hasil = results.data;
17141
			}
17142
		});
17143
		if (hasil.length > 0) {
17144
			Ext.each(hasil, function (rec) {
17145
				var null_ = null;
17146
				if (rec.IsPrimaryKey == true) {
17147
					null_ = false;
17148
				}
17149
				if (rec.IsRequired == true) {
17150
					null_ = false;
17151
				} else {
17152
					null_ = true;
17153
				}
17154
				if (rec.GridView == 1) {
17155
					switch (rec.FormatRef) {
17156
					case "action":
17157
						cols_.push({
17158
							text: rec.HeaderTitle,
17159
							width: 100,
17160
							xtype: 'actioncolumn',
17161
							tooltip: 'View Data',
17162
							name: rec.FieldName,
17163
							itemId: me.tableName + rec.FieldName,
17164
							align: 'center',
17165
							iconCls: 'fa-edit',
17166
							renderer: function (value, metadata, record) {
17167
								metadata.tdStyle = 'font-family: FontAwesome'
17168
							},
17169
							handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
17170

    
17171
								this.fireEvent(me.tableName + rec.FieldName + "onActionClick", record);
17172
							}
17173
						});
17174
						break
17175
					case "file":
17176
						cols_.push({
17177
							xtype: 'minovapicturecolumn',
17178
							text: rec.HeaderTitle,
17179
							dataIndex: rec.FieldName,
17180
							width: 100
17181
						});
17182
						break
17183
					case "date":
17184
						cols_.push({
17185
							xtype: 'minovadatecolumn',
17186
							text: rec.HeaderTitle,
17187
							dataIndex: rec.FieldName,
17188
							width: 100,
17189
							filter: {
17190
								type: 'date',
17191
								itemDefaults: {
17192
									emptyText: 'Search for...'
17193
								}
17194
							}
17195
						});
17196
						break
17197
					case "amountencrypt":
17198
						cols_.push({
17199
							xtype: 'minovaamountcolumn',
17200
							text: rec.HeaderTitle,
17201
							dataIndex: rec.FieldName,
17202
							align: 'right',
17203
							width: 100,
17204
							filter: {
17205
								type: 'string',
17206
								itemDefaults: {
17207
									emptyText: 'Search for...'
17208
								}
17209
							}
17210
						});
17211
						break
17212
					case "amount":
17213
						cols_.push({
17214
							xtype: 'minovacurrancycolumn',
17215
							text: rec.HeaderTitle,
17216
							dataIndex: rec.FieldName,
17217
							align: 'right',
17218
							width: 100,
17219
							filter: {
17220
								type: 'number',
17221
								itemDefaults: {
17222
									emptyText: 'Search for...'
17223
								}
17224
							}
17225
						});
17226
						break
17227
					case "datetime":
17228
						cols_.push({
17229
							xtype: 'minovadatetimecolumn',
17230
							text: rec.HeaderTitle,
17231
							dataIndex: rec.FieldName,
17232
							width: 140,
17233
							filter: {
17234
								type: 'string',
17235
								itemDefaults: {
17236
									emptyText: 'Search for...'
17237
								}
17238
							}
17239
						});
17240
						break
17241
					default:
17242
						if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY') {
17243
							cols_.push({
17244
								text: rec.HeaderTitle,
17245
								dataIndex: rec.FieldName,
17246
								width: 100,
17247
								filter: {
17248
									type: 'string',
17249
									itemDefaults: {
17250
										emptyText: 'Search for...'
17251
									}
17252
								}
17253
							});
17254
						} else if (rec.TableRef != "") {
17255
							if (rec.TableRef != null) {
17256
								var valueField = null;
17257
								var displayValue = null;
17258
								Ext.Ajax.request({
17259
									async: false,
17260
									method: 'POST',
17261
									url: '/UserControl/GetStore',
17262
									params: {
17263
										tableName: 'SDATATABLEFIELD',
17264
										param: 'TableName[equal]' + rec.TableRef
17265
									},
17266
									success: function (response) {
17267
										var results = Ext.decode(response.responseText);
17268
										data_ = results.data;
17269
										if (data_.length > 0) {
17270
											valueField_ = $.grep(data_, function (r) {
17271
													return r.ValueField == '1'
17272
												});
17273
											valueField = valueField_[0].FieldName
17274
												displayValue_ = $.grep(data_, function (r) {
17275
													return r.DisplayValue == '1'
17276
												});
17277
											displayValue = displayValue_[0].FieldName
17278
										} else {
17279
											MinovaMessage('Not Null', 'BSNULLCOMBO', rec.TableRef, 'E');
17280
										}
17281
									}
17282
								});
17283
								var store_ = Ext.StoreMgr.lookup('store_' + rec.FieldName);
17284
								var count_ = 0;
17285
								if (store_) {
17286
									count_ = store_.count();
17287
								}
17288
								if (count_ == 0) {
17289
									Ext.create('Ext.data.Store', {
17290
										storeId: 'store_' + rec.FieldName,
17291
										autoLoad: false,
17292
										proxy: {
17293
											method: 'POST',
17294
											type: 'ajax',
17295
											url: '/UserControl/GetStore',
17296
											extraParams: {
17297
												tableName: rec.TableRef,
17298
												param: rec.ParamCombo
17299
											},
17300
											reader: {
17301
												type: 'json',
17302
												root: 'data',
17303
												totalProperty: 'data[0].TotalCount'
17304
											}
17305
										}
17306
									})
17307
								}
17308
								cols_.push({
17309
									xtype: 'minovacombocolumn',
17310
									text: rec.HeaderTitle,
17311
									dataIndex: rec.FieldName,
17312
									valueField: valueField,
17313
									displayField: displayValue,
17314
									store: 'store_' + rec.FieldName,
17315
									filter: {
17316
										type: 'list',
17317
										itemDefaults: {
17318
											emptyText: 'Search for...'
17319
										}
17320
									}
17321
								});
17322
							}
17323
						} else if (rec.FixedValue != "") {
17324
							cols_.push({
17325
								xtype: 'minovacombocolumnfixvalue',
17326
								text: rec.HeaderTitle,
17327
								dataIndex: rec.FieldName,
17328
								fixedValue: rec.FixedValue,
17329
								filter: {
17330
									type: 'list',
17331
									itemDefaults: {
17332
										emptyText: 'Search for...'
17333
									}
17334
								}
17335
							});
17336
						} else {
17337
							cols_.push({
17338
								text: rec.HeaderTitle,
17339
								dataIndex: rec.FieldName,
17340
								filter: {
17341
									itemDefaults: {
17342
										emptyText: 'Search for...'
17343
									}
17344
								}
17345
							});
17346
						}
17347
						break
17348
					}
17349
				} else {
17350
					cols_.push({
17351
						text: rec.HeaderTitle,
17352
						dataIndex: rec.FieldName,
17353
						hidden: true,
17354
						filter: {
17355
							itemDefaults: {
17356
								emptyText: 'Search for...'
17357
							}
17358
						}
17359
					});
17360
				}
17361

    
17362
			});
17363
		};
17364
		var param_ = me.param;
17365
		if (param_ == undefined) {
17366
			param_ = ''
17367
		}
17368
		var jsStoreGrid = new Ext.data.Store({
17369
				storeId: me.storename,
17370
				autoLoad: autoLoad,
17371
				pageSize: me.pagesize,
17372
				proxy: {
17373
					method: 'POST',
17374
					type: 'ajax',
17375
					url: '/UserControl/GetStorePagingAuth',
17376
					extraParams: {
17377
						tableName: me.tableName,
17378
						param: param_,
17379
						menuId: MinovaUtil.GetMenuID()
17380
					},
17381
					reader: {
17382
						type: 'json',
17383
						root: 'data',
17384
						totalProperty: 'totalRecords'
17385
					}
17386
				},
17387
			});
17388
		Ext.applyIf(me, {
17389
			autoScroll: true,
17390
			enableLocking: locking,
17391
			lockedGridConfig: {
17392
				header: false,
17393
				collapsible: true,
17394
				width: widthLock,
17395
				forceFit: locking,
17396
				listeners: {
17397
					render: function (grid) {
17398
						var pagingToolbar = grid.child('pagingtoolbar');
17399
						if (pagingToolbar) {
17400
							grid.remove(pagingToolbar, true);
17401
						}
17402
					}
17403
				}
17404
			},
17405
			listeners: {
17406
				viewready: function () {
17407
					if (autoLoad == true) {
17408
						this.getStore().loadPage(1);
17409
					}
17410
				},
17411
				beforeedit: function () {
17412
					return false;
17413
				}
17414
			},
17415
			lockedViewConfig: {
17416
				scroll: 'horizontal'
17417
			},
17418
			viewConfig: {
17419
				emptyText: 'No Data Display',
17420
				deferEmptyText: false,
17421
				listeners: {
17422
					refresh: function (dataview) {
17423
						Ext.each(dataview.panel.columns, function (column) {
17424
							if (column.autoSizeColumn == false)
17425
								column.autoSizeColumn = true;
17426
							column.autoSize();
17427
						})
17428
					}
17429
				}
17430
			},
17431
			selModel: {},
17432
			selType: checkSelection,
17433
			columns: cols_,
17434
			store: jsStoreGrid,
17435
			plugins: [{
17436
					ptype: 'gridfilters'
17437
				}
17438
			]
17439
		});
17440
		me.callParent(arguments);
17441
	}
17442
});
17443
/*Add by Taufan ( Generate Doc Transaction Cell Edit Grid  For ERP )*/
17444
Ext.define('MinovaUtil.MinovaES.MinovaDocGridCellEdit', {
17445
	extend: 'Ext.form.Panel',
17446
	alias: 'widget.docgridcelledit',
17447
	requires: [
17448
		'Ext.grid.plugin.CellEditing',
17449
		'Ext.grid.Panel'
17450
	],
17451
	autoScroll: true,
17452
	anchor: '100%',
17453
	tableName: undefined,
17454
	docType: undefined,
17455
	transType: undefined,
17456
	docNo: undefined,
17457
	hideButton: undefined,
17458
	multiSelect: undefined,
17459
	initComponent: function () {
17460
		var me = this;
17461
		var isLookup = me.isLookup;
17462
		var hide_ = false;
17463
		var widthLock = 250;
17464
		var checkSelection = '';
17465

    
17466
		if (me.hideButton == true) {
17467
			hide_ = true;
17468
		}
17469
		if (me.multiSelect) {
17470
			locking = false;
17471
			checkSelection = 'checkboxmodel';
17472
			widthLock = 40;
17473
		}
17474
		var tableName = me.tableName;
17475
		var cols = [];
17476
		var fieldStore = [];
17477
		var _url = 'GetAllField';
17478
		var hasil = null;
17479
		var height = me.height;
17480
		var storeID = 'store' + me.tableName;
17481
		var gridName = 'grid' + me.name;
17482
		if (me.storeName) {
17483
			storeID = me.storeName;
17484
		}
17485
		var LangID = MinovaUtil.GetLangID();
17486
		var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',DocType='" + me.docType + "'";
17487
		Ext.Ajax.request({
17488
			async: false,
17489
			method: 'POST',
17490
			url: '/UserControl/GetStore',
17491
			params: {
17492
				tableName: 'PDSDOCFIELD',
17493
				param: parameter
17494
			},
17495
			success: function (response) {
17496
				var results = Ext.decode(response.responseText);
17497
				hasil = results.data;
17498
			}
17499
		});
17500
		cols.push({
17501
			xtype: 'rownumberer'
17502
		});
17503
		var addData = '({';
17504
		if (hasil.length > 0) {
17505
			Ext.each(hasil, function (rec) {
17506
				fieldStore.push(rec.FieldName);
17507
				var defaultValue = rec.DefaultValue;
17508
				if (defaultValue.substring(0, 2).toLowerCase() == 'fn') {
17509
					Ext.Ajax.request({
17510
						async: false,
17511
						method: 'POST',
17512
						url: '/UserControl/GetStore',
17513
						params: {
17514
							tableName: 'PCMFUNC',
17515
							param: 'FuncName[equal]' + rec.DefaultValue
17516
						},
17517
						success: function (response) {
17518
							var results = Ext.decode(response.responseText);
17519
							data_ = results.data;
17520
							if (data_.length > 0) {
17521
								defaultValue = eval(data_[0].FunctionCode);
17522
							}
17523
						}
17524
					});
17525
				}
17526
				addData = addData + rec.FieldName + ":" + "'" + defaultValue + "',";
17527
				var null_ = null;
17528
				var ReadOnly_ = false;
17529
				if (rec.IsPrimaryKey == true) {
17530
					null_ = false;
17531
				}
17532
				if (rec.IsRequired == true) {
17533
					null_ = false;
17534
				} else {
17535
					null_ = true;
17536
				}
17537
				var Hidden_ = false;
17538
				if (rec.ReadOnly == '1') {
17539
					ReadOnly_ = true;
17540
				}
17541
				if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
17542
					Hidden_ = true;
17543
					null_ = true;
17544
				}
17545
				if (rec.GridView == 1) {
17546
					switch (rec.FormatRef) {
17547
					case "date":
17548
						cols.push({
17549
							xtype: 'minovadatecolumn',
17550
							hidden: Hidden_,
17551
							text: rec.HeaderTitle,
17552
							dataIndex: rec.FieldName,
17553
							filter: {
17554
								itemDefaults: {
17555
									emptyText: 'Search for...'
17556
								}
17557
							},
17558
							editor: {
17559
								allowBlank: null_,
17560
								xtype: 'datefield',
17561
								hideMode: 'visibility',
17562
								readOnly: ReadOnly_,
17563
								id: tableName + rec.FieldName,
17564
								value: defaultValue
17565
							}
17566
						});
17567
						break
17568
					case "amount":
17569
						cols.push({
17570
							//xtype : 'minovacurrancycolumn',
17571
							xtype: 'numbercolumn',
17572
							text: rec.HeaderTitle,
17573
							align: 'right',
17574
							dataIndex: rec.FieldName,
17575
							hidden: Hidden_,
17576
							filter: {
17577
								itemDefaults: {
17578
									emptyText: 'Search for...'
17579
								}
17580
							},
17581
							editor: {
17582
								allowBlank: null_,
17583
								xtype: 'textfield',
17584
								readOnly: ReadOnly_,
17585
								id: tableName + rec.FieldName,
17586
								nameTable: rec.TableName,
17587
								fieldGrid: rec.FieldName,
17588
								fieldStyle: 'text-align:right;',
17589
								vtype: 'validateMinovaNumber',
17590
								value: '0',
17591
								listeners: {
17592
									change: function (val, recs) {
17593
										var fvalue = val.getValue();
17594
										var custumFunc = rec.SelectFunction;
17595
										if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
17596
											Ext.Ajax.request({
17597
												async: false,
17598
												method: 'POST',
17599
												url: '/UserControl/GetStore',
17600
												params: {
17601
													tableName: 'PCMFUNC',
17602
													param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
17603
												},
17604
												success: function (response) {
17605
													var results = Ext.decode(response.responseText);
17606
													var dt = results.data[0];
17607
													if (dt != undefined) {
17608
														custumFunc = dt.FunctionCode;
17609
													}
17610
												}
17611
											});
17612
										}
17613
										if (custumFunc) {
17614
											eval(custumFunc)
17615
										}
17616
									}
17617
								}
17618
							}
17619
						});
17620
						break
17621
					default:
17622
						if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
17623
							cols.push({
17624
								text: rec.HeaderTitle,
17625
								dataIndex: rec.FieldName,
17626
								width: 100,
17627
								filter: {
17628
									type: 'string',
17629
									itemDefaults: {
17630
										emptyText: 'Search for...'
17631
									}
17632
								}
17633
							});
17634
						} else if (rec.SearchType == '0') {
17635
							var valueField = null;
17636
							var displayValue = null;
17637
							var TableRef = undefined;
17638
							if (rec.TableRef != '') {
17639
								TableRef = rec.TableRef;
17640
								Ext.Ajax.request({
17641
									async: false,
17642
									method: 'POST',
17643
									url: '/UserControl/GetStore',
17644
									params: {
17645
										tableName: 'SDATATABLEFIELD',
17646
										param: 'TableName[equal]' + rec.TableRef
17647
									},
17648
									success: function (response) {
17649
										var results = Ext.decode(response.responseText);
17650
										data_ = results.data;
17651
										if (data_ != undefined) {
17652
											valueField_ = $.grep(data_, function (r) {
17653
													return r.ValueField == '1'
17654
												});
17655
											valueField = valueField_[0].FieldName
17656
												displayValue_ = $.grep(data_, function (r) {
17657
													return r.DisplayValue == '1'
17658
												});
17659
											displayValue = displayValue_[0].FieldName
17660
										}
17661
									}
17662
								});
17663
							}
17664
							Ext.create('Ext.data.Store', {
17665
								storeId: 'store_' + me.tableName + rec.FieldName,
17666
								autoLoad: true,
17667
								proxy: {
17668
									method: 'POST',
17669
									type: 'ajax',
17670
									url: '/UserControl/GetStoreAuth',
17671
									extraParams: {
17672
										tableName: TableRef,
17673
										param: rec.ParamCombo,
17674
										menuId: MinovaUtil.GetMenuID()
17675
									},
17676
									reader: {
17677
										type: 'json',
17678
										root: 'data',
17679
										totalProperty: 'data[0].TotalCount'
17680
									}
17681
								}
17682
							});
17683
							cols.push({
17684
								xtype: 'minovacombocolumn',
17685
								hidden: Hidden_,
17686
								text: rec.HeaderTitle,
17687
								dataIndex: rec.FieldName,
17688
								valueField: valueField,
17689
								displayField: displayValue,
17690
								store: 'store_' + me.tableName + rec.FieldName,
17691
								editor: {
17692
									allowBlank: null_,
17693
									xtype: 'combobox',
17694
									readOnly: ReadOnly_,
17695
									id: tableName + rec.FieldName,
17696
									valueField: valueField,
17697
									displayField: displayValue,
17698
									store: 'store_' + me.tableName + rec.FieldName,
17699
									listeners: {
17700
										change: function (val) {
17701
											var fvalue = val.getValue();
17702
											var custumFunc = rec.SelectFunction;
17703
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
17704
												Ext.Ajax.request({
17705
													async: false,
17706
													method: 'POST',
17707
													url: '/UserControl/GetStore',
17708
													params: {
17709
														tableName: 'PCMFUNC',
17710
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
17711
													},
17712
													success: function (response) {
17713
														var results = Ext.decode(response.responseText);
17714
														var dt = results.data[0];
17715
														if (dt != undefined) {
17716
															custumFunc = dt.FunctionCode;
17717
														}
17718
													}
17719
												});
17720
											}
17721
											if (custumFunc) {
17722
												eval(custumFunc)
17723
											}
17724
										}
17725
									}
17726
								},
17727
								filter: {
17728
									type: 'list',
17729
									itemDefaults: {
17730
										emptyText: 'Search for...'
17731
									}
17732
								}
17733
							});
17734
						} else if (rec.SearchType == '2') {
17735
							var triger = (rec.TriggerCombo).split('$');
17736
							var targetField_ = triger[0];
17737
							var fieldValue_ = triger[1];
17738
							cols.push({
17739
								text: rec.HeaderTitle,
17740
								hidden: Hidden_,
17741
								dataIndex: rec.FieldName,
17742
								filter: {
17743
									itemDefaults: {
17744
										emptyText: 'Search for...'
17745
									}
17746
								},
17747
								editor: {
17748
									allowBlank: null_,
17749
									xtype: 'minovalookupgrid',
17750
									readOnly: ReadOnly_,
17751
									isGrid: true,
17752
									fieldTarget: targetField_,
17753
									fieldValue: fieldValue_,
17754
									isGrid: true,
17755
									id: tableName + rec.FieldName,
17756
									tableName: rec.TableRef,
17757
									triggerCls: 'x-form-search-trigger',
17758
									vtype: 'alphanum',
17759
									listeners: {
17760
										change: function (val) {
17761
											var custumFunc = rec.SelectFunction;
17762
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
17763
												Ext.Ajax.request({
17764
													async: false,
17765
													method: 'POST',
17766
													url: '/UserControl/GetStore',
17767
													params: {
17768
														tableName: 'PCMFUNC',
17769
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
17770
													},
17771
													success: function (response) {
17772
														var results = Ext.decode(response.responseText);
17773
														data_ = results.data[0];
17774
														if (data_ != undefined) {
17775
															custumFunc = data_.FunctionCode;
17776
														}
17777
													}
17778
												});
17779
											}
17780
											if (custumFunc) {
17781
												eval(custumFunc)
17782
											}
17783
										}
17784
									}
17785
								}
17786
							});
17787
						} else if (rec.SearchType == '3') {
17788
							cols.push({
17789
								text: rec.HeaderTitle,
17790
								hidden: Hidden_,
17791
								dataIndex: rec.FieldName,
17792
								filter: {
17793
									itemDefaults: {
17794
										emptyText: 'Search for...'
17795
									}
17796
								},
17797
								editor: {
17798
									allowBlank: null_,
17799
									xtype: 'MinovaLookupTree',
17800
									readOnly: ReadOnly_,
17801
									id: tableName + rec.FieldName,
17802
									tableName: rec.TableRef,
17803
									triggerCls: 'x-form-search-trigger',
17804
									vtype: 'alphanum',
17805
									treeSructure: rec.SearchFunction,
17806
									objClassValue: rec.ParamCombo,
17807
									listeners: {
17808
										change: function (val) {
17809
											var custumFunc = rec.SelectFunction;
17810
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
17811
												Ext.Ajax.request({
17812
													async: false,
17813
													method: 'POST',
17814
													url: '/UserControl/GetStore',
17815
													params: {
17816
														tableName: 'PCMFUNC',
17817
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
17818
													},
17819
													success: function (response) {
17820
														var results = Ext.decode(response.responseText);
17821
														data_ = results.data[0];
17822
														if (data_ != undefined) {
17823
															custumFunc = data_.FunctionCode;
17824
														}
17825
													}
17826
												});
17827
											}
17828
											if (custumFunc) {
17829
												eval(custumFunc)
17830
											}
17831
										}
17832
									}
17833
								}
17834
							});
17835
						} 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) {
17836
							var triger = (rec.TriggerCombo).split('&');
17837
							var targetField_ = triger[0];
17838
							var fieldValue_ = triger[0];
17839
							cols.push({
17840
								text: rec.HeaderTitle,
17841
								hidden: Hidden_,
17842
								dataIndex: rec.FieldName,
17843
								filter: {
17844
									itemDefaults: {
17845
										emptyText: 'Search for...'
17846
									}
17847
								},
17848
								editor: {
17849
									allowBlank: null_,
17850
									xtype: 'lookupemployee',
17851
									readOnly: ReadOnly_,
17852
									isGrid: true,
17853
									fieldTarget: targetField_,
17854
									fieldValue: fieldValue_,
17855
									isGrid: true,
17856
									id: tableName + rec.FieldName,
17857
									tableName: rec.TableRef,
17858
									triggerCls: 'x-form-search-trigger',
17859
									vtype: 'alphanum',
17860
									listeners: {
17861
										change: function (val) {
17862
											var custumFunc = rec.SelectFunction;
17863
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
17864
												Ext.Ajax.request({
17865
													async: false,
17866
													method: 'POST',
17867
													url: '/UserControl/GetStore',
17868
													params: {
17869
														tableName: 'PCMFUNC',
17870
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
17871
													},
17872
													success: function (response) {
17873
														var results = Ext.decode(response.responseText);
17874
														data_ = results.data[0];
17875
														if (data_ != undefined) {
17876
															custumFunc = data_.FunctionCode;
17877
														}
17878
													}
17879
												});
17880
											}
17881
											if (custumFunc) {
17882
												eval(custumFunc)
17883
											}
17884
										}
17885
									}
17886
								}
17887
							});
17888
						} else if (rec.SearchType == '4' && isLookup != true) {
17889
							cols.push({
17890
								text: rec.HeaderTitle,
17891
								hidden: Hidden_,
17892
								dataIndex: rec.FieldName,
17893
								filter: {
17894
									itemDefaults: {
17895
										emptyText: 'Search for...'
17896
									}
17897
								},
17898
								editor: {
17899
									allowBlank: null_,
17900
									xtype: 'lookupemployee',
17901
									readOnly: ReadOnly_,
17902
									isGrid: true,
17903
									fieldTarget: targetField_,
17904
									fieldValue: fieldValue_,
17905
									isGrid: true,
17906
									id: tableName + rec.FieldName,
17907
									tableName: rec.TableRef,
17908
									triggerCls: 'x-form-search-trigger',
17909
									vtype: 'alphanum',
17910
									listeners: {
17911
										change: function (val) {
17912
											var custumFunc = rec.SelectFunction;
17913
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
17914
												Ext.Ajax.request({
17915
													async: false,
17916
													method: 'POST',
17917
													url: '/UserControl/GetStore',
17918
													params: {
17919
														tableName: 'PCMFUNC',
17920
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
17921
													},
17922
													success: function (response) {
17923
														var results = Ext.decode(response.responseText);
17924
														data_ = results.data[0];
17925
														if (data_ != undefined) {
17926
															custumFunc = data_.FunctionCode;
17927
														}
17928
													}
17929
												});
17930
											}
17931
											if (custumFunc) {
17932
												eval(custumFunc)
17933
											}
17934
										}
17935
									}
17936
								}
17937
							});
17938
						} else if (rec.FixedValue != '') {
17939
							cols.push({
17940
								text: rec.HeaderTitle,
17941
								hidden: Hidden_,
17942
								dataIndex: rec.FieldName,
17943
								filter: {
17944
									itemDefaults: {
17945
										emptyText: 'Search for...'
17946
									}
17947
								},
17948
								editor: {
17949
									allowBlank: null_,
17950
									xtype: 'minovafixvalue',
17951
									readOnly: ReadOnly_,
17952
									id: tableName + rec.FieldName,
17953
									nameTable: tableName,
17954
									fieldGrid: rec.FieldName,
17955
									fixedValue: rec.FixedValue,
17956
									valueField: 'code',
17957
									displayField: 'desc',
17958
									value: defaultValue
17959
								},
17960
								renderer: function (value) {
17961
									var val = "";
17962
									var storeData = [];
17963
									var str = rec.FixedValue;
17964
									var hasil = str.split('||');
17965
									hasil.forEach(function (h) {
17966
										store_ = h.split('=')
17967
											storeData.push({
17968
												code: store_[0],
17969
												desc: store_[1]
17970
											});
17971
									});
17972
									var item = storeData.find(x => x.code == value);
17973
									if (item != undefined) {
17974
										val = item.desc;
17975
									}
17976
									return val;
17977
								}
17978
							});
17979
						} else if (rec.FieldDataType == 3) {
17980
							cols.push({
17981
								text: rec.HeaderTitle,
17982
								hidden: Hidden_,
17983
								dataIndex: rec.FieldName,
17984
								filter: {
17985
									itemDefaults: {
17986
										emptyText: 'Search for...'
17987
									}
17988
								},
17989
								editor: {
17990
									allowBlank: null_,
17991
									xtype: 'textfield',
17992
									readOnly: ReadOnly_,
17993
									id: tableName + rec.FieldName,
17994
									nameTable: rec.TableName,
17995
									fieldGrid: rec.FieldName,
17996
									vtype: 'validateDecimal',
17997
									maxLength: rec.Length,
17998
									precision: rec.Prec,
17999
									fieldStyle: 'text-align:right;',
18000
									value: defaultValue,
18001
									listeners: {
18002
										change: function (val) {
18003
											var custumFunc = rec.SelectFunction;
18004
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
18005
												Ext.Ajax.request({
18006
													async: false,
18007
													method: 'POST',
18008
													url: '/UserControl/GetStore',
18009
													params: {
18010
														tableName: 'PCMFUNC',
18011
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
18012
													},
18013
													success: function (response) {
18014
														var results = Ext.decode(response.responseText);
18015
														data_ = results.data[0];
18016
														if (data_ != undefined) {
18017
															custumFunc = data_.FunctionCode;
18018
														}
18019
													}
18020
												});
18021
											}
18022
											if (custumFunc) {
18023
												eval(custumFunc)
18024
											}
18025
										}
18026
									}
18027
								}
18028
							});
18029
						} else {
18030
							cols.push({
18031
								text: rec.HeaderTitle,
18032
								hidden: Hidden_,
18033
								dataIndex: rec.FieldName,
18034
								filter: {
18035
									itemDefaults: {
18036
										emptyText: 'Search for...'
18037
									}
18038
								},
18039
								editor: {
18040
									allowBlank: null_,
18041
									xtype: 'textfield',
18042
									readOnly: ReadOnly_,
18043
									id: tableName + rec.FieldName,
18044
									value: defaultValue,
18045
									listeners: {
18046
										change: function (val) {
18047
											var custumFunc = rec.SelectFunction;
18048
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
18049
												Ext.Ajax.request({
18050
													async: false,
18051
													method: 'POST',
18052
													url: '/UserControl/GetStore',
18053
													params: {
18054
														tableName: 'PCMFUNC',
18055
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
18056
													},
18057
													success: function (response) {
18058
														var results = Ext.decode(response.responseText);
18059
														data_ = results.data[0];
18060
														if (data_ != undefined) {
18061
															custumFunc = data_.FunctionCode;
18062
														}
18063
													}
18064
												});
18065
											}
18066
											if (custumFunc) {
18067
												eval(custumFunc)
18068
											}
18069
										}
18070
									}
18071
								}
18072
							});
18073
						}
18074
						break
18075
					}
18076
				} else {
18077
					cols.push({
18078
						text: rec.HeaderTitle,
18079
						hidden: Hidden_,
18080
						dataIndex: rec.FieldName,
18081
						hidden: true,
18082
						editor: {
18083
							allowBlank: true,
18084
							xtype: 'textfield',
18085
							readOnly: ReadOnly_,
18086
							id: tableName + rec.FieldName,
18087
							value: defaultValue
18088
						},
18089
						filter: {
18090
							itemDefaults: {
18091
								emptyText: 'Search for...'
18092
							}
18093
						}
18094
					});
18095
				}
18096
			});
18097
		};
18098
		addData = addData + "})";
18099
		this.cellEditing = new Ext.grid.plugin.CellEditing({
18100
				clicksToEdit: 1
18101
			});
18102
		Ext.applyIf(me, {
18103
			items: [{
18104
					xtype: 'grid',
18105
					autoScroll: true,
18106
					id: gridName,
18107
					name: gridName,
18108
					height: height,
18109
					store: Ext.create('Ext.data.Store', {
18110
						storeId: storeID,
18111
						fields: fieldStore,
18112
						proxy: {
18113
							method: 'POST',
18114
							type: 'ajax',
18115
							url: '',
18116
							reader: {
18117
								type: 'json',
18118
								root: 'data'
18119
							}
18120
						}
18121
					}),
18122
					dockedItems: [{
18123
							xtype: 'toolbar',
18124
							items: [{
18125
									text: 'Add',
18126
									name: 'add' + tableName,
18127
									iconCls: 'fa-plus-circle',
18128
									style: 'font-family: FontAwesome',
18129
									handler: function () {
18130
										var store = Ext.StoreMgr.lookup(storeID);
18131
										var data = eval(addData);
18132
										if (me.transType == "FIN") {
18133
											var fp = Ext.ComponentQuery.query("[name=FiscalPeriod]")[0].getValue();
18134
											var fy = Ext.ComponentQuery.query("[name=FiscalYear]")[0].getValue();
18135
											var cp = Ext.ComponentQuery.query("[name=CompanyID]")[0].getValue();
18136
											var bu = Ext.ComponentQuery.query("[name=BusinessUnit]")[0].getValue();
18137
											data["FiscalPeriod"] = fp;
18138
											data["FiscalYear"] = fy;
18139
											data["CompanyID"] = cp;
18140
											data["BusinessUnit"] = bu;
18141
										}
18142
										idx = store.getCount();
18143
										store.insert(idx, data);
18144
									}
18145
								}, {
18146
									text: 'Delete',
18147
									name: 'delete' + tableName,
18148
									iconCls: 'fa-trash-o',
18149
									style: 'font-family: FontAwesome',
18150
									handler: function () {
18151
										var me = this,
18152
										store = Ext.StoreMgr.lookup(storeID);
18153
										var grid = Ext.getCmp(gridName);
18154
										Ext.MessageBox.show({
18155
											title: 'Remove tab',
18156
											msg: "This will remove. Do you want to continue?",
18157
											buttons: Ext.MessageBox.YESNO,
18158
											fn: function (choice) {
18159
												console.log(choice);
18160
												if (choice === 'yes') {
18161
													var selection = grid.getView().getSelectionModel().getSelection()[0];
18162
													if (selection) {
18163
														store.remove(selection);
18164
													}
18165
												}
18166
											}
18167
										});
18168
									}
18169
								}
18170
							]
18171
						}
18172
					],
18173
					columns: cols,
18174
					selModel: {
18175
						type: 'cellmodel'
18176
					},
18177
					plugins: [this.cellEditing]
18178
				}
18179
			]
18180
		});
18181
		me.callParent(arguments);
18182
	}
18183
});
18184
/*Add by Taufan ( Generate Doc Transaction Cell Edit Grid Sum For ERP )*/
18185
Ext.define('MinovaUtil.MinovaES.MinovaDocGridCellEditSum', {
18186
	extend: 'Ext.form.Panel',
18187
	alias: 'widget.docgridcelleditsum',
18188
	requires: [
18189
		'Ext.grid.plugin.CellEditing',
18190
		'Ext.grid.Panel',
18191
		'Ext.grid.RowNumberer'
18192
	],
18193
	autoScroll: true,
18194
	anchor: '100%',
18195
	tableName: undefined,
18196
	docType: undefined,
18197
	transType: undefined,
18198
	docNo: undefined,
18199
	hideButton: undefined,
18200
	multiSelect: undefined,
18201
	initComponent: function () {
18202
		var me = this;
18203
		var isLookup = me.isLookup;
18204
		var hide_ = false;
18205
		var widthLock = 250;
18206
		var checkSelection = '';
18207

    
18208
		if (me.hideButton == true) {
18209
			hide_ = true;
18210
		}
18211
		if (me.multiSelect) {
18212
			locking = false;
18213
			checkSelection = 'checkboxmodel';
18214
			widthLock = 40;
18215
		}
18216
		var tableName = me.tableName;
18217
		var cols = [];
18218
		var fieldStore = [];
18219
		var _url = 'GetAllField';
18220
		var hasil = null;
18221
		var height = me.height;
18222
		var storeID = 'store' + me.tableName;
18223
		var gridName = 'grid' + me.name;
18224
		if (me.storeName) {
18225
			storeID = me.storeName;
18226
		}
18227
		var LangID = MinovaUtil.GetLangID();
18228
		var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',DocType='" + me.docType + "'";
18229
		Ext.Ajax.request({
18230
			async: false,
18231
			method: 'POST',
18232
			url: '/UserControl/GetStore',
18233
			params: {
18234
				tableName: 'PDSDOCFIELD',
18235
				param: parameter
18236
			},
18237
			success: function (response) {
18238
				var results = Ext.decode(response.responseText);
18239
				hasil = results.data;
18240
			}
18241
		});
18242
		cols.push({
18243
			xtype: 'rownumberer'
18244
		});
18245
		var addData = '({';
18246
		if (hasil.length > 0) {
18247
			Ext.each(hasil, function (rec) {
18248
				fieldStore.push(rec.FieldName);
18249
				var defaultValue = rec.DefaultValue;
18250
				if (defaultValue.substring(0, 2).toLowerCase() == 'fn') {
18251
					Ext.Ajax.request({
18252
						async: false,
18253
						method: 'POST',
18254
						url: '/UserControl/GetStore',
18255
						params: {
18256
							tableName: 'PCMFUNC',
18257
							param: 'FuncName[equal]' + rec.DefaultValue
18258
						},
18259
						success: function (response) {
18260
							var results = Ext.decode(response.responseText);
18261
							data_ = results.data;
18262
							if (data_.length > 0) {
18263
								defaultValue = eval(data_[0].FunctionCode);
18264
							}
18265
						}
18266
					});
18267
				}
18268
				addData = addData + rec.FieldName + ":" + "'" + defaultValue + "',";
18269
				var null_ = null;
18270
				var ReadOnly_ = false;
18271
				if (rec.IsPrimaryKey == true) {
18272
					null_ = false;
18273
				}
18274
				if (rec.IsRequired == true) {
18275
					null_ = false;
18276
				} else {
18277
					null_ = true;
18278
				}
18279
				var Hidden_ = false;
18280
				if (rec.ReadOnly == '1') {
18281
					ReadOnly_ = true;
18282
				}
18283
				if (rec.IsHidden == '1' || rec.Sequence == '' || rec.Sequence == '0' || rec.ColumnNo == '' || rec.GridView == '') {
18284
					Hidden_ = true;
18285
					null_ = true;
18286
				}
18287
				var isSum = rec.IsSummary;
18288
				if (rec.GridView == 1) {
18289
					switch (rec.FormatRef) {
18290
					case "date":
18291
						cols.push({
18292
							xtype: 'minovadatecolumn',
18293
							hidden: Hidden_,
18294
							text: rec.HeaderTitle,
18295
							dataIndex: rec.FieldName,
18296
							filter: {
18297
								itemDefaults: {
18298
									emptyText: 'Search for...'
18299
								}
18300
							},
18301
							isSummary: isSum,
18302
							editor: {
18303
								allowBlank: null_,
18304
								xtype: 'datefield',
18305
								hideMode: 'visibility',
18306
								readOnly: ReadOnly_,
18307
								id: tableName + rec.FieldName,
18308
								value: defaultValue
18309
							}
18310
						});
18311
						break
18312
					case "amount":
18313
						cols.push({
18314
							xtype: 'numbercolumn',
18315
							text: rec.HeaderTitle,
18316
							align: 'right',
18317
							dataIndex: rec.FieldName,
18318
							isSummary: isSum,
18319
							hidden: Hidden_,
18320
							filter: {
18321
								itemDefaults: {
18322
									emptyText: 'Search for...'
18323
								}
18324
							},
18325
							autoSizeColumn: true,
18326
							width: 300,
18327
							editor: {
18328
								allowBlank: null_,
18329
								xtype: 'textfield',
18330
								readOnly: ReadOnly_,
18331
								id: tableName + rec.FieldName,
18332
								nameTable: rec.TableName,
18333
								fieldGrid: rec.FieldName,
18334
								fieldStyle: 'text-align:right;',
18335
								vtype: 'validateMinovaNumber',
18336
								value: '0',
18337
								listeners: {
18338
									change: function (val, recs) {
18339
										var fvalue = val.getValue();
18340
										var custumFunc = rec.SelectFunction;
18341
										if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
18342
											Ext.Ajax.request({
18343
												async: false,
18344
												method: 'POST',
18345
												url: '/UserControl/GetStore',
18346
												params: {
18347
													tableName: 'PCMFUNC',
18348
													param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
18349
												},
18350
												success: function (response) {
18351
													var results = Ext.decode(response.responseText);
18352
													var dt = results.data[0];
18353
													if (dt != undefined) {
18354
														custumFunc = dt.FunctionCode;
18355
													}
18356
												}
18357
											});
18358
										}
18359
										if (custumFunc) {
18360
											eval(custumFunc)
18361
										}
18362
									}
18363
								}
18364
							}
18365
						});
18366
						break
18367
					default:
18368
						if (rec.DataRef == 'CREATEBY' || rec.DataRef == 'CHANGEBY' || rec.DataRef == 'CREATEDT' || rec.DataRef == 'CHANGEDT') {
18369
							cols.push({
18370
								text: rec.HeaderTitle,
18371
								dataIndex: rec.FieldName,
18372
								width: 100,
18373
								isSummary: isSum,
18374
								filter: {
18375
									type: 'string',
18376
									itemDefaults: {
18377
										emptyText: 'Search for...'
18378
									}
18379
								}
18380
							});
18381
						} else if (rec.SearchType == '0') {
18382
							var valueField = null;
18383
							var displayValue = null;
18384
							var TableRef = undefined;
18385
							if (rec.TableRef != '') {
18386
								TableRef = rec.TableRef;
18387
								Ext.Ajax.request({
18388
									async: false,
18389
									method: 'POST',
18390
									url: '/UserControl/GetStore',
18391
									params: {
18392
										tableName: 'SDATATABLEFIELD',
18393
										param: 'TableName[equal]' + rec.TableRef
18394
									},
18395
									success: function (response) {
18396
										var results = Ext.decode(response.responseText);
18397
										data_ = results.data;
18398
										if (data_ != undefined) {
18399
											valueField_ = $.grep(data_, function (r) {
18400
													return r.ValueField == '1'
18401
												});
18402
											valueField = valueField_[0].FieldName
18403
												displayValue_ = $.grep(data_, function (r) {
18404
													return r.DisplayValue == '1'
18405
												});
18406
											displayValue = displayValue_[0].FieldName
18407
										}
18408
									}
18409
								});
18410
							}
18411
							Ext.create('Ext.data.Store', {
18412
								storeId: 'store_' + me.tableName + rec.FieldName,
18413
								autoLoad: true,
18414
								proxy: {
18415
									method: 'POST',
18416
									type: 'ajax',
18417
									url: '/UserControl/GetStoreAuth',
18418
									extraParams: {
18419
										tableName: TableRef,
18420
										param: rec.ParamCombo,
18421
										menuId: MinovaUtil.GetMenuID()
18422
									},
18423
									reader: {
18424
										type: 'json',
18425
										root: 'data',
18426
										totalProperty: 'data[0].TotalCount'
18427
									}
18428
								}
18429
							});
18430
							cols.push({
18431
								xtype: 'minovacombocolumn',
18432
								hidden: Hidden_,
18433
								text: rec.HeaderTitle,
18434
								dataIndex: rec.FieldName,
18435
								valueField: valueField,
18436
								displayField: displayValue,
18437
								store: 'store_' + me.tableName + rec.FieldName,
18438
								isSummary: isSum,
18439
								autoSizeColumn: true,
18440
								width: 200,
18441
								editor: {
18442
									allowBlank: null_,
18443
									xtype: 'combobox',
18444
									readOnly: ReadOnly_,
18445
									id: tableName + rec.FieldName,
18446
									valueField: valueField,
18447
									displayField: displayValue,
18448
									store: 'store_' + me.tableName + rec.FieldName,
18449
									listeners: {
18450
										change: function (val) {
18451
											var fvalue = val.getValue();
18452
											var custumFunc = rec.SelectFunction;
18453
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
18454
												Ext.Ajax.request({
18455
													async: false,
18456
													method: 'POST',
18457
													url: '/UserControl/GetStore',
18458
													params: {
18459
														tableName: 'PCMFUNC',
18460
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
18461
													},
18462
													success: function (response) {
18463
														var results = Ext.decode(response.responseText);
18464
														var dt = results.data[0];
18465
														if (dt != undefined) {
18466
															custumFunc = dt.FunctionCode;
18467
														}
18468
													}
18469
												});
18470
											}
18471
											if (custumFunc) {
18472
												eval(custumFunc)
18473
											}
18474
										}
18475
									}
18476
								},
18477
								filter: {
18478
									type: 'list',
18479
									itemDefaults: {
18480
										emptyText: 'Search for...'
18481
									}
18482
								}
18483
							});
18484
						} else if (rec.SearchType == '2') {
18485
							var triger = (rec.TriggerCombo).split('$');
18486
							var targetField_ = triger[0];
18487
							var fieldValue_ = triger[1];
18488
							cols.push({
18489
								text: rec.HeaderTitle,
18490
								hidden: Hidden_,
18491
								dataIndex: rec.FieldName,
18492
								isSummary: isSum,
18493
								filter: {
18494
									itemDefaults: {
18495
										emptyText: 'Search for...'
18496
									}
18497
								},
18498
								autoSizeColumn: true,
18499
								width: 200,
18500
								editor: {
18501
									allowBlank: null_,
18502
									xtype: 'minovalookupgrid',
18503
									readOnly: ReadOnly_,
18504
									isGrid: true,
18505
									fieldTarget: targetField_,
18506
									fieldValue: fieldValue_,
18507
									isGrid: true,
18508
									id: tableName + rec.FieldName,
18509
									tableName: rec.TableRef,
18510
									triggerCls: 'x-form-search-trigger',
18511
									vtype: 'alphanum',
18512
									listeners: {
18513
										change: function (val) {
18514
											var custumFunc = rec.SelectFunction;
18515
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
18516
												Ext.Ajax.request({
18517
													async: false,
18518
													method: 'POST',
18519
													url: '/UserControl/GetStore',
18520
													params: {
18521
														tableName: 'PCMFUNC',
18522
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
18523
													},
18524
													success: function (response) {
18525
														var results = Ext.decode(response.responseText);
18526
														var dt = results.data[0];
18527
														if (dt != undefined) {
18528
															custumFunc = dt.FunctionCode;
18529
														}
18530
													}
18531
												});
18532
											}
18533
											if (custumFunc) {
18534
												eval(custumFunc)
18535
											}
18536
										}
18537
									}
18538
								}
18539
							});
18540
						} else if (rec.SearchType == '3') {
18541
							cols.push({
18542
								text: rec.HeaderTitle,
18543
								hidden: Hidden_,
18544
								dataIndex: rec.FieldName,
18545
								isSummary: isSum,
18546
								filter: {
18547
									itemDefaults: {
18548
										emptyText: 'Search for...'
18549
									}
18550
								},
18551
								autoSizeColumn: true,
18552
								width: 200,
18553
								editor: {
18554
									allowBlank: null_,
18555
									xtype: 'MinovaLookupTree',
18556
									readOnly: ReadOnly_,
18557
									id: tableName + rec.FieldName,
18558
									tableName: rec.TableRef,
18559
									triggerCls: 'x-form-search-trigger',
18560
									vtype: 'alphanum',
18561
									treeSructure: rec.SearchFunction,
18562
									objClassValue: rec.ParamCombo,
18563
									listeners: {
18564
										change: function (val) {
18565
											var custumFunc = rec.SelectFunction;
18566
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
18567
												Ext.Ajax.request({
18568
													async: false,
18569
													method: 'POST',
18570
													url: '/UserControl/GetStore',
18571
													params: {
18572
														tableName: 'PCMFUNC',
18573
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
18574
													},
18575
													success: function (response) {
18576
														var results = Ext.decode(response.responseText);
18577
														var dt = results.data[0];
18578
														if (dt != undefined) {
18579
															custumFunc = dt.FunctionCode;
18580
														}
18581
													}
18582
												});
18583
											}
18584
											if (custumFunc) {
18585
												eval(custumFunc)
18586
											}
18587
										}
18588
									}
18589
								}
18590
							});
18591
						} 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) {
18592
							var triger = (rec.TriggerCombo).split('&');
18593
							var targetField_ = triger[0];
18594
							var fieldValue_ = triger[0];
18595
							cols.push({
18596
								text: rec.HeaderTitle,
18597
								hidden: Hidden_,
18598
								dataIndex: rec.FieldName,
18599
								isSummary: isSum,
18600
								filter: {
18601
									itemDefaults: {
18602
										emptyText: 'Search for...'
18603
									}
18604
								},
18605
								autoSizeColumn: true,
18606
								width: 200,
18607
								editor: {
18608
									allowBlank: null_,
18609
									xtype: 'lookupemployee',
18610
									readOnly: ReadOnly_,
18611
									isGrid: true,
18612
									fieldTarget: targetField_,
18613
									fieldValue: fieldValue_,
18614
									isGrid: true,
18615
									id: tableName + rec.FieldName,
18616
									tableName: rec.TableRef,
18617
									triggerCls: 'x-form-search-trigger',
18618
									vtype: 'alphanum',
18619
									listeners: {
18620
										change: function (val) {
18621
											var custumFunc = rec.SelectFunction;
18622
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
18623
												Ext.Ajax.request({
18624
													async: false,
18625
													method: 'POST',
18626
													url: '/UserControl/GetStore',
18627
													params: {
18628
														tableName: 'PCMFUNC',
18629
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
18630
													},
18631
													success: function (response) {
18632
														var results = Ext.decode(response.responseText);
18633
														var dt = results.data[0];
18634
														if (dt != undefined) {
18635
															custumFunc = dt.FunctionCode;
18636
														}
18637
													}
18638
												});
18639
											}
18640
											if (custumFunc) {
18641
												eval(custumFunc)
18642
											}
18643
										}
18644
									}
18645
								}
18646
							});
18647
						} else if (rec.SearchType == '4' && isLookup != true) {
18648
							cols.push({
18649
								text: rec.HeaderTitle,
18650
								hidden: Hidden_,
18651
								dataIndex: rec.FieldName,
18652
								isSummary: isSum,
18653
								filter: {
18654
									itemDefaults: {
18655
										emptyText: 'Search for...'
18656
									}
18657
								},
18658
								autoSizeColumn: true,
18659
								width: 200,
18660
								editor: {
18661
									allowBlank: null_,
18662
									xtype: 'lookupemployee',
18663
									readOnly: ReadOnly_,
18664
									isGrid: true,
18665
									fieldTarget: targetField_,
18666
									fieldValue: fieldValue_,
18667
									isGrid: true,
18668
									id: tableName + rec.FieldName,
18669
									tableName: rec.TableRef,
18670
									triggerCls: 'x-form-search-trigger',
18671
									vtype: 'alphanum',
18672
									listeners: {
18673
										change: function (val) {
18674
											var custumFunc = rec.SelectFunction;
18675
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
18676
												Ext.Ajax.request({
18677
													async: false,
18678
													method: 'POST',
18679
													url: '/UserControl/GetStore',
18680
													params: {
18681
														tableName: 'PCMFUNC',
18682
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
18683
													},
18684
													success: function (response) {
18685
														var results = Ext.decode(response.responseText);
18686
														var dt = results.data[0];
18687
														if (dt != undefined) {
18688
															custumFunc = dt.FunctionCode;
18689
														}
18690
													}
18691
												});
18692
											}
18693
											if (custumFunc) {
18694
												eval(custumFunc)
18695
											}
18696
										}
18697
									}
18698
								}
18699
							});
18700
						} else if (rec.FixedValue != '') {
18701
							cols.push({
18702
								text: rec.HeaderTitle,
18703
								hidden: Hidden_,
18704
								dataIndex: rec.FieldName,
18705
								isSummary: isSum,
18706
								filter: {
18707
									itemDefaults: {
18708
										emptyText: 'Search for...'
18709
									}
18710
								},
18711
								autoSizeColumn: true,
18712
								width: 200,
18713
								editor: {
18714
									allowBlank: null_,
18715
									xtype: 'minovafixvalue',
18716
									readOnly: ReadOnly_,
18717
									id: tableName + rec.FieldName,
18718
									nameTable: tableName,
18719
									fieldGrid: rec.FieldName,
18720
									fixedValue: rec.FixedValue,
18721
									valueField: 'code',
18722
									displayField: 'desc',
18723
									value: defaultValue
18724
								},
18725
								renderer: function (value) {
18726
									var val = "";
18727
									var storeData = [];
18728
									var str = rec.FixedValue;
18729
									var hasil = str.split('||');
18730
									hasil.forEach(function (h) {
18731
										store_ = h.split('=')
18732
											storeData.push({
18733
												code: store_[0],
18734
												desc: store_[1]
18735
											});
18736
									});
18737
									var item = storeData.find(x => x.code == value);
18738
									if (item != undefined) {
18739
										val = item.desc;
18740
									}
18741
									return val;
18742
								}
18743
							});
18744
						} else if (rec.FieldDataType == 3) {
18745
							cols.push({
18746
								text: rec.HeaderTitle,
18747
								hidden: Hidden_,
18748
								dataIndex: rec.FieldName,
18749
								isSummary: isSum,
18750
								filter: {
18751
									itemDefaults: {
18752
										emptyText: 'Search for...'
18753
									}
18754
								},
18755
								autoSizeColumn: true,
18756
								width: 200,
18757
								editor: {
18758
									allowBlank: null_,
18759
									xtype: 'textfield',
18760
									readOnly: ReadOnly_,
18761
									id: tableName + rec.FieldName,
18762
									nameTable: rec.TableName,
18763
									fieldGrid: rec.FieldName,
18764
									vtype: 'validateDecimal',
18765
									maxLength: rec.Length,
18766
									precision: rec.Prec,
18767
									fieldStyle: 'text-align:right;',
18768
									value: defaultValue,
18769
									listeners: {
18770
										change: function (val) {
18771
											var custumFunc = rec.SelectFunction;
18772
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
18773
												Ext.Ajax.request({
18774
													async: false,
18775
													method: 'POST',
18776
													url: '/UserControl/GetStore',
18777
													params: {
18778
														tableName: 'PCMFUNC',
18779
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
18780
													},
18781
													success: function (response) {
18782
														var results = Ext.decode(response.responseText);
18783
														var dt = results.data[0];
18784
														if (dt != undefined) {
18785
															custumFunc = dt.FunctionCode;
18786
														}
18787
													}
18788
												});
18789
											}
18790
											if (custumFunc) {
18791
												eval(custumFunc)
18792
											}
18793
										}
18794
									}
18795
								}
18796
							});
18797
						} else {
18798
							cols.push({
18799
								text: rec.HeaderTitle,
18800
								hidden: Hidden_,
18801
								dataIndex: rec.FieldName,
18802
								isSummary: isSum,
18803
								filter: {
18804
									itemDefaults: {
18805
										emptyText: 'Search for...'
18806
									}
18807
								},
18808
								autoSizeColumn: true,
18809
								width: 200,
18810
								editor: {
18811
									allowBlank: null_,
18812
									xtype: 'textfield',
18813
									readOnly: ReadOnly_,
18814
									id: tableName + rec.FieldName,
18815
									value: defaultValue,
18816
									listeners: {
18817
										change: function (val) {
18818
											var custumFunc = rec.SelectFunction;
18819
											if (custumFunc.toLowerCase().substring(0, 2) == 'fn') {
18820
												Ext.Ajax.request({
18821
													async: false,
18822
													method: 'POST',
18823
													url: '/UserControl/GetStore',
18824
													params: {
18825
														tableName: 'PCMFUNC',
18826
														param: 'FuncName[equal]' + custumFunc + ',Active[=]1'
18827
													},
18828
													success: function (response) {
18829
														var results = Ext.decode(response.responseText);
18830
														var dt = results.data[0];
18831
														if (dt != undefined) {
18832
															custumFunc = dt.FunctionCode;
18833
														}
18834
													}
18835
												});
18836
											}
18837
											if (custumFunc) {
18838
												eval(custumFunc)
18839
											}
18840
										}
18841
									}
18842
								}
18843
							});
18844
						}
18845
						break
18846
					}
18847
				} else {
18848
					cols.push({
18849
						text: rec.HeaderTitle,
18850
						hidden: Hidden_,
18851
						dataIndex: rec.FieldName,
18852
						isSummary: isSum,
18853
						hidden: true,
18854
						editor: {
18855
							allowBlank: true,
18856
							xtype: 'textfield',
18857
							readOnly: ReadOnly_,
18858
							id: tableName + rec.FieldName,
18859
							value: defaultValue
18860
						},
18861
						filter: {
18862
							itemDefaults: {
18863
								emptyText: 'Search for...'
18864
							}
18865
						}
18866
					});
18867
				}
18868
			});
18869
		};
18870
		addData = addData + "})";
18871
		Ext.applyIf(me, {
18872
			items: [{
18873
					xtype: 'grid',
18874
					autoScroll: true,
18875
					id: gridName,
18876
					name: gridName,
18877
					height: height,
18878
					store: Ext.create('Ext.data.Store', {
18879
						storeId: storeID,
18880
						fields: fieldStore,
18881
						proxy: {
18882
							method: 'POST',
18883
							type: 'ajax',
18884
							url: '',
18885
							reader: {
18886
								type: 'json',
18887
								root: 'data'
18888
							}
18889
						}
18890
					}),
18891
					dockedItems: [{
18892
							xtype: 'toolbar',
18893
							items: [{
18894
									text: 'Add',
18895
									hidden: hide_,
18896
									name: 'add' + tableName,
18897
									iconCls: 'fa-plus-circle',
18898
									style: 'font-family: FontAwesome',
18899
									handler: function () {
18900
										var store = Ext.StoreMgr.lookup(storeID);
18901
										var data = eval(addData);
18902
										if (me.transType == "FIN") {
18903
											var fp = Ext.ComponentQuery.query("[name=FiscalPeriod]")[0].getValue();
18904
											var fy = Ext.ComponentQuery.query("[name=FiscalYear]")[0].getValue();
18905
											var cp = Ext.ComponentQuery.query("[name=CompanyID]")[0].getValue();
18906
											var bu = Ext.ComponentQuery.query("[name=BusinessUnit]")[0].getValue();
18907
											data["FiscalPeriod"] = fp;
18908
											data["FiscalYear"] = fy;
18909
											data["CompanyID"] = cp;
18910
											data["BusinessUnit"] = bu;
18911
										}
18912
										idx = store.getCount();
18913
										store.insert(idx, data);
18914
									}
18915
								}, {
18916
									text: 'Delete',
18917
									hidden: hide_,
18918
									name: 'delete' + tableName,
18919
									iconCls: 'fa-trash-o',
18920
									style: 'font-family: FontAwesome',
18921
									handler: function () {
18922
										var me = this,
18923
										store = Ext.StoreMgr.lookup(storeID)
18924
											var grid = Ext.getCmp(gridName);
18925
										Ext.MessageBox.show({
18926
											title: 'Remove tab',
18927
											msg: "This will remove. Do you want to continue?",
18928
											buttons: Ext.MessageBox.YESNO,
18929
											fn: function (choice) {
18930
												console.log(choice);
18931
												if (choice === 'yes') {
18932
													var selection = grid.getView().getSelectionModel().getSelection()[0];
18933
													if (selection) {
18934
														store.remove(selection);
18935
													}
18936
												}
18937
											}
18938
										});
18939
									}
18940
								}
18941
							]
18942
						}
18943
					],
18944
					columns: cols,
18945
					selType: 'cellmodel',
18946
					plugins: [
18947
						Ext.create('Ext.grid.plugin.CellEditing', {
18948
							clicksToEdit: 1
18949
						})
18950
					],
18951
					viewConfig: {
18952
						listeners: {
18953
							refresh: function (dataview) {
18954
								console.log(dataview);
18955
								Ext.each(dataview.panel.columns, function (column) {
18956
									if (column.autoSizeColumn === true)
18957
										column.autoSize();
18958
								})
18959
							}
18960
						}
18961
					},
18962
					listeners: {
18963
						'edit': function (editor, e, eOpts) {
18964
							var grid = Ext.ComponentQuery.query('[name=' + gridName + ']')[0];
18965
							var fField = e.field;
18966
							if (e.column.isSummary == '1') {
18967
								var fldValue = 0;
18968
								Ext.each(grid.store.getRange(), function (r) {
18969
									var fValue = r.data[fField];
18970
									fldValue = fldValue + parseFloat(fValue);
18971
								});
18972
								var sumPanel = Ext.ComponentQuery.query('[name=SUM' + tableName + ']')[0];
18973
								var sumForm = sumPanel.getForm();
18974
								fldValue = Ext.util.Format.number(fldValue, '0,000.00');
18975
								sumForm.findField(fField).setValue(fldValue);
18976
							}
18977
						}
18978
					}
18979
				}
18980
			]
18981
		});
18982
		me.callParent(arguments);
18983
	}
18984
});
18985
Ext.define('MinovaUtil.MinovaES.LookupDoc', {
18986
	extend: 'Ext.window.Window',
18987
	alias: 'widget.lookupdocument',
18988
	requires: [],
18989
	height: '87%',
18990
	width: '41%',
18991
	minWidth: '50%',
18992
	maxWidth: '100%',
18993
	bodyPadding: 0,
18994
	formname: undefined,
18995
	name: 'LookupDocumentTrans',
18996
	test: undefined,
18997
	vtype: 'validateMinovaXss',
18998
	targetField: undefined,
18999
	valueField: undefined,
19000
	tableName: undefined,
19001
	LookupFunction: undefined,
19002
	isGrid: undefined,
19003
	listeners: {
19004
		afterrender: function (f) {
19005
			f.setTitle('Lookup - Document');
19006
		}
19007
	},
19008
	initComponent: function () {
19009
		var me = this;
19010
		var targetField_ = me.targetField;
19011
		var valueField_ = me.valueField;
19012
		var form = me.test;
19013
		var tableName_ = me.tableName;
19014
		var isGrid = me.isGrid_;
19015
		var LookupFunction = me.LookupFunction;
19016
		param_ = null;
19017
		var filterParam_ = me.filterParam;
19018
		var fieldLabel_ = 'Document No';
19019
		Ext.applyIf(me, {
19020
			items: [{
19021
					items: [{
19022
							xtype: 'tabpanel',
19023
							items: [{
19024
									xtype: 'form',
19025
									title: 'Quick Search',
19026
									height: '70%',
19027
									items: [{
19028
											xtype: 'form',
19029
											name: 'frmSearch',
19030
											width: '100%',
19031
											height: 'auto',
19032
											dockedItems: [{
19033
													xtype: 'toolbar',
19034
													dock: 'top',
19035
													layout: 'vbox',
19036
													bodyPadding: 10,
19037
													border: 0,
19038
													items: [{
19039
															xtype: 'fieldset',
19040
															layout: 'hbox',
19041
															width: '100%',
19042
															border: 0,
19043
															padding: 0,
19044
															items: [{
19045
																	xtype: 'textfield',
19046
																	name: 'DocSearch',
19047
																	fieldLabel: fieldLabel_,
19048
																	width: 470,
19049
																	labelWidth: 185,
19050
																	enableKeyEvents: true,
19051
																	filterParam: filterParam_,
19052
																	listeners: {
19053
																		specialkey: function (f, e) {
19054
																			if (e.getKey() == e.ENTER) {
19055
																				var doc = Ext.ComponentQuery.query('[name=DocSearch]')[0];
19056
																				var docNo = doc.getValue();
19057
																				var store = Ext.data.StoreManager.lookup('storeQC');
19058
																				param_ = 'DocNo[like]' + docNo
19059
																					if (this.filterParam) {
19060
																						param_ = param_ + ',' + this.filterParam_
19061
																					}
19062
																					store.proxy.extraParams = {
19063
																					tableName: tableName_,
19064
																					param: param_,
19065
																					menuId: MinovaUtil.GetMenuID()
19066
																				};
19067
																				store.removeAll();
19068
																				store.reload();
19069
																				store.loadPage(1);
19070
																			}
19071
																		}
19072
																	}
19073
																}, {
19074
																	xtype: 'tbspacer',
19075
																	width: 5
19076
																}, {
19077
																	xtype: 'button',
19078
																	name: 'Search',
19079
																	text: 'Search',
19080
																	filterParam: filterParam_,
19081
																	handler: function () {
19082
																		var doc = Ext.ComponentQuery.query('[name=DocSearch]')[0];
19083
																		var docNo = doc.getValue();
19084
																		var store = Ext.data.StoreManager.lookup('storeQC');
19085
																		param_ = 'DocNo[like]' + docNo
19086
																			if (this.filterParam) {
19087
																				param_ = param_ + ',' + this.filterParam
19088
																			}
19089
																			store.proxy.extraParams = {
19090
																			tableName: tableName_,
19091
																			param: param_,
19092
																			menuId: MinovaUtil.GetMenuID()
19093
																		};
19094
																		store.removeAll();
19095
																		store.reload();
19096
																		store.loadPage(1);
19097
																	}
19098
																}
19099
															]
19100
														}
19101
													]
19102
												}
19103
											]
19104
										}, {
19105
											items: [{
19106
													xtype: "minovagrid1",
19107
													name: "GridDocNo",
19108
													storename: 'storeQC',
19109
													tableName: tableName_,
19110
													param: this.filterParam,
19111
													isLookup: true,
19112
													pagesize: 25,
19113
													height: 398,
19114
													LookupFunction: LookupFunction,
19115
													valueField: valueField_,
19116
													targetField: targetField_,
19117
													isGrid: true,
19118
													listeners: {
19119
														beforeedit: function () {
19120
															return false;
19121
														},
19122
														itemdblclick: function () {
19123
															var grid = Ext.ComponentQuery.query('[name=GridDocNo]')[0];
19124
															var selection = grid.getView().getSelectionModel().getSelection()[0];
19125
															var documentno = selection.data.DocNo;
19126
															LookupFunction = this.LookupFunction;
19127
															eval(LookupFunction);
19128
															var target = Ext.ComponentQuery.query('[name=LookupDocumentTrans]')[0].targetField;
19129
															Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(documentno);
19130
															Ext.ComponentQuery.query('[name=LookupDocumentTrans]')[0].hide();
19131
														}
19132
													},
19133
												}, {
19134
													xtype: 'pagingtoolbar',
19135
													store: 'storeQC',
19136
													dock: 'bottom',
19137
													displayInfo: true
19138
												}
19139
											]
19140
										}
19141
									]
19142
								}, {
19143
									title: 'Advance Search',
19144
									items: [{
19145
											xtype: 'form',
19146
											name: 'formlookup',
19147
											items: [{
19148
													xtype: 'minovaform',
19149
													name: 'frmlookup',
19150
													tableName: tableName_,
19151
													param: filterParam_,
19152
													isLookup: true,
19153
													buttons: [{
19154
															text: 'Search',
19155
															filterParam: filterParam_,
19156
															listeners: {
19157
																click: function () {
19158
																	var store = Ext.data.StoreManager.lookup('storeadvance');
19159
																	var form = Ext.ComponentQuery.query('[name=formlookup]')[0].getForm();
19160
																	grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
19161
																	var values_ = form.getValues();
19162
																	var fields_ = form.getFields().items;
19163
																	var param_ = '';
19164
																	for (var i = 0; i < fields_.length; i++) {
19165
																		var val_ = form.getFields().items[i].getValue();
19166
																		var xtype_ = form.getFields().items[i].xtype;
19167
																		var oprator_ = '[like]';
19168
																		if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
19169
																			oprator_ = '[Equal]';
19170
																		}
19171
																		if (xtype_ == 'datefield') {
19172
																			if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
19173
																				oprator_ = '[LessThanEqual]';
19174
																			} else {
19175
																				oprator_ = '[GreaterThanEqual]';
19176
																			}
19177
																		}
19178
																		if (val_ != 'undefined' && val_ != "" && val_ != null) {
19179
																			param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
19180
																		}
19181
																	}
19182
																	if (this.filterParam_) {
19183
																		param_ = param_ + ',' + this.filterParam_
19184
																	}
19185
																	store.proxy.extraParams = {
19186
																		tableName: grid.tableName,
19187
																		param: param_,
19188
																		menuId: MinovaUtil.GetMenuID()
19189
																	};
19190
																	store.removeAll();
19191
																	store.reload();
19192
																	store.loadPage(1);
19193
																}
19194
															}
19195
														}
19196
													]
19197
												}, {
19198
													xtype: 'minovagrid1',
19199
													name: 'gridlookup',
19200
													minHeight: 312,
19201
													height: 290,
19202
													tableName: tableName_,
19203
													param: this.filterParam,
19204
													isLookup: true,
19205
													storename: 'storeadvance',
19206
													pagesize: 25,
19207
													valueField: valueField_,
19208
													targetField: targetField_,
19209
													hidebutton: 0,
19210
													isGrid: true,
19211
													listeners: {
19212
														beforeedit: function () {
19213
															return false;
19214
														},
19215
														itemdblclick: function () {
19216
															var grid = Ext.ComponentQuery.query('[name=gridlookup]')[0];
19217
															var selection = grid.getView().getSelectionModel().getSelection()[0];
19218
															var documentno = selection.data.DocNo;
19219
															LookupFunction = this.LookupFunction;
19220
															eval(LookupFunction);
19221
															var target = Ext.ComponentQuery.query('[name=LookupDocumentTrans]')[0].targetField;
19222
															Ext.ComponentQuery.query('[name=' + target + ']')[0].setValue(documentno);
19223
															Ext.ComponentQuery.query('[name=LookupDocumentTrans]')[0].hide();
19224
														}
19225
													},
19226
													dockedItems: [{
19227
															xtype: 'pagingtoolbar',
19228
															store: 'storeadvance',
19229
															dock: 'bottom',
19230
															displayInfo: true
19231
														}
19232
													]
19233
												}
19234
											]
19235
										}
19236
									]
19237
								}
19238
							]
19239
						}
19240
					]
19241
				}
19242
			]
19243
		});
19244
		me.callParent(arguments);
19245
	}
19246
});
19247
Ext.define('MinovaUtil.MinovaES.MinovaSummaryDocForm', {
19248
	extend: 'Ext.form.Panel',
19249
	alias: ['widget.summarydocform'],
19250
	formname: this.name,
19251
	tableName: undefined,
19252
	docType: undefined,
19253
	transType: undefined,
19254
	resizable: true,
19255
	border: false,
19256
	autoScroll: true,
19257
	layout: 'column',
19258
	defaults: {
19259
		layout: 'form',
19260
		xtype: 'container',
19261
		defaultType: 'textfield',
19262
		style: 'width: 50%',
19263
	},
19264
	initComponent: function () {
19265
		var me = this;
19266
		var col1 = [];
19267
		var col2 = [];
19268
		var LangID = localStorage.LangId;
19269
		var parameter = "LangID='" + LangID + "',TableName='" + me.tableName + "',DocType='" + me.docType + "',IsSummary=1";
19270
		var formname_ = me.name;
19271
		var nameTable_ = me.tableName;
19272
		Ext.Ajax.request({
19273
			async: false,
19274
			method: 'POST',
19275
			url: '/UserControl/GetStore',
19276
			params: {
19277
				tableName: 'PDSDOCFIELD',
19278
				param: parameter
19279
			},
19280
			success: function (response) {
19281
				var results = Ext.decode(response.responseText);
19282
				hasil = results.data;
19283
			}
19284
		});
19285
		if (hasil.length > 0) {
19286
			Ext.each(hasil, function (rec) {
19287
				var formfield = MinovaUtil.FieldGenerator.Form(me.name, rec, false, true, me.tableName, false);
19288
				var descField = undefined;
19289
				if (rec.ColumnNo == 1) {
19290
					col1.push(formfield);
19291
					if (descField) {
19292
						col1.push(descField)
19293
					}
19294
				} else {
19295
					col2.push(formfield);
19296
					if (descField) {
19297
						col2.push(descField)
19298
					}
19299
				}
19300
			});
19301
		}
19302
		Ext.applyIf(me, {
19303
			items: [{
19304
					style: 'width: 50%',
19305
					items: col1
19306
				}, {
19307
					style: 'width: 50%',
19308
					items: col2
19309
				}
19310
			]
19311
		});
19312
		this.callParent();
19313
	}
19314
});
19315
Ext.define('MinovaUtil.MinovaES.LookupDocRef', {
19316
	extend: 'Ext.window.Window',
19317
	alias: 'widget.lookupdocumentref',
19318
	requires: [],
19319
	height: '87%',
19320
	width: '41%',
19321
	minWidth: '50%',
19322
	maxWidth: '100%',
19323
	bodyPadding: 0,
19324
	formname: undefined,
19325
	name: 'LookupDocRef',
19326
	test: undefined,
19327
	vtype: 'validateMinovaXss',
19328
	targetField: undefined,
19329
	valueField: undefined,
19330
	tableName: 'PDSDOCREF',
19331
	transType: undefined,
19332
	docType: undefined,
19333
	LookupFunction: undefined,
19334
	datarecord: undefined,
19335
	isGrid: undefined,
19336
	filterParam: undefined,
19337
	listeners: {
19338
		afterrender: function (f) {
19339
			f.setTitle('Lookup - Document');
19340
		}
19341
	},
19342
	initComponent: function () {
19343
		var me = this;
19344
		var targetField_ = me.targetField;
19345
		var valueField_ = me.valueField;
19346
		var form = me.test;
19347
		var tableName_ = me.tableName;
19348
		var isGrid = me.isGrid_;
19349
		var LookupFunction = me.LookupFunction;
19350
		param_ = null;
19351
		var filterParam_ = me.filterParam;
19352
		var compselect = "";
19353
		var buselect = "";
19354
		Ext.applyIf(me, {
19355
			items: [{
19356
					xtype: 'form',
19357
					name: 'formlookup',
19358
					items: [{
19359
							xtype: 'minovaform',
19360
							name: 'frmlookup',
19361
							tableName: tableName_,
19362
							param: filterParam_,
19363
							isLookup: true,
19364
							buttons: [{
19365
									text: 'Search',
19366
									filterParam: filterParam_,
19367
									listeners: {
19368
										click: function () {
19369
											var store = Ext.data.StoreManager.lookup('storeadvance');
19370
											var form = Ext.ComponentQuery.query('[name=formlookup]')[0].getForm();
19371
											grid = Ext.ComponentQuery.query('[name=gridlookupdocref]')[0];
19372
											var values_ = form.getValues();
19373
											var fields_ = form.getFields().items;
19374
											var param_ = '';
19375
											for (var i = 0; i < fields_.length; i++) {
19376
												var val_ = form.getFields().items[i].getValue();
19377
												var xtype_ = form.getFields().items[i].xtype;
19378
												var oprator_ = '[like]';
19379
												if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox') {
19380
													oprator_ = '[Equal]';
19381
												}
19382
												if (xtype_ == 'datefield') {
19383
													if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
19384
														oprator_ = '[LessThanEqual]';
19385
													} else {
19386
														oprator_ = '[GreaterThanEqual]';
19387
													}
19388
												}
19389
												if (val_ != 'undefined' && val_ != "" && val_ != null) {
19390
													param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
19391
												}
19392
											}
19393
											if (filterParam_) {
19394
												param_ = param_ + ',' + filterParam_
19395
											}
19396
											store.proxy.extraParams = {
19397
												tableName: grid.tableName,
19398
												param: param_,
19399
												menuId: MinovaUtil.GetMenuID()
19400
											};
19401
											store.removeAll();
19402
											store.reload();
19403
											store.loadPage(1);
19404
										}
19405
									}
19406
								}
19407
							]
19408
						}, {
19409
							xtype: 'minovagrid1',
19410
							name: 'gridlookupdocref',
19411
							minHeight: 312,
19412
							height: 290,
19413
							tableName: tableName_,
19414
							param: this.filterParam,
19415
							isLookup: true,
19416
							storename: 'storeadvance',
19417
							pagesize: 25,
19418
							valueField: valueField_,
19419
							targetField: targetField_,
19420
							multiSelect: true,
19421
							hidebutton: 0,
19422
							isGrid: true,
19423
							listeners: {
19424
								beforeedit: function () {
19425
									return false;
19426
								},
19427
								itemdblclick: function () {},
19428
								select: function (t, record, index, eOpts) {
19429
									if (compselect !== "") {
19430
										if (compselect !== record.data.CompanyID) {
19431
											MinovaMessageError("", "FILO06", "");
19432
											return;
19433
										}
19434
									}
19435
									if (buselect !== "") {
19436
										if (buselect !== record.data.BusinessUnit) {
19437
											MinovaMessageError("", "FILO07", "");
19438
											return;
19439
										}
19440
									}
19441
									compselect = record.data.CompanyID;
19442
									buselect = record.data.BusinessUnit;
19443
								}
19444
							},
19445
							dockedItems: [{
19446
									xtype: 'pagingtoolbar',
19447
									store: 'storeadvance',
19448
									dock: 'bottom',
19449
									displayInfo: true
19450
								}, {
19451
									xtype: 'button',
19452
									name: 'select',
19453
									text: 'Select',
19454
									dock: 'bottom'
19455
								}
19456
							]
19457
						}
19458
					]
19459
				}
19460
			]
19461
		});
19462
		me.callParent(arguments);
19463
	}
19464
});
(9-9/9)