Commit 0f932207 by Takumi Imai

Merge branch 'feature/1.0_check_web_dev_imai' into 'feature/1.0_check_web_dev'

constant footer operationLIst topPageの名前を変更

See merge request !3
parents 1578f03d 88d0aff8
......@@ -21,12 +21,12 @@ CHK_Common.lang;
*/
CHK_Common.setLangCodeWeb = function () {
let lang = CHK_Common.getLangWeb();
if (lang.split('-')[0] == CHK_CONSTANT.LANG.English) {
lang = CHK_CONSTANT.LANG.ENGLISH;
} else if (lang.split('-')[0] == CHK_CONSTANT.LANG.KOREA) {
lang = CHK_CONSTANT.LANG.KOREA;
if (lang.split('-')[0] == CONSTANT.LANG.English) {
lang = CONSTANT.LANG.ENGLISH;
} else if (lang.split('-')[0] == CONSTANT.LANG.KOREA) {
lang = CONSTANT.LANG.KOREA;
} else {
lang = CHK_CONSTANT.LANG.JAPAN;
lang = CONSTANT.LANG.JAPAN;
}
CHK_Common.lang = lang;
};
......@@ -39,11 +39,11 @@ CHK_Common.setLangCodeWeb = 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];
if (localStorage[CONSTANT.LANG.SAVE_NAME]) {
pageLang = localStorage[CONSTANT.LANG.SAVE_NAME];
} 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;
localStorage[CONSTANT.LANG.SAVE_NAME] = pageLang;
}
return pageLang;
} else {
......@@ -81,7 +81,7 @@ CHK_Common.updateLang = function () {
* @returns String msg
*/
CHK_Common.getMsg = function (key) {
const msg = CHK_CONSTANT.MSG_MAP[key];
const msg = CONSTANT.MSG_MAP[key];
if (!msg) {
return '';
}
......@@ -165,7 +165,7 @@ CHK_Common.alertClose = function () {
*/
CHK_Common.goUrlWithCurrentParams = function (url, params) {
if (!params) {
location.href = CHK_CONSTANT.URL.BASE_WEB + url;
location.href = CONSTANT.URL.BASE_WEB + url;
}
const mixParams = Object.assign(CHK_Common.getUrlParameter(), params);
......@@ -203,7 +203,7 @@ CHK_Common.getUrlParameter = function () {
* @returns sid
*/
CHK_Common.getSid = function () {
return ClientData.userInfo_sid_local();
return ClientData.userInfo_sid_local();
};
/**
......@@ -228,7 +228,7 @@ CHK_Common.cmsAjax = function (url, param, async = true, callback, errorCallback
if (result.status == '200') {
if (callback) callback(result);
} else if (result.status == '401') {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
CHK_Common.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
} else if (errorCallback) {
errorCallback();
} else {
......@@ -289,8 +289,8 @@ CHK_Common.postCommunication = function (url, params, method = 'post') {
CHK_Common.checkAuth = function (async = true) {
let params = {};
params.sid = CHK_Common.getSid;
const url = CHK_CONSTANT.URL.BASE_CMS + CHK_CONSTANT.URL.AUTH_SESSION;
const url = CONSTANT.URL.BASE_CMS + CONSTANT.URL.AUTH_SESSION;
CHK_Common.cmsAjax(url, params, async, null, function () {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
CHK_Common.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
});
};
/**
* constant js
*
* @since 1.4.3.2 & 1.4.3.3
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
const CHK_CONSTANT = {};
const CONSTANT = {};
CHK_CONSTANT.SORT_TYPE = {
CONSTANT.SORT_TYPE = {
NAME: 0,
START_DATE_DESC: 1,
START_DATE_ASC: 2,
......@@ -13,7 +13,7 @@ CHK_CONSTANT.SORT_TYPE = {
LAST_EDIT_DATE: 4,
};
CHK_CONSTANT.PAGE_NAME = {
CONSTANT.PAGE_NAME = {
DASHBOARD: 'dashboard',
OPERATION_LIST: 'operationList',
FOOTER: 'main-footer.html',
......@@ -21,45 +21,45 @@ CHK_CONSTANT.PAGE_NAME = {
LOGIN: 'login.html',
};
CHK_CONSTANT.PAGE_TAB = {
CONSTANT.PAGE_TAB = {
DASHBOARD: 'dashboard',
OPERATION_LIST: 'operationList',
};
CHK_CONSTANT.OPERATION_TYPE = {
CONSTANT.OPERATION_TYPE = {
LIST: '0',
DRAWING: '1',
VTOUR: '2',
PDF: '3',
};
CHK_CONSTANT.REPORT_TYPE = {
CONSTANT.REPORT_TYPE = {
REPORTONLY: '0',
INSPECT: '1',
WITHREPLY: '2',
WORKFLOW: '3',
};
CHK_CONSTANT.ADD_REPORT_FLG = {
CONSTANT.ADD_REPORT_FLG = {
UNABLE: '0',
ABLE: '1',
};
CHK_CONSTANT.URL = {
CONSTANT.URL = {
BASE_CMS: 'https://' + location.host + '/checkapi/web/',
BASE_WEB: 'abvw/html/',
ALL_OPERATION_LIST: 'operationLIstWeb/getOperationList',
AUTH_SESSION: 'getsession/checkAuthUser',
};
CHK_CONSTANT.LANG = {
CONSTANT.LANG = {
SAVE_NAME: 'lang',
JAPAN: 'ja',
KOREA: 'ko',
ENGLISH: 'en',
};
CHK_CONSTANT.MSG_MAP = {
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' },
......
/**
* Common js for footer.
* ※Code is written mainly for dashboard and operationList.
*
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var CHK_Footer = {};
var FOOTER = {};
/**
* Change specific footer bottom to active.
*
* @param {String} bottomNavId
*
* @param {String} bottomNavId
*/
CHK_Footer.activeBottomNav = function(bottomNavId) {
let elm = $("#" + bottomNavId);
FOOTER.activeBottomNav = function (bottomNavId) {
let elm = $('#' + bottomNavId);
if (typeof elm !== 'object') {
console.log('CHK_Footer.activeBottomNav:elm !== object:' + bottomNavId);
console.log('FOOTER.activeBottomNav:elm !== object:' + bottomNavId);
return;
}
elm.removeClass('text-secondary');
elm.addClass("text-primary");
let img = elm.find("img")[0];
if (img && img.getAttribute("data-src")) {
img.src = img.getAttribute("data-src");
elm.addClass('text-primary');
let img = elm.find('img')[0];
if (img && img.getAttribute('data-src')) {
img.src = img.getAttribute('data-src');
}
}
};
/**
* change inactive all footer bottom
*/
CHK_Footer.inactiveAllBottomNav = function() {
let navs = document.getElementsByClassName("bottom-nav");
FOOTER.inactiveAllBottomNav = function () {
let navs = document.getElementsByClassName('bottom-nav');
for (i = 0; i < navs.length; i++) {
navs[i].className = navs[i].className.replace("text-primary", "text-secondary");
let img = navs[i].querySelector("img");
navs[i].className = navs[i].className.replace('text-primary', 'text-secondary');
let img = navs[i].querySelector('img');
if (img && img.getAttribute('data-inactive-src')) {
img.src = img.getAttribute('data-inactive-src');
}
}
}
}
};
/**
* Go page of index.html.
* Store tab id in session for want to show display.
*
* @param {String} tabId
*
* @param {String} tabId
*/
CHK_Footer.goIndexPage = function(tabId) {
FOOTER.goIndexPage = function (tabId) {
sessionStorage.activeTab = tabId;
CHK_Common.goUrlWithCurrentParams(DAFAULT_PAGE);
}
};
/**
* is the url index.html?
*/
CHK_Footer.isIndexPage = function() {
FOOTER.isIndexPage = function () {
if (typeof location === 'object' && typeof location.pathname === 'string') {
if (location.pathname.includes(CHK_CONSTANT.PAGE_NAME.DEFAULT) == true) {
if (location.pathname.includes(CONSTANT.PAGE_NAME.DEFAULT) == true) {
return true;
}
}
return false;
}
};
/**
* Initialize with any navigation
*
* @param {String} bottomNav
*
* @param {String} bottomNav
*/
CHK_Footer.activeInitBottomNav = function(bottomNav) {
CHK_Footer.inactiveAllBottomNav();
CHK_Footer.activeBottomNav(bottomNav);
}
FOOTER.activeInitBottomNav = function (bottomNav) {
FOOTER.inactiveAllBottomNav();
FOOTER.activeBottomNav(bottomNav);
};
/**
* Go page of dashboard
*/
CHK_Footer.goDashboard = function() {
sessionStorage.activeTab = CHK_CONSTANT.PAGE_TAB.DASHBOARD;
CHK_Footer.activeInitBottomNav('dashboardBottomNav');
if (CHK_Footer.isIndexPage()) {
CHK_TOP.showPage(CHK_CONSTANT.PAGE_NAME.DASHBOARD);
FOOTER.goDashboard = function () {
sessionStorage.activeTab = CONSTANT.PAGE_TAB.DASHBOARD;
FOOTER.activeInitBottomNav('dashboardBottomNav');
if (FOOTER.isIndexPage()) {
TOP.showPage(CONSTANT.PAGE_NAME.DASHBOARD);
return;
}
CHK_Footer.goIndexPage(CHK_CONSTANT.PAGE_NAME.DASHBOARD);
}
FOOTER.goIndexPage(CONSTANT.PAGE_NAME.DASHBOARD);
};
/**
* Go page of operationList
*/
CHK_Footer.goOperationList = function() {
sessionStorage.activeTab = CHK_CONSTANT.PAGE_TAB.OPERATION_LIST;
CHK_Footer.activeInitBottomNav('operationListBottomNav');
if (CHK_Footer.isIndexPage()) {
CHK_TOP.showPage(CHK_CONSTANT.PAGE_NAME.OPERATION_LIST);
FOOTER.goOperationList = function () {
sessionStorage.activeTab = CONSTANT.PAGE_TAB.OPERATION_LIST;
FOOTER.activeInitBottomNav('operationListBottomNav');
if (FOOTER.isIndexPage()) {
TOP.showPage(CONSTANT.PAGE_NAME.OPERATION_LIST);
return;
}
CHK_Footer.goIndexPage(CHK_CONSTANT.PAGE_NAME.OPERATION_LIST);
}
FOOTER.goIndexPage(CONSTANT.PAGE_NAME.OPERATION_LIST);
};
/**
* Go to active tab when footer was loaded.
* If it is no active tab, go to page in settings.
*/
CHK_Footer.initFooter = function() {
$("#footer").load(CHK_CONSTANT.PAGE_NAME.FOOTER, function() {
if (typeof sessionStorage != 'undefined' && typeof sessionStorage.activeTab != 'undefined') {
if (sessionStorage.activeTab == CHK_CONSTANT.PAGE_TAB.DASHBOARD) {
CHK_Footer.goDashboard();
} else {
CHK_Footer.goOperationList();
}
return;
}
CHK_Footer.goOperationList();
// CHK.loadDashboardSetting(function() {
// if (CHK.dashboardSetting.dashboardHome) {
// CHK_Footer.goDashboard();
// } else {
// CHK_Footer.goOperationList();
// }
// });
});
}
\ No newline at end of file
FOOTER.initFooter = function () {
$('#footer').load(CONSTANT.PAGE_NAME.FOOTER, function () {
if (typeof sessionStorage != 'undefined' && typeof sessionStorage.activeTab != 'undefined') {
if (sessionStorage.activeTab == CONSTANT.PAGE_TAB.DASHBOARD) {
FOOTER.goDashboard();
} else {
FOOTER.goOperationList();
}
return;
}
FOOTER.goOperationList();
// CHK.loadDashboardSetting(function() {
// if (CHK.dashboardSetting.dashboardHome) {
// FOOTER.goDashboard();
// } else {
// FOOTER.goOperationList();
// }
// });
});
};
......@@ -14,22 +14,22 @@
<link rel="stylesheet" type="text/css" href="/abvw/common/css/appCommon/app.css">
<link rel="stylesheet" type="text/css" href="/abvw/common/css/appCommon/fontawesome_relative_path.css">
<script src="/abvw/common/js/appCommon/constant.js?__UPDATEID__"></script>
<script src="/abvw/common/js/constant.js?__UPDATEID__"></script>
<script src="/abvw/common/js/jquery/jquery-3.6.0.min.js?__UPDATEID__"></script>
<script src="/abvw/common/js/jquery/jquery-ui.min.js?__UPDATEID__"></script>
<script src="/abvw/js/operationList/operationList.js?__UPDATEID__"></script>
<script src="/abvw/js/topPage/topPage.js?__UPDATEID__"></script>
<script src="/abvw/js/dashboardSetting/check-dashboard-setting.js?__UPDATEID__"></script>
<script src="/abvw/js/dashboard/check-dashboard.js?__UPDATEID__"></script>
<script src="/abvw/common/js/appCommon/check-footer.js?__UPDATEID__"></script>
<script src="/abvw/common/js/footer.js?__UPDATEID__"></script>
<script src="/abvw/common/js/appCommon/check-common.js?__UPDATEID__"></script>
<script src="/abvw/common/js/web/common.js?__UPDATEID__"></script>
<script src="/abvw/common/js/web/avweb.js?__UPDATEID__"></script>
<script src="/abvw/common/js/appCommon/app.js?__UPDATEID__" defer></script>
<script src="/abvw/common/js/app.js?__UPDATEID__" defer></script>
</head>
<body onload="CHK_TOP.init();" style="position: relative; margin-top: 53px;">
<body onload="TOP.init();" style="position: relative; margin-top: 53px;">
<!--作業一覧画面-->
<section id="operationList" class="page-content" style="display: none;">
......@@ -38,7 +38,7 @@
<header style="position: fixed; width: 100%; top: 0px; left: 0; z-index: 999;">
<nav class="navbar navbar-dark bg-primary">
<div>
<a class="navbar-brand category-btn lht-0 d-none" onclick="CHK_OL.openCategory();" id="operationGroupMasterButton">
<a class="navbar-brand category-btn lht-0 d-none" onclick="OL.openCategory();" id="operationGroupMasterButton">
<i class="fa fa-folder fs-12 p-1" id="category-toggle-button"></i>
<span class="d-none d-md-inline fs-10 multi-lang" data-msg="buttonCategory"></span>
</a>
......@@ -53,7 +53,7 @@
<nav id="category-menu" class="drawer-menu">
<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>
<h2 class="text-nowrap -btn p-3" onclick="OL.openCategory();" href="#"><i class="fa fa-times"></i></a>
</div>
</nav>
</section>
......@@ -74,7 +74,7 @@
<div class="form-group has-search input-group">
<input type="text" class="form-control multi-lang" data-msg="placeholderOperationName" placeholder="placeholderOperationName" id="searchTaskName">
<div class="input-group-append">
<i class="fas fa-search input-group-text" onclick="CHK_OL.search();"></i>
<i class="fas fa-search input-group-text" onclick="OL.search();"></i>
</div>
</div>
</div>
......@@ -124,12 +124,12 @@
<span class="d-none d-md-inline text-dark fs-10 align-middle multi-lang" data-msg="labelSort"></span>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortName" data-sort="0" onclick="CHK_OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type active multi-lang" data-msg="labelSortNew" data-sort="1" id="defaultSort" onclick="CHK_OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortOld" data-sort="2" onclick="CHK_OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortOpen" data-sort="4" onclick="CHK_OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortName" data-sort="0" onclick="OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type active multi-lang" data-msg="labelSortNew" data-sort="1" id="defaultSort" onclick="OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortOld" data-sort="2" onclick="OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortOpen" data-sort="4" onclick="OL.changeSortType(this);"></a>
</div>
<a href="javascript:CHK_OL.resetSearch();" class="text-decoration-none py-2 lht-0 d-inline-block ml-3">
<a href="javascript:OL.resetSearch();" class="text-decoration-none py-2 lht-0 d-inline-block ml-3">
<img class="icon" src="/abvw/img/operationList/icon_clear.svg">
<span class="d-none d-md-inline text-dark fs-10 align-middle multi-lang" data-msg="labelReset" lnag="labelReset"></span>
</a>
......
......@@ -2,12 +2,12 @@
<nav class="d-flex justify-content-around">
<!--ダッシュボード-->
<a id="dashboardBottomNav" class="d-block w-100 text-center py-2 text-decoration-none text-secondary bottom-nav" href="javascript:CHK_Footer.goDashboard();">
<a id="dashboardBottomNav" class="d-block w-100 text-center py-2 text-decoration-none text-secondary bottom-nav" href="javascript:FOOTER.goDashboard();">
<img src="/abvw/img/dashboard/icon_dashboard_inactive.svg" data-inactive-src="/abvw/img/dashboard/icon_dashboard_inactive.svg" data-src="/abvw/img/dashboard/icon_dashboard.svg" alt="buttonDashboard" class="p-1">
<div class="fs-7 multi-lang" data-msg="buttonDashboard"></div>
</a>
<!--作業一覧-->
<a id="operationListBottomNav" class="d-block w-100 text-center py-2 text-decoration-none text-primary bottom-nav" href="javascript:CHK_Footer.goOperationList();">
<a id="operationListBottomNav" class="d-block w-100 text-center py-2 text-decoration-none text-primary bottom-nav" href="javascript:FOOTER.goOperationList();">
<i class="fas fa-tasks fs-14 p-1"></i>
<div class="fs-7 multi-lang" data-msg="buttonOperationList"></div>
</a>
......
var CHK_DashboardSetting = {};
CHK_DashboardSetting.displayItems = [
{ id:'newReport', name: 'chk-new', enabled: true, title:'新規報告', msg: 'dashboardSettingNewRegistrationTitle'},
{ id:'continousWork', name: 'chk-proccess', enabled: true, title:'工程作業', msg: 'dashboardSettingContinousWorkTitle'},
{ id:'reportWarning', name: 'chk-alert', enabled: true, title:'警告を含む作業', msg: 'dashboardSettingReportWarningTitle'},
{ id:'dashboardHome', name: 'chk-home', enabled: false, title:'ダッシュボードをホーム画面にする', msg: 'dashboardSettingDashboardHomeTitle'},
{ id: 'newReport', name: 'chk-new', enabled: true, title: '新規報告', msg: 'dashboardSettingNewRegistrationTitle' },
{ id: 'continousWork', name: 'chk-proccess', enabled: true, title: '工程作業', msg: 'dashboardSettingContinousWorkTitle' },
{ id: 'reportWarning', name: 'chk-alert', enabled: true, title: '警告を含む作業', msg: 'dashboardSettingReportWarningTitle' },
{ id: 'dashboardHome', name: 'chk-home', enabled: false, title: 'ダッシュボードをホーム画面にする', msg: 'dashboardSettingDashboardHomeTitle' },
];
//CHK_DashboardSetting.displayItemsに設定されている情報から✓されている項目をhtml上に設定する
CHK_DashboardSetting.loadSettings = function() {
CHK_DashboardSetting.displayItems.forEach(function(item) {
CHK_DashboardSetting.loadSettings = function () {
CHK_DashboardSetting.displayItems.forEach(function (item) {
let enabled = CHK.dashboardSetting[item.id];
if (typeof enabled !== 'undefined') {
item.enabled = enabled;
......@@ -17,50 +17,47 @@ CHK_DashboardSetting.loadSettings = function() {
itemElement.addClass('checked');
} else {
itemElement.removeClass('checked');
}
}
}
});
}
};
//CHK_DashboardSetting.displayItemsに設定を書き込む
CHK_DashboardSetting.saveSetting = function(key, enabled) {
CHK_DashboardSetting.displayItems.forEach(function(item) {
CHK_DashboardSetting.saveSetting = function (key, enabled) {
CHK_DashboardSetting.displayItems.forEach(function (item) {
if (item.id == key) {
item.enabled = enabled;
}
});
CHK.saveDashboardSetting(key, enabled);
}
};
//CHK_DashboardSetting.displayItemsからhtmlに設定画面を表示する
CHK_DashboardSetting.initDisplays = function() {
$("#displayItems tbody").empty();
CHK_DashboardSetting.displayItems.forEach(function(item) {
CHK_DashboardSetting.initDisplays = function () {
$('#displayItems tbody').empty();
CHK_DashboardSetting.displayItems.forEach(function (item) {
var html = CHK_DashboardSetting.initHtmlItem(item);
$("#displayItems tbody").append(html);
$('#displayItems tbody').append(html);
});
}
};
//設定画面に表示するhtmlを生成する
CHK_DashboardSetting.initHtmlItem = function(item) {
var titleDiv = '<div class="font-weight-normal text-dark multi-lang" data-msg="' + item.msg + '">' + item.title +'</div>';
CHK_DashboardSetting.initHtmlItem = function (item) {
var titleDiv = '<div class="font-weight-normal text-dark multi-lang" data-msg="' + item.msg + '">' + item.title + '</div>';
var toggleClass = 'toggle';
if (item.enabled) {
toggleClass += ' checked';
}
var toggleDiv = '<div id="' + item.id + '" class="' + toggleClass + '"><input type="checkbox" name="' + item.name + '" /></div>';
var html = $('<tr>'
+ '<th>' + titleDiv + '</th>'
+ '<td>' + toggleDiv + '</td>'
+ '</tr>');
var html = $('<tr>' + '<th>' + titleDiv + '</th>' + '<td>' + toggleDiv + '</td>' + '</tr>');
return html;
}
};
//設定画面でクリックされてた時の処理
//
CHK_DashboardSetting.bindToggleClick = function() {
$(".toggle").on("click", function() {
$(this).toggleClass("checked");
CHK_DashboardSetting.bindToggleClick = function () {
$('.toggle').on('click', function () {
$(this).toggleClass('checked');
var id = $(this).attr('id');
var enabled = false;
if ($(this).hasClass('checked')) {
......@@ -68,22 +65,22 @@ CHK_DashboardSetting.bindToggleClick = function() {
}
CHK_DashboardSetting.saveSetting(id, enabled);
});
}
};
//設定画面の初期処理
CHK_DashboardSetting.init = function() {
CHK_DashboardSetting.init = function () {
CHK.initCommon();
$("#footer").load("main-footer.html", function() {
CHK_Footer.activeDashboardBottomNav();
$('#footer').load('main-footer.html', function () {
FOOTER.activeDashboardBottomNav();
});
CHK.loadDashboardSetting(function() {
CHK.loadDashboardSetting(function () {
CHK_DashboardSetting.loadSettings();
CHK_DashboardSetting.initDisplays();
CHK_DashboardSetting.bindToggleClick();
});
}
};
//戻るボタン
CHK_DashboardSetting.goBack = function() {
CHK_Footer.goDashboard();
}
\ No newline at end of file
CHK_DashboardSetting.goBack = function () {
FOOTER.goDashboard();
};
......@@ -5,15 +5,15 @@
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var CHK_OL = {};
var 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.operationSearchCriteria;
OL.operationList; //Operation json data
OL.operationGroupMaster; //category(operationGroupMaster) json data
OL.isOperationGroupMaster = 0; //0: category(operationGroupMaster) not exist 1: category(operationGroupMaster) exist
OL.operationSearchCriteria;
CHK_OL.sortIndex;
CHK_OL.operationGroupMasterId;
OL.sortIndex;
OL.operationGroupMasterId;
/**
* process on page load.
......@@ -21,17 +21,17 @@ CHK_OL.operationGroupMasterId;
* 2.show operationList.
* 3.show category(operationGroupMaster).
*/
CHK_OL.init = function () {
OL.init = function () {
console.log('OperationList start');
//get all data of operation list scene
CHK_OL.getAllDataWeb();
OL.getAllDataWeb();
//show operation list
CHK_OL.createOperationList(CHK_OL.operationList);
OL.createOperationList(OL.operationList);
//show category(operationGroupMaster)
CHK_OL.createCategory();
OL.createCategory();
};
/**
......@@ -45,7 +45,7 @@ CHK_OL.init = function () {
* @param {String} searchEndDate
* @param {Number} operationGroupMasterId
*/
CHK_OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
let param = {};
param.sid = CHK_Common.getSid();
param.operationGroupMasterId = searchKeyword;
......@@ -54,14 +54,14 @@ CHK_OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, sear
param.endDate = searchEndDate;
param.operationGroupMasterId = operationGroupMasterId;
const url = CHK_CONSTANT.URL.BASE_CMS + CHK_CONSTANT.URL.ALL_OPERATION_LIST;
const url = CONSTANT.URL.BASE_CMS + CONSTANT.URL.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();
OL.operationList = json.operationList;
OL.operationGroupMaster = json.operationGroupMasterList;
OL.isOperationGroupMaster = json.isOperationGroupMaster;
OL.operationSearchCriteria = json.operationSearchCriteria;
OL.setSearchInfoWeb();
console.log('json.operationList', JSON.stringify(json.operationList));
});
};
......@@ -69,20 +69,20 @@ CHK_OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, sear
/**
* set search criteria when Initial display.
*/
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);
CHK_OL.operationGroupMasterId = CHK_OL.operationSearchCriteria.operationGroupMasterId;
OL.setSearchInfoWeb = function () {
OL.sortIndex = OL.operationSearchCriteria.sort;
$('#searchTaskName').val(OL.operationSearchCriteria.operationName);
$('#searchStartDate').val(OL.operationSearchCriteria.startDate);
$('#searchEndDate').val(OL.operationSearchCriteria.endDate);
OL.operationGroupMasterId = OL.operationSearchCriteria.operationGroupMasterId;
};
/**
* create operation list
*/
CHK_OL.createOperationList = function (operationList) {
OL.createOperationList = function (operationList) {
//Initialization
CHK_OL.initActiveSortIndex();
OL.initActiveSortIndex();
$('#operationTable').empty();
if (!operationList) {
......@@ -96,7 +96,7 @@ CHK_OL.createOperationList = function (operationList) {
const operationNameTd = $(
"<td class='operationId_" +
operationList[i].operationId +
"'><a href=\"javascript:CHK_OL.sendOperation('goOperation', '" +
"'><a href=\"javascript:OL.sendOperation('goOperation', '" +
operationList[i].operationId +
"', '" +
operationList[i].operationType +
......@@ -105,13 +105,13 @@ CHK_OL.createOperationList = function (operationList) {
"');\" 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) +
OL.setOperationDate(operationList[i].operationStartDate) +
' ~ ' +
CHK_OL.setOperationDate(operationList[i].operationEndDate) +
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));
const operationStartDateTd = $('<td/>', { class: 'operationStartDate' }).text(OL.setOperationDate(operationList[i].operationStartDate));
const operationEndDateTd = $('<td/>', { class: 'operationEndDate' }).text(OL.setOperationDate(operationList[i].operationEndDate));
operationTR.append(operationNameTd);
operationTR.append(operationStartDateTd);
......@@ -126,14 +126,14 @@ CHK_OL.createOperationList = function (operationList) {
*
* @param {Number} sortIndex
*/
CHK_OL.initActiveSortIndex = function (sortIndex) {
if (!sortIndex && !CHK_OL.sortIndex) {
CHK_OL.sortIndex = CHK_CONSTANT.SORT_TYPE.START_DATE_DESC;
OL.initActiveSortIndex = function (sortIndex) {
if (!sortIndex && !OL.sortIndex) {
OL.sortIndex = CONSTANT.SORT_TYPE.START_DATE_DESC;
}
$('.sort-type').each(function () {
const sortType = $(this).data('sort');
if (sortType == CHK_OL.sortIndex) {
if (sortType == OL.sortIndex) {
$('.sort-type').removeClass('active');
$(this).addClass('active');
}
......@@ -146,7 +146,7 @@ CHK_OL.initActiveSortIndex = function (sortIndex) {
* @param {String} date
* @returns operationDate
*/
CHK_OL.setOperationDate = function (date) {
OL.setOperationDate = function (date) {
const operationDate = date.replace(/-/g, '/').substring(0, 10);
return operationDate;
};
......@@ -154,35 +154,35 @@ CHK_OL.setOperationDate = function (date) {
/**
* create category(operationGroupMaster).
*/
CHK_OL.createCategory = function () {
if (!CHK_OL.isOperationGroupMaster) {
OL.createCategory = function () {
if (!OL.isOperationGroupMaster) {
return;
}
CHK_OL.initCategory();
CHK_OL.createBreadcrumbList();
CHK_OL.createCategoryList();
CHK_OL.acdMenu();
OL.initCategory();
OL.createBreadcrumbList();
OL.createCategoryList();
OL.acdMenu();
};
/**
* Initial processing of category(operationGroupMaster).
*/
CHK_OL.initCategory = function () {
if (!CHK_OL.isOperationGroupMaster) {
OL.initCategory = function () {
if (!OL.isOperationGroupMaster) {
return;
}
$('#operationGroupMasterButton').removeClass('d-none');
$(window).resize(function () {
CHK_OL.setCategoryHeight();
OL.setCategoryHeight();
});
};
/**
* change height category(operationGroupMaster)
*/
CHK_OL.setCategoryHeight = function () {
OL.setCategoryHeight = function () {
const CATEGORY_HEIGHT = $('footer').offset().top - $('#category-menu').offset().top;
console.log(CATEGORY_HEIGHT);
$('#category-menu').css('overflow', 'scroll');
......@@ -193,21 +193,21 @@ CHK_OL.setCategoryHeight = function () {
/**
* create Breadcrumb List
*/
CHK_OL.createBreadcrumbList = function () {
if (!CHK_OL.isOperationGroupMaster) {
OL.createBreadcrumbList = function () {
if (!OL.isOperationGroupMaster) {
return;
}
$('#groupMasterPath').empty();
if (typeof CHK_OL.operationGroupMasterId == 'undefined' || CHK_OL.operationGroupMasterId == 0) {
if (typeof OL.operationGroupMasterId == 'undefined' || OL.operationGroupMasterId == 0) {
$('#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 groupMaster = OL.operationGroupMaster.filter(it => it.operationGroupMasterId == OL.operationGroupMasterId)[0];
const groupMasterPathIdlist = groupMaster.treePath.split('/');
groupMasterPathIdlist.forEach(function (parentId) {
const pathOperationGroupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == parentId)[0];
const pathOperationGroupMaster = OL.operationGroupMaster.filter(it => it.operationGroupMasterId == parentId)[0];
$('#groupMasterPath').append(
'<li class="breadcrumb-item"><a onclick="CHK_OL.changeOperationGroupMaster(' +
'<li class="breadcrumb-item"><a onclick="OL.changeOperationGroupMaster(' +
pathOperationGroupMaster.operationGroupMasterId +
');" class="text-decoration-none text-dark">' +
pathOperationGroupMaster.operationGroupMasterName +
......@@ -220,67 +220,65 @@ CHK_OL.createBreadcrumbList = function () {
/**
* create category(operationGroupMaster) structure
*/
CHK_OL.createCategoryList = function () {
if (!CHK_OL.isOperationGroupMaster) {
OL.createCategoryList = function () {
if (!OL.isOperationGroupMaster) {
return;
}
//Create a side menu category structure
$('.group-category-list').remove();
CHK_OL.operationGroupMaster.sort(function (a, b) {
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='OL.changeOperationGroupMaster(0);'>" + CHK_Common.getMsg(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) {
for (let i = 0; i < OL.operationGroupMaster.length; i++) {
if (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 +
OL.operationGroupMaster[i].operationGroupMasterId +
" class='group-category-list' style='overflow-x:auto;'><dt class='menu-ttl'><a onclick='OL.changeOperationGroupMaster(" +
OL.operationGroupMaster[i].operationGroupMasterId +
");'>" +
CHK_OL.operationGroupMaster[i].operationGroupMasterName +
OL.operationGroupMaster[i].operationGroupMasterName +
'</a></dt></dl>',
);
$('#category-menu').append(categoryParent);
} else {
if ($('#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId + '>ul').length > 0) {
if ($('#groupMasterId_' + OL.operationGroupMaster[i].parentOperationGroupMasterId + '>ul').length > 0) {
const categoryChild = $(
"<li id='groupMasterId_" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
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 +
OL.operationGroupMaster[i].operationGroupMasterLevel +
"'><a class='category-a' onclick='OL.changeOperationGroupMaster(" +
OL.operationGroupMaster[i].operationGroupMasterId +
");'>" +
CHK_OL.operationGroupMaster[i].operationGroupMasterName +
OL.operationGroupMaster[i].operationGroupMasterName +
'</a></p></li>',
);
$('#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId + ' >ul').append(categoryChild);
$('#groupMasterId_' + OL.operationGroupMaster[i].parentOperationGroupMasterId + ' >ul').append(categoryChild);
} else {
const groupParents = '#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId;
const groupParents = '#groupMasterId_' + 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 +
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 +
OL.operationGroupMaster[i].operationGroupMasterLevel +
"'><a class='category-a' onclick='OL.changeOperationGroupMaster(" +
OL.operationGroupMaster[i].operationGroupMasterId +
");'>" +
CHK_OL.operationGroupMaster[i].operationGroupMasterName +
OL.operationGroupMaster[i].operationGroupMasterName +
'</a></p></li></ul>',
);
$('#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId).append(categoryChild);
$('#groupMasterId_' + OL.operationGroupMaster[i].parentOperationGroupMasterId).append(categoryChild);
}
}
}
......@@ -289,7 +287,7 @@ CHK_OL.createCategoryList = function () {
/**
* Open/close category(operationGroupMaster) drawer menu
*/
CHK_OL.acdMenu = function () {
OL.acdMenu = function () {
//Hide accordion contents by default
$('.drawer-menu dd').css('display', 'none');
$('.drawer-menu2 ul').css('display', 'none');
......@@ -313,12 +311,12 @@ CHK_OL.acdMenu = function () {
*
* @param {Object} sortType
*/
CHK_OL.changeSortType = function (sortType) {
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);
OL.sortIndex = $(sortType).attr('data-sort');
OL.sortOperationList(sortType);
OL.createOperationList(OL.operationList);
};
/**
......@@ -326,39 +324,39 @@ CHK_OL.changeSortType = function (sortType) {
*
* @param {Number} sortType
*/
CHK_OL.sortOperationList = function (sortType) {
OL.sortOperationList = function (sortType) {
switch (sortType) {
case CHK_CONSTANT.SORT_TYPE.NAME:
CHK_OL.operationList.sort(function (a, b) {
case CONSTANT.SORT_TYPE.NAME:
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) {
case CONSTANT.SORT_TYPE.START_DATE_DESC:
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) {
case CONSTANT.SORT_TYPE.START_DATE_ASC:
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) {
case CONSTANT.SORT_TYPE.TYPE:
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:
case CONSTANT.SORT_TYPE.LAST_EDIT_DATE:
const defaultDate = '1900-01-01 09:00:00';
CHK_OL.operationList.sort(function (a, b) {
OL.operationList.sort(function (a, b) {
if (!a.operationOpenDate) {
a.operationOpenDate = defaultDate;
}
......@@ -376,7 +374,7 @@ CHK_OL.sortOperationList = function (sortType) {
/**
* search operarionList
*/
CHK_OL.search = function () {
OL.search = function () {
CHK_Common.showLoading();
const searchKeyword = $('#searchTaskName').val();
const searchStartDate = $('#searchStartDate').val();
......@@ -388,8 +386,8 @@ CHK_OL.search = function () {
return;
}
CHK_OL.getAllDataWeb(searchKeyword, CHK_OL.sortIndex, searchStartDate, searchEndDate, CHK_OL.operationGroupMasterId);
CHK_OL.createOperationList(CHK_OL.operationList);
OL.getAllDataWeb(searchKeyword, OL.sortIndex, searchStartDate, searchEndDate, OL.operationGroupMasterId);
OL.createOperationList(OL.operationList);
CHK_Common.closeLoading();
};
......@@ -397,19 +395,19 @@ CHK_OL.search = function () {
* change the operationList by select the category(OperationGroupMaster)
* @param {Number} operationGroupMasterId
*/
CHK_OL.changeOperationGroupMaster = function (operationGroupMasterId) {
OL.changeOperationGroupMaster = function (operationGroupMasterId) {
if ($('#category-menu').hasClass('open')) {
$('#category-toggle-button').click();
$('body').css('overflow', 'visible');
}
CHK_OL.operationGroupMasterId = operationGroupMasterId;
CHK_OL.search();
OL.operationGroupMasterId = operationGroupMasterId;
OL.search();
};
/**
* open the category(OperationGroupMaster)
*/
CHK_OL.openCategory = function () {
OL.openCategory = function () {
window.scrollTo(0, 0);
if ($('#category-menu').hasClass('open')) {
$('body').css('overflow', 'visible');
......@@ -421,11 +419,11 @@ CHK_OL.openCategory = function () {
/**
* reset search
*/
CHK_OL.resetSearch = function () {
OL.resetSearch = function () {
$('#searchTaskName').val('');
$('#searchStartDate').val('');
$('#searchEndDate').val('');
CHK_OL.changeSortType($('#defaultSort'));
OL.changeSortType($('#defaultSort'));
};
/**
......@@ -433,11 +431,11 @@ CHK_OL.resetSearch = function () {
*
* @param {String} operationId
*/
CHK_OL.sendOperation = function (operationId, operationType, reportType) {
OL.sendOperation = function (operationId, operationType, reportType) {
//save operation logs. needed for sorting
let saveParams = {};
saveParams.sid = CHK_Common.getSid();
saveParams.cmd = CHK_CONSTANT.ACT_CMD.saveOperationLog;
saveParams.cmd = CONSTANT.ACT_CMD.saveOperationLog;
saveParams.deviceType = 4;
saveParams.operationType = operationType;
saveParams.reportType = reportType;
......@@ -449,7 +447,7 @@ CHK_OL.sendOperation = function (operationId, operationType, reportType) {
//Transition to the report form or operation list screen
let postParams = {};
postParams.sid = CHK_Common.getSid();
postParams.cmd = CHK_CONSTANT.ACT_CMD.goOperation;
postParams.cmd = CONSTANT.ACT_CMD.goOperation;
postParams.operationId = operationId;
const url = CHK_Common.getUrlWeb(postParams.cmd);
postCommunication(url, postParams);
......
/**
* common js of top page.
* top page is dashboard and operationList.
*
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var CHK_TOP = {};
var TOP = {};
$(document).ready(function () {
//setting lang info
CHK_Common.setLangCodeWeb();
//Check if user is logged in
CHK_Common.checkAuth(false);
......@@ -22,34 +21,32 @@ $(document).ready(function () {
/**
* show page
*/
CHK_TOP.init = function() {
TOP.init = function () {
CHK_Common.showLoading();
CHK_Footer.initFooter();//app should get data after initFooter
FOOTER.initFooter(); //app should get data after initFooter
CHK_Common.closeLoading();
};
/**
* Show page by arbitrary id
*
* @param {String} pageId
*
* @param {String} pageId
*/
CHK_TOP.showPage = function(pageId) {
TOP.showPage = function (pageId) {
//get data
if (pageId == CHK_CONSTANT.PAGE_NAME.OPERATION_LIST) {
CHK_OL.init();
} else if (pageId == CHK_CONSTANT.PAGE_NAME.DASHBOARD) {
if (pageId == CONSTANT.PAGE_NAME.OPERATION_LIST) {
OL.init();
} else if (pageId == CONSTANT.PAGE_NAME.DASHBOARD) {
CHK_Dashboard.init();
}
//show page
const pages = document.getElementsByClassName("page-content");
const pages = document.getElementsByClassName('page-content');
for (let i = 0; i < pages.length; i++) {
if (pages[i].id == pageId) {
pages[i].style.display = "block";
pages[i].style.display = 'block';
} else {
pages[i].style.display = "none";
pages[i].style.display = 'none';
}
}
}
\ 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