From b92cc09bf351addbd3c26cd556c3f8a9024ab6e1 Mon Sep 17 00:00:00 2001 From: Sai Sudheer Date: Thu, 1 Dec 2022 12:16:42 +0530 Subject: [PATCH] API's Notifications, tasks list Loading --- assets/css/list.page.css | 26 +++++++- assets/js/base.js | 52 +++++++++++++-- assets/js/list.index.js | 133 +++++++++++++++++++++++++++++++++----- authentication/index.html | 35 +--------- 4 files changed, 187 insertions(+), 59 deletions(-) diff --git a/assets/css/list.page.css b/assets/css/list.page.css index f173feb..80830c8 100644 --- a/assets/css/list.page.css +++ b/assets/css/list.page.css @@ -1,8 +1,8 @@ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap'); :root { --topNavHeight: 75px; - --rtrWidth: 60px; - --lftWidth: 300px; + --rtrWidth: 50px; + --lftWidth: 275px; --tpMenuPad: 30px; --icnPadng: 10px 0px; --prmBgColor: rgb(244, 244, 221); @@ -135,6 +135,7 @@ li.logo-li { .ctr-lst-pge { position: fixed; + z-index: 2; left: var(--lftWidth); right: var(--rtrWidth); height: inherit; @@ -261,4 +262,23 @@ a.badge { } -/* Scroll bar End Here */ \ No newline at end of file +/* Scroll bar End Here */ + +.accordion-button::after { + background-size: 0.9rem !important; + ; +} + +a[role="button"]:focus { + box-shadow: none !important; +} + +#notifi-list .item-li:first .accordion-button:not(.collapsed) { + border-top-left-radius: var(--lstPgArc); + border-top-right-radius: var(--lstPgArc); +} + +input[type="checkbox"] { + box-shadow: none !important; + border-radius: 2px; +} \ No newline at end of file diff --git a/assets/js/base.js b/assets/js/base.js index e04bd0d..d59d3d6 100644 --- a/assets/js/base.js +++ b/assets/js/base.js @@ -1,4 +1,4 @@ -const serverUrl = 'https://test.bizgaze.app/'; +const serverUrl = 'https://c01.bizgaze.app/'; let _baseUserInfo = atob(document.cookie.split('=')[1]); let baseUserInfo = JSON.parse(_baseUserInfo).result; let baseSessionId = baseUserInfo.sessionId; @@ -25,12 +25,50 @@ function getData(url) { }); } -function formatLocal(dateTime) { - var date = moment.utc(dateTime).local(); - var difmonths = moment().diff(date, 'months'); +function getDataObj(url, data, async, type) { //url, data, true, "POST" - if (difmonths == 0) { - return this.formatPeriod(date); + let serviceurl = serverUrl + url; + return $.ajax({ + type: type, + url: serviceurl, + data: JSON.stringify(data), + contentType: 'application/json', + traditional: true, + crossDomain: true, + async: async, + beforeSend: function(xhr) { + if (baseUserInfo != undefined && baseUserInfo != null) { + xhr.setRequestHeader('Authorization', 'Basic ' + baseSessionId); + xhr.setRequestHeader('geoposition', 0 + ':' + 0); + } + } + }); +} + +function formatLocal(dateTime) { + var hou = new Date(dateTime).getHours(), + sec, min, day, month, years; + if (hou < 24) { + min = new Date(dateTime).getMinutes(); + if (min < 60) { + sec = new Date(dateTime).getSeconds(); + if (sec < 60) { + return sec + ' Seconds'; + } + } else { + return min + ' Minutes'; + } + return hou + ' Hours'; + } else { //24 > + day = new Date(dateTime).getHours(); + if (day > 31) { // 31 day + month = new Date(dateTime).getMonth(); + if (month > 12) { // 12 months + years = new Date(dateTime).getFullYear(); + return years + ' Years'; + } + return month + ' month'; + } + return day + ' day'; } - return date.format("DD MMM, YYYY HH:mm"); } \ No newline at end of file diff --git a/assets/js/list.index.js b/assets/js/list.index.js index 9357e75..a5a3cb8 100644 --- a/assets/js/list.index.js +++ b/assets/js/list.index.js @@ -14,27 +14,126 @@ $('.uindtls').html(usrinfoHTML) // List Page loading getData('apis/v4/unibase/reminders/platform/getunreadreminders/ReminderType/6/PageSize/20').then(function(result) { let response = JSON.parse(result.result); - let bdyUI = ''; - for (var i = 0; i < response.length; i++) { - bdyUI += `
  • - -
    -
    -
    - ${response[i].Subject} - ${response[i].Message} + if (response.length != 0) { // Notifcations + let bdyUI = '
    '; + for (var i = 0; i < response.length; i++) { + bdyUI += `
  • +
    + +
    +
    + +
    -
    -
    - 21 days - Mark as read -
    - -
  • `; + `; + } + bdyUI += '' + $('.bdy-ul').append(bdyUI); + $('.notifiListItms').on('click', function() { + let _this = $(this).parents('.item-li'); + let obj = { "FromDate": "2022/11/30", "InstalledAppId": Number($(_this).attr('data-installedAppId')), "RecordId": Number($(_this).attr('data-ref')), "ToDate": "2022/11/30" }; + //let obj = { "FromDate": "2022/11/30", "InstalledAppId": 102530270000109, "RecordId": 102533490346298, "ToDate": "2022/11/30" }; + getDataObj('apis/v4/unibase/platform/widgets/getdefaultwidget', obj, true, "POST").then(function(response) { + let res = JSON.parse(response.result), + html = ''; + if (response.message == '200' && response.errors == null) { + html = ``; + } else { + html += `` + } + $(_this).find('.accordion-body').html(html); + }); + }) } - $('.bdy-ul').html(bdyUI); }) +getData('apis/v4/unibase/reminders/platform/getunreadreminders/ReminderType/1/PageSize/20').then(function(tskResp) { + let response = JSON.parse(tskResp.result) + if (response.length != 0) { + let _tskhtml = '
    '; + for (var i = 0; i < response.length; i++) { + _tskhtml += `
  • +
    + +
    +
    +
      +
    • Confirm
    • +
    • Reject
    • +
    • Close
    • +
    +
    +
    +
    +
  • `; + } + _tskhtml += '
    ' + $('.bdy-ul').append(_tskhtml); + } +}); /*Data loading start here*/ $('.mnNvIcn').click(function() { diff --git a/authentication/index.html b/authentication/index.html index da500a2..00d34a3 100644 --- a/authentication/index.html +++ b/authentication/index.html @@ -68,36 +68,7 @@
    @@ -112,7 +83,7 @@ - - + + \ No newline at end of file