Commit ecb94893 by Takumi Imai

引数追加

parent 350b3069
......@@ -15,7 +15,10 @@ var COMMON = {};
COMMON.hasErrorKey = 'AVW_HASERR';
/* page transition without outputting a warning message */
/**
* page transition without outputting a warning message
* @param {*} url
*/
COMMON.avwScreenMove = function (url) {
COMMON.showLoading();
window.onbeforeunload = null;
......@@ -117,7 +120,6 @@ COMMON.getUrlParameter = function () {
/**
* get sid in local Storage
*
* @returns sid
*/
COMMON.getSid = function () {
return ClientData.userInfo_sid();
......@@ -131,6 +133,7 @@ COMMON.getSid = function () {
* @param {boolean} async
* @param {Object} callback
* @param {Object} errorCallback
* @param {number} type
*/
COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, type) {
var sysSettings = new COMMON.sysSetting();
......@@ -467,7 +470,12 @@ UserSetting.prototype.load = function () {
}
return js;
};
/* store user setting */
/**
* store user setting
* @param {*} key
* @param {*} value
*/
UserSetting.prototype.set = function (key, value) {
this.userSetting = this.load();
var values = this.userSetting;
......@@ -483,7 +491,12 @@ UserSetting.prototype.set = function (key, value) {
}
this.userSetting = values;
};
/* grab user setting */
/**
* grab user setting
* @param {*} key
* @returns
*/
UserSetting.prototype.get = function (key) {
this.userSetting = this.load();
var values = this.userSetting;
......@@ -492,7 +505,11 @@ UserSetting.prototype.get = function (key) {
}
return null;
};
/* show user setting object list */
/**
* show user setting object list
* @param {*} elmid
*/
UserSetting.prototype.show = function (elmid) {
var storage = window.localStorage;
var tags = '<p>';
......@@ -525,7 +542,11 @@ UserSetting.prototype.keys = function () {
}
return null;
};
/* Delete user settings */
/**
* Delete user settings
* @param {*} key
*/
UserSetting.prototype.remove = function (key) {
var storage = window.localStorage;
if (storage) {
......@@ -553,7 +574,11 @@ UserSetting.prototype.removeAll = function () {
var UserSession = function () {
this.available = false;
};
/* Initialize User Session */
/**
* Initialize User Session
* @param {*} option
*/
UserSession.prototype.init = function (option) {
this.available = false;
if (option == 'restore') {
......@@ -572,7 +597,12 @@ UserSession.prototype.init = function (option) {
this.available = true;
}
};
/* store key, value item to user session */
/**
* store key, value item to user session
* @param {*} key
* @param {*} value
*/
UserSession.prototype.set = function (key, value) {
var storage = window.sessionStorage;
if (storage) {
......@@ -587,7 +617,12 @@ UserSession.prototype.set = function (key, value) {
}
}
};
/* get session item value */
/**
* get session item value
* @param {*} key
* @returns
*/
UserSession.prototype.get = function (key) {
var value = null;
if (this.available) {
......@@ -597,7 +632,12 @@ UserSession.prototype.get = function (key) {
}
return value;
};
/* get item value from session storage */
/**
* get item value from session storage
* @param {*} key
* @returns
*/
UserSession.prototype._get = function (key) {
var storage = window.sessionStorage;
var value = null;
......@@ -614,7 +654,11 @@ UserSession.prototype.destroy = function () {
this.available = false;
}
};
/* show user session object list */
/**
* show user session object list
* @param {*} elmid
*/
UserSession.prototype.show = function (elmid) {
var storage = window.sessionStorage;
var tags = '<p>';
......@@ -847,7 +891,11 @@ var LocalStorageUtils = {
},
};
/* String.format function def. */
/**
* String.format function def.
* @param {*} fmt
* @returns
*/
COMMON.format = function (fmt) {
for (var i = 1; i < arguments.length; i++) {
var reg = new RegExp('\\{' + (i - 1) + '\\}', 'g');
......@@ -856,7 +904,12 @@ COMMON.format = function (fmt) {
return fmt;
};
// Get param url
/**
* Get param url
* @param {*} name
* @param {*} url
* @returns
*/
COMMON.getUrlParam = function (name, url) {
if (!url) {
url = window.location.href;
......@@ -885,13 +938,16 @@ COMMON.ToogleLogoutNortice = function () {
};
};
/*
* 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) ->
* getter . Get from session: + if it existed and key existed in localstorage ->
* return result + else: set value from local to sessionstorage -> return value
* of sessionstorage if value is not empty, otherwise, return default result.
*
* @param {*} args
* @param {*} strKey
* @param {*} returnDefaultData
* @returns
*/
COMMON.operateData = function (args, strKey, returnDefaultData) {
if (args.length > 0) {
......@@ -1027,18 +1083,33 @@ Date.prototype.toIdString = function () {
strResult += strHour.padLeft('0', 2) + strMinute.padLeft('0', 2) + strSecond.padLeft('0', 2) + strMilisecond.padLeft('0', 3);
return strResult;
};
// Subtract date to get days
/**
* Subtract date to get days
* @param {*} targetDate
* @returns
*/
Date.prototype.subtractByDays = function (targetDate) {
var milis = Math.abs(this - targetDate);
var days = Math.floor(milis / (60 * 60 * 24 * 1000));
return days;
};
/**
* add seconds
* @param {*} plusSeconds
* @returns
*/
Date.prototype.addSeconds = function (plusSeconds) {
var newDate = new Date(this.getTime() + plusSeconds * 1000);
return newDate;
};
// Subtract date to get days
/**
* Subtract date to get days
* @param {*} targetDate
* @returns
*/
Date.prototype.subtractBySeconds = function (targetDate) {
var milis = Math.abs(this - targetDate);
var days = Math.floor(milis / 1000);
......@@ -1064,20 +1135,35 @@ String.prototype.trimRight = function () {
return this.replace(/\s+$/, '');
};
// String: pads left
/**
* String: pads left
* @param {*} padString
* @param {*} length
* @returns
*/
String.prototype.padLeft = function (padString, length) {
var str = this;
while (str.length < length) str = padString + str;
return str;
};
// String: pads right
/**
* String: pads right
* @param {*} padString
* @param {*} length
* @returns
*/
String.prototype.padRight = function (padString, length) {
var str = this;
while (str.length < length) str = str + padString;
return str;
};
// Check contain string
/**
* Check contain string
* @param {*} string
* @returns
*/
String.prototype.contains = function (string) {
if (this.indexOf(string) != -1) {
return true;
......@@ -1085,13 +1171,23 @@ String.prototype.contains = function (string) {
return false;
};
// Number: pads left
/**
* Number: pads left
* @param {*} padString
* @param {*} length
* @returns
*/
Number.prototype.padLeft = function (padString, length) {
var str = this + '';
return str.padLeft(padString, length);
};
// Number: pads right
/**
* Number: pads right
* @param {*} padString
* @param {*} length
* @returns
*/
Number.prototype.padRight = function (padString, length) {
var str = this + '';
return str.padRight(padString, length);
......
......@@ -10,7 +10,10 @@ $(function () {
COMMON.showLoading();
});
/** Direct home page setting */
/**
* Direct home page setting
* @param {*} pageId
*/
HEADER.goToHomePage = function (pageId) {
DashboardSetting.getSettingData(function (settings) {
if (settings.dashboardHome == 1) {
......
......@@ -3,9 +3,9 @@
* Common processing for internationalization (language switching)
*
* For language resource files, modify the following files according to the language you specify
* - 日本語: lang-ja.json
* - 韓国語: lang-ko.json
* - 英語 : lang-en.json
* - ja: lang-ja.json
* - ko: lang-ko.json
* - en : lang-en.json
*
* Copyright (C) Agentec Co, Ltd. All rights reserved.
*/
......@@ -74,7 +74,10 @@ I18N.getNavigatorLanguage = function () {
return lang;
};
/* Language resource file loading */
/**
* Language resource file loading
* @param {*} lang
*/
I18N.loadLanguage = function (lang) {
// Select language file from arguments
var langfile = 'lang-' + lang + '.json';
......@@ -104,7 +107,10 @@ I18N.loadLanguage = function (lang) {
});
};
/* Replace all text on the page with the language */
/**
* Replace all text on the page with the language
* @param {*} jsonLangData
*/
I18N.replaceText = function (jsonLangData) {
var itemCount = $('.lang').length;
if (itemCount > 0) {
......@@ -149,7 +155,11 @@ I18N.i18nReplaceText = function () {
}
};
/* Get string from key */
/**
* Get string from key
* @param {*} key
* @returns
*/
I18N.i18nText = function (key) {
var storage = window.sessionStorage;
if (storage) {
......@@ -162,7 +172,12 @@ I18N.i18nText = function (key) {
return 'undefined';
};
/* Obtain strings from key values of language data */
/**
* Obtain strings from key values of language data
* @param {*} jsonLangData
* @param {*} key
* @returns
*/
I18N.getLangText = function (jsonLangData, key) {
if (jsonLangData) {
var text = jsonLangData[key];
......@@ -171,7 +186,10 @@ I18N.getLangText = function (jsonLangData, key) {
return 'undefined.';
};
/* Switching Language Data */
/**
* Switching Language Data
* @param {*} lang
*/
I18N.changeLanguage = function (lang) {
// Store the selected language only when switching languages
var storage = window.localStorage;
......@@ -183,7 +201,11 @@ I18N.changeLanguage = function (lang) {
I18N.loadLanguage(lang);
};
/* Save language settings */
/**
* Save language settings
* @param {*} lang
* @param {*} langData
*/
I18N.storeCurrentLanguage = function (lang, langData) {
var ss = window.sessionStorage;
if (ss) {
......
......@@ -31,6 +31,7 @@ DASHBOARD.getDataApiUrl = COMMON.format(ClientData.conf_checkApiUrl(), ClientDat
/**
* Call api get data
* @param callback
*/
DASHBOARD.getDashboardData = function (callback) {
let param = {
......@@ -82,7 +83,11 @@ DASHBOARD.initCommunications = function () {
});
};
/** Initialization dashboard items html */
/**
* Initialization dashboard items html
* @param {*} item
* @returns
*/
DASHBOARD.initHtmlItem = function (item) {
let countText = '' + item.count;
if (item.count >= 100) {
......@@ -144,7 +149,11 @@ DASHBOARD.loadCommon = function () {
TEMPLATE.loadMainNavsTitle('#includedMainTitle', 'dashboard', null, DASHBOARD.loadMainTitleCallback);
};
/** Update pickup config from setting dashboard data */
/**
* Update pickup config from setting dashboard data
* @param {*} settings
* @param {*} dataDashboard
*/
DASHBOARD.updateDataPickups = function (settings, dataDashboard) {
DASHBOARD.pickupItems.forEach(function (item) {
const enabled = settings[item.id];
......@@ -158,7 +167,10 @@ DASHBOARD.updateDataPickups = function (settings, dataDashboard) {
});
};
/** Update communication setting from dashboard data */
/**
* Update communication setting from dashboard data
* @param {*} dataDashboard
*/
DASHBOARD.updateDataCommunications = function (dataDashboard) {
DASHBOARD.communicationItems.forEach(function (item) {
if (item.id == 'messageList') {
......@@ -171,7 +183,10 @@ DASHBOARD.updateDataCommunications = function (dataDashboard) {
});
};
/** Direct to pickup screen */
/**
* Direct to pickup screen
* @param {*} pickupId
*/
DASHBOARD.goPickup = function (pickupId) {
COMMON.goUrlWithCurrentParams('pickup.html', { pickupActive: pickupId });
};
......
......@@ -7,71 +7,78 @@
var HEADER = {};
HEADER.init = function() {
$("#dspLoginId").text(ClientData.userInfo_loginId());
HEADER.init = function () {
$('#dspLoginId').text(ClientData.userInfo_loginId());
$("#btnLogout").click(HEADER.logoutFunction);
$('#btnLogout').click(HEADER.logoutFunction);
};
/** Direct home page setting */
/**
* Direct home page setting
* @param {*} pageId
*/
HEADER.goToHomePage = function (pageId) {
DashboardSetting.getSettingData(function (settings) {
if(settings.dashboardHome == 1)
{
if (settings.dashboardHome == 1) {
HEADER.goDashboard();
}
else
{
} else {
HEADER.goOperationList();
}
});
}
HEADER.logoutFunction = function() {
console.log("clicked logout");
$("#msgModel").text(I18N.i18nText('msgLogoutConfirm'));
};
$("#confirmYes").click(HEADER.processLogout);
}
/**
* logout function
*/
HEADER.logoutFunction = function () {
console.log('clicked logout');
$('#msgModel').text(I18N.i18nText('msgLogoutConfirm'));
HEADER.processLogout = function() {
$('#confirmYes').click(HEADER.processLogout);
};
/**
* process logout
*/
HEADER.processLogout = function () {
var params = {
sid: ClientData.userInfo_sid()
sid: ClientData.userInfo_sid(),
};
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.LOGOUT;
COMMON.cmsAjax(url, params, false,
function (data) {
if (data.httpStatus == CONSTANT.HTTP_STATUS.OK) {
SessionStorageUtils.clear();
COMMON.userSetting().remove(CONSTANT.KEYS.userInfo_sid);
COMMON.userSetting().remove(CONSTANT.KEYS.userInfo_sid_local);
// Move to login screen
//window.location = COMMON.ScreenIds.Login;
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
} else {
if (data.errorMessage) {
COMMON.displayAlert(data.errorMessage);
} else {
COMMON.displayAlert("errorOccured");
}
}
},
function (xmlHttpRequest, txtStatus, errorThrown) {
if(xmlHttpRequest.errorMessage) {
COMMON.displayAlert(xmlHttpRequest.errorMessage);
} else {
COMMON.displayAlert("errorOccured");
}
});
}
COMMON.cmsAjax(
url,
params,
false,
function (data) {
if (data.httpStatus == CONSTANT.HTTP_STATUS.OK) {
SessionStorageUtils.clear();
COMMON.userSetting().remove(CONSTANT.KEYS.userInfo_sid);
COMMON.userSetting().remove(CONSTANT.KEYS.userInfo_sid_local);
// Move to login screen
//window.location = COMMON.ScreenIds.Login;
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
} else {
if (data.errorMessage) {
COMMON.displayAlert(data.errorMessage);
} else {
COMMON.displayAlert('errorOccured');
}
}
},
function (xmlHttpRequest, txtStatus, errorThrown) {
if (xmlHttpRequest.errorMessage) {
COMMON.displayAlert(xmlHttpRequest.errorMessage);
} else {
COMMON.displayAlert('errorOccured');
}
},
);
};
/**
* Go page of operationList
*/
HEADER.goOperationList = function () {
* Go page of operationList
*/
HEADER.goOperationList = function () {
$('#footer').load(CONSTANT.PAGE_NAME.FOOTER, function () {
sessionStorage.activeTab = CONSTANT.PAGE_TAB.OPERATION_LIST;
HEADER.activeInitBottomNav('operationListBottomNav');
......@@ -83,10 +90,9 @@ HEADER.processLogout = function() {
* Go page of dashboard
*/
HEADER.goDashboard = function () {
COMMON.avwScreenMove("dashboard.html");
COMMON.avwScreenMove('dashboard.html');
};
/**
* Initialize with any navigation
*
......@@ -111,7 +117,6 @@ HEADER.inactiveAllBottomNav = function () {
}
};
/**
* Change specific footer bottom to active.
*
......
......@@ -376,7 +376,10 @@ LOGIN.changePasswordProcess = function () {
);
};
// Change Language English
/**
* Change Language English
* @param {*} lang
*/
LOGIN.changeLanguage = function (lang) {
I18N.changeLanguage(lang);
document.title = I18N.i18nText('dspLogin') + ' | ' + I18N.i18nText('sysAppTitle');
......@@ -459,6 +462,10 @@ LOGIN.getServiceOptionList = function () {
});
};
/**
* login when click enter
* @param {*} e
*/
LOGIN.loginWhenClickEnter = function (e) {
var code = e.keyCode ? e.keyCode : e.which;
if (code == 13) {
......@@ -493,7 +500,11 @@ LOGIN.initLoginNormalUser = function () {
$('#txtPassword').keydown(LOGIN.loginWhenClickEnter);
};
/* display alert screen */
/**
* display alert screen
* @param {*} errMes
* @param {*} scrMove
*/
LOGIN.showAlertScreen = function (errMes, scrMove) {
// アラートメッセージの表示
if (errMes == undefined || errMes == '') {
......
......@@ -53,6 +53,7 @@ NotificationSelect.selectOperationClick = function () {
/**
* init data, action when screen onload
* @param selectedCallback
*/
NotificationSelect.init = function (selectedCallback) {
NotificationSelect.getNotificationSelectData(function (data) {
......@@ -65,6 +66,7 @@ NotificationSelect.init = function (selectedCallback) {
/**
* Implement notification select html
* @param pushMessageTemplate
* @returns
*/
NotificationSelect.createNotificationSelectList = function (pushMessageTemplate) {
......
......@@ -132,6 +132,7 @@ OL.setSearchInfoWeb = function () {
/**
* create operation list
* @param operarionList
*/
OL.createOperationList = function (operationList) {
//Initialization
......@@ -494,8 +495,10 @@ OL.resetSearch = function () {
/**
* Transition to the report form or operation list screen
*
* @param {String} operationId
* @param {*} operationId
* @param {*} operationType
* @param {*} reportType
* @param {*} enableAddReport
*/
OL.sendOperation = function (operationId, operationType, reportType, enableAddReport) {
//save operation logs. needed for sorting
......
......@@ -55,6 +55,7 @@ OperationSelect.selectOperationClick = function () {
/**
* init data, action when screen onload
* @param selectedCallback
*/
OperationSelect.init = function (selectedCallback) {
OperationSelect.getOperationSelectData(function (data) {
......@@ -67,6 +68,7 @@ OperationSelect.init = function (selectedCallback) {
/**
* Implement operation select html
* @param operarionList
* @returns
*/
OperationSelect.createOperationSelectList = function (operationList) {
......
......@@ -54,6 +54,7 @@ PICKUP.getReportWithWarningsListApiUrl = PICKUP.baseApiUrl + CONSTANT.URL.CMS.AP
/**
* Call get new report list api get data
* @param callback
*/
PICKUP.getNewreportListData = function (callback) {
let param = {
......@@ -559,6 +560,11 @@ PICKUP.initWarningReportWithReportOnlyType = function (report) {
return ele;
};
/**
* init Warning Report With Inspect Type
* @param {*} report
* @returns
*/
PICKUP.initWarningReportWithInspectType = function (report) {
let ele = $(
"<li class='card mb-2'>" +
......@@ -736,6 +742,7 @@ PICKUP.getInspectDate = function (dateString) {
/**
* send data to open report form from New report pickup
* @param operarionId
* @returns
*/
PICKUP.sendReportFormFromNewReport = function (operationId) {
......@@ -749,7 +756,10 @@ PICKUP.sendReportFormFromNewReport = function (operationId) {
/**
* send data to open report form of event click continuous work operation report
* @returns
* @param {*} operationId
* @param {*} taskKey
* @param {*} processKey
* @param {*} phaseNo
*/
PICKUP.sendReportFormFromContinuousWork = function (operationId, taskKey, processKey, phaseNo) {
//Transition to the report form or operation list screen
......@@ -763,8 +773,13 @@ PICKUP.sendReportFormFromContinuousWork = function (operationId, taskKey, proces
};
/**
* send data to open report form of event click warning operation report
* @returns
* send data to open report form of event click warning operation reports
* @param {*} operationId
* @param {*} reportType
* @param {*} taskKey
* @param {*} processKey
* @param {*} phaseNo
* @param {*} replyNo
*/
PICKUP.sendReportFormFromWarningReport = function (operationId, reportType, taskKey, processKey, phaseNo, replyNo) {
//Transition to the report form or operation list screen
......
......@@ -14,7 +14,10 @@ $(document).ready(function () {
COMMON.closeLoading();
});
// Process changing password
/**
* Process changing password
* @param {*} e
*/
SETTINGS.dspPwdUpd1_Click = function (e) {
e.preventDefault();
var isOK = true;
......
......@@ -31,14 +31,21 @@ TEMPLATE.loadDashboardSetting = function (elmentId, changeCallback) {
});
};
/** Template load confirm model */
/**
* Template load confirm model
* @param {*} elmentId
*/
TEMPLATE.loadConfirmModal = function (elmentId) {
$(elmentId).load('../common/html/confirmModal.html', function () {
I18N.initi18n();
});
};
/** Template load operation select */
/**
* Template load operation select
* @param {*} elmentId
* @param {*} selectCallback
*/
TEMPLATE.loadOperationSelect = function (elmentId, selectCallback) {
$(elmentId).load('operationSelect.html', function () {
OperationSelect.init(selectCallback);
......@@ -55,7 +62,11 @@ TEMPLATE.showModalConfirm = function () {
});
};
/** Template load notification content*/
/**
* Template load notification content
* @param {*} elmentId
* @param {*} selectCallback
*/
TEMPLATE.loadNotificationSelect = function (elmentId, selectCallback) {
$(elmentId).load('notificationContent.html', function () {
NotificationSelect.init(selectCallback);
......
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