topPage.js 1.06 KB
Newer Older
Takumi Imai committed
1 2 3
/**
 * common js of top page.
 * top page is dashboard and operationList.
4
 *
Takumi Imai committed
5
 * @since cms:1.4.3.2&1.4.3.3 web:1.0
Takumi Imai committed
6 7
 */

8
var TOP = {};
Takumi Imai committed
9 10 11

$(document).ready(function () {
    //setting lang info
12
    COMMON.setLangCodeWeb();
13

Takumi Imai committed
14
    //Check if user is logged in
15
    COMMON.checkAuth(false);
Takumi Imai committed
16 17

    //setting msg of html
18
    COMMON.updateLang();
Takumi Imai committed
19 20 21 22 23
});

/**
 * show page
 */
24 25
TOP.init = function () {
    COMMON.showLoading();
26
    FOOTER.initFooter(); //app should get data after initFooter
27
    COMMON.closeLoading();
Takumi Imai committed
28 29 30 31
};

/**
 * Show page by arbitrary id
32 33
 *
 * @param {String} pageId
Takumi Imai committed
34
 */
35
TOP.showPage = function (pageId) {
Takumi Imai committed
36
    //get data
37 38 39
    if (pageId == CONSTANT.PAGE_NAME.OPERATION_LIST) {
        OL.init();
    } else if (pageId == CONSTANT.PAGE_NAME.DASHBOARD) {
Takumi Imai committed
40 41 42 43
        CHK_Dashboard.init();
    }

    //show page
44
    const pages = document.getElementsByClassName('page-content');
Takumi Imai committed
45 46
    for (let i = 0; i < pages.length; i++) {
        if (pages[i].id == pageId) {
47
            pages[i].style.display = 'block';
Takumi Imai committed
48
        } else {
49
            pages[i].style.display = 'none';
Takumi Imai committed
50 51
        }
    }
52
};