1
|
Ext.define('MinovaES.controller.performance.controllerperformance', {
|
2
|
//extend: 'MinovaES.controller.masterdata.basemasterdata',
|
3
|
extend : 'Ext.app.ViewController',
|
4
|
alias : 'controller.performancemaintenance-controller',
|
5
|
init : function () {
|
6
|
this.control({
|
7
|
'[name=addPerformance]' : {
|
8
|
click : this.addPerformance,
|
9
|
},
|
10
|
'[name=editPerformance]' : {
|
11
|
click : this.editPerformance,
|
12
|
},
|
13
|
'[name=cancelPerformance]' : {
|
14
|
click : this.cancelPerformance,
|
15
|
},
|
16
|
'[name=PA0047]' : {
|
17
|
itemdblclick : this.editPerformance,
|
18
|
afterrender : this.afterRenderOverview
|
19
|
},
|
20
|
'[name=savePerformance]' : {
|
21
|
click : this.savePerformance,
|
22
|
},
|
23
|
'[name=gotoother]' : {
|
24
|
click : this.btnGoToother
|
25
|
},
|
26
|
'[name=deletePerformance]' : {
|
27
|
click : this.deletePerformance,
|
28
|
},
|
29
|
'[name=AppraisalType]' : {
|
30
|
select : this.createGridDetail,
|
31
|
},
|
32
|
'[name=gridPHRPA0048]' : {
|
33
|
itemdblclick : this.addAppraiser,
|
34
|
},
|
35
|
'[name=gridPHRPA0049]' : {
|
36
|
afteritemexpand : this.loadChild
|
37
|
},
|
38
|
/*'[name=AddKPI]' : {
|
39
|
click : this.addNewKPI
|
40
|
},*/
|
41
|
'[name=BtnCancelKPI]' : {
|
42
|
click : this.cancelAddNewKPI
|
43
|
},
|
44
|
/*'[name=BtnAddKPI]' : {
|
45
|
click : this.addNewKPI
|
46
|
},*/
|
47
|
'[name=Action]' : {
|
48
|
"onEditClick" : this.loadMenu
|
49
|
},
|
50
|
'[name=PHRPA0048Add]' : {
|
51
|
click : this.AddAppraiserQ
|
52
|
},
|
53
|
'[name=PHRPA0049Add]' : {
|
54
|
click : this.addNewKPI
|
55
|
},
|
56
|
'[name=PHRPA0051Add]' : {
|
57
|
click : this.addNewQualification
|
58
|
},
|
59
|
'[name=PHRPA0051Delete]' : {
|
60
|
click : this.deleteQualification
|
61
|
},
|
62
|
'[name=PHRPA0049Delete]' : {
|
63
|
click : this.deleteKPI
|
64
|
},
|
65
|
/*'[id=PHRPA0049Unit]': {
|
66
|
change: this.CalculateWeightedScore,
|
67
|
}*/
|
68
|
});
|
69
|
},
|
70
|
|
71
|
getRowIndex_ : function () {
|
72
|
return this.rowIndex_;
|
73
|
},
|
74
|
setRowIndex_ : function (value) {
|
75
|
var me = this;
|
76
|
me.rowIndex_ = value;
|
77
|
return me;
|
78
|
},
|
79
|
getRec : function () {
|
80
|
return this.rec;
|
81
|
},
|
82
|
setRec : function (value) {
|
83
|
var me = this;
|
84
|
me.rec = value;
|
85
|
return me;
|
86
|
},
|
87
|
|
88
|
/*CalculateWeightedScore : function () { ////-- add by Tri nwh 20220523
|
89
|
var Weight = Ext.ComponentQuery.query('[name=Weight][nameTable=PHRPA0049]')[0]; console.log(Weight.getValue);
|
90
|
var Cal = Ext.ComponentQuery.query('[id=phrpa0049WeightedScore]')[0].setValue(Weight.getValue());
|
91
|
var seq = Ext.ComponentQuery.query('[name=Sequence]')[0].getValue();
|
92
|
var pnl = Ext.ComponentQuery.query('[name=gridPHRPA0049]')[0];
|
93
|
var leafCount = 0;
|
94
|
pnl.getRootNode().cascadeBy(function (node) {
|
95
|
if (!node.isLeaf())
|
96
|
leafCount++;
|
97
|
});
|
98
|
var data = '';
|
99
|
var Sequence = 0;
|
100
|
if (leafCount == 0) {
|
101
|
Sequence = 1;
|
102
|
} else {
|
103
|
Sequence = 1 + leafCount;
|
104
|
}
|
105
|
|
106
|
|
107
|
var C = '';
|
108
|
|
109
|
data = {
|
110
|
KPIGroup : c,
|
111
|
EmployeeID : Ext.ComponentQuery.query('[name=EmployeeID]')[0].getValue(),
|
112
|
AppraisalType : Ext.ComponentQuery.query('[name=AppraisalType]')[0].getValue(),
|
113
|
KPI : Ext.ComponentQuery.query('[name=KPI]')[0].getValue(),
|
114
|
Sequence : Sequence,
|
115
|
ObjectDescription : Ext.ComponentQuery.query('[name=KPI]')[0].value.split('-')[1].substr(1),
|
116
|
SubKPI : "-",
|
117
|
HeaderSequence : seq,
|
118
|
SequenceSubKPI : "0",
|
119
|
IsSubKPI : "0",
|
120
|
leaf : false,
|
121
|
Target : 1,
|
122
|
expanded : true
|
123
|
};
|
124
|
|
125
|
var task = pnl.getRootNode();
|
126
|
task.appendChild(data);
|
127
|
},
|
128
|
},*/
|
129
|
|
130
|
afterRenderOverview : function () {
|
131
|
var overView = Ext.StoreMgr.lookup("PerformanceOverview");
|
132
|
|
133
|
overView.proxy.extraParams = {
|
134
|
tableName : 'PHRPA0047',
|
135
|
param : 'EmployeeID[=]' + getParam('EmployeeID')
|
136
|
};
|
137
|
overView.removeAll();
|
138
|
overView.reload();
|
139
|
overView.loadPage(1);
|
140
|
},
|
141
|
|
142
|
addPerformance : function () {
|
143
|
var card_ = Ext.ComponentQuery.query('[name=PerformanceCard]')[0];
|
144
|
card_.getLayout().setActiveItem(1);
|
145
|
var form_ = Ext.ComponentQuery.query('[name=mainformPerformance]')[0];
|
146
|
form_.getForm().reset();
|
147
|
form_.getForm().findField('EmployeeID').setValue(getParam('EmployeeID'));
|
148
|
var delBtn_ = Ext.ComponentQuery.query('[name=deletePerformance]')[0];
|
149
|
delBtn_.setHidden(true);
|
150
|
var grid = Ext.ComponentQuery.query('[name=formPerformanceDetail]')[0];
|
151
|
grid.removeAll();
|
152
|
//form_.setActionSubmit(0);
|
153
|
//this.setHeaderSeqEmpForm(0);
|
154
|
|
155
|
var me = this;
|
156
|
me._action = "0";
|
157
|
},
|
158
|
|
159
|
editPerformance : function () {
|
160
|
var me = Ext.ComponentQuery.query('[name=PA0047]')[0];
|
161
|
var form = Ext.ComponentQuery.query('[name=mainformPerformance]')[0]; // edit proses
|
162
|
form.setActionSubmit(1);
|
163
|
var selection = me.getView().getSelectionModel().getSelection()[0];
|
164
|
var form_ = form.getForm();
|
165
|
form_.setValues(selection.data);
|
166
|
|
167
|
var card_ = Ext.ComponentQuery.query('[name=PerformanceCard]')[0];
|
168
|
card_.getLayout().setActiveItem(1);
|
169
|
var delBtn_ = Ext.ComponentQuery.query('[name=deletePerformance]')[0];
|
170
|
delBtn_.setHidden(false);
|
171
|
|
172
|
this.setGridPerformance('1');
|
173
|
|
174
|
data = {
|
175
|
AdjustedIndex : '',
|
176
|
AdjustedScore : selection.data.AdjustedKPI,
|
177
|
CalculatedScore : selection.data.CalculatedKPI,
|
178
|
FinalScore : selection.data.KPIFinalScore,
|
179
|
IndexScore : '',
|
180
|
TotalScore : selection.data.KPITotalScore,
|
181
|
Type : 'KPI',
|
182
|
Weight : selection.data.KPITotalWeight
|
183
|
};
|
184
|
|
185
|
data2 = [];
|
186
|
data2[0] = data;
|
187
|
|
188
|
data = {
|
189
|
AdjustedIndex : '',
|
190
|
AdjustedScore : selection.data.AdjustedCompetency,
|
191
|
CalculatedScore : selection.data.CalculatedCompetency,
|
192
|
FinalScore : selection.data.QualFinalScore,
|
193
|
IndexScore : '',
|
194
|
TotalScore : selection.data.QualTotalScore,
|
195
|
Type : 'Qualification',
|
196
|
Weight : selection.data.QualTotalWeight //selection.data.QualificationPercen //// comment by Tri nwh 20220531
|
197
|
};
|
198
|
|
199
|
data2[1] = data;
|
200
|
|
201
|
var overView = Ext.StoreMgr.lookup('storePDSPMSUMMARY');
|
202
|
if (overView != undefined) {
|
203
|
overView.removeAll();
|
204
|
overView.loadData(data2);
|
205
|
}
|
206
|
|
207
|
dataTotal = {
|
208
|
AdjustedIndex : selection.data.AdjustedIndex,
|
209
|
AdjustedScore : selection.data.AdjustedScore,
|
210
|
CalculatedScore : selection.data.CalculatedScore,
|
211
|
IndexScore : selection.data.CalculatedIndex
|
212
|
};
|
213
|
|
214
|
dataTotalList = [];
|
215
|
dataTotalList[0] = dataTotal;
|
216
|
|
217
|
var overView = Ext.StoreMgr.lookup('storePDSPMSUMTOTAL');
|
218
|
if (overView != undefined) {
|
219
|
overView.removeAll();
|
220
|
overView.loadData(dataTotalList);
|
221
|
}
|
222
|
setTimeout( () =>{ //// add by Tri nwh & saswanto 20220603 agar combobox keluar description
|
223
|
var grid49 = Ext.ComponentQuery.query('[name=gridPHRPA0049]')[0];
|
224
|
grid49.getView().refresh();
|
225
|
|
226
|
var grid51 = Ext.ComponentQuery.query('[name=gridPHRPA0051]')[0];
|
227
|
grid51.getView().refresh();
|
228
|
|
229
|
var gridSumTotal = Ext.ComponentQuery.query('[name=gridPDSPMSUMTOTAL]')[0];
|
230
|
gridSumTotal.getView().refresh();
|
231
|
|
232
|
}, 1000);
|
233
|
},
|
234
|
|
235
|
cancelPerformance : function () {
|
236
|
var card_ = Ext.ComponentQuery.query('[name=PerformanceCard]')[0];
|
237
|
card_.getLayout().setActiveItem(0);
|
238
|
},
|
239
|
|
240
|
createGridDetail : function (rec) {
|
241
|
var me = this;
|
242
|
var main = Ext.ComponentQuery.query('[name=mainformPerformance]')[0];
|
243
|
var form = main.getForm();
|
244
|
var SDate = form.findField("StartDate").getValue();
|
245
|
var EDate = form.findField("EndDate").getValue();
|
246
|
if (SDate == '' || SDate == undefined || EDate == '' || EDate == undefined) {
|
247
|
MinovaMessage('', 'PMS0003', '', 'E');
|
248
|
Ext.ComponentQuery.query('[name=AppraisalType]')[0].setValue('');
|
249
|
return;
|
250
|
}
|
251
|
this.setGridPerformance('0');
|
252
|
|
253
|
var appType = rec.getValue();
|
254
|
|
255
|
if (appType != 'G') {
|
256
|
var main = Ext.ComponentQuery.query('[name=mainformPerformance]')[0];
|
257
|
var form = main.getForm();
|
258
|
var SDate = form.findField("StartDate").getValue();
|
259
|
var EDate = form.findField("EndDate").getValue();
|
260
|
var Data = undefined;
|
261
|
var params = {
|
262
|
serviceName : 'Performance.asmx',
|
263
|
methodName : 'SetDefaultAppraiser',
|
264
|
parameter : 'EmployeeID=' + getParam('EmployeeID')
|
265
|
+ '&StartDate=' + SDate
|
266
|
+ '&EndDate=' + EDate
|
267
|
};
|
268
|
MinovaAjaxPost('/InvokeService/Invoke/', params, function (xhr) {
|
269
|
var result = Ext.decode(xhr.responseText);
|
270
|
Data = result;
|
271
|
var overView = Ext.StoreMgr.lookup('storePHRPA0048');
|
272
|
if (overView != undefined) {
|
273
|
overView.removeAll();
|
274
|
overView.loadData(Ext.decode(Data.data));
|
275
|
}
|
276
|
if (result.success) {
|
277
|
MinovaMessage('', 'PMS0001', '', 'S');
|
278
|
} else {}
|
279
|
});
|
280
|
|
281
|
var params = {
|
282
|
serviceName : 'Performance.asmx',
|
283
|
methodName : 'SetDefaultKPI',
|
284
|
parameter : 'EmployeeID=' + getParam('EmployeeID')
|
285
|
+ '&StartDate=' + SDate
|
286
|
+ '&EndDate=' + EDate
|
287
|
};
|
288
|
MinovaAjaxPost('/InvokeService/Invoke/', params, function (xhr) {
|
289
|
var result = Ext.decode(xhr.responseText);
|
290
|
Data = result;
|
291
|
var pnl = Ext.ComponentQuery.query('[name=gridPHRPA0049]')[0];
|
292
|
if (pnl != undefined) {
|
293
|
pnl.store.removeAll()
|
294
|
pnl.store.load()
|
295
|
pnl.store.setRootNode({
|
296
|
expanded : true,
|
297
|
nodetype : 'async',
|
298
|
children : Ext.decode(Data.data)
|
299
|
});
|
300
|
}
|
301
|
if (result.success) {}
|
302
|
else {}
|
303
|
});
|
304
|
} else {
|
305
|
me.setDefaultAppbyOM();
|
306
|
}
|
307
|
},
|
308
|
|
309
|
setGridPerformance : function (_a) {
|
310
|
var me = this;
|
311
|
var appType = Ext.ComponentQuery.query('[name=AppraisalType]')[0];
|
312
|
var grid = Ext.ComponentQuery.query('[name=formPerformanceDetail]')[0];
|
313
|
var _empID = getParam('EmployeeID');
|
314
|
grid.removeAll();
|
315
|
|
316
|
try {
|
317
|
var hasil = null;
|
318
|
Ext.Ajax.request({
|
319
|
async : false,
|
320
|
method : 'POST',
|
321
|
url : '/Performance/getListTableRef',
|
322
|
params : {
|
323
|
AppType : appType.getValue(),
|
324
|
EmpID : _empID
|
325
|
},
|
326
|
success : function (response) {
|
327
|
var results = Ext.decode(response.responseText);
|
328
|
hasil = Ext.decode(results.data);
|
329
|
}
|
330
|
});
|
331
|
|
332
|
if (hasil.length > 0) {
|
333
|
Ext.Array.each(hasil, function (rec) {
|
334
|
|
335
|
var _title = undefined;
|
336
|
Ext.Ajax.request({
|
337
|
async : false,
|
338
|
//method : 'POST',
|
339
|
url : '/UserControl/GetStore',
|
340
|
params : {
|
341
|
tableName : 'SDATATABLE',
|
342
|
param : 'TableName[=]' + rec
|
343
|
},
|
344
|
|
345
|
success : function (response) {
|
346
|
var results = Ext.decode(response.responseText);
|
347
|
var dt = results.data[0];
|
348
|
_title = dt.TableDescription;
|
349
|
}
|
350
|
});
|
351
|
|
352
|
if (rec != 'PHRPA0049' && rec != 'PHRPA0051') {
|
353
|
var _GridDetail = {
|
354
|
xtype : 'fieldset',
|
355
|
columnWidth : 0.5,
|
356
|
title : _title,
|
357
|
collapsible : true,
|
358
|
defaultType : 'textfield',
|
359
|
defaults : {
|
360
|
anchor : '100%'
|
361
|
},
|
362
|
height : 400,
|
363
|
layout : 'anchor',
|
364
|
bbar : [{
|
365
|
xtype : 'textfield',
|
366
|
name : 'TotalScore' + rec,
|
367
|
label : 'Total Score'
|
368
|
}
|
369
|
],
|
370
|
items : [{
|
371
|
xtype : 'minovapmseditablegrid',
|
372
|
height : 300,
|
373
|
autoLoad : false,
|
374
|
autoScroll : true,
|
375
|
tableName : rec,
|
376
|
storeName : 'store' + rec,
|
377
|
name : rec,
|
378
|
hideButton : false,
|
379
|
pagesize : 10,
|
380
|
empID : getParam('EmployeeID'),
|
381
|
apprasalType : appType.getValue(),
|
382
|
listeners : {}
|
383
|
}
|
384
|
]
|
385
|
};
|
386
|
grid.add(_GridDetail);
|
387
|
|
388
|
if (_a == '1') {
|
389
|
me.getDataAppraiser(rec);
|
390
|
}
|
391
|
} else {
|
392
|
var _GridDetail = {
|
393
|
xtype : 'fieldset',
|
394
|
columnWidth : 0.5,
|
395
|
title : _title,
|
396
|
collapsible : true,
|
397
|
//defaultType : 'textfield',
|
398
|
//autoScroll : true,
|
399
|
defaults : {
|
400
|
anchor : '100%'
|
401
|
},
|
402
|
height : 420,
|
403
|
layout : 'anchor',
|
404
|
items : [{
|
405
|
xtype : 'Minovapmstreeeditablegrid',
|
406
|
tableName : rec,
|
407
|
height : 280,
|
408
|
apprasalType : appType.getValue(),
|
409
|
empID : getParam('EmployeeID'),
|
410
|
autoScroll : true,
|
411
|
hideButton : false,
|
412
|
multiSelect : false,
|
413
|
/*xtype : 'panel',
|
414
|
name : 'Pnl' + rec,
|
415
|
height : 380,
|
416
|
width : '100%',
|
417
|
autoScroll : true,
|
418
|
/*items : [{
|
419
|
xtype : 'Minovapmstreeeditablegrid',
|
420
|
tableName : rec,
|
421
|
height : 280,
|
422
|
apprasalType : appType.getValue(),
|
423
|
empID : getParam('EmployeeID'),
|
424
|
autoScroll : true,
|
425
|
hideButton : false,
|
426
|
multiSelect : false
|
427
|
}
|
428
|
],*/
|
429
|
tbar : [{
|
430
|
xtype : 'toolbar',
|
431
|
items : [{
|
432
|
text : 'Add',
|
433
|
name : rec + 'Add',
|
434
|
iconCls : 'fa-plus-circle',
|
435
|
style : 'font-family: FontAwesome'
|
436
|
}, {
|
437
|
text : 'Delete',
|
438
|
name : rec + 'DeleteText',
|
439
|
iconCls : 'fa-trash-o',
|
440
|
style : 'font-family: FontAwesome',
|
441
|
//disabled: true
|
442
|
handler : function () {
|
443
|
var me = this,
|
444
|
store = Ext.StoreMgr.lookup(storeID)
|
445
|
|
446
|
var grid = Ext.getCmp(gridName);
|
447
|
|
448
|
Ext.MessageBox.show({
|
449
|
title : 'Remove tab',
|
450
|
msg : "This will remove. Do you want to continue?",
|
451
|
buttons : Ext.MessageBox.YESNO,
|
452
|
fn : function (choice) {
|
453
|
console.log(choice);
|
454
|
if (choice === 'yes') {
|
455
|
var selection = grid.getView().getSelectionModel().getSelection()[0];
|
456
|
if (selection) {
|
457
|
store.remove(selection);
|
458
|
}
|
459
|
}
|
460
|
}
|
461
|
});
|
462
|
}
|
463
|
}
|
464
|
]
|
465
|
}
|
466
|
]
|
467
|
}
|
468
|
|
469
|
]
|
470
|
};
|
471
|
grid.add(_GridDetail);
|
472
|
|
473
|
if (_a == '1') {
|
474
|
var pnl = Ext.ComponentQuery.query('[name=grid' + rec + ']')[0];
|
475
|
var seq = Ext.ComponentQuery.query('[name=Sequence]')[0];
|
476
|
var data_kpi = null;
|
477
|
var url = null;
|
478
|
if (rec == 'PHRPA0049') {
|
479
|
url = '/Performance/getKPI';
|
480
|
|
481
|
Ext.Ajax.request({
|
482
|
//method : 'POST',
|
483
|
async : false,
|
484
|
url : url,
|
485
|
params : {
|
486
|
EmpID : getParam('EmployeeID'),
|
487
|
Seq : seq.getValue(),
|
488
|
AppType : appType.getValue()
|
489
|
},
|
490
|
success : function (response) {
|
491
|
var results = Ext.decode(response.responseText);
|
492
|
data_kpi = Ext.decode(results.data);
|
493
|
}
|
494
|
});
|
495
|
|
496
|
pnl.store.setRootNode({
|
497
|
expanded : true,
|
498
|
nodetype : 'async',
|
499
|
children : data_kpi
|
500
|
//[]
|
501
|
});
|
502
|
}
|
503
|
else if (rec == 'PHRPA0051') {
|
504
|
//// -- add by Tri nwh 20220531
|
505
|
param = 'EmployeeID[=]' + getParam('EmployeeID')
|
506
|
+ ',HeaderSequence[=]' + seq.getValue()
|
507
|
+ ',AppraisalType[=]' + appType.getValue();
|
508
|
Ext.Ajax.request({
|
509
|
async : false,
|
510
|
url : '/UserControl/GetStore',
|
511
|
params : {
|
512
|
tableName : 'PHRPA0051',
|
513
|
param : param
|
514
|
},
|
515
|
success : function (response) {
|
516
|
var results = Ext.decode(response.responseText);
|
517
|
var data_ = results.data;
|
518
|
var pnl2 = Ext.ComponentQuery.query('[name=gridPHRPA0051]')[0];
|
519
|
pnl2.store.setRootNode({
|
520
|
expanded : true,
|
521
|
nodetype : 'async',
|
522
|
children : data_
|
523
|
});
|
524
|
}
|
525
|
});
|
526
|
//// -- end add by Tri nwh 20220531
|
527
|
}
|
528
|
//me.loadQualification();
|
529
|
}
|
530
|
}
|
531
|
});
|
532
|
} else {}
|
533
|
|
534
|
if (appType.getValue() == 'P' || appType.getValue() == 'F') {
|
535
|
var _title = undefined;
|
536
|
Ext.Ajax.request({
|
537
|
async : false,
|
538
|
//method : 'POST',
|
539
|
url : '/UserControl/GetStore',
|
540
|
params : {
|
541
|
tableName : 'SDATATABLE',
|
542
|
param : 'TableName[=]' + 'PDSPMSUMMARY'
|
543
|
},
|
544
|
|
545
|
success : function (response) {
|
546
|
var results = Ext.decode(response.responseText);
|
547
|
var dt = results.data[0];
|
548
|
_title = dt.TableDescription;
|
549
|
}
|
550
|
});
|
551
|
|
552
|
var _GridDetail = {
|
553
|
xtype : 'fieldset',
|
554
|
columnWidth : 0.5,
|
555
|
title : _title,
|
556
|
collapsible : true,
|
557
|
defaultType : 'textfield',
|
558
|
defaults : {
|
559
|
anchor : '100%'
|
560
|
},
|
561
|
height : 420,
|
562
|
layout : 'anchor',
|
563
|
items : [{
|
564
|
xtype : 'Minovaeditablegrid',
|
565
|
autoLoad : false,
|
566
|
hideButton : true,
|
567
|
autoScroll : true,
|
568
|
height : 200,
|
569
|
layout : 'fit',
|
570
|
tableName : 'PDSPMSUMMARY',
|
571
|
storeName : 'store' + 'PDSPMSUMMARY',
|
572
|
name : 'PDSPMSUMMARY',
|
573
|
empID : getParam('EmployeeID'),
|
574
|
apprasalType : appType.getValue(),
|
575
|
tbar : [{
|
576
|
xtype : 'toolbar',
|
577
|
docked : 'top',
|
578
|
items : [{
|
579
|
xtype : 'button',
|
580
|
text : 'Calculate',
|
581
|
name : 'Calculate',
|
582
|
handler : function () {
|
583
|
me.calculatePMS()
|
584
|
}
|
585
|
}
|
586
|
/*,{
|
587
|
xtype : 'button',
|
588
|
text : 'Save to Profile',
|
589
|
name : 'SaveProfile',
|
590
|
handler : function () {
|
591
|
me.SaveToMDHistory()
|
592
|
}
|
593
|
}*/
|
594
|
]
|
595
|
}
|
596
|
]
|
597
|
}, {
|
598
|
xtype : 'Minovaeditablegrid',
|
599
|
autoLoad : false,
|
600
|
hideButton : true,
|
601
|
autoScroll : true,
|
602
|
height : 200,
|
603
|
layout : 'fit',
|
604
|
tableName : 'PDSPMSUMTOTAL',
|
605
|
storeName : 'store' + 'PDSPMSUMTOTAL',
|
606
|
name : 'PDSPMSUMTOTAL'
|
607
|
}
|
608
|
]
|
609
|
};
|
610
|
grid.add(_GridDetail);
|
611
|
}
|
612
|
|
613
|
} catch (exc) {}
|
614
|
},
|
615
|
|
616
|
savePerformance : function () {
|
617
|
var me = this;
|
618
|
var form = Ext.ComponentQuery.query('[name=mainformPerformance]')[0];
|
619
|
var form_ = form.getForm();
|
620
|
var data = form_.getValues();
|
621
|
var treepnl = Ext.ComponentQuery.query('[name=gridPHRPA0049]')[0];
|
622
|
var treestore = undefined;
|
623
|
if (treepnl != undefined) {
|
624
|
treepnl.expandAll();
|
625
|
treestore = treepnl.store;
|
626
|
Ext.Array.each(treestore.data.items, function (rec) {
|
627
|
rec.expand(true);
|
628
|
})
|
629
|
}
|
630
|
var pnlqual = Ext.ComponentQuery.query('[name=gridPHRPA0051]')[0];
|
631
|
var storequal = undefined;
|
632
|
if (pnlqual != undefined) {
|
633
|
pnlqual.expandAll();
|
634
|
storequal = pnlqual.store;
|
635
|
Ext.Array.each(storequal.data.items, function (rec) {
|
636
|
rec.expand(true);
|
637
|
})
|
638
|
}
|
639
|
form.mask('Loading...');
|
640
|
var PA0048 = Ext.StoreMgr.lookup("storePHRPA0048");
|
641
|
var PA0049 = Ext.StoreMgr.lookup("storePHRPA0049");
|
642
|
var PA0049A = Ext.StoreMgr.lookup("storePHRPA0049A");
|
643
|
var PA0051 = Ext.StoreMgr.lookup("storePHRPA0051");
|
644
|
var PA0048_dATA = null;
|
645
|
var PA0049_dATA = null;
|
646
|
var PA0049A_dATA = null;
|
647
|
var PA0051_dATA = null;
|
648
|
var TREE_dATA = null;
|
649
|
|
650
|
if (PA0048 != undefined)
|
651
|
PA0048_dATA = Ext.encode(Ext.pluck(PA0048.data.items, 'data'));
|
652
|
if (PA0049 != undefined)
|
653
|
PA0049_dATA = Ext.encode(Ext.pluck(PA0049.data.items, 'data'));
|
654
|
if (PA0049A != undefined)
|
655
|
PA0049A_dATA = Ext.encode(Ext.pluck(PA0049A.data.items, 'data'));
|
656
|
if (storequal != undefined) {
|
657
|
var _data = Ext.pluck(storequal.data.items, 'data');
|
658
|
Ext.Array.each(_data, function (rec) {
|
659
|
rec.children = null
|
660
|
})
|
661
|
PA0051_dATA = Ext.encode(_data);
|
662
|
}
|
663
|
if (treepnl != undefined)
|
664
|
TREE_dATA = Ext.encode(Ext.pluck(treestore.data.items, 'data'));
|
665
|
|
666
|
if (data.AppraisalType != "G") {
|
667
|
var form = Ext.ComponentQuery.query('[name=mainformPerformance]')[0];
|
668
|
var form_ = form.getForm();
|
669
|
var data = form_.getValues();
|
670
|
var Sum = Ext.StoreMgr.lookup("storePDSPMSUMMARY");
|
671
|
if (Sum.data.items.length > 0) {
|
672
|
var DataSum = Ext.encode(Ext.pluck(Sum.data.items, 'data'));
|
673
|
Ext.Array.each(Ext.decode(DataSum), function (rec) {
|
674
|
if (rec.Type == "KPI") {
|
675
|
data["AdjustedKPI"] = rec.AdjustedScore;
|
676
|
data["CalculatedKPI"] = rec.CalculatedScore;
|
677
|
data["KPIFinalScore"] = rec.FinalScore;
|
678
|
data["KPITotalScore"] = rec.TotalScore;
|
679
|
data["KPITotalWeight"] = rec.Weight;
|
680
|
} else {
|
681
|
data["AdjustedCompetency"] = rec.AdjustedScore;
|
682
|
data["CalculatedCompetency"] = rec.CalculatedScore;
|
683
|
data["QualFinalScore"] = rec.FinalScore;
|
684
|
data["QualTotalScore"] = rec.TotalScore;
|
685
|
data["QualTotalWeight"] = rec.Weight;
|
686
|
}
|
687
|
})
|
688
|
}
|
689
|
var TotalSum = Ext.StoreMgr.lookup("storePDSPMSUMTOTAL");
|
690
|
var dataTotalSum = Ext.pluck(TotalSum.data.items, 'data');
|
691
|
if (dataTotalSum.length > 0) {
|
692
|
data["AdjustedIndex"] = dataTotalSum[0].AdjustedIndex;
|
693
|
data["AdjustedScore"] = dataTotalSum[0].AdjustedScore;
|
694
|
data["CalculatedScore"] = dataTotalSum[0].CalculatedScore;
|
695
|
data["CalculatedIndex"] = dataTotalSum[0].IndexScore;
|
696
|
}
|
697
|
}
|
698
|
var params = { //// add by Tri nwh 20220602
|
699
|
serviceName : 'Performance.asmx',
|
700
|
methodName : 'savePerformance',
|
701
|
parameter :
|
702
|
'header=' + Ext.encode(data)
|
703
|
+ '&PA0048=' + PA0048_dATA
|
704
|
+ '&PA0049=' + TREE_dATA
|
705
|
+ '&PA0049A=' + TREE_dATA
|
706
|
+ '&PA0051=' + PA0051_dATA
|
707
|
+ '&Token=' + MinovaUtil.SESSIONS.Token
|
708
|
};
|
709
|
MinovaAjaxPost('/InvokeService/Invoke/', params, function (xhr) {
|
710
|
var result = Ext.decode(xhr.responseText);
|
711
|
console.log(result.success);
|
712
|
var card_ = Ext.ComponentQuery.query('[name=PerformanceCard]')[0];
|
713
|
card_.getLayout().setActiveItem(0);
|
714
|
MinovaMessage('', '000006', '', 'S');
|
715
|
if (data.AppraisalType == "F") { console.log('chani');
|
716
|
//me.SaveToMDHistory();
|
717
|
//me.saveToMDProfile();
|
718
|
}
|
719
|
me.afterRenderOverview();
|
720
|
form.unmask();
|
721
|
});
|
722
|
},
|
723
|
|
724
|
btnGoToother : function () {
|
725
|
var menu_ = [];
|
726
|
var Y = 180;
|
727
|
|
728
|
menu_.push({
|
729
|
text : 'Employee Search',
|
730
|
handler : function () {
|
731
|
Ext.create('Ext.window.Window', {
|
732
|
title : 'Lookup - Employee',
|
733
|
height : 530,
|
734
|
width : 500,
|
735
|
name : 'lookupMain',
|
736
|
modal : true,
|
737
|
items : [{
|
738
|
xtype : 'minovaform',
|
739
|
bodyBorder : false,
|
740
|
MaxHeigth : '100',
|
741
|
cls : 'borderLookup',
|
742
|
border : false,
|
743
|
MaxHeigth : '30',
|
744
|
scroll : true,
|
745
|
isLookup : true,
|
746
|
name : "formLookupFilter",
|
747
|
tableName : 'PDSEMP0002',
|
748
|
buttons : [{
|
749
|
text : 'Search',
|
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 : 'minovagrid1',
|
789
|
isLookup : 1,
|
790
|
minHeight : 280,
|
791
|
height : 280,
|
792
|
tableName : 'PDSEMP0002',
|
793
|
param : '',
|
794
|
isLookup : true,
|
795
|
autoLoad : false,
|
796
|
name : 'gridLookup',
|
797
|
hidebutton : 0,
|
798
|
pagesize : 25,
|
799
|
storename : 'lookupStore',
|
800
|
listeners : {
|
801
|
itemdblclick : function (g) {
|
802
|
var dataSelection = this.getView().getSelectionModel().getSelection()[0].data;
|
803
|
//console.log(dataSelection)
|
804
|
var url = MinovaUtil.GetMenuID() + '&EmployeeID=' + dataSelection.EmployeeID + '&FullName=' + dataSelection.FullName + '&Lang=' + localStorage.LangId;
|
805
|
var mb = new minovaBlowfish();
|
806
|
e = mb.minovaEncryptUrl(url);
|
807
|
window.open('masterdataperformancedetail?' + e, "_self");
|
808
|
|
809
|
},
|
810
|
beforeedit : function (grid) {
|
811
|
return false;
|
812
|
}
|
813
|
},
|
814
|
dockedItems : [{
|
815
|
xtype : 'pagingtoolbar',
|
816
|
store : 'lookupStore',
|
817
|
dock : 'bottom',
|
818
|
pageSize : 25,
|
819
|
displayInfo : true
|
820
|
}
|
821
|
]
|
822
|
|
823
|
}, ]
|
824
|
}).show();
|
825
|
}
|
826
|
});
|
827
|
menu_.push({
|
828
|
text : 'Back',
|
829
|
handler : function () {
|
830
|
window.history.back();
|
831
|
}
|
832
|
});
|
833
|
Ext.create('Ext.menu.Menu', {
|
834
|
name : 'panelMenu',
|
835
|
width : 240,
|
836
|
height : 100,
|
837
|
margin : '0 0 10 0',
|
838
|
|
839
|
items : menu_
|
840
|
}).showAt([1239, Y]);
|
841
|
},
|
842
|
|
843
|
deletePerformance : function () {
|
844
|
var me = this;
|
845
|
var StartDate = Ext.ComponentQuery.query('[name=StartDate]')[0];
|
846
|
var EndDate = Ext.ComponentQuery.query('[name=EndDate]')[0];
|
847
|
var appType = Ext.ComponentQuery.query('[name=AppraisalType]')[0];
|
848
|
var Sequence = Ext.ComponentQuery.query('[name=Sequence]')[0];
|
849
|
var _empID = getParam('EmployeeID');
|
850
|
|
851
|
Ext.Ajax.request({
|
852
|
async : false,
|
853
|
method : 'POST',
|
854
|
url : '/Performance/deleteData',
|
855
|
params : {
|
856
|
EmpID : _empID,
|
857
|
Seq : Sequence.getValue(),
|
858
|
AppType : appType.getValue(),
|
859
|
StDate : StartDate.getValue(),
|
860
|
EnDate : EndDate.getValue()
|
861
|
},
|
862
|
waitMsg : 'Deleting Data...',
|
863
|
success : function (response) {
|
864
|
|
865
|
var result = Ext.decode(response.responseText);
|
866
|
if (result.success) {
|
867
|
var card_ = Ext.ComponentQuery.query('[name=PerformanceCard]')[0];
|
868
|
card_.getLayout().setActiveItem(0);
|
869
|
MinovaMessage('', '000006', '', 'S');
|
870
|
me.afterRenderOverview();
|
871
|
//pnl.unmask();
|
872
|
} else {
|
873
|
//.unmask();
|
874
|
//MinovaMessage('', result.message.id, result.message.text, "E");
|
875
|
MinovaMessage('', '000005', result.message.text, "E")
|
876
|
}
|
877
|
},
|
878
|
failure : function (response) {
|
879
|
var result = Ext.decode(response.responseText);
|
880
|
//pnl.unmask();
|
881
|
// MinovaMessage('', result.message.id, result.message.text, "E")
|
882
|
MinovaMessage('', '000005', result.message.text, "E")
|
883
|
}
|
884
|
});
|
885
|
|
886
|
me.afterRenderOverview();
|
887
|
},
|
888
|
|
889
|
addAppraiser : function () {
|
890
|
var grid = Ext.getCmp('gridPHRPA0048');
|
891
|
var record = grid.getSelectionModel().getSelection()[0];
|
892
|
record.set('EmployeeID', getParam('EmployeeID'));
|
893
|
},
|
894
|
|
895
|
getDataAppraiser : function (tblName) {
|
896
|
var appType = Ext.ComponentQuery.query('[name=AppraisalType]')[0];
|
897
|
var seq = Ext.ComponentQuery.query('[name=Sequence]')[0];
|
898
|
var overView = Ext.StoreMgr.lookup('store' + tblName);
|
899
|
var param = null;
|
900
|
var data_kpi = null;
|
901
|
|
902
|
if (tblName == 'PHRPA0049') {
|
903
|
var pnl = Ext.ComponentQuery.query('[name=' + tblName + ']')[0];
|
904
|
Ext.Ajax.request({
|
905
|
//method : 'POST',
|
906
|
async : false,
|
907
|
url : '/Performance/getKPI',
|
908
|
params : {
|
909
|
EmpID : _empID,
|
910
|
Seq : seq.getValue(),
|
911
|
AppType : appType.getValue()
|
912
|
},
|
913
|
success : function (response) {
|
914
|
var results = Ext.decode(response.responseText);
|
915
|
data_kpi = Ext.decode(results.data);
|
916
|
}
|
917
|
});
|
918
|
pnl.store.setRootNode({
|
919
|
expanded : true,
|
920
|
nodetype : 'async',
|
921
|
children : data_kpi
|
922
|
//[]
|
923
|
});
|
924
|
} else {
|
925
|
param = 'EmployeeID[=]' + getParam('EmployeeID')
|
926
|
+ ',HeaderSequence[=]' + seq.getValue()
|
927
|
+ ',AppraisalType[=]' + appType.getValue();
|
928
|
Ext.Ajax.request({
|
929
|
//method : 'POST',
|
930
|
async : false,
|
931
|
url : '/UserControl/GetStore',
|
932
|
params : {
|
933
|
tableName : tblName,
|
934
|
param : param
|
935
|
},
|
936
|
success : function (response) {
|
937
|
var results = Ext.decode(response.responseText);
|
938
|
|
939
|
if (tblName != 'PHRPA0049') {
|
940
|
overView.removeAll();
|
941
|
overView.loadData(results.data);
|
942
|
} else {
|
943
|
var data_ = results.data;
|
944
|
var pnl = Ext.ComponentQuery.query('[name=' + tblName + ']')[0];
|
945
|
pnl.store.setRootNode({
|
946
|
expanded : true,
|
947
|
nodetype : 'async',
|
948
|
children : data_
|
949
|
//[]
|
950
|
});
|
951
|
}
|
952
|
}
|
953
|
});
|
954
|
}
|
955
|
//overView.removeAll();
|
956
|
//overView.reload();
|
957
|
//overView.loadPage(1);
|
958
|
},
|
959
|
|
960
|
loadChild : function (node, index, item, eOpts) {
|
961
|
var me = this;
|
962
|
var _empID = getParam('EmployeeID');
|
963
|
var appType = Ext.ComponentQuery.query('[name=AppraisalType]')[0];
|
964
|
var seq = Ext.ComponentQuery.query('[name=Sequence]')[0];
|
965
|
var data_ = null;
|
966
|
var idx = 0;
|
967
|
var tree_ = Ext.ComponentQuery.query('treepanel[name=gridPHRPA0049]')[0];
|
968
|
var v = tree_.getView();
|
969
|
|
970
|
if (node.data.IsSubKPI == '1') {
|
971
|
return;
|
972
|
}
|
973
|
|
974
|
tree_.mask('Expanding tree...');
|
975
|
|
976
|
Ext.Ajax.request({
|
977
|
//method : 'POST',
|
978
|
async : false,
|
979
|
url : '/Performance/getSubKPI',
|
980
|
params : {
|
981
|
EmpID : _empID,
|
982
|
Seq : seq.getValue(),
|
983
|
AppType : appType.getValue(),
|
984
|
KPIID : node.data.KPI,
|
985
|
KPISeq : node.data.Sequence
|
986
|
},
|
987
|
success : function (response) {
|
988
|
var results = Ext.decode(response.responseText);
|
989
|
data_ = Ext.decode(results.data);
|
990
|
}
|
991
|
});
|
992
|
|
993
|
if (data_.length > 0) {
|
994
|
data_.forEach(function (rec) {
|
995
|
if (v.store.data.find('SequenceSubKPI', rec.SequenceSubKPI) == null) {
|
996
|
node.appendChild(data_[idx])
|
997
|
}
|
998
|
idx++;
|
999
|
})
|
1000
|
}
|
1001
|
|
1002
|
tree_.unmask();
|
1003
|
},
|
1004
|
|
1005
|
addNewKPI : function () {
|
1006
|
var me = this;
|
1007
|
var count_lookup = Ext.ComponentQuery.query('[name=AddNewKPI]').length;
|
1008
|
if (count_lookup == 1) {
|
1009
|
Ext.ComponentQuery.query('[name=AddNewKPI]')[0].show();
|
1010
|
} else {
|
1011
|
Ext.create('Ext.window.Window', {
|
1012
|
title : 'Add KPI',
|
1013
|
name : 'AddNewKPI',
|
1014
|
layout : 'fit',
|
1015
|
items : [{
|
1016
|
xtype : 'form',
|
1017
|
name : 'formAddKPI',
|
1018
|
items : [{
|
1019
|
xtype : 'minovaForm',
|
1020
|
bodyBorder : false,
|
1021
|
cls : 'borderLookup',
|
1022
|
border : false,
|
1023
|
isLookup : false,
|
1024
|
name : "mainformAddKPI",
|
1025
|
tableName : 'PDSPMLOOKUPKPI'
|
1026
|
}
|
1027
|
]
|
1028
|
}
|
1029
|
],
|
1030
|
buttons : [{
|
1031
|
text : 'Add KPI',
|
1032
|
name : 'BtnAddKPI',
|
1033
|
iconCls : 'fa-save',
|
1034
|
style : 'font-family: FontAwesome',
|
1035
|
margin : '3 3 10 3',
|
1036
|
handler : function () {
|
1037
|
me.addNewKPItoGrid();
|
1038
|
}
|
1039
|
}, {
|
1040
|
text : 'Cancel',
|
1041
|
name : 'BtnCancelKPI',
|
1042
|
iconCls : 'fa-reply',
|
1043
|
style : 'font-family: FontAwesome',
|
1044
|
margin : '3 3 10 3',
|
1045
|
handler : function () {
|
1046
|
me.cancelAddNewKPI();
|
1047
|
}
|
1048
|
}
|
1049
|
]
|
1050
|
}).show();
|
1051
|
}
|
1052
|
},
|
1053
|
|
1054
|
cancelAddNewKPI : function () {
|
1055
|
Ext.ComponentQuery.query('[name=AddNewKPI]')[0].destroy();
|
1056
|
},
|
1057
|
|
1058
|
addNewKPItoGrid : function () {
|
1059
|
var seq = Ext.ComponentQuery.query('[name=Sequence]')[0].getValue();
|
1060
|
var pnl = Ext.ComponentQuery.query('[name=gridPHRPA0049]')[0];
|
1061
|
var leafCount = 0;
|
1062
|
pnl.getRootNode().cascadeBy(function (node) {
|
1063
|
if (!node.isLeaf())
|
1064
|
leafCount++;
|
1065
|
});
|
1066
|
var data = '';
|
1067
|
var Sequence = 0;
|
1068
|
if (leafCount == 0) {
|
1069
|
Sequence = 1;
|
1070
|
} else {
|
1071
|
Sequence = 1 + leafCount;
|
1072
|
}
|
1073
|
|
1074
|
var a = Ext.ComponentQuery.query('[name=mainformAddKPI]')[0];
|
1075
|
var b = a.getValues();
|
1076
|
var C = '';
|
1077
|
|
1078
|
Ext.Ajax.request({
|
1079
|
method : 'POST',
|
1080
|
async : false,
|
1081
|
url : '/UserControl/GetStore',
|
1082
|
params : {
|
1083
|
tableName : 'PHROM0002',
|
1084
|
param : 'ObjectClass[=]KG,RelationshipClass[=]K,RelationshipObject[=]' + Ext.ComponentQuery.query('[name=KPI]')[0].getValue() + ',StartDate[<=]' + b.StartDate + ',EndDate[>=]' + b.StartDate
|
1085
|
},
|
1086
|
success : function (response) {
|
1087
|
var results = Ext.decode(response.responseText);
|
1088
|
if (results.data != null && results.data.length > 0) {
|
1089
|
c = results.data[0].ObjectID;
|
1090
|
}
|
1091
|
}
|
1092
|
});
|
1093
|
|
1094
|
data = {
|
1095
|
KPIGroup : c,
|
1096
|
EmployeeID : Ext.ComponentQuery.query('[name=EmployeeID]')[0].getValue(),
|
1097
|
AppraisalType : Ext.ComponentQuery.query('[name=AppraisalType]')[0].getValue(),
|
1098
|
KPI : Ext.ComponentQuery.query('[name=KPI]')[0].getValue(),
|
1099
|
Sequence : Sequence,
|
1100
|
ObjectDescription : Ext.ComponentQuery.query('[name=KPI]')[0].value.split('-')[1].substr(1),
|
1101
|
SubKPI : "-",
|
1102
|
HeaderSequence : seq,
|
1103
|
SequenceSubKPI : "0",
|
1104
|
IsSubKPI : "0",
|
1105
|
leaf : false,
|
1106
|
Target : 1,
|
1107
|
expanded : true
|
1108
|
,App2Value : 0 //// ---- add by Tri nwh 20220601
|
1109
|
,App1Percentage : 0
|
1110
|
,App1Projected : 0
|
1111
|
,App2Percentage : 0
|
1112
|
,App2Projected : 0
|
1113
|
};
|
1114
|
|
1115
|
var task = pnl.getRootNode();
|
1116
|
task.appendChild(data);
|
1117
|
Ext.ComponentQuery.query('[name=AddNewKPI]')[0].destroy();
|
1118
|
},
|
1119
|
|
1120
|
addNewsubKPI : function (record) {
|
1121
|
var me = this;
|
1122
|
var count_lookup = Ext.ComponentQuery.query('[name=AddNewsubKPI]').length;
|
1123
|
if (count_lookup == 1) {
|
1124
|
Ext.ComponentQuery.query('[name=AddNewsubKPI]')[0].show();
|
1125
|
} else {
|
1126
|
Ext.create('Ext.window.Window', {
|
1127
|
title : 'Add subKPI',
|
1128
|
name : 'AddNewsubKPI',
|
1129
|
layout : 'fit',
|
1130
|
items : [{
|
1131
|
xtype : 'form',
|
1132
|
name : 'formAddsubKPI',
|
1133
|
items : [{
|
1134
|
xtype : 'minovaForm',
|
1135
|
bodyBorder : false,
|
1136
|
cls : 'borderLookup',
|
1137
|
border : false,
|
1138
|
isLookup : false,
|
1139
|
name : "mainformAddsubKPI",
|
1140
|
tableName : 'PDSPMLOOKUPKPI'
|
1141
|
}
|
1142
|
]
|
1143
|
}
|
1144
|
],
|
1145
|
buttons : [{
|
1146
|
text : 'Add subKPI',
|
1147
|
name : 'BtnAddsubKPI',
|
1148
|
iconCls : 'fa-save',
|
1149
|
style : 'font-family: FontAwesome',
|
1150
|
margin : '3 3 10 3',
|
1151
|
handler : function () {
|
1152
|
me.addNewsubKPItoGrid(record);
|
1153
|
}
|
1154
|
}, {
|
1155
|
text : 'Cancel',
|
1156
|
name : 'BtnCancelsubKPI',
|
1157
|
iconCls : 'fa-reply',
|
1158
|
style : 'font-family: FontAwesome',
|
1159
|
margin : '3 3 10 3',
|
1160
|
handler : function () {
|
1161
|
Ext.ComponentQuery.query('[name=AddNewsubKPI]')[0].destroy();
|
1162
|
}
|
1163
|
}
|
1164
|
]
|
1165
|
}).show();
|
1166
|
}
|
1167
|
},
|
1168
|
|
1169
|
addNewsubKPItoGrid : function (record) {
|
1170
|
var pnl = Ext.ComponentQuery.query('[name=gridPHRPA0049]')[0];
|
1171
|
var leafCount = 0;
|
1172
|
var _empID = getParam('EmployeeID');
|
1173
|
var appType = Ext.ComponentQuery.query('[name=AppraisalType]')[0];
|
1174
|
var seq = Ext.ComponentQuery.query('[name=Sequence]')[0];
|
1175
|
var i = 0;
|
1176
|
var data_ = null;
|
1177
|
Ext.Ajax.request({
|
1178
|
async : false,
|
1179
|
url : '/Performance/getSubKPI',
|
1180
|
params : {
|
1181
|
EmpID : _empID,
|
1182
|
Seq : seq.getValue(),
|
1183
|
AppType : appType.getValue(),
|
1184
|
KPIID : record.data.KPI,
|
1185
|
KPISeq : record.data.Sequence
|
1186
|
},
|
1187
|
success : function (response) {
|
1188
|
var results = Ext.decode(response.responseText);
|
1189
|
data_ = Ext.decode(results.data);
|
1190
|
}
|
1191
|
});
|
1192
|
if (data_.length == 0) {
|
1193
|
i = 1;
|
1194
|
} else {
|
1195
|
i += data_.length;
|
1196
|
}
|
1197
|
|
1198
|
var data = {
|
1199
|
EmployeeID : Ext.ComponentQuery.query('[name=EmployeeID]')[0].getValue(),
|
1200
|
AppraisalType : Ext.ComponentQuery.query('[name=AppraisalType]')[0].getValue(),
|
1201
|
KPI : record.data.KPI,
|
1202
|
ObjectDescription : record.data.ObjectDescription,
|
1203
|
Sequence : record.data.Sequence,
|
1204
|
HeaderSequence : seq.getValue(),
|
1205
|
SequenceSubKPI : i,
|
1206
|
IsSubKPI : "1",
|
1207
|
SubKPI : Ext.ComponentQuery.query('[name=KPI]')[0].getValue(),
|
1208
|
SubKPIDescription : Ext.ComponentQuery.query('[name=KPI]')[0].value.split('-')[1].substr(1),
|
1209
|
leaf : true
|
1210
|
};
|
1211
|
|
1212
|
record.appendChild(data);
|
1213
|
Ext.ComponentQuery.query('[name=AddNewsubKPI]')[0].destroy();
|
1214
|
},
|
1215
|
|
1216
|
loadMenu : function () {
|
1217
|
var me = this;
|
1218
|
var main_ = Ext.ComponentQuery.query('[name=gridPHRPA0049]')[0];
|
1219
|
var record = main_.getView().selection;
|
1220
|
var _a = record.data.leaf;
|
1221
|
var _kpi = record.data.KPI;
|
1222
|
var rowIndex = record.data.index;
|
1223
|
var n = rowIndex * 50;
|
1224
|
var Y = 180 + n;
|
1225
|
var menu_ = []
|
1226
|
|
1227
|
if (!_a) {
|
1228
|
menu_.push({
|
1229
|
text : 'Delete KPI',
|
1230
|
handler : function () {
|
1231
|
me.deleteSubKPI(record);
|
1232
|
}
|
1233
|
})
|
1234
|
menu_.push({
|
1235
|
text : 'Add subKPI',
|
1236
|
handler : function () {
|
1237
|
me.addNewsubKPI(record);
|
1238
|
}
|
1239
|
})
|
1240
|
menu_.push({
|
1241
|
text : 'Delete All subKPI',
|
1242
|
handler : function () {}
|
1243
|
})
|
1244
|
} else {
|
1245
|
menu_.push({
|
1246
|
text : 'Delete subKPI',
|
1247
|
handler : function () {
|
1248
|
me.deleteSubKPI(record);
|
1249
|
}
|
1250
|
})
|
1251
|
}
|
1252
|
|
1253
|
Ext.create('Ext.menu.Menu', {
|
1254
|
name : 'panelMenu',
|
1255
|
width : 240,
|
1256
|
height : 150,
|
1257
|
margin : '0 0 10 0',
|
1258
|
items : menu_
|
1259
|
}).showAt([1239, Y]);
|
1260
|
},
|
1261
|
|
1262
|
AddAppraiserQ : function () {},
|
1263
|
|
1264
|
deleteSubKPI : function (a) {
|
1265
|
/*var main_ = Ext.ComponentQuery.query('[name=PHRPA0049]')[0];
|
1266
|
var record = main_.getView().selection;
|
1267
|
var _empID = getParam('EmployeeID');
|
1268
|
var appType = Ext.ComponentQuery.query('[name=AppraisalType]')[0];
|
1269
|
var seq = Ext.ComponentQuery.query('[name=Sequence]')[0];
|
1270
|
var kpiseq = record.data.Sequence;
|
1271
|
var skpiseq = record.data.SequenceSubKPI;
|
1272
|
var params = {
|
1273
|
serviceName : 'Performance.asmx',
|
1274
|
methodName : 'deleteSubKPI',
|
1275
|
parameter : 'empID=' + _empID
|
1276
|
+ '&HeaderSeq=' + seq.getValue()
|
1277
|
+ '&appType=' + appType.getValue()
|
1278
|
+ '&KPISeq=' + kpiseq
|
1279
|
+ '&sKPISeq=' + skpiseq
|
1280
|
};
|
1281
|
MinovaAjaxPost('/InvokeService/Invoke/', params, function (xhr) {
|
1282
|
var result = Ext.decode(xhr.responseText);
|
1283
|
if (result.success) {
|
1284
|
MinovaMessage('', 'PMS0001', '', 'S');
|
1285
|
record.remove();
|
1286
|
} else {
|
1287
|
MinovaMessage('', '000005', result.message.text, 'E');
|
1288
|
}
|
1289
|
});*/
|
1290
|
a.remove();
|
1291
|
},
|
1292
|
|
1293
|
calculatePMS : function () {
|
1294
|
var pnl = Ext.ComponentQuery.query('[name=mainformPerformance]')[0];
|
1295
|
var form_ = pnl.getForm();
|
1296
|
var data = form_.getValues();
|
1297
|
var treepnl = Ext.ComponentQuery.query('[name=gridPHRPA0049]')[0];
|
1298
|
var treestore = treepnl.store;
|
1299
|
var pnlqual = Ext.ComponentQuery.query('[name=gridPHRPA0051]')[0];//Ext.ComponentQuery.query('[name=PHRPA0051]')[0];
|
1300
|
var storequal = undefined;
|
1301
|
if (pnlqual != undefined) {
|
1302
|
pnlqual.expandAll();
|
1303
|
storequal = pnlqual.store;
|
1304
|
}
|
1305
|
var PA0048 = Ext.StoreMgr.lookup("storePHRPA0048");
|
1306
|
var PA0051 = Ext.StoreMgr.lookup("storePHRPA0051");
|
1307
|
var PA0048_dATA = null;
|
1308
|
var PA0051_dATA = null;
|
1309
|
var TREE_dATA = null;
|
1310
|
var Head = null;
|
1311
|
var Child = null;
|
1312
|
|
1313
|
if (data.AppraisalType != "G") {
|
1314
|
var form = Ext.ComponentQuery.query('[name=mainformPerformance]')[0];
|
1315
|
var form_ = form.getForm();
|
1316
|
var data = form_.getValues();
|
1317
|
var Sum = Ext.StoreMgr.lookup("storePDSPMSUMMARY");
|
1318
|
if (Sum.data.items.length > 0) {
|
1319
|
var DataSum = Ext.encode(Ext.pluck(Sum.data.items, 'data'));
|
1320
|
Ext.Array.each(Ext.decode(DataSum), function (rec) {
|
1321
|
if (rec.Type == "KPI") {
|
1322
|
data["AdjustedKPI"] = rec.AdjustedScore;
|
1323
|
data["CalculatedKPI"] = rec.CalculatedScore;
|
1324
|
data["KPIFinalScore"] = rec.FinalScore;
|
1325
|
data["KPITotalScore"] = rec.TotalScore;
|
1326
|
} else {
|
1327
|
data["AdjustedCompetency"] = rec.AdjustedScore;
|
1328
|
data["CalculatedCompetency"] = rec.CalculatedScore;
|
1329
|
data["QualFinalScore"] = rec.FinalScore;
|
1330
|
data["QualTotalScore"] = rec.TotalScore;
|
1331
|
}
|
1332
|
})
|
1333
|
}
|
1334
|
var TotalSum = Ext.StoreMgr.lookup("storePDSPMSUMTOTAL");
|
1335
|
var dataTotalSum = Ext.pluck(TotalSum.data.items, 'data');
|
1336
|
if (dataTotalSum.length > 0) {
|
1337
|
data["AdjustedIndex"] = dataTotalSum[0].AdjustedIndex;
|
1338
|
data["AdjustedScore"] = dataTotalSum[0].AdjustedScore;
|
1339
|
data["CalculatedScore"] = dataTotalSum[0].CalculatedScore;
|
1340
|
data["CalculatedIndex"] = dataTotalSum[0].IndexScore;
|
1341
|
}
|
1342
|
}
|
1343
|
|
1344
|
if (PA0048 != undefined)
|
1345
|
PA0048_dATA = Ext.encode(Ext.pluck(PA0048.data.items, 'data'));
|
1346
|
if (storequal != undefined) {
|
1347
|
var _data = Ext.pluck(storequal.data.items, 'data');
|
1348
|
Ext.Array.each(_data, function (rec) {
|
1349
|
rec.children = null
|
1350
|
})
|
1351
|
PA0051_dATA = Ext.encode(_data);
|
1352
|
}
|
1353
|
if (treepnl != undefined)
|
1354
|
TREE_dATA = Ext.encode(Ext.pluck(treestore.data.items, 'data'));
|
1355
|
|
1356
|
var dataresult = null;
|
1357
|
var data47 = null;
|
1358
|
|
1359
|
var params = {
|
1360
|
serviceName : 'Performance.asmx',
|
1361
|
methodName : 'CalculatePerformance',
|
1362
|
parameter :
|
1363
|
'header=' + Ext.encode(data)
|
1364
|
+ '&PA0048=' + PA0048_dATA
|
1365
|
+ '&PA0049=' + TREE_dATA
|
1366
|
+ '&PA0051=' + PA0051_dATA
|
1367
|
+ '&Token=' + MinovaUtil.SESSIONS.Token
|
1368
|
};
|
1369
|
MinovaAjaxPost('/InvokeService/Invoke/', params, function (xhr) {
|
1370
|
var result = Ext.decode(xhr.responseText);
|
1371
|
dataresult = result.data;
|
1372
|
Head = $.grep(Ext.decode(dataresult), function (r) {
|
1373
|
return r.Tablename == '0047'
|
1374
|
});
|
1375
|
data47 = Head;
|
1376
|
var form = Ext.ComponentQuery.query('[name=mainformPerformance]')[0];
|
1377
|
var form_ = form.getForm();
|
1378
|
form_.setValues(Head[0]);
|
1379
|
var dataPA0048 = $.grep(Ext.decode(dataresult), function (r) {
|
1380
|
return r.Tablename == '0048'
|
1381
|
});
|
1382
|
var overView = Ext.StoreMgr.lookup('storePHRPA0048');
|
1383
|
if (overView != undefined) {
|
1384
|
overView.removeAll();
|
1385
|
overView.loadData(dataPA0048);
|
1386
|
}
|
1387
|
|
1388
|
//// comment by Tri
|
1389
|
var dataPA0049 = $.grep(Ext.decode(dataresult), function (r) {
|
1390
|
return r.Tablename == '0049'
|
1391
|
}); console.log(dataPA0049);
|
1392
|
var pnl = Ext.ComponentQuery.query('[name=gridPHRPA0049]')[0];
|
1393
|
if (pnl != undefined) {
|
1394
|
pnl.store.load()
|
1395
|
var taskkpi = pnl.getRootNode();
|
1396
|
taskkpi.appendChild(dataPA0049);
|
1397
|
}
|
1398
|
|
1399
|
var dataPA0051 = $.grep(Ext.decode(dataresult), function (r) {
|
1400
|
return r.Tablename == '0051'
|
1401
|
});
|
1402
|
var pnl51 = Ext.ComponentQuery.query('[name=gridPHRPA0051]')[0];
|
1403
|
if (pnl51 != undefined) {
|
1404
|
pnl51.store.load()
|
1405
|
var qual = pnl51.getRootNode();
|
1406
|
qual.appendChild(dataPA0051);
|
1407
|
}
|
1408
|
|
1409
|
/* var dataPA0051 = $.grep(Ext.decode(dataresult), function (r) {
|
1410
|
return r.Tablename == '0051'
|
1411
|
});
|
1412
|
var pnl2 = Ext.ComponentQuery.query('[name=gridPHRPA0051]')[0];
|
1413
|
if (pnl2 != undefined) {
|
1414
|
//pnl.store.removeAll()
|
1415
|
pnl2.store.load()
|
1416
|
// pnl.store.setRootNode({
|
1417
|
// expanded : true,
|
1418
|
// nodetype : 'async',
|
1419
|
// children : dataKPI
|
1420
|
// });
|
1421
|
var taskqual = pnl2.getRootNode();
|
1422
|
taskqual.appendChild(dataPA0051);
|
1423
|
}*/
|
1424
|
|
1425
|
/*var pnl2 = Ext.ComponentQuery.query('[name=PHRPA0051]')[0]; //// comment by Tri nwh 20220527
|
1426
|
Head = $.grep(dataPA0051, function (r) {
|
1427
|
return r.SequenceSub == 0
|
1428
|
});
|
1429
|
Child = $.grep(dataPA0051, function (r) {
|
1430
|
return r.SequenceSub != 0
|
1431
|
});
|
1432
|
Ext.Array.each(Child, function (rec) {
|
1433
|
rec['leaf'] = true;
|
1434
|
});
|
1435
|
if (pnl2 != undefined) {
|
1436
|
pnl2.store.load();
|
1437
|
var task = pnl2.getRootNode();
|
1438
|
//task.appendChild(Head);
|
1439
|
//pnl2 = Ext.ComponentQuery.query('[name=PHRPA0051]')[0];
|
1440
|
//storequal = pnl2.store;
|
1441
|
//Ext.Array.each(storequal.data.items, function (rec) {
|
1442
|
//var t = rec.data;
|
1443
|
//var QChild = $.grep(Child, function (r) {
|
1444
|
//return r.QualificationID == t.QualificationID
|
1445
|
//});
|
1446
|
//var index = t.index;
|
1447
|
//rec.appendChild(QChild);
|
1448
|
//})
|
1449
|
Ext.Array.each(Head, function (rec) {
|
1450
|
var QChild = $.grep(Child, function (r) {
|
1451
|
return r.QualificationID == rec.QualificationID
|
1452
|
});
|
1453
|
rec['children'] = QChild;
|
1454
|
rec['expanded'] = true;
|
1455
|
task.appendChild(rec);
|
1456
|
})
|
1457
|
pnl2.getView().refresh();
|
1458
|
}*/
|
1459
|
if (result.success) {
|
1460
|
MinovaMessage('', 'PMS0002', '', 'S');
|
1461
|
} else {
|
1462
|
MinovaMessage('', '000005', '', 'E');
|
1463
|
}
|
1464
|
|
1465
|
data = {
|
1466
|
AdjustedIndex : '',
|
1467
|
AdjustedScore : data47[0].AdjustedKPI,
|
1468
|
CalculatedScore : data47[0].CalculatedKPI,
|
1469
|
FinalScore : data47[0].KPIFinalScore,
|
1470
|
IndexScore : '',
|
1471
|
TotalScore : data47[0].KPITotalScore,
|
1472
|
Type : 'KPI',
|
1473
|
Weight : data47[0].KPITotalWeight//'80'
|
1474
|
};
|
1475
|
|
1476
|
data2 = [];
|
1477
|
data2[0] = data;
|
1478
|
|
1479
|
data = {
|
1480
|
AdjustedIndex : '',
|
1481
|
AdjustedScore : data47[0].AdjustedCompetency,
|
1482
|
CalculatedScore : data47[0].CalculatedCompetency,
|
1483
|
FinalScore : data47[0].QualFinalScore,
|
1484
|
IndexScore : '',
|
1485
|
TotalScore : data47[0].QualTotalScore,
|
1486
|
Type : 'Qualification',
|
1487
|
Weight : data47[0].QualTotalWeight//'20'
|
1488
|
};
|
1489
|
|
1490
|
data2[1] = data;
|
1491
|
|
1492
|
var overView = Ext.StoreMgr.lookup('storePDSPMSUMMARY');
|
1493
|
if (overView != undefined) {
|
1494
|
overView.removeAll();
|
1495
|
overView.loadData(data2);
|
1496
|
}
|
1497
|
|
1498
|
dataTotal = {
|
1499
|
AdjustedIndex : data47[0].AdjustedIndex,
|
1500
|
AdjustedScore : data47[0].AdjustedScore,
|
1501
|
CalculatedScore : data47[0].CalculatedScore,
|
1502
|
IndexScore : data47[0].CalculatedIndex
|
1503
|
};
|
1504
|
|
1505
|
dataTotalList = [];
|
1506
|
dataTotalList[0] = dataTotal;
|
1507
|
|
1508
|
var overView = Ext.StoreMgr.lookup('storePDSPMSUMTOTAL');
|
1509
|
if (overView != undefined) {
|
1510
|
overView.removeAll();
|
1511
|
overView.loadData(dataTotalList);
|
1512
|
}
|
1513
|
});
|
1514
|
},
|
1515
|
|
1516
|
addNewQualification : function () {
|
1517
|
var me = this;
|
1518
|
var count_lookup = Ext.ComponentQuery.query('[name=AddNewQualification]').length;
|
1519
|
if (count_lookup == 1) {
|
1520
|
Ext.ComponentQuery.query('[name=AddNewQualification]')[0].show();
|
1521
|
} else {
|
1522
|
Ext.create('Ext.window.Window', {
|
1523
|
title : 'Add Qualification',
|
1524
|
name : 'AddNewQualification',
|
1525
|
layout : 'fit',
|
1526
|
items : [{
|
1527
|
xtype : 'form',
|
1528
|
name : 'formAddQualification',
|
1529
|
items : [{
|
1530
|
xtype : 'minovaForm',
|
1531
|
bodyBorder : false,
|
1532
|
cls : 'borderLookup',
|
1533
|
border : false,
|
1534
|
isLookup : false,
|
1535
|
name : "mainformAddQualification",
|
1536
|
tableName : 'PDSPMLOOKUPQUAL'
|
1537
|
}
|
1538
|
]
|
1539
|
}
|
1540
|
],
|
1541
|
buttons : [{
|
1542
|
text : 'Add Qualification',
|
1543
|
name : 'BtnAddKPI',
|
1544
|
iconCls : 'fa-save',
|
1545
|
style : 'font-family: FontAwesome',
|
1546
|
margin : '3 3 10 3',
|
1547
|
handler : function () {
|
1548
|
me.addNewQualificationtoGrid();
|
1549
|
}
|
1550
|
}, {
|
1551
|
text : 'Cancel',
|
1552
|
name : 'BtnCancelQualification',
|
1553
|
iconCls : 'fa-reply',
|
1554
|
style : 'font-family: FontAwesome',
|
1555
|
margin : '3 3 10 3',
|
1556
|
handler : function () {
|
1557
|
Ext.ComponentQuery.query('[name=AddNewQualification]')[0].destroy();
|
1558
|
}
|
1559
|
}
|
1560
|
]
|
1561
|
}).show();
|
1562
|
}
|
1563
|
},
|
1564
|
|
1565
|
addNewQualificationtoGrid : function () {
|
1566
|
var seq = Ext.ComponentQuery.query('[name=Sequence]')[0].getValue();
|
1567
|
var pnl = Ext.ComponentQuery.query('[name=gridPHRPA0051]')[0];//Ext.ComponentQuery.query('[name=PHRPA0051]')[0];
|
1568
|
var str = pnl.store;
|
1569
|
|
1570
|
if (str.findRecord('QualificationID', Ext.ComponentQuery.query('[name=Qualification]')[0].getValue()) != null) {
|
1571
|
return;
|
1572
|
}
|
1573
|
|
1574
|
var leafCount = 0;
|
1575
|
pnl.getRootNode().cascadeBy(function (node) {
|
1576
|
if (!node.isLeaf())
|
1577
|
leafCount++;
|
1578
|
});
|
1579
|
var data = '';
|
1580
|
var Sequence = 0;
|
1581
|
if (leafCount == 0) {
|
1582
|
Sequence = 1;
|
1583
|
} else {
|
1584
|
Sequence = 1 + leafCount;
|
1585
|
}
|
1586
|
|
1587
|
var form_ = Ext.ComponentQuery.query('[name=mainformPerformance]')[0];
|
1588
|
var formdata_ = form_.getForm();
|
1589
|
|
1590
|
var data = {
|
1591
|
"EmployeeID" : formdata_.findField('EmployeeID').getValue(),
|
1592
|
"HeaderSequence" : formdata_.findField('Sequence').getValue(),
|
1593
|
"Sequence" : Sequence,
|
1594
|
"AppraisalType" : formdata_.findField('AppraisalType').getValue()
|
1595
|
};
|
1596
|
var data2 = null;
|
1597
|
/*var params = {
|
1598
|
serviceName : 'Performance.asmx',
|
1599
|
methodName : 'SetQualification',
|
1600
|
parameter : 'TableName=' + 'PHRPA0051'
|
1601
|
+ '&Qualification=' + Ext.ComponentQuery.query('[name=Qualification]')[0].getValue()
|
1602
|
+ '&data=' + Ext.encode(data)
|
1603
|
};
|
1604
|
MinovaAjaxPostSync('/InvokeService/Invoke/', params, function (xhr) {
|
1605
|
var result = Ext.decode(xhr.responseText);
|
1606
|
data2 = result.data;
|
1607
|
if (result.success) {console.log(data2);}
|
1608
|
else {
|
1609
|
MinovaMessage('', '000005', result.message.text, 'E');
|
1610
|
}
|
1611
|
});*/
|
1612
|
|
1613
|
var a = Ext.ComponentQuery.query('[name=mainformAddQualification]')[0];
|
1614
|
var b = a.getValues();
|
1615
|
var d = '';
|
1616
|
Ext.Ajax.request({
|
1617
|
method: 'POST',
|
1618
|
async: false,
|
1619
|
url: '/UserControl/GetStore',
|
1620
|
params: {
|
1621
|
//tableName: 'PHROM0001',
|
1622
|
//param: 'ObjectClass[=]Q,ObjectID[=]' + Ext.ComponentQuery.query('[name=Qualification]')[0].getValue() + ',EndDate[<=]' + b.StartDate + ',EndDate[>=]' + b.StartDate
|
1623
|
tableName : 'PHROM0002',
|
1624
|
param : 'ObjectClass[=]QG,RelationshipClass[=]Q,RelationshipObject[=]' + Ext.ComponentQuery.query('[name=Qualification]')[0].getValue() + ',StartDate[<=]' + b.StartDate + ',EndDate[>=]' + b.StartDate
|
1625
|
},
|
1626
|
success: function (response) {
|
1627
|
var results = Ext.decode(response.responseText);
|
1628
|
if (results.data != null && results.data.length > 0) {
|
1629
|
d = results.data[0].ObjectID;
|
1630
|
//data2 = results.data; console.log(data2);
|
1631
|
}
|
1632
|
}
|
1633
|
});
|
1634
|
|
1635
|
//var children = eval("children:" + data2);
|
1636
|
data = {
|
1637
|
QualificationGroup: d, //// add by Tri nwh
|
1638
|
EmployeeID : Ext.ComponentQuery.query('[name=EmployeeID]')[0].getValue(),
|
1639
|
AppraisalType : Ext.ComponentQuery.query('[name=AppraisalType]')[0].getValue(),
|
1640
|
QualificationID : Ext.ComponentQuery.query('[name=Qualification]')[0].getValue(),
|
1641
|
Sequence : Sequence,
|
1642
|
Description : Ext.ComponentQuery.query('[name=Qualification]')[0].value.split('-')[1].substr(1),
|
1643
|
HeaderSequence : seq,
|
1644
|
SequenceSub : "0",
|
1645
|
Weight : 0,
|
1646
|
leaf : false,
|
1647
|
Target : 1,
|
1648
|
//children,
|
1649
|
expanded : true
|
1650
|
,App2Score : 0 //// ---- add by Tri nwh 20220601
|
1651
|
,App1Percentage : 0 //// ---- add by Tri nwh 20220601
|
1652
|
,App2Percentage : 0 //// ---- add by Tri nwh 20220601
|
1653
|
};
|
1654
|
|
1655
|
var task = pnl.getRootNode();
|
1656
|
task.appendChild(data);
|
1657
|
Ext.ComponentQuery.query('[name=AddNewQualification]')[0].destroy();
|
1658
|
},
|
1659
|
|
1660
|
loadQualification : function () {
|
1661
|
var pnl = Ext.ComponentQuery.query('[name=gridPHRPA0051]')[0];//Ext.ComponentQuery.query('[name=PHRPA0051]')[0];
|
1662
|
var _result = undefined;
|
1663
|
var Head = undefined;
|
1664
|
|
1665
|
Ext.Ajax.request({
|
1666
|
async : false,
|
1667
|
//method : 'POST',
|
1668
|
url : '/UserControl/GetStore',
|
1669
|
params : {
|
1670
|
tableName : 'PHRPA0051',
|
1671
|
param : 'EmployeeID[=]' + Ext.ComponentQuery.query('[name=EmployeeID]')[0].getValue()
|
1672
|
+ ',AppraisalType[=]' + Ext.ComponentQuery.query('[name=AppraisalType]')[0].getValue()
|
1673
|
+ ',HeaderSequence[=]' + Ext.ComponentQuery.query('[name=Sequence]')[0].getValue()
|
1674
|
},
|
1675
|
success : function (response) {
|
1676
|
_result = Ext.decode(response.responseText);
|
1677
|
if (_result.success) {
|
1678
|
var data = _result.data;
|
1679
|
Head = $.grep(data, function (r) {
|
1680
|
return r.SequenceSub == 0
|
1681
|
});
|
1682
|
var Child = $.grep(data, function (r) {
|
1683
|
return r.SequenceSub != 0
|
1684
|
});
|
1685
|
Ext.Array.each(Child, function (rec) {
|
1686
|
rec['leaf'] = true;
|
1687
|
})
|
1688
|
pnl.store.load();
|
1689
|
var task = pnl.getRootNode();
|
1690
|
Ext.Array.each(Head, function (rec) {
|
1691
|
var QChild = $.grep(Child, function (r) {
|
1692
|
return r.QualificationID == rec.QualificationID
|
1693
|
});
|
1694
|
rec['children'] = QChild;
|
1695
|
rec['expanded'] = true;
|
1696
|
task.appendChild(rec);
|
1697
|
})
|
1698
|
}
|
1699
|
}
|
1700
|
});
|
1701
|
},
|
1702
|
|
1703
|
deleteQualification : function () {
|
1704
|
var main_ = Ext.ComponentQuery.query('[name=gridPHRPA0051]')[0];//Ext.ComponentQuery.query('[name=PHRPA0051]')[0];
|
1705
|
var record = main_.getView().selection;
|
1706
|
|
1707
|
if (record == null) {
|
1708
|
MinovaMessage('', 'PMSE003', '', 'E');
|
1709
|
return;
|
1710
|
}
|
1711
|
|
1712
|
var _d = record.data;
|
1713
|
if (_d.SequenceSub != 0) {
|
1714
|
MinovaMessage('', 'PMSE003', '', 'E');
|
1715
|
return;
|
1716
|
}
|
1717
|
record.remove();
|
1718
|
},
|
1719
|
|
1720
|
deleteKPI : function () {
|
1721
|
var main_ = Ext.ComponentQuery.query('[name=gridPHRPA0049]')[0];
|
1722
|
var record = main_.getView().selection;
|
1723
|
|
1724
|
if (record == null) {
|
1725
|
MinovaMessage('', 'PMSE003', '', 'E');
|
1726
|
return;
|
1727
|
}
|
1728
|
|
1729
|
var _d = record.data;
|
1730
|
if (_d.SequenceSubKPI != 0) {
|
1731
|
MinovaMessage('', 'PMSE003', '', 'E');
|
1732
|
return;
|
1733
|
}
|
1734
|
record.remove();
|
1735
|
},
|
1736
|
|
1737
|
setDefaultAppbyOM : function () {
|
1738
|
var StartDate = Ext.ComponentQuery.query('[name=StartDate]')[0].getValue();
|
1739
|
var EndDate = Ext.ComponentQuery.query('[name=EndDate]')[0].getValue();
|
1740
|
var AppraisalType = Ext.ComponentQuery.query('[name=AppraisalType]')[0].getValue();
|
1741
|
var EmployeeID = getParam("EmployeeID");
|
1742
|
var Result = null;
|
1743
|
var params = {
|
1744
|
serviceName : 'Performance.asmx',
|
1745
|
methodName : 'GetDefaultAppraiser',
|
1746
|
parameter :
|
1747
|
'EmployeeID=' + EmployeeID
|
1748
|
+ '&StartDate=' + StartDate
|
1749
|
+ '&EndDate=' + EndDate
|
1750
|
+ '&AppraisalType=' + AppraisalType
|
1751
|
};
|
1752
|
MinovaAjaxPost('/InvokeService/Invoke/', params, function (xhr) {
|
1753
|
Result = Ext.decode(xhr.responseText);
|
1754
|
if (Result.success) {
|
1755
|
var pnl0048 = Ext.StoreMgr.lookup("storePHRPA0048");
|
1756
|
pnl0048.add(Ext.decode(Result.data));
|
1757
|
} else {}
|
1758
|
})
|
1759
|
},
|
1760
|
|
1761
|
saveToMDProfile : function () {
|
1762
|
var me = this;
|
1763
|
var pnl = Ext.ComponentQuery.query('[name=gridPHRPA0051]')[0];//Ext.ComponentQuery.query('[name=PHRPA0051]')[0];
|
1764
|
var storequal = pnl.store;
|
1765
|
var PA0051_dATA = null;
|
1766
|
var dataMD8002 = null;
|
1767
|
if (storequal != undefined) {
|
1768
|
pnl.expandAll();
|
1769
|
var _data = Ext.pluck(storequal.data.items, 'data');
|
1770
|
Ext.Array.each(_data, function (rec) {
|
1771
|
rec.children = null
|
1772
|
})
|
1773
|
PA0051_dATA = Ext.encode(_data);
|
1774
|
dataMD8002 = $.grep(Ext.decode(PA0051_dATA), function (r) {
|
1775
|
r['StartDate'] = Ext.ComponentQuery.query('[name=StartDate]')[0].getValue();
|
1776
|
r['EndDate'] = Ext.ComponentQuery.query('[name=EndDate]')[0].getValue();
|
1777
|
r['QualificationLevel'] = r.AppraiserScore
|
1778
|
return r.SequenceSub == 0
|
1779
|
});
|
1780
|
}
|
1781
|
var Result = null;
|
1782
|
var params = {
|
1783
|
serviceName : 'Performance.asmx',
|
1784
|
methodName : 'SaveToMD',
|
1785
|
parameter :
|
1786
|
'TableName=' + 'PHRPA0045'
|
1787
|
+ '&dataDetail=' + Ext.encode(dataMD8002)
|
1788
|
+ '&Token=' + MinovaUtil.SESSIONS.Token
|
1789
|
};
|
1790
|
MinovaAjaxPost('/InvokeService/Invoke/', params, function (xhr) {
|
1791
|
Result = Ext.decode(xhr.responseText);
|
1792
|
if (Result.success) {
|
1793
|
MinovaMessage('', 'PY0000', '', 'S');
|
1794
|
} else {
|
1795
|
MinovaMessage('', '000005', Result.message.text, 'E');
|
1796
|
}
|
1797
|
})
|
1798
|
},
|
1799
|
|
1800
|
SaveToMDHistory : function () {
|
1801
|
var me = this;
|
1802
|
var form = Ext.ComponentQuery.query('[name=mainformPerformance]')[0];
|
1803
|
var form_ = form.getForm();
|
1804
|
var data = form_.getValues();
|
1805
|
var Sum = Ext.StoreMgr.lookup("storePDSPMSUMMARY");
|
1806
|
var DataSum = Ext.encode(Ext.pluck(Sum.data.items, 'data'));
|
1807
|
Ext.Array.each(Ext.decode(DataSum), function (rec) {
|
1808
|
if (rec.Type == "KPI") {
|
1809
|
data["AdjustedKPI"] = rec.AdjustedScore;
|
1810
|
data["CalculatedKPI"] = rec.CalculatedScore;
|
1811
|
data["KPIFinalScore"] = rec.FinalScore;
|
1812
|
data["KPITotalScore"] = rec.TotalScore;
|
1813
|
data["KPITotalWeight"] = rec.Weight;
|
1814
|
} else {
|
1815
|
data["AdjustedCompetency"] = rec.AdjustedScore;
|
1816
|
data["CalculatedCompetency"] = rec.CalculatedScore;
|
1817
|
data["QualFinalScore"] = rec.FinalScore;
|
1818
|
data["QualTotalScore"] = rec.TotalScore;
|
1819
|
data["QualTotalWeight"] = rec.Weight;
|
1820
|
}
|
1821
|
})
|
1822
|
var TotalSum = Ext.StoreMgr.lookup("storePDSPMSUMTOTAL");
|
1823
|
var dataTotalSum = Ext.pluck(TotalSum.data.items, 'data');
|
1824
|
data["AdjustedIndex"] = dataTotalSum[0].AdjustedIndex;
|
1825
|
data["AdjustedScore"] = dataTotalSum[0].AdjustedScore;
|
1826
|
data["CalculatedScore"] = dataTotalSum[0].CalculatedScore;
|
1827
|
data["CalculatedIndex"] = dataTotalSum[0].IndexScore;
|
1828
|
|
1829
|
var Result = null;
|
1830
|
var params = {
|
1831
|
serviceName : 'Performance.asmx',
|
1832
|
methodName : 'SaveToMD',
|
1833
|
parameter :
|
1834
|
'TableName=' + 'PHRPA0029'
|
1835
|
+ '&dataDetail=' + '[' + Ext.encode(data) + ']'
|
1836
|
+ '&Token=' + MinovaUtil.SESSIONS.Token
|
1837
|
};
|
1838
|
MinovaAjaxPost('/InvokeService/Invoke/', params, function (xhr) {
|
1839
|
Result = Ext.decode(xhr.responseText);
|
1840
|
if (Result.success) {
|
1841
|
MinovaMessage('', 'PY0000', '', 'S');
|
1842
|
} else {
|
1843
|
MinovaMessage('', '000005', Result.message.text, 'E');
|
1844
|
}
|
1845
|
})
|
1846
|
}
|
1847
|
});
|