Commit f1a599f0 by Takumi Imai

Merge branch 'feature/1.0_check_web_dev' into feature/1.0_check_web_dev_imai

parents 9013b5bd 739e1686
...@@ -11,75 +11,61 @@ ...@@ -11,75 +11,61 @@
* *
* @since cms:1.4.3.2&1.4.3.3 web:1.0 * @since cms:1.4.3.2&1.4.3.3 web:1.0
*/ */
var COMMON = {}; var COMMON = {};
CONSTANT.PAGE_NAME = { COMMON.loginCheckPageList = [CONSTANT.PAGE_NAME.DEFAULT, CONSTANT.PAGE_NAME.DASHBOARD, CONSTANT.PAGE_NAME.REPORT_LIST, CONSTANT.PAGE_NAME.REPORT_FORM,
DASHBOARD: 'dashboard',
OPERATION_LIST: 'workList',
REPORT_LIST: 'reportList',
REPORT_FORM: 'reportForm',
MESSAGE_DETAIL: 'pushMessageDetail',
MESSAGE_LIST: 'pushMessageList',
SEND_MESSAGE: 'sendMessage',
SETTING: 'accountSetting',
PICKUP: 'pickup',
PDF_PRINT: 'pdfPrint',
DEFAULT: 'index',
LOGIN: './login.html',
};
COMMON.loginCheckPageList = [CONSTANT.PAGE_NAME.DEFAULT, CONSTANT.PAGE_NAME.DASHBOARD, CONSTANT.PAGE_NAME.REPORT_LIST, CONSTANT.PAGE_NAME.REPORT_FORM,
CONSTANT.PAGE_NAME.MESSAGE_DETAIL, CONSTANT.PAGE_NAME.MESSAGE_LIST, CONSTANT.PAGE_NAME.SEND_MESSAGE, CONSTANT.PAGE_NAME.SETTING, CONSTANT.PAGE_NAME.MESSAGE_DETAIL, CONSTANT.PAGE_NAME.MESSAGE_LIST, CONSTANT.PAGE_NAME.SEND_MESSAGE, CONSTANT.PAGE_NAME.SETTING,
CONSTANT.PAGE_NAME.PICKUP, CONSTANT.PAGE_NAME.PDF_PRINT]; CONSTANT.PAGE_NAME.PICKUP, CONSTANT.PAGE_NAME.PDF_PRINT];
COMMON.hasErrorKey = 'AVW_HASERR'; COMMON.hasErrorKey = 'AVW_HASERR';
$(document).ready(function() { $(document).ready(function() {
const checkUrl = location.href.substring(location.href.lastIndexOf('/') + 1 ,location.href.lastIndexOf(".html")); const checkUrl = location.href.substring(location.href.lastIndexOf('/') + 1 ,location.href.lastIndexOf(".html"));
if (COMMON.loginCheckPageList.includes(checkUrl)) { if (COMMON.loginCheckPageList.includes(checkUrl)) {
if (!COMMON.checkLogin(CONSTANT.PAGE_NAME.LOGIN)){ if (!COMMON.checkLogin(CONSTANT.PAGE_NAME.LOGIN)){
return; return;
} }
} }
}) })
/** /**
* page transition without outputting a warning message * page transition without outputting a warning message
* @param {*} url * @param {*} url
*/ */
COMMON.avwScreenMove = function (url) { COMMON.avwScreenMove = function (url) {
COMMON.showLoading(); COMMON.showLoading();
window.onbeforeunload = null; window.onbeforeunload = null;
window.location = url; window.location = url;
}; };
/** /**
* show loading dialog * show loading dialog
* show msg by key * show msg by key
* *
* @param {String} key * @param {String} key
*/ */
COMMON.showLoading = function () { COMMON.showLoading = function () {
console.log("kdh check showLoading");
$('#loader').css( { $('#loader').css( {
'width': $(window).width(), 'width': $(window).width(),
'height': $(window).height() 'height': $(window).height()
}); });
document.getElementById('loader').style.display = 'block'; document.getElementById('loader').style.display = 'block';
}; };
/** /**
* close loading * close loading
*/ */
COMMON.closeLoading = function () { COMMON.closeLoading = function () {
setTimeout(function(){ setTimeout(function(){
document.getElementById('loader').style.display = 'none'; document.getElementById('loader').style.display = 'none';
}, 1000); }, 1000);
}; };
/** /**
* show confirm modal with yes, no buttons * show confirm modal with yes, no buttons
* @param {Object} data - Object with {title, message, confirmYes, confirmNo} * @param {Object} data - Object with {title, message, confirmYes, confirmNo}
* @param {callback} confirmCallback - The callback that handles the confirm button clicked * @param {callback} confirmCallback - The callback that handles the confirm button clicked
*/ */
COMMON.showConfirmModal = function (data, confirmCallback) { COMMON.showConfirmModal = function (data, confirmCallback) {
if (data) { if (data) {
let title = ''; let title = '';
if (data.title) { if (data.title) {
...@@ -115,15 +101,15 @@ COMMON.showConfirmModal = function (data, confirmCallback) { ...@@ -115,15 +101,15 @@ COMMON.showConfirmModal = function (data, confirmCallback) {
} }
} }
$('#showConfirmModalButton').click(); $('#showConfirmModalButton').click();
}; };
/** /**
* Show confirm modal with defaults: title, yes, no * Show confirm modal with defaults: title, yes, no
* @param {string} messageCode * @param {string} messageCode
* @param {callback} confirmCallback - The callback that handles the confirm button clicked * @param {callback} confirmCallback - The callback that handles the confirm button clicked
* @param {Object} options - Object with {titleCode, message, confirmYesCode, confirmNoCode} * @param {Object} options - Object with {titleCode, message, confirmYesCode, confirmNoCode}
*/ */
COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) { COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) {
const defaultParams = { const defaultParams = {
titleCode: 'confirmation', titleCode: 'confirmation',
confirmYesCode: 'confirmYes', confirmYesCode: 'confirmYes',
...@@ -154,15 +140,15 @@ COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) { ...@@ -154,15 +140,15 @@ COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) {
confirmYes: I18N.i18nText(params.confirmYesCode), confirmYes: I18N.i18nText(params.confirmYesCode),
confirmNo: I18N.i18nText(params.confirmNoCode) confirmNo: I18N.i18nText(params.confirmNoCode)
}, confirmCallback); }, confirmCallback);
}; };
/** /**
* show alert message by confirm modal html * show alert message by confirm modal html
* @param {String} messageCode * @param {String} messageCode
* @param {string} titleCode * @param {string} titleCode
* @param {Object} options - Data Options {message, titleCode, confirmNoCode} * @param {Object} options - Data Options {message, titleCode, confirmNoCode}
*/ */
COMMON.showAlert = function (messageCode, titleCode = 'error', options = {}) { COMMON.showAlert = function (messageCode, titleCode = 'error', options = {}) {
const defaultParams = { const defaultParams = {
titleCode: titleCode ? titleCode : 'error', titleCode: titleCode ? titleCode : 'error',
confirmYesCode: null, confirmYesCode: null,
...@@ -170,18 +156,18 @@ COMMON.showAlert = function (messageCode, titleCode = 'error', options = {}) { ...@@ -170,18 +156,18 @@ COMMON.showAlert = function (messageCode, titleCode = 'error', options = {}) {
} }
const params = Object.assign(defaultParams, options); const params = Object.assign(defaultParams, options);
COMMON.showConfirm(messageCode, null, params); COMMON.showConfirm(messageCode, null, params);
}; };
/** /**
* close alert * close alert
*/ */
COMMON.alertClose = function () { COMMON.alertClose = function () {
$('.alert-overlay').addClass('d-none'); $('.alert-overlay').addClass('d-none');
$('.alert-area').addClass('d-none'); $('.alert-area').addClass('d-none');
$('body').css('overflow', 'visible'); $('body').css('overflow', 'visible');
}; };
/** /**
* go Url page With Current Params * go Url page With Current Params
* *
* ios will remove all web types data when reopen webview * ios will remove all web types data when reopen webview
...@@ -190,7 +176,7 @@ COMMON.alertClose = function () { ...@@ -190,7 +176,7 @@ COMMON.alertClose = function () {
* @param {String} url * @param {String} url
* @param {Object} params * @param {Object} params
*/ */
COMMON.goUrlWithCurrentParams = function (url, params) { COMMON.goUrlWithCurrentParams = function (url, params) {
if (!params) { if (!params) {
location.href = CONSTANT.URL.WEB.BASE + url; location.href = CONSTANT.URL.WEB.BASE + url;
} }
...@@ -201,13 +187,13 @@ COMMON.goUrlWithCurrentParams = function (url, params) { ...@@ -201,13 +187,13 @@ COMMON.goUrlWithCurrentParams = function (url, params) {
} else { } else {
location.href = url + '?' + new URLSearchParams(mixParams); location.href = url + '?' + new URLSearchParams(mixParams);
} }
}; };
/** /**
* get url parameter * get url parameter
* *
*/ */
COMMON.getUrlParameter = function () { COMMON.getUrlParameter = function () {
var ret = {}; var ret = {};
if (location.search) { if (location.search) {
var param = {}; var param = {};
...@@ -222,17 +208,17 @@ COMMON.getUrlParameter = function () { ...@@ -222,17 +208,17 @@ COMMON.getUrlParameter = function () {
} }
console.log({ ret: ret }); console.log({ ret: ret });
return ret; return ret;
}; };
/** /**
* get sid in local Storage * get sid in local Storage
* *
*/ */
COMMON.getSid = function () { COMMON.getSid = function () {
return ClientData.userInfo_sid(); return ClientData.userInfo_sid();
}; };
/** /**
* cms communication * cms communication
* *
* @param {String} url * @param {String} url
...@@ -242,7 +228,7 @@ COMMON.getSid = function () { ...@@ -242,7 +228,7 @@ COMMON.getSid = function () {
* @param {Object} errorCallback * @param {Object} errorCallback
* @param {number} type * @param {number} type
*/ */
COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, type) { COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, type) {
var sysSettings = new COMMON.sysSetting(); var sysSettings = new COMMON.sysSetting();
if (url) { if (url) {
$.ajax({ $.ajax({
...@@ -293,23 +279,24 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty ...@@ -293,23 +279,24 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty
COMMON.showAlert('errorOccurred'); COMMON.showAlert('errorOccurred');
} }
} }
}; };
/** /**
* Check if user is logged in * Check if user is logged in
* *
* @param {boolean} async * @param {boolean} async
*/ */
COMMON.checkAuth = function (async = true) { COMMON.checkAuth = function (async = true) {
let params = {}; let params = {};
console.log("kdh check");
params.sid = COMMON.getSid; params.sid = COMMON.getSid;
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.AUTH_SESSION; const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.AUTH_SESSION;
COMMON.cmsAjax(url, params, async, null, function () { COMMON.cmsAjax(url, params, async, null, function () {
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN); COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
}); });
}; };
var ClientData = { var ClientData = {
// Local :userInfo_account path:String // Local :userInfo_account path:String
userInfo_accountPath: function (data) { userInfo_accountPath: function (data) {
if (arguments.length > 0) { if (arguments.length > 0) {
...@@ -521,24 +508,24 @@ var ClientData = { ...@@ -521,24 +508,24 @@ var ClientData = {
return COMMON.operateData(arguments, CONSTANT.KEYS.IsJumpBack, undefined); return COMMON.operateData(arguments, CONSTANT.KEYS.IsJumpBack, undefined);
} }
}, },
}; };
/* /*
* Variables * Variables
*/ */
COMMON.userSessionObj = null; COMMON.userSessionObj = null;
COMMON.userSettingObj = null; COMMON.userSettingObj = null;
COMMON.sysSettingObj = null; COMMON.sysSettingObj = null;
/* /*
* User Settings Class Definition * User Settings Class Definition
*/ */
var UserSetting = function () { var UserSetting = function () {
this.US_KEY = 'AVWUS'; this.US_KEY = 'AVWUS';
this.userSetting = this.load(); this.userSetting = this.load();
}; };
/* get user setting from localStorage */ /* get user setting from localStorage */
UserSetting.prototype.load = function () { UserSetting.prototype.load = function () {
var storage = window.localStorage; var storage = window.localStorage;
var value = null; var value = null;
var js = null; var js = null;
...@@ -550,14 +537,14 @@ UserSetting.prototype.load = function () { ...@@ -550,14 +537,14 @@ UserSetting.prototype.load = function () {
js = JSON.parse(value); js = JSON.parse(value);
} }
return js; return js;
}; };
/** /**
* store user setting * store user setting
* @param {*} key * @param {*} key
* @param {*} value * @param {*} value
*/ */
UserSetting.prototype.set = function (key, value) { UserSetting.prototype.set = function (key, value) {
this.userSetting = this.load(); this.userSetting = this.load();
var values = this.userSetting; var values = this.userSetting;
if (!values) { if (!values) {
...@@ -571,27 +558,27 @@ UserSetting.prototype.set = function (key, value) { ...@@ -571,27 +558,27 @@ UserSetting.prototype.set = function (key, value) {
storage.setItem(this.US_KEY, jsonStr); storage.setItem(this.US_KEY, jsonStr);
} }
this.userSetting = values; this.userSetting = values;
}; };
/** /**
* grab user setting * grab user setting
* @param {*} key * @param {*} key
* @returns * @returns
*/ */
UserSetting.prototype.get = function (key) { UserSetting.prototype.get = function (key) {
this.userSetting = this.load(); this.userSetting = this.load();
var values = this.userSetting; var values = this.userSetting;
if (values) { if (values) {
return values[key]; return values[key];
} }
return null; return null;
}; };
/** /**
* show user setting object list * show user setting object list
* @param {*} elmid * @param {*} elmid
*/ */
UserSetting.prototype.show = function (elmid) { UserSetting.prototype.show = function (elmid) {
var storage = window.localStorage; var storage = window.localStorage;
var tags = '<p>'; var tags = '<p>';
if (storage) { if (storage) {
...@@ -605,9 +592,9 @@ UserSetting.prototype.show = function (elmid) { ...@@ -605,9 +592,9 @@ UserSetting.prototype.show = function (elmid) {
tags = tags + '</p>'; tags = tags + '</p>';
$(elmid).html(tags); $(elmid).html(tags);
} }
}; };
/* Retrieve a list of user-set keys */ /* Retrieve a list of user-set keys */
UserSetting.prototype.keys = function () { UserSetting.prototype.keys = function () {
var storage = window.localStorage; var storage = window.localStorage;
var keyList = []; var keyList = [];
if (storage) { if (storage) {
...@@ -622,13 +609,13 @@ UserSetting.prototype.keys = function () { ...@@ -622,13 +609,13 @@ UserSetting.prototype.keys = function () {
return keyList; return keyList;
} }
return null; return null;
}; };
/** /**
* Delete user settings * Delete user settings
* @param {*} key * @param {*} key
*/ */
UserSetting.prototype.remove = function (key) { UserSetting.prototype.remove = function (key) {
var storage = window.localStorage; var storage = window.localStorage;
if (storage) { if (storage) {
var value = storage.getItem(this.US_KEY); var value = storage.getItem(this.US_KEY);
...@@ -640,27 +627,27 @@ UserSetting.prototype.remove = function (key) { ...@@ -640,27 +627,27 @@ UserSetting.prototype.remove = function (key) {
} }
} }
} }
}; };
/* Delete all user settings */ /* Delete all user settings */
UserSetting.prototype.removeAll = function () { UserSetting.prototype.removeAll = function () {
var storage = window.localStorage; var storage = window.localStorage;
if (storage) { if (storage) {
storage.remove(this.US_KEY); storage.remove(this.US_KEY);
} }
}; };
/* /*
* User Session Class Definition * User Session Class Definition
*/ */
var UserSession = function () { var UserSession = function () {
this.available = false; this.available = false;
}; };
/** /**
* Initialize User Session * Initialize User Session
* @param {*} option * @param {*} option
*/ */
UserSession.prototype.init = function (option) { UserSession.prototype.init = function (option) {
this.available = false; this.available = false;
if (option == 'restore') { if (option == 'restore') {
var value = null; var value = null;
...@@ -677,14 +664,14 @@ UserSession.prototype.init = function (option) { ...@@ -677,14 +664,14 @@ UserSession.prototype.init = function (option) {
this.set('init', new Date().toLocaleString()); this.set('init', new Date().toLocaleString());
this.available = true; this.available = true;
} }
}; };
/** /**
* store key, value item to user session * store key, value item to user session
* @param {*} key * @param {*} key
* @param {*} value * @param {*} value
*/ */
UserSession.prototype.set = function (key, value) { UserSession.prototype.set = function (key, value) {
var storage = window.sessionStorage; var storage = window.sessionStorage;
if (storage) { if (storage) {
if (this.available == false) { if (this.available == false) {
...@@ -697,14 +684,14 @@ UserSession.prototype.set = function (key, value) { ...@@ -697,14 +684,14 @@ UserSession.prototype.set = function (key, value) {
storage.setItem('AVWS_' + key, value); storage.setItem('AVWS_' + key, value);
} }
} }
}; };
/** /**
* get session item value * get session item value
* @param {*} key * @param {*} key
* @returns * @returns
*/ */
UserSession.prototype.get = function (key) { UserSession.prototype.get = function (key) {
var value = null; var value = null;
if (this.available) { if (this.available) {
value = this._get(key); value = this._get(key);
...@@ -712,35 +699,35 @@ UserSession.prototype.get = function (key) { ...@@ -712,35 +699,35 @@ UserSession.prototype.get = function (key) {
throw new Error('Session Destroyed.'); throw new Error('Session Destroyed.');
} }
return value; return value;
}; };
/** /**
* get item value from session storage * get item value from session storage
* @param {*} key * @param {*} key
* @returns * @returns
*/ */
UserSession.prototype._get = function (key) { UserSession.prototype._get = function (key) {
var storage = window.sessionStorage; var storage = window.sessionStorage;
var value = null; var value = null;
if (storage) { if (storage) {
value = storage.getItem('AVWS_' + key); value = storage.getItem('AVWS_' + key);
} }
return value; return value;
}; };
/* destroy user session */ /* destroy user session */
UserSession.prototype.destroy = function () { UserSession.prototype.destroy = function () {
var storage = window.sessionStorage; var storage = window.sessionStorage;
if (storage) { if (storage) {
storage.clear(); storage.clear();
this.available = false; this.available = false;
} }
}; };
/** /**
* show user session object list * show user session object list
* @param {*} elmid * @param {*} elmid
*/ */
UserSession.prototype.show = function (elmid) { UserSession.prototype.show = function (elmid) {
var storage = window.sessionStorage; var storage = window.sessionStorage;
var tags = '<p>'; var tags = '<p>';
if (storage) { if (storage) {
...@@ -752,10 +739,10 @@ UserSession.prototype.show = function (elmid) { ...@@ -752,10 +739,10 @@ UserSession.prototype.show = function (elmid) {
tags = tags + '</p>'; tags = tags + '</p>';
$(elmid).html(tags); $(elmid).html(tags);
} }
}; };
/* Initialize system */ /* Initialize system */
$(function () { $(function () {
// Determine the path where the system configuration files are located // Determine the path where the system configuration files are located
var location = window.location.toString().toLowerCase(); var location = window.location.toString().toLowerCase();
...@@ -789,15 +776,15 @@ $(function () { ...@@ -789,15 +776,15 @@ $(function () {
//#31919 [Investigation] Business meeting support system GoogleChrome does not work with Bitch in/out. //#31919 [Investigation] Business meeting support system GoogleChrome does not work with Bitch in/out.
navigator.pointerEnabled = navigator.maxTouchPoints > 0; // Edge 17 touch support workaround navigator.pointerEnabled = navigator.maxTouchPoints > 0; // Edge 17 touch support workaround
document.documentElement.ontouchstart = navigator.maxTouchPoints > 0 ? function () {} : undefined; // Chrome 70 touch support workaround document.documentElement.ontouchstart = navigator.maxTouchPoints > 0 ? function () {} : undefined; // Chrome 70 touch support workaround
}); });
// Hide the locking layout // Hide the locking layout
COMMON.unlockLayout = function () { COMMON.unlockLayout = function () {
$('#avw-sys-modal').hide(); $('#avw-sys-modal').hide();
}; };
// Show the locking layout // Show the locking layout
COMMON.lockLayout = function () { COMMON.lockLayout = function () {
if (document.getElementById('avw-sys-modal')) { if (document.getElementById('avw-sys-modal')) {
$('#avw-sys-modal').show(); $('#avw-sys-modal').show();
} else { } else {
...@@ -821,34 +808,34 @@ COMMON.lockLayout = function () { ...@@ -821,34 +808,34 @@ COMMON.lockLayout = function () {
}); });
}); });
} }
}; };
/* Clear error condition */ /* Clear error condition */
COMMON.clearError = function () { COMMON.clearError = function () {
var session = window.sessionStorage; var session = window.sessionStorage;
if (session) { if (session) {
session.setItem(COMMON.hasErrorKey, false); session.setItem(COMMON.hasErrorKey, false);
} }
}; };
/* Get error status */ /* Get error status */
COMMON.hasError = function () { COMMON.hasError = function () {
var session = window.sessionStorage; var session = window.sessionStorage;
var isError = false; var isError = false;
if (session) { if (session) {
isError = session.getItem(COMMON.hasErrorKey); isError = session.getItem(COMMON.hasErrorKey);
} }
return isError == 'true'; return isError == 'true';
}; };
/* Set to error condition */ /* Set to error condition */
COMMON.setErrorState = function () { COMMON.setErrorState = function () {
var session = window.sessionStorage; var session = window.sessionStorage;
if (session) { if (session) {
session.setItem(COMMON.hasErrorKey, true); session.setItem(COMMON.hasErrorKey, true);
} }
}; };
/* get user session object */ /* get user session object */
COMMON.userSession = function () { COMMON.userSession = function () {
if (!COMMON.userSessionObj) { if (!COMMON.userSessionObj) {
var obj = new UserSession(); var obj = new UserSession();
obj.init('restore'); obj.init('restore');
...@@ -860,9 +847,9 @@ COMMON.userSession = function () { ...@@ -860,9 +847,9 @@ COMMON.userSession = function () {
} }
} }
return COMMON.userSessionObj; return COMMON.userSessionObj;
}; };
/* create user session object */ /* create user session object */
COMMON.createUserSession = function () { COMMON.createUserSession = function () {
if (COMMON.userSessionObj) { if (COMMON.userSessionObj) {
COMMON.userSessionObj.destroy(); COMMON.userSessionObj.destroy();
} else { } else {
...@@ -870,26 +857,26 @@ COMMON.createUserSession = function () { ...@@ -870,26 +857,26 @@ COMMON.createUserSession = function () {
COMMON.userSessionObj.init(); COMMON.userSessionObj.init();
} }
return COMMON.userSessionObj; return COMMON.userSessionObj;
}; };
/* get user setting object */ /* get user setting object */
COMMON.userSetting = function () { COMMON.userSetting = function () {
if (COMMON.userSettingObj == null) { if (COMMON.userSettingObj == null) {
COMMON.userSettingObj = new UserSetting(); COMMON.userSettingObj = new UserSetting();
} }
return COMMON.userSettingObj; return COMMON.userSettingObj;
}; };
/* get system setting object */ /* get system setting object */
COMMON.sysSetting = function () { COMMON.sysSetting = function () {
return COMMON.sysSettingObj; return COMMON.sysSettingObj;
}; };
/* /*
* Operations for session storage [start] * Operations for session storage [start]
*/ */
var SessionStorageUtils = { var SessionStorageUtils = {
login: function () { login: function () {
if (COMMON.userSession()) { if (COMMON.userSession()) {
// Skip this case // Skip this case
...@@ -911,12 +898,12 @@ var SessionStorageUtils = { ...@@ -911,12 +898,12 @@ var SessionStorageUtils = {
remove: function (strKey) { remove: function (strKey) {
COMMON.userSession().set(strKey, null); COMMON.userSession().set(strKey, null);
}, },
}; };
/* /*
* Operations for local storage * Operations for local storage
*/ */
var LocalStorageUtils = { var LocalStorageUtils = {
getUniqueId: function () { getUniqueId: function () {
var uniqueId = ''; var uniqueId = '';
...@@ -970,28 +957,28 @@ var LocalStorageUtils = { ...@@ -970,28 +957,28 @@ var LocalStorageUtils = {
} }
return isExisted; return isExisted;
}, },
}; };
/** /**
* String.format function def. * String.format function def.
* @param {*} fmt * @param {*} fmt
* @returns * @returns
*/ */
COMMON.format = function (fmt) { COMMON.format = function (fmt) {
for (var i = 1; i < arguments.length; i++) { for (var i = 1; i < arguments.length; i++) {
var reg = new RegExp('\\{' + (i - 1) + '\\}', 'g'); var reg = new RegExp('\\{' + (i - 1) + '\\}', 'g');
fmt = fmt.replace(reg, arguments[i]); fmt = fmt.replace(reg, arguments[i]);
} }
return fmt; return fmt;
}; };
/** /**
* Get param url * Get param url
* @param {*} name * @param {*} name
* @param {*} url * @param {*} url
* @returns * @returns
*/ */
COMMON.getUrlParam = function (name, url) { COMMON.getUrlParam = function (name, url) {
if (!url) { if (!url) {
url = window.location.href; url = window.location.href;
} }
...@@ -1005,10 +992,10 @@ COMMON.getUrlParam = function (name, url) { ...@@ -1005,10 +992,10 @@ COMMON.getUrlParam = function (name, url) {
} else { } else {
return results[1]; return results[1];
} }
}; };
// Toogle Logout Nortice // Toogle Logout Nortice
COMMON.ToogleLogoutNortice = function () { COMMON.ToogleLogoutNortice = function () {
window.onbeforeunload = function (event) { window.onbeforeunload = function (event) {
var message = I18N.i18nText('sysInfoWithoutLogout'); var message = I18N.i18nText('sysInfoWithoutLogout');
var e = event || window.event; var e = event || window.event;
...@@ -1017,9 +1004,9 @@ COMMON.ToogleLogoutNortice = function () { ...@@ -1017,9 +1004,9 @@ COMMON.ToogleLogoutNortice = function () {
} }
return message; return message;
}; };
}; };
/** /**
* * Get data from localstorage and sessionstorage synchronization If has any * * Get data from localstorage and sessionstorage synchronization If has any
* param (args.length > 0) -> setter If has not param (args.length = 0) -> * param (args.length > 0) -> setter If has not param (args.length = 0) ->
* getter . Get from session: + if it existed and key existed in localstorage -> * getter . Get from session: + if it existed and key existed in localstorage ->
...@@ -1030,7 +1017,7 @@ COMMON.ToogleLogoutNortice = function () { ...@@ -1030,7 +1017,7 @@ COMMON.ToogleLogoutNortice = function () {
* @param {*} returnDefaultData * @param {*} returnDefaultData
* @returns * @returns
*/ */
COMMON.operateData = function (args, strKey, returnDefaultData) { COMMON.operateData = function (args, strKey, returnDefaultData) {
if (args.length > 0) { if (args.length > 0) {
var data = args[0]; var data = args[0];
LocalStorageUtils.set(strKey, data); LocalStorageUtils.set(strKey, data);
...@@ -1056,23 +1043,23 @@ COMMON.operateData = function (args, strKey, returnDefaultData) { ...@@ -1056,23 +1043,23 @@ COMMON.operateData = function (args, strKey, returnDefaultData) {
return returnDefaultData; return returnDefaultData;
} }
} }
}; };
/** /**
* UTC current Time (millisecond) * UTC current Time (millisecond)
* *
* @returns UTC time * @returns UTC time
*/ */
COMMON.currentTime = function () { COMMON.currentTime = function () {
return Date.now(); return Date.now();
}; };
/** /**
* check login information in window.sessionStorage * check login information in window.sessionStorage
* *
* @returns boolean * @returns boolean
*/ */
COMMON.checkLogin = function (option) { COMMON.checkLogin = function (option) {
var userSession = COMMON.userSession(); var userSession = COMMON.userSession();
if(!userSession) { if(!userSession) {
...@@ -1116,23 +1103,23 @@ COMMON.checkLogin = function (option) { ...@@ -1116,23 +1103,23 @@ COMMON.checkLogin = function (option) {
return false; return false;
} }
return true; return true;
} }
/* /*
* Operations for session storage [ end ] * Operations for session storage [ end ]
*/ */
// ============================================================================================= // =============================================================================================
// Utils for string, date, number [start] // Utils for string, date, number [start]
// ============================================================================================= // =============================================================================================
/* /*
* Convert date to JP format date time [start] * Convert date to JP format date time [start]
*/ */
/* /*
* YYYY/MM/DD HH:MM:SS * YYYY/MM/DD HH:MM:SS
*/ */
Date.prototype.jpDateTimeString = function () { Date.prototype.jpDateTimeString = function () {
var strResult = ''; var strResult = '';
var strYear = this.getFullYear() + ''; var strYear = this.getFullYear() + '';
var strMonth = this.getMonth() + 1 + ''; var strMonth = this.getMonth() + 1 + '';
...@@ -1144,11 +1131,11 @@ Date.prototype.jpDateTimeString = function () { ...@@ -1144,11 +1131,11 @@ Date.prototype.jpDateTimeString = function () {
strResult += strYear.padLeft('0', 4) + '/' + strMonth.padLeft('0', 2) + '/' + strDayInMonth.padLeft('0', 2); strResult += strYear.padLeft('0', 4) + '/' + strMonth.padLeft('0', 2) + '/' + strDayInMonth.padLeft('0', 2);
strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2); strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2);
return strResult; return strResult;
}; };
/* /*
* YYYY-MM-DD HH:MM:SS * YYYY-MM-DD HH:MM:SS
*/ */
Date.prototype.jpDateTimeString1 = function () { Date.prototype.jpDateTimeString1 = function () {
var strResult = ''; var strResult = '';
var strYear = this.getFullYear() + ''; var strYear = this.getFullYear() + '';
var strMonth = this.getMonth() + 1 + ''; var strMonth = this.getMonth() + 1 + '';
...@@ -1160,11 +1147,11 @@ Date.prototype.jpDateTimeString1 = function () { ...@@ -1160,11 +1147,11 @@ Date.prototype.jpDateTimeString1 = function () {
strResult += strYear.padLeft('0', 4) + '-' + strMonth.padLeft('0', 2) + '-' + strDayInMonth.padLeft('0', 2); strResult += strYear.padLeft('0', 4) + '-' + strMonth.padLeft('0', 2) + '-' + strDayInMonth.padLeft('0', 2);
strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2); strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2);
return strResult; return strResult;
}; };
/* /*
* yyyy/MM/dd * yyyy/MM/dd
*/ */
Date.prototype.jpDateString = function () { Date.prototype.jpDateString = function () {
var strResult = ''; var strResult = '';
var strYear = this.getFullYear() + ''; var strYear = this.getFullYear() + '';
var strMonth = this.getMonth() + 1 + ''; var strMonth = this.getMonth() + 1 + '';
...@@ -1173,11 +1160,11 @@ Date.prototype.jpDateString = function () { ...@@ -1173,11 +1160,11 @@ Date.prototype.jpDateString = function () {
strResult += strYear.padLeft('0', 4) + '/' + strMonth.padLeft('0', 2) + '/' + strDayInMonth.padLeft('0', 2); strResult += strYear.padLeft('0', 4) + '/' + strMonth.padLeft('0', 2) + '/' + strDayInMonth.padLeft('0', 2);
return strResult; return strResult;
}; };
/* /*
* HH:mm:ss * HH:mm:ss
*/ */
Date.prototype.jpTimeString = function () { Date.prototype.jpTimeString = function () {
var strResult = ''; var strResult = '';
var strHour = this.getHours() + ''; var strHour = this.getHours() + '';
var strMinute = this.getMinutes() + ''; var strMinute = this.getMinutes() + '';
...@@ -1185,11 +1172,11 @@ Date.prototype.jpTimeString = function () { ...@@ -1185,11 +1172,11 @@ Date.prototype.jpTimeString = function () {
strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2); strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2);
return strResult; return strResult;
}; };
/* /*
* HH:mm * HH:mm
*/ */
Date.prototype.jpShortTimeString = function () { Date.prototype.jpShortTimeString = function () {
var strResult = ''; var strResult = '';
var strHour = this.getHours() + ''; var strHour = this.getHours() + '';
var strMinute = this.getMinutes() + ''; var strMinute = this.getMinutes() + '';
...@@ -1197,11 +1184,11 @@ Date.prototype.jpShortTimeString = function () { ...@@ -1197,11 +1184,11 @@ Date.prototype.jpShortTimeString = function () {
strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2); strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2);
return strResult; return strResult;
}; };
/* /*
* yyyyMMddHHmmss * yyyyMMddHHmmss
*/ */
Date.prototype.toIdString = function () { Date.prototype.toIdString = function () {
var strResult = ''; var strResult = '';
var strYear = this.getFullYear() + ''; var strYear = this.getFullYear() + '';
var strMonth = this.getMonth() + 1 + ''; var strMonth = this.getMonth() + 1 + '';
...@@ -1214,127 +1201,128 @@ Date.prototype.toIdString = function () { ...@@ -1214,127 +1201,128 @@ Date.prototype.toIdString = function () {
strResult += strYear.padLeft('0', 4) + strMonth.padLeft('0', 2) + strDayInMonth.padLeft('0', 2); strResult += strYear.padLeft('0', 4) + strMonth.padLeft('0', 2) + strDayInMonth.padLeft('0', 2);
strResult += strHour.padLeft('0', 2) + strMinute.padLeft('0', 2) + strSecond.padLeft('0', 2) + strMilisecond.padLeft('0', 3); strResult += strHour.padLeft('0', 2) + strMinute.padLeft('0', 2) + strSecond.padLeft('0', 2) + strMilisecond.padLeft('0', 3);
return strResult; return strResult;
}; };
/** /**
* Subtract date to get days * Subtract date to get days
* @param {*} targetDate * @param {*} targetDate
* @returns * @returns
*/ */
Date.prototype.subtractByDays = function (targetDate) { Date.prototype.subtractByDays = function (targetDate) {
var milis = Math.abs(this - targetDate); var milis = Math.abs(this - targetDate);
var days = Math.floor(milis / (60 * 60 * 24 * 1000)); var days = Math.floor(milis / (60 * 60 * 24 * 1000));
return days; return days;
}; };
/** /**
* add seconds * add seconds
* @param {*} plusSeconds * @param {*} plusSeconds
* @returns * @returns
*/ */
Date.prototype.addSeconds = function (plusSeconds) { Date.prototype.addSeconds = function (plusSeconds) {
var newDate = new Date(this.getTime() + plusSeconds * 1000); var newDate = new Date(this.getTime() + plusSeconds * 1000);
return newDate; return newDate;
}; };
/** /**
* Subtract date to get days * Subtract date to get days
* @param {*} targetDate * @param {*} targetDate
* @returns * @returns
*/ */
Date.prototype.subtractBySeconds = function (targetDate) { Date.prototype.subtractBySeconds = function (targetDate) {
var milis = Math.abs(this - targetDate); var milis = Math.abs(this - targetDate);
var days = Math.floor(milis / 1000); var days = Math.floor(milis / 1000);
return days; return days;
}; };
/* /*
* Convert date to JP format date time [ end ] * Convert date to JP format date time [ end ]
*/ */
// trimming space from both side of the string // trimming space from both side of the string
String.prototype.trim = function () { String.prototype.trim = function () {
return this.replace(/^\s+|\s+$/g, ''); return this.replace(/^\s+|\s+$/g, '');
}; };
// trimming space from left side of the string // trimming space from left side of the string
String.prototype.trimLeft = function () { String.prototype.trimLeft = function () {
return this.replace(/^\s+/, ''); return this.replace(/^\s+/, '');
}; };
// trimming space from right side of the string // trimming space from right side of the string
String.prototype.trimRight = function () { String.prototype.trimRight = function () {
return this.replace(/\s+$/, ''); return this.replace(/\s+$/, '');
}; };
/** /**
* String: pads left * String: pads left
* @param {*} padString * @param {*} padString
* @param {*} length * @param {*} length
* @returns * @returns
*/ */
String.prototype.padLeft = function (padString, length) { String.prototype.padLeft = function (padString, length) {
var str = this; var str = this;
while (str.length < length) str = padString + str; while (str.length < length) str = padString + str;
return str; return str;
}; };
/** /**
* String: pads right * String: pads right
* @param {*} padString * @param {*} padString
* @param {*} length * @param {*} length
* @returns * @returns
*/ */
String.prototype.padRight = function (padString, length) { String.prototype.padRight = function (padString, length) {
var str = this; var str = this;
while (str.length < length) str = str + padString; while (str.length < length) str = str + padString;
return str; return str;
}; };
/** /**
* Check contain string * Check contain string
* @param {*} string * @param {*} string
* @returns * @returns
*/ */
String.prototype.contains = function (string) { String.prototype.contains = function (string) {
if (this.indexOf(string) != -1) { if (this.indexOf(string) != -1) {
return true; return true;
} }
return false; return false;
}; };
/** /**
* Number: pads left * Number: pads left
* @param {*} padString * @param {*} padString
* @param {*} length * @param {*} length
* @returns * @returns
*/ */
Number.prototype.padLeft = function (padString, length) { Number.prototype.padLeft = function (padString, length) {
var str = this + ''; var str = this + '';
return str.padLeft(padString, length); return str.padLeft(padString, length);
}; };
/** /**
* Number: pads right * Number: pads right
* @param {*} padString * @param {*} padString
* @param {*} length * @param {*} length
* @returns * @returns
*/ */
Number.prototype.padRight = function (padString, length) { Number.prototype.padRight = function (padString, length) {
var str = this + ''; var str = this + '';
return str.padRight(padString, length); return str.padRight(padString, length);
}; };
// Clear data of array // Clear data of array
Array.prototype.clear = function () { Array.prototype.clear = function () {
this.splice(0, this.length); this.splice(0, this.length);
}; };
// Function to set position of object to center // Function to set position of object to center
jQuery.fn.center = function () { jQuery.fn.center = function () {
this.css('position', 'fixed'); this.css('position', 'fixed');
this.css('top', ($(window).height() - this.height()) / 2 + 'px'); this.css('top', ($(window).height() - this.height()) / 2 + 'px');
this.css('left', ($(window).width() - this.width()) / 2 + 'px'); this.css('left', ($(window).width() - this.width()) / 2 + 'px');
return this; return this;
}; };
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<title lang="pickup"></title> <title class="lang" lang="pickup"></title>
<!-- favicons --> <!-- favicons -->
<link href="../common/img/favicon.ico" rel="icon"> <link href="../common/img/favicon.ico" rel="icon">
<link href="../common/img/apple-touch-icon.png" rel="apple-touch-icon"> <link href="../common/img/apple-touch-icon.png" rel="apple-touch-icon">
......
...@@ -12,12 +12,19 @@ ...@@ -12,12 +12,19 @@
RL.init = function () { RL.init = function () {
//Check if user is logged in //Check if user is logged in
COMMON.showLoading(); COMMON.showLoading();
console.log("kdh check closeLoading RL.init1");
COMMON.checkAuth(false); COMMON.checkAuth(false);
console.log("kdh check closeLoading RL.init2");
console.log('ReportList init start'); console.log('ReportList init start');
console.log("kdh check closeLoading RL.init3");
RL.checkQuickReport(); RL.checkQuickReport();
console.log("kdh check closeLoading RL.init4");
RL.loadCommon(); RL.loadCommon();
console.log("kdh check closeLoading RL.init5");
RL.initTaskReportList(); RL.initTaskReportList();
console.log("kdh check closeLoading RL.init6");
COMMON.closeLoading(); COMMON.closeLoading();
console.log("kdh check closeLoading RL.init7");
}; };
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment