Commit 0457bca1 by Takumi Imai

ファイルコメント追加

parent f4b02a86
/**
* Dashboard Setting js in dashboard.html
*
* @since 1.0 check web
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var DashboardSetting = {};
DashboardSetting.changeSettingCallback = function() {};
DashboardSetting.changeSettingCallback = function () {};
/**
* Html element array, map with json key from setting data API
......@@ -27,33 +27,33 @@ DashboardSetting.defaultSetting = {
continousWork: 1,
warningReport: 1,
dashboardHome: 0,
}
};
/** dummy setting json reponse */
DashboardSetting.dummySettingJson = {
dashboardSettingList: [
{
"id": 1,
"settingName": "New Report",
"settingValue": 1
id: 1,
settingName: 'New Report',
settingValue: 1,
},
{
"id": 2,
"settingName": "Continous Work",
"settingValue": 1
id: 2,
settingName: 'Continous Work',
settingValue: 1,
},
{
"id": 3,
"settingName": "Warning Report",
"settingValue": 1
id: 3,
settingName: 'Warning Report',
settingValue: 1,
},
{
"id": 4,
"settingName": "Dashboard Home",
"settingValue": 0
}
id: 4,
settingName: 'Dashboard Home',
settingValue: 0,
},
],
}
};
/**
* get setting data from cms
......@@ -64,14 +64,18 @@ DashboardSetting.getSettingData = function (callback) {
sid: COMMON.getSid(),
};
const url = DashboardSetting.baseApiUrl;
COMMON.cmsAjax(url, param, false, function (json) {
COMMON.cmsAjax(
url,
param,
false,
function (json) {
let settings = {};
//map id with key when save setting
const mapKeys = {
1: 'newReport',
2: 'continousWork',
3: 'warningReport',
4: 'dashboardHome'
4: 'dashboardHome',
};
if (json && json.dashboardSettingList) {
for (const item of json.dashboardSettingList) {
......@@ -84,9 +88,11 @@ DashboardSetting.getSettingData = function (callback) {
if (callback) {
callback(settings);
}
}, function() {
},
function () {
console.log('DashboardSetting.getSettingData error');
});
},
);
};
/**
......@@ -123,15 +129,21 @@ DashboardSetting.saveSetting = function () {
param[key] = element.enabled ? 1 : 0;
}
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.SAVE_DASHBOARD_SETTING;
COMMON.cmsAjax(url, param, false, function (json) {
COMMON.cmsAjax(
url,
param,
false,
function (json) {
DashboardSetting.closeModal();
if (DashboardSetting.changeSettingCallback && typeof DashboardSetting.changeSettingCallback === 'function') {
DashboardSetting.changeSettingCallback();
}
}, function() {
},
function () {
console.log('DashboardSetting.saveSetting error');
DashboardSetting.closeModal();
});
},
);
};
/**
......
// prepared to use Global object(LOGIN)
/**
* prepared to use Global object(LOGIN)
* @since cms:1.4.3.2&1.4.3.3 web:1.0
**/
var LOGIN = {};
// var requirePasswordChange;
......@@ -9,12 +13,12 @@ LOGIN.optionList = [];
LOGIN.force_pw_change_on_login;
LOGIN.force_pw_change_periodically;
LOGIN.login_error_flag = false;
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
LOGIN.timeWaitSplashScreen = 2000;// wait splash screen 2 second
LOGIN.timeWaitSplashScreen = 2000; // wait splash screen 2 second
// Load login Info
LOGIN.loadLoginInfo = function() {
LOGIN.loadLoginInfo = function () {
$('#chkRemember').attr('checked', 'checked');
if (ClientData.userInfo_accountPath() != null) {
$('#txtAccPath').val(ClientData.userInfo_accountPath());
......@@ -26,19 +30,17 @@ LOGIN.loadLoginInfo = function() {
};
// Initial Screen
LOGIN.initialScreen = function() {
LOGIN.initialScreen = function () {
if (ClientData.userInfo_rememberLogin()) {
LOGIN.loadLoginInfo();
} else {
$('#txtAccPath').val("");
$('#txtAccId').val("");
$('#txtAccPath').val('');
$('#txtAccId').val('');
}
};
// check Save Login Info
LOGIN.saveLoginInfo = function() {
LOGIN.saveLoginInfo = function () {
var lang = I18N.getCurrentLanguage();
// load language
I18N.changeLanguage(lang);
......@@ -71,30 +73,28 @@ LOGIN.saveLoginInfo = function() {
// reset to paging function
ClientData.JumpQueue([]);
ClientData.IsJumpBack(false);
};
// Check validation
LOGIN.checkValidation = function() {
LOGIN.checkValidation = function () {
var accountPath = $('#txtAccPath').val();
var loginId = $('#txtAccId').val();
var password = $('#txtPassword').val();
var msgError = $('#main-error-message');
if (!ValidationUtil.CheckRequiredForText(accountPath)) {
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
msgError.html(I18N.i18nText('msgLoginEmpty'));
msgError.attr('lang', 'msgLoginEmpty');
msgError.show();
return false;
} else if (!ValidationUtil.CheckRequiredForText(loginId)) {
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
msgError.html(I18N.i18nText('msgLoginEmpty'));
msgError.attr('lang', 'msgLoginEmpty');
msgError.show();
return false;
} else if (!ValidationUtil.CheckRequiredForText(password)) {
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
msgError.html(I18N.i18nText('msgLoginEmpty'));
msgError.attr('lang', 'msgLoginEmpty');
msgError.show();
......@@ -105,51 +105,51 @@ LOGIN.checkValidation = function() {
};
// Check Dialog validation
LOGIN.checkDialogValidation = function() {
LOGIN.checkDialogValidation = function () {
var currentPass = $('#txtCurrentPass').val();
var newPass = $('#txtNewPass').val();
var confirmPass = $('#txtConfirmNew').val();
var msgError = $('#dialog-error-message');
if (!ValidationUtil.CheckRequiredForText(currentPass)) {
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
msgError.html(I18N.i18nText('msgPwdEmpty'));
msgError.attr('lang', 'msgPwdEmpty');
msgError.show();
return false;
} else if (!ValidationUtil.CheckRequiredForText(newPass)) {
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
msgError.html(I18N.i18nText('msgPwdEmpty'));
msgError.attr('lang', 'msgPwdEmpty');
msgError.show();
return false;
} else {
if (newPass != confirmPass) {
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
msgError.html(I18N.i18nText('msgPwdNotMatch'));
msgError.attr('lang', 'msgPwdNotMatch');
msgError.show();
return false;
} else if (!ValidationUtil.CheckMinLengthForByte(newPass, 6)) {
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
msgError.html(I18N.i18nText('msgInvaildLength'));
msgError.attr('lang', 'msgInvaildLength');
msgError.show();
return false;
} else if (!ValidationUtil.CheckMaxLengthForByte(newPass, 16)) {
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
msgError.html(I18N.i18nText('msgInvaildLength'));
msgError.attr('lang', 'msgInvaildLength');
msgError.show();
return false;
} else if (ValidationUtil.HasSeqChar(newPass, 3)) {
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
msgError.html(I18N.i18nText('msgHasSeqChar'));
msgError.attr('lang', 'msgHasSeqChar');
msgError.show();
return false;
} else if (ValidationUtil.ContainSameSeqChar(newPass, currentPass, 4)) {
LOGIN.login_errorMessage = "";
LOGIN.login_errorMessage = '';
msgError.html(I18N.i18nText('msgContainSameSeqChar'));
msgError.attr('lang', 'msgContainSameSeqChar');
msgError.show();
......@@ -161,10 +161,10 @@ LOGIN.checkDialogValidation = function() {
};
// Login Process
LOGIN.processLogin = function() {
var accountPath = "";
var loginId = "";
var password = "";
LOGIN.processLogin = function () {
var accountPath = '';
var loginId = '';
var password = '';
loginId = $('#txtAccId').val();
......@@ -175,10 +175,10 @@ LOGIN.processLogin = function() {
var skipPwdDate;
var params = {
previousSid : '',
loginId : loginId,
password : password,
urlpath : accountPath
previousSid: '',
loginId: loginId,
password: password,
urlpath: accountPath,
};
// Set sid for login, this will be checked authoring 2 sessions
......@@ -188,7 +188,11 @@ LOGIN.processLogin = function() {
// Get url to login
url = COMMON.format(ClientData.conf_checkApiUrl(), accountPath) + CONSTANT.URL.CMS.API.LOGIN;
COMMON.cmsAjax(url, params, true, function(data) {
COMMON.cmsAjax(
url,
params,
true,
function (data) {
LOGIN.userinfo_sid = data.sid;
LOGIN.userInfo_userName = data.userName;
LOGIN.optionList = data.serviceOptionList;
......@@ -203,24 +207,24 @@ LOGIN.processLogin = function() {
$('#main-error-message').css('display', 'none');
console.log("data.requirePasswordChange:" + data.requirePasswordChange);
console.log('data.requirePasswordChange:' + data.requirePasswordChange);
COMMON.closeLoading();
if (data.requirePasswordChange == 0) {
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
// move to home.html page
COMMON.avwScreenMove("index.html");
COMMON.avwScreenMove('index.html');
} else if (data.requirePasswordChange == 1) {
if (LOGIN.force_pw_change_on_login == 2) { // force to change
if (LOGIN.force_pw_change_on_login == 2) {
// force to change
// password
LOGIN.OpenChangePasswordDialog();
$(".ui-dialog-titlebar").hide();
$('.ui-dialog-titlebar').hide();
$('#btnSkip').hide();
$("#txtPwdRemind").css('visibility', 'hidden');
} else if (LOGIN.force_pw_change_on_login == 1) { // recommend
$('#txtPwdRemind').css('visibility', 'hidden');
} else if (LOGIN.force_pw_change_on_login == 1) {
// recommend
// to change
// password
......@@ -230,31 +234,31 @@ LOGIN.processLogin = function() {
if (skipPwdDate == null || skipPwdDate == 'undefined') {
LOGIN.OpenChangePasswordDialog();
$('#btnSkip').show();
$(".ui-dialog-titlebar").hide();
$('.ui-dialog-titlebar').hide();
} else {
var date = new Date();
var skpPwdDt = new Date(skipPwdDate);
var numDay = date.subtractByDays(skpPwdDt);
if (numDay <= 30) {
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
// move to home.html page
COMMON.avwScreenMove("index.html");
COMMON.avwScreenMove('index.html');
} else if (numDay > 30) {
LOGIN.OpenChangePasswordDialog();
$('#btnSkip').show();
$(".ui-dialog-titlebar").hide();
$('.ui-dialog-titlebar').hide();
}
}
} else { // no need to change password
} else {
// no need to change password
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
// move to home.html page
COMMON.avwScreenMove("index.html");
COMMON.avwScreenMove('index.html');
}
} else if (data.requirePasswordChange == 2) {
if (LOGIN.force_pw_change_periodically == 1) { // recommend to
if (LOGIN.force_pw_change_periodically == 1) {
// recommend to
// change
// password
$('#btnSkip').show();
......@@ -262,9 +266,8 @@ LOGIN.processLogin = function() {
if (skipPwdDate == null || skipPwdDate == 'undefined') {
LOGIN.OpenChangePasswordDialog();
$(".ui-dialog-titlebar").hide();
$('.ui-dialog-titlebar').hide();
} else {
var date = new Date();
var skpPwdDt = new Date(skipPwdDate);
var numDay = date.subtractByDays(skpPwdDt);
......@@ -273,25 +276,26 @@ LOGIN.processLogin = function() {
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
// move to home.html page
COMMON.avwScreenMove("index.html");
COMMON.avwScreenMove('index.html');
} else if (numDay > 30) {
LOGIN.OpenChangePasswordDialog();
$(".ui-dialog-titlebar").hide();
$('.ui-dialog-titlebar').hide();
}
}
} else if (LOGIN.force_pw_change_periodically == 2) { // Force
} else if (LOGIN.force_pw_change_periodically == 2) {
// Force
// to
// change
// password
LOGIN.OpenChangePasswordDialog();
$('#btnSkip').hide();
$(".ui-dialog-titlebar").hide();
$("#txtPwdRemind").css('visibility', 'hidden');
} else { // No need to change password
$('.ui-dialog-titlebar').hide();
$('#txtPwdRemind').css('visibility', 'hidden');
} else {
// No need to change password
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
// move to home.html page
COMMON.avwScreenMove("index.html");
COMMON.avwScreenMove('index.html');
}
}
} else {
......@@ -299,10 +303,9 @@ LOGIN.processLogin = function() {
LOGIN.login_errorMessage = data.errorMessage;
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), data.errorMessage).toString());
$('#main-error-message').show();
}
}, function(result) {
},
function (result) {
LOGIN.login_error_flag = true;
COMMON.closeLoading();
if (result.errorMessage) {
......@@ -312,22 +315,23 @@ LOGIN.processLogin = function() {
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
}
$('#main-error-message').show();
});
},
);
};
// Change Password Process
LOGIN.changePasswordProcess = function() {
LOGIN.changePasswordProcess = function () {
var sid = ClientData.userInfo_sid_local();
var loginId = $('#txtAccId').val();
var password = $('#txtCurrentPass').val();
var confirmPass = $('#txtConfirmNew').val();
var params = {
sid : sid,
loginId : loginId,
password : password,
newPassword : confirmPass,
appId : 4
sid: sid,
loginId: loginId,
password: password,
newPassword: confirmPass,
appId: 4,
};
if (I18N.getCurrentLanguage()) {
......@@ -336,7 +340,11 @@ LOGIN.changePasswordProcess = function() {
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.PASSWORD_CHANGE;
COMMON.cmsAjax(url, params, false, function(result) {
COMMON.cmsAjax(
url,
params,
false,
function (result) {
if (result.httpStatus == '200') {
LOGIN.CloseChangePasswordDialog();
$('#dialog-error-message').css('display', 'none');
......@@ -344,11 +352,10 @@ LOGIN.changePasswordProcess = function() {
if (ClientData.serviceOpt_abook_check() == 'Y') {
// move to home.html page
COMMON.avwScreenMove("index.html");
COMMON.avwScreenMove('index.html');
} else {
$('#dialog-error-message').html(I18N.i18nText('msgPwdChangeNG'));
$('#dialog-error-message').show();
}
} else if (result.httpStatus == '401') {
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
......@@ -356,7 +363,8 @@ LOGIN.changePasswordProcess = function() {
$('#dialog-error-message').html(data.message);
$('#dialog-error-message').show();
}
}, function(result) {
},
function (result) {
COMMON.closeLoading();
if (result.errorMessage) {
$('#dialog-error-message').html(result.errorMessage);
......@@ -364,21 +372,21 @@ LOGIN.changePasswordProcess = function() {
$('#dialog-error-message').html(I18N.i18nText('msgPwdChangeNG'));
}
$('#dialog-error-message').show();
});
},
);
};
// Change Language English
LOGIN.changeLanguage = function(lang) {
LOGIN.changeLanguage = function (lang) {
I18N.changeLanguage(lang);
document.title = I18N.i18nText('dspLogin') + ' | ' + I18N.i18nText('sysAppTitle');
if (LOGIN.login_errorMessage != "") {
if (LOGIN.login_errorMessage != '') {
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), LOGIN.login_errorMessage).toString());
}
};
// Login click function
LOGIN.loginFunction = function() {
LOGIN.loginFunction = function () {
COMMON.showLoading();
if (LOGIN.checkValidation()) {
LOGIN.processLogin();
......@@ -388,14 +396,14 @@ LOGIN.loginFunction = function() {
};
// Change Password function
LOGIN.changePassFunction = function() {
LOGIN.changePassFunction = function () {
if (LOGIN.checkDialogValidation()) {
LOGIN.changePasswordProcess();
}
};
// Skip Password function
LOGIN.skipPassFunction = function() {
LOGIN.skipPassFunction = function () {
var date = new Date();
ClientData.userInfo_pwdSkipDt(date);
......@@ -403,32 +411,29 @@ LOGIN.skipPassFunction = function() {
if (ClientData.serviceOpt_abook_check() == 'Y') {
// move to home.html page
COMMON.avwScreenMove("index.html");
COMMON.avwScreenMove('index.html');
} else {
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
$('#main-error-message').show();
}
};
// Open Change Password Dialog
LOGIN.OpenChangePasswordDialog = function() {
$("#password-reset-modal").show();
LOGIN.OpenChangePasswordDialog = function () {
$('#password-reset-modal').show();
COMMON.showLoading();
console.log("password open");
console.log('password open');
};
// Close Chnage Password Dialog
LOGIN.CloseChangePasswordDialog = function() {
$("#main-password-change").hide();
LOGIN.CloseChangePasswordDialog = function () {
$('#main-password-change').hide();
COMMON.closeLoading();
};
// Save Service Option
LOGIN.saveServiceUserOption = function() {
$.each(LOGIN.optionList, function(i, option) {
LOGIN.saveServiceUserOption = function () {
$.each(LOGIN.optionList, function (i, option) {
if (option.serviceOptionId == 22) {
ClientData.serviceOpt_force_pw_change_periodically(option.value);
} else if (option.serviceOptionId == 21) {
......@@ -444,42 +449,39 @@ LOGIN.saveServiceUserOption = function() {
};
// Get Service Option
LOGIN.getServiceOptionList = function() {
$.each(LOGIN.optionList, function(i, option) {
LOGIN.getServiceOptionList = function () {
$.each(LOGIN.optionList, function (i, option) {
if (option.serviceOptionId == 22) {
LOGIN.force_pw_change_periodically = option.value;
} else if (option.serviceOptionId == 21) {
LOGIN.force_pw_change_on_login = option.value;
}
});
};
LOGIN.loginWhenClickEnter = function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if (code == 13) { // Enter keycode
LOGIN.loginWhenClickEnter = function (e) {
var code = e.keyCode ? e.keyCode : e.which;
if (code == 13) {
// Enter keycode
$('#btnLogin').click();
}
};
// init login for normal user
LOGIN.initLoginNormalUser = function() {
LOGIN.initLoginNormalUser = function () {
document.title = I18N.i18nText('dspLogin') + ' | ' + I18N.i18nText('sysAppTitle');
// Initial Screen
LOGIN.initialScreen();
// Change language
let selector = document.getElementById("languageSelect");
let selector = document.getElementById('languageSelect');
var lang = I18N.getCurrentLanguage();
if (lang) {
selector.value = lang;
}
selector.addEventListener("change", function() {
selector.addEventListener('change', function () {
LOGIN.changeLanguage(this.value);
})
});
// Button login click event
$('#btnLogin').click(LOGIN.loginFunction);
......@@ -491,30 +493,27 @@ LOGIN.initLoginNormalUser = function() {
$('#txtPassword').keydown(LOGIN.loginWhenClickEnter);
};
/* display alert screen */
LOGIN.showAlertScreen = function(errMes, scrMove) {
LOGIN.showAlertScreen = function (errMes, scrMove) {
// アラートメッセージの表示
if (errMes == undefined || errMes == "") {
errMes = "message."; // I18N.i18nText('msgPageImgErr');
if (errMes == undefined || errMes == '') {
errMes = 'message.'; // I18N.i18nText('msgPageImgErr');
}
COMMON.lockLayout();
/* show error messages */
$().toastmessage({
position : 'middle-center'
position: 'middle-center',
});
$().toastmessage('showToast', {
type : 'error',
sticky : true,
text : errMes,
close : function() {
}
type: 'error',
sticky: true,
text: errMes,
close: function () {},
});
$('.toast-type-error').css('height', '100px');
$('.toast-type-error > p').css('padding-top', '35px');
$('.toast-item-close').live('click', function() {
$('.toast-item-close').live('click', function () {
COMMON.unlockLayout();
if (scrMove) {
COMMON.avwScreenMove(scrMove);
......@@ -523,8 +522,7 @@ LOGIN.showAlertScreen = function(errMes, scrMove) {
};
// $(document).ready(function (e) {
LOGIN.ready = function() {
LOGIN.ready = function () {
// Session Storage clear
SessionStorageUtils.clear();
COMMON.userSessionObj = null;
......@@ -534,28 +532,24 @@ LOGIN.ready = function() {
var sysSettings = COMMON.sysSetting(); // get info in conf.json
// check an getits setting
if (sysSettings.apiUrl == "") {
if (sysSettings.apiUrl == '') {
// acquire parameters
var siteUrl = COMMON.getUrlParam('siteUrl', '');
var urlPath = COMMON.getUrlParam('urlPath', '');
var storeUrl = COMMON.getUrlParam('storeUrl', '');
if (siteUrl != "" && urlPath != "") {
if (siteUrl != '' && urlPath != '') {
// ClientData.siteUrl(siteUrl);
// set api connection
ClientData.conf_apiUrl(siteUrl + "{0}/abvapi");
ClientData.conf_apiLoginUrl(siteUrl + "nuabvapi");
ClientData.conf_checkApiUrl(siteUrl + "checkapi/web");
ClientData.conf_apiResourceDlUrl(siteUrl + "{0}/dl");
ClientData.conf_apiUrl(siteUrl + '{0}/abvapi');
ClientData.conf_apiLoginUrl(siteUrl + 'nuabvapi');
ClientData.conf_checkApiUrl(siteUrl + 'checkapi/web');
ClientData.conf_apiResourceDlUrl(siteUrl + '{0}/dl');
// set account setting value
ClientData.userInfo_accountPath(urlPath);
ClientData.userInfo_accountPath_session(urlPath);
ClientData.userInfo_loginId("");
ClientData.userInfo_loginId_session("");
ClientData.userInfo_loginId('');
ClientData.userInfo_loginId_session('');
}
} else {
// conf parameter set
ClientData.conf_apiUrl(sysSettings.apiUrl);
......@@ -568,20 +562,32 @@ LOGIN.ready = function() {
$('#normalUser').show();
$('#formlogin').hide();
$('#logologin').animate({
"margin-top" : 0
}, LOGIN.timeWaitSplashScreen, function() {
$('#logologin').animate(
{
'margin-top': 0,
},
LOGIN.timeWaitSplashScreen,
function () {
$('#formlogin').show();
$('#menu-language').animate({
opacity : 1
}, LOGIN.timeWaitSplashScreen);
$('#formlogin').animate({
opacity : 1
}, LOGIN.timeWaitSplashScreen);
$('.cnt_footer').animate({
opacity : 1
}, LOGIN.timeWaitSplashScreen);
});
$('#menu-language').animate(
{
opacity: 1,
},
LOGIN.timeWaitSplashScreen,
);
$('#formlogin').animate(
{
opacity: 1,
},
LOGIN.timeWaitSplashScreen,
);
$('.cnt_footer').animate(
{
opacity: 1,
},
LOGIN.timeWaitSplashScreen,
);
},
);
LOGIN.initLoginNormalUser();
};
/**
* Operation Select js in operationSelect.html
*
* @since 1.0 check web
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var NotificationSelect = {};
NotificationSelect.nameSelected="";
NotificationSelect.valueSelected="";
NotificationSelect.nameSelected = '';
NotificationSelect.valueSelected = '';
/**
* default operation select data JSON
*/
......@@ -21,16 +21,22 @@ NotificationSelect.getNotificationSelectData = function (callback) {
sid: COMMON.getSid(),
};
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.PUSH_MESSAGE_TEMPLATE;
COMMON.cmsAjax(url, param, false, function (json) {
COMMON.cmsAjax(
url,
param,
false,
function (json) {
if (callback) {
callback(json);
}
}, function() {
},
function () {
console.log('NotificationSelect.getNotificationSelectData error');
if (callback) {
callback(NotificationSelect.defaultNotificationSelectJson);
}
});
},
);
};
/**
......@@ -48,7 +54,7 @@ NotificationSelect.selectOperationClick = function () {
/**
* init data, action when screen onload
*/
NotificationSelect.init = function (selectedCallback) {
NotificationSelect.init = function (selectedCallback) {
NotificationSelect.getNotificationSelectData(function (data) {
if (typeof data === 'undefined' || data == null) return;
NotificationSelect.createNotificationSelectList(data.pushMessageTemplate);
......@@ -61,24 +67,29 @@ NotificationSelect.selectOperationClick = function () {
* Implement notification select html
* @returns
*/
NotificationSelect.createNotificationSelectList = function(pushMessageTemplate) {
$("#notificationSelectList").empty();
NotificationSelect.createNotificationSelectList = function (pushMessageTemplate) {
$('#notificationSelectList').empty();
if (typeof pushMessageTemplate === 'undefined' || pushMessageTemplate.length < 1) return;
let classSelected = "selected";
let classSelected = 'selected';
for (let i = 0; i < pushMessageTemplate.length; i++) {
let divName = $("<div class='pl-5 py-3 h-100 w-100 align-self-center select-label'>" + pushMessageTemplate[i].name + "</div>");
let divIcon = $("<div class='flex-shrink-1 mx-3 align-self-center'>"
+ "<button class='btn btn-link border collapsed' type='button' data-toggle='collapse' data-target='#collapse" + i + "' aria-expanded='true' aria-controls='collapse" + i + "'>"
+ "<div class='arrow-icon'></div>"
+ "</button></div>");
let divName = $("<div class='pl-5 py-3 h-100 w-100 align-self-center select-label'>" + pushMessageTemplate[i].name + '</div>');
let divIcon = $(
"<div class='flex-shrink-1 mx-3 align-self-center'>" +
"<button class='btn btn-link border collapsed' type='button' data-toggle='collapse' data-target='#collapse" +
i +
"' aria-expanded='true' aria-controls='collapse" +
i +
"'>" +
"<div class='arrow-icon'></div>" +
'</button></div>',
);
let ahrefName = $("<a href='#' class='d-flex text-decoration-none'></a>");
let divParentName = $("<div class='card mb-2 " + classSelected + "' id='heading" + i + "'></div>");
classSelected = "";
classSelected = '';
let divValue = $("<div id='collapse" + i + "' class='collapse' aria-labelledby='heading" + i + "' data-parent='#accordion" + i + "'></div>");
let divBodyValue = $("<div class='card-body'>" + pushMessageTemplate[i].value + "</div>");
let divBodyValue = $("<div class='card-body'>" + pushMessageTemplate[i].value + '</div>');
let messageli = $("<li class='accordion' id='accordion" + i + "'></li>");
......@@ -88,28 +99,25 @@ NotificationSelect.selectOperationClick = function () {
divValue.append(divBodyValue);
messageli.append(divParentName);
messageli.append(divValue);
if(i == 0)
{
if (i == 0) {
NotificationSelect.nameSelected = pushMessageTemplate[i].name;
NotificationSelect.valueSelected = pushMessageTemplate[i].value;
}
$("#notificationSelectList").append(messageli);
$('#notificationSelectList').append(messageli);
}
}
};
/**
* handle click event of select button
*/
NotificationSelect.onClickTempalte = function () {
NotificationSelect.onClickTempalte = function () {
NotificationSelect.chooseTemplate();
};
/**
* Get operation select and call back function in main page
*/
NotificationSelect.chooseTemplate = function () {
NotificationSelect.chooseTemplate = function () {
let param = {};
param.nameSelected = NotificationSelect.nameSelected;
param.valueSelected = NotificationSelect.valueSelected;
......@@ -122,6 +130,6 @@ NotificationSelect.selectOperationClick = function () {
/**
* close setting dialog
*/
NotificationSelect.closeModal = function () {
NotificationSelect.closeModal = function () {
$('#select-template-modal .close').click();
};
/**
* Operation Select js in operationSelect.html
*
* @since 1.0 check web
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var OperationSelect = {};
OperationSelect.changeSelectCallback = function() {};
OperationSelect.changeSelectCallback = function () {};
OperationSelect.operationIdSelected="";
OperationSelect.operationNameSelected="";
OperationSelect.operationIdSelected = '';
OperationSelect.operationNameSelected = '';
/**
* default operation select data JSON
......@@ -23,16 +23,22 @@ OperationSelect.getOperationSelectData = function (callback) {
sid: COMMON.getSid(),
};
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.OPERATION_SELECT;
COMMON.cmsAjax(url, param, false, function (json) {
COMMON.cmsAjax(
url,
param,
false,
function (json) {
if (callback) {
callback(json);
}
}, function() {
},
function () {
console.log('OperationSelect.getOperationSelectData error');
if (callback) {
callback(OperationSelect.defaultOperationSelectJson);
}
});
},
);
};
/**
......@@ -63,48 +69,47 @@ OperationSelect.init = function (selectedCallback) {
* Implement operation select html
* @returns
*/
OperationSelect.createOperationSelectList = function(operationList) {
$("#operationSelectList").empty();
OperationSelect.createOperationSelectList = function (operationList) {
$('#operationSelectList').empty();
if (typeof operationList === 'undefined' || operationList.length < 1) return;
for (let i = 0; i < operationList.length; i++) {
let messageli = $("<li class='card mb-2' name = 'operationId_" + operationList[i].operationId + "' ></li>");
let ahrefRequiredFlg = $("<a href='#' class='d-block px-5 py-3 text-decoration-none select-label' data-key='" + operationList[i].operationId + "' data-name='" + operationList[i].operationName + "' ></a>");
let divText = $("<div class='fs-12 text-truncate d-block'>"+ operationList[i].operationName + "</div>");
let ahrefRequiredFlg = $(
"<a href='#' class='d-block px-5 py-3 text-decoration-none select-label' data-key='" + operationList[i].operationId + "' data-name='" + operationList[i].operationName + "' ></a>",
);
let divText = $("<div class='fs-12 text-truncate d-block'>" + operationList[i].operationName + '</div>');
ahrefRequiredFlg.append(divText);
messageli.append(ahrefRequiredFlg);
$("#operationSelectList").append(messageli);
$('#operationSelectList').append(messageli);
}
$("#operationSelectList :first-child").addClass("selected");
}
$('#operationSelectList :first-child').addClass('selected');
};
/**
* handle click event of select button
*/
OperationSelect.onClickSelect = function () {
OperationSelect.onClickSelect = function () {
OperationSelect.chooseOperationSelect();
};
/**
* Get operation select and call back function in main page
*/
OperationSelect.chooseOperationSelect = function () {
OperationSelect.chooseOperationSelect = function () {
let param = {};
param.operationIdSelected = OperationSelect.operationIdSelected;
param.operationNameSelected = OperationSelect.operationNameSelected;
OperationSelect.closeModal();
if (OperationSelect.changeSelectCallback && typeof OperationSelect.changeSelectCallback === 'function') {
OperationSelect.changeSelectCallback(param.operationIdSelected,param.operationNameSelected );
OperationSelect.changeSelectCallback(param.operationIdSelected, param.operationNameSelected);
}
};
/**
* close setting dialog
*/
OperationSelect.closeModal = function () {
OperationSelect.closeModal = function () {
$('#task-list-modal .close').click();
};
// PDF PRINT function js
/**
* PDF PRINT function js
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
**/
var PP = {};
......
/**
* js for pushing detailed messages
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var PushMessageDetail = {};
PushMessageDetail.baseApiUrl = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.PUSH_MESSAGE_DETAIL;
......
// ReportForm function js
/**
* ReportForm function js
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var RF = {};
......
// ReportList function js
/**
* ReportList function js
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
**/
var RL = {};
......
/**
* Send Message js in sendMessage.html
*
* @since 1.0 check web
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var SendMessage = {};
......
/// Account Settings function js
/**
* Account Settings function js
* @since cms:1.4.3.2&1.4.3.3 web:1.0
**/
var SETTINGS = {};
......
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