Commit 546683ce by NGUYEN HOANG SON

add jsdoc

parent eb57ef10
......@@ -5,7 +5,9 @@
*/
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 = {
newReport: { id: 'settingNewReport', name: 'chk-new', enabled: true },
continousWork: { id: 'settingContinousWork', name: 'chk-proccess', enabled: true },
......@@ -15,6 +17,9 @@ DashboardSetting.elementItems = {
DashboardSetting.baseApiUrl = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.API.BASE + 'dashboardSetting/';
/**
* default setting JSON
*/
DashboardSetting.defaultSettingJson = {
newReport: 1,
continousWork: 1,
......@@ -22,6 +27,10 @@ DashboardSetting.defaultSettingJson = {
dashboardHome: 0,
}
/**
* get setting data from cms
* @param {function} callback
*/
DashboardSetting.getSettingData = function (callback) {
let param = {
sid: COMMON.getSid(),
......@@ -39,6 +48,10 @@ DashboardSetting.getSettingData = function (callback) {
});
};
/**
* apply settings to screen
* @param {JSON} settings
*/
DashboardSetting.applySettings = function (settings) {
for (const key in settings) {
const enabled = settings[key];
......@@ -58,6 +71,9 @@ DashboardSetting.applySettings = function (settings) {
}
};
/**
* post request to save setting to cms
*/
DashboardSetting.saveSetting = function () {
let param = {};
param.sid = COMMON.getSid();
......@@ -74,7 +90,9 @@ DashboardSetting.saveSetting = function () {
});
};
//handle click on/off of setting item
/**
* handle on/off setting
*/
DashboardSetting.bindToggleClick = function () {
$('.toggle').on('click', function () {
$(this).toggleClass('checked');
......@@ -90,6 +108,9 @@ DashboardSetting.bindToggleClick = function () {
});
};
/**
* init data, action when screen onload
*/
DashboardSetting.init = function () {
DashboardSetting.getSettingData(function (settings) {
DashboardSetting.applySettings(settings);
......@@ -97,10 +118,16 @@ DashboardSetting.init = function () {
DashboardSetting.bindToggleClick();
};
/**
* handle click event of save button
*/
DashboardSetting.onClickSave = function () {
DashboardSetting.saveSetting();
};
/**
* close setting dialog
*/
DashboardSetting.closeModal = function () {
$('#dashboard-setting-modal .close').click();
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment