Commit ee4a6bb7 by Takumi Imai

#49471 インデント修正

parent 49973db6
{
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 200,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 4,
"tabs": true,
"trailingComma": "all",
"useTabs": false,
"vueIndentScriptAndStyle": false
}
\ No newline at end of file
......@@ -19,59 +19,52 @@ CHK_Common.lang;
* web gets lang form local storage
* but app gets lnag from session storage
*/
CHK_Common.setLangCodeWeb = function() {
CHK_Common.setLangCodeWeb = function () {
let lang = CHK_Common.getLangWeb();
if (lang.split("-")[0] == CHK_CONSTANT.LANG.English) {
if (lang.split('-')[0] == CHK_CONSTANT.LANG.English) {
lang = CHK_CONSTANT.LANG.ENGLISH;
} else if (lang.split("-")[0] == CHK_CONSTANT.LANG.KOREA) {
} else if (lang.split('-')[0] == CHK_CONSTANT.LANG.KOREA) {
lang = CHK_CONSTANT.LANG.KOREA;
} else {
lang =CHK_CONSTANT.LANG.JAPAN;
lang = CHK_CONSTANT.LANG.JAPAN;
}
CHK_Common.lang = lang;
}
};
/**
* get lang in local storage
*
* @returns String pageLang
*/
CHK_Common.getLangWeb = function() {
CHK_Common.getLangWeb = function () {
if (!CHK_Common.lang) {
let pageLang;
if (localStorage[CHK_CONSTANT.LANG.SAVE_NAME]) {
pageLang = localStorage[CHK_CONSTANT.LANG.SAVE_NAME];
}
else {
pageLang = (window.navigator.languages && window.navigator.languages[0]) ||
window.navigator.language ||
window.navigator.userLanguage ||
window.navigator.browserLanguage;
} else {
pageLang = (window.navigator.languages && window.navigator.languages[0]) || window.navigator.language || window.navigator.userLanguage || window.navigator.browserLanguage;
localStorage[CHK_CONSTANT.LANG.SAVE_NAME] = pageLang;
}
return pageLang;
} else {
return CHK_Common.lang;
}
return pageLang;
}
};
/**
* change lang of html
*/
CHK_Common.updateLang = function() {
$(".multi-lang").each(function () {
const key = $(this).attr("data-msg");
CHK_Common.updateLang = function () {
$('.multi-lang').each(function () {
const key = $(this).attr('data-msg');
if (key) {
if ($(this).prop("tagName").toLowerCase() == "input" && ($(this).attr("type") == "text" || $(this).attr("type") == "search")) {
if ($(this).prop('tagName').toLowerCase() == 'input' && ($(this).attr('type') == 'text' || $(this).attr('type') == 'search')) {
const attr = $(this).attr('placeholder');
if (typeof attr !== 'undefined' && attr !== false) {
$(this).attr("placeholder", CHK_Common.getMsg(key));
$(this).attr('placeholder', CHK_Common.getMsg(key));
} else {
$(this).val(CHK_Common.getMsg(key));
}
......@@ -80,7 +73,7 @@ CHK_Common.getLangWeb = function() {
}
}
});
}
};
/**
* get any lang msg from CHK_Common.msgMap
......@@ -91,11 +84,11 @@ CHK_Common.getLangWeb = function() {
CHK_Common.getMsg = function (key) {
const msg = CHK_CONSTANT.MSG_MAP[key];
if (!msg) {
return "";
return '';
}
return msg[CHK_Common.lang];
}
};
/**
* show loading dialog
......@@ -103,98 +96,64 @@ CHK_Common.getMsg = function (key) {
*
* @param {String} key
*/
CHK_Common.showLoading = function() {
$("#check_loading").dialog({
dialogClass: 'noTitleDialog ui-dialog-titlebar dialogNoBorder',
CHK_Common.showLoading = function () {
$('#check_loading').dialog({
dialogClass: 'noTitleDialog ui-dialog-titlebar dialogNoBorder', //cssを追加する必要がある
autoOpen: false,
resizable: false,
modal: true,
width: "100%",
width: '100%',
title: ' ',
open: function(e) {
$('.loadingAnime .loadingBall').css('animation-play-state','');
open: function (e) {
$(e.target).parent().css('background-color', 'rgba(128,128,128)');
$(e.target).parent().css('position', 'absolute');
$(e.target).parent().css('left', '50%');
$(e.target).parent().css('top', '25vh');
$(e.target).parent().css('transform', 'translateX(-50%)');
$(e.target).parent().css('-webkit- transform', 'translateY(-50%) translateX(-50%)');
$(e.target).parent().children(".ui-dialog-buttonpane").css('background-color', 'rgba(128,128,128)').css('border', 'none');
$(e.target).parent().children('.ui-dialog-buttonpane').css('background-color', 'rgba(128,128,128)').css('border', 'none');
},
close: function() {}
close: function () {},
});
$("#check_loading").dialog('open');
}
$('#check_loading').dialog('open');
};
/**
* close loading
*/
CHK_Common.closeLoading = function() {
if ($("#check_loading").hasClass("ui-dialog-content")) {
$("#check_loading").dialog('close');
$('.loadingAnime .loadingBall').css('animation-play-state','paused');
CHK_Common.closeLoading = function () {
if ($('#check_loading').hasClass('ui-dialog-content')) {
$('#check_loading').dialog('close');
}
}
};
/**
* show alert
*
* @param {String} msgCode
*/
CHK_Common.displayAlert = function(msgCode) {
$("#alertMsg").html(CHK_Common.getMsg(msgCode));
$(".alert-overlay").removeClass("d-none");
$(".alert-area").removeClass("d-none");
const positionY = $(document).scrollTop() + screen.height/8;
const height = screen.height/4;
$(".alert-overlay").css("height", screen.height);
$(".alert-area").css("top", positionY);
$(".alert-area").css("min-height", height);
$("body").css("overflow", "hidden");
}
CHK_Common.displayAlert = function (msgCode, title) {
$('#alertMsg').html(CHK_Common.getMsg(msgCode));
$('.alert-overlay').removeClass('d-none');
$('.alert-area').removeClass('d-none');
const positionY = $(document).scrollTop() + screen.height / 8;
const height = screen.height / 4;
$('.alert-overlay').css('height', screen.height);
$('.alert-area').css('top', positionY);
$('.alert-area').css('min-height', height);
$('body').css('overflow', 'hidden');
};
/**
* close alert
*/
CHK_Common.alertClose = function() {
$(".alert-overlay").addClass("d-none");
$(".alert-area").addClass("d-none");
$("body").css("overflow", "visible");
}
/**
* send ABookCheck
*
* @param {json} param
* @param {boolean} async
* @param {Object} callback
* @param {Object} errorCallback
*/
CHK_Common.sendABookCheckApi = function(param, async = true, callback, errorCallback) {
const url = CHK_Common.getUrlWeb(param.cmd);
CHK_Common.cmsAjax(url, param, async, callback, errorCallback);
}
/**
* get URL for CMS action
* @param {String} method
*/
CHK_Common.getUrlWeb = function(method) {
for (let i in CHK_CONSTANT.CMS_WEB) {
if (CHK_CONSTANT.CMS_WEB[i].includes(method)) {
return "https://" + location.host + "/checkapi/web/" + CHK_CONSTANT.CMS_WEB[i] + "/" + method;
}
}
return null;
}
CHK_Common.alertClose = function () {
$('.alert-overlay').addClass('d-none');
$('.alert-area').addClass('d-none');
$('body').css('overflow', 'visible');
};
/**
* go Url page With Current Params
......@@ -205,47 +164,48 @@ CHK_Common.getUrlWeb = function(method) {
* @param {String} url
* @param {Object} params
*/
CHK_Common.goUrlWithCurrentParams = function(url, params) {
const webUrl = 'abvw/html/';
CHK_Common.goUrlWithCurrentParams = function (url, params) {
if (!params) {
location.href = webUrl + url;
location.href = CHK_CONSTANT.URL.BASE_WEB + url;
}
const mixParams = Object.assign(CHK_Common.getUrlParameter(), params);
if (url.includes("?")) {
if (url.includes('?')) {
location.href = url + '&' + new URLSearchParams(mixParams);
} else {
location.href = url + '?' + new URLSearchParams(mixParams);
}
}
};
/**
* get url parameter
*
*/
CHK_Common.getUrlParameter = function() {
CHK_Common.getUrlParameter = function () {
var ret = {};
if (location.search) {
var param = {};
location.search.substring(1).split('&').forEach(function(val) {
location.search
.substring(1)
.split('&')
.forEach(function (val) {
var kv = val.split('=');
param[kv[0]] = kv[1];
});
ret = param;
}
console.log({ret: ret});
console.log({ ret: ret });
return ret;
}
};
/**
* get sid in local Storage
*
* @returns sid
*/
CHK_Common.getSid = function() {
return "sid";
}
CHK_Common.getSid = function () {
return 'sid';
};
/**
* cms communication
......@@ -256,46 +216,45 @@ CHK_Common.getSid = function() {
* @param {Object} callback
* @param {Object} errorCallback
*/
CHK_Common.cmsAjax = function(url, param, async = true, callback, errorCallback) {
CHK_Common.cmsAjax = function (url, param, async = true, callback, errorCallback) {
if (url) {
$.ajax({
type: "POST",
type: 'POST',
url: url,
data: param,
dataType:"json",
dataType: 'json',
cache: false,
async: async,
success: function(result) {
if (result.status == "200") {
if(callback) callback(result);
} else if (result.status == "401") {
success: function (result) {
if (result.status == '200') {
if (callback) callback(result);
} else if (result.status == '401') {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
} else if(errorCallback) {
} else if (errorCallback) {
errorCallback();
} else {
CHK_Common.closeLoading();
CHK_Common.displayAlert(result.message);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
//if(errorCallback) {
//errorCallback();
//} else {
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (errorCallback) {
errorCallback();
} else {
CHK_Common.closeLoading();
CHK_Common.displayAlert("errorCommunicationFailed");
//}
CHK_Common.displayAlert('errorCommunicationFailed');
}
},
});
} else {
if(errorCallback) {
if (errorCallback) {
errorCallback();
} else {
CHK_Common.closeLoading();
CHK_Common.displayAlert("errorOccurred");
CHK_Common.displayAlert('errorOccurred');
}
}
}
};
/**
* Communicate with cms and post
......@@ -304,8 +263,7 @@ CHK_Common.cmsAjax = function(url, param, async = true, callback, errorCallback)
* @param {Object} params
* @param {String} method
*/
CHK_Common.postCommunication = function(url, params, method='post') {
CHK_Common.postCommunication = function (url, params, method = 'post') {
const form = document.createElement('form');
form.method = method;
form.action = url;
......@@ -329,11 +287,11 @@ CHK_Common.postCommunication = function(url, params, method='post') {
*
* @param {boolean} async
*/
CHK_Common.checkAuth = function(async = true) {
let params ={};
CHK_Common.checkAuth = function (async = true) {
let params = {};
params.sid = CHK_Common.getSid;
params.cmd = CHK_CONSTANT.ACT_CMD.checkSession;
CHK_Common.sendABookCheckApi(params, async, null, function() {
CHK_Common.sendABookCheckApi(params, async, null, function () {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
});
}
\ No newline at end of file
};
/**
* constant js
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
* @since 1.4.3.2 & 1.4.3.3
*/
const CHK_CONSTANT = {};
......@@ -14,90 +14,78 @@ CHK_CONSTANT.SORT_TYPE = {
};
CHK_CONSTANT.PAGE_NAME = {
DASHBOARD: "dashboard",
OPERATION_LIST: "operationList",
FOOTER: "main-footer.html",
DEFAULT: "index.html",
LOGIN: "login.html"
}
DASHBOARD: 'dashboard',
OPERATION_LIST: 'operationList',
FOOTER: 'main-footer.html',
DEFAULT: 'index.html',
LOGIN: 'login.html',
};
CHK_CONSTANT.PAGE_TAB = {
DASHBOARD: "dashboard",
OPERATION_LIST: "operationList"
}
DASHBOARD: 'dashboard',
OPERATION_LIST: 'operationList',
};
CHK_CONSTANT.OPERATION_TYPE = {
LIST: "0",
DRAWING: "1",
VTOUR: "2",
PDF: "3"
LIST: '0',
DRAWING: '1',
VTOUR: '2',
PDF: '3',
};
CHK_CONSTANT.REPORT_TYPE = {
REPORTONLY: "0",
INSPECT: "1",
WITHREPLY: "2",
WORKFLOW: "3"
}
REPORTONLY: '0',
INSPECT: '1',
WITHREPLY: '2',
WORKFLOW: '3',
};
CHK_CONSTANT.ADD_REPORT_FLG = {
UNABLE: "0",
ABLE: "1"
}
//Command for sending CMS.
//must match the value (method name).
CHK_CONSTANT.ACT_CMD = {
getOperationList: "getOperationList",
goOperation: "redirectOperationPage",
checkSession: "checkAuthUser",
saveOperationLog: "saveOperationLog"
UNABLE: '0',
ABLE: '1',
};
//method name corresponding to the command.
//Disallow duplicate method names.
CHK_CONSTANT.CMS_WEB = {
OperationListWeb: ["getOperationList"],
BranchOperation: ["redirectOperationPage"],
GetSession: ["checkAuthUser"],
OperationLogWeb:["saveOperationLog"]
CHK_CONSTANT.URL = {
BASE_CMS: 'https://' + location.host + '/checkapi/web/',
BASE_WEB: 'abvw/html/',
ALL_OPERATION_LIST: 'operationLIstWeb/getOperationList',
};
CHK_CONSTANT.LANG = {
SAVE_NAME: "lang",
JAPAN: "ja",
KOREA: "ko",
ENGLISH: "en"
}
SAVE_NAME: 'lang',
JAPAN: 'ja',
KOREA: 'ko',
ENGLISH: 'en',
};
CHK_CONSTANT.MSG_MAP = {
all:{ja:"全て", ko:"전체", en:"All"},
dateError: { ja: "開始日は終了日の前に設定してください。", ko: "잘못된 검색일입니다.", en: "Please enter correct search date." },
operationListTitle:{ ja: "トップページ|A Book Check", ko: "톱 페이지|A Book Check", en: "Top Page|A Book Check" },
buttonCategory: { ja: "カテゴリー", ko: "카테고리", en: "Category" },
buttonRefresh: { ja: "更新", ko: "갱신", en: "Refresh" },
buttonBack: { ja: "戻る", ko: "Back", en: "Back" },
placeholderOperationName: { ja: "作業名", ko: "작업명", en: "Working Name" },
labelPeriod: { ja: "期間", ko: "기간", en: "Period" },
labelStartDate: { ja: "開始日", ko: "시작일", en: "Start date" },
labelEndDate: { ja: "終了日", ko: "종료일", en: "End date" },
placeholderSelect: { ja: "選択", ko: "선택", en: "Choice" },
labelSort: { ja: "並び替え", ko: "정렬", en: "Sort" },
labelSortName: { ja: "作業名順", ko: "작업명순", en: "By working name" },
labelSortNew: { ja: "作業期間が新しい順", ko: "작업기간이 최신순", en: "By newest period" },
labelSortOld: { ja: "作業期間が古い順", ko: "작업기간이 오래된순", en: "By oldest period" },
labelSortOpen: { ja: "閲覧日が新しい順", ko: "열람순", en: "By newest viewing date" },
labelReset: { ja: "クリア", ko: "클리어", en: "Clear" },
headerItemName: { ja: "作業名", ko: "작업명", en: "Working Name" },
headerStartDate: { ja: "開始日", ko: "시작일", en: "Start date" },
headerEndDate: { ja: "終了日", ko: "종료일", en: "End date" },
buttonHome: { ja: "ホーム", ko: "홈", en: "Home" },
buttonSetting: { ja: "設定", ko: "설정", en: "Setting" },
buttonOperationList: { ja: "作業一覧", ko: "작업일람", en: "Operations List" },
operationListHeaderTitle: { ja: "作業一覧", ko: "작업일람", en: "Operations List" },
buttonDashboard: { ja: "ダッシュボード", ko: "대시보드", en: "Dashboard" },
buttonDashboardSetting: { ja: "設定", ko: "설정", en: "Setting" },
Processing_w_dot: { ja: "処理中...", ko: "처리중", en: "Processing..." },
errorCommunicationFailed: { ja: "通信エラーが発生しました", ko: "통신 오류가 발생했습니다", en: "A communication error has occurred" },
errorOccurred: { ja: "エラーが発生しました", ko: "오류가 발생했습니다", en: "Error Occurred" }
all: { ja: '全て', ko: '전체', en: 'All' },
dateError: { ja: '開始日は終了日の前に設定してください。', ko: '잘못된 검색일입니다.', en: 'Please enter correct search date.' },
operationListTitle: { ja: 'トップページ|A Book Check', ko: '톱 페이지|A Book Check', en: 'Top Page|A Book Check' },
buttonCategory: { ja: 'カテゴリー', ko: '카테고리', en: 'Category' },
buttonRefresh: { ja: '更新', ko: '갱신', en: 'Refresh' },
buttonBack: { ja: '戻る', ko: 'Back', en: 'Back' },
placeholderOperationName: { ja: '作業名', ko: '작업명', en: 'Working Name' },
labelPeriod: { ja: '期間', ko: '기간', en: 'Period' },
labelStartDate: { ja: '開始日', ko: '시작일', en: 'Start date' },
labelEndDate: { ja: '終了日', ko: '종료일', en: 'End date' },
placeholderSelect: { ja: '選択', ko: '선택', en: 'Choice' },
labelSort: { ja: '並び替え', ko: '정렬', en: 'Sort' },
labelSortName: { ja: '作業名順', ko: '작업명순', en: 'By working name' },
labelSortNew: { ja: '作業期間が新しい順', ko: '작업기간이 최신순', en: 'By newest period' },
labelSortOld: { ja: '作業期間が古い順', ko: '작업기간이 오래된순', en: 'By oldest period' },
labelSortOpen: { ja: '閲覧日が新しい順', ko: '열람순', en: 'By newest viewing date' },
labelReset: { ja: 'クリア', ko: '클리어', en: 'Clear' },
headerItemName: { ja: '作業名', ko: '작업명', en: 'Working Name' },
headerStartDate: { ja: '開始日', ko: '시작일', en: 'Start date' },
headerEndDate: { ja: '終了日', ko: '종료일', en: 'End date' },
buttonHome: { ja: 'ホーム', ko: '홈', en: 'Home' },
buttonSetting: { ja: '設定', ko: '설정', en: 'Setting' },
buttonOperationList: { ja: '作業一覧', ko: '작업일람', en: 'Operations List' },
operationListHeaderTitle: { ja: '作業一覧', ko: '작업일람', en: 'Operations List' },
buttonDashboard: { ja: 'ダッシュボード', ko: '대시보드', en: 'Dashboard' },
buttonDashboardSetting: { ja: '設定', ko: '설정', en: 'Setting' },
Processing_w_dot: { ja: '処理中...', ko: '처리중', en: 'Processing...' },
errorCommunicationFailed: { ja: '通信エラーが発生しました', ko: '통신 오류가 발생했습니다', en: 'A communication error has occurred' },
errorOccurred: { ja: 'エラーが発生しました', ko: '오류가 발생했습니다', en: 'Error Occurred' },
};
......@@ -48,9 +48,9 @@
<section class="category-menu">
<div id="overlayDiv" class="overlay"></div>
<nav id="category-menu" class="drawer-menu">
<div class="d-flex justify-content-between border-bottom">
<h2 class="text-nowrap font-weight-bold fs-13 p-3 mb-0 multi-lang" data-msg="buttonCategory"></h2>
<a class="category-btn p-3" onclick="CHK_OL.openCategory();" href="#"><i class="fa fa-times"></i></a>
<div class="d-flex justifyfont-weight-bold fs-13 p-3 mb-0 multi-lang" data-msg="buttonCategory"></h2>
<a class="category-content-between border-bottom">
<h2 class="text-nowrap -btn p-3" onclick="CHK_OL.openCategory();" href="#"><i class="fa fa-times"></i></a>
</div>
</nav>
</section>
......
......@@ -9,7 +9,7 @@ var CHK_OL = {};
CHK_OL.operationList; //Operation json data
CHK_OL.operationGroupMaster; //category(operationGroupMaster) json data
CHK_OL.isOperationGroupMaster = 0;//0: category(operationGroupMaster) not exist 1: category(operationGroupMaster) exist
CHK_OL.isOperationGroupMaster = 0; //0: category(operationGroupMaster) not exist 1: category(operationGroupMaster) exist
CHK_OL.operationSearchCriteria;
CHK_OL.sortIndex;
......@@ -21,8 +21,8 @@ CHK_OL.operationGroupMasterId;
* 2.show operationList.
* 3.show category(operationGroupMaster).
*/
CHK_OL.init = function() {
console.log("OperationList start");
CHK_OL.init = function () {
console.log('OperationList start');
//get all data of operation list scene
CHK_OL.getAllDataWeb();
......@@ -32,7 +32,7 @@ CHK_OL.operationGroupMasterId;
//show category(operationGroupMaster)
CHK_OL.createCategory();
}
};
/**
* get operation list all data
......@@ -45,8 +45,7 @@ CHK_OL.operationGroupMasterId;
* @param {String} searchEndDate
* @param {Number} operationGroupMasterId
*/
CHK_OL.getAllDataWeb = function(searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
CHK_OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
let param = {};
param.cmd = CHK_CONSTANT.ACT_CMD.getOperationList;
param.sid = CHK_Common.getSid();
......@@ -56,32 +55,33 @@ CHK_OL.operationGroupMasterId;
param.endDate = searchEndDate;
param.operationGroupMasterId = operationGroupMasterId;
CHK_Common.sendABookCheckApi(param, false, function(json) {
const url = CHK_CONSTANT.URL.BASE_CMS + ALL_OPERATION_LIST;
CHK_Common.cmsAjax(url, param, false, function (json) {
CHK_OL.operationList = json.operationList;
CHK_OL.operationGroupMaster = json.operationGroupMasterList;
CHK_OL.isOperationGroupMaster = json.isOperationGroupMaster;
CHK_OL.operationSearchCriteria = json.operationSearchCriteria;
CHK_OL.setSearchInfoWeb();
console.log("json.operationList", JSON.stringify(json.operationList));
console.log('json.operationList', JSON.stringify(json.operationList));
});
}
};
/**
* set search criteria when Initial display.
*/
CHK_OL.setSearchInfoWeb = function() {
CHK_OL.setSearchInfoWeb = function () {
CHK_OL.sortIndex = CHK_OL.operationSearchCriteria.sort;
$("#searchTaskName").val(CHK_OL.operationSearchCriteria.operationName);
$("#searchStartDate").val(CHK_OL.operationSearchCriteria.startDate);
$("#searchEndDate").val(CHK_OL.operationSearchCriteria.endDate);
$('#searchTaskName').val(CHK_OL.operationSearchCriteria.operationName);
$('#searchStartDate').val(CHK_OL.operationSearchCriteria.startDate);
$('#searchEndDate').val(CHK_OL.operationSearchCriteria.endDate);
CHK_OL.operationGroupMasterId = CHK_OL.operationSearchCriteria.operationGroupMasterId;
}
};
/**
* create operation list
*/
CHK_OL.createOperationList = function(operationList) {
CHK_OL.createOperationList = function (operationList) {
//Initialization
CHK_OL.initActiveSortIndex();
$('#operationTable').empty();
......@@ -92,22 +92,33 @@ CHK_OL.createOperationList = function(operationList) {
//create & show
for (let i = 0; i < operationList.length; i++) {
let operationTR = $("<tr/>");
const operationNameTd = $("<td class='operationId_" + operationList[i].operationId
+ "'><a href=\"javascript:CHK_OL.sendOperation('goOperation', '"
+ operationList[i].operationId + "', '" + operationList[i].operationType+ "', '" + operationList[i].reportType + "');\" class='d-block text-black text-decoration-none mb-1'>" + operationList[i].operationName
+ "</a><div class='fa-sm mobile_operation_date'><i class='far fa-clock fa-blue' style='color:blue;margin-right:10px'></i>"
+ CHK_OL.setOperationDate(operationList[i].operationStartDate) + " ~ "
+ CHK_OL.setOperationDate(operationList[i].operationEndDate) +"</div></td>");
const operationStartDateTd = $("<td/>", {class: "operationStartDate"}).text(CHK_OL.setOperationDate(operationList[i].operationStartDate));
const operationEndDateTd = $("<td/>", {class: "operationEndDate"}).text(CHK_OL.setOperationDate(operationList[i].operationEndDate));
let operationTR = $('<tr/>');
const operationNameTd = $(
"<td class='operationId_" +
operationList[i].operationId +
"'><a href=\"javascript:CHK_OL.sendOperation('goOperation', '" +
operationList[i].operationId +
"', '" +
operationList[i].operationType +
"', '" +
operationList[i].reportType +
"');\" class='d-block text-black text-decoration-none mb-1'>" +
operationList[i].operationName +
"</a><div class='fa-sm mobile_operation_date'><i class='far fa-clock fa-blue' style='color:blue;margin-right:10px'></i>" +
CHK_OL.setOperationDate(operationList[i].operationStartDate) +
' ~ ' +
CHK_OL.setOperationDate(operationList[i].operationEndDate) +
'</div></td>',
);
const operationStartDateTd = $('<td/>', { class: 'operationStartDate' }).text(CHK_OL.setOperationDate(operationList[i].operationStartDate));
const operationEndDateTd = $('<td/>', { class: 'operationEndDate' }).text(CHK_OL.setOperationDate(operationList[i].operationEndDate));
operationTR.append(operationNameTd);
operationTR.append(operationStartDateTd);
operationTR.append(operationEndDateTd);
$(".table tbody").append(operationTR);
$('.table tbody').append(operationTR);
}
};
......@@ -116,20 +127,19 @@ CHK_OL.createOperationList = function(operationList) {
*
* @param {Number} sortIndex
*/
CHK_OL.initActiveSortIndex = function(sortIndex) {
CHK_OL.initActiveSortIndex = function (sortIndex) {
if (!sortIndex && !CHK_OL.sortIndex) {
CHK_OL.sortIndex = CHK_CONSTANT.SORT_TYPE.START_DATE_DESC;
}
$(".sort-type").each(function() {
const sortType = $(this).data("sort");
$('.sort-type').each(function () {
const sortType = $(this).data('sort');
if (sortType == CHK_OL.sortIndex) {
$(".sort-type").removeClass("active");
$(this).addClass("active");
$('.sort-type').removeClass('active');
$(this).addClass('active');
}
});
}
};
/**
* set date for OperationList
......@@ -137,16 +147,15 @@ CHK_OL.initActiveSortIndex = function(sortIndex) {
* @param {String} date
* @returns operationDate
*/
CHK_OL.setOperationDate = function(date) {
const operationDate = date.replace(/-/g, "/").substring(0,10);
CHK_OL.setOperationDate = function (date) {
const operationDate = date.replace(/-/g, '/').substring(0, 10);
return operationDate;
};
/**
* create category(operationGroupMaster).
*/
CHK_OL.createCategory = function() {
CHK_OL.createCategory = function () {
if (!CHK_OL.isOperationGroupMaster) {
return;
}
......@@ -160,181 +169,197 @@ CHK_OL.createCategory = function() {
/**
* Initial processing of category(operationGroupMaster).
*/
CHK_OL.initCategory = function() {
CHK_OL.initCategory = function () {
if (!CHK_OL.isOperationGroupMaster) {
return;
}
$("#operationGroupMasterButton").removeClass("d-none");
$(window).resize(function() {
$('#operationGroupMasterButton').removeClass('d-none');
$(window).resize(function () {
CHK_OL.setCategoryHeight();
});
}
};
/**
* change height category(operationGroupMaster)
*/
CHK_OL.setCategoryHeight = function() {
CHK_OL.setCategoryHeight = function () {
const CATEGORY_HEIGHT = $('footer').offset().top - $('#category-menu').offset().top;
console.log(CATEGORY_HEIGHT);
$("#category-menu").css("overflow", "scroll");
$('#category-menu').css('overflow', 'scroll');
$('#category-menu').height(CATEGORY_HEIGHT);
$('#overlayDiv').height(CATEGORY_HEIGHT);
}
};
/**
* create Breadcrumb List
*/
CHK_OL.createBreadcrumbList = function() {
CHK_OL.createBreadcrumbList = function () {
if (!CHK_OL.isOperationGroupMaster) {
return;
}
$("#groupMasterPath").empty();
$('#groupMasterPath').empty();
if (typeof CHK_OL.operationGroupMasterId == 'undefined' || CHK_OL.operationGroupMasterId == 0) {
$("#groupMasterPath").append('<li class="breadcrumb-item"><a href="#" class="text-decoration-none text-dark">' + CHK_Common.getMsg("all") + '</a></li>');
$('#groupMasterPath').append('<li class="breadcrumb-item"><a href="#" class="text-decoration-none text-dark">' + CHK_Common.getMsg('all') + '</a></li>');
} else {
const groupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == CHK_OL.operationGroupMasterId)[0];
const groupMasterPathIdlist = groupMaster.treePath.split('/');
groupMasterPathIdlist.forEach( function (parentId){
groupMasterPathIdlist.forEach(function (parentId) {
const pathOperationGroupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == parentId)[0];
$("#groupMasterPath").append('<li class="breadcrumb-item"><a onclick="CHK_OL.changeOperationGroupMaster('
+ pathOperationGroupMaster.operationGroupMasterId + ');" class="text-decoration-none text-dark">'
+ pathOperationGroupMaster.operationGroupMasterName + '</a></li>');
$('#groupMasterPath').append(
'<li class="breadcrumb-item"><a onclick="CHK_OL.changeOperationGroupMaster(' +
pathOperationGroupMaster.operationGroupMasterId +
');" class="text-decoration-none text-dark">' +
pathOperationGroupMaster.operationGroupMasterName +
'</a></li>',
);
});
}
}
};
/**
* create category(operationGroupMaster) structure
*/
CHK_OL.createCategoryList = function() {
CHK_OL.createCategoryList = function () {
if (!CHK_OL.isOperationGroupMaster) {
return;
}
//Create a side menu category structure
$('.group-category-list').remove();
CHK_OL.operationGroupMaster.sort(function(a, b) {
CHK_OL.operationGroupMaster.sort(function (a, b) {
if (a.operationGroupMasterLevel < b.operationGroupMasterLevel) return -1;
if (a.operationGroupMasterLevel > b.operationGroupMasterLevel) return 1;
return 1;
});
//common
const noCategory = $("<dl id='groupMasterId_0' class='group-category-list'><dt><a onclick='CHK_OL.changeOperationGroupMaster(0);'>"+ CHK_Common.getMsg(CHK_CONSTANT.MSG_MAP.all) + "</a></dt></dl>");
const noCategory = $(
"<dl id='groupMasterId_0' class='group-category-list'><dt><a onclick='CHK_OL.changeOperationGroupMaster(0);'>" + CHK_Common.getMsg(CHK_CONSTANT.MSG_MAP.all) + '</a></dt></dl>',
);
$('#category-menu').append(noCategory);
//create category(operationGroupMaster) structure
for (let i = 0; i < CHK_OL.operationGroupMaster.length; i++) {
if (CHK_OL.operationGroupMaster[i].operationGroupMasterLevel == 0 ){
const categoryParent = $("<dl id=groupMasterId_" + CHK_OL.operationGroupMaster[i].operationGroupMasterId
+ " class='group-category-list' style='overflow-x:auto;'><dt class='menu-ttl'><a onclick='CHK_OL.changeOperationGroupMaster("
+ CHK_OL.operationGroupMaster[i].operationGroupMasterId + ");'>" + CHK_OL.operationGroupMaster[i].operationGroupMasterName
+ "</a></dt></dl>");
if (CHK_OL.operationGroupMaster[i].operationGroupMasterLevel == 0) {
const categoryParent = $(
'<dl id=groupMasterId_' +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
" class='group-category-list' style='overflow-x:auto;'><dt class='menu-ttl'><a onclick='CHK_OL.changeOperationGroupMaster(" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
");'>" +
CHK_OL.operationGroupMaster[i].operationGroupMasterName +
'</a></dt></dl>',
);
$('#category-menu').append(categoryParent);
} else {
if ($('#groupMasterId_'+ CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId + '>ul').length > 0){
const categoryChild = $("<li id='groupMasterId_" + CHK_OL.operationGroupMaster[i].operationGroupMasterId
+ "' class=''><p class='category-li group-level-" + CHK_OL.operationGroupMaster[i].operationGroupMasterLevel
+ "'><a class='category-a' onclick='CHK_OL.changeOperationGroupMaster("
+ CHK_OL.operationGroupMaster[i].operationGroupMasterId + ");'>" + CHK_OL.operationGroupMaster[i].operationGroupMasterName
+ "</a></p></li>");
if ($('#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId + '>ul').length > 0) {
const categoryChild = $(
"<li id='groupMasterId_" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
"' class=''><p class='category-li group-level-" +
CHK_OL.operationGroupMaster[i].operationGroupMasterLevel +
"'><a class='category-a' onclick='CHK_OL.changeOperationGroupMaster(" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
");'>" +
CHK_OL.operationGroupMaster[i].operationGroupMasterName +
'</a></p></li>',
);
$('#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId + ' >ul').append(categoryChild);
} else {
const groupParents = '#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId;
$(groupParents + " > p").addClass("sub-menu-ttl");
const categoryChild = $("<ul style='display:none;' class=''><li class='' id='groupMasterId_" + CHK_OL.operationGroupMaster[i].operationGroupMasterId
+ "' class=''><p class='category-li group-level-"
+ CHK_OL.operationGroupMaster[i].operationGroupMasterLevel
+ "'><a class='category-a' onclick='CHK_OL.changeOperationGroupMaster(" + CHK_OL.operationGroupMaster[i].operationGroupMasterId
+ ");'>" + CHK_OL.operationGroupMaster[i].operationGroupMasterName + "</a></p></li></ul>");
$(groupParents + ' > p').addClass('sub-menu-ttl');
const categoryChild = $(
"<ul style='display:none;' class=''><li class='' id='groupMasterId_" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
"' class=''><p class='category-li group-level-" +
CHK_OL.operationGroupMaster[i].operationGroupMasterLevel +
"'><a class='category-a' onclick='CHK_OL.changeOperationGroupMaster(" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
");'>" +
CHK_OL.operationGroupMaster[i].operationGroupMasterName +
'</a></p></li></ul>',
);
$('#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId).append(categoryChild);
}
}
}
}
};
/**
* Open/close category(operationGroupMaster) drawer menu
*/
CHK_OL.acdMenu = function() {
CHK_OL.acdMenu = function () {
//Hide accordion contents by default
$(".drawer-menu dd").css("display", "none");
$(".drawer-menu2 ul").css("display", "none");
$('.drawer-menu dd').css('display', 'none');
$('.drawer-menu2 ul').css('display', 'none');
//second accordion
$(".drawer-menu dt").on('click', function() {
$(".sub-menu-ttl").removeClass("openAcd").next().slideUp("fast");
$(".drawer-menu dt").not(this).removeClass("open").next().slideUp("fast");
$(this).toggleClass("open").next().slideToggle("fast");
$('.drawer-menu dt').on('click', function () {
$('.sub-menu-ttl').removeClass('openAcd').next().slideUp('fast');
$('.drawer-menu dt').not(this).removeClass('open').next().slideUp('fast');
$(this).toggleClass('open').next().slideToggle('fast');
});
//third accordion
$(".sub-menu-ttl").on('click', function() {
$(".sub-menu-ttl").not($(this)).not($(this).parents().siblings("p")).removeClass("openAcd").next().slideUp("fast");
$(this).toggleClass("openAcd").next().slideToggle("fast");
$('.sub-menu-ttl').on('click', function () {
$('.sub-menu-ttl').not($(this)).not($(this).parents().siblings('p')).removeClass('openAcd').next().slideUp('fast');
$(this).toggleClass('openAcd').next().slideToggle('fast');
});
}
};
/**
* Sort the operationList by screen operation
*
* @param {Object} sortType
*/
CHK_OL.changeSortType = function(sortType) {
$(".sort-type").removeClass("active");
$(sortType).addClass("active");
CHK_OL.sortIndex = $(sortType).attr("data-sort");
CHK_OL.changeSortType = function (sortType) {
$('.sort-type').removeClass('active');
$(sortType).addClass('active');
CHK_OL.sortIndex = $(sortType).attr('data-sort');
CHK_OL.sortOperationList(sortType);
CHK_OL.createOperationList(CHK_OL.operationList);
}
};
/**
* sort the operationList
*
* @param {Number} sortType
*/
CHK_OL.sortOperationList = function(sortType) {
switch(sortType) {
CHK_OL.sortOperationList = function (sortType) {
switch (sortType) {
case CHK_CONSTANT.SORT_TYPE.NAME:
CHK_OL.operationList.sort(function(a,b) {
CHK_OL.operationList.sort(function (a, b) {
if (a.operationName > b.operationName) return 1;
if (a.operationName < b.operationName) return -1;
return 0;
});
break;
case CHK_CONSTANT.SORT_TYPE.START_DATE_DESC:
CHK_OL.operationList.sort(function(a,b) {
CHK_OL.operationList.sort(function (a, b) {
if (setOperationDate(a.operationStartDate) < setOperationDate(b.operationStartDate)) return 1;
if (setOperationDate(a.operationStartDate) > setOperationDate(b.operationStartDate)) return -1;
return 0;
});
break;
case CHK_CONSTANT.SORT_TYPE.START_DATE_ASC:
CHK_OL.operationList.sort(function(a,b) {
CHK_OL.operationList.sort(function (a, b) {
if (setOperationDate(a.operationStartDate) > setOperationDate(b.operationStartDate)) return 1;
if (setOperationDate(a.operationStartDate) < setOperationDate(b.operationStartDate)) return -1;
return 0;
});
break;
case CHK_CONSTANT.SORT_TYPE.TYPE:
CHK_OL.operationList.sort(function(a,b) {
CHK_OL.operationList.sort(function (a, b) {
if (a.operationType < b.operationType) return 1;
if (a.operationType > b.operationType) return -1;
return 0;
});
break;
case CHK_CONSTANT.SORT_TYPE.LAST_EDIT_DATE:
const defaultDate = "1900-01-01 09:00:00";
CHK_OL.operationList.sort(function(a,b) {
const defaultDate = '1900-01-01 09:00:00';
CHK_OL.operationList.sort(function (a, b) {
if (!a.operationOpenDate) {
a.operationOpenDate = defaultDate;
}
......@@ -347,20 +372,20 @@ CHK_OL.sortOperationList = function(sortType) {
});
break;
}
}
};
/**
* search operarionList
*/
CHK_OL.search = function() {
CHK_OL.search = function () {
CHK_Common.showLoading();
const searchKeyword = $("#searchTaskName").val();
const searchStartDate = $("#searchStartDate").val();
const searchEndDate = $("#searchEndDate").val();
const searchKeyword = $('#searchTaskName').val();
const searchStartDate = $('#searchStartDate').val();
const searchEndDate = $('#searchEndDate').val();
if((searchStartDate && searchEndDate) && (searchStartDate > searchEndDate)){
if (searchStartDate && searchEndDate && searchStartDate > searchEndDate) {
CHK_Common.closeLoading();
CHK_Common.displayAlert("dateError");
CHK_Common.displayAlert('dateError');
return;
}
......@@ -373,44 +398,43 @@ CHK_OL.search = function() {
* change the operationList by select the category(OperationGroupMaster)
* @param {Number} operationGroupMasterId
*/
CHK_OL.changeOperationGroupMaster = function(operationGroupMasterId) {
if ($("#category-menu").hasClass("open")) {
CHK_OL.changeOperationGroupMaster = function (operationGroupMasterId) {
if ($('#category-menu').hasClass('open')) {
$('#category-toggle-button').click();
$("body").css("overflow", "visible");
$('body').css('overflow', 'visible');
}
CHK_OL.operationGroupMasterId = operationGroupMasterId;
CHK_OL.search();
}
};
/**
* open the category(OperationGroupMaster)
*/
CHK_OL.openCategory = function() {
window.scrollTo(0,0);
if ($("#category-menu").hasClass("open")) {
$("body").css("overflow", "visible");
}else{
$("body").css("overflow", "hidden");
CHK_OL.openCategory = function () {
window.scrollTo(0, 0);
if ($('#category-menu').hasClass('open')) {
$('body').css('overflow', 'visible');
} else {
$('body').css('overflow', 'hidden');
}
}
};
/**
* reset search
*/
CHK_OL.resetSearch = function() {
CHK_OL.resetSearch = function () {
$('#searchTaskName').val('');
$('#searchStartDate').val('');
$('#searchEndDate').val('');
CHK_OL.changeSortType($('#defaultSort'));
}
};
/**
* Transition to the report form or operation list screen
*
* @param {String} operationId
*/
CHK_OL.sendOperation = function(operationId, operationType, reportType) {
CHK_OL.sendOperation = function (operationId, operationType, reportType) {
//save operation logs. needed for sorting
let saveParams = {};
saveParams.sid = CHK_Common.getSid();
......@@ -421,7 +445,7 @@ CHK_OL.sendOperation = function(operationId, operationType, reportType) {
const date = new Date();
saveParams.viewingStartDate = date.toLocaleString();
CHK_Common.sendABookCheckApi(saveParam, false)
CHK_Common.sendABookCheckApi(saveParam, false);
//Transition to the report form or operation list screen
let postParams = {};
......
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