RecentTrans

This commit is contained in:
sayaliparab
2024-07-15 15:41:53 +05:30
21 changed files with 859 additions and 507 deletions

View File

@@ -187,4 +187,29 @@ class CustomerControllerApi extends Controller
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500); return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
} }
} }
/**
* Created By : sayli Raut
* Created at : 15 July 2024
* Use : To get user subscription status.
*/
public function CheckSubscription()
{
try {
$token = readHeaderToken();
if ($token) {
$customerIamId = $token['sub'];
$response = $this->CustomerApiServices->CheckSubscription($customerIamId);
return jsonResponseWithSuccessMessageApi(__('auth.data_fetched_successfully'), ['is_subscribed' => $response], 200);
} else {
return jsonResponseWithErrorMessageApi(__('auth.user_deleted'), 409);
}
} catch (Exception $e) {
Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage(), ['exception' => $e]);
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
} }

View File

@@ -85,7 +85,7 @@ class SubscriptionController extends Controller
} catch (\Exception $e) { } catch (\Exception $e) {
Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage(), ['exception' => $e]); Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage(), ['exception' => $e]);
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500); return jsonResponseWithErrorMessage(__('auth.something_went_wrong'));
} }
} }

View File

@@ -86,178 +86,184 @@ class ManageNotificationsController extends Controller
* Use : To add notification . * Use : To add notification .
*/ */
public function store_notificaton_data(Request $request) public function store_notificaton_data(Request $request)
{ {
try { try {
$request->validate([ $request->validate([
'image' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048', 'image' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
]); ]);
DB::beginTransaction(); DB::beginTransaction();
if (isset($request->image)) { if (isset($request->image)) {
$image = $request->image; $image = $request->image;
$image_db = null; $image_db = null;
} else { } else {
$image = null; $image = null;
$image_db = $request->image; $image_db = $request->image;
} }
$tnormalImage = saveSingleImageWithoutCrop($image, 'notification_images', $image_db); $tnormalImage = saveSingleImageWithoutCrop($image, 'notification_images', $image_db);
$imagePath = ListingImageUrl('notification_images', $tnormalImage); $imagePath = ListingImageUrl('notification_images', $tnormalImage);
$states = $request->states; $states = $request->states;
$dateTime = now(); $dateTime = now();
$formattedDateTime = $dateTime->format('Y-m-d H:i:s'); $formattedDateTime = $dateTime->format('Y-m-d H:i:s');
$iamPrincipals = Subscriptions::select('iam_principal_xid') $iamPrincipals = Subscriptions::select('iam_principal_xid')
->where('next_payment_date', '>=', $formattedDateTime) ->where('next_payment_date', '>=', $formattedDateTime)
->get(); ->get();
$iamPrincipalIds = $iamPrincipals->pluck('iam_principal_xid'); $iamPrincipalIds = $iamPrincipals->pluck('iam_principal_xid');
$subscribe = IamPrincipal::whereIn('id', $iamPrincipalIds) $subscribe = IamPrincipal::whereIn('id', $iamPrincipalIds)
->where('is_active', 1) ->where('is_active', 1)
->where('notification_status', 1) ->where('notification_status', 1)
->where('principal_type_xid', 3) ->where('principal_type_xid', 3)
->whereIn('state_xid', $states) ->whereIn('state_xid', $states)
->get(); ->get();
if ($request->user_type == 1) { $scheduled = false;
$allCustomerOneSignalIds = $subscribe->pluck('id');
$UserData = IamPrincipal::whereIn('id', $allCustomerOneSignalIds)->get();
foreach ($UserData as $customerIdItem) { if ($request->user_type == 1) {
// user_type 1 = subscribed user $allCustomerOneSignalIds = $subscribe->pluck('id');
if ($request->schedule_radio1 == 1 && $request->schedule_date) { $UserData = IamPrincipal::whereIn('id', $allCustomerOneSignalIds)->get();
// Scheduled Notification
NotificationDetails::create([
'principal_xid' => $customerIdItem->id,
'description' => $request->description,
'type' => $request->title,
'image' => $imagePath,
'date_added' => $request->schedule_date,
'is_schedule' => 1,
'delivery_schedule' => $request->schedule_date,
'is_active' => 0,
]); foreach ($UserData as $customerIdItem) {
} else { // user_type 1 = subscribed user
// Immediate Notification if ($request->schedule_radio1 == 1 && $request->schedule_date) {
if ($customerIdItem->one_signal_player_id) { // Scheduled Notification
onesignalhelper::sendNotificationApi( NotificationDetails::create([
$customerIdItem->one_signal_player_id, 'principal_xid' => $customerIdItem->id,
$request->title, 'description' => $request->description,
$request->description, 'type' => $request->title,
'Dashboard Notification', 'image' => $imagePath,
$imagePath, 'date_added' => $request->schedule_date,
$id = null 'is_schedule' => 1,
); 'delivery_schedule' => $request->schedule_date,
} 'is_active' => 0,
onesignalhelper::StoreNotificationDetails($customerIdItem->id, 'Notification', $request->title, $imagePath); ]);
} $scheduled = true;
} } else {
} elseif ($request->user_type == 2) { // Immediate Notification
//user_type 2 unsubscribed users if ($customerIdItem->one_signal_player_id) {
$allPrincipalIds = IamPrincipal::where('principal_type_xid', 3) onesignalhelper::sendNotificationApi(
->pluck('id'); $customerIdItem->one_signal_player_id,
$request->title,
$request->description,
'Dashboard Notification',
$imagePath,
$id = null
);
}
onesignalhelper::StoreNotificationDetails($customerIdItem->id, 'Notification', $request->title, $imagePath);
}
}
} elseif ($request->user_type == 2) {
// user_type 2 unsubscribed users
$allPrincipalIds = IamPrincipal::where('principal_type_xid', 3)
->pluck('id');
$subscribedIds = Subscriptions::select('iam_principal_xid') $subscribedIds = Subscriptions::select('iam_principal_xid')
->where('next_payment_date', '>=', $formattedDateTime) ->where('next_payment_date', '>=', $formattedDateTime)
->pluck('iam_principal_xid'); ->pluck('iam_principal_xid');
$unsubscribedIds = $allPrincipalIds->diff($subscribedIds); $unsubscribedIds = $allPrincipalIds->diff($subscribedIds);
$unsubscribedPrincipals = IamPrincipal::whereIn('id', $unsubscribedIds) $unsubscribedPrincipals = IamPrincipal::whereIn('id', $unsubscribedIds)
->where('is_active', 1) ->where('is_active', 1)
->where('notification_status', 1) ->where('notification_status', 1)
->whereIn('state_xid', $states) ->whereIn('state_xid', $states)
->get(); ->get();
$allRestaurantOneSignalIds = $unsubscribedPrincipals->pluck('id'); $allRestaurantOneSignalIds = $unsubscribedPrincipals->pluck('id');
$restaurantData = IamPrincipal::whereIn('id', $allRestaurantOneSignalIds)->get(); $restaurantData = IamPrincipal::whereIn('id', $allRestaurantOneSignalIds)->get();
foreach ($restaurantData as $restaurantsData) { foreach ($restaurantData as $restaurantsData) {
if ($request->schedule_radio1 == 1 && $request->schedule_date) { if ($request->schedule_radio1 == 1 && $request->schedule_date) {
// Scheduled Notification // Scheduled Notification
NotificationDetails::create([ NotificationDetails::create([
'principal_xid' => $restaurantsData->id, 'principal_xid' => $restaurantsData->id,
'description' => $request->description, 'description' => $request->description,
'type' => $request->title, 'type' => $request->title,
'image' => $imagePath, 'image' => $imagePath,
'date_added' => $request->schedule_date, 'date_added' => $request->schedule_date,
'is_schedule' => 1, 'is_schedule' => 1,
'delivery_schedule' => $request->schedule_date, 'delivery_schedule' => $request->schedule_date,
'is_active' => 0, 'is_active' => 0,
]);
$scheduled = true;
} else {
// Immediate Notification
if ($restaurantsData->one_signal_player_id) {
onesignalhelper::sendNotificationApi(
$restaurantsData->one_signal_player_id,
$request->title,
$request->description,
$request->title,
$imagePath,
$id = null
);
}
onesignalhelper::StoreNotificationDetails($restaurantsData->id, 'Notification', $request->title, $imagePath);
}
}
} elseif ($request->user_type == 3) {
// user_type 3 = subscribed and unsubscribed users
$userQuery = IamPrincipal::where('is_active', 1)
->where('notification_status', 1)
->where('principal_type_xid', 3)
->whereIn('state_xid', $states);
$allUserOneSignalIds = $userQuery->pluck('id');
$UserData = IamPrincipal::whereIn('id', $allUserOneSignalIds)->get();
]); foreach ($UserData as $CustomerData) {
} else { if ($request->schedule_radio1 == 1 && $request->schedule_date) {
// Immediate Notification // Scheduled Notification
if ($restaurantsData->one_signal_player_id) { NotificationDetails::create([
onesignalhelper::sendNotificationApi( 'principal_xid' => $CustomerData->id,
$restaurantsData->one_signal_player_id, 'description' => $request->description,
$request->title, 'type' => $request->title,
$request->description, 'image' => $imagePath,
$request->title, 'date_added' => $request->schedule_date,
$imagePath, 'is_schedule' => 1,
$id = null 'delivery_schedule' => $request->schedule_date,
); 'is_active' => 0,
} ]);
onesignalhelper::StoreNotificationDetails($restaurantsData->id, 'Notification', $request->title, $imagePath); $scheduled = true;
} } else {
} // Immediate Notification
} elseif ($request->user_type == 3) { if ($CustomerData->one_signal_player_id) {
// user_type 3 = subscribed and unsubscribed users onesignalhelper::sendNotificationApi(
$userQuery = IamPrincipal::where('is_active', 1) $CustomerData->one_signal_player_id,
->where('notification_status', 1) $request->title,
->where('principal_type_xid', 3) $request->description,
->whereIn('state_xid', $states); 'Dashboard Notification',
$imagePath,
$id = null
);
}
onesignalhelper::StoreNotificationDetails($CustomerData->id, 'Notification', $request->title, $imagePath);
}
}
}
$allUserOneSignalIds = $userQuery->pluck('id'); DB::commit();
$UserData = IamPrincipal::whereIn('id', $allUserOneSignalIds)->get();
foreach ($UserData as $CustomerData) { if ($scheduled) {
if ($request->schedule_radio1 == 1 && $request->schedule_date) { return jsonResponseWithSuccessMessage(__('success.save_data_scheduled'));
// Scheduled Notification } else {
NotificationDetails::create([ return jsonResponseWithSuccessMessage(__('success.save_data_immediate'));
'principal_xid' => $CustomerData->id, }
'description' => $request->description, } catch (Exception $e) {
'type' => $request->title, DB::rollBack();
'image' => $imagePath, Log::error("Notification send Failed " . $e->getMessage());
'date_added' => $request->schedule_date, return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
'is_schedule' => 1, }
'delivery_schedule' => $request->schedule_date, }
'is_active' => 0,
]);
} else {
// Immediate Notification
if ($CustomerData->one_signal_player_id) {
onesignalhelper::sendNotificationApi(
$CustomerData->one_signal_player_id,
$request->title,
$request->description,
'Dashboard Notification',
$imagePath,
$id = null
);
}
onesignalhelper::StoreNotificationDetails($CustomerData->id, 'Notification', $request->title, $imagePath);
}
}
}
DB::commit();
return jsonResponseWithSuccessMessage(__('success.save_data'));
} catch (Exception $e) {
DB::rollBack();
Log::error("Notification send Failed " . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}

View File

@@ -12,6 +12,7 @@ use Exception;
use App\Helpers\onesignalhelper; use App\Helpers\onesignalhelper;
use App\Models\IamPrincipal; use App\Models\IamPrincipal;
use App\Models\ManageState; use App\Models\ManageState;
use App\Models\RestaurantClosedHour;
use App\Models\RestaurantTimeInterval; use App\Models\RestaurantTimeInterval;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Maatwebsite\Excel\Facades\Excel; use Maatwebsite\Excel\Facades\Excel;
@@ -29,11 +30,11 @@ class ManageRestrauntController extends Controller
$activeQuery = $request->query('active'); $activeQuery = $request->query('active');
if ($activeQuery == 1) { if ($activeQuery == 1) {
$restaurant = ManageRestaurant::where('is_active', 1)->latest()->get(); $restaurant = ManageRestaurant::with('state')->where('is_active', 1)->latest()->get();
} else if ($activeQuery == 0 && $activeQuery != null) { } else if ($activeQuery == 0 && $activeQuery != null) {
$restaurant = ManageRestaurant::where('is_active', 0)->latest()->get(); $restaurant = ManageRestaurant::with('state')->where('is_active', 0)->latest()->get();
} else { } else {
$restaurant = ManageRestaurant::latest()->get(); $restaurant = ManageRestaurant::with('state')->latest()->get();
} }
return view('Admin.pages.manage_restaurants.manage_restaurants', compact('restaurant')); return view('Admin.pages.manage_restaurants.manage_restaurants', compact('restaurant'));
} }
@@ -87,6 +88,7 @@ class ManageRestrauntController extends Controller
$restaurant->try_on_4 = $request->input('try_on_4'); $restaurant->try_on_4 = $request->input('try_on_4');
$restaurant->save(); $restaurant->save();
// Storing operating hours
foreach ($request->input('operating_hours') as $day => $hours) { foreach ($request->input('operating_hours') as $day => $hours) {
OperatingHour::create([ OperatingHour::create([
'manage_restaurant_xid' => $restaurant->id, 'manage_restaurant_xid' => $restaurant->id,
@@ -96,6 +98,7 @@ class ManageRestrauntController extends Controller
]); ]);
} }
// Storing restaurant time interval
$restTimeInterval = new RestaurantTimeInterval(); $restTimeInterval = new RestaurantTimeInterval();
$restTimeInterval->manage_restaurants_xid = $restaurant->id; $restTimeInterval->manage_restaurants_xid = $restaurant->id;
$restTimeInterval->time_hours = $request->timeHours; $restTimeInterval->time_hours = $request->timeHours;
@@ -103,8 +106,18 @@ class ManageRestrauntController extends Controller
$restTimeInterval->quantity = $request->timeQuantity; $restTimeInterval->quantity = $request->timeQuantity;
$restTimeInterval->save(); $restTimeInterval->save();
$imagePath = ListingImageUrl('restaurant_images', $restaurant->image); // Storing closed restaurant date and time
if ($request->has('closed_date')) {
$ClosedTime = new RestaurantClosedHour();
$ClosedTime->restaurant_id = $restaurant->id;
$ClosedTime->day = $request->closed_date;
$ClosedTime->start_time = $request->closed_start_time;
$ClosedTime->end_time = $request->closed_end_time;
$ClosedTime->save();
}
// Sending notifications
$imagePath = ListingImageUrl('restaurant_images', $restaurant->image);
$allCustomerOneSignalIds = IamPrincipal::select('id', 'one_signal_player_id')->where('is_active', 1)->where('notification_status', 1)->where('principal_type_xid', 3)->get(); $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"; $title = "New " . $restaurant->name . " is added";
$message = "New Restaurant is Now Live."; $message = "New Restaurant is Now Live.";
@@ -125,7 +138,6 @@ class ManageRestrauntController extends Controller
onesignalhelper::StoreNotificationDetails($customerIdItem->id, $content_type, $title, $imagePath); onesignalhelper::StoreNotificationDetails($customerIdItem->id, $content_type, $title, $imagePath);
} }
DB::commit(); DB::commit();
return jsonResponseWithSuccessMessage(__('success.save_data')); return jsonResponseWithSuccessMessage(__('success.save_data'));
} catch (Exception $e) { } catch (Exception $e) {
@@ -136,6 +148,7 @@ class ManageRestrauntController extends Controller
} }
/* /*
Created By : Sayli Raut Created By : Sayli Raut
Created at : 29 May 2024 Created at : 29 May 2024
@@ -146,6 +159,7 @@ class ManageRestrauntController extends Controller
try { try {
$operating_hours = OperatingHour::where('manage_restaurant_xid', $id)->get()->keyBy('day_of_week'); $operating_hours = OperatingHour::where('manage_restaurant_xid', $id)->get()->keyBy('day_of_week');
$restaurantItem = ManageRestaurant::with('timeInterval')->where('id', $id)->first(); $restaurantItem = ManageRestaurant::with('timeInterval')->where('id', $id)->first();
$restaurantClosedTime = RestaurantClosedHour::with('restaurant')->where('restaurant_id', $id)->first();
$timeInterval = $restaurantItem->timeInterval->first(); $timeInterval = $restaurantItem->timeInterval->first();
$state = ManageState::where('is_active', 1)->get()->toArray(); $state = ManageState::where('is_active', 1)->get()->toArray();
@@ -157,7 +171,8 @@ class ManageRestrauntController extends Controller
'operating_hours', 'operating_hours',
'state', 'state',
'timeInterval' 'timeInterval',
'restaurantClosedTime'
) )
); );
} catch (Exception $e) { } catch (Exception $e) {
@@ -245,6 +260,26 @@ class ManageRestrauntController extends Controller
]); ]);
} }
// Handle closed restaurant data
$closedTime = RestaurantClosedHour::where('restaurant_id', $restaurant->id)->first();
if ($closedTime) {
// Update existing record
$closedTime->update([
'day' => $request->input('closed_date'),
'start_time' => $request->input('closed_start_time'),
'end_time' => $request->input('closed_end_time'),
]);
} else {
// Create new record
RestaurantClosedHour::create([
'restaurant_id' => $restaurant->id,
'day' => $request->input('closed_date'),
'start_time' => $request->input('closed_start_time'),
'end_time' => $request->input('closed_end_time'),
]);
}
DB::commit(); DB::commit();
return jsonResponseWithSuccessMessage(__('success.update_data')); return jsonResponseWithSuccessMessage(__('success.update_data'));
@@ -258,6 +293,7 @@ class ManageRestrauntController extends Controller
/* /*
Created By : Sayli Raut Created By : Sayli Raut
Created at : 29 May 2024 Created at : 29 May 2024

View File

@@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Session;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Tymon\JWTAuth\Facades\JWTAuth; use Tymon\JWTAuth\Facades\JWTAuth;
use GuzzleHttp\Client;
/** /**
* Created By : sayli raut * Created By : sayli raut
@@ -168,17 +169,82 @@ if (!function_exists('readRestHeaderToken')) {
if (!function_exists('generateOTP')) { if (!function_exists('generateOTP')) {
function generateOTP() function generateOTP()
{ {
// Define the length of the OTP // Define the length of the OTP
$otpLength = 4; $otpLength = 4;
// Generate a random OTP with $otpLength digits // Generate a random OTP with $otpLength digits
$otp = ''; $otp = '';
for ($i = 0; $i < $otpLength; $i++) { for ($i = 0; $i < $otpLength; $i++) {
$otp .= rand(0, 9); $otp .= rand(0, 9);
}
return $otp;
} }
return $otp;
} }
} }
/**
* Created by : Hritik RD
* Created at : 12 July 2024
* Use : To Get Opening hours of Restaurant By NAME based on Google Maps using Google Places APIs
*/
if (!function_exists('getOpeningHoursOfRestaurant')) {
function getOpeningHoursOfRestaurant($restaurantName)
{
$googlePlaceApiKey = config('constants.googlePlaces.api_key'); // Your webhook secret key
// dd($googlePlaceApiKey);
$client = new Client();
$url = 'https://maps.googleapis.com/maps/api/place/findplacefromtext/json';
$response = $client->get($url, [
'query' => [
'fields' => 'place_id',
'input' => $restaurantName,
'inputtype' => 'textquery',
'key' => $googlePlaceApiKey
]
]);
$placeData = json_decode($response->getBody(), true);
if (isset($placeData['candidates'][0]['place_id'])) {
$placeId = $placeData['candidates'][0]['place_id'];
// return $placeId;
} else {
$placeId = "N/A";
// return response()->json($placeId);
return $placeId;
}
// $placeId = 'ChIJT3dpYcy35zsRLxY5KTTMqhU'; // You can also pass this as a parameter if needed
$client = new Client();
$url = 'https://maps.googleapis.com/maps/api/place/details/json';
$response = $client->get($url, [
'query' => [
'fields' => 'name,rating,formatted_phone_number,opening_hours',
'place_id' => $placeId,
'key' => $googlePlaceApiKey
]
]);
$data = json_decode($response->getBody(), true);
if (isset($data['result']['opening_hours']['weekday_text'])) {
$hours = $data['result']['opening_hours']['weekday_text'];
// return response()->json(['place_id' => $placeId]);
} else {
$hours = "N/A";
}
return $hours ;
// dd($data);
// return response()->json($data);
}
} }

