Commit 102d0078 by Takumi Imai

Merge branch 'feature/1.0_check_web_dev' into feature/1.0_check_web_dev_imai

# Conflicts:
#	abweb/html/dashboard.html
#	abweb/html/push-message-list.html
#	abweb/js/dashboard/dashboard.js
parents f06bfb5d 462e03ac
<div id="main-ttl">
<div class="container">
<!-- breadcrumb -->
<nav id="mainTitleNavs" aria-label="breadcrumb">
<ol class="breadcrumb px-0 mb-0"></ol>
</nav>
<!-- title -->
<h1 id="mainTitleHeader" class="fs-14 font-weight-bold pt-sm-4 pt-2 pb-3 mb-0 lang"></h1>
</div>
</div>
\ No newline at end of file
<div id="main-ttl">
<div class="container">
<!-- title -->
<div class="d-flex align-items-center">
<h1 id="mainTitleHeader" class="fs-14 font-weight-bold pt-4 pb-3 mb-0 mr-auto lang"></h1>
</div>
</div>
</div>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>ダッシュボード</title> <title class="lang" lang="dashboard"></title>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<!-- favicons --> <!-- favicons -->
<link href="../common/img/favicon.ico" rel="icon"> <link href="../common/img/favicon.ico" rel="icon">
...@@ -37,17 +37,10 @@ ...@@ -37,17 +37,10 @@
<!-- header --> <!-- header -->
<div id="includedHeader"></div> <div id="includedHeader"></div>
<div id="includedMainTitle"></div>
<!-- dashboard --> <!-- dashboard -->
<main> <main>
<div class="container"> <div class="container">
<!-- title -->
<div class="d-flex align-items-center">
<h1 class="fs-14 font-weight-bold pt-4 pb-3 mb-0 mr-auto lang" lang="dashboard"></h1>
<a href="#" data-toggle="modal" data-target="#dashboard-setting-modal" >
<img src="../common/img/icon_dashboard_setting.svg" type="image" alt="" class="p-1 w-40px lang" lang="dashboardSettings">
</a>
</div>
<!-- sub title --> <!-- sub title -->
<h2 class="fs-8 font-weight-bold lang" id="#pickupHeader" lang="pickup"></h2> <h2 class="fs-8 font-weight-bold lang" id="#pickupHeader" lang="pickup"></h2>
...@@ -73,5 +66,4 @@ ...@@ -73,5 +66,4 @@
<script type="text/javascript" src="../common/js/newdash/app.js?__UPDATEID__"></script> <script type="text/javascript" src="../common/js/newdash/app.js?__UPDATEID__"></script>
<script type="text/javascript" src="../common/js/newdash/common.js?__UPDATEID__"></script> <script type="text/javascript" src="../common/js/newdash/common.js?__UPDATEID__"></script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -38,21 +38,10 @@ ...@@ -38,21 +38,10 @@
<!-- header --> <!-- header -->
<div id="includedHeader"></div> <div id="includedHeader"></div>
<div id="includedMainTitle"></div>
<!-- message list --> <!-- message list -->
<main> <main>
<div class="container"> <div class="container">
<!-- breadcrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb px-0 mb-0">
<li class="breadcrumb-item"><a href="dashboard.html" class="text-decoration-none text-underline lang" lang="dashboard"></a></li>
<li class="breadcrumb-item active lang" lang="messageListTitle" aria-current="page"><span></span></li>
</ol>
</nav>
<!-- title -->
<h1 class="fs-14 font-weight-bold pt-sm-4 pt-2 pb-3 mb-0 lang" lang="messageListTitle"></h1>
<!-- message --> <!-- message -->
<ul class="card-list message-list p-0" id="messageList"> <ul class="card-list message-list p-0" id="messageList">
<li class="card mb-2 not-found d-none"> <li class="card mb-2 not-found d-none">
...@@ -66,5 +55,4 @@ ...@@ -66,5 +55,4 @@
</main> </main>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -6,17 +6,17 @@ var DASHBOARD = {}; ...@@ -6,17 +6,17 @@ var DASHBOARD = {};
/** pickup dashboard configuration */ /** pickup dashboard configuration */
DASHBOARD.pickupItems = [ DASHBOARD.pickupItems = [
{id: 'newReport', href: "javascript:DASHBOARD.goPickup('newReport');", count: 0, enabled: true, img: {src: '../common/img/dahboard_icon_new.svg'}, msg: 'newRegistrationTitle'}, { id: 'newReport', href: "javascript:DASHBOARD.goPickup('newReport');", count: 0, enabled: true, img: { src: '../common/img/dahboard_icon_new.svg' }, msg: 'newRegistrationTitle' },
{id: 'continousWork', href: "javascript:DASHBOARD.goPickup('continousWork');", count: 0, enabled: true, img: {src: '../common/img/dahboard_icon_proccess.svg'}, msg: 'continousWorkTitle'}, { id: 'continousWork', href: "javascript:DASHBOARD.goPickup('continousWork');", count: 0, enabled: true, img: { src: '../common/img/dahboard_icon_proccess.svg' }, msg: 'continousWorkTitle' },
{id: 'warningReport', href: "javascript:DASHBOARD.goPickup('reportWarning');", count: 0, enabled: true, img: {src: '../common/img/dahboard_icon_alert.svg'}, msg: 'reportWarningTitle' }, { id: 'warningReport', href: "javascript:DASHBOARD.goPickup('reportWarning');", count: 0, enabled: true, img: { src: '../common/img/dahboard_icon_alert.svg' }, msg: 'reportWarningTitle' },
]; ];
/** comunication dashboard configuration */ /** comunication dashboard configuration */
DASHBOARD.communicationItems = [ DASHBOARD.communicationItems = [
{id: 'messageList', href: "javascript:DASHBOARD.goMessageList();", count: 0, enabled: true, img: {src: '../common/img/dahboard_icon_message_list.svg'}, msg: 'messageListTitle' }, { id: 'messageList', href: 'javascript:DASHBOARD.goMessageList();', count: 0, enabled: true, img: { src: '../common/img/dahboard_icon_message_list.svg' }, msg: 'messageListTitle' },
{id: 'sendMessage', href: "javascript:DASHBOARD.goSendMessage();", count: 0, enabled: true, img: {src: '../common/img/dahboard_icon_send_message.svg'}, msg: 'sendMessageTitle' }, { id: 'sendMessage', href: 'javascript:DASHBOARD.goSendMessage();', count: 0, enabled: true, img: { src: '../common/img/dahboard_icon_send_message.svg' }, msg: 'sendMessageTitle' },
{id: 'distanceSupport', href: "javascript:DASHBOARD.goDistanceSupport();", count: 0, enabled: true, img: {src: '../common/img/dahboard_icon_remote.svg'}, msg: 'distanceSupportTitle' }, { id: 'distanceSupport', href: 'javascript:DASHBOARD.goDistanceSupport();', count: 0, enabled: true, img: { src: '../common/img/dahboard_icon_remote.svg' }, msg: 'distanceSupportTitle' },
{id: 'chat', href: "javascript:DASHBOARD.goChat();", count: 0, enabled: true, img: {src: '../common/img/dahboard_icon_chat.svg'}, msg: 'chatTitle' }, { id: 'chat', href: 'javascript:DASHBOARD.goChat();', count: 0, enabled: true, img: { src: '../common/img/dahboard_icon_chat.svg' }, msg: 'chatTitle' },
]; ];
/** Default dashboard setting data */ /** Default dashboard setting data */
...@@ -25,7 +25,7 @@ DASHBOARD.defaultDashboard = { ...@@ -25,7 +25,7 @@ DASHBOARD.defaultDashboard = {
continousWork: 0, continousWork: 0,
warningReport: 0, warningReport: 0,
pushMesage: 0, pushMesage: 0,
} };
DASHBOARD.getDataApiUrl = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.API.BASE + 'dashboard/'; DASHBOARD.getDataApiUrl = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.API.BASE + 'dashboard/';
...@@ -36,71 +36,91 @@ DASHBOARD.getDashboardData = function (callback) { ...@@ -36,71 +36,91 @@ DASHBOARD.getDashboardData = function (callback) {
let param = { let param = {
sid: COMMON.getSid(), sid: COMMON.getSid(),
}; };
COMMON.cmsAjax(DASHBOARD.getDataApiUrl, param, false, function (json) { COMMON.cmsAjax(
DASHBOARD.getDataApiUrl,
param,
false,
function (json) {
if (callback) { if (callback) {
callback(json); callback(json);
} }
}, function() { },
function () {
console.log('DASHBOARD.getData error'); console.log('DASHBOARD.getData error');
if (callback) { if (callback) {
callback(DASHBOARD.defaultDashboard); callback(DASHBOARD.defaultDashboard);
} }
}); },
);
}; };
/** Initialization dashboard pickup items html */ /** Initialization dashboard pickup items html */
DASHBOARD.initPickups = function() { DASHBOARD.initPickups = function () {
$("#pickupItems").empty(); $('#pickupItems').empty();
DASHBOARD.pickupItems.forEach(function(item) { DASHBOARD.pickupItems.forEach(function (item) {
if (item.enabled == true ) { if (item.enabled == true) {
var html = DASHBOARD.initHtmlItem(item); var html = DASHBOARD.initHtmlItem(item);
$("#pickupItems").append(html); $('#pickupItems').append(html);
} }
}); });
//pickup empty //pickup empty
if ($("#pickupItems").children().length > 0) { if ($('#pickupItems').children().length > 0) {
$("#pickupHeader").removeClass('d-none'); $('#pickupHeader').removeClass('d-none');
} else { } else {
$("#pickupHeader").addClass('d-none'); $('#pickupHeader').addClass('d-none');
} }
} };
/** Initialization dashboard communication items html */ /** Initialization dashboard communication items html */
DASHBOARD.initCommunications = function() { DASHBOARD.initCommunications = function () {
$("#communicationItems").empty(); $('#communicationItems').empty();
DASHBOARD.communicationItems.forEach(function(item) { DASHBOARD.communicationItems.forEach(function (item) {
if (item.enabled == true) { if (item.enabled == true) {
const html = DASHBOARD.initHtmlItem(item); const html = DASHBOARD.initHtmlItem(item);
$("#communicationItems").append(html); $('#communicationItems').append(html);
} }
}); });
} };
/** Initialization dashboard items html */ /** Initialization dashboard items html */
DASHBOARD.initHtmlItem = function(item) { DASHBOARD.initHtmlItem = function (item) {
let countText = '' + item.count; let countText = '' + item.count;
if (item.count >= 100) { if (item.count >= 100) {
countText = '99+'; countText = '99+';
} }
let countDClass = ''; let countDClass = '';
let countSpan = '' let countSpan = '';
if (typeof item.count != 'undefined' && item.count > 0) { if (typeof item.count != 'undefined' && item.count > 0) {
countDClass = ' '; countDClass = ' ';
countSpan = '<span class="fs-8 circle-tag-danger' + countDClass + '">' + countText + '</span>'; countSpan = '<span class="fs-8 circle-tag-danger' + countDClass + '">' + countText + '</span>';
} }
let html = $('<li class="card mb-2 position-relative" id="' + item.id + '">' let html = $(
+ '<a href="' + item.href + '" class="d-block text-dark text-decoration-none mb-1 p-3 text-center">' '<li class="card mb-2 position-relative" id="' +
+ '<div class="bg-lightblue p-2 d-inline-block rounded-circle mb-3">' item.id +
+ '<img src="' + item.img.src + '" alt="' + I18N.i18nText(item.msg) +'" class="img-fluid"> </div>' '">' +
+ '<div class="fs-10 lang" lang="' + item.msg + '">' + I18N.i18nText(item.msg ) + '</div>' '<a href="' +
+ countSpan item.href +
+ '</a>' '" class="d-block text-dark text-decoration-none mb-1 p-3 text-center">' +
+ '</li>'); '<div class="bg-lightblue p-2 d-inline-block rounded-circle mb-3">' +
'<img src="' +
item.img.src +
'" alt="' +
I18N.i18nText(item.msg) +
'" class="img-fluid"> </div>' +
'<div class="fs-10 lang" lang="' +
item.msg +
'">' +
I18N.i18nText(item.msg) +
'</div>' +
countSpan +
'</a>' +
'</li>',
);
return html; return html;
} };
/** Initialization dashboard screen */ /** Initialization dashboard screen */
DASHBOARD.init = function() { DASHBOARD.init = function () {
DASHBOARD.loadCommon(); DASHBOARD.loadCommon();
DashboardSetting.getSettingData(function (settings) { DashboardSetting.getSettingData(function (settings) {
DASHBOARD.getDashboardData(function (dataDashboard) { DASHBOARD.getDashboardData(function (dataDashboard) {
...@@ -108,20 +128,20 @@ DASHBOARD.init = function() { ...@@ -108,20 +128,20 @@ DASHBOARD.init = function() {
DASHBOARD.initPickups(); DASHBOARD.initPickups();
DASHBOARD.updateDataCommunications(dataDashboard); DASHBOARD.updateDataCommunications(dataDashboard);
DASHBOARD.initCommunications(); DASHBOARD.initCommunications();
}); });
}); });
} };
/** load common data */ /** load common data */
DASHBOARD.loadCommon = function() { DASHBOARD.loadCommon = function () {
TEMPLATE.loadHearder("#includedHeader"); TEMPLATE.loadHearder('#includedHeader');
TEMPLATE.loadDashboardSetting("#includedDashboardSetting", DASHBOARD.changeSettingCallback); TEMPLATE.loadDashboardSetting('#includedDashboardSetting', DASHBOARD.changeSettingCallback);
TEMPLATE.loadConfirmModal("#includedConfirmModal"); TEMPLATE.loadConfirmModal('#includedConfirmModal');
} TEMPLATE.loadMainNavsTitle('#includedMainTitle', 'dashboard', null, DASHBOARD.loadMainTitleCallback);
};
/** Update pickup config from setting dashboard data */ /** Update pickup config from setting dashboard data */
DASHBOARD.updateDataPickups = function(settings, dataDashboard) { DASHBOARD.updateDataPickups = function (settings, dataDashboard) {
DASHBOARD.pickupItems.forEach(function(item) { DASHBOARD.pickupItems.forEach(function (item) {
const enabled = settings[item.id]; const enabled = settings[item.id];
if (enabled == true || enabled == false) { if (enabled == true || enabled == false) {
item.enabled = enabled; item.enabled = enabled;
...@@ -131,40 +151,53 @@ DASHBOARD.updateDataPickups = function(settings, dataDashboard) { ...@@ -131,40 +151,53 @@ DASHBOARD.updateDataPickups = function(settings, dataDashboard) {
item.count = dataDashboard[item.id]; item.count = dataDashboard[item.id];
} }
}); });
} };
/** Update communication setting from dashboard data */ /** Update communication setting from dashboard data */
DASHBOARD.updateDataCommunications = function(dataDashboard) { DASHBOARD.updateDataCommunications = function (dataDashboard) {
DASHBOARD.communicationItems.forEach(function(item) { DASHBOARD.communicationItems.forEach(function (item) {
if (item.id == 'messageList') { if (item.id == 'messageList') {
item.count = 0; item.count = 0;
if (dataDashboard['pushMesage']) {
item.count = dataDashboard['pushMesage']; if (dataDashboard.dashboard['pushMesage']) {
item.count = dataDashboard.dashboard['pushMesage'];
} }
} }
}); });
} };
/** Direct to pickup screen */ /** Direct to pickup screen */
DASHBOARD.goPickup = function(pickupId) { DASHBOARD.goPickup = function (pickupId) {
COMMON.goUrlWithCurrentParams('pickup.html', {pickupActive: pickupId}); COMMON.goUrlWithCurrentParams('pickup.html', { pickupActive: pickupId });
} };
/** Direct to Message list screen */ /** Direct to Message list screen */
DASHBOARD.goMessageList = function() { DASHBOARD.goMessageList = function () {
COMMON.goUrlWithCurrentParams('push-message-list.html', {}); COMMON.goUrlWithCurrentParams('push-message-list.html', {});
} };
/** /**
* Direct to send message screen * Direct to send message screen
*/ */
DASHBOARD.goSendMessage = function() { DASHBOARD.goSendMessage = function () {
COMMON.goUrlWithCurrentParams('send-message.html', {}); COMMON.goUrlWithCurrentParams('send-message.html', {});
} };
/** /**
* callback when setting changed * callback when setting changed
*/ */
DASHBOARD.changeSettingCallback = function() { DASHBOARD.changeSettingCallback = function () {
location.reload(); location.reload();
} };
/**
* callback when complete load main title html
*/
DASHBOARD.loadMainTitleCallback = function () {
//add dashboard setting item
var elmA = $('<a href="#" data-toggle="modal" data-target="#dashboard-setting-modal">');
let elmImg = $('<img src="../common/img/icon_dashboard_setting.svg" alt="" class="p-1 w-40px lang" lang="dashboardSettings" data-toggle="tooltip" data-placement="bottom" title="">');
elmImg.attr('title', I18N.i18nText('dashboardSettings'));
elmA.append(elmImg);
$('#mainTitleHeader').after(elmA);
};
...@@ -10,6 +10,16 @@ PushMessageList.baseApiUrl = CONSTANT.URL.CMS.BASE + ClientData.userInfo_account ...@@ -10,6 +10,16 @@ PushMessageList.baseApiUrl = CONSTANT.URL.CMS.BASE + ClientData.userInfo_account
*/ */
PushMessageList.init = function() { PushMessageList.init = function() {
TEMPLATE.loadHearder("#includedHeader"); TEMPLATE.loadHearder("#includedHeader");
const navs = [
{
titleLang: 'dashboard',
href: 'dashboard.html',
},
{
titleLang: 'messageListTitle',
},
];
TEMPLATE.loadMainNavsTitle("#includedMainTitle", "messageListTitle", navs, null);
PushMessageList.getMessageList(function(messageList) { PushMessageList.getMessageList(function(messageList) {
PushMessageList.generateMessageListHtml(messageList.pushMessageList); PushMessageList.generateMessageListHtml(messageList.pushMessageList);
}); });
......
...@@ -61,3 +61,49 @@ TEMPLATE.loadNotificationSelect = function(elmentId, selectCallback) { ...@@ -61,3 +61,49 @@ TEMPLATE.loadNotificationSelect = function(elmentId, selectCallback) {
I18N.initi18n(); I18N.initi18n();
}); });
} }
/**
* load main navs title html to a element by id
* @param {string} elmentId - elementId where contain main title html
* @param {string} titleLang - lang of title
* @param {Array} navs - array nav items (titleLang, href)
*/
TEMPLATE.loadMainNavsTitle = function(elmentId, titleLang, navs, completeCallback) {
var titleHtmlPath = '../common/main-title.html';
if (navs) {
titleHtmlPath = '../common/main-nav-title.html';
}
$(elmentId).load(titleHtmlPath , function(data) {
$(elmentId).replaceWith(data);
if (titleLang) {
$('#mainTitleHeader').attr("lang", titleLang);
}
if (navs) {
var olElm = $('#mainTitleNavs ol');
for (var i = 0; i < navs.length; i++) {
const nav = navs[i];
var liElm = $('<li class="breadcrumb-item" />');
if (nav.href) {
var aElm = $('<a class="text-decoration-none text-underline lang" />');
aElm.attr('href', nav.href);
if (nav.titleLang) {
aElm.attr('lang', nav.titleLang);
}
liElm.append(aElm);
} else {
liElm.addClass('lang');
liElm.attr('aria-current', 'page');
liElm.append('<span></span>');
if (nav.titleLang) {
liElm.attr('lang', nav.titleLang);
}
}
olElm.append(liElm);
}
}
I18N.initi18n();
if (completeCallback) {
completeCallback();
}
});
}
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