Browse Source

notification view all page

feature/19315_Customer-Registration
Leeza Baidar 12 months ago
parent
commit
36e577198a
  1. 3
      CustomerOnlineV2/CustomerOnlineV2.Business/Business/RegisterBusiness/IRegisterBusiness.cs
  2. 7
      CustomerOnlineV2/CustomerOnlineV2.Business/Business/RegisterBusiness/RegisterBusiness.cs
  3. 4
      CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/RegisterRepository/IRegisterRepository.cs
  4. 64
      CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/RegisterRepository/RegisterRepository.cs
  5. 19
      CustomerOnlineV2/CustomerOnlineV2/Controllers/CustomerController.cs
  6. 170
      CustomerOnlineV2/CustomerOnlineV2/Views/Customer/Notifications.cshtml
  7. 4
      CustomerOnlineV2/CustomerOnlineV2/Views/Home/Index.cshtml
  8. 2
      CustomerOnlineV2/CustomerOnlineV2/Views/Shared/_Layout.cshtml
  9. 88
      CustomerOnlineV2/CustomerOnlineV2/Views/Shared/_Layout2.cshtml

3
CustomerOnlineV2/CustomerOnlineV2.Business/Business/RegisterBusiness/IRegisterBusiness.cs

@ -1,4 +1,6 @@
using CustomerOnlineV2.Common.Models;
using CustomerOnlineV2.Common.Models.AccountModel;
using CustomerOnlineV2.Common.Models.HomeModel;
using CustomerOnlineV2.Common.Models.RegisterModel;
using System;
using System.Collections.Generic;
@ -12,5 +14,6 @@ namespace CustomerOnlineV2.Business.Business.RegisterBusiness
{
Task<CommonResponse> AddCustomers(OnlineCustomerRegisterModel register);
Task<AddressListResponse> GetAddressList(AddressRequest addressRequest);
Task<CustomerNotificationModel> GetAllNotificationDetails(LoginResponse loginDetails);
}
}

7
CustomerOnlineV2/CustomerOnlineV2.Business/Business/RegisterBusiness/RegisterBusiness.cs

@ -1,5 +1,7 @@
using CustomerOnlineV2.Api.API.TPApi;
using CustomerOnlineV2.Common.Models;
using CustomerOnlineV2.Common.Models.AccountModel;
using CustomerOnlineV2.Common.Models.HomeModel;
using CustomerOnlineV2.Common.Models.RegisterModel;
using CustomerOnlineV2.Repository.Repository.RegisterRepository;
using Microsoft.Extensions.Logging;
@ -37,5 +39,10 @@ namespace CustomerOnlineV2.Business.Business.RegisterBusiness
{
throw new NotImplementedException();
}
public async Task<CustomerNotificationModel> GetAllNotificationDetails(LoginResponse loginDetails)
{
return (CustomerNotificationModel)await _registerRepository.GetAllNotificationDetails(loginDetails);
}
}
}

4
CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/RegisterRepository/IRegisterRepository.cs

@ -1,4 +1,6 @@
using CustomerOnlineV2.Common.Models;
using CustomerOnlineV2.Common.Models.AccountModel;
using CustomerOnlineV2.Common.Models.HomeModel;
using CustomerOnlineV2.Common.Models.RegisterModel;
using System;
using System.Collections.Generic;
@ -11,5 +13,7 @@ namespace CustomerOnlineV2.Repository.Repository.RegisterRepository
public interface IRegisterRepository
{
Task<CommonResponse> AddRegisterDetails(OnlineCustomerRegisterModel register);
// Task<CommonResponse> AddRegisterDetails(LoginResponse loginDetails);
Task<CustomerNotificationModel> GetAllNotificationDetails(LoginResponse loginDetails);
}
}

64
CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/RegisterRepository/RegisterRepository.cs

