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/activities_view.js
"use strict";

theme.addActivitiesTaskForm = function(params){
    var commands = [{
        icon:  DOMElement.i({
            attrs: {
                className: "material-icons"
            },
            text: "save"
        }),
        cmd: function(){
            params.func.save().then(function(){
                params.frameList.removeLast();
                hr.menu.showMobileTabbar(true);
            });
        }
    }];
    var header = absol.buildDom({
        tag: 'mheaderbar',
        props: {
            actionIcon: DOMElement.i({
                attrs: {
                    className: "material-icons"
                },
                text: "arrow_back_ios"
            }),
            title: params.title,
            commands: commands
        },
        on: {
            action: function(){
                params.func.cancel().then(function(){
                    params.frameList.removeLast();
                });
            },
            command: function(event){
                event.commandItem.cmd();
            }
        }
    });
    var singlePage = absol.buildDom({
        tag: 'tabframe',
        child:[
            header,
            DOMElement.div({
                attrs: {
                    className: "card-mobile-content"
                },
                children: [params.formContainer]
            })
        ]
    });
    params.frameList.addChild(singlePage);
    singlePage.requestActive();
    hr.menu.showMobileTabbar(false);
};

theme.addActivitiesMeetingForm = function(params){
    var commands = [{
        icon:  DOMElement.i({
            attrs: {
                className: "material-icons"
            },
            text: "save"
        }),
        cmd: function(){
            params.func.save().then(function(){
                params.frameList.removeLast();
                hr.menu.showMobileTabbar(true);
            });
        }
    }];
    var header = absol.buildDom({
        tag: 'mheaderbar',
        props: {
            actionIcon: DOMElement.i({
                attrs: {
                    className: "material-icons"
                },
                text: "arrow_back_ios"
            }),
            title: params.title,
            commands: commands
        },
        on: {
            action: function(){
                params.func.cancel().then(function(){
                    params.frameList.removeLast();
                });
            },
            command: function(event){
                event.commandItem.cmd();
            }
        }
    });
    var singlePage = absol.buildDom({
        tag: 'tabframe',
        child:[
            header,
            DOMElement.div({
                attrs: {
                    className: "card-mobile-content"
                },
                children: [params.formContainer]
            })
        ]
    });
    params.frameList.addChild(singlePage);
    singlePage.requestActive();
    hr.menu.showMobileTabbar(false);
};

theme.formActivitiesView = function(host, params){
    var scrollInto = function(value){
        if (sectionList[value]) sectionList[value].scrollIntoView();
    };
    var drawGeneralInformation = function(){
        var viewGeneralInformation = DOMElement.div({
            attrs: {
                style: {
                    paddingTop: "var(--control-verticle-distance-2)"
                }
            }
        });
        host.drawGeneralInforFunc(viewGeneralInformation);
        var childs = [
            {
                class: 'm-mk-section-header-name',
                child: { text: LanguageModule.text("txt_general_information") },
            }
        ];
        childs.push({
            class: 'm-mk-section-header-right',
            child: [
                DOMElement.a({
                    attrs: {
                        onclick: function(){
                            params.editInforFunc();
                        }
                    },
                    text: LanguageModule.text("txt_edit")
                })
            ]
        });
        var res = absol.buildDom({
            attr: {
                "data-sectionid": "general_information"
            },
            child: [
                absol.buildDom({
                    class: ["m-mk-section-header", "first"],
                    child: childs
                }),
                viewGeneralInformation
            ]
        });
        return res;
    };
    host.nameViewCtn = DOMElement.div({});
    var data_ctn = DOMElement.div({});
    data_ctn.appendChild(drawGeneralInformation());
    data_ctn.appendChild(contentModule.drawComment({taskid: params.activityid, tablename: params.activityType, frameList: host.frameList}));
    var sectionList = {};
    absol.$("div", data_ctn, function(elt){
        var id = elt.getAttribute("data-sectionid");
        if (!id) return;
        sectionList[id] = elt;
    });
    var header = absol.buildDom({
        tag: 'mheaderbar',
        props: {
            actionIcon: DOMElement.i({
                attrs: {
                    className: "material-icons"
                },
                text: "arrow_back_ios"
            }),
            title: host.nameViewCtn,
            quickmenu: {
                props: {
                    extendClasses: 'cd-context-menu',
                    items: [
                        {
                            text: LanguageModule.text("txt_general_information"),
                            icon: DOMElement.i({
                                attrs: {
                                    className: "mdi mdi-information-outline"
                                }
                            }),
                            extendClasses: "bsc-quickmenu",
                            cmd: function(){
                                scrollInto("general_information");
                            }
                        },
                        {
                            text: LanguageModule.text("txt_comment"),
                            icon: DOMElement.i({
                                attrs: {
                                    className: "mdi mdi-comment-multiple-outline"
                                }
                            }),
                            extendClasses: "bsc-quickmenu",
                            cmd: function(){
                                scrollInto("comment");
                            }
                        }
                    ]
                },
                onSelect: function (x) {
                    x.cmd();
                }
            }
        },
        on: {
            action: function(){
                host.frameList.removeLast();
                hr.menu.showMobileTabbar(true);
            }
        }
    });
    var singlePage = absol.buildDom({
        tag: 'tabframe',
        child:[
            header,
            DOMElement.div({
                attrs: {
                    className: "card-mobile-content"
                },
                children: [data_ctn]
            })
        ]
    });
    host.frameList.addChild(singlePage);
    singlePage.requestActive();
    hr.menu.showMobileTabbar(false);
};

