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