From c93d4589f690d43408c121f8187d8d6ad856c248 Mon Sep 17 00:00:00 2001 From: iotcat Date: Sun, 23 Aug 2020 12:37:43 +0800 Subject: [PATCH] notice --- records.html | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/records.html b/records.html index 67de1fd..12b0110 100644 --- a/records.html +++ b/records.html @@ -214,7 +214,102 @@ $('#account-events').html(s); - + + var userNotice = []; + data['itemsByUser'][session.get('hash')].forEach((item)=>{ + if(!(item.state == '1')){ + userNotice.push(item); + } + }); + userNotice.reverse(); + + function notice(){ + var s = ''; + + if(!userNotice.length){ + s += ` +
  • +
    +
    +
    +
    You have NO notifications!!
    +
    +
    +
    + +
    +
    +
  • `; + $('#no-content').html(s); + $("#no-icon").attr("src", 'https://cdn.yimian.xyz/smart-settlement/img/content/notification-no.png'); + $("#no-icon2").attr("src", 'https://cdn.yimian.xyz/smart-settlement/img/content/notification2-no.png'); + return; + } + + + s += ` +
  • +
    +
    +
    +
    Your last `; + + s += userNotice.length; + s += ` notifications
    +
    +
    +
    + +
    +
    +
  • `; + + userNotice.forEach(function(item){ + s += ` +
  • +
    +
    +
    + +
    +
    +

    `; + + if(item.value < 0) s += `You will Get £`+Number(-item.value)+` from `+ data.usersName[item.comments] + ` `; + if(item.value > 0) s += `Please Give £`+Number(item.value)+` to `+ data.usersName[item.comments]; + + s += `

    + `; + s += timeago(new Date(item.created_at.replace(/-/g, '/')).getTime()); + s += ` +
    +
    +
    +
  • `; + }); + + s += ` +
  • + +
  • `; + + $('#no-content').html(s); + $("#no-icon").attr("src", 'https://cdn.yimian.xyz/smart-settlement/img/content/notification-yes.png'); + $("#no-icon2").attr("src", 'https://cdn.yimian.xyz/smart-settlement/img/content/notification2-yes.png'); + + }; + notice();