Commit 31c31a10 by NGUYEN HOANG SON

#49170 implement action push message 'read'

parent 780e3a60
...@@ -13,10 +13,10 @@ CHK_MessageDetail.init = function() { ...@@ -13,10 +13,10 @@ CHK_MessageDetail.init = function() {
CHK_Footer.activeDashboardBottomNav(); CHK_Footer.activeDashboardBottomNav();
}); });
var urlParam = CHK.getUrlParameter(); var urlParam = CHK.getUrlParameter();
if (typeof urlParam !== 'object' || typeof urlParam.id === 'undefined') { if (typeof urlParam !== 'object' || typeof urlParam.pushMessageId === 'undefined') {
return; return;
} }
let messageId = urlParam.id; let messageId = urlParam.pushMessageId;
CHK.loadJson(CHK.jsonPath.pushMessageList, function (json) { CHK.loadJson(CHK.jsonPath.pushMessageList, function (json) {
var messageList = json.pushMessageList; var messageList = json.pushMessageList;
if (typeof messageList !== 'object') { if (typeof messageList !== 'object') {
...@@ -26,6 +26,14 @@ CHK_MessageDetail.init = function() { ...@@ -26,6 +26,14 @@ CHK_MessageDetail.init = function() {
let message = messageList[i]; let message = messageList[i];
if (message.pushMessageId == messageId) { if (message.pushMessageId == messageId) {
CHK_MessageDetail.showMessage(message); CHK_MessageDetail.showMessage(message);
if (!message.readingFlg) {
//update reading flag
var param = {};
param.cmd = CHK.getCommand('actionPushMessage');
param.pushMessageId = messageId;
param.pushMessageAction = 'read';
CHK.sendABookCheckApi(param);
}
break; break;
} }
} }
......
...@@ -9,8 +9,8 @@ CHK_MessageList.init = function() { ...@@ -9,8 +9,8 @@ CHK_MessageList.init = function() {
$("#footer").load("main-footer.html", function() { $("#footer").load("main-footer.html", function() {
CHK_Footer.activeDashboardBottomNav(); CHK_Footer.activeDashboardBottomNav();
}); });
//CHK_MessageList.createMessageList(CHK_MessageList.dummyMessageList());
CHK.loadJson(CHK.jsonPath.pushMessageList, function (json) { CHK.loadJson(CHK.jsonPath.pushMessageList, function (json) {
//CHK_MessageList.createMessageList(CHK_MessageList.dummyMessageList());
CHK_MessageList.createMessageList(json.pushMessageList); CHK_MessageList.createMessageList(json.pushMessageList);
}); });
} }
...@@ -23,6 +23,11 @@ CHK_MessageList.refresh = function() { ...@@ -23,6 +23,11 @@ CHK_MessageList.refresh = function() {
CHK_MessageList.init(); CHK_MessageList.init();
} }
CHK_MessageList.clickMessage = function(pushMessageId) {
$("#pushMessageId_" + pushMessageId).removeClass('unread');
location.href = 'message-detail.html?pushMessageId=' + pushMessageId;
}
CHK_MessageList.createMessageList = function(messageList) { CHK_MessageList.createMessageList = function(messageList) {
$('#messageTable').empty(); $('#messageTable').empty();
if (typeof messageList !== 'object') { if (typeof messageList !== 'object') {
...@@ -37,12 +42,12 @@ CHK_MessageList.createMessageList = function(messageList) { ...@@ -37,12 +42,12 @@ CHK_MessageList.createMessageList = function(messageList) {
var mDate = message.pushSendDate; var mDate = message.pushSendDate;
var mSubtitle = message.operationName; var mSubtitle = message.operationName;
var unread = !message.readingFlg; var unread = !message.readingFlg;
var messageLi = $('<li class="item list-unstyled rounded border mb-2"/>'); var messageLi = $('<li class="item list-unstyled rounded border mb-2" id="pushMessageId_' + messageId + '"/>');
if (unread) { if (unread) {
messageLi.addClass('unread'); messageLi.addClass('unread');
} }
var messageA = $('<a class="d-block px-3 py-2 text-decoration-none text-dark"/>'); var messageA = $('<a class="d-block px-3 py-2 text-decoration-none text-dark"/>');
messageA.attr('href', 'message-detail.html?id=' + messageId); messageA.attr('href', "javascript:CHK_MessageList.clickMessage('" + messageId +"');");
var titleDiv = $('<div class="title">' + mTitle + '</div>'); var titleDiv = $('<div class="title">' + mTitle + '</div>');
var subTitleMainDiv = $('<div class="sub-title-wrap"></div>'); var subTitleMainDiv = $('<div class="sub-title-wrap"></div>');
var dateDiv = $('<div class="fs-8 text-secondary mr-2"><div class="data">' + mDate + '</div></div>'); var dateDiv = $('<div class="fs-8 text-secondary mr-2"><div class="data">' + mDate + '</div></div>');
......
...@@ -214,7 +214,8 @@ CHK.apiCmd = { ...@@ -214,7 +214,8 @@ CHK.apiCmd = {
changeReport: "changeTaskReport", //報告レポート変更 changeReport: "changeTaskReport", //報告レポート変更
getGroupTreeInfo: "getGroupTreeInfo", //担当グループ参照用 ログインユーザーが所属しているグループ取得 getGroupTreeInfo: "getGroupTreeInfo", //担当グループ参照用 ログインユーザーが所属しているグループ取得
deleteProcess: "deleteProcess", deleteProcess: "deleteProcess",
changeOperationGroupMaster: "changeOperationGroupMaster" changeOperationGroupMaster: "changeOperationGroupMaster",
actionPushMessage: "actionPushMessage"
}; };
//CMS送信用コマンド //CMS送信用コマンド
CHK.actCmd = { CHK.actCmd = {
......
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