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
5e8b2296
Commit
5e8b2296
authored
Oct 20, 2022
by
NGUYEN HOANG SON
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement dashboard setting js
parent
9a266c6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
48 deletions
+19
-48
abvw/html/dashboard.html
+2
-2
abvw/js/dashboardSetting/dashboard-setting.js
+17
-46
No files found.
abvw/html/dashboard.html
View file @
5e8b2296
...
...
@@ -26,7 +26,7 @@
<script
type=
"text/javascript"
src=
"../js/dashboard/dashboard.js"
></script>
</head>
<body>
<body
onload=
"DASHBOARD.init();"
>
<!-- header -->
<?php include('common/header.html');?>
...
...
@@ -152,7 +152,7 @@
</table>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-primary multi-lang"
data-msg=
"dashboardSettingSaveButton"
onclick=
"DashboardSetting.
s
ave();"
>
保存
</button>
<button
type=
"button"
class=
"btn btn-primary multi-lang"
data-msg=
"dashboardSettingSaveButton"
onclick=
"DashboardSetting.
onClickS
ave();"
>
保存
</button>
<button
type=
"button"
class=
"btn btn-tertiary multi-lang"
data-msg=
"dashboardSettingCancelButton"
data-dismiss=
"modal"
>
キャンセル
</button>
</div>
</div>
...
...
abvw/js/dashboardSetting/dashboard-setting.js
View file @
5e8b2296
var
DashboardSetting
=
{};
DashboardSetting
.
display
Items
=
[
{
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
:
'
dashboardHome'
,
enabled
:
false
,
title
:
'ダッシュボードをホーム画面にする'
,
msg
:
'dashboardSettingDashboardHomeTitle'
},
DashboardSetting
.
element
Items
=
[
{
id
:
'newReport'
,
name
:
'
chk-new'
,
enabled
:
true
},
{
id
:
'continousWork'
,
name
:
'c
hk-proccess'
,
enabled
:
true
},
{
id
:
'reportWarning'
,
name
:
'
chk-alert'
,
enabled
:
true
},
{
id
:
'dashboardHome'
,
name
:
'
chk-home'
,
enabled
:
false
},
];
DashboardSetting
.
baseApiUrl
=
CONSTANT
.
URL
.
CMS
.
BASE
+
ClientData
.
userInfo_accountPath
()
+
CONSTANT
.
URL
.
CMS
.
API
.
BASE
+
'dashboardSetting/'
;
...
...
@@ -30,9 +30,8 @@ DashboardSetting.getSettingData = function (callback) {
});
};
//CHK_DashboardSetting.displayItemsに設定されている情報から✓されている項目をhtml上に設定する
DashboardSetting
.
loadSettings
=
function
(
settings
)
{
DashboardSetting
.
displayItems
.
forEach
(
function
(
item
)
{
DashboardSetting
.
applySettings
=
function
(
settings
)
{
DashboardSetting
.
elementItems
.
forEach
(
function
(
item
)
{
let
enabled
=
settings
[
item
.
id
];
if
(
typeof
enabled
!==
'undefined'
)
{
item
.
enabled
=
enabled
;
...
...
@@ -48,7 +47,7 @@ DashboardSetting.loadSettings = function (settings) {
//CHK_DashboardSetting.displayItemsに設定を書き込む
DashboardSetting
.
saveSetting
=
function
(
key
,
enabled
)
{
DashboardSetting
.
display
Items
.
forEach
(
function
(
item
)
{
DashboardSetting
.
element
Items
.
forEach
(
function
(
item
)
{
if
(
item
.
id
==
key
)
{
item
.
enabled
=
enabled
;
}
...
...
@@ -61,56 +60,28 @@ DashboardSetting.saveSetting = function (key, enabled) {
});
};
//CHK_DashboardSetting.displayItemsからhtmlに設定画面を表示する
DashboardSetting
.
initDisplays
=
function
()
{
$
(
'#displayItems tbody'
).
empty
();
DashboardSetting
.
displayItems
.
forEach
(
function
(
item
)
{
var
html
=
DashboardSetting
.
initHtmlItem
(
item
);
$
(
'#displayItems tbody'
).
append
(
html
);
});
};
//設定画面に表示するhtmlを生成する
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
;
};
//設定画面でクリックされてた時の処理
//
DashboardSetting
.
bindToggleClick
=
function
()
{
$
(
'.toggle'
).
on
(
'click'
,
function
()
{
$
(
this
).
toggleClass
(
'checked'
);
var
id
=
$
(
this
).
attr
(
'id'
);
var
enabled
=
false
;
if
(
$
(
this
).
hasClass
(
'checked'
))
{
enabled
=
true
;
}
DashboardSetting
.
saveSetting
(
id
,
enabled
);
//
var id = $(this).attr('id');
//
var enabled = false;
//
if ($(this).hasClass('checked')) {
//
enabled = true;
//
}
//
DashboardSetting.saveSetting(id, enabled);
});
};
//設定画面の初期処理
DashboardSetting
.
init
=
function
()
{
FOOTER
.
initFooter
();
DashboardSetting
.
getSettingData
(
function
(
settings
)
{
DashboardSetting
.
loadSettings
(
settings
);
DashboardSetting
.
initDisplays
();
DashboardSetting
.
bindToggleClick
();
DashboardSetting
.
applySettings
(
settings
);
});
DashboardSetting
.
bindToggleClick
();
};
//戻るボタン
DashboardSetting
.
goBack
=
function
()
{
FOOTER
.
goDashboard
();
};
DashboardSetting
.
save
=
function
()
{
DashboardSetting
.
onClickSave
=
function
()
{
console
.
log
(
"DashboardSetting.save"
);
};
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