Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_web
check
Commits
8112496c
Commit
8112496c
authored
Oct 18, 2022
by
NGUYEN HOANG SON
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#50278 implement dashboard setting js
parent
18699cb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
31 deletions
+57
-31
abvw/html/dashboard-setting.html
+3
-3
abvw/js/dashboardSetting/dashboard-setting.js
+54
-28
No files found.
abvw/html/dashboard-setting.html
View file @
8112496c
...
...
@@ -18,13 +18,13 @@
<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/
check-
dashboard-setting.js"
></script>
<script
src=
"/abvw/js/dashboardSetting/dashboard-setting.js"
></script>
</head>
<body
id=
"dashboard"
onload=
"
CHK_
DashboardSetting.init();"
>
<body
id=
"dashboard"
onload=
"DashboardSetting.init();"
>
<header>
<nav
class=
"navbar navbar-dark bg-primary position-fixed fixed-top w-100"
>
<a
href=
"javascript:
CHK_
DashboardSetting.goBack();"
class=
"navbar-brand category-btn lht-0"
>
<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"
>
戻る
...
...
abvw/js/dashboardSetting/
check-
dashboard-setting.js
→
abvw/js/dashboardSetting/dashboard-setting.js
View file @
8112496c
var
CHK_
DashboardSetting
=
{};
CHK_
DashboardSetting
.
displayItems
=
[
{
id
:
'newReport'
,
name
:
'
chk-new
'
,
enabled
:
true
,
title
:
'新規報告'
,
msg
:
'dashboardSettingNewRegistrationTitle'
},
{
id
:
'continousWork'
,
name
:
'c
hk-proccess
'
,
enabled
:
true
,
title
:
'工程作業'
,
msg
:
'dashboardSettingContinousWorkTitle'
},
{
id
:
'reportWarning'
,
name
:
'
chk-alert
'
,
enabled
:
true
,
title
:
'警告を含む作業'
,
msg
:
'dashboardSettingReportWarningTitle'
},
{
id
:
'dashboardHome'
,
name
:
'
chk-h
ome'
,
enabled
:
false
,
title
:
'ダッシュボードをホーム画面にする'
,
msg
:
'dashboardSettingDashboardHomeTitle'
},
var
DashboardSetting
=
{};
DashboardSetting
.
displayItems
=
[
{
id
:
'newReport'
,
name
:
'
newReport
'
,
enabled
:
true
,
title
:
'新規報告'
,
msg
:
'dashboardSettingNewRegistrationTitle'
},
{
id
:
'continousWork'
,
name
:
'c
ontinousWork
'
,
enabled
:
true
,
title
:
'工程作業'
,
msg
:
'dashboardSettingContinousWorkTitle'
},
{
id
:
'reportWarning'
,
name
:
'
reportWarning
'
,
enabled
:
true
,
title
:
'警告を含む作業'
,
msg
:
'dashboardSettingReportWarningTitle'
},
{
id
:
'dashboardHome'
,
name
:
'
dashboardH
ome'
,
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
();
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment