Commit 31c31a10 by NGUYEN HOANG SON

#49170 implement action push message 'read'

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