View File

@@ -60,5 +60,10 @@ class ManageRestaurant extends Model
return $this->hasMany(RestaurantTimeInterval::class, 'manage_restaurants_xid', 'id'); return $this->hasMany(RestaurantTimeInterval::class, 'manage_restaurants_xid', 'id');
} }
public function closedRestaurant()
{
return $this->hasMany(RestaurantClosedHour::class, 'restaurant_id', 'id');
}
} }

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class RestaurantClosedHour extends Model
{
use HasFactory;
protected $table = 'restaurant_closed_hours';
protected $fillable = [
'restaurant_id', 'day', 'start_time', 'end_time'
];
public function restaurant()
{
return $this->belongsTo(ManageRestaurant::class);
}
}

View File

@@ -12,43 +12,43 @@ use Illuminate\Support\Facades\DB;
class CustomerApiServices class CustomerApiServices
{ {
public function getUserProfileDetailService($customerIamId) public function getUserProfileDetailService($customerIamId)
{ {
try { try {
$user = IamPrincipal::findOrFail($customerIamId); $user = IamPrincipal::findOrFail($customerIamId);
$data = IamPrincipal::select( $data = IamPrincipal::select(
'id', 'id',
'first_name', 'first_name',
'last_name', 'last_name',
'email_address', 'email_address',
'phone_number', 'phone_number',
'date_of_birth', 'date_of_birth',
'state_xid', 'state_xid',
'profile_photo', 'profile_photo',
'referral_code' 'referral_code'
)->find($user->id); )->find($user->id);
$dateTime = now(); $dateTime = now();
$formattedDateTime = $dateTime->format('Y-m-d H:i:s'); $formattedDateTime = $dateTime->format('Y-m-d H:i:s');
$isSubscribedUser = Subscriptions::where('iam_principal_xid', $customerIamId) $isSubscribedUser = Subscriptions::where('iam_principal_xid', $customerIamId)
->where('next_payment_date', '>=', $formattedDateTime) ->where('next_payment_date', '>=', $formattedDateTime)
->exists(); ->exists();
if ($data->profile_photo) { if ($data->profile_photo) {
$data->profile_photo = ListingImageUrl('profile_image', $data->profile_photo); $data->profile_photo = ListingImageUrl('profile_image', $data->profile_photo);
} else { } else {
$data->profile_photo = asset('public/assets/img/blankProfile.png'); $data->profile_photo = asset('public/assets/img/blankProfile.png');
}
$data->is_subscribed = $isSubscribedUser;
return $data;
} catch (Exception $ex) {
Log::error('Customer Get data service failed : ' . $ex->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
} }
$data->is_subscribed = $isSubscribedUser;
return $data;
} catch (Exception $ex) {
Log::error('Customer Get data service failed : ' . $ex->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
} }
}
@@ -143,4 +143,21 @@ class CustomerApiServices
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
} }
} }
public function CheckSubscription($customerIamId)
{
try {
$dateTime = now();
$formattedDateTime = $dateTime->format('Y-m-d H:i:s');
$isSubscribedUser = Subscriptions::where('iam_principal_xid', $customerIamId)
->where('next_payment_date', '>=', $formattedDateTime)
->exists();
return $isSubscribedUser;
} catch (Exception $ex) {
Log::error('Customer Get data service failed : ' . $ex->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
} }

View File

@@ -23,7 +23,7 @@ class RestaurantApiServices
public function getCoordinates($customerIamId) public function getCoordinates($customerIamId)
{ {
try { try {
$restaurants = ManageRestaurant::with('operatingHours')->select( $restaurants = ManageRestaurant::with('operatingHours','closedRestaurant')->select(
'id', 'id',
'name', 'name',
'image', 'image',
@@ -43,6 +43,7 @@ class RestaurantApiServices
->where('restaurant_xid', $restaurant['id']) ->where('restaurant_xid', $restaurant['id'])
->exists(); ->exists();
$restaurant['is_favourite'] = $isFavourite; $restaurant['is_favourite'] = $isFavourite;
// $restaurant['operating_hours'] = getOpeningHoursOfRestaurant($restaurant['name']);// will update later
} }
return jsonResponseWithSuccessMessage(__('auth.data_fetched_successfully'), $restaurants, 200); return jsonResponseWithSuccessMessage(__('auth.data_fetched_successfully'), $restaurants, 200);
@@ -121,6 +122,8 @@ class RestaurantApiServices
->exists(); ->exists();
$rest->is_favourite = $isFavourite; $rest->is_favourite = $isFavourite;
$redeem = RedeemRestaurant::where('iam_principal_xid', $customerIamId) $redeem = RedeemRestaurant::where('iam_principal_xid', $customerIamId)
->where('manage_restaurants_xid', $rest->id) ->where('manage_restaurants_xid', $rest->id)
->where('is_redeem', "1") ->where('is_redeem', "1")
@@ -131,6 +134,10 @@ class RestaurantApiServices
// $timeIntervalHours = $Timeinterval->time_hours; // $timeIntervalHours = $Timeinterval->time_hours;
$restTimeHours = $restTime->time_hours; $restTimeHours = $restTime->time_hours;
//this below code is updated by hritik on 12-07-2024 by adding restaurant opening hours dynamically from Google
// $rest->operating_hours = getOpeningHoursOfRestaurant($rest->name); //will update later
// $greaterTime = max($timeIntervalHours, $restTimeHours); // $greaterTime = max($timeIntervalHours, $restTimeHours);

View File

@@ -21,5 +21,9 @@ return [
'stripe_secret_key' => env('STRIPE_SECRET'), 'stripe_secret_key' => env('STRIPE_SECRET'),
'webhook_secret' => env('STRIPE_WEBHOOK_SECRET'), 'webhook_secret' => env('STRIPE_WEBHOOK_SECRET'),
], ],
'googlePlaces'=>[
'api_key'=>env('GOOGLE_PLACE_API_KEY')
]
]; ];

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('restaurant_closed_hours', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('restaurant_id');
$table->string('day');
$table->time('start_time')->nullable();
$table->time('end_time')->nullable();
$table->timestamps();
$table->foreign('restaurant_id')->references('id')->on('manage_restaurants')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('restaurant_closed_hours');
}
};

View File

@@ -64,6 +64,16 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
required: true, required: true,
number: true, number: true,
min: 1 min: 1
},
closed_start_time: {
required: function (element) {
return $('input[name="closed_date"]').val() !== '';
}
},
closed_end_time: {
required: function (element) {
return $('input[name="closed_date"]').val() !== '';
}
} }
}, },
messages: { messages: {
@@ -122,11 +132,17 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
required: "Please enter the maximum number of cocktails", required: "Please enter the maximum number of cocktails",
number: "Maximum number of cocktails must be a number", number: "Maximum number of cocktails must be a number",
min: "Maximum number of cocktails must be greater than 0" min: "Maximum number of cocktails must be greater than 0"
},
closed_start_time: {
required: "Please select the start time for closing hours"
},
closed_end_time: {
required: "Please select the end time for closing hours"
} }
}, },
errorClass: 'error-message', errorClass: 'error-message',
submitHandler: function (form) { submitHandler: function (form) {
e.preventDefault(); // Prevent default form submission e.preventDefault();
var form = $('#update_restaurant_form')[0]; var form = $('#update_restaurant_form')[0];
var formData = new FormData(form); var formData = new FormData(form);
@@ -163,7 +179,6 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
toastr.error('Something Went Wrong'); toastr.error('Something Went Wrong');
// Handle error
}, },
complete: function () { complete: function () {
$('#update_restaurant_btn').attr('disabled', false); $('#update_restaurant_btn').attr('disabled', false);
@@ -173,5 +188,3 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
} }
}); });
}); });