@ -1,8 +1,13 @@
using CustomerOnlineV2.Common.Models;
using CustomerOnlineV2.Common.Models.AccountModel;
using CustomerOnlineV2.Common.Models.HomeModel;
using CustomerOnlineV2.Common.Models.RegisterModel;
using CustomerOnlineV2.Repository.ConnectionHelper;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
@ -13,9 +18,11 @@ namespace CustomerOnlineV2.Repository.Repository.RegisterRepository
public class RegisterRepository : IRegisterRepository
{
private readonly IConnectionHelper _connHelper;
private readonly ILogger<RegisterRepository> _logger;
public RegisterRepository(IConnectionHelper connHelper)
public RegisterRepository(ILogger<RegisterRepository> logger, IConnectionHelper connHelper)
{
_logger = logger;
_connHelper = connHelper;
}
@ -86,5 +93,60 @@ namespace CustomerOnlineV2.Repository.Repository.RegisterRepository
return await Task.FromResult(model);
}
public async Task<CustomerNotificationModel> GetAllNotificationDetails(LoginResponse loginDetails)
{
CustomerNotificationModel _response = new CustomerNotificationModel();
try
{
var sql = "EXEC proc_getNotifyInfo";
sql += " @Flag = " + _connHelper.FilterString("notificationDetail-portal");
// sql += ",@User = " + _connHelper.FilterString(loginDetails.UserName);
sql += ",@customerId = " + _connHelper.FilterString(loginDetails.UserId);
_logger.LogDebug("HOMEREPOSITORY | GETCUSTOMERNOTIFLIST | SQL | " + sql);
var dt = _connHelper.ExecuteDataTable(sql);
if (dt == null || dt.Rows.Count <= 0)
{
_response.ResponseCode = ResponseHelper.FAILED;
_response.ResponseMessage = "DB Null Error!";
_logger.LogError("HOMEREPOSITORY | GETCUSTOMERNOTIFLIST | DB RESPONSE | " + JsonConvert.SerializeObject(_response));
}
else
{
_response.ResponseCode = Convert.ToInt16(dt.Rows[0]["errorCode"]);
_response.ResponseMessage = Convert.ToString(dt.Rows[0]["msg"]);
List<NotificationModel> obj = new List<NotificationModel>();
foreach (DataRow item in dt.Rows)
{
obj.Add(new NotificationModel
{
//Id = Convert.ToString(item["rowId"]),
Title = Convert.ToString(item["title"]),
Body = Convert.ToString(item["body"]),
Date = Convert.ToString(item["createDate"]),
//IsRead = Convert.ToString(item["isRead"]),
//Type = Convert.ToString(item["type"]),
//SentId = Convert.ToString(item["sentId"]),
// Category = Convert.ToString(item["category"]),
//url = Convert.ToString(item["url"]),
//IsClickable = Convert.ToString(item["isClickable"])
// notificationCount = Convert.ToString(item["notificationCount"])
});
}
_response.NotificationModel = obj;
}
}
catch (Exception ex)
{
_response.ResponseCode = ResponseHelper.EXCEPTION;
_response.ResponseMessage = "Exception occured: " + ex.Message;
_logger.LogError("HOMEREPOSITORY | GETCUSTOMERNOTIFLIST | EXCEPTION | " + JsonConvert.SerializeObject(_response));
}
return await Task.FromResult(_response);
}
}
}

19
CustomerOnlineV2/CustomerOnlineV2/Controllers/CustomerController.cs

@ -2,12 +2,15 @@
using CustomerOnlineV2.Authorization;
using CustomerOnlineV2.Business.Business.RegisterBusiness;
using CustomerOnlineV2.Common.Models;
using CustomerOnlineV2.Common.Models.HomeModel;
using CustomerOnlineV2.Common.Models.ReceiverModel;
using CustomerOnlineV2.Common.Models.RegisterModel;
using CustomerOnlineV2.Common.Models.TransactionModel;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Serilog.Context;
using CustomerOnlineV2.Common.Helper;
namespace CustomerOnlineV2.Controllers
{
@ -76,5 +79,21 @@ namespace CustomerOnlineV2.Controllers
{
return View();
}
[Authorization("Notifications")]
public IActionResult Notifications()
{
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
[Authorization("GetAllNotifications")]
public async Task<CustomerNotificationModel> GetAllNotifications()
{
var loginDetails = HttpContext.GetLoginDetails();
return await _registerBusiness.GetAllNotificationDetails(loginDetails);
}
}
}

170
CustomerOnlineV2/CustomerOnlineV2/Views/Customer/Notifications.cshtml

