/**
 * common js of top page.
 * top page is dashboard and operationList.
 *
 * @since cms:1.4.3.2&1.4.3.3 web:1.0
 */

var TOP = {};

$(document).ready(function () {
    //Check if user is logged in
    COMMON.checkAuth(false);

    //setting msg of html
    TOP.init();
});

/**
 * show page
 */
TOP.init = function () {
    //ページ再読み込み時の規約確認
    if(window.performance){
        if(window.performance.navigation.type === 1){
            agreementToTerms.destinationHtml();
        }
    }

    //ホーム画面に遷移した時の規約確認(規約が更新された場合は規約同意画面に遷移する)
    var terms = agreementToTerms.getTerms();
    if(Object.keys(terms).length >= 4){
        agreementToTerms.destinationHtml();
    }

    const urlParameterList = COMMON.getUrlParameter();
    if (urlParameterList && urlParameterList.pageId == CONSTANT.PAGE_NAME.OPERATION_LIST) {
        //index with param page
        HEADER.goOperationList();
    } else {
        //go homepage by dashboard setting
        HEADER.goToHomePage();
    }
    COMMON.closeLoading();
};