View File

@@ -34,5 +34,8 @@ return [
'authentic_success' => 'Authentication Successful', 'authentic_success' => 'Authentication Successful',
'confirmed_password' => 'please confirm your passsword', 'confirmed_password' => 'please confirm your passsword',
'redeemed_successfully' => 'Referral code redeemed successfully.', 'redeemed_successfully' => 'Referral code redeemed successfully.',
'save_data_scheduled' => 'Notification Schedule Successfully.',
'save_data_immediate' => 'Notification Sent Successfully.',
]; ];

View File

@@ -57,7 +57,10 @@
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label for="company-name" class="label">Upload Image</label> <label for="company-name" class="label">Upload Image</label>
<input type="file" class="form-control" name="image" accept="image/*"> <input type="file" class="form-control" name="image" accept="image/*"
onchange="previewImage(event)">
<img id="preview" src="#" alt="your image" class="mt-3"
style="display:none;width:20%;" />
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@@ -138,10 +141,12 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="notification-card"> <div class="notification-card">
<h6>Delivery Schedule</h6> <label for="company-name" class="label">Delivery Schedule</label>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<h6>When should this message start sending?</h6> <label for="company-name" class="label">When should this message
start sending?</label>
<div class="form-group radio-btn"> <div class="form-group radio-btn">
<input type="radio" class="form-control" name="schedule_radio1" <input type="radio" class="form-control" name="schedule_radio1"
id="push_schedule_radi01" value="0"> id="push_schedule_radi01" value="0">
@@ -182,193 +187,212 @@
</div> </div>
@endsection @endsection
@section('section_script') @section('section_script')
<script> <script>
$(document).ready(function() { $(document).ready(function() {
// Custom validator for checking state checkboxes // Custom validator for checking state checkboxes
$.validator.addMethod('stateRequired', function(value, element) { $.validator.addMethod('stateRequired', function(value, element) {
let selectedUserType = $('input[name="user_type"]:checked').val(); let selectedUserType = $('input[name="user_type"]:checked').val();
if (selectedUserType) { if (selectedUserType) {
let dropdownId = `dropdown-${selectedUserType}`; let dropdownId = `dropdown-${selectedUserType}`;
return $(`#${dropdownId} .state-checkbox:checked`).length > 0; return $(`#${dropdownId} .state-checkbox:checked`).length > 0;
} }
return true; return true;
}, 'Please select at least one state.'); }, 'Please select at least one state.');
// Validate the form // Validate the form
$('#send_notification_form').validate({ $('#send_notification_form').validate({
ignore: [], ignore: [],
debug: false, debug: false,
rules: { rules: {
title: { title: {
required: true required: true
},
description: {
required: true
},
image: {
required: true
},
user_type: {
required: true
},
schedule_radio1: {
required: true
},
schedule_date: {
required: function() {
return $('#push_schedule_radi02').is(':checked');
}
},
'states[]': {
stateRequired: true
}
},
messages: {
title: {
required: 'Please enter this field'
},
description: {
required: 'Please enter this field'
},
image: {
required: 'Please upload an image file'
},
user_type: {
required: 'Please select at least one category'
},
schedule_radio1: {
required: 'Please select a delivery schedule'
},
schedule_date: {
required: 'Please select a specific time'
},
'states[]': {
stateRequired: 'Please select at least one state.'
}
},
errorClass: 'error-message',
errorPlacement: function(error, element) {
if (element.attr("name") == "user_type") {
error.insertAfter("#select-ids").addClass('error-message');
} else if (element.attr("name") == "schedule_radio1") {
error.insertAfter("#push_schedule_radi02").addClass('error-message');
} else if (element.attr("name") == "states[]") {
error.insertAfter(`#dropdown-${$('input[name="user_type"]:checked').val()}`).addClass('error-message');
} else {
error.insertAfter(element).addClass('error-message');
}
},
submitHandler: function(form) {
var formData = new FormData(form);
let base_url = url_path;
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url: base_url + '/insert_notification',
type: 'POST',
data: formData,
beforeSend: function() {
$('#store_notification_btn').html('Please wait...');
$('#store_notification_btn').attr('disabled', true);
}, },
processData: false, description: {
contentType: false, required: true
success: function(result) { },
if (result.status_code == 200) { image: {
toastr.success('Data Added Successfully'); required: true
setTimeout(function() { },
window.location.href = base_url + "/manage-notification"; user_type: {
}, 2000); required: true
} else if (result.status_code == 422) { },
// Display validation errors using toastr schedule_radio1: {
$.each(result.errors, function(key, value) { required: true
toastr.error(value); },
setTimeout(function() { schedule_date: {
window.location.href = base_url + "/manage-notification"; required: function() {
}, 2000); return $('#push_schedule_radi02').is(':checked');
});
} else {
toastr.error('Something Went Wrong');
setTimeout(function() {
window.location.href = base_url + "/manage-notification";
}, 2000);
} }
$('#store_notification_btn').attr('disabled', false);
$('#store_notification_btn').text('Submit');
}, },
}); 'states[]': {
} stateRequired: true
}); }
},
// Hide date and time input by default messages: {
$('.checkbox-btsss').hide(); title: {
required: 'Please enter this field'
// Show/hide date and time input based on radio button selection },
$('#push_schedule_radi01').click(function() { description: {
$('.checkbox-btsss').hide(); required: 'Please enter this field'
$('input[name="schedule_date"]').val(''); // Clear date and time input },
}); image: {
required: 'Please upload an image file'
$('#push_schedule_radi02').click(function() { },
$('.checkbox-btsss').show(); user_type: {
}); required: 'Please select at least one category'
},
}); schedule_radio1: {
</script> required: 'Please select a delivery schedule'
},
<script> schedule_date: {
document.addEventListener('DOMContentLoaded', function() { required: 'Please select a specific time'
function handleUserTypeChange() { },
var dropdowns = [ 'states[]': {
document.getElementById('dropdown-1'), stateRequired: 'Please select at least one state.'
document.getElementById('dropdown-2'), }
document.getElementById('dropdown-3') },
]; errorClass: 'error-message',
errorPlacement: function(error, element) {
dropdowns.forEach(function(dropdown, index) { if (element.attr("name") == "user_type") {
if (index + 1 == this.value) { error.insertAfter("#select-ids").addClass('error-message');
dropdown.style.display = 'block'; } else if (element.attr("name") == "schedule_radio1") {
toggleCheckboxes(dropdown, false); error.insertAfter("#push_schedule_radi02").addClass('error-message');
} else { } else if (element.attr("name") == "states[]") {
dropdown.style.display = 'none'; error.insertAfter(`#dropdown-${$('input[name="user_type"]:checked').val()}`)
toggleCheckboxes(dropdown, true); .addClass('error-message');
} else {
error.insertAfter(element).addClass('error-message');
}
},
submitHandler: function(form) {
var formData = new FormData(form);
let base_url = url_path;
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url: base_url + '/insert_notification',
type: 'POST',
data: formData,
beforeSend: function() {
$('#store_notification_btn').html('Please wait...');
$('#store_notification_btn').attr('disabled', true);
},
processData: false,
contentType: false,
success: function(result) {
if (result.status_code == 200) {
toastr.success(result.message);
setTimeout(function() {
window.location.href = base_url +
"/manage-notification";
}, 2000);
} else if (result.status_code == 422) {
// Display validation errors using toastr
$.each(result.errors, function(key, value) {
toastr.error(value);
setTimeout(function() {
window.location.href = base_url +
"/manage-notification";
}, 2000);
});
} else {
toastr.error('Something Went Wrong');
setTimeout(function() {
window.location.href = base_url +
"/manage-notification";
}, 2000);
}
$('#store_notification_btn').attr('disabled', false);
$('#store_notification_btn').text('Submit');
},
});
} }
}, this); });
}
function toggleCheckboxes(dropdown, disable) { // Hide date and time input by default
var checkboxes = dropdown.querySelectorAll('.form-check-input'); $('.checkbox-btsss').hide();
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].disabled = disable; // Show/hide date and time input based on radio button selection
$('#push_schedule_radi01').click(function() {
$('.checkbox-btsss').hide();
$('input[name="schedule_date"]').val(''); // Clear date and time input
});
$('#push_schedule_radi02').click(function() {
$('.checkbox-btsss').show();
});
});
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
function handleUserTypeChange() {
var dropdowns = [
document.getElementById('dropdown-1'),
document.getElementById('dropdown-2'),
document.getElementById('dropdown-3')
];
dropdowns.forEach(function(dropdown, index) {
if (index + 1 == this.value) {
dropdown.style.display = 'block';
toggleCheckboxes(dropdown, false);
} else {
dropdown.style.display = 'none';
toggleCheckboxes(dropdown, true);
}
}, this);
}
function toggleCheckboxes(dropdown, disable) {
var checkboxes = dropdown.querySelectorAll('.form-check-input');
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].disabled = disable;
}
}
var userTypeRadios = document.getElementsByName('user_type');
for (var i = 0; i < userTypeRadios.length; i++) {
userTypeRadios[i].addEventListener('change', handleUserTypeChange);
}
var checkedRadio = document.querySelector('input[name="user_type"]:checked');
if (checkedRadio) {
handleUserTypeChange.call(checkedRadio);
}
function handleSelectAllChange() {
var dropdown = this.closest('div[id^="dropdown-"]');
var checkboxes = dropdown.querySelectorAll('.state-checkbox');
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = this.checked;
}
}
var selectAllCheckboxes = document.querySelectorAll('.select-all-checkbox');
for (var i = 0; i < selectAllCheckboxes.length; i++) {
selectAllCheckboxes[i].addEventListener('change', handleSelectAllChange);
}
});
</script>
<script>
function previewImage(event) {
var input = event.target;
var reader = new FileReader();
reader.onload = function() {
var preview = document.getElementById('preview');
preview.src = reader.result;
preview.style.display = 'block';
};
if (input.files && input.files[0]) {
reader.readAsDataURL(input.files[0]);
} }
} }
</script>
var userTypeRadios = document.getElementsByName('user_type');
for (var i = 0; i < userTypeRadios.length; i++) {
userTypeRadios[i].addEventListener('change', handleUserTypeChange);
}
var checkedRadio = document.querySelector('input[name="user_type"]:checked');
if (checkedRadio) {
handleUserTypeChange.call(checkedRadio);
}
function handleSelectAllChange() {
var dropdown = this.closest('div[id^="dropdown-"]');
var checkboxes = dropdown.querySelectorAll('.state-checkbox');
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = this.checked;
}
}
var selectAllCheckboxes = document.querySelectorAll('.select-all-checkbox');
for (var i = 0; i < selectAllCheckboxes.length; i++) {
selectAllCheckboxes[i].addEventListener('change', handleSelectAllChange);
}
});
</script>
@endsection @endsection