theme.formActivitiesGetRow = function(params, content){
    var cells = [
        {
            style: {textAlign: "center"},
            innerText: "",
            render: function(tdElt){
                tdElt.addChild(absol._({
                    tag: "checkbox",
                    props: {
                        checked: content.status == 1
                    },
                    on: {
                        change: function(){
                            content.func.changeStatus(this.checked);
                        }
                    }
                }));
            }
        },
        {
            innerText: content.name,
            render: function(tdElt){
                tdElt.addChild(DOMElement.div({
                    attrs: {
                        onclick: function(){
                            content.func.view(function(value){
                                if (value === undefined){
                                    var x = params.tableView.rowOf(row);
                                    x.remove();
                                }
                                else {
                                    params.tableView.replaceRow(theme.formActivitiesGetRow(params, value), row);
                                }
                            });
                        }
                    },
                    text: content.name
                }));
            }
        },
        {
            style: {textAlign: "center"},
            innerText: "",
            render: function(tdElt){
                tdElt.addChild(DOMElement.div({
                    children: [contentModule.getMarkIcon(content.marked, content.func.markedFunc)]
                }));
            }
        }
    ];
    cells.push({
        style: {width: "40px", textAlign: "center"},
        render: function(tdElt){
            var qmenuButton = DOMElement.div({
                children: [DOMElement.i({
                    attrs: {
                        className: "material-icons bsc-icon-hover-black"
                    },
                    text: "more_horiz"
                })]
            });
            var quickMenuItems = [
                {
                    text: LanguageModule.text("txt_view"),
                    extendClasses: "bsc-quickmenu",
                    icon: DOMElement.i({
                        attrs: {
                            className: "material-icons"
                        },
                        text: "visibility"
                    }),
                    onclick: function(){
                        content.func.view(function(value){
                            if (value === undefined){
                                var x = params.tableView.rowOf(row)
                                x.remove();
                            }
                            else {
                                params.tableView.replaceRow(theme.formActivitiesGetRow(params, value), row);
                            }
                        });
                    }
                }
            ];
            if (content.func.delete) quickMenuItems.push({
                text: LanguageModule.text("txt_delete"),
                extendClasses: ["bsc-quickmenu", "red"],
                icon: DOMElement.i({
                    attrs: {
                        className: "material-icons"
                    },
                    text: "delete"
                }),
                cmd: function(){
                    content.func.delete().then(function(value){
                        var x = params.tableView.rowOf(row)
                        x.remove();
                    });
                }
            });
            absol.QuickMenu.showWhenClick(qmenuButton, {items: quickMenuItems}, [3, 4], function (menuItem) {
                if (menuItem.cmd) menuItem.cmd();
            });
            tdElt.addChild(qmenuButton);
        }
    });
    var row = {
        cells: cells
    };
    row.view = function(){
        content.func.view(function(value){
            if (value === undefined){
                var x = params.tableView.rowOf(row);
                x.remove();
            }
            else {
                params.tableView.replaceRow(theme.formActivitiesGetRow(params, value), row);
            }
        });
    };
    return row;
};

