@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\APIs\RestaurantApi;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\APIs\RestaurantService\RedeemApiService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Exception;
|
||||
|
||||
class RedeemControllerApi extends Controller
|
||||
{
|
||||
protected $RedeemApiService;
|
||||
|
||||
public function __construct(RedeemApiService $RedeemApiService)
|
||||
{
|
||||
$this->RedeemApiService = $RedeemApiService;
|
||||
}
|
||||
|
||||
public function undoRedemption(Request $request)
|
||||
{
|
||||
try {
|
||||
$token = readRestHeaderToken();
|
||||
if ($token) {
|
||||
$restIamId = $token['sub'];
|
||||
$validator = Validator::make($request->all(), [
|
||||
'voucher_id' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return jsonResponseWithErrorMessageApi($validator->errors()->first(), 400);
|
||||
}
|
||||
|
||||
return $this->RedeemApiService->undoRedemption($restIamId, $request);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
47
app/Http/Controllers/Admin/ReferralCodeController.php
Normal file
47
app/Http/Controllers/Admin/ReferralCodeController.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\APIs\CustomerAPIs\ReferralCodeServices;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ReferralCodeController extends Controller
|
||||
{
|
||||
|
||||
protected $ReferralCodeServices;
|
||||
|
||||
public function __construct(ReferralCodeServices $ReferralCodeServices)
|
||||
{
|
||||
$this->ReferralCodeServices = $ReferralCodeServices;
|
||||
}
|
||||
public function CheckReferral(Request $request)
|
||||
{
|
||||
try {
|
||||
$token = readHeaderToken();
|
||||
$validator = Validator::make($request->all(), [
|
||||
'referral_code' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$validationErrors = $validator->errors()->all();
|
||||
Log::error("Validation error: " . implode(", ", $validationErrors));
|
||||
return jsonResponseWithErrorMessageApi($validationErrors, 403);
|
||||
}
|
||||
|
||||
if ($token) {
|
||||
$customerIamId = $token['sub'];
|
||||
$response = $this->ReferralCodeServices->CheckReferral($customerIamId, $request);
|
||||
return $response;
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
app/Services/APIs/CustomerAPIs/ReferralCodeServices.php
Normal file
23
app/Services/APIs/CustomerAPIs/ReferralCodeServices.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Services\APIs\CustomerAPIs;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Exception;
|
||||
|
||||
class ReferralCodeServices
|
||||
{
|
||||
public function CheckReferral($customerIamId, $request)
|
||||
{
|
||||
try {
|
||||
dd($request);
|
||||
} catch (Exception $ex) {
|
||||
DB::rollBack();
|
||||
Log::error('Check referral code service failed: ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use App\Helpers\onesignalhelper;
|
||||
use App\Models\admin\ManageVoucherModel;
|
||||
use App\Models\IamPrincipal;
|
||||
use App\Models\IamPrincipalRestaurantRole;
|
||||
use App\Models\ManageRestaurant;
|
||||
use App\Models\MyPassportVoucher;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -13,144 +14,11 @@ use Illuminate\Support\Facades\Log;
|
||||
class RedeemApiService
|
||||
{
|
||||
|
||||
public function getRedemedData($restIamId)
|
||||
{
|
||||
try {
|
||||
$rest = IamPrincipal::findOrFail($restIamId);
|
||||
$data['user_detail'] = IamPrincipal::select('id', 'first_name', 'last_name', 'email_address', 'phone_number', 'date_of_birth')->find($rest->id);
|
||||
|
||||
$restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')->where('principal_xid', $rest->id)->get();
|
||||
|
||||
$restaurantDetail = [];
|
||||
foreach ($restaurantRoles as $role) {
|
||||
$restaurantImage = ManageVoucherModel::select('id', 'coupon_name', 'description', 'thumbnail_image', 'image', 'location_name')->find($role->restaurant_xid);
|
||||
if ($restaurantImage) {
|
||||
$restaurantImage->thumbnail_image = ListingImageUrl('voucher_thumbnail_images', $restaurantImage->thumbnail_image);
|
||||
$restaurantImage->image = ListingImageUrl('voucher_images', $restaurantImage->image);
|
||||
}
|
||||
$restaurantDetail[] = $restaurantImage;
|
||||
|
||||
$redeemedVouchers = [];
|
||||
$redemptionUndoneVouchers = [];
|
||||
|
||||
$vouchers = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone')
|
||||
->where('manage_vouchers_xid', $role->restaurant_xid)
|
||||
->where('is_redeem', 1)
|
||||
->get();
|
||||
|
||||
$redeemptionUndone = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone', 'redeemption_undone_date')
|
||||
->where('manage_vouchers_xid', $role->restaurant_xid)
|
||||
->where([['is_redeem', 0], ['is_redeemption_undone', 1]])
|
||||
->get();
|
||||
|
||||
foreach ($vouchers as $voucher) {
|
||||
$userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1')
|
||||
->where('id', $voucher->iam_principal_xid)
|
||||
->first();
|
||||
|
||||
if ($userDetail) {
|
||||
if ($userDetail->profile_photo) {
|
||||
$userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
} else {
|
||||
$userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
}
|
||||
|
||||
$voucher->user_detail = $userDetail;
|
||||
$redeemedVouchers[] = $voucher;
|
||||
} else {
|
||||
|
||||
Log::error('User detail not found for IAM principal ID: ' . $voucher->iam_principal_xid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($redeemptionUndone as $undone) {
|
||||
$userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1')
|
||||
->where('id', $undone->iam_principal_xid)
|
||||
->first();
|
||||
|
||||
if ($userDetail) {
|
||||
if ($userDetail->profile_photo) {
|
||||
$userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
} else {
|
||||
$userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
}
|
||||
|
||||
$undone->user_detail = $userDetail;
|
||||
$redemptionUndoneVouchers[] = $undone;
|
||||
} else {
|
||||
|
||||
Log::error('User detail not found for IAM principal ID: ' . $undone->iam_principal_xid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$restaurantDetail['redeemed_vouchers'] = $redeemedVouchers;
|
||||
$restaurantDetail['redemption_undone_vouchers'] = $redemptionUndoneVouchers;
|
||||
}
|
||||
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $restaurantDetail, 200);
|
||||
} catch (Exception $ex) {
|
||||
Log::error('Restaurant Get data service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function undoRedemption($restIamId, $request)
|
||||
{
|
||||
try {
|
||||
$voucherDetail = MyPassportVoucher::with('passportData', 'voucherData')->where('id', $request->voucher_id)->first();
|
||||
if ($voucherDetail) {
|
||||
$voucherDetail->update([
|
||||
'is_redeem' => 0,
|
||||
'redeem_date' => null,
|
||||
'is_redeemption_undone' => 1,
|
||||
'redeemption_undone_date' => now(),
|
||||
|
||||
]);
|
||||
$imagePath = ListingImageUrl('voucher_images', $voucherDetail->voucherData->image);
|
||||
$customerTitle = "Your voucher was successfully undo redemption for " . $voucherDetail->passportData->passport_name;
|
||||
$customerMessage = $voucherDetail->voucherData->coupon_name . " Voucher Undo Redemption Successfully";
|
||||
$customerContentType = 'Voucher_UndoRedemption';
|
||||
$customerImageUrl = $imagePath;
|
||||
$customerData = IamPrincipal::where('id', $voucherDetail->iam_principal_xid)->where('notification_status', 1)->where('principal_type_xid', 3)->first();
|
||||
if ($customerData) {
|
||||
$pushNotificationToCustomer = onesignalhelper::sendNotificationApi(
|
||||
$customerData->one_signal_player_id,
|
||||
$customerTitle,
|
||||
$customerMessage,
|
||||
$customerContentType,
|
||||
$customerImageUrl,
|
||||
$id = null
|
||||
);
|
||||
|
||||
onesignalhelper::StoreNotificationDetails($customerData->id, $customerContentType, $customerTitle, $customerImageUrl);
|
||||
}
|
||||
$restUser = IamPrincipal::where('id', $restIamId)->where('notification_status', 1)->where('principal_type_xid', 4)->first();
|
||||
if ($restUser) {
|
||||
$restImagePath = ListingImageUrl('voucher_images', $voucherDetail->voucherData->image);
|
||||
$restTitle = "voucher Undo redemption successful for " . $voucherDetail->passportData->passport_name;
|
||||
$restMessage = $voucherDetail->voucherData->coupon_name . " Voucher Undo Redemption Successfully";
|
||||
$restContentType = 'Voucher_UndoRedemption';
|
||||
$restImageUrl = $restImagePath;
|
||||
|
||||
$pushNotificationToCustomer = onesignalhelper::restSendNotificationApi(
|
||||
$restUser->one_signal_player_id,
|
||||
$restTitle,
|
||||
$restMessage,
|
||||
$restContentType,
|
||||
$restImageUrl,
|
||||
$id = null
|
||||
);
|
||||
|
||||
onesignalhelper::StoreNotificationDetails($restUser->id, $restContentType, $restTitle, $restImageUrl);
|
||||
}
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.data_updated_successfully'), 200);
|
||||
} else {
|
||||
return jsonResponseWithErrorMessageApi(__('auth.voucher_not_found'), 404);
|
||||
}
|
||||
$rest = ManageRestaurant::where('short_id', $request->voucher_id)->first();
|
||||
} catch (Exception $ex) {
|
||||
Log::error('Restaurant update profile service failed: ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
@@ -158,91 +26,91 @@ class RedeemApiService
|
||||
}
|
||||
|
||||
|
||||
public function searchRedemption($restIamId, $request)
|
||||
{
|
||||
try {
|
||||
$searchQuery = $request->input('search_data');
|
||||
// public function searchRedemption($restIamId, $request)
|
||||
// {
|
||||
// try {
|
||||
// $searchQuery = $request->input('search_data');
|
||||
|
||||
$rest = IamPrincipal::findOrFail($restIamId);
|
||||
$data['user_detail'] = IamPrincipal::select('id', 'first_name', 'last_name', 'email_address', 'phone_number', 'date_of_birth')->find($rest->id);
|
||||
// $rest = IamPrincipal::findOrFail($restIamId);
|
||||
// $data['user_detail'] = IamPrincipal::select('id', 'first_name', 'last_name', 'email_address', 'phone_number', 'date_of_birth')->find($rest->id);
|
||||
|
||||
$restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')->where('principal_xid', $rest->id)->get();
|
||||
// $restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')->where('principal_xid', $rest->id)->get();
|
||||
|
||||
$restaurantDetail = [];
|
||||
foreach ($restaurantRoles as $role) {
|
||||
$restaurantImage = ManageVoucherModel::select('id', 'coupon_name', 'description', 'thumbnail_image', 'image', 'location_name')->find($role->restaurant_xid);
|
||||
if ($restaurantImage) {
|
||||
$restaurantImage->thumbnail_image = ListingImageUrl('voucher_thumbnail_images', $restaurantImage->thumbnail_image);
|
||||
$restaurantImage->image = ListingImageUrl('voucher_images', $restaurantImage->image);
|
||||
}
|
||||
$restaurantDetail[] = $restaurantImage;
|
||||
// $restaurantDetail = [];
|
||||
// foreach ($restaurantRoles as $role) {
|
||||
// $restaurantImage = ManageVoucherModel::select('id', 'coupon_name', 'description', 'thumbnail_image', 'image', 'location_name')->find($role->restaurant_xid);
|
||||
// if ($restaurantImage) {
|
||||
// $restaurantImage->thumbnail_image = ListingImageUrl('voucher_thumbnail_images', $restaurantImage->thumbnail_image);
|
||||
// $restaurantImage->image = ListingImageUrl('voucher_images', $restaurantImage->image);
|
||||
// }
|
||||
// $restaurantDetail[] = $restaurantImage;
|
||||
|
||||
$redeemedVouchers = [];
|
||||
$redemptionUndoneVouchers = [];
|
||||
// $redeemedVouchers = [];
|
||||
// $redemptionUndoneVouchers = [];
|
||||
|
||||
$vouchers = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone')
|
||||
->where('manage_vouchers_xid', $role->restaurant_xid)
|
||||
->where('is_redeem', 1)
|
||||
->get();
|
||||
// $vouchers = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone')
|
||||
// ->where('manage_vouchers_xid', $role->restaurant_xid)
|
||||
// ->where('is_redeem', 1)
|
||||
// ->get();
|
||||
|
||||
foreach ($vouchers as $voucher) {
|
||||
$userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1')
|
||||
->where('id', $voucher->iam_principal_xid)
|
||||
->first();
|
||||
// foreach ($vouchers as $voucher) {
|
||||
// $userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1')
|
||||
// ->where('id', $voucher->iam_principal_xid)
|
||||
// ->first();
|
||||
|
||||
if ($userDetail && (stripos($userDetail->first_name, $searchQuery) !== false || stripos($voucher->id, $searchQuery) !== false || stripos($voucher->redeem_date, $searchQuery) !== false)) {
|
||||
if ($userDetail->profile_photo) {
|
||||
$userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
} else {
|
||||
$userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
}
|
||||
// if ($userDetail && (stripos($userDetail->first_name, $searchQuery) !== false || stripos($voucher->id, $searchQuery) !== false || stripos($voucher->redeem_date, $searchQuery) !== false)) {
|
||||
// if ($userDetail->profile_photo) {
|
||||
// $userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
// } else {
|
||||
// $userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
// }
|
||||
|
||||
$voucher->user_detail = $userDetail;
|
||||
$redeemedVouchers[] = $voucher;
|
||||
} else {
|
||||
// $voucher->user_detail = $userDetail;
|
||||
// $redeemedVouchers[] = $voucher;
|
||||
// } else {
|
||||
|
||||
Log::error('User detail not found for IAM principal ID: ' . $voucher->iam_principal_xid);
|
||||
}
|
||||
}
|
||||
// Log::error('User detail not found for IAM principal ID: ' . $voucher->iam_principal_xid);
|
||||
// }
|
||||
// }
|
||||
|
||||
$redeemptionUndone = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone', 'redeemption_undone_date')
|
||||
->where('manage_vouchers_xid', $role->restaurant_xid)
|
||||
->where([['is_redeem', 0], ['is_redeemption_undone', 1]])
|
||||
->get();
|
||||
// $redeemptionUndone = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone', 'redeemption_undone_date')
|
||||
// ->where('manage_vouchers_xid', $role->restaurant_xid)
|
||||
// ->where([['is_redeem', 0], ['is_redeemption_undone', 1]])
|
||||
// ->get();
|
||||
|
||||
foreach ($redeemptionUndone as $undone) {
|
||||
$userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1')
|
||||
->where('id', $undone->iam_principal_xid)
|
||||
->first();
|
||||
// foreach ($redeemptionUndone as $undone) {
|
||||
// $userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1')
|
||||
// ->where('id', $undone->iam_principal_xid)
|
||||
// ->first();
|
||||
|
||||
if ($userDetail && (stripos($userDetail->first_name, $searchQuery) !== false || stripos($undone->id, $searchQuery) !== false || stripos($undone->redeemption_undone_date, $searchQuery) !== false)) {
|
||||
if ($userDetail->profile_photo) {
|
||||
$userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
} else {
|
||||
$userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
}
|
||||
// if ($userDetail && (stripos($userDetail->first_name, $searchQuery) !== false || stripos($undone->id, $searchQuery) !== false || stripos($undone->redeemption_undone_date, $searchQuery) !== false)) {
|
||||
// if ($userDetail->profile_photo) {
|
||||
// $userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo);
|
||||
// } else {
|
||||
// $userDetail->profile_photo = asset('public/assets/img/blankProfile.png');
|
||||
// }
|
||||
|
||||
$undone->user_detail = $userDetail;
|
||||
$redemptionUndoneVouchers[] = $undone;
|
||||
} else {
|
||||
// $undone->user_detail = $userDetail;
|
||||
// $redemptionUndoneVouchers[] = $undone;
|
||||
// } else {
|
||||
|
||||
Log::error('User detail not found for IAM principal ID: ' . $undone->iam_principal_xid);
|
||||
}
|
||||
}
|
||||
// Log::error('User detail not found for IAM principal ID: ' . $undone->iam_principal_xid);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (empty($searchQuery)) {
|
||||
$restaurantDetail['redeemed_vouchers'] = $redeemedVouchers;
|
||||
$restaurantDetail['redemption_undone_vouchers'] = $redemptionUndoneVouchers;
|
||||
}
|
||||
// if (empty($searchQuery)) {
|
||||
// $restaurantDetail['redeemed_vouchers'] = $redeemedVouchers;
|
||||
// $restaurantDetail['redemption_undone_vouchers'] = $redemptionUndoneVouchers;
|
||||
// }
|
||||
|
||||
$restaurantDetail['redeemed_vouchers'] = $redeemedVouchers;
|
||||
$restaurantDetail['redemption_undone_vouchers'] = $redemptionUndoneVouchers;
|
||||
}
|
||||
// $restaurantDetail['redeemed_vouchers'] = $redeemedVouchers;
|
||||
// $restaurantDetail['redemption_undone_vouchers'] = $redemptionUndoneVouchers;
|
||||
// }
|
||||
|
||||
return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $restaurantDetail, 200);
|
||||
} catch (Exception $ex) {
|
||||
Log::error('Restaurant Get data service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
// return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $restaurantDetail, 200);
|
||||
// } catch (Exception $ex) {
|
||||
// Log::error('Restaurant Get data service failed : ' . $ex->getMessage());
|
||||
// return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ $(document).on("click", ".restaurant_unarchive", function (e) {
|
||||
// let base_url = url_path;
|
||||
// var status = $(this).prop("checked") == true ? 1 : 0;
|
||||
// var rest_user_id = $(this).data("id");
|
||||
|
||||
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// dataType: "json",
|
||||
@@ -112,7 +112,7 @@ $(document).on("click", ".restaurant_unarchive", function (e) {
|
||||
// let base_url = url_path;
|
||||
// var rest_user_id = $(this).data("id");
|
||||
// var status = 1;
|
||||
|
||||
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// dataType: "json",
|
||||
@@ -126,19 +126,19 @@ $(document).on("click", ".restaurant_unarchive", function (e) {
|
||||
// "timeOut": 500
|
||||
// }
|
||||
// toastr.success("User approved and status activated successfully. !!");
|
||||
|
||||
|
||||
// // Update the switch to active
|
||||
// $('#switch' + rest_user_id).prop('checked', true);
|
||||
// },
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
// // Handle disapprove button click
|
||||
// $(".disapprove-btn").on("click", function () {
|
||||
// let base_url = url_path;
|
||||
// var rest_user_id = $(this).data("id");
|
||||
// var status = 0;
|
||||
|
||||
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// dataType: "json",
|
||||
@@ -149,112 +149,30 @@ $(document).on("click", ".restaurant_unarchive", function (e) {
|
||||
// },
|
||||
// success: function (data) {
|
||||
// toastr.error("User disapproved and status deactivated successfully. !!");
|
||||
|
||||
|
||||
// // Update the switch to inactive
|
||||
// $('#switch' + rest_user_id).prop('checked', false);
|
||||
// },
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
// $(".rest_users_table").on("change", ".active_rest_user", function () {
|
||||
// // Revert the switch change
|
||||
// var rest_user_id = $(this).data("id");
|
||||
// var currentStatus = $(this).prop("checked");
|
||||
|
||||
|
||||
// // Revert the switch state
|
||||
// $(this).prop("checked", !currentStatus);
|
||||
|
||||
|
||||
// toastr.options = {
|
||||
// "timeOut": 6000
|
||||
// }
|
||||
// toastr.error("You can only change the status using Approve/Disapprove buttons.");
|
||||
// });
|
||||
|
||||
|
||||
// });
|
||||
$(document).ready(function () {
|
||||
// Handle approve button click
|
||||
$(".approve-btn").on("click", function () {
|
||||
let base_url = url_path;
|
||||
var rest_user_id = $(this).data("id");
|
||||
var switchElement = $('#switch' + rest_user_id);
|
||||
|
||||
// Check current status
|
||||
if (switchElement.prop('checked')) {
|
||||
toastr.options = {
|
||||
"timeOut": 500
|
||||
}
|
||||
toastr.warning("User is already approved. !!");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: base_url + '/change_rest_status',
|
||||
data: {
|
||||
status: 1,
|
||||
rest_user_id: rest_user_id,
|
||||
},
|
||||
success: function (data) {
|
||||
toastr.options = {
|
||||
"timeOut": 500
|
||||
}
|
||||
toastr.success("User approved and status activated successfully. !!");
|
||||
|
||||
// Update the switch to active
|
||||
switchElement.prop('checked', true);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Handle disapprove button click
|
||||
$(".disapprove-btn").on("click", function () {
|
||||
let base_url = url_path;
|
||||
var rest_user_id = $(this).data("id");
|
||||
var switchElement = $('#switch' + rest_user_id);
|
||||
|
||||
// Check current status
|
||||
if (!switchElement.prop('checked')) {
|
||||
toastr.options = {
|
||||
"timeOut": 500
|
||||
}
|
||||
toastr.warning("User is already disapproved. !!");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: base_url + '/change_rest_status',
|
||||
data: {
|
||||
status: 0,
|
||||
rest_user_id: rest_user_id,
|
||||
},
|
||||
success: function (data) {
|
||||
toastr.error("User disapproved and status deactivated successfully. !!");
|
||||
|
||||
// Update the switch to inactive
|
||||
switchElement.prop('checked', false);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Handle switch change
|
||||
$(".rest_users_table").on("change", ".active_rest_user", function () {
|
||||
// Revert the switch change
|
||||
var currentStatus = $(this).prop("checked");
|
||||
|
||||
// Revert the switch state
|
||||
$(this).prop("checked", !currentStatus);
|
||||
|
||||
toastr.options = {
|
||||
"timeOut": 500
|
||||
}
|
||||
toastr.error("You can only change the status using Approve/Disapprove buttons.");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// $(document).ready(function() {
|
||||
// // console.log('dfkjb');
|
||||
// $('#rest_user_form').validate({
|
||||
@@ -271,17 +189,17 @@ $(document).on("click", ".restaurant_unarchive", function (e) {
|
||||
// user_birth:{
|
||||
// required: true,
|
||||
// },
|
||||
|
||||
|
||||
// restaurant_email: {
|
||||
// required: true,
|
||||
// email: true,
|
||||
// },
|
||||
|
||||
|
||||
// restaurant_phone: {
|
||||
// required: true,
|
||||
// numericCharactersOnly: true
|
||||
// },
|
||||
|
||||
|
||||
// },
|
||||
// messages: {
|
||||
// first_name: {
|
||||
@@ -294,17 +212,17 @@ $(document).on("click", ".restaurant_unarchive", function (e) {
|
||||
// user_birth:{
|
||||
// required: "Please enter date of birth",
|
||||
// },
|
||||
|
||||
|
||||
// restaurant_email: {
|
||||
// required: "Enter email address",
|
||||
// email: "Please enter a valid email address"
|
||||
// },
|
||||
|
||||
|
||||
// restaurant_phone: {
|
||||
// required: "Enter Phone Number",
|
||||
// numericCharactersOnly: "Please enter only numeric characters"
|
||||
// },
|
||||
|
||||
|
||||
// },
|
||||
// errorClass: 'error-message',
|
||||
// submitHandler: function(form) {
|
||||
@@ -313,7 +231,7 @@ $(document).on("click", ".restaurant_unarchive", function (e) {
|
||||
// // console.log(formData);
|
||||
// $('#restaturant_btn').text('Please wait...');
|
||||
// $('#restaturant_btn').attr('disabled', true);
|
||||
|
||||
|
||||
// $.ajaxSetup({
|
||||
// headers: {
|
||||
// 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
@@ -349,6 +267,5 @@ $(document).on("click", ".restaurant_unarchive", function (e) {
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -283,6 +283,45 @@
|
||||
"lengthMenu": [7, 10, 20, 50],
|
||||
"pageLength": 10
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('<button><ul class="navbar-item flex-row ms-lg-auto ms-0"><li class="nav-item dropdown action-dropdown order-lg-0 order-1"><a href="javascript:void(0);"class="nav-link dropdown-toggle user extra-btn" id="actionDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><div class="avatar-container"><div class="avatar avatar-sm avatar-indicators avatar-online"><h3>Filter</h3></div></div></a><div class="dropdown-menu position-absolute" aria-labelledby="actionDropdown"><div class="dropdown-item"><a href="{{ route('manage.contact') }}" id="allFilter" class="default-filter"><span>All</span></a></div><div class="dropdown-item"><a href="{{ route('manage.contact', ['is_reply' => true]) }}" id="activeFilter"><span>Resolved</span></a></div><div class="dropdown-item"><a href="{{ route('manage.contact', ['is_reply' => false]) }}" id="expiredFilter"> <span>Pending</span></a></div></div></li></ul></button>')
|
||||
.insertBefore("#zero-config_filter label");
|
||||
|
||||
// Retrieve the selected filter from local storage
|
||||
var selectedFilter = localStorage.getItem('selectedFilter');
|
||||
|
||||
// If a selected filter exists, set its color
|
||||
if (selectedFilter) {
|
||||
handleChange(selectedFilter);
|
||||
} else {
|
||||
// If no selected filter is found, simulate a click event on the default filter button
|
||||
$('#allFilter').trigger('click');
|
||||
}
|
||||
|
||||
// Add event listeners to filter links
|
||||
$('#activeFilter').on('click', function() {
|
||||
// Prevent the default anchor behavior
|
||||
handleChange('active');
|
||||
// Store selected filter in local storage
|
||||
localStorage.setItem('selectedFilter', 'active');
|
||||
});
|
||||
|
||||
$('#expiredFilter').on('click', function() {
|
||||
// Prevent the default anchor behavior
|
||||
handleChange('expired');
|
||||
// Store selected filter in local storage
|
||||
localStorage.setItem('selectedFilter', 'expired');
|
||||
});
|
||||
|
||||
$('#allFilter').on('click', function() {
|
||||
// Prevent the default anchor behavior
|
||||
handleChange('all');
|
||||
// Store selected filter in local storage
|
||||
localStorage.setItem('selectedFilter', 'all');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).on("click", ".delete_user", function() {
|
||||
|
||||
@@ -283,4 +283,89 @@ $currentPage = 'manage-restaurant_app';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
// Handle approve button click
|
||||
$(".approve-btn").on("click", function () {
|
||||
let base_url = url_path;
|
||||
var rest_user_id = $(this).data("id");
|
||||
var switchElement = $('#switch' + rest_user_id);
|
||||
|
||||
// Check current status
|
||||
if (switchElement.prop('checked')) {
|
||||
toastr.options = {
|
||||
"timeOut": 500
|
||||
}
|
||||
toastr.warning("User is already approved. !!");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: base_url + '/change_rest_status',
|
||||
data: {
|
||||
status: 1,
|
||||
rest_user_id: rest_user_id,
|
||||
},
|
||||
success: function (data) {
|
||||
toastr.options = {
|
||||
"timeOut": 500
|
||||
}
|
||||
toastr.success("User approved and status activated successfully. !!");
|
||||
|
||||
// Update the switch to active
|
||||
switchElement.prop('checked', true);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Handle disapprove button click
|
||||
$(".disapprove-btn").on("click", function () {
|
||||
let base_url = url_path;
|
||||
var rest_user_id = $(this).data("id");
|
||||
var switchElement = $('#switch' + rest_user_id);
|
||||
|
||||
// Check current status
|
||||
if (!switchElement.prop('checked')) {
|
||||
toastr.options = {
|
||||
"timeOut": 500
|
||||
}
|
||||
toastr.warning("User is already disapproved. !!");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: base_url + '/change_rest_status',
|
||||
data: {
|
||||
status: 0,
|
||||
rest_user_id: rest_user_id,
|
||||
},
|
||||
success: function (data) {
|
||||
toastr.error("User disapproved and status deactivated successfully. !!");
|
||||
|
||||
// Update the switch to inactive
|
||||
switchElement.prop('checked', false);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// Handle switch change
|
||||
$(".rest_users_table").on("change", ".active_rest_user", function () {
|
||||
// Revert the switch change
|
||||
var currentStatus = $(this).prop("checked");
|
||||
|
||||
// Revert the switch state
|
||||
$(this).prop("checked", !currentStatus);
|
||||
|
||||
toastr.options = {
|
||||
"timeOut": 500
|
||||
}
|
||||
toastr.error("You can only change the status using Approve/Disapprove buttons.");
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Http\Controllers\Admin\APIs\Customer_API\CustomerControllerApi;
|
||||
use App\Http\Controllers\Admin\APIs\Customer_API\FeedbackApiController;
|
||||
use App\Http\Controllers\Admin\APIs\Customer_API\NotificationController;
|
||||
use App\Http\Controllers\Admin\APIs\Customer_API\RestaurantControllerApi;
|
||||
use App\Http\Controllers\Admin\ReferralCodeController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
|
||||
@@ -67,5 +68,9 @@ Route::middleware(['customerApiBasicAuth'])->group(function () {
|
||||
|
||||
Route::get('/v1/feedback-reactions', [FeedbackApiController::class, 'getFeedbackReaction']);
|
||||
Route::post('/v1/store-feedback', [FeedbackApiController::class, 'storeFeedback']);
|
||||
|
||||
//*******************************************************Check referral code********************************************************
|
||||
Route::post('/v1/check-referral', [ReferralCodeController::class, 'CheckReferral']); //pending
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\APIs\RestaurantApi\RedeemControllerApi;
|
||||
use App\Http\Controllers\Admin\APIs\RestaurantApi\RedeemControllerApi;
|
||||
use App\Http\Controllers\Admin\APIs\RestaurantApi\RestNotificationController;
|
||||
use App\Http\Controllers\Admin\APIs\RestaurantApi\RestAuthApiController;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Admin\APIs\RestaurantApi\RestaurantControllerApi;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
use App\Http\Controllers\Admin\APIs\RestaurantApi\RestCMSController;
|
||||
Route::middleware(['restaurantApiBasicAuth'])->group(function () {
|
||||
|
||||
|
||||
Route::get('/v1/list-restaurant', [RestAuthApiController::class, 'viewresyaurant']);
|
||||
Route::post('/v1/rest-register', [RestAuthApiController::class, 'restRegister']);
|
||||
Route::get('/v1/list-states', [RestAuthApiController::class, 'viewstates']);
|
||||
@@ -35,7 +34,7 @@ Route::middleware(['restaurantApiBasicAuth'])->group(function () {
|
||||
// //*******************************************************Redeemption Data********************************************************
|
||||
|
||||
// Route::get('/v1/fetch-redeem-data', [RedeemControllerApi::class, 'getRedemedData']);
|
||||
// Route::post('/v1/undo-redemption', [RedeemControllerApi::class, 'undoRedemption']);
|
||||
Route::post('/v1/undo-redemption', [RedeemControllerApi::class, 'undoRedemption']);
|
||||
// Route::post('/v1/search-Redemption-data', [RedeemControllerApi::class, 'searchRedemption']);
|
||||
|
||||
// //*******************************************************CMS********************************************************
|
||||
|
||||
Reference in New Issue
Block a user