View File

@@ -1,83 +1,91 @@
@extends('Admin.layouts.master') @extends('Admin.layouts.master')
@section('content') @section('content')
@php @php
$currentPage = 'manage-notification'; $currentPage = 'manage-notification';
@endphp @endphp
<div class="layout-px-spacing"> <div class="layout-px-spacing">
<div class="middle-content container-xxl p-0"> <div class="middle-content container-xxl p-0">
<div class="row layout-top-spacing "> <div class="row layout-top-spacing ">
<div class="top-tabel"> <div class="top-tabel">
<div class="row"> <div class="row">
<div class="col-md-4 left"> <div class="col-md-4 left">
<a class="d-flex align-items-center justify-content-center pl-2" <a class="d-flex align-items-center justify-content-center pl-2"
href="{{ route('manage.notification')}}"> href="{{ route('manage.notification') }}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg')}}"> <img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
<h6 class="card-title p-0">View Details</h6> <h6 class="card-title p-0">View Details</h6>
</a> </a>
</div>
</div> </div>
</div> </div>
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
<div class="widget-content widget-content-area br-8 position-btn p-0">
<div class="view-details">
<div class="simple-tab">
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home-tab-pane" role="tabpanel"
aria-labelledby="home-tab" tabindex="0">
<div class="row">
<div class="col-md-6 mb-10 tabs23">
<table>
<tr class="title">
<td>Notification content :</td>
<td>Created Date :</td>
</tr>
<tr class="w-100">
<td>{{ $notification->description }}</td>
<td>{{ \Carbon\Carbon::parse($notification->date_added)->format('d/m/y') }}</td>
</tr>
</table>
</div> </div>
<div class="col-md-6 mb-10"> <div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
<table> <div class="widget-content widget-content-area br-8 position-btn p-0">
<tr class="title"> <div class="view-details">
<td>Recipients :</td> <div class="simple-tab">
{{-- <td>Last Modified Date :</td> --}} <div class="tab-content" id="myTabContent">
</tr> <div class="tab-pane fade show active" id="home-tab-pane" role="tabpanel"
<tr class="w-100"> aria-labelledby="home-tab" tabindex="0">
<div class="row">
<div class="col-md-6 mb-10 tabs23">
<table>
<tr class="title">
<td>Message :</td>
<td>Description :</td>
<td>Created Date :</td>
</tr>
<tr class="w-100">
<td>{{ $notification->type }}</td>
<td>{{ $notification->description }}</td>
<td>@if($notification->notification->principal_type_xid == '3') <td>{{ \Carbon\Carbon::parse($notification->date_added)->format('d/m/y') }}
Customer </td>
@else </tr>
Resturant
@endif
</td>
</tr>
</table> </table>
</div>
</div> </div>
<div class="col-md-6 mb-10">
<table>
<tr class="title">
<td>Recipients :</td>
<td>Image :</td>
{{-- <td>Last Modified Date :</td> --}}
</tr>
<tr class="w-100">
<td>
@if ($notification->notification->principal_type_xid == '3')
Customer
@else
Resturant
@endif
</td>
<td>
<img src="{{ $notification->image }}" alt="Notification Image"
style="max-width: 100px; max-height: 100px;">
</td>
</tr>
</table>
</div>
</div> </div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
@endsection @endsection

