From 2c64ab88319ce0e0bed45600cc5129e55e7c065a Mon Sep 17 00:00:00 2001 From: sayliraut Date: Thu, 6 Jun 2024 13:01:39 +0530 Subject: [PATCH 1/3] change --- resources/views/Admin/pages/auth/login.blade.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/views/Admin/pages/auth/login.blade.php b/resources/views/Admin/pages/auth/login.blade.php index 8e9fa14..217671f 100644 --- a/resources/views/Admin/pages/auth/login.blade.php +++ b/resources/views/Admin/pages/auth/login.blade.php @@ -15,7 +15,7 @@ {{-- @include('admin.layouts.messages') --}}

WELCOME BACK

- @csrf + @csrf
@@ -97,7 +97,9 @@ if (response.status_code == 200) { toastr.success(response.message); - window.location.href = base_url + "/dashboard"; + setTimeout(function() { + window.location.href = base_url + "/dashboard"; + }, 2000); } else if (response.status_code == 401) { toastr.error(response.message); form.reset(); From 1fd511432bfd0de73a17df6f1ef93b625ed2de6b Mon Sep 17 00:00:00 2001 From: sayliraut Date: Thu, 6 Jun 2024 13:32:02 +0530 Subject: [PATCH 2/3] change --- resources/views/Admin/pages/auth/forgot_password.blade.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/views/Admin/pages/auth/forgot_password.blade.php b/resources/views/Admin/pages/auth/forgot_password.blade.php index 0494643..6047c12 100644 --- a/resources/views/Admin/pages/auth/forgot_password.blade.php +++ b/resources/views/Admin/pages/auth/forgot_password.blade.php @@ -70,10 +70,9 @@ $(document).on("click", "#forgot_password_btn", function (e) { if (response.status_code == 200) { form.reset(); toastr.success('Otp send it your mail id please check'); - setTimeout(function () { -// toastr.info('Please check your email to reset your password. The link is valid for 5 minutes.'); + setTimeout(function() { window.location.href = base_url + "/otp"; - }, 1000); + }, 2000); }else if (response.status == 404) { toastr.error('This email id is not exits'); } From 8bd146c62af263e81bd06956019469ef4b97a575 Mon Sep 17 00:00:00 2001 From: sayliraut Date: Thu, 6 Jun 2024 14:44:22 +0530 Subject: [PATCH 3/3] change --- app/Console/Commands/ReinstateRestaurant.php | 111 +++++++----------- .../Admin/ManageRestrauntController.php | 2 +- app/Http/Helpers/onesignalhelper.php | 3 +- 3 files changed, 47 insertions(+), 69 deletions(-) diff --git a/app/Console/Commands/ReinstateRestaurant.php b/app/Console/Commands/ReinstateRestaurant.php index bb4f108..7b0c926 100644 --- a/app/Console/Commands/ReinstateRestaurant.php +++ b/app/Console/Commands/ReinstateRestaurant.php @@ -29,83 +29,60 @@ class ReinstateRestaurant extends Command /** * Execute the console command. */ - public function handle() -{ - try { - $recordsToUpdate = RedeemRestaurant::where('is_redeem', 1)->get(); - foreach ($recordsToUpdate as $record) { - // Find restaurant - $managerestaurant = ManageRestaurant::where('id', $record->manage_restaurants_xid)->first(); + public function handle() + { + try { + $recordsToUpdate = RedeemRestaurant::where('is_redeem', 1)->get(); - // Fetch customer - $customerData = IamPrincipal::where('id', $record->iam_principal_xid) - ->where('notification_status', 1) - ->where('principal_type_xid', 3) - ->first(); + foreach ($recordsToUpdate as $record) { + //find restaurant + $managerestaurant = ManageRestaurant::where('id', $record->manage_restaurants_xid)->first(); - if ($managerestaurant && $managerestaurant->is_active == 1) { - $redeemDate = Carbon::parse($record->redeem_date); - $fourHourPlusTimeOfRecord = $redeemDate->copy()->addHours(4); - $currentTime = Carbon::now(); + $customerData = IamPrincipal::where('id', $record->iam_principal_xid)->where('notification_status', 1)->where('principal_type_xid',3)->first(); //fetch customer - if ($currentTime > $fourHourPlusTimeOfRecord) { - // Update record - $record->update([ - 'is_redeem' => 0, - 'redeem_date' => null, - 'count' => $record->count + 1, - 'is_redeemption_undone' => 0, - 'redeemption_undone_date' => null, - ]); + if ($managerestaurant && $managerestaurant->is_active == 1) { + $redeemDate = Carbon::parse($record->redeem_date); - // Prepare notification details - $restImage = ListingImageUrl('restaurant_images', $managerestaurant->image); - $title = "Your " . $managerestaurant->name . " Reinstate successfully"; - $message = "Your " . $managerestaurant->name . " Reinstate successfully"; - $content_type = 'Restaurant_Reinstate'; - $imageUrl = $restImage; + $fourHourPlusTimeOfRecord = $redeemDate->copy()->addHours(4); - // Send notification - $notificationSent = onesignalhelper::sendNotificationApi( - $customerData->one_signal_player_id, - $title, - $message, - $content_type, - $imageUrl, - $id = null - ); + $currentTime = Carbon::now(); - // Check if notification was sent successfully - if ($notificationSent) { - Log::info('Notification sent successfully to customer ID: ' . $customerData->id); + if ($currentTime > $fourHourPlusTimeOfRecord) { + $record->update([ + 'is_redeem' => 0, + 'redeem_date' => null, + 'count' => $record->count + 1, + 'is_redeemption_undone' => 0, + 'redeemption_undone_date' => null, + ]); + $restImage = ListingImageUrl('restaurant_images', $managerestaurant->image); + $title = "Your " . $managerestaurant->name . " Reinstate successfully"; + $message = "Your " . $managerestaurant->name . " Reinstate successfully"; + $content_type = 'Restaurant Reinstate'; + $imageUrl = $restImage; - // Store notification details - $notificationStored = onesignalhelper::StoreNotificationDetails( - $customerData->id, - $content_type, - $title, - $restImage - ); + onesignalhelper::sendNotificationApi( + $customerData->one_signal_player_id, + $title, + $message, + $content_type, + $imageUrl, + $id = null + ); + Log::info('Reinstate of record done at ' . now()); - if ($notificationStored) { - Log::info('Notification details stored successfully for customer ID: ' . $customerData->id); - } else { - Log::warning('Failed to store notification details for customer ID: ' . $customerData->id); - } - } else { - Log::warning('Failed to send notification to customer ID: ' . $customerData->id); - } + onesignalhelper::StoreNotificationDetails($customerData->id, $content_type, $title, $restImage); + } + } + } - Log::info('Reinstate of record done at ' . now()); - } - } - } + Log::info('Reinstate task ran successfully at ' . now()); + } catch (\Exception $e) { + Log::error('Reinstate function failed: ' . $e->getMessage()); + } + + } - Log::info('Reinstate task ran successfully at ' . now()); - } catch (\Exception $e) { - Log::error('Reinstate function failed: ' . $e->getMessage()); - } -} } diff --git a/app/Http/Controllers/Admin/ManageRestrauntController.php b/app/Http/Controllers/Admin/ManageRestrauntController.php index 48b82c0..91d3040 100644 --- a/app/Http/Controllers/Admin/ManageRestrauntController.php +++ b/app/Http/Controllers/Admin/ManageRestrauntController.php @@ -94,7 +94,7 @@ class ManageRestrauntController extends Controller $allCustomerOneSignalIds = IamPrincipal::select('id', 'one_signal_player_id')->where('is_active', 1)->where('notification_status', 1)->where('principal_type_xid', 3)->get(); $title = "New " . $restaurant->name . " is added"; $message = "New Restaurant is Now Live."; - $content_type = 'New_Restaurant_Added'; + $content_type = 'New Restaurant Added'; $imageUrl = $imagePath; foreach ($allCustomerOneSignalIds as $customerIdItem) { diff --git a/app/Http/Helpers/onesignalhelper.php b/app/Http/Helpers/onesignalhelper.php index 6f4366c..ca594b2 100644 --- a/app/Http/Helpers/onesignalhelper.php +++ b/app/Http/Helpers/onesignalhelper.php @@ -26,7 +26,8 @@ class onesignalhelper 'id' => $id, ], 'big_picture' => $imageUrl, - // 'app_id' => env('ONE_SIGNAL_APP_ID'), + + 'external_id' => [$playerId] // 'authorization' => env('ONE_SIGNAL_AUTHORIZE') ];