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
280de0b5
Commit
280de0b5
authored
Oct 21, 2022
by
NGUYEN HOANG SON
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code : dashboard setting js
parent
4126f0f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
abvw/js/dashboardSetting/dashboard-setting.js
+10
-7
No files found.
abvw/js/dashboardSetting/dashboard-setting.js
View file @
280de0b5
/**
* Dashboard Setting js in dashboard.html
*
* @since 1.0 check web
*/
var
DashboardSetting
=
{};
var
DashboardSetting
=
{};
DashboardSetting
.
elementItems
=
{
DashboardSetting
.
elementItems
=
{
newReport
:
{
id
:
'settingNewReport'
,
name
:
'chk-new'
,
enabled
:
true
},
newReport
:
{
id
:
'settingNewReport'
,
name
:
'chk-new'
,
enabled
:
true
},
...
@@ -7,8 +12,6 @@ DashboardSetting.elementItems = {
...
@@ -7,8 +12,6 @@ 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/'
;
DashboardSetting
.
saveSettingApiUrl
=
DashboardSetting
.
baseApiUrl
+
'saveSetting'
;
DashboardSetting
.
getSettingApiUrl
=
DashboardSetting
.
baseApiUrl
+
'getAllSettingData'
;
DashboardSetting
.
defaultSettingJson
=
{
DashboardSetting
.
defaultSettingJson
=
{
newReport
:
1
,
newReport
:
1
,
...
@@ -21,7 +24,8 @@ DashboardSetting.getSettingData = function (callback) {
...
@@ -21,7 +24,8 @@ DashboardSetting.getSettingData = function (callback) {
let
param
=
{
let
param
=
{
sid
:
COMMON
.
getSid
(),
sid
:
COMMON
.
getSid
(),
};
};
COMMON
.
cmsAjax
(
DashboardSetting
.
getSettingApiUrl
,
param
,
false
,
function
(
json
)
{
const
url
=
DashboardSetting
.
baseApiUrl
+
'getAllSettingData'
;
COMMON
.
cmsAjax
(
url
,
param
,
false
,
function
(
json
)
{
if
(
callback
)
{
if
(
callback
)
{
callback
(
json
);
callback
(
json
);
}
}
...
@@ -37,7 +41,7 @@ DashboardSetting.applySettings = function (settings) {
...
@@ -37,7 +41,7 @@ DashboardSetting.applySettings = function (settings) {
for
(
const
key
in
settings
)
{
for
(
const
key
in
settings
)
{
const
enabled
=
settings
[
key
];
const
enabled
=
settings
[
key
];
if
(
DashboardSetting
.
elementItems
.
hasOwnProperty
(
key
))
{
if
(
DashboardSetting
.
elementItems
.
hasOwnProperty
(
key
))
{
cons
t
elementItem
=
DashboardSetting
.
elementItems
[
key
];
le
t
elementItem
=
DashboardSetting
.
elementItems
[
key
];
elementItem
.
enabled
=
enabled
;
elementItem
.
enabled
=
enabled
;
let
element
=
$
(
'#'
+
elementItem
.
id
);
let
element
=
$
(
'#'
+
elementItem
.
id
);
if
(
element
)
{
if
(
element
)
{
...
@@ -58,7 +62,8 @@ DashboardSetting.saveSetting = function () {
...
@@ -58,7 +62,8 @@ DashboardSetting.saveSetting = function () {
const
element
=
DashboardSetting
.
elementItems
[
key
];
const
element
=
DashboardSetting
.
elementItems
[
key
];
param
[
key
]
=
element
.
enabled
;
param
[
key
]
=
element
.
enabled
;
}
}
COMMON
.
cmsAjax
(
DashboardSetting
.
saveSettingApiUrl
,
param
,
false
,
function
(
json
)
{
const
url
=
DashboardSetting
.
baseApiUrl
+
'saveSetting'
;
COMMON
.
cmsAjax
(
url
,
param
,
false
,
function
(
json
)
{
DashboardSetting
.
closeModal
();
DashboardSetting
.
closeModal
();
},
function
()
{
},
function
()
{
console
.
log
(
'DashboardSetting.saveSetting error'
);
console
.
log
(
'DashboardSetting.saveSetting error'
);
...
@@ -66,7 +71,6 @@ DashboardSetting.saveSetting = function () {
...
@@ -66,7 +71,6 @@ DashboardSetting.saveSetting = function () {
});
});
};
};
//設定画面でクリックされてた時の処理
DashboardSetting
.
bindToggleClick
=
function
()
{
DashboardSetting
.
bindToggleClick
=
function
()
{
$
(
'.toggle'
).
on
(
'click'
,
function
()
{
$
(
'.toggle'
).
on
(
'click'
,
function
()
{
$
(
this
).
toggleClass
(
'checked'
);
$
(
this
).
toggleClass
(
'checked'
);
...
@@ -82,7 +86,6 @@ DashboardSetting.bindToggleClick = function () {
...
@@ -82,7 +86,6 @@ DashboardSetting.bindToggleClick = function () {
});
});
};
};
//設定画面の初期処理
DashboardSetting
.
init
=
function
()
{
DashboardSetting
.
init
=
function
()
{
DashboardSetting
.
getSettingData
(
function
(
settings
)
{
DashboardSetting
.
getSettingData
(
function
(
settings
)
{
DashboardSetting
.
applySettings
(
settings
);
DashboardSetting
.
applySettings
(
settings
);
...
...
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