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