View File

@@ -24,37 +24,33 @@
<div class="top-tabel"> <div class="top-tabel">
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<!-- <h6 class="card-title">Edit Manage Customers</h6> -->
<a class="d-flex align-items-center justify-content-center pl-2" <a class="d-flex align-items-center justify-content-center pl-2"
href="{{ route('manage.restaurants') }}"> href="{{ route('manage.restaurants') }}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}"> <img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
<h6 class="card-title p-0">Add Details</h6> <h6 class="card-title p-0">Add Details</h6>
</a> </a>
</div> </div>
<div class="col-md-8">
</div>
</div> </div>
</div> </div>
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing"> <div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
<div class="widget-content widget-content-area br-8 position-btn h-10"> <div class="widget-content widget-content-area br-8 position-btn h-10">
<div class="view-details Article"> <div class="view-details Article">
<form id="update_restaurant_form" enctype="multipart/form-data"> <form id="update_restaurant_form" enctype="multipart/form-data">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group "> <div class="form-group">
<label for="company-name" class="label">Restaurant Name</label> <label for="company-name" class="label">Restaurant Name</label>
<input type="text" class="form-control" name="name" required> <input type="text" class="form-control" name="name" required>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group "> <div class="form-group">
<label for="company-name" class="label">Restaurant ID</label> <label for="company-name" class="label">Restaurant ID</label>
<input type="text" class="form-control" name="rest_id" required> <input type="text" class="form-control" name="rest_id" required>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group "> <div class="form-group">
<label for="location" class="label">Address</label> <label for="location" class="label">Address</label>
<input type="text" class="form-control" name="address" required> <input type="text" class="form-control" name="address" required>
</div> </div>
@@ -63,52 +59,52 @@
<div class="form-group"> <div class="form-group">
<label class="label">Image</label> <label class="label">Image</label>
<div class=""> <div class="">
<input type="file" class="form-control input_class" accept="image/*" <input type="file" class="form-control" accept="image/*" name="image"
placeholder="Upload an Image" name="image" id="selectImage" required> id="selectImage" required>
<img id="preview" src="#" alt="your image" class="mt-3 " <img id="preview" src="#" alt="your image" class="mt-3"
style="display:none;width:20%;" /> style="display:none;width:20%;" />
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group "> <div class="form-group">
<label for="location" class="label">Exclusion</label> <label for="location" class="label">Exclusion</label>
<textarea type="text" class="form-control" name="exclusion"></textarea> <textarea type="text" class="form-control" name="exclusion"></textarea>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<label for="location" class="label">Select state</label> <div class="form-group">
<label for="location" class="label">Select State</label>
<select class="form-select" aria-label="Default select example" id="single" <select class="form-select" aria-label="Default select example" id="single"
name="state_xid"> name="state_xid">
<option value="">Select State</option> <option value="">Select State</option>
@foreach ($state as $states) @foreach ($state as $states)
<option value="{{ $states['id'] }}">{{ $states['name'] }} <option value="{{ $states['id'] }}">{{ $states['name'] }}</option>
</option> @endforeach
@endforeach </select>
</select> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group "> <div class="form-group">
<label for="location" class="label">Latitude</label> <label for="location" class="label">Latitude</label>
<input type="text" class="form-control" name="latitude" required> <input type="text" class="form-control" name="latitude" required>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group "> <div class="form-group">
<label for="location" class="label">Longitude</label> <label for="location" class="label">Longitude</label>
<input type="text" class="form-control" name="longitude" required> <input type="text" class="form-control" name="longitude" required>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group "> <div class="form-group">
<label for="phone_number" class="label">Phone number</label> <label for="phone_number" class="label">Phone Number</label>
<input type="text" class="form-control" name="phone_number" maxlength="15" <input type="text" class="form-control" name="phone_number" maxlength="15"
required> required>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group "> <div class="form-group">
<label for="company-name" class="label">Bio</label> <label for="company-name" class="label">Bio</label>
<input type="text" class="form-control" name="bio" required> <input type="text" class="form-control" name="bio" required>
</div> </div>
@@ -117,7 +113,7 @@
<div class="form-group"> <div class="form-group">
<label class="label">Operating Hours</label> <label class="label">Operating Hours</label>
@foreach (['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as $day) @foreach (['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as $day)
<div class="row"> <div class="row mb-2">
<div class="col-md-3"> <div class="col-md-3">
<label>{{ $day }} Start Time:</label> <label>{{ $day }} Start Time:</label>
<input type="time" class="form-control" <input type="time" class="form-control"
@@ -132,6 +128,32 @@
@endforeach @endforeach
</div> </div>
</div> </div>
<div class="col-md-6">
<div class="form-group">
<label for="closed_date" class="label">Date for Close Restaurant</label>
<input type="date" class="form-control" name="closed_date"
id="closed_date">
</div>
</div>
<!-- Close Hours of Restaurant Start Time -->
<div class="col-md-6">
<div class="form-group">
<label for="start-time" class="label">Close Hours of Restaurant Start
Time</label>
<input type="time" class="form-control" name="closed_start_time">
</div>
</div>
<!-- Close Hours of Restaurant End Time -->
<div class="col-md-6">
<div class="form-group">
<label for="end-time" class="label">Close Hours of Restaurant End
Time</label>
<input type="time" class="form-control" name="closed_end_time">
</div>
</div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label for="timeHours" class="label">Time in hours between redeeming two <label for="timeHours" class="label">Time in hours between redeeming two
@@ -142,36 +164,32 @@
<div class="input-group"> <div class="input-group">
<select class="form-control" id="timeInterval" name="timeInterval" <select class="form-control" id="timeInterval" name="timeInterval"
required> required>
{{-- <option value="day">Day</option>
<option value="week">Week</option> --}}
<option value="month">Month</option> <option value="month">Month</option>
</select> </select>
<input type="number" class="form-control" id="timeQuantity" <input type="number" class="form-control" id="timeQuantity"
name="timeQuantity" required> name="timeQuantity" required>
</div> </div>
</div> </div>
</div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group "> <div class="form-group">
<label for="company-name" class="label">While at Restaurant be sure to <label for="company-name" class="label">While at Restaurant be sure to
try:</label> try:</label>
<input type="text" class="form-control mb-3" name="try_on_1" required> <input type="text" class="form-control mb-3" name="try_on_1" required>
<input type="text" class="form-control mb-3" name="try_on_2" required> <input type="text" class="form-control mb-3" name="try_on_2" required>
<input type="text" class="form-control mb-3" name="try_on_3" required> <input type="text" class="form-control mb-3" name="try_on_3" required>
<input type="text" class="form-control mb-3" name="try_on_4" required> <input type="text" class="form-control mb-3" name="try_on_4" required>
</div>
</div>
<div class="col-md-12">
<button id="update_restaurant_btn" type="submit"
class="download-btn-custom mt-3 custom-width-10">Save</button>
</div> </div>
</div> </div>
<div class="col-md-12">
<button id="update_restaurant_btn" type="submit"
class="download-btn-custom mt-3 custom-width-10">Save</button>
</div>
</div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -201,4 +219,10 @@
theme: 'snow' theme: 'snow'
}); });
</script> </script>
<script>
document.addEventListener("DOMContentLoaded", function() {
var today = new Date().toISOString().split('T')[0];
document.getElementsByName("closed_date")[0].setAttribute('min', today);
});
</script>
@endsection @endsection

