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
546683ce
Commit
546683ce
authored
Oct 25, 2022
by
NGUYEN HOANG SON
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add jsdoc
parent
eb57ef10
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
abvw/js/dashboardSetting/dashboard-setting.js
+29
-2
No files found.
abvw/js/dashboardSetting/dashboard-setting.js
View file @
546683ce
...
@@ -5,7 +5,9 @@
...
@@ -5,7 +5,9 @@
*/
*/
var
DashboardSetting
=
{};
var
DashboardSetting
=
{};
//setting html elements, map with json key from setting data API
/**
* Html element array, map with json key from setting data API
*/
DashboardSetting
.
elementItems
=
{
DashboardSetting
.
elementItems
=
{
newReport
:
{
id
:
'settingNewReport'
,
name
:
'chk-new'
,
enabled
:
true
},
newReport
:
{
id
:
'settingNewReport'
,
name
:
'chk-new'
,
enabled
:
true
},
continousWork
:
{
id
:
'settingContinousWork'
,
name
:
'chk-proccess'
,
enabled
:
true
},
continousWork
:
{
id
:
'settingContinousWork'
,
name
:
'chk-proccess'
,
enabled
:
true
},
...
@@ -15,6 +17,9 @@ DashboardSetting.elementItems = {
...
@@ -15,6 +17,9 @@ DashboardSetting.elementItems = {
DashboardSetting
.
baseApiUrl
=
CONSTANT
.
URL
.
CMS
.
BASE
+
ClientData
.
userInfo_accountPath
()
+
CONSTANT
.
URL
.
CMS
.
API
.
BASE
+
'dashboardSetting/'
;
DashboardSetting
.
baseApiUrl
=
CONSTANT
.
URL
.
CMS
.
BASE
+
ClientData
.
userInfo_accountPath
()
+
CONSTANT
.
URL
.
CMS
.
API
.
BASE
+
'dashboardSetting/'
;
/**
* default setting JSON
*/
DashboardSetting
.
defaultSettingJson
=
{
DashboardSetting
.
defaultSettingJson
=
{
newReport
:
1
,
newReport
:
1
,
continousWork
:
1
,
continousWork
:
1
,
...
@@ -22,6 +27,10 @@ DashboardSetting.defaultSettingJson = {
...
@@ -22,6 +27,10 @@ DashboardSetting.defaultSettingJson = {
dashboardHome
:
0
,
dashboardHome
:
0
,
}
}
/**
* get setting data from cms
* @param {function} callback
*/
DashboardSetting
.
getSettingData
=
function
(
callback
)
{
DashboardSetting
.
getSettingData
=
function
(
callback
)
{
let
param
=
{
let
param
=
{
sid
:
COMMON
.
getSid
(),
sid
:
COMMON
.
getSid
(),
...
@@ -39,6 +48,10 @@ DashboardSetting.getSettingData = function (callback) {
...
@@ -39,6 +48,10 @@ DashboardSetting.getSettingData = function (callback) {
});
});
};
};
/**
* apply settings to screen
* @param {JSON} settings
*/
DashboardSetting
.
applySettings
=
function
(
settings
)
{
DashboardSetting
.
applySettings
=
function
(
settings
)
{
for
(
const
key
in
settings
)
{
for
(
const
key
in
settings
)
{
const
enabled
=
settings
[
key
];
const
enabled
=
settings
[
key
];
...
@@ -58,6 +71,9 @@ DashboardSetting.applySettings = function (settings) {
...
@@ -58,6 +71,9 @@ DashboardSetting.applySettings = function (settings) {
}
}
};
};
/**
* post request to save setting to cms
*/
DashboardSetting
.
saveSetting
=
function
()
{
DashboardSetting
.
saveSetting
=
function
()
{
let
param
=
{};
let
param
=
{};
param
.
sid
=
COMMON
.
getSid
();
param
.
sid
=
COMMON
.
getSid
();
...
@@ -74,7 +90,9 @@ DashboardSetting.saveSetting = function () {
...
@@ -74,7 +90,9 @@ DashboardSetting.saveSetting = function () {
});
});
};
};
//handle click on/off of setting item
/**
* handle on/off setting
*/
DashboardSetting
.
bindToggleClick
=
function
()
{
DashboardSetting
.
bindToggleClick
=
function
()
{
$
(
'.toggle'
).
on
(
'click'
,
function
()
{
$
(
'.toggle'
).
on
(
'click'
,
function
()
{
$
(
this
).
toggleClass
(
'checked'
);
$
(
this
).
toggleClass
(
'checked'
);
...
@@ -90,6 +108,9 @@ DashboardSetting.bindToggleClick = function () {
...
@@ -90,6 +108,9 @@ DashboardSetting.bindToggleClick = function () {
});
});
};
};
/**
* init data, action when screen onload
*/
DashboardSetting
.
init
=
function
()
{
DashboardSetting
.
init
=
function
()
{
DashboardSetting
.
getSettingData
(
function
(
settings
)
{
DashboardSetting
.
getSettingData
(
function
(
settings
)
{
DashboardSetting
.
applySettings
(
settings
);
DashboardSetting
.
applySettings
(
settings
);
...
@@ -97,10 +118,16 @@ DashboardSetting.init = function () {
...
@@ -97,10 +118,16 @@ DashboardSetting.init = function () {
DashboardSetting
.
bindToggleClick
();
DashboardSetting
.
bindToggleClick
();
};
};
/**
* handle click event of save button
*/
DashboardSetting
.
onClickSave
=
function
()
{
DashboardSetting
.
onClickSave
=
function
()
{
DashboardSetting
.
saveSetting
();
DashboardSetting
.
saveSetting
();
};
};
/**
* close setting dialog
*/
DashboardSetting
.
closeModal
=
function
()
{
DashboardSetting
.
closeModal
=
function
()
{
$
(
'#dashboard-setting-modal .close'
).
click
();
$
(
'#dashboard-setting-modal .close'
).
click
();
};
};
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