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 @@
<head>
<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">
<!-- favicons -->
<link href="../common/img/favicon.ico" rel="icon">
......@@ -37,17 +37,10 @@
<!-- header -->
<div id="includedHeader"></div>
<div id="includedMainTitle"></div>
<!-- dashboard -->
<main>
<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 -->
<h2 class="fs-8 font-weight-bold lang" id="#pickupHeader" lang="pickup"></h2>
......@@ -73,5 +66,4 @@
<script type="text/javascript" src="../common/js/newdash/app.js?__UPDATEID__"></script>
<script type="text/javascript" src="../common/js/newdash/common.js?__UPDATEID__"></script>
</body>
</html>
\ No newline at end of file
......@@ -38,21 +38,10 @@
<!-- header -->
<div id="includedHeader"></div>
<div id="includedMainTitle"></div>
<!-- message list -->
<main>
<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 -->
<ul class="card-list message-list p-0" id="messageList">
<li class="card mb-2 not-found d-none">
......@@ -66,5 +55,4 @@
</main>
</body>
</html>
\ No newline at end of file
......@@ -6,17 +6,17 @@ var DASHBOARD = {};
/** pickup dashboard configuration */
DASHBOARD.pickupItems = [
{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: 'warningReport', href: "javascript:DASHBOARD.goPickup('reportWarning');", count: 0, enabled: true, img: {src: '../common/img/dahboard_icon_alert.svg'}, msg: 'reportWarningTitle' },
{ 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: 'warningReport', href: "javascript:DASHBOARD.goPickup('reportWarning');", count: 0, enabled: true, img: { src: '../common/img/dahboard_icon_alert.svg' }, msg: 'reportWarningTitle' },
];
/** comunication dashboard configuration */
DASHBOARD.communicationItems = [
{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: '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: '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: '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' },
];
/** Default dashboard setting data */
......@@ -25,103 +25,123 @@ DASHBOARD.defaultDashboard = {
continousWork: 0,
warningReport: 0,
pushMesage: 0,
}
};
DASHBOARD.getDataApiUrl = CONSTANT.URL.CMS.BASE + ClientData.userInfo_accountPath() + CONSTANT.URL.CMS.API.BASE + 'dashboard/';
/**
* Call api get data
* Call api get data
*/
DASHBOARD.getDashboardData = function (callback) {
let param = {
sid: COMMON.getSid(),
};
COMMON.cmsAjax(DASHBOARD.getDataApiUrl, param, false, function (json) {
if (callback) {
callback(json);
}
}, function() {
console.log('DASHBOARD.getData error');
if (callback) {
callback(DASHBOARD.defaultDashboard);
}
});
COMMON.cmsAjax(
DASHBOARD.getDataApiUrl,
param,
false,
function (json) {
if (callback) {
callback(json);
}
},
function () {
console.log('DASHBOARD.getData error');
if (callback) {
callback(DASHBOARD.defaultDashboard);
}
},
);
};
/** Initialization dashboard pickup items html */
DASHBOARD.initPickups = function() {
$("#pickupItems").empty();
DASHBOARD.pickupItems.forEach(function(item) {
if (item.enabled == true ) {
DASHBOARD.initPickups = function () {
$('#pickupItems').empty();
DASHBOARD.pickupItems.forEach(function (item) {
if (item.enabled == true) {
var html = DASHBOARD.initHtmlItem(item);
$("#pickupItems").append(html);
$('#pickupItems').append(html);
}
});
//pickup empty
if ($("#pickupItems").children().length > 0) {
$("#pickupHeader").removeClass('d-none');
if ($('#pickupItems').children().length > 0) {
$('#pickupHeader').removeClass('d-none');
} else {
$("#pickupHeader").addClass('d-none');
$('#pickupHeader').addClass('d-none');
}
}
};
/** Initialization dashboard communication items html */
DASHBOARD.initCommunications = function() {
$("#communicationItems").empty();
DASHBOARD.communicationItems.forEach(function(item) {
DASHBOARD.initCommunications = function () {
$('#communicationItems').empty();
DASHBOARD.communicationItems.forEach(function (item) {
if (item.enabled == true) {
const html = DASHBOARD.initHtmlItem(item);
$("#communicationItems").append(html);
$('#communicationItems').append(html);
}
});
}
};
/** Initialization dashboard items html */
DASHBOARD.initHtmlItem = function(item) {
DASHBOARD.initHtmlItem = function (item) {
let countText = '' + item.count;
if (item.count >= 100) {
countText = '99+';
}
let countDClass = '';
let countSpan = ''
let countSpan = '';
if (typeof item.count != 'undefined' && item.count > 0) {
countDClass = ' ';
countSpan = '<span class="fs-8 circle-tag-danger' + countDClass + '">' + countText + '</span>';
}
let html = $('<li class="card mb-2 position-relative" id="' + item.id + '">'
+ '<a href="' + item.href + '" class="d-block text-dark text-decoration-none mb-1 p-3 text-center">'
+ '<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>');
let html = $(
'<li class="card mb-2 position-relative" id="' +
item.id +
'">' +
'<a href="' +
item.href +
'" class="d-block text-dark text-decoration-none mb-1 p-3 text-center">' +
'<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;
}
};
/** Initialization dashboard screen */
DASHBOARD.init = function() {
DASHBOARD.init = function () {
DASHBOARD.loadCommon();
DashboardSetting.getSettingData(function (settings) {
DASHBOARD.getDashboardData(function (dataDashboard) {
DASHBOARD.updateDataPickups(settings, dataDashboard);
DASHBOARD.initPickups();
DASHBOARD.updateDataCommunications(dataDashboard);
DASHBOARD.initCommunications();
DASHBOARD.initCommunications();
});
});
}
});
};
/** load common data */
DASHBOARD.loadCommon = function() {
TEMPLATE.loadHearder("#includedHeader");
TEMPLATE.loadDashboardSetting("#includedDashboardSetting", DASHBOARD.changeSettingCallback);
TEMPLATE.loadConfirmModal("#includedConfirmModal");
}
DASHBOARD.loadCommon = function () {
TEMPLATE.loadHearder('#includedHeader');
TEMPLATE.loadDashboardSetting('#includedDashboardSetting', DASHBOARD.changeSettingCallback);
TEMPLATE.loadConfirmModal('#includedConfirmModal');
TEMPLATE.loadMainNavsTitle('#includedMainTitle', 'dashboard', null, DASHBOARD.loadMainTitleCallback);
};
/** Update pickup config from setting dashboard data */
DASHBOARD.updateDataPickups = function(settings, dataDashboard) {
DASHBOARD.pickupItems.forEach(function(item) {
DASHBOARD.updateDataPickups = function (settings, dataDashboard) {
DASHBOARD.pickupItems.forEach(function (item) {
const enabled = settings[item.id];
if (enabled == true || enabled == false) {
item.enabled = enabled;
......@@ -131,40 +151,53 @@ DASHBOARD.updateDataPickups = function(settings, dataDashboard) {
item.count = dataDashboard[item.id];
}
});
}
};
/** Update communication setting from dashboard data */
DASHBOARD.updateDataCommunications = function(dataDashboard) {
DASHBOARD.communicationItems.forEach(function(item) {
DASHBOARD.updateDataCommunications = function (dataDashboard) {
DASHBOARD.communicationItems.forEach(function (item) {
if (item.id == 'messageList') {
item.count = 0;
if (dataDashboard['pushMesage']) {
item.count = dataDashboard['pushMesage'];
}
if (dataDashboard.dashboard['pushMesage']) {
item.count = dataDashboard.dashboard['pushMesage'];
}
}
});
}
};
/** Direct to pickup screen */
DASHBOARD.goPickup = function(pickupId) {
COMMON.goUrlWithCurrentParams('pickup.html', {pickupActive: pickupId});
}
DASHBOARD.goPickup = function (pickupId) {
COMMON.goUrlWithCurrentParams('pickup.html', { pickupActive: pickupId });
};
/** Direct to Message list screen */
DASHBOARD.goMessageList = function() {
DASHBOARD.goMessageList = function () {
COMMON.goUrlWithCurrentParams('push-message-list.html', {});
}
};
/**
* Direct to send message screen
*/
DASHBOARD.goSendMessage = function() {
DASHBOARD.goSendMessage = function () {
COMMON.goUrlWithCurrentParams('send-message.html', {});
}
};
/**
* callback when setting changed
*/
DASHBOARD.changeSettingCallback = function() {
DASHBOARD.changeSettingCallback = function () {
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
*/
PushMessageList.init = function() {
TEMPLATE.loadHearder("#includedHeader");
const navs = [
{
titleLang: 'dashboard',
href: 'dashboard.html',
},
{
titleLang: 'messageListTitle',
},
];
TEMPLATE.loadMainNavsTitle("#includedMainTitle", "messageListTitle", navs, null);
PushMessageList.getMessageList(function(messageList) {
PushMessageList.generateMessageListHtml(messageList.pushMessageList);
});
......
......@@ -61,3 +61,49 @@ TEMPLATE.loadNotificationSelect = function(elmentId, selectCallback) {
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