View File

@@ -123,6 +123,7 @@
$timeQuantity = $timeInterval->quantity ?? ''; $timeQuantity = $timeInterval->quantity ?? '';
@endphp @endphp
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label for="timeHours" class="label">Time in hours between redeeming two <label for="timeHours" class="label">Time in hours between redeeming two
@@ -196,6 +197,30 @@
</div> </div>
</div> </div>
<div class="col-md-6">
<div class="form-group">
<label for="closed_date" class="label">Date for Close Restaurant</label>
<input type="date" class="form-control" name="closed_date"
id="closed_date" value="{{ $restaurantClosedTime->day ?? '' }}"
min="{{ date('Y-m-d') }}">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="closed_start_time" class="label">Close Start Time</label>
<input type="time" class="form-control" name="closed_start_time"
value="{{ $restaurantClosedTime->start_time ?? '' }}">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="closed_end_time" class="label">Close End Time</label>
<input type="time" class="form-control" name="closed_end_time"
value="{{ $restaurantClosedTime->end_time ?? '' }}">
</div>
</div>
<div class="col-md-12"> <div class="col-md-12">
<button class="download-btn "style="width: 30%;" id="update_restaurant"> <button class="download-btn "style="width: 30%;" id="update_restaurant">
<span>Submit</span> <span>Submit</span>
@@ -324,6 +349,16 @@
try_on_4: { try_on_4: {
required: true, required: true,
}, },
closed_start_time: {
required: function(element) {
return $('input[name="closed_date"]').val() !== '';
}
},
closed_end_time: {
required: function(element) {
return $('input[name="closed_date"]').val() !== '';
}
}
}, },
messages: { messages: {
name: { name: {
@@ -379,6 +414,12 @@
try_on_4: { try_on_4: {
required: "Please enter this field", required: "Please enter this field",
}, },
closed_start_time: {
required: "Please select the start time for closing hours"
},
closed_end_time: {
required: "Please select the end time for closing hours"
}
}, },
errorClass: 'error-message', errorClass: 'error-message',
submitHandler: function(form) { submitHandler: function(form) {
@@ -425,4 +466,17 @@
}); });
}); });
</script> </script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const closedDateInput = document.getElementById('closed_date');
closedDateInput.addEventListener('input', function() {
const today = new Date().toISOString().split('T')[0];
if (this.value < today) {
alert('Please select a future date.');
this.value = '';
}
});
});
</script>
@endsection @endsection

