ปรับให้แสดงวันที่ใน noti ให้ถูกต้อง
This commit is contained in:
@@ -562,9 +562,23 @@ function GetSubMenu(result){
|
||||
return x;
|
||||
}
|
||||
|
||||
function GetDayStringFromDate(thedate) {
|
||||
var date = thedate.split(" ")[0];
|
||||
var time = thedate.split(" ")[1];
|
||||
|
||||
var day = date.split("-")[2];
|
||||
var month = date.split("-")[1];
|
||||
var year = String(parseInt(date.split("-")[0]) + 543);
|
||||
|
||||
var hour = time.split(":")[0];
|
||||
var minute = time.split(":")[1];
|
||||
|
||||
return "วันที่ "+day+"/"+month+"/"+year+" เวลา "+hour+"."+minute+" น."
|
||||
}
|
||||
|
||||
function GetNoti(noti_url, mynoti, root) {
|
||||
var refresh_noti = function (result) {
|
||||
//console.log(result);
|
||||
console.log(result);
|
||||
//console.log(result.unread.length);
|
||||
|
||||
var dropdown = "";
|
||||
@@ -586,17 +600,19 @@ function GetNoti(noti_url, mynoti, root) {
|
||||
if (result.unread.length > 0) {
|
||||
tag += '<li><p class="red">แจ้งเตือนมาใหม่</p></li>';
|
||||
$.each(result.unread, function (i, data) {
|
||||
tag += '<li><a href="javascript:window_open_from_root(' + temp + root + '/read_notification_url/' + data.id + '?url=' + data.data.url + temp +');"><div class="badge-noti">New</div><span class="message">' + data.data.title+'</span><span class="time"> วันที่ 16/02/2564 เวลา 16:02 น.</span></a></li>';
|
||||
tag += '<li><a href="javascript:window_open_from_root(' + temp + root + '/read_notification_url/' + data.id + '?url=' + data.data.url + temp + ');"><div class="badge-noti">New</div><span class="message">' + data.data.title + '</span><span class="time"> ' + GetDayStringFromDate(data.created_at)+'</span></a></li>';
|
||||
});
|
||||
}
|
||||
|
||||
if (result.readed.length > 0) {
|
||||
tag += '<li><p class="green">แจ้งเตือนที่อ่านแล้ว</p></li>';
|
||||
$.each(result.readed, function (i, data) {
|
||||
tag += '<li><a href="javascript:window_open_from_root(' + temp + root + '/read_notification_url/' + data.id + '?url=' + data.data.url + temp +');"><span class="message">' + data.data.title +'</span><span class="time"> วันที่ 16/02/2564 เวลา 16:02 น.</span></a></li>';
|
||||
tag += '<li><a href="javascript:window_open_from_root(' + temp + root + '/read_notification_url/' + data.id + '?url=' + data.data.url + temp + ');"><span class="message">' + data.data.title + '</span><span class="time"> ' + GetDayStringFromDate(data.created_at) +'</span></a></li>';
|
||||
});
|
||||
}
|
||||
|
||||
tag += '<li style="margin-bottom: -8px; text-align: center;"><a href="javascript:window_open_from_root('+temp+root+'/notifications'+temp+');">ดูทั้งหมด</a ></li >';
|
||||
|
||||
tag += '</ul>';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user