theme.formActivitiesContentData = function(params){
    return new Promise(function(rs, rj){
        DOMElement.removeAllChildren(params.data_container);
        var data = [];
        // for (var i = 0; i < params.data.length; i++){
        //     data.push(theme.formActivitiesGetRow(params, params.getRow(params.data[i])));
        // }
        params.tableView = absol.buildDom({
            tag: "dynamictable",
        style:{
            height:"calc(var(--body-height) - 230px)"
        },
            props: {
                adapter: {
                   data: {
                       head: {
                           rows: []
                       },
                       body: {
                           rows: data
                       }
                   }
               }
            }
        });
        params.tableView.attachSearchInput(params.inputsearchbox);
        params.tableView.requestQuery();
        params.data_container.appendChild(params.tableView);
        params.data_container.insertData = function(list){
            var x, y;
            var rows = [];
            for (var i = 0; i < list.length; i++){
                x = params.getRow(list[i].id);
                if (x) {
                    y = theme.formActivitiesGetRow(params, x);
                    rows.push(y);
                }
            }
            params.tableView.addRows(rows);
            // params.tableView.notifyRowsChange();
            return y;
        };
        rs();
    });
};

theme.formActivitiesInit = function (params){
    var filterFunc = function(){
        theme.modalFormMobile({
            title: LanguageModule.text("txt_filter"),
            bodycontent: filter_bodycontent
        });
    };
    var activity_type = absol.buildDom({
        tag: "mselectmenu",
        style: {
            display: "block",
            width: "100%"
        },
        props: {
            items: [
                {value: "all", text: LanguageModule.text("txt_all_activities")},
                {value: "type_task", text: LanguageModule.text("txt_task")},
                {value: "type_meeting", text: LanguageModule.text("txt_meeting")}
            ],
            enableSearch: true
        },
        on: {
            // change: function(){
            //     params.filter_change_func();
            // }
        }
    });
    var status = absol.buildDom({
        tag: "mselectmenu",
        style: {
            display: "block",
            wdith: "100%"
        },
        props: {
            items: [
                {value: "all", text: LanguageModule.text("txt_all_status")},
                {value: "completed", text: LanguageModule.text("txt_completed")},
                {value: "uncompleted", text: LanguageModule.text("txt_uncompleted")},
                {value: "overdue", text: LanguageModule.text("txt_over_due")},
                {value: "doing", text: LanguageModule.text("txt_doing")}
            ],
            enableSearch: true
        },
        on: {
            // change: function(){
            //     params.filter_change_func();
            // }
        }
    });
    var employee = absol.buildDom({
        tag: "multichecktreemenu",
        style: {
            display: "block",
            width: "100%"
        },
        props: {
            items: params.employeeItems,
            enableSearch: true
        },
        on: {
            // change: function(){
            //     params.filter_change_func();
            // }
        }
    });
    var filter_bodycontent;
    var time = contentModule.reportTimeModule({
        value: {
            relativeTime: 15
        },
        class: params.timeClass,
        container: filter_bodycontent,
        change: function(){
            // params.filter_change_func();
            time.emit('change');
        }
    });

    absol.OOP.extends(time, absol.EventEmitter.prototype);
    absol.EventEmitter.call(time);
    filter_bodycontent = DOMElement.div({
        children: [
            DOMElement.div({
                attrs: {
                    className: "card-mobile-label-form-edit-first"
                },
                text: LanguageModule.text("txt_activities_type")
            }),
            activity_type,
            DOMElement.div({
                attrs: {
                    className: "card-mobile-label-form-edit"
                },
                text: LanguageModule.text("txt_status")
            }),
            status,
            DOMElement.div({
                attrs: {
                    className: "card-mobile-label-form-edit"
                },
                text: LanguageModule.text("txt_employee")
            }),
            employee,
            DOMElement.div({
                attrs: {
                    className: "card-mobile-label-form-edit"
                },
                text: LanguageModule.text("txt_time")
            }),
            time.timeElt,
            DOMElement.div({
                attrs: {style: {paddingTop: "var(--control-verticle-distance-2)"}},
                children: [
                    DOMElement.div({
                        attrs: {
                            className: params.timeClass,
                            style: {
                                display: "none",
                                paddingBottom: "var(--control-horizontal-distance-2)",
                                paddingRight: "var(--control-horizontal-distance-2)"
                            }
                        },
                        children: [time.startElt]
                    }),
                    DOMElement.div({
                        attrs: {
                            className: params.timeClass,
                            style: {
                                display: "none"
                            }
                        },
                        children: [time.endElt]
                    })
                ]
            })
        ]
    });
    var commands = [];
    commands.push({
        icon:  DOMElement.i({
            attrs: {
                className: "material-icons m-hr-icon-filter active"
            },
            text: "filter_alt"
        }),
        cmd: function(){
            filterFunc();
        }
    });
    commands.push({
        icon:  DOMElement.i({
            attrs: {
                className: "material-icons"
            },
            text: "search"
        }),
        cmd: function(){
            header.searchMode(true);
        }
    });
    var inputsearchbox = absol.buildDom({
        tag: 'searchcrosstextinput',
        style: {
            width: "var(--searchbox-width)"
        },
        props:{
            placeholder: LanguageModule.text("txt_search")
        }
    });
    var quickmenuItems = [];
    if (params.cmdbutton.addTask !== undefined){
        quickmenuItems.push({
            text: LanguageModule.text("txt_add_task"),
            extendClasses: "bsc-quickmenu",
            icon:  DOMElement.i({
                attrs: {
                    className: "material-icons"
                },
                text: "add"
            }),
            cmd: params.cmdbutton.addTask
        });
    }
    if (params.cmdbutton.addMeeting !== undefined){
        quickmenuItems.push({
            text: LanguageModule.text("txt_add_meeting"),
            extendClasses: "bsc-quickmenu",
            icon:  DOMElement.i({
                attrs: {
                    className: "material-icons"
                },
                text: "add"
            }),
            cmd: params.cmdbutton.addMeeting
        });
    }
    var header = absol.buildDom({
        tag: 'headerbarwithsearch',
        props: {
            actionIcon: DOMElement.i({
                attrs: {
                    className: "material-icons"
                },
                text: "arrow_back_ios"
            }),
            title: LanguageModule.text("txt_activities"),
            commands: commands,
            quickmenu: {
                props: {
                    extendClasses: 'cd-context-menu',
                    items: quickmenuItems
                },
                onSelect: function (x) {
                    x.cmd();
                }
            }
        },
        data:{
            searchInput: inputsearchbox
        },
        on: {
            action: params.cmdbutton.close,
            command: function(event){
                event.commandItem.cmd();
            }
        }
    });
    var singlePage = absol.buildDom({
        tag: 'tabframe',
        child:[
            header,
            DOMElement.div({
                attrs: {
                    className: "card-mobile-content"
                },
                children: [
                    params.chartContainer,
                    params.data_container
                ]
            })
        ]
    });
    singlePage.status = status;
    singlePage.activity_type = activity_type;
    singlePage.inputsearchbox = inputsearchbox;
    singlePage.time = time;
    singlePage.employee = employee;
    return singlePage;
};

ModuleManagerClass.register({
    name: "Activities_view",
    prerequisites: ["ModalElement"]
});

VaKeR 2022