Commit 49973db6 by Takumi Imai

#50096 コード整理

parent b06de933
......@@ -8,7 +8,7 @@
"name": "ABookCheck WEB",
"type": "chrome",
"request": "launch",
"url":"http://127.0.0.1:5500/index.html",
"url":"http://127.0.0.1:5500/abvw/html/index.html",
"webRoot": "${workspaceFolder}"
}
]
......
......@@ -2,7 +2,7 @@
* Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
.fa,.fab,.fad,.fal,.far,.fas {
.fa,.fab,.fad,.fal,.far,.fas {
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: inline-block;
......@@ -6548,7 +6548,7 @@ hr {
}
.blockquote-footer:before {
content: "— "
content: "— "
}
.img-fluid,.img-thumbnail {
......@@ -20371,4 +20371,4 @@ button {
left: 50%;
transform: translateY(-50%) translateX(-50%);
margin: auto;
}
}
\ No newline at end of file
......@@ -8,9 +8,8 @@
* 5.cms communication
* 6.check if user is logged in
*
* @since 1.4.3.2 & 1.4.3.3
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var CHK_Common = {};
CHK_Common.lang;
......@@ -39,8 +38,9 @@ CHK_Common.setLangCodeWeb = function() {
* @returns String pageLang
*/
CHK_Common.getLangWeb = function() {
let pageLang;
if (!CHK_Common.lang) {
if (!CHK_Common.lang) {
let pageLang;
if (localStorage[CHK_CONSTANT.LANG.SAVE_NAME]) {
pageLang = localStorage[CHK_CONSTANT.LANG.SAVE_NAME];
}
......@@ -51,6 +51,10 @@ CHK_Common.getLangWeb = function() {
window.navigator.browserLanguage;
localStorage[CHK_CONSTANT.LANG.SAVE_NAME] = pageLang;
}
return pageLang;
} else {
return CHK_Common.lang;
}
return pageLang;
......@@ -203,11 +207,13 @@ CHK_Common.getUrlWeb = function(method) {
*/
CHK_Common.goUrlWithCurrentParams = function(url, params) {
const webUrl = 'abvw/html/';
if (!params) {
location.href = url;
location.href = webUrl + 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);
......@@ -264,7 +270,7 @@ CHK_Common.cmsAjax = function(url, param, async = true, callback, errorCallback)
if (result.status == "200") {
if(callback) callback(result);
} else if (result.status == "401") {
location.href = "/login.html";
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
} else if(errorCallback) {
errorCallback();
} else {
......
/**
* Common js for footer.
* ※Code is written mainly for dashboard and operationList.
* @since 1.4.3.2 & 1.4.3.3
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var CHK_Footer = {};
......
/**
* 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 = {};
......
......@@ -8,21 +8,21 @@
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<meta name="description" content="A Book Check">
<link rel="stylesheet" type="text/css" href="abvw/common/css/header.css">
<link rel="stylesheet" type="text/css" href="abvw/common/css/footer.css">
<link rel="stylesheet" type="text/css" href="abvw/common/css/style.css">
<link rel="stylesheet" type="text/css" href="abvw/common/css/app.css">
<link rel="stylesheet" type="text/css" href="abvw/css/common/fontawesome_relative_path.css">
<script src="abvw/common/js/check/constant.js?__UPDATEID__"></script>
<script src="abvw/common/js/jquery-3.6.0.min.js?__UPDATEID__"></script>
<script src="abvw/common/js/jquery-ui.min.js?__UPDATEID__"></script>
<script src="abvw/js/operationList/operationList.js?__UPDATEID__"></script>
<script src="abvw/js/topPage/checkTop.js?__UPDATEID__"></script>
<script src="abvw/js/dashboard/check-dashboard-setting.js"></script>
<script src="abvw/js/dashboard/check-dashboard.js"></script>
<script src="abvw/common/js/check/check-footer.js"></script>
<script src="abvw/common/js/check/check-common.js"></script>
<link rel="stylesheet" type="text/css" href="/abvw/common/css/appCommon/header.css">
<link rel="stylesheet" type="text/css" href="/abvw/common/css/appCommon/footer.css">
<link rel="stylesheet" type="text/css" href="/abvw/common/css/appCommon/style.css">
<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/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/appCommon/check-common.js?__UPDATEID__"></script>
</head>
......@@ -79,7 +79,7 @@
<!--カレンダー-->
<div class="col-1 col-md-2 duration-area">
<a href="#" class="d-inline-block text-decoration-none py-2 lht-0" data-toggle="modal" data-target="#exampleModal">
<img class="icon" src="abvw/img/operationList/icon_calendar.svg">
<img class="icon" src="/abvw/img/operationList/icon_calendar.svg">
<span class="d-none d-md-inline text-black fs-10 align-middle multi-lang" data-msg="labelPeriod"></span>
</a>
<div class="modal modal-duration fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
......@@ -117,7 +117,7 @@
<!--ソート-->
<div class="col-4 col-md-5 col-lg-6 text-right">
<a href="#" class="text-decoration-none py-2 lht-0" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-offset="-120, 0">
<img class="icon" src="abvw/img/operationList/icon_swap.svg">
<img class="icon" src="/abvw/img/operationList/icon_swap.svg">
<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">
......@@ -127,7 +127,7 @@
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortOpen" data-sort="4" onclick="CHK_OL.changeSortType(this);"></a>
</div>
<a href="javascript:CHK_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">
<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>
</div>
......@@ -159,7 +159,7 @@
<h1 class="fs-10 font-weight-bold mb-0 text-white multi-lang alignCenter_header" data-msg="dashboardHeaderTitle"></h1>
<div class="d-flex align-items-center">
<a href="javascript:CHK.goUrlWithCurrentParams('dashboard-setting.html');" class="nav-link text-white lht-0 p-1 mr-2">
<img class="icon" src="abvw/img/dashboard/icon_dashboard_setting.svg" alt="">
<img class="icon" src="/abvw/img/dashboard/icon_dashboard_setting.svg" alt="">
<span class="d-none d-md-inline fs-10 align-middle multi-lang" data-msg="buttonDashboardSetting"></span>
</a>
</div>
......@@ -197,6 +197,6 @@
<div id="checkLoadingImage"><img src='${check}images/transferLoading.gif' /></div>
</div>
<script type="text/javascript" src="abvw/common/js/check/app.js" defer></script>
<script type="text/javascript" src="/abvw/common/js/appCommon/app.js?__UPDATEID__" defer></script>
</body>
</html>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<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();">
<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">
<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>
<!--作業一覧-->
......
var CHK_Dashboard = {};
CHK_Dashboard.pickupItems = [
{id: 'newReport', href: "javascript:CHK_Dashboard.goPickup('newReport');", count: 0, enabled: true, img: {src: 'img/icon_new.svg'}, msg: 'newRegistrationTitle'},
{id: 'continousWork', href: "javascript:CHK_Dashboard.goPickup('continousWork');", count: 0, enabled: true, img: {src: 'img/icon_proccess.svg'}, msg: 'continousWorkTitle'},
{id: 'reportWarning', href: "javascript:CHK_Dashboard.goPickup('reportWarning');", count: 0, enabled: true, img: {src: 'img/icon_alert.svg'}, msg: 'reportWarningTitle'},
];
CHK_Dashboard.communicationItems = [
{id: 'messageList', href: "javascript:CHK_Dashboard.goMessageList();", count: 0, enabled: true, img: {src: 'img/icon_message_lsit.svg'}, msg: 'messageListTitle'},
{id: 'sendMessage', href: "javascript:CHK.sendAppCommand('goSendMessage');", count: 0, enabled: true, img: {src: 'img/icon_send_message.svg'}, msg: 'sendMessageTitle'},
{id: 'distanceSupport', href: "javascript:CHK.sendAppCommand('goDistanceSupport');", count: 0, enabled: true, img: {src: 'img/icon_remote.svg'}, msg: 'distanceSupportTitle'},
{id: 'chat', href: "javascript:CHK.sendAppCommand('goChat');", count: 0, enabled: false, img: {src: 'img/icon_chat.svg'}, msg: 'chatTitle'},
];
//CHK_Dashboard.pickupItemsに設定した情報をhtmlに表示する
CHK_Dashboard.initPickups = function() {
$("#pickupItems").empty();
CHK_Dashboard.pickupItems.forEach(function(item) {
if (item.enabled == true) {
var html = CHK_Dashboard.initHtmlItem(item);
$("#pickupItems").append(html);
}
});
//pickup empty
if ($("#pickupItems").children().length > 0) {
$("#pickupHeader").removeClass('d-none');
} else {
$("#pickupHeader").addClass('d-none');
}
}
//CHK_Dashboard.communicationItemsに設定した情報をhtmlに表示する
CHK_Dashboard.initCommunications = function() {
$("#communicationItems").empty();
CHK_Dashboard.communicationItems.forEach(function(item) {
if (item.enabled == true) {
var html = CHK_Dashboard.initHtmlItem(item);
$("#communicationItems").append(html);
}
});
}
//設定されている情報からhtmlを表示する
CHK_Dashboard.initHtmlItem = function(item) {
var countText = '' + item.count;
if (item.count >= 100) {
countText = '99+';
}
var countDClass = '';
if (typeof item.count == 'undefined' || item.count < 1) {
countDClass = ' d-none';
}
var countSpan = '<span class="count fs-7' + countDClass + '">' + countText + '</span>';
var html = $('<div class="item" id="' + item.id + '">'
+ '<a href="' + item.href + '" class="d-block text-dark text-decoration-none mb-1 p-3">'
+ '<img src="' + item.img.src + '">'
+ '<div class="fs-8 multi-lang" data-msg="' + item.msg + '">' + getMsg(item.msg) + '</div>'
+ countSpan
+ '</a>'
+ '</div>');
return html;
}
//ダッシュボード画面の初期表示
CHK_Dashboard.init = function() {
CHK_Dashboard.updateDataPickups();
CHK_Dashboard.initPickups();
CHK_Dashboard.updateDataCommunications();
CHK_Dashboard.initCommunications();
}
//変数として設定しているガジェットに初期表示で取得したデータを設定
CHK_Dashboard.updateDataPickups = function() {
CHK_Dashboard.pickupItems.forEach(function(item) {
let enabled = CHK.dashboardSetting[item.id];
if (enabled == true || enabled == false) {
item.enabled = enabled;
}
item.count = 0;
if (CHK.dashboardBatch[item.id]) {
item.count = CHK.dashboardBatch[item.id];
}
});
}
//変数として設定しているコミュニケーションに初期表示で取得したデータを設定
CHK_Dashboard.updateDataCommunications = function() {
CHK_Dashboard.communicationItems.forEach(function(item) {
if (item.id == 'messageList') {
item.count = 0;
if (typeof CHK.pushMessageList !== 'undefined') {
//読んでいないメッセージがあればカウントを +1
CHK.pushMessageList.forEach(function(message) {
if (!message.readingFlg) {
item.count += 1;
}
});
}
} else if (item.id == 'chat') {
item.enabled = CHK.isChat;
}
});
}
//ガジェット画面に移動
CHK_Dashboard.goPickup = function(pickupId) {
CHK.goUrlWithCurrentParams('pickup.html', {pickupActive: pickupId});
}
//コミュニケーション画面に移動
CHK_Dashboard.goMessageList = function() {
CHK.goUrlWithCurrentParams('message-list.html', {});
}
\ No newline at end of file
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'},
];
//CHK_DashboardSetting.displayItemsに設定されている情報から✓されている項目をhtml上に設定する
CHK_DashboardSetting.loadSettings = function() {
CHK_DashboardSetting.displayItems.forEach(function(item) {
let enabled = CHK.dashboardSetting[item.id];
if (typeof enabled !== 'undefined') {
item.enabled = enabled;
let itemElement = $('#' + item.id);
if (item.enabled) {
itemElement.addClass('checked');
} else {
itemElement.removeClass('checked');
}
}
});
}
//CHK_DashboardSetting.displayItemsに設定を書き込む
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) {
var html = CHK_DashboardSetting.initHtmlItem(item);
$("#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>';
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>');
return html;
}
//設定画面でクリックされてた時の処理
//
CHK_DashboardSetting.bindToggleClick = function() {
$(".toggle").on("click", function() {
$(this).toggleClass("checked");
var id = $(this).attr('id');
var enabled = false;
if ($(this).hasClass('checked')) {
enabled = true;
}
CHK_DashboardSetting.saveSetting(id, enabled);
});
}
//設定画面の初期処理
CHK_DashboardSetting.init = function() {
CHK.initCommon();
$("#footer").load("main-footer.html", function() {
CHK_Footer.activeDashboardBottomNav();
});
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
/**
* It is one of the js in index.html.
* index.html is made of operations List , dashboard and topPage.
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var CHK_OL = {};
CHK_OL.operationList; //Operation json data
......
......@@ -2,7 +2,7 @@
* common js of top page.
* top page is dashboard and operationList.
*
* @since 1.4.3.2 & 1.4.3.3
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var CHK_TOP = {};
......@@ -14,6 +14,9 @@ $(document).ready(function () {
//Check if user is logged in
CHK_Common.checkAuth(false);
//setting msg of html
CHK_Common.updateLang();
});
/**
......@@ -22,13 +25,7 @@ $(document).ready(function () {
CHK_TOP.init = function() {
CHK_Common.showLoading();
//setting msg of html
CHK_Common.updateLang();
//show page
CHK_Footer.initFooter();//app should get data after initFooter
CHK_Common.closeLoading();
};
......
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