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,34 +64,40 @@ DashboardSetting.getSettingData = function (callback) {
sid: COMMON.getSid(),
};
const url = DashboardSetting.baseApiUrl;
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'
};
if (json && json.dashboardSettingList) {
for (const item of json.dashboardSettingList) {
if (mapKeys.hasOwnProperty(item.id)) {
const settingKey = mapKeys[item.id];
settings[settingKey] = item.settingValue;
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',
};
if (json && json.dashboardSettingList) {
for (const item of json.dashboardSettingList) {
if (mapKeys.hasOwnProperty(item.id)) {
const settingKey = mapKeys[item.id];
settings[settingKey] = item.settingValue;
}
}
}
}
if (callback) {
callback(settings);
}
}, function() {
console.log('DashboardSetting.getSettingData error');
});
if (callback) {
callback(settings);
}
},
function () {
console.log('DashboardSetting.getSettingData error');
},
);
};
/**
* apply settings to screen
* @param {JSON} settings
* @param {JSON} settings
*/
DashboardSetting.applySettings = function (settings) {
for (const key in settings) {
......@@ -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) {
DashboardSetting.closeModal();
if (DashboardSetting.changeSettingCallback && typeof DashboardSetting.changeSettingCallback === 'function') {
DashboardSetting.changeSettingCallback();
}
}, function() {
console.log('DashboardSetting.saveSetting error');
DashboardSetting.closeModal();
});
COMMON.cmsAjax(
url,
param,
false,
function (json) {
DashboardSetting.closeModal();
if (DashboardSetting.changeSettingCallback && typeof DashboardSetting.changeSettingCallback === 'function') {
DashboardSetting.changeSettingCallback();
}
},
function () {
console.log('DashboardSetting.saveSetting error');
DashboardSetting.closeModal();
},
);
};
/**
......
/**
* 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
*/
......@@ -14,23 +14,29 @@ NotificationSelect.defaultNotificationSelectJson = [];
/**
* get operation select data from cms
* @param {function} callback
* @param {function} callback
*/
NotificationSelect.getNotificationSelectData = function (callback) {
let param = {
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) {
if (callback) {
callback(json);
}
}, function() {
console.log('NotificationSelect.getNotificationSelectData error');
if (callback) {
callback(NotificationSelect.defaultNotificationSelectJson);
}
});
COMMON.cmsAjax(
url,
param,
false,
function (json) {
if (callback) {
callback(json);
}
},
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);
......@@ -59,57 +65,59 @@ NotificationSelect.selectOperationClick = function () {
/**
* Implement notification select html
* @returns
* @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 = "";
let ahrefName = $("<a href='#' class='d-flex text-decoration-none'></a>");
let divParentName = $("<div class='card mb-2 " + classSelected + "' id='heading" + i + "'></div>");
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 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 messageli = $("<li class='accordion' id='accordion" + i + "'></li>");
ahrefName.append(divName);
ahrefName.append(divIcon);
let messageli = $("<li class='accordion' id='accordion" + i + "'></li>");
ahrefName.append(divName);
ahrefName.append(divIcon);
divParentName.append(ahrefName);
divValue.append(divBodyValue);
messageli.append(divParentName);
messageli.append(divValue);
if(i == 0)
{
messageli.append(divParentName);
messageli.append(divValue);
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();
};
\ No newline at end of file
};
/**
* 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
......@@ -16,23 +16,29 @@ OperationSelect.defaultOperationSelectJson = [];
/**
* get operation select data from cms
* @param {function} callback
* @param {function} callback
*/
OperationSelect.getOperationSelectData = function (callback) {
let param = {
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) {
if (callback) {
callback(json);
}
}, function() {
console.log('OperationSelect.getOperationSelectData error');
if (callback) {
callback(OperationSelect.defaultOperationSelectJson);
}
});
COMMON.cmsAjax(
url,
param,
false,
function (json) {
if (callback) {
callback(json);
}
},
function () {
console.log('OperationSelect.getOperationSelectData error');
if (callback) {
callback(OperationSelect.defaultOperationSelectJson);
}
},
);
};
/**
......@@ -61,50 +67,49 @@ OperationSelect.init = function (selectedCallback) {
/**
* Implement operation select html
* @returns
* @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>");
ahrefRequiredFlg.append(divText);
messageli.append(ahrefRequiredFlg);
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>');
$("#operationSelectList").append(messageli);
}
$("#operationSelectList :first-child").addClass("selected");
}
ahrefRequiredFlg.append(divText);
messageli.append(ahrefRequiredFlg);
$('#operationSelectList').append(messageli);
}
$('#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();
};
\ No newline at end of file
};
// 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