Project

General

Profile

Bug #1497 » petralifePMS_goal20220908.txt

file pms goal - M Azid Wahyudi, 09/08/2022 12:28 PM

 
1

    
2
/*Strat OnDocAfterRender */
3

    
4

    
5
/* End OnDocAfterRender */
6

    
7
/* Start OnDocBefore Submit */
8

    
9

    
10
/* End OnDocBefore Submit */
11

    
12
/* start OnInitExtension */
13

    
14
'field[name=AppraisalPeriod_47]': {
15
    expand: function () {
16
		debugger
17
        periodMap();
18
    },
19
    select: function () {
20
		setDefaultAppraiser();
21
        setPeriod();
22
    }
23
},'button[name=PHRPA0048ESSAdd]': {
24
	click: function () {
25
		debugger
26
        ValRowAppraiser();
27
    }
28
},'field[name=AppraisalD_48]': {
29
	change: function () {
30
		fillNameAppr ();
31
	}
32
}
33

    
34
/* End OnInitExtension */
35

    
36
/* Start OnMethodExtension */
37

    
38
function periodMap() {
39
    var AppraisalType = Ext.ComponentQuery.query('[name=AppraisalType_47]')[0].getValue();
40
    var store = Ext.StoreManager.lookup('storeAppraisalPeriod_47');
41
    store.removeAll();
42
    MinovaUtil.ExecuteParamQuery({
43
        ID: "WFGOALPARAMPERIOD",
44
        EmployeeID: MinovaUtil.WORKFLOW.getEmpId(),
45
        AppraisalType: AppraisalType
46
    }, function (s) {
47
        var result = Ext.decode(s.responseText);
48
        Dt = Ext.decode(Ext.decode(result.data));
49
        store.loadData(Dt);
50
    }, function (f) {});
51
}
52
function setDefaultAppraiser() {
53
    var gridStore = Ext.StoreManager.lookup('storePHRPA0048ESS');
54
    MinovaUtil.ExecuteParamQuery({
55
        ID: 'WFPMSDEFAULTAPPRG',
56
        empid_requester: MinovaUtil.WORKFLOW.getEmpId(),
57
        now: MinovaUtil.GetNowDate()
58
    }, function (s) {
59
        try {
60
            var result = Ext.decode(s.responseText).data;
61
            var dataGrid = Ext.decode(Ext.decode(result));
62
            gridStore.loadData(dataGrid);
63
        } catch (e) {}
64
    }, function (e) {});
65
    setDefaultQUAL();
66
}
67
function setDefaultQUAL() {
68
    var gridStore = Ext.StoreManager.lookup('storePHRPA0051ESS');
69
    MinovaUtil.ExecuteParamQuery({
70
        ID: 'WFPMSDEFAULTQUALG',
71
        empid_requester: MinovaUtil.WORKFLOW.getEmpId(),
72
        now: MinovaUtil.GetNowDate()
73
    }, function (s) {
74
        try {
75
            var result = Ext.decode(s.responseText).data;
76
            var dataGrid = Ext.decode(Ext.decode(result));
77
            gridStore.loadData(dataGrid);
78
        } catch (e) {}
79
    }, function (e) {});
80
}
81
function setPeriod() {
82
    var AppraisalType = Ext.ComponentQuery.query('[name=AppraisalType_47]')[0].getValue();
83
    var AppraisalPeriod = Ext.ComponentQuery.query('[name=AppraisalPeriod_47]')[0].getValue();
84
    Ext.Ajax.request({
85
        async: false,
86
        method: 'POST',
87
        url: '/UserControl/GetStore',
88
        params: {
89
            tableName: 'PCMAPPPERIOD',
90
            param: 'Isactive[=]1,Apptype[=]' + AppraisalType + ',code[=]' + AppraisalPeriod
91
        },
92
        success: function (response) {
93
            var results = Ext.decode(response.responseText);
94
            Ext.ComponentQuery.query('[name=StartDate_47]')[0].setValue(results.data[0].Startdate);
95
            Ext.ComponentQuery.query('[name=EndDate_47]')[0].setValue(results.data[0].Enddate);
96
        }
97
    });
98
}
99
function ValRowAppraiser() {
100
	var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
101
	var gridStore = Ext.StoreManager.lookup('storePHRPA0048ESS');
102
	if (gridStore.data.length >= 6 ) {
103
		gridStore.removeAt(idx);
104
		Ext.Msg.alert('Alert', 'Sorry, Value cannot > 6');
105
	}
106
}
107
function fillNameAppr() {
108
	var AppraisalID = Ext.ComponentQuery.query('[name=AppraisalD_48]')[0].getValue();
109
	var store = Ext.StoreManager.lookup('storePHRPA0048ESS');
110
    MinovaUtil.ExecuteParamQuery({
111
        ID: "WFGOALAPPFILLNAME",
112
        appID: AppraisalID,
113
		now: MinovaUtil.GetNowDate()
114
    }, function (s) {
115
        var result = Ext.decode(s.responseText);
116
        Dt = Ext.decode(Ext.decode(result.data));
117
		var appName = Ext.ComponentQuery.query('[name=Appraisername_48]')[0];
118
		appName.setValue(Dt[0].Appraisername_48);
119
    }, function (f) {});
120
}
121

    
122
/* End OnMethodExtension */
(2-2/2)