@ -0,0 +1,170 @@
@using CustomerOnlineV2.Common.Helper
@{
Layout = "_Layout2";
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, shrink-to-fit=no" />
</head>
<body>
<!-- Preloader -->
<div id="preloader">
<div data-loader="dual-ring"></div>
</div>
<!-- Preloader End -->
<!-- Document Wrapper -->
<div id="main-wrapper">
<!-- Content -->
<div id="content">
<!-- Who we are -->
<section class="section section-form-bg">
<div class="container">
<!-- My Receiver Activity
=============================== -->
<div class="bg-white rounded py-4 mb-4">
<!-- Title
=============================== -->
<div class="transaction-title py-2 px-4">
<div class="row fw-00">
<div class="col-1 col-sm-4">Title</div>
<div class="col-2 col-sm-2">Message </div>
<div class="col-2 col-sm-2">Date </div>
@* <div class="col-3 col-sm-2 d-none d-sm-block text-center">Date</div>
<div class="col-4 col-sm-2 text-end">Transaction Type</div> *@
</div>
</div>
<!-- Title End -->
<!-- My Receiver List
=============================== -->
<div class="transaction-list">
<div class="transaction-item px-4 py-3" data-bs-toggle="modal" data-bs-target="#transaction-detail">
<div class="row align-items-center flex-row">
<div class="col-1 col-sm-4"> <span class="d-block text-1" id="title"></span></div>
<div class="col-2 col-sm-2"> <span class="d-block text-1" id="body"></span></div>
<div class="col-2 col-sm-2"> <span class="d-block text-1" id="date"></span></div>
@* <div class="col-3 col-sm-2 d-none d-sm-block text-center text-1" id="pCountry"></div>
<div class="col-4 col-sm-2 text-end text-1" id="paymentMethod"> <span class="text-nowrap"></span></div> *@
</div>
</div>
</div>
<!-- My Receiver List End -->
</div>
</section>
<!-- Who we are end -->
</div>
<!-- Content end -->
<!-- Footer -->
<footer id="footer" class="footer-web">
<div class="container">
<div class="text-center">
<div class="row">
<div class="mx-auto">
<div class="text-center text-white">
<p class="text-center mb-3 text-1">
IME London is a product of Subhida UK Limited, Pentax House,South Hill Avenue, South Harrow, London, H2A 0D
Company Registration No. 06432399 Subhida UK Ltd is authorized and regulated by the Financial Conduct
Authority (FCA) <br> under the Payment Service Regulations 2017. FCA Registration No. 576127 HMRC Registration No. XYML000000119350
<p class="text-center my-3 text-1"></p>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 mx-auto">
<div class="text-center text-white">
<p>© IME London, 2023</p>
</div>
</div>
</div>
</div>
</div>
</footer>
<!-- Footer end -->
</div>
<!-- Document Wrapper end -->
<!-- Back to Top
============================================= -->
<a id="back-to-top" data-bs-toggle="tooltip" title="Back to Top" href="javascript:void(0)"><i class="fa fa-chevron-up"></i></a>
</body>
</html>
@section scripts{
<script>
$(document).ready(function () {
getNotificationDetails();
});
function getNotificationDetails() {
debugger
$.ajax({
type: 'POST',
// url: '/ReceiverInformation/GetAllReceiver',
url: '/Customer/GetAllNotifications',
data: {},
processData: true,
headers: {
"RequestVerificationToken":
$('input[name="__RequestVerificationToken"]').val()
},
async: false,
success: function (response) {
debugger;
// if (response.responsecode != 0) {
// showalertmessage(response.responsecode, response.responsemessage);
// }
PopulateNotifications(response);
},
error: function () {
return null;
}
});
}
function PopulateNotifications(response) {
debugger
var result = response.notificationModel;
console.log('Received response:', result);
if (response.responseCode == 0) {
var transactionList = $(".transaction-list");
transactionList.empty();
$.each(result, function (i, d) {
var row = `
<div class="transaction-item px-4 py-2" data-bs-toggle="modal" data-bs-target="#transaction-detail">
<div class="row align-items-center flex-row">
<div class="col-1 col-sm-3"><span class="d-block text-1">${d.title}</span></div>
<div class="col-1 col-sm-3"><span class="d-block text-1">${d.body}</span></div>
<div class="col-1 col-sm-3"><span class="d-block text-1">${d.date}</span></div>
</div>
</div>`;
transactionList.append(row);
});
}
}
</script>
}

4
CustomerOnlineV2/CustomerOnlineV2/Views/Home/Index.cshtml

@ -30,7 +30,7 @@
</a>
</div>
</div>
<div class="col-sm-6 col-md-3">
@* <div class="col-sm-6 col-md-3">
<div class="border rounded text-center">
<a href="#">
<span class="d-block text-10 text-light mt-1 mb-1"><img src="images/menu2.jpg" height="80"></span>
@ -77,7 +77,7 @@
<p class="text-2 text-strong">Bill Payment</p>
</a>
</div>
</div>
</div> *@
<div class="col-sm-6 col-md-3">
<div class="border rounded text-center">
<a href="#">

2
CustomerOnlineV2/CustomerOnlineV2/Views/Shared/_Layout.cshtml

@ -99,7 +99,7 @@
</li>
<li class="dropdown-divider mx-n3"></li>
<li><a class="dropdown-item text-center text-primary px-0" href="notifications.html">See all Notifications</a></li>
<li><a class="dropdown-item text-center text-primary px-0" href="/Customer/Notifications">See all Notifications</a></li>
</ul>
</li>
<li class="dropdown profile ms-2">

88
CustomerOnlineV2/CustomerOnlineV2/Views/Shared/_Layout2.cshtml

@ -81,22 +81,25 @@
<li><a class="dropdown-item" href="#">French</a></li>
</ul>
</li>
<li class="dropdown notifications">
<li class="dropdown notifications" id="notification">
<a class="dropdown-toggle" href="#">
<span class="text-5"><i class="far fa-bell"></i></span><span class="count">3</span>
<span class="text-5"><i class="far fa-bell"></i></span><span class="count" id="count"></span>
</a>
<ul class="dropdown-menu">
<li class="text-center text-3 py-2">Notifications (3)</li>
<li class="text-center text-3 py-2" id="notifCount"></li>
<li class="dropdown-divider mx-n3"></li>
<li>
<a class="dropdown-item" href="#"><i class="fas fa-bell"></i>A new digital FIRC document is available for you to download<span class="text-1 text-muted d-block">22 Jul 2021</span></a>
<a class="dropdown-item" href="#" id="notificationDetail">
<div class="notification-item">
<div class="notification-date" id="date"></div>
<div class="notification-title" id="title"></div>
<div class="notification-body" id="body"></div>
</div>
</a>
</li>
<li>
<a class="dropdown-item" href="#"><i class="fas fa-bell"></i>Updates to our privacy policy. Please read.<span class="text-1 text-muted d-block">04 March 2021</span></a>
</li>
<li class="dropdown-divider mx-n3"></li>
<li><a class="dropdown-item text-center text-primary px-0" href="notifications.html">See all Notifications</a></li>
<li><a class="dropdown-item text-center text-primary px-0" href="/Customer/Notifications">See all Notifications</a></li>
</ul>
</li>
<li class="dropdown profile ms-2">
@ -165,6 +168,73 @@
let errorMsg = '@errorMessage';
let errorCode = '@errorCode';
ShowAlertMessage(errorCode, errorMsg);
$(document).ready(function () {
GetNotificationList();
});
function GetNotificationList() {
debugger
$.ajax(
{
type: 'POST',
url: '/Home/GetNotificationList',
data: {},
processData: true,
headers: {
"RequestVerificationToken":
$('input[name="__RequestVerificationToken"]').val()
},
async: false,
success: function (response) {
debugger
debugger
if (response.responseCode != 0) {
ShowAlertMessage(response.responseCode, response.responseMessage);
}
PopulateNotificationData(response);
},
error: function () {
return null;
}
});
}
function PopulateNotificationData(response) {
var result = response.notificationModel;
if (response.responseCode == 0) {
var notificationDetail = $('#notificationDetail');
var countElement = $('#count');
var notificationCount = response.notificationModel[0].notificationCount;
$('#count').text(notificationCount);
$('#notifCount').text('NOTIFICATIONS (' + notificationCount + ')');
notificationDetail.empty();
for (var i = 0; i < result.length; i++) {
var notification = result[i];
var notificationItem = $('<li>');
var notificationLink = $('<a>', {
'class': 'dropdown-item',
'href': '#'
});
var notificationContent = $('<div>', { 'class': 'notification-item' });
var notificationDate = $('<div>', { 'class': 'notification-date', 'id': 'date' }).text(notification.date);
var notificationTitle = $('<div>', { 'class': 'notification-title', 'id': 'title' }).text(notification.title);
var notificationBody = $('<div>', { 'class': 'notification-body', 'id': 'body' }).text(notification.body);
notificationContent.append(notificationDate, notificationTitle, notificationBody);
notificationLink.append(notificationContent);
notificationItem.append(notificationLink);
notificationDetail.append(notificationItem);
}
}
}
</script>
@await RenderSectionAsync("Scripts", required: false)
</body>
Loading…
Cancel
Save