/**
 * PDF PRINT function js
 *
 * @since cms:1.4.3.2&1.4.3.3 web:1.0
 **/

var PP = {};

/**
 * init
 */
PP.init = function () {
    //Check if user is logged in
    COMMON.checkAuth(false);

    console.log('PP.init');
    PP.loadCommon();

    PP.initPdfList();

    COMMON.closeLoading();
};

/**
 * load common
 */
PP.loadCommon = function () {
    $('#includedHeader').load('../common/html/header.html', function () {
        I18N.initi18n();
        HEADER.init();
    });
    $('#includedConfirmModal').load('../common/html/confirmModal.html', function () {
        I18N.initi18n();
    });
};

/**
 * init pdf list
 */
PP.initPdfList = function () {
    if (sessionStorage.OL_operationId) {
        let params = {};
        params.sid = COMMON.getSid();
        params.operationId = sessionStorage.OL_operationId;
        params.returnUrl = CONSTANT.URL.WEB.BASE + CONSTANT.URL.WEB.OPERATION_LIST;
        let url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.HTML.BASE + CONSTANT.URL.CMS.HTML.QUICK_REPORT_PRINT;
        $('#pdfPrint').load(url, params);
    } else {
        COMMON.displayAlert('error');
        COMMON.avwScreenMove('reportList.html');
    }
};