View File

@@ -42,6 +42,7 @@
<th class="text-center">Sr no</th> <th class="text-center">Sr no</th>
<th class="text-center">Restaurant Name</th> <th class="text-center">Restaurant Name</th>
<th class="text-center">Restaurant ID</th> <th class="text-center">Restaurant ID</th>
<th class="text-center">State</th>
<th class="text-center">Status</th> <th class="text-center">Status</th>
<th class="no-content">Action</th> <th class="no-content">Action</th>
</tr> </tr>
@@ -60,6 +61,7 @@
<td class="text-center">{{ $count }}</td> <td class="text-center">{{ $count }}</td>
<td class="text-center">{{ $restaurants->name }}</td> <td class="text-center">{{ $restaurants->name }}</td>
<td class="text-center">{{ $restaurants->restaurant_id }}</td> <td class="text-center">{{ $restaurants->restaurant_id }}</td>
<td class="text-center">{{ $restaurants->state->name }}</td>
<td class="text-center"> <td class="text-center">
<form> <form>
<div class="switch-btn" id="status-change"> <div class="switch-btn" id="status-change">

View File

@@ -32,7 +32,7 @@
<th class="text-start">Restaurant Name</th> <th class="text-start">Restaurant Name</th>
<th class="text-start">Restaurant Image</th> <th class="text-start">Restaurant Image</th>
<th class="text-start">Redemption Date and Time</th> <th class="text-start">Redemption Date and Time</th>
<th class="text-start">Voucher Count</th> {{-- <th class="text-start">Voucher Count</th> --}}
<th class="text-start">Voucher Status</th> <th class="text-start">Voucher Status</th>
</tr> </tr>
@@ -56,7 +56,7 @@
<span>No date</span> <span>No date</span>
@endif @endif
</td> </td>
<td class="text-start">{{ $redeemDetail->count }}</td> {{-- <td class="text-start">{{ $redeemDetail->count }}</td> --}}
<!-- <td class="text-center"> <!-- <td class="text-center">
<div class="switch-btn" id="status-change"> <div class="switch-btn" id="status-change">
<input type="checkbox" id="switch{{ $redeemDetail['id'] }}" <input type="checkbox" id="switch{{ $redeemDetail['id'] }}"
@@ -67,7 +67,7 @@
data-off-label="Inactive"></label> data-off-label="Inactive"></label>
</div> </div>
</td> --> </td> -->
<td class="text-center"> <td class="text-center">
<div class="switch-btn"> <div class="switch-btn">
<input type="checkbox" id="switch{{ $redeemDetail['id'] }}" switch="bool" data-id="{{ $redeemDetail['id'] }}" <input type="checkbox" id="switch{{ $redeemDetail['id'] }}" switch="bool" data-id="{{ $redeemDetail['id'] }}"
@@ -75,7 +75,7 @@
<label for="switch{{ $redeemDetail['id'] }}" data-on-label="Active" data-off-label="Inactive"></label> <label for="switch{{ $redeemDetail['id'] }}" data-on-label="Active" data-off-label="Inactive"></label>
</div> </div>
</td> </td>
</tr> </tr>
@endforeach @endforeach

