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);
}
}
/**
* 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) {
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 .
*/
public function store_notificaton_data(Request $request)
{
try {
$request->validate([
'image' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
]);
public function store_notificaton_data(Request $request)
{
try {
$request->validate([
'image' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
]);
DB::beginTransaction();
DB::beginTransaction();
if (isset($request->image)) {
$image = $request->image;
$image_db = null;
} else {
$image = null;
$image_db = $request->image;
}
if (isset($request->image)) {
$image = $request->image;
$image_db = null;
} else {
$image = null;
$image_db = $request->image;
}
$tnormalImage = saveSingleImageWithoutCrop($image, 'notification_images', $image_db);
$imagePath = ListingImageUrl('notification_images', $tnormalImage);
$tnormalImage = saveSingleImageWithoutCrop($image, 'notification_images', $image_db);
$imagePath = ListingImageUrl('notification_images', $tnormalImage);
$states = $request->states;
$states = $request->states;
$dateTime = now();
$formattedDateTime = $dateTime->format('Y-m-d H:i:s');
$iamPrincipals = Subscriptions::select('iam_principal_xid')
->where('next_payment_date', '>=', $formattedDateTime)
->get();
$dateTime = now();
$formattedDateTime = $dateTime->format('Y-m-d H:i:s');
$iamPrincipals = Subscriptions::select('iam_principal_xid')
->where('next_payment_date', '>=', $formattedDateTime)
->get();
$iamPrincipalIds = $iamPrincipals->pluck('iam_principal_xid');
$iamPrincipalIds = $iamPrincipals->pluck('iam_principal_xid');
$subscribe = IamPrincipal::whereIn('id', $iamPrincipalIds)
->where('is_active', 1)
->where('notification_status', 1)
->where('principal_type_xid', 3)
->whereIn('state_xid', $states)
->get();
$subscribe = IamPrincipal::whereIn('id', $iamPrincipalIds)
->where('is_active', 1)
->where('notification_status', 1)
->where('principal_type_xid', 3)
->whereIn('state_xid', $states)
->get();
if ($request->user_type == 1) {
$allCustomerOneSignalIds = $subscribe->pluck('id');
$UserData = IamPrincipal::whereIn('id', $allCustomerOneSignalIds)->get();
$scheduled = false;
foreach ($UserData as $customerIdItem) {
// user_type 1 = subscribed user
if ($request->schedule_radio1 == 1 && $request->schedule_date) {
// 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,
if ($request->user_type == 1) {
$allCustomerOneSignalIds = $subscribe->pluck('id');
$UserData = IamPrincipal::whereIn('id', $allCustomerOneSignalIds)->get();
]);
} else {
// Immediate Notification
if ($customerIdItem->one_signal_player_id) {
onesignalhelper::sendNotificationApi(
$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');
foreach ($UserData as $customerIdItem) {
// user_type 1 = subscribed user
if ($request->schedule_radio1 == 1 && $request->schedule_date) {
// 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,
]);
$scheduled = true;
} else {
// Immediate Notification
if ($customerIdItem->one_signal_player_id) {
onesignalhelper::sendNotificationApi(
$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')
->where('next_payment_date', '>=', $formattedDateTime)
->pluck('iam_principal_xid');
$subscribedIds = Subscriptions::select('iam_principal_xid')
->where('next_payment_date', '>=', $formattedDateTime)
->pluck('iam_principal_xid');
$unsubscribedIds = $allPrincipalIds->diff($subscribedIds);
$unsubscribedIds = $allPrincipalIds->diff($subscribedIds);
$unsubscribedPrincipals = IamPrincipal::whereIn('id', $unsubscribedIds)
->where('is_active', 1)
->where('notification_status', 1)
->whereIn('state_xid', $states)
->get();
$unsubscribedPrincipals = IamPrincipal::whereIn('id', $unsubscribedIds)
->where('is_active', 1)
->where('notification_status', 1)
->whereIn('state_xid', $states)
->get();
$allRestaurantOneSignalIds = $unsubscribedPrincipals->pluck('id');
$restaurantData = IamPrincipal::whereIn('id', $allRestaurantOneSignalIds)->get();
$allRestaurantOneSignalIds = $unsubscribedPrincipals->pluck('id');
$restaurantData = IamPrincipal::whereIn('id', $allRestaurantOneSignalIds)->get();
foreach ($restaurantData as $restaurantsData) {
if ($request->schedule_radio1 == 1 && $request->schedule_date) {
// Scheduled Notification
NotificationDetails::create([
'principal_xid' => $restaurantsData->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 ($restaurantData as $restaurantsData) {
if ($request->schedule_radio1 == 1 && $request->schedule_date) {
// Scheduled Notification
NotificationDetails::create([
'principal_xid' => $restaurantsData->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,
]);
$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();
]);
} 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);
foreach ($UserData as $CustomerData) {
if ($request->schedule_radio1 == 1 && $request->schedule_date) {
// Scheduled Notification
NotificationDetails::create([
'principal_xid' => $CustomerData->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,
]);
$scheduled = true;
} 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);
}
}
}
$allUserOneSignalIds = $userQuery->pluck('id');
$UserData = IamPrincipal::whereIn('id', $allUserOneSignalIds)->get();
DB::commit();
foreach ($UserData as $CustomerData) {
if ($request->schedule_radio1 == 1 && $request->schedule_date) {
// Scheduled Notification
NotificationDetails::create([
'principal_xid' => $CustomerData->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,
if ($scheduled) {
return jsonResponseWithSuccessMessage(__('success.save_data_scheduled'));
} else {
return jsonResponseWithSuccessMessage(__('success.save_data_immediate'));
}
} catch (Exception $e) {
DB::rollBack();
Log::error("Notification send Failed " . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
]);
} 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\Models\IamPrincipal;
use App\Models\ManageState;
use App\Models\RestaurantClosedHour;
use App\Models\RestaurantTimeInterval;
use Illuminate\Support\Facades\Log;
use Maatwebsite\Excel\Facades\Excel;
@@ -29,11 +30,11 @@ class ManageRestrauntController extends Controller
$activeQuery = $request->query('active');
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) {
$restaurant = ManageRestaurant::where('is_active', 0)->latest()->get();
$restaurant = ManageRestaurant::with('state')->where('is_active', 0)->latest()->get();
} else {
$restaurant = ManageRestaurant::latest()->get();
$restaurant = ManageRestaurant::with('state')->latest()->get();
}
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->save();
// Storing operating hours
foreach ($request->input('operating_hours') as $day => $hours) {
OperatingHour::create([
'manage_restaurant_xid' => $restaurant->id,
@@ -96,6 +98,7 @@ class ManageRestrauntController extends Controller
]);
}
// Storing restaurant time interval
$restTimeInterval = new RestaurantTimeInterval();
$restTimeInterval->manage_restaurants_xid = $restaurant->id;
$restTimeInterval->time_hours = $request->timeHours;
@@ -103,8 +106,18 @@ class ManageRestrauntController extends Controller
$restTimeInterval->quantity = $request->timeQuantity;
$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();
$title = "New " . $restaurant->name . " is added";
$message = "New Restaurant is Now Live.";
@@ -125,7 +138,6 @@ class ManageRestrauntController extends Controller
onesignalhelper::StoreNotificationDetails($customerIdItem->id, $content_type, $title, $imagePath);
}
DB::commit();
return jsonResponseWithSuccessMessage(__('success.save_data'));
} catch (Exception $e) {
@@ -136,6 +148,7 @@ class ManageRestrauntController extends Controller
}
/*
Created By : Sayli Raut
Created at : 29 May 2024
@@ -146,6 +159,7 @@ class ManageRestrauntController extends Controller
try {
$operating_hours = OperatingHour::where('manage_restaurant_xid', $id)->get()->keyBy('day_of_week');
$restaurantItem = ManageRestaurant::with('timeInterval')->where('id', $id)->first();
$restaurantClosedTime = RestaurantClosedHour::with('restaurant')->where('restaurant_id', $id)->first();
$timeInterval = $restaurantItem->timeInterval->first();
$state = ManageState::where('is_active', 1)->get()->toArray();
@@ -157,7 +171,8 @@ class ManageRestrauntController extends Controller
'operating_hours',
'state',
'timeInterval'
'timeInterval',
'restaurantClosedTime'
)
);
} 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();
return jsonResponseWithSuccessMessage(__('success.update_data'));
@@ -258,6 +293,7 @@ class ManageRestrauntController extends Controller
/*
Created By : Sayli Raut
Created at : 29 May 2024

View File

@@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Session;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Tymon\JWTAuth\Facades\JWTAuth;
use GuzzleHttp\Client;
/**
* Created By : sayli raut
@@ -168,17 +169,82 @@ if (!function_exists('readRestHeaderToken')) {
if (!function_exists('generateOTP')) {
function generateOTP()
{
// Define the length of the OTP
$otpLength = 4;
function generateOTP()
{
// Define the length of the OTP
$otpLength = 4;
// Generate a random OTP with $otpLength digits
$otp = '';
for ($i = 0; $i < $otpLength; $i++) {
$otp .= rand(0, 9);
// Generate a random OTP with $otpLength digits
$otp = '';
for ($i = 0; $i < $otpLength; $i++) {
$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');
}
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
{
public function getUserProfileDetailService($customerIamId)
{
try {
$user = IamPrincipal::findOrFail($customerIamId);
{
try {
$user = IamPrincipal::findOrFail($customerIamId);
$data = IamPrincipal::select(
'id',
'first_name',
'last_name',
'email_address',
'phone_number',
'date_of_birth',
'state_xid',
'profile_photo',
'referral_code'
)->find($user->id);
$data = IamPrincipal::select(
'id',
'first_name',
'last_name',
'email_address',
'phone_number',
'date_of_birth',
'state_xid',
'profile_photo',
'referral_code'
)->find($user->id);
$dateTime = now();
$formattedDateTime = $dateTime->format('Y-m-d H:i:s');
$dateTime = now();
$formattedDateTime = $dateTime->format('Y-m-d H:i:s');
$isSubscribedUser = Subscriptions::where('iam_principal_xid', $customerIamId)
->where('next_payment_date', '>=', $formattedDateTime)
->exists();
$isSubscribedUser = Subscriptions::where('iam_principal_xid', $customerIamId)
->where('next_payment_date', '>=', $formattedDateTime)
->exists();
if ($data->profile_photo) {
$data->profile_photo = ListingImageUrl('profile_image', $data->profile_photo);
} else {
$data->profile_photo = asset('public/assets/img/blankProfile.png');
if ($data->profile_photo) {
$data->profile_photo = ListingImageUrl('profile_image', $data->profile_photo);
} else {
$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);
}
}
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)
{
try {
$restaurants = ManageRestaurant::with('operatingHours')->select(
$restaurants = ManageRestaurant::with('operatingHours','closedRestaurant')->select(
'id',
'name',
'image',
@@ -43,6 +43,7 @@ class RestaurantApiServices
->where('restaurant_xid', $restaurant['id'])
->exists();
$restaurant['is_favourite'] = $isFavourite;
// $restaurant['operating_hours'] = getOpeningHoursOfRestaurant($restaurant['name']);// will update later
}
return jsonResponseWithSuccessMessage(__('auth.data_fetched_successfully'), $restaurants, 200);
@@ -121,6 +122,8 @@ class RestaurantApiServices
->exists();
$rest->is_favourite = $isFavourite;
$redeem = RedeemRestaurant::where('iam_principal_xid', $customerIamId)
->where('manage_restaurants_xid', $rest->id)
->where('is_redeem', "1")
@@ -131,6 +134,10 @@ class RestaurantApiServices
// $timeIntervalHours = $Timeinterval->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);

View File

@@ -21,5 +21,9 @@ return [
'stripe_secret_key' => env('STRIPE_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,
number: true,
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: {
@@ -122,11 +132,17 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
required: "Please enter the maximum number of cocktails",
number: "Maximum number of cocktails must be a number",
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',
submitHandler: function (form) {
e.preventDefault(); // Prevent default form submission
e.preventDefault();
var form = $('#update_restaurant_form')[0];
var formData = new FormData(form);
@@ -163,7 +179,6 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
},
error: function (xhr, status, error) {
toastr.error('Something Went Wrong');
// Handle error
},
complete: function () {
$('#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',
'confirmed_password' => 'please confirm your passsword',
'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="form-group">
<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 class="col-md-6">
@@ -138,10 +141,12 @@
<div class="col-md-12">
<div class="notification-card">
<h6>Delivery Schedule</h6>
<label for="company-name" class="label">Delivery Schedule</label>
<div class="row">
<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">
<input type="radio" class="form-control" name="schedule_radio1"
id="push_schedule_radi01" value="0">
@@ -182,193 +187,212 @@
</div>
@endsection
@section('section_script')
<script>
$(document).ready(function() {
// Custom validator for checking state checkboxes
$.validator.addMethod('stateRequired', function(value, element) {
let selectedUserType = $('input[name="user_type"]:checked').val();
if (selectedUserType) {
let dropdownId = `dropdown-${selectedUserType}`;
return $(`#${dropdownId} .state-checkbox:checked`).length > 0;
}
return true;
}, 'Please select at least one state.');
<script>
$(document).ready(function() {
// Custom validator for checking state checkboxes
$.validator.addMethod('stateRequired', function(value, element) {
let selectedUserType = $('input[name="user_type"]:checked').val();
if (selectedUserType) {
let dropdownId = `dropdown-${selectedUserType}`;
return $(`#${dropdownId} .state-checkbox:checked`).length > 0;
}
return true;
}, 'Please select at least one state.');
// Validate the form
$('#send_notification_form').validate({
ignore: [],
debug: false,
rules: {
title: {
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);
// Validate the form
$('#send_notification_form').validate({
ignore: [],
debug: false,
rules: {
title: {
required: true
},
processData: false,
contentType: false,
success: function(result) {
if (result.status_code == 200) {
toastr.success('Data Added Successfully');
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);
description: {
required: true
},
image: {
required: true
},
user_type: {
required: true
},
schedule_radio1: {
required: true
},
schedule_date: {
required: function() {
return $('#push_schedule_radi02').is(':checked');
}
$('#store_notification_btn').attr('disabled', false);
$('#store_notification_btn').text('Submit');
},
});
}
});
// Hide date and time input by default
$('.checkbox-btsss').hide();
// 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);
'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,
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) {
var checkboxes = dropdown.querySelectorAll('.form-check-input');
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].disabled = disable;
// Hide date and time input by default
$('.checkbox-btsss').hide();
// 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]);
}
}
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>
@endsection

View File

@@ -1,83 +1,91 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage-notification';
@endphp
<div class="layout-px-spacing">
<div class="middle-content container-xxl p-0">
<div class="row layout-top-spacing ">
<div class="top-tabel">
<div class="row">
<div class="col-md-4 left">
<a class="d-flex align-items-center justify-content-center pl-2"
href="{{ route('manage.notification')}}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg')}}">
<h6 class="card-title p-0">View Details</h6>
</a>
</div>
@php
$currentPage = 'manage-notification';
@endphp
<div class="layout-px-spacing">
<div class="middle-content container-xxl p-0">
<div class="row layout-top-spacing ">
<div class="top-tabel">
<div class="row">
<div class="col-md-4 left">
<a class="d-flex align-items-center justify-content-center pl-2"
href="{{ route('manage.notification') }}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
<h6 class="card-title p-0">View Details</h6>
</a>
</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 class="col-md-6 mb-10">
<table>
<tr class="title">
<td>Recipients :</td>
{{-- <td>Last Modified Date :</td> --}}
</tr>
<tr class="w-100">
</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>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')
Customer
@else
Resturant
@endif
</td>
<td>{{ \Carbon\Carbon::parse($notification->date_added)->format('d/m/y') }}
</td>
</tr>
</tr>
</table>
</div>
</table>
</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>
@endsection

View File

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

View File

@@ -123,6 +123,7 @@
$timeQuantity = $timeInterval->quantity ?? '';
@endphp
<div class="col-md-6">
<div class="form-group">
<label for="timeHours" class="label">Time in hours between redeeming two
@@ -196,6 +197,30 @@
</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">
<button class="download-btn "style="width: 30%;" id="update_restaurant">
<span>Submit</span>
@@ -324,6 +349,16 @@
try_on_4: {
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: {
name: {
@@ -379,6 +414,12 @@
try_on_4: {
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',
submitHandler: function(form) {
@@ -425,4 +466,17 @@
});
});
</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

View File

@@ -42,6 +42,7 @@
<th class="text-center">Sr no</th>
<th class="text-center">Restaurant Name</th>
<th class="text-center">Restaurant ID</th>
<th class="text-center">State</th>
<th class="text-center">Status</th>
<th class="no-content">Action</th>
</tr>
@@ -60,6 +61,7 @@
<td class="text-center">{{ $count }}</td>
<td class="text-center">{{ $restaurants->name }}</td>
<td class="text-center">{{ $restaurants->restaurant_id }}</td>
<td class="text-center">{{ $restaurants->state->name }}</td>
<td class="text-center">
<form>
<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 Image</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>
</tr>
@@ -56,7 +56,7 @@
<span>No date</span>
@endif
</td>
<td class="text-start">{{ $redeemDetail->count }}</td>
{{-- <td class="text-start">{{ $redeemDetail->count }}</td> --}}
<!-- <td class="text-center">
<div class="switch-btn" id="status-change">
<input type="checkbox" id="switch{{ $redeemDetail['id'] }}"
@@ -67,7 +67,7 @@
data-off-label="Inactive"></label>
</div>
</td> -->
<td class="text-center">
<div class="switch-btn">
<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>
</div>
</td>
</tr>
@endforeach

View File

@@ -63,6 +63,7 @@ Route::middleware(['customerApiBasicAuth'])->group(function () {
Route::post('/v1/reset-user-password', [CustomerControllerApi::class, 'resetUserPassword']);
Route::post('/v1/customer-logout', [CustomerControllerApi::class, 'customerLogout']);
Route::post('/v1/delete_account', [CustomerControllerApi::class, 'destroyAccount']);
Route::get('/v1/check_subscription', [CustomerControllerApi::class, 'CheckSubscription']);
//*******************************************************Restaurant********************************************************
Route::get('/v1/detail-of-restaurant/{id}', [RestaurantControllerApi::class, 'DetailRestaurant']);
@@ -93,6 +94,8 @@ Route::middleware(['customerApiBasicAuth'])->group(function () {
//*******************************************************Rules ********************************************************
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::get('/forgot_password', [LoginController::class, '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('/rules_edit/{id}', [ManageRulesController::class, 'edit'])->name('rules_edit');
Route::post('/update_rules', [ManageRulesController::class, 'update']);
});
@@ -232,17 +233,17 @@ Route::group(['middleware' => ['customer.jwt.verify']], 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::get('thank-you', [SubscriptionController::class, 'thankyou'])->name('thankyou');
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::post('subscribe-to-plan', [SubscriptionController::class, 'subscriptionToPlan'])->name('subscribe-to-plan');
Route::get('thank-you', [SubscriptionController::class, 'thankyou'])->name('thankyou');
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::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('cancel-subscription', [SubscriptionController::class, 'cancelSubscription'])->name('cancel-subscription');