From 6faa6a11efe46b0c4d7d82b090a3531879d18642 Mon Sep 17 00:00:00 2001 From: Shailesh-1981 <86923815+Shailesh-1981@users.noreply.github.com> Date: Wed, 5 Jun 2024 14:59:33 +0530 Subject: [PATCH] fixing user notification --- .../Frontend/ProfileController.php | 71 ++++--- app/helper.php | 4 +- public/assets/css/FrontendCss/style.css | 126 +++++++++++ public/assets/css/FrontendCss/style2.css | 130 ++++++++++++ .../private-equity-fund-product.blade.php | 4 +- resources/views/Frontend/footer.blade.php | 56 ++++- .../views/Frontend/menu-after-lg.blade.php | 199 +++++++++++++++--- routes/web.php | 1 + 8 files changed, 528 insertions(+), 63 deletions(-) diff --git a/app/Http/Controllers/Frontend/ProfileController.php b/app/Http/Controllers/Frontend/ProfileController.php index e7263bc..2a5c1cf 100644 --- a/app/Http/Controllers/Frontend/ProfileController.php +++ b/app/Http/Controllers/Frontend/ProfileController.php @@ -177,7 +177,6 @@ class ProfileController extends Controller 'email_otp' => $emailotp, 'mobile_otp' => $otp ]); - } else if ($addUser && $user->email != $request->email) { //update $validator = validator::make($request->all(), [ @@ -207,7 +206,6 @@ class ProfileController extends Controller ); return response()->json(['status' => 200, 'message' => 'Details Updated Successfully!', 'email_otp' => $emailotp]); - } else if ($addUser && $user->contact_number != $request->contact_number) { //mobile no, @@ -230,7 +228,6 @@ class ProfileController extends Controller ] ); return response()->json(['status' => 200, 'message' => 'Details Updated Successfully!', 'mobile_otp' => $otp]); - } if ($addUser) { return response()->json(['status' => 200, 'message' => 'Details Updated Successfully!']); @@ -247,18 +244,18 @@ class ProfileController extends Controller $userOtpData = UserOtpModel::where('user_id', $userId)->first(); $userData = User::where('id', $userId)->first(); - + if (!$userOtpData || !$userData) { return response()->json(['status' => 400, 'message' => 'User Data Not Found in database'], 400); } - + if ($isVerificationFor == 1) { $emailOtp = $request->email_otp; $emailToUpdate = $request->email; - $userOtpData = UserOtpModel::where('user_id', $userId)->where('email_otp',$emailOtp)->first(); + $userOtpData = UserOtpModel::where('user_id', $userId)->where('email_otp', $emailOtp)->first(); if (!$userOtpData) { return response()->json(['status' => 400, 'message' => 'OTP Did Not Matched!'], 400); } @@ -267,13 +264,13 @@ class ProfileController extends Controller } $userData->email = $emailToUpdate; - $userData->save(); - } + $userData->save(); + } if ($isVerificationFor == 2) { $contactOtp = $request->contact_otp; $contactToUpdate = $request->contact_no; - $userOtpData = UserOtpModel::where('user_id', $userId)->where('contact_otp',$contactOtp)->first(); + $userOtpData = UserOtpModel::where('user_id', $userId)->where('contact_otp', $contactOtp)->first(); if (!$userOtpData) { return response()->json(['status' => 400, 'message' => 'OTP Did Not Matched!'], 400); } @@ -282,12 +279,9 @@ class ProfileController extends Controller } $userData->contact_number = $contactToUpdate; - $userData->save(); - - + $userData->save(); } return response()->json(['status' => 200, 'message' => 'Your OTP verified Successfully!']); - } catch (\Exception $e) { return response()->json(['status' => 400, 'message' => 'Error Updating Details!'], 400); } @@ -295,14 +289,13 @@ class ProfileController extends Controller public function resendOtpForProfileUpdate(Request $request) { - try{ + try { $type = $request->type; $user_id = request()->user()->id; $credential = $request->credential; - $otp = rand(1000,9999); + $otp = rand(1000, 9999); // $getUser = User::find($user_id); - if($type == 1) - { + if ($type == 1) { // type 1 for email otp // $email = $getUser->email; $mailData = [ @@ -310,17 +303,15 @@ class ProfileController extends Controller 'body' => 'This is for testing email using smtp.' ]; Mail::to($credential)->send(new OtpMail($mailData, $otp)); - UserOtpModel::where('user_id', $user_id)->update(['email_otp'=> $otp, 'expire_at'=>Carbon::now()->addMinutes(2)]); - } - else if($type == 2) - { + UserOtpModel::where('user_id', $user_id)->update(['email_otp' => $otp, 'expire_at' => Carbon::now()->addMinutes(2)]); + } else if ($type == 2) { // $mobileNumber = $getUser->contact_number; $this->thirdPartyOTP($credential, $otp); - UserOtpModel::where('user_id', $user_id)->update(['contact_otp'=> $otp,'expire_at'=>Carbon::now()->addMinutes(2)]); + UserOtpModel::where('user_id', $user_id)->update(['contact_otp' => $otp, 'expire_at' => Carbon::now()->addMinutes(2)]); } return response()->json([ - 'status'=>200, - 'message'=>'OTP has been send', + 'status' => 200, + 'message' => 'OTP has been send', ]); } catch (\Exception $e) { return response()->json(['message' => $e->getMessage()], 400); @@ -507,4 +498,36 @@ class ProfileController extends Controller } return response()->json(['status' => 201, 'message' => 'Please enter OTP']); } + + public function readNotification(Request $request) + { + + $id = $request->id; + // dd(Auth::guard('users')->user()); + // dd(getAllNotifications()); + if ($id) { + Auth::guard('users')->user()->unreadNotifications->where('id', $id)->markAsRead(); + } + $notifications = Auth::guard('users')->user()->notifications; + // dd($notifications); + $notificationHTML = ''; + $count = 0; + foreach ($notifications as $data) { + $count++; + $read_at = $data->read_at ? 'style="color:#808080"' : 'style="color:black"'; + $oddEven = $count % 2 == 1 ? 'odd' : 'even'; + // $notificationHTML .= "
  • + $notificationHTML .= "
  • + " . $data->data['message'] . " +

    + " . $data->created_at->diffForHumans() . " +

    +
    +
  • "; + } + if ($notificationHTML) { + return response()->json(['status' => 200, 'data' => $notificationHTML, 'count'=>Auth::guard('users')->user()->unreadNotifications->count()]); + } + } } diff --git a/app/helper.php b/app/helper.php index ad011bc..9e693da 100644 --- a/app/helper.php +++ b/app/helper.php @@ -258,7 +258,9 @@ function termsConditions() function getAllNotifications() { $user = User::find(auth()->guard('users')->user()->id); - return $user->unreadNotifications; + + // dd($user->unreadNotifications); + return $user->notifications; } function getAllAdminNotifications() diff --git a/public/assets/css/FrontendCss/style.css b/public/assets/css/FrontendCss/style.css index 4840c47..eda64d0 100644 --- a/public/assets/css/FrontendCss/style.css +++ b/public/assets/css/FrontendCss/style.css @@ -5744,3 +5744,129 @@ span.color-red { margin-bottom: 42px; text-align: center; } +.notification-drop { + font-family: 'Ubuntu', sans-serif; + color: #444; +} +.notification-drop .item { + padding: 10px; + font-size: 18px; + position: relative; + border-bottom: 1px solid #ddd; +} +.notification-drop .item:hover { + cursor: pointer; +} +.notification-drop .item i { + margin-left: 10px; +} +.notification-drop .item ul { + display: none; + position: absolute; + top: 100%; + background: #fff; + left: -200px; + right: 0; + z-index: 1; + border-top: 1px solid #ddd; +} +.notification-drop .item ul li { + font-size: 16px; + padding: 15px 0 15px 25px; +} +.notification-drop .item ul li:hover { + background: #ddd; + color: rgba(0, 0, 0, 0.8); +} + +@media screen and (min-width: 500px) { + .notification-drop { + display: flex; + justify-content: flex-end; + } + .notification-drop .item { + border: none; + } +} + + + +.notification-bell{ + font-size: 20px; +} + +.btn__badge { + background: #FF5D5D; + color: white; + font-size: 12px; + position: absolute; + top: 0; + right: 0px; + padding: 3px 10px; + border-radius: 50%; +} + +.pulse-button { + box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.5); + -webkit-animation: pulse 1.5s infinite; +} + +.pulse-button:hover { + -webkit-animation: none; +} + +@-webkit-keyframes pulse { + 0% { + -moz-transform: scale(0.9); + -ms-transform: scale(0.9); + -webkit-transform: scale(0.9); + transform: scale(0.9); + } + 70% { + -moz-transform: scale(1); + -ms-transform: scale(1); + -webkit-transform: scale(1); + transform: scale(1); + box-shadow: 0 0 0 50px rgba(255, 0, 0, 0); + } + 100% { + -moz-transform: scale(0.9); + -ms-transform: scale(0.9); + -webkit-transform: scale(0.9); + transform: scale(0.9); + box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); + } +} + +.notification-text{ + font-size: 14px; + font-weight: bold; +} + +.notification-text span{ + float: right; +} +.notifications img { + width: 36px !IMPORTANT; + filter: brightness(0) invert(1); +} + +.notifications li.item { + list-style: none; +} +ul.notification-drop { + padding: 0; +} +.notifications .item ul { + padding: 20px; + background: #fff; + position: absolute; + width: 400px; + border-radius: 5px; + top: 65px; + right: -11rem; +} + +.notifications .item ul li { + list-style: none; +} \ No newline at end of file diff --git a/public/assets/css/FrontendCss/style2.css b/public/assets/css/FrontendCss/style2.css index 92087aa..1d07209 100644 --- a/public/assets/css/FrontendCss/style2.css +++ b/public/assets/css/FrontendCss/style2.css @@ -20,7 +20,137 @@ .works-section-inner ul { margin: 0; } +.notification-drop { + font-family: 'Ubuntu', sans-serif; + color: #444; + } + .notification-drop .item { + padding: 10px; + font-size: 18px; + position: relative; + border-bottom: 1px solid #ddd; + } + .notification-drop .item:hover { + cursor: pointer; + } + .notification-drop .item i { + margin-left: 10px; + } + .notification-drop .item ul { + display: none; + position: absolute; + top: 100%; + background: #fff; + left: -200px; + right: 0; + z-index: 1; + border-top: 1px solid #ddd; + } + .notification-drop .item ul li { + font-size: 16px; + padding: 15px 0 15px 25px; + } + .notification-drop .item ul li:hover { + background: #ddd; + color: rgba(0, 0, 0, 0.8); + } + + @media screen and (min-width: 500px) { + .notification-drop { + display: flex; + justify-content: flex-end; + } + .notification-drop .item { + border: none; + } + } + + + + .notification-bell{ + font-size: 20px; + } + + .btn__badge { + background: #FF5D5D; + color: white; + font-size: 12px; + position: absolute; + top: 9px; + right: 4px; + padding: 0 5px; + border-radius: 50%; + width: 20px; + height: 20px; + display: flex; + align-items: center; + justify-content: center; +} + .pulse-button { + box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.5); + -webkit-animation: pulse 1.5s infinite; + } + + .pulse-button:hover { + -webkit-animation: none; + } + + @-webkit-keyframes pulse { + 0% { + -moz-transform: scale(0.9); + -ms-transform: scale(0.9); + -webkit-transform: scale(0.9); + transform: scale(0.9); + } + 70% { + -moz-transform: scale(1); + -ms-transform: scale(1); + -webkit-transform: scale(1); + transform: scale(1); + box-shadow: 0 0 0 50px rgba(255, 0, 0, 0); + } + 100% { + -moz-transform: scale(0.9); + -ms-transform: scale(0.9); + -webkit-transform: scale(0.9); + transform: scale(0.9); + box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); + } + } + + .notification-text{ + font-size: 14px; + font-weight: bold; + } + + .notification-text span{ + float: right; + } + .notifications img { + width: 36px !IMPORTANT; + filter: brightness(0) invert(1); +} +.notifications li.item { + list-style: none; +} + +.notifications .item ul { + padding: 20px; + background: #fff; + position: absolute; + width: 400px; + border-radius: 5px; + top: 65px; + right: -11rem; + height: 500px; + overflow-x: hidden; + overflow-y: auto; +} + +.notifications .item ul li { + list-style: none; +} .faq-ctn2 h2 { font-size: 35px; font-weight: 600; diff --git a/resources/views/Frontend/Pages/alternative-investment-fund/private-equity-fund-product.blade.php b/resources/views/Frontend/Pages/alternative-investment-fund/private-equity-fund-product.blade.php index 7221e55..b4dca97 100644 --- a/resources/views/Frontend/Pages/alternative-investment-fund/private-equity-fund-product.blade.php +++ b/resources/views/Frontend/Pages/alternative-investment-fund/private-equity-fund-product.blade.php @@ -313,10 +313,10 @@

    Other expenses

    {{ $privateEquityFund->other_expenses ?? '-' }} -
    + {{--

    Company

    {{ $privateEquityFund->company->company_name ?? '-' }} -
    +
    --}} diff --git a/resources/views/Frontend/footer.blade.php b/resources/views/Frontend/footer.blade.php index 398c5b8..696dd37 100644 --- a/resources/views/Frontend/footer.blade.php +++ b/resources/views/Frontend/footer.blade.php @@ -239,9 +239,9 @@ @@ -256,7 +256,7 @@ {{-- --}} - + - // $('#get_deactivate_popup').on('click', function(){ // var userStatus = $('#get_user_status').val(); @@ -292,10 +291,9 @@ // $('#dashboard_modal').modal('show'); // } // }); - - - function showDeactivatePopup(id) - { + + + function showDeactivatePopup(id) { var userStatus = $('#get_user_status').val(); // Convert userStatus to a number @@ -309,7 +307,7 @@ } // alert(id); } - + // $(document).ready(function() { // var firstTime = true; var checkLogin = $('#check_user_login').val(); @@ -380,7 +378,7 @@ }); }); - $('#log_out').on('click',function(){ + $('#log_out').on('click', function() { sessionStorage.removeItem('route'); }) @@ -509,6 +507,33 @@ crossorigin="anonymous" referrerpolicy="no-referrer"> + + @yield('scripts') diff --git a/resources/views/Frontend/menu-after-lg.blade.php b/resources/views/Frontend/menu-after-lg.blade.php index 34e3794..9e59efd 100644 --- a/resources/views/Frontend/menu-after-lg.blade.php +++ b/resources/views/Frontend/menu-after-lg.blade.php @@ -368,13 +368,15 @@
  • - @if(!auth()->guard('users')->check()) - List Your Asset + @if (!auth()->guard('users')->check()) + List Your Asset @else - List Your Asset + List Your + Asset @endif
  • - {{-- href="{{ route('market-list') }}" --}} + {{-- href="{{ route('market-list') }}" --}} @@ -382,7 +384,7 @@
  • Login
  • @else
  • - + --}} + {{-- --}} +
    + +
    -