From d351eceba482783676540b2339899c52c1ce9ba8 Mon Sep 17 00:00:00 2001 From: sayliraut Date: Tue, 6 Aug 2024 14:48:59 +0530 Subject: [PATCH 1/6] changes --- .../APIs/CustomerAPIs/RestaurantApiServices.php | 10 +++++----- resources/views/Admin/dashboard.blade.php | 16 +++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/Services/APIs/CustomerAPIs/RestaurantApiServices.php b/app/Services/APIs/CustomerAPIs/RestaurantApiServices.php index 9bba50f..a40fc82 100644 --- a/app/Services/APIs/CustomerAPIs/RestaurantApiServices.php +++ b/app/Services/APIs/CustomerAPIs/RestaurantApiServices.php @@ -61,7 +61,7 @@ class RestaurantApiServices $promises[$restaurant['name']] = $client->getAsync('https://maps.googleapis.com/maps/api/place/findplacefromtext/json', [ 'query' => [ 'fields' => 'place_id', - 'input' => $restaurant['name'], + 'input' => $restaurant['name'] .' ' . $restaurant['address'], 'inputtype' => 'textquery', 'key' => $googlePlaceApiKey ] @@ -234,7 +234,7 @@ class RestaurantApiServices $promises[$res->name] = $client->getAsync('https://maps.googleapis.com/maps/api/place/findplacefromtext/json', [ 'query' => [ 'fields' => 'place_id', - 'input' => $res->name, + 'input' => $res->name . ' ' . $res->address, 'inputtype' => 'textquery', 'key' => $googlePlaceApiKey ] @@ -332,7 +332,7 @@ class RestaurantApiServices $placeResponse = $client->get('https://maps.googleapis.com/maps/api/place/findplacefromtext/json', [ 'query' => [ 'fields' => 'place_id', - 'input' => $rest->name, + 'input' => $rest->name . ' ' . $rest->address, 'inputtype' => 'textquery', 'key' => $googlePlaceApiKey ] @@ -504,7 +504,7 @@ class RestaurantApiServices $promises[$res->name] = $client->getAsync('https://maps.googleapis.com/maps/api/place/findplacefromtext/json', [ 'query' => [ 'fields' => 'place_id', - 'input' => $res->name, + 'input' => $res->name . ' ' . $res->address, 'inputtype' => 'textquery', 'key' => $googlePlaceApiKey ] @@ -802,7 +802,7 @@ class RestaurantApiServices $promises[$restaurant['name']] = $client->getAsync('https://maps.googleapis.com/maps/api/place/findplacefromtext/json', [ 'query' => [ 'fields' => 'place_id', - 'input' => $restaurant['name'], + 'input' => $restaurant['name'] . ' ' . $restaurant['address'], 'inputtype' => 'textquery', 'key' => $googlePlaceApiKey ] diff --git a/resources/views/Admin/dashboard.blade.php b/resources/views/Admin/dashboard.blade.php index a399741..156ea53 100644 --- a/resources/views/Admin/dashboard.blade.php +++ b/resources/views/Admin/dashboard.blade.php @@ -45,10 +45,10 @@
{{-- --}} - +
- + @endif @@ -291,6 +291,7 @@ Sr no Name + Customer Id Email Count Referred Users @@ -311,6 +312,7 @@ {{ $loop->iteration }} {{ $data['referred_user']['first_name'] }} {{ $data['referred_user']['last_name'] }} + {{ $data['referred_user']['id'] }} {{ $data['referred_user']['email_address'] }} {{ count($data['refeers_users']) }} @@ -356,9 +358,9 @@

Email:

-
+ {{--

Referral Code:

-
+
--}}

Reffered Users:

@@ -610,9 +612,9 @@ document.querySelector( '#referral-user-details-modal .referral-user-inn-div:nth-child(2) span') .innerText = user.email_address; - document.querySelector( + {{-- document.querySelector( '#referral-user-details-modal .referral-user-inn-div:nth-child(3) span') - .innerText = user.referral_code; + .innerText = user.referral_code; --}} // Clear previous referred users const referredUsersDiv = document.querySelector( @@ -622,7 +624,7 @@ referredUsers.forEach(referredUser => { const p = document.createElement('p'); p.innerText = - `${referredUser.first_name} ${referredUser.last_name} (${referredUser.email_address})`; + `${referredUser.first_name} ${referredUser.last_name} (${referredUser.email_address}) (${referredUser.id})`; referredUsersDiv.appendChild(p); }); }); From d9b528ba86ae13c85e2d43550d31c48fe2c4bcfb Mon Sep 17 00:00:00 2001 From: sayliraut Date: Tue, 6 Aug 2024 16:42:44 +0530 Subject: [PATCH 2/6] changes --- .../APIs/RestaurantApi/RestAuthApiController.php | 15 ++++++--------- .../RestaurantService/RestAuthApiService.php | 16 ++++++++++------ resources/lang/en/auth.php | 1 + 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php index 32ec481..3e40e96 100644 --- a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php +++ b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php @@ -126,12 +126,12 @@ class RestAuthApiController extends Controller 'required', 'string', 'email', - function ($attribute, $value, $fail) { - $existingUser = IamPrincipal::where('email_address', $value)->where('principal_type_xid', 4)->whereNull('deleted_at')->exists(); - if (!$existingUser) { - $fail('The selected email address is invalid.'); - } - }, + // function ($attribute, $value, $fail) { + // $existingUser = IamPrincipal::where('email_address', $value)->where('principal_type_xid', 4)->whereNull('deleted_at')->exists(); + // if (!$existingUser) { + // $fail('Entered e-mail address is not in our system.'); + // } + // }, ], ]); @@ -246,7 +246,4 @@ class RestAuthApiController extends Controller return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500); } } - - - } diff --git a/app/Services/APIs/RestaurantService/RestAuthApiService.php b/app/Services/APIs/RestaurantService/RestAuthApiService.php index dbef22b..c40a6e9 100644 --- a/app/Services/APIs/RestaurantService/RestAuthApiService.php +++ b/app/Services/APIs/RestaurantService/RestAuthApiService.php @@ -160,15 +160,19 @@ class RestAuthApiService { try { DB::beginTransaction(); + $user = IamPrincipal::where('email_address', $request->email_address) ->where('principal_type_xid', 4) ->whereNull('deleted_at') - ->first(); - //use this for both customer and restaurant just change principal_type_xid 4 - if ($user == null) { - Log::error('Email not exist'); - return jsonResponseWithErrorMessageApi(__('auth.incorrect_email'), 403); - } + ->exists(); + + + if (!$user) { + return jsonResponseWithDataErrorMessageApi(__('EmailNotExist'), ('Entered e-mail address is not in our system. Register for an account here.')); + + } + + // Define the generateOTP function $otp = $this->generateOTP(); diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index 9b91dba..cd84533 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -114,6 +114,7 @@ return [ 'state_limit_reached' => 'You have reached the maximum limit for redeeming vouchers.', 'restaurant_limit_reached' => 'You have reached the maximum limit for redeeming vouchers.', 'email_already_used' => 'The email address is already in use.', + 'invalid_mail' => 'Entered e-mail address is not in our system. Register for an account here.', ]; From 5dcd85f0d9cfa53ff8bb839937310e33fc72482b Mon Sep 17 00:00:00 2001 From: sayliraut Date: Tue, 6 Aug 2024 17:15:55 +0530 Subject: [PATCH 3/6] changes --- .../APIs/RestaurantApi/RestAuthApiController.php | 15 +++++++++------ .../RestaurantService/RestAuthApiService.php | 16 ++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php index 3e40e96..32ec481 100644 --- a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php +++ b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php @@ -126,12 +126,12 @@ class RestAuthApiController extends Controller 'required', 'string', 'email', - // function ($attribute, $value, $fail) { - // $existingUser = IamPrincipal::where('email_address', $value)->where('principal_type_xid', 4)->whereNull('deleted_at')->exists(); - // if (!$existingUser) { - // $fail('Entered e-mail address is not in our system.'); - // } - // }, + function ($attribute, $value, $fail) { + $existingUser = IamPrincipal::where('email_address', $value)->where('principal_type_xid', 4)->whereNull('deleted_at')->exists(); + if (!$existingUser) { + $fail('The selected email address is invalid.'); + } + }, ], ]); @@ -246,4 +246,7 @@ class RestAuthApiController extends Controller return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500); } } + + + } diff --git a/app/Services/APIs/RestaurantService/RestAuthApiService.php b/app/Services/APIs/RestaurantService/RestAuthApiService.php index c40a6e9..dbef22b 100644 --- a/app/Services/APIs/RestaurantService/RestAuthApiService.php +++ b/app/Services/APIs/RestaurantService/RestAuthApiService.php @@ -160,19 +160,15 @@ class RestAuthApiService { try { DB::beginTransaction(); - $user = IamPrincipal::where('email_address', $request->email_address) ->where('principal_type_xid', 4) ->whereNull('deleted_at') - ->exists(); - - - if (!$user) { - return jsonResponseWithDataErrorMessageApi(__('EmailNotExist'), ('Entered e-mail address is not in our system. Register for an account here.')); - - } - - + ->first(); + //use this for both customer and restaurant just change principal_type_xid 4 + if ($user == null) { + Log::error('Email not exist'); + return jsonResponseWithErrorMessageApi(__('auth.incorrect_email'), 403); + } // Define the generateOTP function $otp = $this->generateOTP(); From a6ec4103221e1f2eb55b25390c2538b405fe44f2 Mon Sep 17 00:00:00 2001 From: sayliraut Date: Tue, 6 Aug 2024 17:20:13 +0530 Subject: [PATCH 4/6] changes --- .../Controllers/APIs/RestaurantApi/RestAuthApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php index 32ec481..1890f72 100644 --- a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php +++ b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php @@ -127,7 +127,7 @@ class RestAuthApiController extends Controller 'string', 'email', function ($attribute, $value, $fail) { - $existingUser = IamPrincipal::where('email_address', $value)->where('principal_type_xid', 4)->whereNull('deleted_at')->exists(); + $existingUser = IamPrincipal::where('email_address', $value)->where('principal_type_xid', 4)->where('is_active', 1)->whereNull('deleted_at')->exists(); if (!$existingUser) { $fail('The selected email address is invalid.'); } From ddb4b6379f9085448193142eaaadd43c3c5b91b7 Mon Sep 17 00:00:00 2001 From: sayliraut Date: Tue, 6 Aug 2024 19:12:38 +0530 Subject: [PATCH 5/6] Changes --- .../manage_restaurants/add_restaurant.blade.php | 2 +- .../manage_restaurants/edit_restaurant.blade.php | 2 +- .../manage_restaurants/view_restaurant.blade.php | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/resources/views/Admin/pages/manage_restaurants/add_restaurant.blade.php b/resources/views/Admin/pages/manage_restaurants/add_restaurant.blade.php index d96ffd7..3aafcff 100644 --- a/resources/views/Admin/pages/manage_restaurants/add_restaurant.blade.php +++ b/resources/views/Admin/pages/manage_restaurants/add_restaurant.blade.php @@ -161,7 +161,7 @@ onclick="removeClosedHourEntry(this)">Remove - diff --git a/resources/views/Admin/pages/manage_restaurants/edit_restaurant.blade.php b/resources/views/Admin/pages/manage_restaurants/edit_restaurant.blade.php index f912cd3..5ddf00a 100644 --- a/resources/views/Admin/pages/manage_restaurants/edit_restaurant.blade.php +++ b/resources/views/Admin/pages/manage_restaurants/edit_restaurant.blade.php @@ -242,7 +242,7 @@ @endforeach - diff --git a/resources/views/Admin/pages/manage_restaurants/view_restaurant.blade.php b/resources/views/Admin/pages/manage_restaurants/view_restaurant.blade.php index 7cfbda6..667acb9 100644 --- a/resources/views/Admin/pages/manage_restaurants/view_restaurant.blade.php +++ b/resources/views/Admin/pages/manage_restaurants/view_restaurant.blade.php @@ -54,7 +54,7 @@ Restaurant Name : Restaurant ID : - Bio : + Bio : Try on 1 : Try on 2 : Try on 3 : @@ -64,7 +64,7 @@ {{ $restaurantItem->name }} {{ $restaurantItem->restaurant_id }} - {{ $restaurantItem->bio }} + {{ $restaurantItem->bio }} {{ $restaurantItem->try_on_1 }} {{ $restaurantItem->try_on_2 }} {{ $restaurantItem->try_on_3 }} @@ -83,8 +83,8 @@ {{-- Description : --}} Status : - Address : - Exclusion : + Address : + Exclusion : Latitude : Longitude : @@ -92,9 +92,9 @@ {{-- {!! $restaurantItem->description !!} --}} {{ $restaurantItem->is_active == 1 ? 'Active' : 'Expired' }} - {{ $restaurantItem->address }} + {{ $restaurantItem->address }} - {{ $restaurantItem->exclusion }} + {{ $restaurantItem->exclusion }} {{ $restaurantItem->latitude }} {{ $restaurantItem->longtitude }} From dc315ffc2f880f231888c3126c7d65a1aee9e90c Mon Sep 17 00:00:00 2001 From: sayliraut Date: Tue, 6 Aug 2024 19:36:55 +0530 Subject: [PATCH 6/6] changes --- app/Http/Controllers/APIs/Customer_API/AuthController.php | 2 +- .../Controllers/APIs/RestaurantApi/RestAuthApiController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/APIs/Customer_API/AuthController.php b/app/Http/Controllers/APIs/Customer_API/AuthController.php index 3427bdc..fbf9620 100644 --- a/app/Http/Controllers/APIs/Customer_API/AuthController.php +++ b/app/Http/Controllers/APIs/Customer_API/AuthController.php @@ -164,7 +164,7 @@ class AuthController extends Controller function ($attribute, $value, $fail) { $existingUser = IamPrincipal::where('email_address', $value)->where('principal_type_xid', 3)->whereNull('deleted_at')->exists(); if (!$existingUser) { - $fail('The selected email address is invalid.'); + $fail('Entered e-mail address is not in our system.'); } }, ], diff --git a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php index 1890f72..cb8a1be 100644 --- a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php +++ b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php @@ -129,7 +129,7 @@ class RestAuthApiController extends Controller function ($attribute, $value, $fail) { $existingUser = IamPrincipal::where('email_address', $value)->where('principal_type_xid', 4)->where('is_active', 1)->whereNull('deleted_at')->exists(); if (!$existingUser) { - $fail('The selected email address is invalid.'); + $fail('Entered e-mail address is not in our system..'); } }, ],