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
52572808
Commit
52572808
authored
Oct 21, 2022
by
NGUYEN HOANG SON
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement apply dashboard settings json
parent
5e8b2296
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
34 deletions
+37
-34
abvw/html/dashboard.html
+4
-4
abvw/js/dashboardSetting/dashboard-setting.js
+33
-30
No files found.
abvw/html/dashboard.html
View file @
52572808
...
...
@@ -134,19 +134,19 @@
<tbody>
<tr>
<th
class=
"fs-9 p-2 text-secondary multi-lang"
data-msg=
"dashboardSettingNewReportTitle"
>
新規報告
</th>
<td
class=
"p-2"
><div
id=
"newReport"
class=
"toggle ml-auto"
><input
type=
"checkbox"
name=
"chk-new"
></div></td>
<td
class=
"p-2"
><div
id=
"
settingNewReport"
data-key=
"
newReport"
class=
"toggle ml-auto"
><input
type=
"checkbox"
name=
"chk-new"
></div></td>
</tr>
<tr>
<th
class=
"fs-9 p-2 text-secondary multi-lang"
data-msg=
"dashboardSettingContinousWorkTitle"
>
工程作業
</th>
<td
class=
"p-2"
><div
id=
"continousWork"
class=
"toggle ml-auto"
><input
type=
"checkbox"
name=
"chk-proccess"
></div></td>
<td
class=
"p-2"
><div
id=
"
settingContinousWork"
data-key=
"
continousWork"
class=
"toggle ml-auto"
><input
type=
"checkbox"
name=
"chk-proccess"
></div></td>
</tr>
<tr>
<th
class=
"fs-9 p-2 text-secondary multi-lang"
data-msg=
"dashboardSettingReportWarningTitle"
>
警告を含む作業
</th>
<td
class=
"p-2"
><div
id=
"reportWarning"
class=
"toggle ml-auto"
><input
type=
"checkbox"
name=
"chk-alert"
></div></td>
<td
class=
"p-2"
><div
id=
"
settingReportWarning"
data-key=
"
reportWarning"
class=
"toggle ml-auto"
><input
type=
"checkbox"
name=
"chk-alert"
></div></td>
</tr>
<tr>
<th
class=
"fs-9 p-2 text-secondary multi-lang"
data-msg=
"dashboardSettingDashboardHomeTitle"
>
ダッシュボードをホーム画面にする
</th>
<td
class=
"p-2"
><div
id=
"dashboardHome"
class=
"toggle ml-auto"
><input
type=
"checkbox"
name=
"chk-home"
></div></td>
<td
class=
"p-2"
><div
id=
"
settingDashboardHome"
data-key=
"
dashboardHome"
class=
"toggle ml-auto"
><input
type=
"checkbox"
name=
"chk-home"
></div></td>
</tr>
</tbody>
</table>
...
...
abvw/js/dashboardSetting/dashboard-setting.js
View file @
52572808
var
DashboardSetting
=
{};
DashboardSetting
.
elementItems
=
[
{
id
:
'n
ewReport'
,
name
:
'chk-new'
,
enabled
:
true
},
{
id
:
'c
ontinousWork'
,
name
:
'chk-proccess'
,
enabled
:
true
},
{
id
:
'r
eportWarning'
,
name
:
'chk-alert'
,
enabled
:
true
},
{
id
:
'd
ashboardHome'
,
name
:
'chk-home'
,
enabled
:
false
},
]
;
DashboardSetting
.
elementItems
=
{
newReport
:
{
id
:
'settingN
ewReport'
,
name
:
'chk-new'
,
enabled
:
true
},
continousWork
:
{
id
:
'settingC
ontinousWork'
,
name
:
'chk-proccess'
,
enabled
:
true
},
reportWarning
:
{
id
:
'settingR
eportWarning'
,
name
:
'chk-alert'
,
enabled
:
true
},
dashboardHome
:
{
id
:
'settingD
ashboardHome'
,
name
:
'chk-home'
,
enabled
:
false
},
}
;
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
.
d
ummy
SettingJson
=
{
DashboardSetting
.
d
efault
SettingJson
=
{
newReport
:
1
,
continousWork
:
1
,
reportWarning
:
1
,
...
...
@@ -27,31 +27,35 @@ DashboardSetting.getSettingData = function (callback) {
}
},
function
()
{
console
.
log
(
'DashboardSetting.getSettingData error'
);
if
(
callback
)
{
callback
(
DashboardSetting
.
defaultSettingJson
);
}
});
};
DashboardSetting
.
applySettings
=
function
(
settings
)
{
DashboardSetting
.
elementItems
.
forEach
(
function
(
item
)
{
let
enabled
=
settings
[
item
.
id
];
if
(
typeof
enabled
!==
'undefined'
)
{
item
.
enabled
=
enabled
;
let
itemElement
=
$
(
'#'
+
item
.
id
);
if
(
item
.
enabled
)
{
itemElement
.
addClass
(
'checked'
);
}
else
{
itemElement
.
removeClass
(
'checked'
);
for
(
const
key
in
settings
)
{
const
enabled
=
settings
[
key
];
if
(
DashboardSetting
.
elementItems
.
hasOwnProperty
(
key
))
{
const
elementItem
=
DashboardSetting
.
elementItems
[
key
];
elementItem
.
enabled
=
enabled
;
let
element
=
$
(
'#'
+
elementItem
.
id
);
if
(
element
)
{
if
(
enabled
)
{
element
.
addClass
(
'checked'
);
}
else
{
element
.
removeClass
(
'checked'
);
}
}
}
}
);
}
};
//CHK_DashboardSetting.displayItemsに設定を書き込む
DashboardSetting
.
saveSetting
=
function
(
key
,
enabled
)
{
DashboardSetting
.
elementItems
.
forEach
(
function
(
item
)
{
if
(
item
.
id
==
key
)
{
item
.
enabled
=
enabled
;
}
});
if
(
DashboardSetting
.
elementItems
.
hasOwnProperty
(
key
))
{
const
elementItem
=
DashboardSetting
.
elementItems
[
key
];
elementItem
.
enabled
=
enabled
;
}
let
param
=
{};
param
.
sid
=
COMMON
.
getSid
();
param
[
key
]
=
enabled
;
...
...
@@ -61,16 +65,15 @@ DashboardSetting.saveSetting = function (key, enabled) {
};
//設定画面でクリックされてた時の処理
//
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);
const
key
=
$
(
this
).
attr
(
'data-key
'
);
var
enabled
=
false
;
if
(
$
(
this
).
hasClass
(
'checked'
))
{
enabled
=
true
;
}
DashboardSetting
.
saveSetting
(
key
,
enabled
);
});
};
...
...
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