Commit 18e25433 by NGUYEN HOANG SON

Merge branch 'feature/1.0_check_web_dev_50266' into feature/1.0_check_web_dev_50265

parents b463916f 8112496c
<!DOCTYPE html>
<html lang="ja-JP">
<head>
<meta charset="utf-8">
<title>ダッシュボード設定</title>
<meta name="robots" content="index, follow">
<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/appCommon/app.css">
<link rel="stylesheet" type="text/css" href="/abvw/common/css/appCommon/fontawesome_relative_path.css">
<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">
<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/common/js/constant.js?__UPDATEID__"></script>
<script src="/abvw/common/js/common.js?__UPDATEID__"></script>
<script src="/abvw/common/js/footer.js"></script>
<script src="/abvw/js/dashboardSetting/dashboard-setting.js"></script>
</head>
<body id="dashboard" onload="DashboardSetting.init();">
<header>
<nav class="navbar navbar-dark bg-primary position-fixed fixed-top w-100">
<a href="javascript:DashboardSetting.goBack();" class="navbar-brand category-btn lht-0">
<i class="fas fa-chevron-left fs-12 p-1"></i>
<span class="d-none d-md-inline fs-10">
戻る
</span>
</a>
<h1 class="fs-10 font-weight-bold mb-0 text-white multi-lang" data-msg="dashboardSettingHeaderTitle">ダッシュボード設定</h1>
<div></div>
</nav>
</header>
<!-- setting -->
<section class="container-fluid main-section">
<main>
<h2 class="fs-8 font-weight-bold mt-4 pb-2 border-bottom text-dark multi-lang" data-msg="dashboardSettingDisplayHeader">表示切替</h2>
<div class="setting-table-wrap">
<table id="displayItems">
<tbody>
<!-- <tr>
<th><div class="font-weight-normal text-dark multi-lang" data-msg="dashboardSettingNewRegistrationTitle">新規報告</div></th>
<td>
<div class="toggle"><input type="checkbox" name="chk-new" /></div>
</td>
</tr> -->
</tbody>
</table>
</div>
</main>
</section>
<div id="footer"></div>
</body>
</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' },
var DashboardSetting = {};
DashboardSetting.displayItems = [
{ id: 'newReport', name: 'newReport', enabled: true, title: '新規報告', msg: 'dashboardSettingNewRegistrationTitle' },
{ id: 'continousWork', name: 'continousWork', enabled: true, title: '工程作業', msg: 'dashboardSettingContinousWorkTitle' },
{ id: 'reportWarning', name: 'reportWarning', enabled: true, title: '警告を含む作業', msg: 'dashboardSettingReportWarningTitle' },
{ id: 'dashboardHome', name: 'dashboardHome', enabled: false, title: 'ダッシュボードをホーム画面にする', msg: 'dashboardSettingDashboardHomeTitle' },
];
DashboardSetting.baseApiUrl = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.API.BASE + 'dashboardSetting/';
DashboardSetting.saveSettingApiUrl = DashboardSetting.baseApiUrl + 'saveSetting';
DashboardSetting.getSettingApiUrl = DashboardSetting.baseApiUrl + 'getAllSettingData';
DashboardSetting.dummySettingJson = {
newReport: 1,
continousWork: 1,
reportWarning: 1,
dashboardHome: 0,
}
DashboardSetting.getSettingData = function (callback) {
let param = {
sid: COMMON.getSid(),
};
COMMON.cmsAjax(DashboardSetting.getSettingApiUrl, param, false, function (json) {
if (callback) {
callback(json);
}
}, function() {
console.log('DashboardSetting.getSettingData error');
});
};
//CHK_DashboardSetting.displayItemsに設定されている情報から✓されている項目をhtml上に設定する
CHK_DashboardSetting.loadSettings = function () {
CHK_DashboardSetting.displayItems.forEach(function (item) {
let enabled = CHK.dashboardSetting[item.id];
DashboardSetting.loadSettings = function (settings) {
DashboardSetting.displayItems.forEach(function (item) {
let enabled = settings[item.id];
if (typeof enabled !== 'undefined') {
item.enabled = enabled;
let itemElement = $('#' + item.id);
......@@ -23,26 +47,31 @@ CHK_DashboardSetting.loadSettings = function () {
};
//CHK_DashboardSetting.displayItemsに設定を書き込む
CHK_DashboardSetting.saveSetting = function (key, enabled) {
CHK_DashboardSetting.displayItems.forEach(function (item) {
DashboardSetting.saveSetting = function (key, enabled) {
DashboardSetting.displayItems.forEach(function (item) {
if (item.id == key) {
item.enabled = enabled;
}
});
CHK.saveDashboardSetting(key, enabled);
let param = {};
param.sid = COMMON.getSid();
param[key] = enabled;
COMMON.cmsAjax(DashboardSetting.saveSettingApiUrl, param, false, function (json) {
});
};
//CHK_DashboardSetting.displayItemsからhtmlに設定画面を表示する
CHK_DashboardSetting.initDisplays = function () {
DashboardSetting.initDisplays = function () {
$('#displayItems tbody').empty();
CHK_DashboardSetting.displayItems.forEach(function (item) {
var html = CHK_DashboardSetting.initHtmlItem(item);
DashboardSetting.displayItems.forEach(function (item) {
var html = DashboardSetting.initHtmlItem(item);
$('#displayItems tbody').append(html);
});
};
//設定画面に表示するhtmlを生成する
CHK_DashboardSetting.initHtmlItem = function (item) {
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) {
......@@ -55,7 +84,7 @@ CHK_DashboardSetting.initHtmlItem = function (item) {
//設定画面でクリックされてた時の処理
//
CHK_DashboardSetting.bindToggleClick = function () {
DashboardSetting.bindToggleClick = function () {
$('.toggle').on('click', function () {
$(this).toggleClass('checked');
var id = $(this).attr('id');
......@@ -63,24 +92,21 @@ CHK_DashboardSetting.bindToggleClick = function () {
if ($(this).hasClass('checked')) {
enabled = true;
}
CHK_DashboardSetting.saveSetting(id, enabled);
DashboardSetting.saveSetting(id, enabled);
});
};
//設定画面の初期処理
CHK_DashboardSetting.init = function () {
CHK.initCommon();
$('#footer').load('main-footer.html', function () {
FOOTER.activeDashboardBottomNav();
});
CHK.loadDashboardSetting(function () {
CHK_DashboardSetting.loadSettings();
CHK_DashboardSetting.initDisplays();
CHK_DashboardSetting.bindToggleClick();
DashboardSetting.init = function () {
FOOTER.initFooter();
DashboardSetting.getSettingData(function (settings) {
DashboardSetting.loadSettings(settings);
DashboardSetting.initDisplays();
DashboardSetting.bindToggleClick();
});
};
//戻るボタン
CHK_DashboardSetting.goBack = function () {
DashboardSetting.goBack = function () {
FOOTER.goDashboard();
};
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