Commit c264090c by Lee Daehyun

システムメッセージ日付追加

parent 89faf50a
......@@ -742,6 +742,9 @@ input[name="tab_item"] {
border: none;
font-size: 18px;
}
.dow {
margin-left: 10px;
}
/**************************** modal *************************/
/* メニューモーダル */
......
......@@ -1193,7 +1193,8 @@ CHAT_UI.loadMessages = function(roomId, roomName) {
let filterObj = jQuery.parseHTML(filterHtml);
$('#filter').append(filterObj);
var checkBeforeDate = "";
var beforeDate = "";
messages.forEach(function(message) {
let template = userMessageTemplate;
if (message.shopMemberId == CHAT.globalLoginParameter.shopMemberId) {
......@@ -1223,6 +1224,19 @@ CHAT_UI.loadMessages = function(roomId, roomName) {
if (messageTime.createdAt.includes(':')) {
isToday = true;
}
if (messageTime.createdAtDay != checkBeforeDate && checkBeforeDate != "") {
let messageDay = CHAT_UTIL.systemDay(beforeDate);
let html = Mustache.render(systemMessageTemplate, {
year: messageDay.year + getLocalizedString('year'),
month: messageDay.month + getLocalizedString('month'),
day: messageDay.day + getLocalizedString('day'),
dow: CHAT_UTIL.findDow(messageDay.dow)
});
workVal = html + workVal;
}
checkBeforeDate = messageTime.createdAtDay;
beforeDate = message.insertDate;
let html = Mustache.render(template, {
text: message.message,
......
......@@ -55,3 +55,37 @@ CHAT_UTIL.generateUUID = function() {
});
return uuid;
};
CHAT_UTIL.systemDay = function(date) {
let createdAt = moment(date);
createdAt = moment(date,'YYYYMMDDhhmmss');
const createdAtDow = createdAt.format('YYYY-MM-DD');
let systemDay = new Object();
systemDay.year = createdAt.format('YYYY');
systemDay.month = createdAt.format('MM');
systemDay.day = createdAt.format('DD');
systemDay.dow = moment(createdAtDow).day();
return systemDay;
}
CHAT_UTIL.findDow = function(data) {
let dow = "";
if (data == 0) {
dow = getLocalizedString('sunday');
} else if (data == 1) {
dow = getLocalizedString('monday');
} else if (data == 2) {
dow = getLocalizedString('thusday');
} else if (data == 3) {
dow = getLocalizedString('wednesday');
} else if (data == 4) {
dow = getLocalizedString('thursday');
} else if (data == 5) {
dow = getLocalizedString('friday');
} else if (data == 6) {
dow = getLocalizedString('sunday');
}
return dow;
}
......@@ -78,5 +78,15 @@ $.lang.en = {
"archiveSaveUser":"Save User",
"archiveAttendUser":"Attend User",
"noResult":"there is no search result.",
"searchUserAndGroup":"search user and group."
"searchUserAndGroup":"search user and group.",
"year":"year",
"month":"month",
"day":"day",
"monday":"monday",
"thusday":"thusday",
"wednesday":"wednesday",
"thursday":"thursday",
"friday":"friday",
"saturday":"saturday",
"sunday":"sunday"
}
......@@ -78,5 +78,15 @@ $.lang.ja = {
"archiveSaveUser":"保存ユーザー",
"archiveAttendUser":"参加ユーザー",
"noResult":"検索結果がありませんでした。",
"searchUserAndGroup":"ユーザーとグループ検索"
"searchUserAndGroup":"ユーザーとグループ検索",
"year":"年",
"month":"月",
"day":"日",
"monday":"月曜日",
"thusday":"火曜日",
"wednesday":"水曜日",
"thursday":"木曜日",
"friday":"金曜日",
"saturday":"土曜日",
"sunday":"日曜日"
}
......@@ -78,5 +78,15 @@ $.lang.ko = {
"archiveSaveUser":"저장 사용자",
"archiveAttendUser":"참여자",
"noResult":"검색결과가 존재하지않습니다",
"searchUserAndGroup":"유저,그룹 검색"
"searchUserAndGroup":"유저,그룹 검색",
"year":"년",
"month":"월",
"day":"일",
"monday":"월요일",
"thusday":"화요일",
"wednesday":"수요일",
"thursday":"목요일",
"friday":"금요일",
"saturday":"토요일",
"sunday":"일요일"
}
<div class="sys_msg text-center">2021/03/04</div>
\ No newline at end of file
<div class="sys_msg text-center">{{year}}{{month}}{{day}}<span class="dow">{{dow}}</span></div>
\ No newline at end of file
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