Commit 4d0921ae by NGO THI HONG

direct home screen

parent 5310be93
/**
* Common js for footer.
* header js for index.
* ※Code is written mainly for dashboard and operationList.
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var FOOTER = {};
var HEADER = {};
/**
* Change specific footer bottom to active.
*
* @param {String} bottomNavId
*/
FOOTER.activeBottomNav = function (bottomNavId) {
let elm = $('#' + bottomNavId);
if (typeof elm !== 'object') {
console.log('FOOTER.activeBottomNav:elm !== object:' + bottomNavId);
return;
}
elm.removeClass('text-secondary');
elm.addClass('text-primary');
let img = elm.find('img')[0];
if (img && img.getAttribute('data-src')) {
img.src = img.getAttribute('data-src');
}
};
/**
* change inactive all footer bottom
*/
FOOTER.inactiveAllBottomNav = function () {
let navs = document.getElementsByClassName('bottom-nav');
for (i = 0; i < navs.length; i++) {
navs[i].className = navs[i].className.replace('text-primary', 'text-secondary');
let img = navs[i].querySelector('img');
if (img && img.getAttribute('data-inactive-src')) {
img.src = img.getAttribute('data-inactive-src');
/** Direct home page setting */
HEADER.goToHomePage = function (pageId) {
DashboardSetting.getSettingData(function (settings) {
if(settings.dashboardHome == 1)
{
HEADER.goDashboard();
}
else
{
HEADER.goOperationList();
}
};
});
}
/**
* Go page of index.html.
* Store tab id in session for want to show display.
*
* @param {String} tabId
* Go page of operationList
*/
FOOTER.goIndexPage = function (tabId) {
sessionStorage.activeTab = tabId;
COMMON.goUrlWithCurrentParams(DAFAULT_PAGE);
HEADER.goOperationList = function () {
$('#footer').load(CONSTANT.PAGE_NAME.FOOTER, function () {
sessionStorage.activeTab = CONSTANT.PAGE_TAB.OPERATION_LIST;
HEADER.activeInitBottomNav('operationListBottomNav');
TOP.showPage(CONSTANT.PAGE_NAME.OPERATION_LIST);
});
};
/**
* is the url index.html?
* Go page of dashboard
*/
FOOTER.isIndexPage = function () {
if (typeof location === 'object' && typeof location.pathname === 'string') {
if (location.pathname.includes(CONSTANT.PAGE_NAME.DEFAULT) == true) {
return true;
}
}
return false;
HEADER.goDashboard = function () {
COMMON.avwScreenMove("dashboard.html");
};
/**
* Initialize with any navigation
*
* @param {String} bottomNav
*/
FOOTER.activeInitBottomNav = function (bottomNav) {
FOOTER.inactiveAllBottomNav();
FOOTER.activeBottomNav(bottomNav);
HEADER.activeInitBottomNav = function (bottomNav) {
HEADER.inactiveAllBottomNav();
HEADER.activeBottomNav(bottomNav);
};
/**
* Go page of dashboard
* change inactive all footer bottom
*/
FOOTER.goDashboard = function () {
sessionStorage.activeTab = CONSTANT.PAGE_TAB.DASHBOARD;
FOOTER.activeInitBottomNav('dashboardBottomNav');
if (FOOTER.isIndexPage()) {
TOP.showPage(CONSTANT.PAGE_NAME.DASHBOARD);
return;
HEADER.inactiveAllBottomNav = function () {
let navs = document.getElementsByClassName('bottom-nav');
for (i = 0; i < navs.length; i++) {
navs[i].className = navs[i].className.replace('text-primary', 'text-secondary');
let img = navs[i].querySelector('img');
if (img && img.getAttribute('data-inactive-src')) {
img.src = img.getAttribute('data-inactive-src');
}
FOOTER.goIndexPage(CONSTANT.PAGE_NAME.DASHBOARD);
};
/**
* Go page of operationList
*/
FOOTER.goOperationList = function () {
sessionStorage.activeTab = CONSTANT.PAGE_TAB.OPERATION_LIST;
FOOTER.activeInitBottomNav('operationListBottomNav');
if (FOOTER.isIndexPage()) {
TOP.showPage(CONSTANT.PAGE_NAME.OPERATION_LIST);
return;
}
FOOTER.goIndexPage(CONSTANT.PAGE_NAME.OPERATION_LIST);
};
/**
* Go to active tab when footer was loaded.
* If it is no active tab, go to page in settings.
* Change specific footer bottom to active.
*
* @param {String} bottomNavId
*/
FOOTER.initFooter = function () {
$('#footer').load(CONSTANT.PAGE_NAME.FOOTER, function () {
if (typeof sessionStorage != 'undefined' && typeof sessionStorage.activeTab != 'undefined') {
if (sessionStorage.activeTab == CONSTANT.PAGE_TAB.DASHBOARD) {
FOOTER.goDashboard();
} else {
FOOTER.goOperationList();
}
HEADER.activeBottomNav = function (bottomNavId) {
let elm = $('#' + bottomNavId);
if (typeof elm !== 'object') {
console.log('HEADER.activeBottomNav:elm !== object:' + bottomNavId);
return;
}
FOOTER.goOperationList();
// CHK.loadDashboardSetting(function() {
// if (CHK.dashboardSetting.dashboardHome) {
// FOOTER.goDashboard();
// } else {
// FOOTER.goOperationList();
// }
// });
});
elm.removeClass('text-secondary');
elm.addClass('text-primary');
let img = elm.find('img')[0];
if (img && img.getAttribute('data-src')) {
img.src = img.getAttribute('data-src');
}
};
\ No newline at end of file
......@@ -23,13 +23,13 @@
<script src="/abvw/js/operationList/operationList.js?__UPDATEID__"></script>
<script src="/abvw/js/dashboardSetting/dashboard-setting.js?__UPDATEID__"></script>
<script src="/abvw/js/dashboard/dashboard.js?__UPDATEID__"></script>
<script src="/abvw/common/js/header.js?__UPDATEID__"></script>
<script src="/abvw/js/topPage/topPage.js?__UPDATEID__"></script>
<script src="/abvw/common/js/footer.js?__UPDATEID__"></script>
<script src="/abvw/common/js/app.js?__UPDATEID__" defer></script>
</head>
<body onload="TOP.init();" style="position: relative; margin-top: 53px;">
<body style="position: relative; margin-top: 53px;">
<!--作業一覧画面-->
<section id="operationList" class="page-content" style="display: none;">
......@@ -197,7 +197,7 @@
<!--ローディング-->
<div id="check_loading" style="display:none; position: relative; overflow:hidden;">
<p id="checkLoadingMessage"></p>
<div id="checkLoadingImage"><img src='${check}images/transferLoading.gif' /></div>
<div id="checkLoadingImage"><img src='/abvw/img/loading.svg' /></div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -227,7 +227,7 @@ PICKUP.showCountDisplayPickupItem = function(elementId, count) {
*/
PICKUP.initNewReportTab = function() {
PICKUP.getNewreportListData(function (json) {
PICKUP.createNewReportList(json.operationtList);
PICKUP.createNewReportList(json.operationList);
});
}
......@@ -237,7 +237,7 @@ PICKUP.initNewReportTab = function() {
*/
PICKUP.initContinuosWorkTab = function() {
PICKUP.getContinuousWorkListData(function (json) {
PICKUP.createContinousWorkList(json.operationtList);
PICKUP.createContinousWorkList(json.operationList);
});
}
......@@ -246,7 +246,7 @@ PICKUP.initNewReportTab = function() {
*/
PICKUP.initReportWithWarningsTab = function() {
PICKUP.getReportWithWarningsListData(function (json) {
PICKUP.createReportWithWarningList(json.operationtList);
PICKUP.createReportWithWarningList(json.operationList);
});
}
......
......@@ -16,6 +16,8 @@ $(document).ready(function () {
//setting msg of html
COMMON.updateLang();
TOP.init();
});
/**
......@@ -23,23 +25,10 @@ $(document).ready(function () {
*/
TOP.init = function () {
COMMON.showLoading();
TOP.goToHomePage();
HEADER.goToHomePage();
COMMON.closeLoading();
};
/** Direct home page setting */
TOP.goToHomePage = function (pageId) {
DashboardSetting.getSettingData(function (settings) {
if(settings.dashboardHome == 1)
{
COMMON.avwScreenMove("dashboard.html");
}
else
{
FOOTER.initFooter(); //app should get data after initFooter
}
});
}
/**
* Show page by arbitrary id
*
......
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