View File

@@ -63,6 +63,7 @@ Route::middleware(['customerApiBasicAuth'])->group(function () {
Route::post('/v1/reset-user-password', [CustomerControllerApi::class, 'resetUserPassword']); Route::post('/v1/reset-user-password', [CustomerControllerApi::class, 'resetUserPassword']);
Route::post('/v1/customer-logout', [CustomerControllerApi::class, 'customerLogout']); Route::post('/v1/customer-logout', [CustomerControllerApi::class, 'customerLogout']);
Route::post('/v1/delete_account', [CustomerControllerApi::class, 'destroyAccount']); Route::post('/v1/delete_account', [CustomerControllerApi::class, 'destroyAccount']);
Route::get('/v1/check_subscription', [CustomerControllerApi::class, 'CheckSubscription']);
//*******************************************************Restaurant******************************************************** //*******************************************************Restaurant********************************************************
Route::get('/v1/detail-of-restaurant/{id}', [RestaurantControllerApi::class, 'DetailRestaurant']); Route::get('/v1/detail-of-restaurant/{id}', [RestaurantControllerApi::class, 'DetailRestaurant']);
@@ -93,6 +94,8 @@ Route::middleware(['customerApiBasicAuth'])->group(function () {
//*******************************************************Rules ******************************************************** //*******************************************************Rules ********************************************************
Route::get('/v1/voucher-rules', [RulesControllerAPI::class, 'getVoucherRules']); Route::get('/v1/voucher-rules', [RulesControllerAPI::class, 'getVoucherRules']);
}); });

View File

@@ -44,7 +44,10 @@ use App\Http\Controllers\Admin\ManageRulesController;
Route::get('/', [LoginController::class, 'index'])->name('login'); Route::get('/admin/login', [LoginController::class, 'index'])->name('login');
Route::get('/', function () {
return redirect('/admin/login');
});
Route::post('/check_login', [LoginController::class, 'login_check']); Route::post('/check_login', [LoginController::class, 'login_check']);
Route::get('/forgot_password', [LoginController::class, 'forgot_password']); Route::get('/forgot_password', [LoginController::class, 'forgot_password']);
Route::post('/send_otp', [LoginController::class, 'add_forgot_password']); Route::post('/send_otp', [LoginController::class, 'add_forgot_password']);
@@ -215,8 +218,6 @@ Route::group(['middleware' => ['checkStatus']], function () {
Route::get('/manage_rules', [ManageRulesController::class, 'index'])->name('manage_rules'); Route::get('/manage_rules', [ManageRulesController::class, 'index'])->name('manage_rules');
Route::get('/rules_edit/{id}', [ManageRulesController::class, 'edit'])->name('rules_edit'); Route::get('/rules_edit/{id}', [ManageRulesController::class, 'edit'])->name('rules_edit');
Route::post('/update_rules', [ManageRulesController::class, 'update']); Route::post('/update_rules', [ManageRulesController::class, 'update']);
}); });
@@ -232,17 +233,17 @@ Route::group(['middleware' => ['customer.jwt.verify']], function () {
// Route::middleware(['checkToken'])->group(function () { // Route::middleware(['checkToken'])->group(function () {
Route::get('list-of-plans', [SubscriptionController::class, 'listOfProduct'])->name('list-of-products'); Route::get('list-of-plans', [SubscriptionController::class, 'listOfProduct'])->name('list-of-products');
// }); // });
Route::post('subscribe-to-plan', [SubscriptionController::class, 'subscriptionToPlan'])->name('subscribe-to-plan'); Route::post('subscribe-to-plan', [SubscriptionController::class, 'subscriptionToPlan'])->name('subscribe-to-plan');
Route::get('thank-you', [SubscriptionController::class, 'thankyou'])->name('thankyou'); Route::get('thank-you', [SubscriptionController::class, 'thankyou'])->name('thankyou');
Route::post('cancel-subscription',[SubscriptionController::class,'cancelSubscription'])->name('cancel-subscription'); Route::post('cancel-subscription', [SubscriptionController::class, 'cancelSubscription'])->name('cancel-subscription');
Route::get('cancel-subscription-thank-you',[SubscriptionController::class,'cancelSubscriptionThankYou'])->name('cancel-subscription-thank-you'); Route::get('cancel-subscription-thank-you', [SubscriptionController::class, 'cancelSubscriptionThankYou'])->name('cancel-subscription-thank-you');
Route::post('apply-referral-code', [SubscriptionController::class, 'applyReferralCode'])->name('apply-referral-code');
Route::post('apply-referral-code', [SubscriptionController::class, 'applyReferralCode'])->name('apply-referral-code');
// Route::post('subscribe-to-product', [SubscriptionController::class, 'subscribeToProduct'])->name('subscribe-to-product'); // Route::post('subscribe-to-product', [SubscriptionController::class, 'subscribeToProduct'])->name('subscribe-to-product');
// Route::post('cancel-subscription', [SubscriptionController::class, 'cancelSubscription'])->name('cancel-subscription'); // Route::post('cancel-subscription', [SubscriptionController::class, 'cancelSubscription'])->name('cancel-subscription');