VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/keeview_app/html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/keeview_app/html/human_resource_request.js
hr.human_resource_request.redraw = function(host, changeType, singlePage2){
    return new Promise(function(resolveMn, rejectMn){
        var type = host.type_select.value;
        console.log(changeType);
        if (changeType){
            var func1 = function(){
                console.log(1111);
                if (!hr.isMobile){
                    DOMElement.removeAllChildren(singlePage2.policy_select_ctn);
                    host[type].policy_select = absol.buildDom({
                        tag: "selectmenu",
                        props: {
                            items: host[type].listPolicy,
                            enableSearch: true
                        },
                        on: {
                            change: function(){
                                console.log(host[type]);
                                host[type].policy_change_func();
                            }
                        }
                    });
                    singlePage2.policy_select_ctn.appendChild(host[type].policy_select);
                }
                else {
                    host.paramsInit.listPolicy = host[type].listPolicy;
                    host.paramsInit.policy_change_func = host[type].policy_change_func;
                    host[type].policy_select = singlePage2.policy_select;
                }
                host[type].employee_select = singlePage2.employee_select;
                host[type].status_select = singlePage2.status_select;
                host[type].period_select = singlePage2.period_select;
                host[type].month_select = singlePage2.month_select;
                host[type].quarter_select = singlePage2.quarter_select;
                host[type].year_select = singlePage2.year_select;
                host[type].inputsearchbox = singlePage2.inputsearchbox;
                host[type].approval_btn_ctn = singlePage2.approval_btn_ctn;
                host[type].data_container = singlePage2.data_container;
                host[type].deny_btn_ctn = singlePage2.deny_btn_ctn;
                if (type == "overtime" || type == "advance_payment"){
                    hr[type + "_request"].init2(host[type]);
                }
                else {
                    hr[type + "_list"].init2(host[type]);
                }
            };
            if (!host[type]){
                host[type] = {
                    database: EncodingClass.string.duplicate(host.database),
                    employeeOfMe: host.employeeOfMe,
                    directSubOfMe: host.directSubOfMe,
                    directManageOfMe: host.directManageOfMe,
                    indirectSubOfMe: host.indirectSubOfMe,
                    indirectManageOfMe: host.indirectManageOfMe,
                    employeeDic: host.employeeDic,
                    groupOfMe: host.groupOfMe,
                    frameList: host.frameList,
                    holder: host.holder
                };
                ModalElement.show_loading();
                if (type == "overtime" || type == "advance_payment"){
                    hr[type + "_request"].init(host[type]).then(function(){
                        ModalElement.close(-1);
                        func1();
                    });
                }
                else {
                    hr[type + "_list"].init(host[type]).then(function(){
                        ModalElement.close(-1);
                        func1();
                    });
                }
            }
            else {
                func1();
            }
        }
        else {
            if (type == "overtime" || type == "advance_payment"){
                hr[type + "_request"].init2(host[type]);
            }
            else {
                hr[type + "_list"].init2(host[type]);
            }
        }
    });
};

hr.human_resource_request.addNew = function(host){
    var type = host.type_select.value;
    switch (type) {
        case "leave":
            hr.leave_list.addLeave_list(host[type], 0);
            break;
        case "late_early_checkin":
            hr.late_early_checkin_list.addLate_early_checkin_list(host[type], 0);
            break;
        case "advance_payment":
            hr.advance_payment_request.addAdvance_payment_request(host[type], 0);
            break;
        case "overtime":
            hr.overtime_request.addOvertime_request(host[type], 0);
            break;
        default:
            ModalElement.alert({message: "Chưa chọn loại đề xuất"});
    }
};

hr.human_resource_request.init = function(host){
    return new Promise(function(resolveMn, rejectMn){
        hr.menu.changeCurrentUrlTab(host, "human_resource_request");
        host.database = {};
        ModalElement.show_loading();
        data_module.loadHumanResourceRequestInit().then(function(content){
            host.employeeOfMe = content.employeeOfMe;
            delete content.employeeOfMe;
            if (host.employeeOfMe.length == 0){
                LanguageModule.text("war_txt_you_need_to_link_with_an_employee_in_organization_chart_to_use_app_functions");
                return;
            }
            host.directSubOfMe = content.directSubOfMe;
            delete content.directSubOfMe;
            host.directManageOfMe = content.directManageOfMe;
            delete content.directManageOfMe;
            host.indirectSubOfMe = content.indirectSubOfMe;
            delete content.indirectSubOfMe;
            host.indirectManageOfMe = content.indirectManageOfMe;
            delete content.indirectManageOfMe;
            contentModule.makeDatabaseContent(host, content);
            contentModule.makeOrgsIndex(host);
            contentModule.makeEmployeeAllData(host);
            contentModule.makeEmployeesIndex(host);
            for (var i = 0; i < host.database.employees.items.length; i++){
                host.database.employees.items[i].orgIndex = host.database.orgs.getIndex(host.database.employees.items[i].orgid);
            }
            host.employeeDic = contentModule.makeDictionaryIndex(host.database.employees.items);
            var cmdbutton = {
                close: function (event, me) {
                    if (hr.isMobile){
                        host.holder.selfRemove();
                        theme.mobileInitBack();
                    }
                    else {
                        hr.menu.tabPanel.removeTab(host.holder.id);
                    }
                },
                approval: function(){
                    var type = host.type_select.value;
                    if (type == "overtime" || type == "advance_payment") hr[type + "_request"].approvalRequest(host[type], 0, false);
                    else hr[type + "_list"].approvalRequest(host[type], 0, false);
                },
                deny: function(){
                    var type = host.type_select.value;
                    if (type == "overtime" || type == "advance_payment") hr[type + "_request"].denyRequestConfirm(host[type], 0, false);
                    else hr[type + "_list"].denyRequestConfirm(host[type], 0, false);
                }
            };
            cmdbutton.add = function (event, me) {
                hr.human_resource_request.addNew(host, 0);
            };
            var typeItems = [
                {value: 0, text: LanguageModule.text("txt_select_value")},
                {value: "overtime", text: LanguageModule.text("txt_overtime_request")},
                {value: "leave", text: LanguageModule.text("txt_leave_request")},
                {value: "late_early_checkin", text: LanguageModule.text("txt_late_early_checkin_request")},
                {value: "advance_payment", text: LanguageModule.text("txt_advance_payment_request")}
            ];
            host.holder.addChild(host.frameList);
            host.paramsInit = {
                frameList: host.frameList,
                holder: host.holder,
                cmdbutton: cmdbutton,
                employeeOfMe: host.employeeOfMe,
                database: host.database,
                statusItem: [
                    {value: "all", text: LanguageModule.text("txt_all_status")},
                    {value: "waiting_approval", text: LanguageModule.text("txt_waiting_approval")},
                    {value: "over_due", text: LanguageModule.text("txt_over_due")},
                    {value: "approved", text: LanguageModule.text("txt_approved")},
                    {value: "deny", text: LanguageModule.text("txt_deny")}
                ],
                typeItems: typeItems,
                type_change_func: function(singlePage2){
                    hr.human_resource_request.redraw(host, true, singlePage2);
                },
                employee_change_func: function(){
                    hr.human_resource_request.redraw(host);
                },
                time_change_func: function(){
                    hr.human_resource_request.redraw(host);
                },
                status_change_func: function(){
                    hr.human_resource_request.redraw(host);
                }
            };
            var singlePage = theme.formHuman_resource_requestInit(host.paramsInit);
            host.type_select = singlePage.type_select;
            ModalElement.close(-1);
            resolveMn();
        });
    });
};

VaKeR 2022