new updated

This commit is contained in:
Hritikkk9
2024-06-28 19:10:02 +05:30
122 changed files with 8449 additions and 4498 deletions

View File

@@ -30,59 +30,56 @@ class ReinstateRestaurant extends Command
* Execute the console command.
*/
public function handle()
{
try {
$recordsToUpdate = RedeemRestaurant::where('is_redeem', 1)->get();
public function handle()
{
try {
$recordsToUpdate = RedeemRestaurant::where('is_redeem', 1)->get();
foreach ($recordsToUpdate as $record) {
//find restaurant
$managerestaurant = ManageRestaurant::where('id', $record->manage_restaurants_xid)->first();
foreach ($recordsToUpdate as $record) {
//find restaurant
$managerestaurant = ManageRestaurant::where('id', $record->manage_restaurants_xid)->first();
$customerData = IamPrincipal::where('id', $record->iam_principal_xid)->where('notification_status', 1)->where('principal_type_xid',3)->first(); //fetch customer
$customerData = IamPrincipal::where('id', $record->iam_principal_xid)->where('notification_status', 1)->where('principal_type_xid', 3)->first(); //fetch customer
if ($managerestaurant && $managerestaurant->is_active == 1) {
$redeemDate = Carbon::parse($record->redeem_date);
if ($managerestaurant && $managerestaurant->is_active == 1) {
$redeemDate = Carbon::parse($record->redeem_date);
$fourHourPlusTimeOfRecord = $redeemDate->copy()->addHours(4);
$fourHourPlusTimeOfRecord = $redeemDate->copy()->addHours($managerestaurant->time_hours);
$currentTime = Carbon::now();
$currentTime = Carbon::now();
if ($currentTime > $fourHourPlusTimeOfRecord) {
$record->update([
'is_redeem' => 0,
'redeem_date' => null,
'count' => $record->count + 1,
'is_redeemption_undone' => 0,
'redeemption_undone_date' => null,
]);
$restImage = ListingImageUrl('restaurant_images', $managerestaurant->image);
$title = "Your " . $managerestaurant->name . " Reinstate successfully";
$message = "Your " . $managerestaurant->name . " Reinstate successfully";
$content_type = 'Restaurant Reinstate';
$imageUrl = $restImage;
if ($currentTime > $fourHourPlusTimeOfRecord) {
$record->update([
'is_redeem' => 0,
'redeem_date' => null,
'count' => $record->count + 1,
'is_redeemption_undone' => 0,
'redeemption_undone_date' => null,
]);
$restImage = ListingImageUrl('restaurant_images', $managerestaurant->image);
$title = "Your " . $managerestaurant->name . " Reinstate successfully";
$message = "Your " . $managerestaurant->name . " Reinstate successfully";
$content_type = 'Restaurant Reinstate';
$imageUrl = $restImage;
onesignalhelper::sendNotificationApi(
$customerData->one_signal_player_id,
$title,
$message,
$content_type,
$imageUrl,
$id = null
);
Log::info('Reinstate of record done at ' . now());
onesignalhelper::StoreNotificationDetails($customerData->id, $content_type, $title, $restImage);
}
}
}
Log::info('Reinstate task ran successfully at ' . now());
} catch (\Exception $e) {
Log::error('Reinstate function failed: ' . $e->getMessage());
}
}
onesignalhelper::sendNotificationApi(
$customerData->one_signal_player_id,
$title,
$message,
$content_type,
$imageUrl,
$id = null
);
Log::info('Reinstate of record done at ' . now());
onesignalhelper::StoreNotificationDetails($customerData->id, $content_type, $title, $restImage);
}
}
}
Log::info('Reinstate task ran successfully at ' . now());
} catch (\Exception $e) {
Log::error('Reinstate function failed: ' . $e->getMessage());
}
}
}

View File

@@ -1,56 +0,0 @@
<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use App\Models\IamPrincipal;
use Illuminate\Support\Collection;
class CustomerExportSelected implements FromCollection, WithHeadings
{
protected $ids;
public function __construct($ids)
{
$this->ids = $ids;
}
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
$selectedCareIds = explode(',', $this->ids);
$selected_customer = IamPrincipal::whereIn('id', $selectedCareIds)
->orderBy('id', 'Desc')
->select(
'first_name',
'email_address',
'date_of_birth',
'phone_number'
)
->get();
return $selected_customer;
}
/**
* @return array
*/
public function headings(): array
{
return [
'first_name',
'email_address',
'date_of_birth',
'phone_number'
];
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Exports;
use App\Models\ManageFeedback;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
class FeedbakExport implements FromCollection, WithHeadings
{
public function collection()
{
return ManageFeedback::with(['principal', 'feedbackReaction', 'restaurant'])->get()->map(function ($feedback) {
$feedbackType = 'N/A';
if ($feedback->is_app_feedback) {
$feedbackType = 'App Feedback';
} elseif ($feedback->is_restaurant_feedback) {
$feedbackType = 'Restaurant Feedback';
}
return [
'Customer Id' => $feedback->principal ? $feedback->principal->id : 'N/A',
'First Name' => $feedback->principal ? $feedback->principal->first_name : 'N/A',
'Last Name' => $feedback->principal ? $feedback->principal->last_name : 'N/A',
'Feedback Reaction' => $feedback->feedbackReaction ? $feedback->feedbackReaction->feedback_reaction_title : 'N/A',
'Comment' => $feedback->comment,
'Date Received' => $feedback->created_at,
'Feedback Type' => $feedbackType,
'Restaurant Name' => $feedback->restaurant ? $feedback->restaurant->name : 'N/A',
];
});
}
public function headings(): array
{
return [
'Customer Id',
'First Name',
'Last Name',
'Feedback Reaction',
'Comment',
'Date Received',
'App Feedback',
'Restaurant Feedback',
'Restaurant Name'
];
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Exports;
use App\Models\ManageRestaurant;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
class RestaurantExport implements FromCollection, WithHeadings
{
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return ManageRestaurant::select(
'name',
'description',
'phone_number',
'restaurant_id',
'address',
'bio',
'try_on_1',
'try_on_2',
'try_on_3',
'try_on_4',
'exclusion',
'latitude',
'longtitude',
'is_active'
)->get();
}
//function header in excel
public function headings(): array
{
return [
'Restaurant Name',
'Description',
'Phone Number',
'Restaurant Id',
'Address',
'Bio',
'Try on 1',
'Try on 2',
'Try on 3',
'Try on 4',
'Exclusion',
'Latitude',
'Longitude',
'Active staus'
];
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Exports;
use App\Models\ManageRestaurant;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
class RestaurantExportSelected implements FromCollection, WithHeadings
{
protected $ids;
public function __construct($ids)
{
$this->ids = $ids;
}
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
$selectedCareIds = explode(',', $this->ids);
$selected_restaurant = ManageRestaurant::whereIn('id', $selectedCareIds)
->orderBy('id', 'Desc')
->select(
'name',
'description',
'phone_number',
'restaurant_id',
'address',
'bio',
'try_on_1',
'try_on_2',
'try_on_3',
'try_on_4',
'exclusion',
'latitude',
'longtitude',
'is_active'
)
->get();
return $selected_restaurant;
}
//function header in excel
public function headings(): array
{
return [
'Restaurant Name',
'Description',
'Phone Number',
'Restaurant Id',
'Address',
'Bio',
'Try on 1',
'Try on 2',
'Try on 3',
'Try on 4',
'Exclusion',
'Latitude',
'Longitude',
'Active staus'
];
}
}

View File

@@ -13,14 +13,30 @@ class customer_export implements FromCollection , WithHeadings
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return IamPrincipal::select(
'first_name',
'email_address',
'date_of_birth',
'phone_number'
)->get();
public function collection(){
return IamPrincipal::where('principal_type_xid',3)
->select('first_name',
'last_name',
'email_address',
'date_of_birth',
'state_xid',
'phone_number'
)
->get()
->map(function ($customer) {
return [
'first_name' => $customer->first_name,
'last_name' => $customer->last_name,
'email_address' => $customer->email_address,
'date_of_birth'=> \Carbon\Carbon::parse($customer->date_of_birth)->format('m/d/Y'),
'state_xid' => $customer->state->name ?? '', // Access the state name and handle null
'phone_number' => $customer->phone_number,
];
});
}
//function header in excel
@@ -28,9 +44,17 @@ class customer_export implements FromCollection , WithHeadings
{
return [
'first_name',
'last_name',
'email_address',
'date_of_birth',
'state_name',
'phone_number'
];
}
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\FromCollection;
use App\Models\IamPrincipal;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
class customer_export_selected implements FromCollection, WithHeadings
{
protected $ids;
public function __construct($ids)
{
$this->ids = explode(',', $ids); // Ensure ids are split into an array
}
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
// Log the ids for debugging purposes
Log::info('Fetching data for IDs: ' . implode(',', $this->ids));
$selected_customer = IamPrincipal::whereIn('id', $this->ids)
->with('state:id,name') // Eager load the state relationship
->orderBy('id', 'desc')
->select(
'first_name',
'last_name',
'email_address',
'date_of_birth',
'state_xid',
'phone_number'
)
->get()
->map(function ($customer) {
return [
'first_name' => $customer->first_name,
'last_name' => $customer->last_name,
'email_address' => $customer->email_address,
'date_of_birth' => \Carbon\Carbon::parse($customer->date_of_birth)->format('m/d/Y'), // Format the date
'state_xid' => $customer->state->name ?? '', // Access the state name and handle null
'phone_number' => $customer->phone_number,
];
});
// Log the fetched data for debugging purposes
Log::info('Fetched customer data: ' . $selected_customer->toJson());
return new Collection($selected_customer);
}
public function headings(): array
{
return [
'First Name',
'Last Name',
'Email Address',
'Date of Birth',
'State Name',
'Phone Number'
];
}
}

View File

@@ -269,4 +269,20 @@ class AuthController extends Controller
return response()->json(__('something_went_wrong'), 500);
}
}
/**
* Created By : Sayli Raut
* Created at : 19 June 2024
* Use : Search State.
*/
public function searchState(Request $request)
{
try {
return $this->AuthServices->searchState($request);
} catch (\Exception $ex) {
Log::error("Login API Failed: " . $ex->getMessage());
return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500);
}
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace App\Http\Controllers\Admin\APIs\Customer_API;
use App\Http\Controllers\Controller;
use App\Models\FeedbackReaction;
use App\Services\APIs\CustomerAPIs\FeedbackApiServices;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Request;
use Exception;
use Illuminate\Support\Facades\Validator;
class FeedbackApiController extends Controller
{
protected $FeedbackApiServices;
public function __construct(FeedbackApiServices $FeedbackApiServices)
{
$this->FeedbackApiServices = $FeedbackApiServices;
}
/**
* Created By : Sayli Raut
* Created at : 07 June 2024
* Use : Storing feedback.
*/
public function getFeedbackReaction(Request $request)
{
try {
$token = readHeaderToken();
if ($token) {
$feedbackReactions = FeedbackReaction::select('id', 'feedback_reaction_title')->get();
if ($feedbackReactions->isEmpty()) {
Log::info('Reactions not found.');
return jsonResponseWithSuccessMessageApi(__('success.data_not_found'), [], 200);
}
$responseData['result'] = $feedbackReactions;
return jsonResponseWithSuccessMessageApi(__('success.data_fetched_successfully'), $feedbackReactions, 200);
} else {
return jsonResponseWithErrorMessageApi(__('auth.user_deleted'), 409);
}
} catch (Exception $e) {
Log::error('Feedback Reaction API failed: ' . $e);
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
public function storeFeedback(Request $request)
{
try {
$token = readHeaderToken();
$validator = Validator::make($request->all(), [
'reaction' => 'required|numeric',
'is_app_feedback' => 'required|boolean',
'is_restaurant_feedback' => 'required|boolean',
'restaurant_id' => $request->input('is_restaurant_feedback') == 1 ? 'required|integer' : '',
// 'comment' => '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->FeedbackApiServices->storeFeedback($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);
}
}
}

View File

@@ -171,7 +171,7 @@ class RestaurantControllerApi extends Controller
}
}
/**
/**
* Created By : Sayli Raut
* Created at : 04 June 2024
* Use : To redeem restaurant.
@@ -198,4 +198,26 @@ class RestaurantControllerApi extends Controller
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
/**
* Created By : Sayli Raut
* Created at : 20 June 2024
* Use : To search from restaurant.
*/
public function searchRestaurant(Request $request)
{
try {
$token = readHeaderToken();
if ($token) {
$customerIamId = $token['sub'];
return $this->RestaurantApiServices->searchRestaurant($customerIamId, $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);
}
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Admin\APIs\Customer_API;
use App\Http\Controllers\Controller;
use App\Services\APIs\CustomerAPIs\RulesApiServices;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Request;
class RulesControllerAPI extends Controller
{
protected $RulesApiServices;
public function __construct(RulesApiServices $RulesApiServices)
{
$this->RulesApiServices = $RulesApiServices;
}
/**
* Created By : sayli Raut
* Created at : 19 June 2024
* Use : To get voucher rules and regulation.
*/
public function getVoucherRules()
{
try {
$token = readHeaderToken();
if ($token) {
$customerIamId = $token['sub'];
$response = $this->RulesApiServices->getVoucherRules();
return jsonResponseWithSuccessMessageApi(__('success.data_fetched_successfully'), $response, 200);
} else {
return jsonResponseWithErrorMessageApi(__('auth.user_deleted'), 409);
}
} catch (\Exception $e) {
Log::error('Voucher rules get data controller function failed: ' . $e->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
}

View File

@@ -0,0 +1,86 @@
<?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;
}
/**
* Created By : sayli Raut
* Created at : 11 June 2024
* Use : To get redeem voucher/restaurant.
*/
public function getRedemedData()
{
try {
$token = readRestHeaderToken();
if ($token) {
$restIamId = $token['sub'];
return $this->RedeemApiService->getRedemedData($restIamId);
} 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);
}
}
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);
}
}
/**
* Created By : sayli Raut
* Created at : 11 June 2024
* Use : Search Redemption coupon.
*/
public function searchRedemption(Request $request)
{
try {
$token = readRestHeaderToken();
if ($token) {
$restIamId = $token['sub'];
return $this->RedeemApiService->searchRedemption($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);
}
}
}

View File

@@ -1,6 +1,7 @@
<?php
namespace App\Http\Controllers\Admin\APIs\RestaurantApi;
use App\Services\APIs\RestaurantService\RestAuthApiService;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
@@ -18,7 +19,7 @@ class RestAuthApiController extends Controller
public function __construct(RestAuthApiService $RestAuthApiService)
{
$this->RestAuthApiService = $RestAuthApiService;
}
}
/**
* Created By : sayali parab
@@ -35,7 +36,7 @@ class RestAuthApiController extends Controller
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
/**
/**
* Created By : sayali parab
* Created at : 30 May 2024
* Use : Restaurant State.
@@ -50,7 +51,7 @@ class RestAuthApiController extends Controller
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
/**
/**
* Created By : sayali parab
* Created at : 30 May 2024
* Use : Restaurant Registration.
@@ -63,7 +64,7 @@ class RestAuthApiController extends Controller
'last_name' => 'required|string|min:2|max:100',
'role' => 'required|string|min:2|max:100',
'restaurant_xid' => 'required',
'state_xid'=>'required',
// 'state_xid'=>'required',
'date_of_birth' => 'required|date',
'email_address' => [
'required',
@@ -88,8 +89,8 @@ class RestAuthApiController extends Controller
return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500);
}
}
/**
* Created By : sayali parab
/**
* Created By : sayali parab
* Created at : 31 May 2024
* Use : Restaurant login.
*/
@@ -112,7 +113,7 @@ class RestAuthApiController extends Controller
return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500);
}
}
/**
/**
* Created By : sayali parab
* Created at : 31 May 2024
* Use : Forgot password for restaurant.
@@ -146,7 +147,7 @@ class RestAuthApiController extends Controller
return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500);
}
}
/**
/**
* Created By : sayali parab
* Created at : 31 May 2024
* Use : verify otp for restaurant.
@@ -230,4 +231,22 @@ class RestAuthApiController extends Controller
}
}
/**
* Created By : Sayli Raut
* Created at : 12 June 2024
* Use : Search Restaurant .
*/
public function searchRest(Request $request)
{
try {
return $this->RestAuthApiService->searchRest($request);
} catch (\Exception $ex) {
Log::error("Login API Failed: " . $ex->getMessage());
return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500);
}
}
}

View File

@@ -95,6 +95,7 @@ class RestaurantControllerApi extends Controller
$restIamId = $token['sub'];
$validator = Validator::make($request->all(), [
'name' => 'required',
'phone_number' => 'required',
'address' => 'required',
'bio' => 'required',
'try_on_1' => 'required',

View File

@@ -39,8 +39,10 @@ class AboutUsController extends Controller
public function edit($id)
{
$edit_privacy_policy = Aboutus::find($id)->toArray();
return view('Admin.pages.manage_cms.manage_aboutus.manage_about_us_cust', compact('edit_privacy_policy'));
$edit_aboutUs_cust = Aboutus::find($id)->toArray();
// dd($edit_privacy_policy);
return view('Admin.pages.manage_cms.manage_aboutus.manage_about_us_cust', compact('edit_aboutUs_cust'));
}
@@ -165,6 +167,7 @@ class AboutUsController extends Controller
DB::beginTransaction();
if (isset($request->about_image)) {
$image = $request->about_image;
$image_db = null;
} else {
@@ -191,4 +194,40 @@ class AboutUsController extends Controller
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
//new update customer aboutUs
/**
* Created By : sayali parab
* Created at : 11 May 2024
* Use : To update customer about us page.
*/
public function update_aboutUS_Cust(Request $request)
{
$update = Aboutus::find($request->about_custom_id);
$update->description = $request->input('about_us');
// dd( $update);
$update->save();
return response()->json(['success' => true, 'status' => 200]);
}
//new update restatuant aboutUs
/**
* Created By : sayali parab
* Created at : 11 May 2024
* Use : To update resturant about us page.
*/
public function update_aboutUS_Rest(Request $request)
{
$update_rest = Aboutus::find($request->about_rest_id);
$update_rest->description = $request->input('about_rest');
// dd($update_rest);
$update_rest->save();
return response()->json(['success' => true, 'status' => 200]);
}
}

View File

@@ -11,7 +11,7 @@ use App\Models\ManageRestaurant;
class DashboardController extends Controller
{
/**
/**
* Created By : sayali parab
* Created at : 16 May 2024
* Use : To show the dashboard.
@@ -19,145 +19,78 @@ class DashboardController extends Controller
// public function showDashboard(){
// return view('Admin.dashboard');
// }
public function showDashboard()
{
// Fetching data for sorting by day
// $dailyData = OrderedPassport::select(DB::raw("COUNT(*) as count"), DB::raw("DATE(created_at) as date"))
// ->whereBetween('created_at', [now()->subDays(7), now()]) // Fetch data for the last 7 days
// ->groupBy(DB::raw("DATE(created_at)"))
// ->orderBy(DB::raw("DATE(created_at)"))
// ->pluck('count', 'date')
// ->toArray();
// Ensure that $dailyData contains zeros for days with no data
$start_date = now()->subDays(7)->startOfDay();
$end_date = now()->endOfDay();
$formattedDailyData = [];
while ($start_date <= $end_date) {
$formattedDailyData[$start_date->format('Y-m-d')] = isset($dailyData[$start_date->format('Y-m-d')]) ? $dailyData[$start_date->format('Y-m-d')] : 0;
$start_date->addDay();
}
// Default sales chart data (monthly)
// $defaultData = OrderedPassport::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month"))
// ->whereYear('created_at', date('Y'))
// ->groupBy(DB::raw("MONTH(created_at)"))
// ->orderBy(DB::raw("MONTH(created_at)"))
// ->pluck('count', 'month')
// ->toArray();
// Ensure that $defaultData contains zeros for months with no data
$months = range(1, 12);
$formattedDefaultData = [];
foreach ($months as $month) {
$formattedDefaultData[$month] = isset($defaultData[$month]) ? $defaultData[$month] : 0;
}
// $quarterlyData = OrderedPassport::select(
// DB::raw("COUNT(*) as count"),
// DB::raw("QUARTER(created_at) as quarter")
// )
// ->whereYear('created_at', date('Y'))
// ->groupBy(DB::raw("QUARTER(created_at)"))
// ->orderBy(DB::raw("QUARTER(created_at)"))
// ->pluck('count', 'quarter')
// ->toArray();
// Ensure that $quarterlyData contains zeros for quarters with no data
for ($i = 1; $i <= 4; $i++) {
if (!isset($quarterlyData[$i])) {
$quarterlyData[$i] = 0;
}
}
// Fetching data for yearly option
// $yearlyData = OrderedPassport::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
// ->groupBy(DB::raw("YEAR(created_at)"))
// ->pluck('count', 'year')
// ->toArray();
//
// Monthly data
$dataMonthlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month"))
->whereIn('principal_type_xid', [3])
->where('principal_type_xid', 3)
->whereYear('created_at', date('Y'))
->groupBy(DB::raw("MONTH(created_at)"))
->orderBy(DB::raw("MONTH(created_at)"))
->pluck('count', 'month')
->toArray();
// dd($dataMonthlyWithType3);
// return $dataMonthlyWithType3;
$dataMonthlyWithType4 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month"))
->whereIn('principal_type_xid', [4])
->where('principal_type_xid', 4)
->whereYear('created_at', date('Y'))
->groupBy(DB::raw("MONTH(created_at)"))
->orderBy(DB::raw("MONTH(created_at)"))
->pluck('count', 'month')
->toArray();
// Quarterly data
$dataQuarterlyWithType3 = IamPrincipal::select(
DB::raw("COUNT(*) as count"),
DB::raw("QUARTER(created_at) as quarter")
)
->whereIn('principal_type_xid', [3])
->groupBy(DB::raw("QUARTER(created_at)"))
->orderBy(DB::raw("QUARTER(created_at)"))
->pluck('count', 'quarter')
->toArray();
for ($i = 1; $i <= 4; $i++) {
if (!isset($dataQuarterlyWithType3[$i])) {
$dataQuarterlyWithType3[$i] = 0;
}
}
// Fill missing months with zeros
$months = range(1, 12);
$dataMonthlyWithType3 = array_replace(array_fill_keys($months, 0), $dataMonthlyWithType3);
$dataMonthlyWithType4 = array_replace(array_fill_keys($months, 0), $dataMonthlyWithType4);
$dataQuarterlyWithType4 = IamPrincipal::select(
DB::raw("COUNT(*) as count"),
DB::raw("QUARTER(created_at) as quarter")
)
->whereIn('principal_type_xid', [4])
// Quarterly data
$dataQuarterlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("QUARTER(created_at) as quarter"))
->where('principal_type_xid', 3)
->groupBy(DB::raw("QUARTER(created_at)"))
->orderBy(DB::raw("QUARTER(created_at)"))
->pluck('count', 'quarter')
->toArray();
for ($i = 1; $i <= 4; $i++) {
if (!isset($dataQuarterlyWithType4[$i])) {
$dataQuarterlyWithType4[$i] = 0;
}
}
$dataQuarterlyWithType4 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("QUARTER(created_at) as quarter"))
->where('principal_type_xid', 4)
->groupBy(DB::raw("QUARTER(created_at)"))
->orderBy(DB::raw("QUARTER(created_at)"))
->pluck('count', 'quarter')
->toArray();
// Fill missing quarters with zeros
$quarters = range(1, 4);
$dataQuarterlyWithType3 = array_replace(array_fill_keys($quarters, 0), $dataQuarterlyWithType3);
$dataQuarterlyWithType4 = array_replace(array_fill_keys($quarters, 0), $dataQuarterlyWithType4);
// Yearly data
$dataYearlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
->whereIn('principal_type_xid', [3])
->where('principal_type_xid', 3)
->groupBy(DB::raw("YEAR(created_at)"))
->pluck('count', 'year')
->toArray();
// dd($dataYearlyWithType3);
$dataYearlyWithType4 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year"))
->whereIn('principal_type_xid', [4])
->where('principal_type_xid', 4)
->groupBy(DB::raw("YEAR(created_at)"))
->pluck('count', 'year')
->toArray();
$customerCount = IamPrincipal::where('principal_type_xid', '=', 3)->count();
// $activePassports = ManagePassport::where('is_active', 1)->take(12)->get();
// $restaurantCount = ManageRestaurant::where('is_redeem', 1)->count();
$restaurantCount = ManageRestaurant::where('is_active', 1)->count();
// $recent_transaction = OrderedPassport::with('order', 'order_passport', 'carts.passport', 'iamPrincipal')->get()->toArray();
// $datas = MyPassportVoucher::with('passportVouchers', 'passportData', 'customer')->get()->toArray();
// Pass the data to the view
// return view('Admin.dashboard', compact('customerCount', 'activePassports', 'restaurantCount', 'recent_transaction', 'datas', 'formattedDefaultData', 'quarterlyData', 'yearlyData', 'dataMonthlyWithType3', 'dataMonthlyWithType4', 'dataQuarterlyWithType3', 'dataQuarterlyWithType4', 'dataYearlyWithType3', 'dataYearlyWithType4','formattedDailyData'));
return view('Admin.dashboard', compact('customerCount','restaurantCount','dataMonthlyWithType3','dataMonthlyWithType4','dataQuarterlyWithType3', 'dataQuarterlyWithType4', 'dataYearlyWithType3', 'dataYearlyWithType4','formattedDefaultData','quarterlyData'));
return view('Admin.dashboard', compact(
'customerCount',
'restaurantCount',
'dataMonthlyWithType3',
'dataMonthlyWithType4',
'dataQuarterlyWithType3',
'dataQuarterlyWithType4',
'dataYearlyWithType3',
'dataYearlyWithType4'
));
}
}

View File

@@ -30,6 +30,7 @@ class FaqController extends Controller
public function index()
{
$data = $this->faqServices->viewfaq();
// return $data;
return view('Admin.pages.manage_cms.manage_faq.manage_faq')->with($data);
}
/**

View File

@@ -39,7 +39,9 @@ class LoginController extends Controller
'password' => 'required|string',
]);
$user = IamPrincipal::where('email_address', $validatedData['email'])->first();
$user = IamPrincipal::where('email_address', $validatedData['email'])
->whereIn('principal_type_xid', [1, 2])
->first();
if ($user) {
if (Hash::check($validatedData['password'], $user->password)) {

View File

@@ -8,18 +8,76 @@ use App\Mail\ReplyMail;
use App\Models\ManageContactus;
use Illuminate\Support\Facades\Mail;
class ManageContactUsController extends Controller
{ /**
* Created By : sayali parab
* Created at : 05 June 2024
* Use : To get contact us page.
*/
public function index(){
// $queries = ManageContactUs::latest()->get();
$queries = ManageContactUs::all();
{
/**
* Created By : sayali parab
* Created at : 05 June 2024
* Use : To get contact us page.
*/
public function index(Request $request)
{
$isReply = $request->query('is_reply');
if ($isReply == 1) {
$queries = ManageContactUs::with('customer')->where('is_reply', 1)->orderBy('id','desc')->get();
} elseif ($isReply == 0 && $isReply != null) {
$queries = ManageContactUs::with('customer')->where('is_reply', 0)->orderBy('id','desc')->get();
} else {
$queries = ManageContactUs::with('customer')->orderBy('id','desc')->get();
}
// return $queries;
return view('Admin.pages.manage_contact_us.manage_contact', compact('queries'));
}
/**
* Created By : Sayli Raut
* Created at : 10 June 2024
* Use : To send reply.
*/
public function sendReply(Request $request)
{
if (!$request->user_id || $request->user_id == null) {
return response()->json(['error' => 'User not found'], 404);
}
$userId = $request->user_id;
$query = ManageContactus::find($userId);
if (!$query) {
return response()->json(['error' => 'Query not found'], 404);
}
$request->validate([
'reply_message' => 'required|string',
]);
$query->reply_message = $request->input('reply_message');
$query->is_reply = true;
$query->save();
try {
Mail::to($query->email)->send(new \App\Mail\ReplyMail($query));
} catch (\Exception $e) {
return response()->json(['error' => 'Failed to send email', 'message' => $e->getMessage()], 500);
}
return response()->json(['message' => 'Reply sent successfully']);
}
return view('Admin.pages.manage_contact_us.manage_contact',compact('queries'));
/**
* Created By : Sayli Raut
* Created at : 10 June 2024
* Use : To delete query.
*/
public function delete_user($id)
{
$data = ManageContactUs::find($id)->delete();
return redirect()->back()->with('success', '');
}
}

View File

@@ -14,8 +14,12 @@ use App\Exports\customer_export;
use App\Exports\customer_export_selected;
use App\Exports\CustomerExportSelected;
use App\Models\ManageRestaurant;
use App\Models\ManageState;
use App\Models\RedeemRestaurant;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Barryvdh\DomPDF\PDF as DomPDFPDF;
use Carbon\Carbon;
use Exception;
use PDF;
@@ -25,7 +29,7 @@ use PDF;
class ManageCustomerController extends Controller
{
/*
/*
Created By : Sayali Parab
Created at : 28 May 2024
Use : To Get User Page.
@@ -45,7 +49,7 @@ class ManageCustomerController extends Controller
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
/*
/*
Created By : Sayali Parab
Created at : 28 May 2024
Use : To Get Passport Page.
@@ -55,14 +59,18 @@ class ManageCustomerController extends Controller
try {
$customers_data = IamPrincipal::findOrFail($id);
$customers_data = IamPrincipal::with('state', 'contactMessages')->findOrFail($id);
if ($customers_data->contactMessages->isEmpty()) {
Log::info('No contact messages found for customer with ID: ' . $id);
}
// return $customers_data;
return view('Admin.pages.manage_users.manage_customer.view_customer_details', compact('customers_data'));
} catch (Exception $e) {
Log::error("Manage Voucher Page Not Load " . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
/*
/*
Created By : Sayali Parab
Created at : 28 May 2024
Use : To Get Customer data.
@@ -72,31 +80,74 @@ class ManageCustomerController extends Controller
{
try {
$customers_data = IamPrincipal::findOrFail($id);
return view('Admin.pages.manage_users.manage_customer.edit_customer', compact('customers_data'));
$customers_data = IamPrincipal::with('state')->findOrFail($id);
$state = ManageState::where('is_active', 1)->get();
return view('Admin.pages.manage_users.manage_customer.edit_customer', compact('customers_data', 'state'));
} catch (Exception $e) {
Log::error("Manage Voucher Page Not Load " . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
/*
/*
Created By : Sayali Parab
Created at : 28 May 2024
Use : To Update Customer Form.
*/
public function update(Request $request)
{
// Validation rules
$rules = [
'email_address' => [
'required',
'string',
'email',
'max:100',
Rule::unique('iam_principal')->where(function ($query) use ($request) {
return $query->where('principal_type_xid', 3)
->whereNull('deleted_at')
->where('id', '!=', $request->customer_id);
}),
],
'date_of_birth' => [
'required',
'date',
function ($attribute, $value, $fail) {
$dob = Carbon::parse($value);
$age = $dob->age;
if ($age < 21) {
$fail('You must be at least 21 years old.');
}
},
],
];
$messages = [
'email_address.required' => 'Enter email address',
'email_address.email' => 'Please enter a valid email address',
'email_address.unique' => 'This email is already registered',
'date_of_birth.required' => 'Date of Birth is required',
'date_of_birth.date' => 'Please enter a valid date',
];
$validator = Validator::make($request->all(), $rules, $messages);
if ($validator->fails()) {
return response()->json(['errors' => $validator->errors()], 422);
}
try {
DB::beginTransaction();
$customer_data = IamPrincipal::where('id', $request->customer_id)->first();
$customer_data->first_name = $request->input('name');
$customer_data->last_name = $request->input('last_name');
$customer_data->phone_number = $request->input('phone');
$customer_data->email_address = $request->input('email_id');
$customer_data->email_address = $request->input('email_address');
$customer_data->date_of_birth = $request->input('date_of_birth');
$customer_data->state_xid = $request->input('state_xid');
$customer_data->save();
DB::commit();
return jsonResponseWithSuccessMessage(__('success.update_data'));
@@ -150,7 +201,7 @@ class ManageCustomerController extends Controller
return response()->json(['success' => false, 'status' => 500, 'message' => __('auth.something_went_wrong')]);
}
}
/*
/*
Created By : Sayali Parab
Created at : 28 May 2024
Use : To Get pdf.
@@ -171,26 +222,44 @@ class ManageCustomerController extends Controller
}
}
/*
Created By : Sayali Parab
Created at : 28 May 2024
Use : To Get Excel.
*/
// public function exportSelectedCustomer(Request $request)
// {
public function exportSelectedCustomer(Request $request)
{
try {
if ($request->has('all_id')) {
return Excel::download(new customer_export, 'Passport_data.xlsx');
}
// try {
$ids = $request->selected_id;
// if ($request->has('all_id')) {
// return Excel::download(new customer_export, 'Passport_data.xlsx');
// }
if (empty($ids)) {
return response()->json(['error' => 'No IDs provided for export.'], 400);
}
// $ids = $request->selected_id;
Log::info("Selected IDs for export: " . $ids);
// $fileName = 'selected_customer_data.xlsx';
// return Excel::download(new customer_export_selected($ids), $fileName);
// } catch (\Exception $e) {
// return response()->json(['error' => 'Export failed. Something went wrong.'], 500);
// }
// }
$fileName = 'selected_customer_data.xlsx';
/*
Log::info("Attempting to export selected customers to file: " . $fileName);
return Excel::download(new customer_export_selected($ids), $fileName);
} catch (\Exception $e) {
Log::error('Export failed: ' . $e->getMessage());
return response()->json(['error' => 'Export failed. Something went wrong.'], 500);
}
}
/*
Created By : Sayali Parab
Created at : 28 May 2024
Use : To Deleted Data Restore.
@@ -222,10 +291,33 @@ class ManageCustomerController extends Controller
{
try {
$redeemDetails = RedeemRestaurant::with('restaurant', 'customer')->where('iam_principal_xid', $id)->get();
// return $redeemDetails;
return view('Admin.pages.manage_users.manage_customer.customer_restaurants', compact('redeemDetails'));
} catch (Exception $e) {
Log::error("Error getting restaurant details: " . $e->getMessage());
return response()->json(['error' => __('auth.something_went_wrong')], 500);
}
}
/*
Created By : Sayali parab
Created at : 27 June 2024
Use : To delete customer details.
*/
public function deleteCustomerUser($id)
{
try {
DB::beginTransaction();
$deleteCustomer = IamPrincipal::find($id);
// dd($id );
$deleteCustomer->delete();
DB::commit();
return response()->json(['sucess' => true, 'status' => 200]);
} catch (Exception $e) {
DB::rollBack();
Log::error("delete_passport function Load Failed " . $e->getMessage());
return response()->json(['success' => false, 'status' => 500, 'message' => __('auth.something_went_wrong')]);
}
}
}

View File

@@ -2,20 +2,57 @@
namespace App\Http\Controllers\Admin;
use App\Exports\FeedbakExport;
use App\Http\Controllers\Controller;
use App\Models\ManageFeedback;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
class ManageFeedbackController extends Controller
{
/**
* Created By : sayali parab
* Created at : 17 May 2024
* Use : To get manage feedback page.
*/
public function index(){
return view('Admin.pages.manage_feedback.manage_feedback');
/**
* Created By : sayali parab
* Created at : 17 May 2024
* Use : To get manage feedback page.
*/
public function index()
{
$feedback = ManageFeedback::with('principal', 'feedbackReaction','restaurant')
->orderBy('created_at', 'desc')
->get();
return view('Admin.pages.manage_feedback.manage_feedback', compact('feedback'));
}
/**
* Created By : Sayli Raut
* Created at : 10 June 2024
* Use : To delete query.
*/
public function delete_feedback($id)
{
$data = ManageFeedback::find($id)->delete();
return redirect()->back()->with('success', '');
}
/*
Created By : Sayli Raut
Created at : 17 June 2024
Use : To download Excel.
*/
public function exportSelectedFeedback(Request $request)
{
// dd($request->all());
try {
if ($request->has('all_id')) {
return Excel::download(new FeedbakExport, 'Feedback_data.xlsx');
}
} catch (\Exception $e) {
return response()->json(['error' => 'Export failed. Something went wrong.'], 500);
}
}
}

View File

@@ -0,0 +1,136 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\ManageState;
use Illuminate\Http\Request;
use Exception;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
class ManageLocationController extends Controller
{
/*
Created By : Sayali parab
Created at : 07 June 2024
Use : To get the page.
*/
public function index()
{
$location = ManageState::orderBy('id', 'asc')->get();
return view('Admin.pages.manage_states.manage_states', compact('location'));
}
/*
Created By : Sayali parab
Created at : 07 June 2024
Use : To store the location.
*/
public function store(Request $request)
{
$request->validate([
'location_name' => 'required|string|max:255'
]);
try {
if (ManageState::where('name', $request->location_name)->exists()) {
return response()->json(['success' => false, 'error' => 'Location name already exists', 'status' => 422]);
}
$location = new ManageState();
$location->name = $request->location_name;
$location->save();
return response()->json(['success' => true, 'status' => 200]);
} catch (\Exception $e) {
return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
}
}
/*
Created By : Sayali parab
Created at : 07 June 2024
Use : To change status.
*/
public function change_location_status(Request $request)
{
try {
DB::beginTransaction();
$status = ManageState::find($request->location_id);
$status->is_active = $request->status;
$status->save();
// return response()->json(['status' => 200]);
DB::commit();
return jsonResponseWithSuccessMessage(__('success.update_data'));
} catch (Exception $e) {
Log::error("Update Status function Load Failed " . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
/*
Created By : Sayali parab
Created at : 07 June 2024
Use : To delete location.
*/
public function delete_location($id)
{
try {
DB::beginTransaction();
$passport = ManageState::find($id);
$passport->delete();
DB::commit();
return response()->json(['success' => true, 'status' => 200]);
} catch (Exception $e) {
DB::rollBack();
Log::error("delete_location function Load Failed " . $e->getMessage());
return response()->json(['success' => false, 'status' => 500, 'message' => __('auth.something_went_wrong')]);
}
}
/*
Created By : Sayali parab
Created at : 07 June 2024
Use : To update location.
*/
public function update(Request $request)
{
try {
DB::beginTransaction();
// Check if the location name already exists, excluding the current location
if (ManageState::where('name', $request->location_name)->where('id', '!=', $request->id)->exists()) {
return response()->json(['success' => false, 'error' => 'Location name already exists', 'status' => 422]);
}
$location_data = ManageState::find($request->id);
$location_data->name = $request->location_name;
$location_data->save();
DB::commit();
return response()->json(['success' => true, 'message' => __('success.update_data'), 'status' => 200]);
} catch (Exception $e) {
DB::rollBack();
Log::error("Failed to update location: " . $e->getMessage());
return response()->json(['success' => false, 'error' => __('auth.something_went_wrong'), 'status' => 500]);
}
}
}

View File

@@ -1,6 +1,7 @@
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
@@ -15,15 +16,15 @@ use Validator;
class ManageNewsAndArticlesController extends Controller
{
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To get newsarticle page.
*/
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To get newsarticle page.
*/
public function index()
{
try {
$news_article = NewsArticle::with('category')->latest()->get()->toArray();
return view('Admin.pages.manage_cms.manage_new.manage_news', compact('news_article'));
@@ -31,17 +32,16 @@ class ManageNewsAndArticlesController extends Controller
Log::error("Manage Article Page Not Load: " . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To change status.
*/
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To change status.
*/
public function change_news_article_Status(Request $request)
{
try {
$status = NewsArticle::find($request->program_id);
@@ -60,223 +60,132 @@ class ManageNewsAndArticlesController extends Controller
}
}
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To edit.
*/
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To edit.
*/
public function edit($id)
{
try {
$news_article_data = NewsArticle::find($id);
$news_categories = NewsArticleCategory::all()->toArray();
return view('Admin.pages.manage_cms.manage_new.manage_news_edit', compact('news_article_data','news_categories'));
return view('Admin.pages.manage_cms.manage_new.manage_news_edit', compact('news_article_data', 'news_categories'));
} catch (\Exception $e) {
// Handle the exception, you can log it or return an error response
return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
}
}
// public function update(Request $request)
// {
// try {
// $update_news_article = NewsArticle::find($request->article_id);
// $update_news_article->name = $request->input('article_name');
// // dd( $update_news_article->name);
// $update_news_article->description = $request->input('article_dis');
// // dd($update_news_article->description);
// // if ($request->hasFile('article_image')) {
// // if ($update_news_article->image) {
// // Storage::disk('public')->delete($update_news_article->image);
// // }
// // $uploadedFile = $request->file('article_image');
// // $extension = $uploadedFile->getClientOriginalExtension();
// // $filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
// // $path = $uploadedFile->storeAs('uploads/news_article', $filename, 'public');
// // $update_news_article->image = $path;
// // }
// if ($request->hasFile('article_thmb')) {
// if ($update_news_article->image) {
// Storage::disk('public')->delete($update_news_article->thumbnail_image);
// }
// $uploadedFile = $request->file('article_thmb');
// $extension = $uploadedFile->getClientOriginalExtension();
// $filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
// $path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
// $update_news_article->thumbnail_image = $path;
// }
// $update_news_article->save();
// // dd( $update_news_article);
// return response()->json(['success' => true,'status'=>200]);
// } catch (\Exception $e) {
// return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
// }
// }
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To update.
*/
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To update.
*/
public function update(Request $request)
{
try {
$update_news_article = NewsArticle::find($request->article_id);
$update_news_article->name = $request->input('article_name');
$update_news_article->description = $request->input('article_dis');
if ($request->hasFile('article_thmb')) {
if ($update_news_article->image) {
Storage::disk('public')->delete($update_news_article->thumbnail_image);
}
$uploadedFile = $request->file('article_thmb');
$extension = $uploadedFile->getClientOriginalExtension();
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
$update_news_article->thumbnail_image = $path;
}
$update_news_article->save();
return response()->json(['success' => true, 'status' => 200]);
} catch (\Exception $e) {
return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
}
}
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To delete.
*/
public function delete_newsarticle($id)
{
try {
$blog = NewsArticle::find($id);
if (!$blog) {
return response()->json(['error' => 'Aboutus entry not found.'], 404);
}
$blog->delete();
return response()->json(['success' => 'Aboutus entry deleted successfully.']);
} catch (\Exception $e) {
// Log the exception or handle it in a way that makes sense for your application
return response()->json(['error' => 'An error occurred while deleting the Aboutus entry.'], 500);
}
}
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To add.
*/
public function add()
{
$news_categories = NewsArticleCategory::all()->toArray();
return view('Admin.pages.manage_cms.manage_new.manage_news_add', compact('news_categories'));
}
// public function insert(Request $request)
// {
// try {
// $blog = new NewsArticle;
// $blog->name = $request->input('article_name');
// $blog->description = $request->input('article_des');
// $blog->news_articles_category_xid = $request->input('category');
// // if ($request->hasFile('article_image')) {
// // $uploadedFile = $request->file('article_image');
// // $extension = $uploadedFile->getClientOriginalExtension();
// // $filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
// // // Move the uploaded file to the storage folder
// // $path = $uploadedFile->storeAs('uploads/news_article', $filename, 'public');
// // // Store the file path in the database
// // $blog->image = $path;
// // }
// // upload blog single image
// if ($request->hasFile('article_thmb')) {
// $uploadedFile = $request->file('article_thmb');
// $extension = $uploadedFile->getClientOriginalExtension();
// $filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
// $path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
// $blog->thumbnail_image = $path;
// }
// $blog->save();
// return response()->json(['success' => true,'status'=>200]);
// } catch (\Exception $e) {
// // Handle the exception, you can log it or return an error response
// return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
// }
// }
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To insert.
*/
public function insert(Request $request)
{
try {
// Validate the incoming request
// $request->validate([
// // 'article_name' => 'required|string',
// // 'article_des' => 'required|string',
// 'article_thmb' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
// 'category' => 'required|string', // Assuming 'category' is the field for category selection
// ]);
DB::beginTransaction();
// Handle thumbnail image upload
$update_news_article = NewsArticle::find($request->article_id);
$update_news_article->name = $request->input('article_name');
$update_news_article->description = $request->input('article_dis');
$update_news_article->news_articles_category_xid = $request->input('category_xid');
if ($request->hasFile('article_thmb')) {
if ($update_news_article->image) {
Storage::disk('public')->delete($update_news_article->thumbnail_image);
}
$uploadedFile = $request->file('article_thmb');
$extension = $uploadedFile->getClientOriginalExtension();
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
$update_news_article->thumbnail_image = $path;
}
// Create a new instance of NewsArticle model and populate it with data
$blog = NewsArticle::create([
'name' => $request->input('article_name'),
'description' => $request->input('article_des'),
'news_articles_category_xid' => $request->input('category'),
'thumbnail_image' => $path // Set thumbnail image path
]);
// dd( $blog);
DB::commit();
return response()->json([
'success' => true,
'status' => 200,
'message' => 'News article added successfully',
]);
} catch (\Exception $exception) {
DB::rollBack();
// Log the exception for further analysis
Log::error('Error in insert method: ' . $exception->getMessage() . ' at ' . $exception->getFile() . ':' . $exception->getLine());
// Return an error response
return response()->json(['error' => 'Failed to add news article'], 500);
$update_news_article->save();
return response()->json(['success' => true, 'status' => 200]);
} catch (\Exception $e) {
return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
}
}
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To delete.
*/
public function delete_newsarticle($id)
{
try {
$blog = NewsArticle::find($id);
if (!$blog) {
return response()->json(['error' => 'Aboutus entry not found.'], 404);
}
$blog->delete();
return response()->json(['success' => 'Aboutus entry deleted successfully.']);
} catch (\Exception $e) {
// Log the exception or handle it in a way that makes sense for your application
return response()->json(['error' => 'An error occurred while deleting the Aboutus entry.'], 500);
}
}
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To add.
*/
public function add()
{
$news_categories = NewsArticleCategory::all()->toArray();
return view('Admin.pages.manage_cms.manage_new.manage_news_add', compact('news_categories'));
}
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To insert.
*/
public function insert(Request $request)
{
try {
$blog = new NewsArticle;
$blog->name = $request->input('article_name');
$blog->description = $request->input('article_des');
$blog->news_articles_category_xid = $request->input('category');
if ($request->hasFile('article_image')) {
$uploadedFile = $request->file('article_image');
$extension = $uploadedFile->getClientOriginalExtension();
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article', $filename, 'public');
$blog->image = $path;
}
if ($request->hasFile('article_thmb')) {
$uploadedFile = $request->file('article_thmb');
$extension = $uploadedFile->getClientOriginalExtension();
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
$blog->thumbnail_image = $path;
}
$blog->save();
return response()->json(['success' => true, 'status' => 200]);
} catch (\Exception $e) {
// Handle the exception, you can log it or return an error response
return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
}
}
}

View File

@@ -3,13 +3,167 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\IamPrincipal;
use App\Models\NotificationDetails;
use Illuminate\Http\Request;
use Exception;
use Illuminate\Support\Facades\Log;
use App\Helpers\onesignalhelper;
use App\Models\ManageState;
use Illuminate\Support\Facades\DB;
class ManageNotificationsController extends Controller
{
public function index(){
return view('Admin.pages.manage_notification.manage_notification');
public function index(Request $request)
{
/**
* Created By : Sayli Raut
* Created at : 11 June 2024
* Use : To list notifications.
*/
$activeQuery = $request->query('active');
if ($activeQuery == 4) { // for customer
$notifications = NotificationDetails::with('Notification')
->whereHas('Notification', function ($query) {
$query->where('principal_type_xid', 3);
})
->latest()
->take(12)
->get();
} else if ($activeQuery == 3) { // for restaurant
$notifications = NotificationDetails::with('Notification')
->whereHas('Notification', function ($query) {
$query->where('principal_type_xid', 4);
})
->latest()
->take(12)
->get();
// return $notifications;
} else {
$notificationsOfType3 = NotificationDetails::with('Notification')
->whereHas('Notification', function ($query) {
$query->where('principal_type_xid', 3);
})
->latest()
->take(12)
->get();
$notificationsOfType4 = NotificationDetails::with('Notification')
->whereHas('Notification', function ($query) {
$query->where('principal_type_xid', 4);
})
->latest()
->take(12)
->get();
$notifications = $notificationsOfType3->merge($notificationsOfType4);
}
return view('Admin.pages.manage_notification.manage_notification', compact('notifications'));
}
/**
* Created By : Sayli Raut
* Created at : 10 June 2024
* Use : To view notification details.s
*/
public function add()
{
$state = ManageState::where('is_active', 1)->get()->toArray();
return view('Admin.pages.manage_notification.manage_notifications_add', compact('state'));
}
/**
* Created By : Sayli Raut
* Created at : 10 June 2024
* Use : To add notification .
*/
public function store_notificaton_data(Request $request)
{
try {
$request->validate([
'image' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
]);
DB::beginTransaction();
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);
// Fetch OneSignal IDs based on the selected states and user type
$states = $request->states;
$userQuery = IamPrincipal::where('is_active', 1)
->where('notification_status', 1)
->where('principal_type_xid', 3)
->whereIn('state_xid', $states);
if ($request->user_type == 1) {
$allCustomerOneSignalIds = $userQuery->pluck('id');
$UserData = IamPrincipal::whereIn('id', $allCustomerOneSignalIds)->get();
foreach ($UserData as $customerIdItem) {
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) {
$allRestaurantOneSignalIds = $userQuery->pluck('id');
$restaurantData = IamPrincipal::whereIn('id', $allRestaurantOneSignalIds)->get();
foreach ($restaurantData as $restIdItem) {
if ($restIdItem->one_signal_player_id) {
onesignalhelper::sendNotificationApi(
$restIdItem->one_signal_player_id,
$request->title,
$request->description,
'Dashboard Notification',
$imagePath,
$id = null
);
}
onesignalhelper::StoreNotificationDetails($restIdItem->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);
}
}
/**
* Created By : Sayli Raut
* Created at : 10 June 2024
* Use : To view notification details.s
*/
public function view($id)
{
$notification = NotificationDetails::with('notification')->findOrFail($id);
return view('Admin.pages.manage_notification.manage_notifications_view', compact('notification'));
}
}

View File

@@ -2,6 +2,8 @@
namespace App\Http\Controllers\Admin;
use App\Exports\RestaurantExport;
use App\Exports\RestaurantExportSelected;
use App\Http\Controllers\Controller;
use App\Models\ManageRestaurant;
use App\Models\OperatingHour;
@@ -9,7 +11,9 @@ use Illuminate\Http\Request;
use Exception;
use App\Helpers\onesignalhelper;
use App\Models\IamPrincipal;
use App\Models\ManageState;
use Illuminate\Support\Facades\Log;
use Maatwebsite\Excel\Facades\Excel;
use Illuminate\Support\Facades\DB;
class ManageRestrauntController extends Controller
@@ -41,7 +45,8 @@ class ManageRestrauntController extends Controller
*/
public function add()
{
return view('Admin.pages.manage_restaurants.add_restaurant');
$state = ManageState::where('is_active', 1)->get()->toArray();
return view('Admin.pages.manage_restaurants.add_restaurant', compact('state'));
}
@@ -66,7 +71,6 @@ class ManageRestrauntController extends Controller
// Creating the restaurant
$restaurant = new ManageRestaurant();
$restaurant->name = $request->input('name');
$restaurant->description = $request->input('description');
$restaurant->image = $imagePath;
$restaurant->restaurant_id = $request->input('rest_id');
$restaurant->address = $request->input('address');
@@ -74,10 +78,16 @@ class ManageRestrauntController extends Controller
$restaurant->latitude = $request->input('latitude');
$restaurant->longtitude = $request->input('longitude');
$restaurant->exclusion = $request->input('exclusion');
$restaurant->phone_number = $request->input('phone_number');
$restaurant->state_xid = $request->input('state_xid');
$restaurant->try_on_1 = $request->input('try_on_1');
$restaurant->try_on_2 = $request->input('try_on_2');
$restaurant->try_on_3 = $request->input('try_on_3');
$restaurant->try_on_4 = $request->input('try_on_4');
$restaurant->time_hours = $request->input('timeHours');
$restaurant->max_numb_day = $request->input('maxNumbDay');
$restaurant->max_numb_week = $request->input('maxNumbWeek');
$restaurant->max_numb_month = $request->input('maxNumbMonth');
$restaurant->save();
foreach ($request->input('operating_hours') as $day => $hours) {
@@ -132,13 +142,15 @@ class ManageRestrauntController extends Controller
try {
$operating_hours = OperatingHour::where('manage_restaurant_xid', $id)->get()->keyBy('day_of_week');
$restaurantItem = ManageRestaurant::where('id', $id)->first();
$state = ManageState::where('is_active', 1)->get()->toArray();
$restaurantItem['image'] = ListingImageUrl('restaurant_images', $restaurantItem['image']);
return view(
'Admin.pages.manage_restaurants.edit_restaurant',
compact(
'restaurantItem',
'operating_hours'
'operating_hours',
'state'
)
);
} catch (Exception $e) {
@@ -172,6 +184,8 @@ class ManageRestrauntController extends Controller
$restaurant->restaurant_id = $request->input('restaurant_id');
$restaurant->address = $request->input('location_name');
$restaurant->exclusion = $request->input('exclusion');
$restaurant->phone_number = $request->input('phone_number');
$restaurant->state_xid = $request->input('state_xid');
$restaurant->latitude = $request->input('latitude');
$restaurant->longtitude = $request->input('longitude');
$restaurant->bio = $request->input('bio');
@@ -179,6 +193,10 @@ class ManageRestrauntController extends Controller
$restaurant->try_on_2 = $request->input('try_on_2');
$restaurant->try_on_3 = $request->input('try_on_3');
$restaurant->try_on_4 = $request->input('try_on_4');
$restaurant->time_hours = $request->input('timeHours');
$restaurant->max_numb_day = $request->input('maxNumbDay');
$restaurant->max_numb_week = $request->input('maxNumbWeek');
$restaurant->max_numb_month = $request->input('maxNumbMonth');
$restaurant->save();
foreach ($request->input('operating_hours') as $day => $hours) {
@@ -230,7 +248,7 @@ class ManageRestrauntController extends Controller
return view('Admin.pages.manage_restaurants.view_restaurant', compact('restaurantItem', 'operating_hours'));
} catch (Exception $e) {
Log::error("view Voucher Load Failed " . $e->getMessage());
Log::error("view Voucher Load Failed" . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
@@ -339,4 +357,25 @@ Use : To Delete Restaurant.
return response()->json(['success' => false, 'status' => 500, 'message' => __('auth.something_went_wrong')]);
}
}
/*
Created By : Sayli Raut
Created at : 17 June 2024
Use : To download Excel.
*/
public function exportSelectedRestaurant(Request $request)
{
try {
if ($request->has('all_id')) {
return Excel::download(new RestaurantExport, 'Restaurant_data.xlsx');
}
$ids = $request->selected_id;
// dd( $ids);
$fileName = 'selected_restaurant_data.xlsx';
return Excel::download(new RestaurantExportSelected($ids), $fileName);
} catch (\Exception $e) {
return response()->json(['error' => 'Export failed. Something went wrong.'], 500);
}
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\ManageRule;
use Illuminate\Http\Request;
class ManageRulesController extends Controller
{
/**
* Created By : sayli Raut
* Created at : 19 June 2024
* Use : To view Rules page.
*/
public function index()
{
$data = ManageRule::all()->toArray();
return view('Admin.pages.manage_rule.manage_rule', compact('data'));
}
/**
* Created By : sayli Raut
* Created at : 19 June 2024
* Use : To edit Rules.
*/
public function edit($id)
{
$data = ManageRule::find($id);
return view('Admin.pages.manage_rule.manage_rules_edit', compact('data'));
}
/**
* Created By : sayli Raut
* Created at : 19 June 2024
* Use : To update Rules.
*/
public function update(Request $request)
{
$validated = $request->validate([
'article_des_title' => 'required',
'article_des_message' => 'required',
]);
$update = ManageRule::find($request->rule_id);
$update->title = $request->input('article_des_title');
$update->message = $request->input('article_des_message');
$update->save();
return response()->json(['success' => true, 'status' => 200]);
}
}

View File

@@ -45,6 +45,7 @@ class ManageSubAdminController extends Controller
$sub_admin = new IamPrincipal();
$sub_admin->first_name = $request->input('sub_admin_name');
$sub_admin->last_name=$request->input('sub_admin_lname');
$sub_admin->user_name = 'sub_admin';
$sub_admin->principal_type_xid = 2;
$sub_admin->principal_source_xid = Auth::guard('admin')->user()->principal_source_xid;
@@ -131,6 +132,7 @@ class ManageSubAdminController extends Controller
$sub_admin = IamPrincipal::find($request->sub_admin_id);
$sub_admin->user_name = 'sub_admin';
$sub_admin->first_name = $request->input('sub_admin_name');
$sub_admin->last_name = $request->input('sub_admin_lname');
$sub_admin->principal_type_xid = 2;
$sub_admin->principal_source_xid = Auth::guard('admin')->user()->principal_source_xid;
$sub_admin->email_address = $request->input('sub_admin_email');
@@ -180,7 +182,12 @@ class ManageSubAdminController extends Controller
}
}
public function get_sub_admin_permission(Request $request)
{
$testing_admin_id = $request->id;
$test = ManageModuleLink::where('principal_xid', $testing_admin_id)->get('manage_modules_xid')->toArray();
return response()->json(['success' => true, 'data' => $test]);
}
}

View File

@@ -9,17 +9,7 @@ use App\Models\PrivacyPolicy;
class PrivacyPolicyController extends Controller
{
// public function index(){
// return view('Admin.pages.manage_cms.manage_privacy.manage_privacy');
// }
// public function index(){
// $view_privacy_policy = PrivacyPolicy::get()->toArray();
// // dd($view_privacy_policy);
// return view('Admin.pages.manage_cms.manage_privacy.manage_privacy');
// }
/**
/**
* Created By : sayali parab
* Created at : 29 May 2024
* Use : To get privacy policy page.
@@ -34,12 +24,12 @@ class PrivacyPolicyController extends Controller
* Created at : 29 May 2024
* Use : To edit.
*/
public function edit($id){
public function edit($id)
{
$edit_privacy_policy = PrivacyPolicy::find($id)->toArray();
return view('Admin.pages.manage_cms.manage_privacy.manage_privacy_policy_edit', compact('edit_privacy_policy'));
}
/**
* Created By : sayali parab
* Created at : 29 May 2024
@@ -77,3 +67,4 @@ class PrivacyPolicyController extends Controller
}
}

View 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);
}
}
}

View File

@@ -76,47 +76,7 @@ class RestaurantAppController extends Controller
// public function change_rest_user_status(Request $request)
// {
// try {
// DB::beginTransaction();
// $status = IamPrincipal::find($request->rest_user_id);
// $status->is_active = $request->status;
// // Generate a random password
// $randomPassword = \Str::random(8); // Adjust the length as per your requirements
// // Set the password
// $status->password = bcrypt($randomPassword); // Make sure to hash the password
// $status->save();
// if ($request->status == 1) {
// // Fetch user data based on user ID
// $user = IamPrincipal::find($request->rest_user_id);
// if ($user) {
// // Send email only if user exists
// $data = [
// 'first_name' => $user->first_name,
// 'last_name' => $user->last_name,
// 'email' => $user->email_address,
// 'password' => $randomPassword, // Pass the random password to the email template
// ];
// Mail::to($user->email_address)->send(new RestUserApproval($data));
// }
// }
// DB::commit();
// return jsonResponseWithSuccessMessage(__('success.update_data'));
// } catch (Exception $e) {
// Log::error("Update Status function Load Failed " . $e->getMessage());
// return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
// }
// }
/**
* Created By : sayali parab
* Created at : 03 June 2024
@@ -205,62 +165,7 @@ class RestaurantAppController extends Controller
}
}
// public function updateRest(Request $request)
// {
// try {
// DB::beginTransaction();
// $rest_data = IamPrincipal::where('id', $request->rest_id)->first();
// $rest_data->first_name = $request->input('name');
// $rest_data->last_name = $request->input('last_name');
// $rest_data->phone_number = $request->input('phone');
// $rest_data->email_address = $request->input('email_id');
// $rest_data->save();
// DB::commit();
// return jsonResponseWithSuccessMessage(__('success.update_data'));
// } catch (Exception $e) {
// DB::rollBack();
// Log::error("updateCustomerNewsArticle Services Page Load Failed " . $e->getMessage());
// return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
// }
// }
// public function updateRest(Request $request)
// {
// try {
// DB::beginTransaction();
// $rest_data = IamPrincipal::find($request->input('rest_id'));
// if (!$rest_data) {
// throw new Exception('Restaurant not found.');
// }
// $rest_data->first_name = $request->input('restaurant_name');
// $rest_data->description = $request->input('restaurant_des');
// $rest_data->phone_number = $request->input('restaurant_phone');
// $rest_data->email_address = $request->input('restaurant_email');
// $rest_data->location = $request->input('restaurant_loc');
// $rest_data->bio = $request->input('restaurant_bio');
// if ($request->hasFile('restaurant_image')) {
// $imagePath = $request->file('restaurant_image')->store('images', 'public');
// $rest_data->image_path = $imagePath;
// }
// $rest_data->save();
// DB::commit();
// return response()->json(['message' => __('success.update_data')], 200);
// } catch (Exception $e) {
// DB::rollBack();
// Log::error("Update Restaurant Failed: " . $e->getMessage());
// return response()->json(['message' => __('auth.something_went_wrong')], 500);
// }
// }
/**
* Created By : sayali parab
* Created at : 04 June 2024

View File

@@ -1,6 +1,7 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\Termsandconditions;
use App\Services\Admin\termsandconditionServices;
use App\Http\Controllers\Controller;
@@ -10,11 +11,11 @@ use Validator;
class TermsController extends Controller
{
public function index(){
public function index()
{
$terms_condition = Termsandconditions::all()->toArray();
return view('Admin.pages.manage_cms.manage_terms.manage_terms',compact('terms_condition'));
return view('Admin.pages.manage_cms.manage_terms.manage_terms', compact('terms_condition'));
}
// public function edit($id)
// {
@@ -22,19 +23,18 @@ class TermsController extends Controller
// return view('Admin.pages.manage_cms.manage_terms.manage_terms_edit', compact('terms'));
// }
public function edit($id)
{
$terms = Termsandconditions::find($id);
{
$terms = Termsandconditions::find($id);
// dd($terms);
return view('Admin.pages.manage_cms.manage_terms.manage_terms_edit', compact('terms'));
}
}
public function update(Request $request)
{
$validated = $request->validate([
'article_des' => 'required', // Add validation for article_des
]);
$update = Termsandconditions::find($request->custom_id);
@@ -42,4 +42,23 @@ class TermsController extends Controller
$update->save();
return response()->json(['success' => true, 'status' => 200]);
}
public function editTerms_rest($id)
{
$edit_terms_rest = Termsandconditions::find($id);
// return $edit_terms_rest;
return view('Admin.pages.manage_cms.manage_terms.manage_terns_edit_rest', compact('edit_terms_rest'));
}
public function update_rest(Request $request)
{
$validated = $request->validate([
'termsrest_des' => 'required',
]);
$update_rest = Termsandconditions::find($request->termRest_id);
$update_rest->message = $request->input('termsrest_des');
$update_rest->save();
return response()->json(['success' => true, 'status' => 200]);
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\Response;
class CheckStatus
@@ -17,7 +18,8 @@ class CheckStatus
{
$admin = auth()->guard('admin')->user();
if ($admin && $admin->is_active == 1) {
Log::info($admin);
if ($admin && $admin->is_active == 1 && ($admin->principal_type_xid == 1 || $admin->principal_type_xid == 2)) {
return $next($request);
} else {
return redirect('/')->with('error_msg', 'You must be logged in..');

65
app/Mail/ReplyMail.php Normal file
View File

@@ -0,0 +1,65 @@
<?php
namespace App\Mail;
use App\Models\ManageContactus;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class ReplyMail extends Mailable
{
use Queueable, SerializesModels;
public $query;
/**
* Create a new message instance.
*/
public function __construct(ManageContactus $query)
{
$this->query = $query;
}
public function build()
{
return $this->view('Admin.pages.mail.reply');
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: 'Reply Mail',
);
}
/**
* Get the message content definition.
*/
// public function content(): Content
// {
// return new Content(
// view: 'view.name',
// );
// }
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class CheckReferralCode extends Model
{
use HasFactory;
protected $table = 'check_referral_code';
protected $fillable = [
'iam_principal_xid',
'referral_code',
'is_active',
];
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class FeedbackReaction extends Model
{
use HasFactory;
protected $table = "feedback_reaction";
protected $fillable = [
"id",
"feedback_reaction_xid",
"feedback_reaction_title",
"is_active",
"created_by",
"modified_by",
"created_at",
"updated_at",
];}

View File

@@ -1,6 +1,7 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Sanctum\HasApiTokens;
@@ -38,12 +39,13 @@ class IamPrincipal extends Authenticatable implements JWTSubject
'state_xid',
'is_active',
'notification_status',
'deleted_by_admin'
'deleted_by_admin',
'referral_code'
];
public function moduleLinks()
{
return $this->hasMany(ManageModuleLink::class,'principal_xid', 'id');
return $this->hasMany(ManageModuleLink::class, 'principal_xid', 'id');
}
public function feedbacks()
@@ -62,7 +64,7 @@ class IamPrincipal extends Authenticatable implements JWTSubject
return $customerCount;
}
// protected $fillable =
@@ -129,35 +131,35 @@ class IamPrincipal extends Authenticatable implements JWTSubject
'password' => 'hashed',
];
public function getPermissionGranted($id,$module)
public function getPermissionGranted($id, $module)
{
// $id is used as authuser id
// $moudle is the slug of sidebar module
$isSubAdmin = IamPrincipal::where('id',$id)->where('principal_type_xid',2)->first();
// 'is_admin',1 is for checking the login user is subadmin or not
$isSubAdmin = IamPrincipal::where('id', $id)->where('principal_type_xid', 2)->first();
// 'is_admin',1 is for checking the login user is subadmin or not
$isMainAdmin = IamPrincipal::where('id',$id)->where('principal_type_xid',1)->first();
if($isMainAdmin){
return true;
}elseif($isSubAdmin){
//search for module
$isModule = ManageModule::where('slug',$module)->first();
if($isModule){
$isSubAdminModuleLink = ManageModuleLink::where('principal_xid',$id)
->where('manage_modules_xid',$isModule->id)->first();
// dd($id,$module,$isSubAdmin->id,$isModule,$isSubAdminModuleLink);
if($isSubAdminModuleLink){
return true;
}else{
return false;
}
}else{
return false;
}
}else{
return false;
}
$isMainAdmin = IamPrincipal::where('id', $id)->where('principal_type_xid', 1)->first();
if ($isMainAdmin) {
return true;
} elseif ($isSubAdmin) {
//search for module
$isModule = ManageModule::where('slug', $module)->first();
if ($isModule) {
$isSubAdminModuleLink = ManageModuleLink::where('principal_xid', $id)
->where('manage_modules_xid', $isModule->id)->first();
// dd($id,$module,$isSubAdmin->id,$isModule,$isSubAdminModuleLink);
if ($isSubAdminModuleLink) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
// public function orders()
@@ -183,8 +185,11 @@ class IamPrincipal extends Authenticatable implements JWTSubject
// }
public function restaurant()
{
return $this->hasMany(ManageRestaurant::class, 'id', 'restaurant_xid');
}
{
return $this->hasMany(ManageRestaurant::class, 'id', 'restaurant_xid');
}
public function contactMessages()
{
return $this->hasMany(ManageContactus::class, 'principal_xid', 'id');
}
}

View File

@@ -27,4 +27,8 @@ class ManageContactus extends Model
'created_by',
'modified_by',
];
public function customer()
{
return $this->belongsTo(IamPrincipal::class, 'principal_xid', 'id');
}
}

View File

@@ -1,19 +1,19 @@
<?php
namespace App\Models\admin;
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\IamPrincipal;
use App\Models\admin\FeedbackReaction;
use App\Models\FeedbackReaction;
class ManageFeedback extends Model
{
use SoftDeletes;
use HasFactory;
protected $table = "manage_feedback";
protected $fillable = ['principal_xid', 'feedback_reaction_xid', 'comment'];
protected $fillable = ['principal_xid', 'feedback_reaction_xid', 'comment','is_app_feedback','is_restaurant_feedback','restaurant_id'];
public function principal()
{
@@ -26,9 +26,16 @@ class ManageFeedback extends Model
public function feedbackReaction()
{
return $this->belongsTo(FeedbackReaction::class, 'feedback_reaction_xid', 'feedback_reaction_xid');
return $this->belongsTo(feedbackReaction::class, 'feedback_reaction_xid', 'feedback_reaction_xid');
}
public function restaurant()
{
return $this->belongsTo(ManageRestaurant::class, 'restaurant_id', 'id');
}
}

View File

@@ -22,7 +22,7 @@ class ManageRestaurant extends Model
protected $fillable = [
'short_id', 'name', 'description', 'restaurant_id', 'address', 'image', 'bio',
'try_on_1', 'try_on_2', 'try_on_3', 'try_on_4', 'exclusion', 'latitude', 'longitude',
'is_active', 'created_by', 'modified_by'
'is_active', 'created_by', 'modified_by', 'phone_number','time_hours','max_numb_day','max_numb_week','max_numb_month'
];
protected static function boot()
@@ -54,6 +54,6 @@ class ManageRestaurant extends Model
return $this->belongsTo(ManageState::class, 'state_xid', 'id');
}
}

18
app/Models/ManageRule.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ManageRule extends Model
{
use HasFactory;
protected $table = 'manage_rules';
protected $fillable = [
'message'
];
}

View File

@@ -4,16 +4,17 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class ManageState extends Model
{
use HasFactory;
use SoftDeletes;
protected $table = 'manage_states';
// protected $dates = ['deleted_at'];
protected $fillable = [
' id ',
'id',
'name',
'is_active',
'email_address',
@@ -21,7 +22,8 @@ class ManageState extends Model
'modified_by',
'deleted_at',
'created_at',
'updated_at ',
'updated_at',
'state_xid',
];
}

View File

@@ -52,19 +52,25 @@ class AuthServices
{
try {
DB::beginTransaction();
do {
$referral_code = \Str::random(10);
} while (IamPrincipal::where('referral_code', $referral_code)->exists());
$user = IamPrincipal::create([
'one_signal_player_id' => $request->one_signal_player_id,
'first_name' => $request->first_name,
'last_name' => $request->last_name,
'email_address' => $request->email_address,
'password' => Hash::make($request->password),
'principal_type_xid' => 3, //3 for customer
'principal_source_xid' => 2, //2 for mobile
'principal_type_xid' => 3, // 3 for customer
'principal_source_xid' => 2, // 2 for mobile
'date_of_birth' => $request->date_of_birth,
// 'address_line1' => $request->address_line1,
'phone_number' => $request->phone_number,
'state_xid' =>$request->state_xid,
'state_xid' => $request->state_xid,
'referral_code' => $referral_code,
]);
DB::commit();
$token = auth()->login($user);
@@ -77,11 +83,16 @@ class AuthServices
return jsonResponseWithSuccessMessage(__('auth.Customer_user_created'), $response, 200);
} catch (QueryException $e) {
DB::rollBack();
Log::error('Restaurant Registration Failed ' . $e->getMessage());
Log::error('Customer Registration Failed ' . $e->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.authentication_failed'), 403);
}
}
public function login($request)
{
try {
@@ -155,7 +166,7 @@ class AuthServices
],
function ($message) use ($user) {
$message->to($user->email_address);
$message->subject('Forgot Password Mail Page');
$message->subject('One-Time Passcode Enclosed');
}
);
@@ -233,7 +244,6 @@ class AuthServices
$User->save();
DB::commit();
return jsonResponseWithSuccessMessageApi(__('auth.password_updated_successfully'));
} catch (QueryException $e) {
DB::rollBack();
Log::error('Customer change password Failed ' . $e->getMessage());
@@ -300,4 +310,24 @@ class AuthServices
return jsonResponseWithErrorMessageApi(__('auth.authentication_failed'), 403);
}
}
public function searchState($request)
{
try {
$searchQuery = $request->input('search_data');
$query = ManageState::select('id', 'name')->where('is_active', 1);
if ($searchQuery) {
$query->where(function ($q) use ($searchQuery) {
$q->where('name', 'like', '%' . $searchQuery . '%');
});
}
$restaurants = $query->get();
return jsonResponseWithSuccessMessageApi(__('auth.data_fetched_successfully'), $restaurants, 200);
} catch (\Exception $e) {
Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage());
return response()->json(__('something_went_wrong'), 500);
}
}
}

View File

@@ -39,19 +39,11 @@ class CMSApiServices
$data['customer'] = Aboutus::select('id', 'thumbnail_image', 'description')
->where('category_xid', '1')
->get()
->map(function ($item) {
$item['description'] = strip_tags($item['description']);
return $item;
})
->toArray();
$data['restaurant'] = Aboutus::select('id', 'thumbnail_image', 'description')
->where('category_xid', '2')
->get()
->map(function ($item) {
$item['description'] = strip_tags($item['description']);
return $item;
})
->toArray();
foreach ($data['customer'] as $k => $val) {
$data['customer'][$k]['thumbnail_image'] = ListingImageUrl('about_images', $val['thumbnail_image']);
@@ -106,16 +98,14 @@ class CMSApiServices
})
->toArray();
//thumbnail_image for 'customer' data
foreach ($data['customer'] as $k => $val) {
$data['customer'][$k]['thumbnail_image'] = ListingImageUrl('news_article_thumb', $val['thumbnail_image']);
$data['customer'][$k]['image'] = ListingImageUrl('news_article', $val['image']);
$data['customer'][$k]['image'] = ListingImageUrl('news_article_image', $val['image']);
}
//thumbnail_image for 'restaurant' data
foreach ($data['restaurant'] as $k => $val) {
$data['restaurant'][$k]['thumbnail_image'] = ListingImageUrl('news_article_thumb', $val['thumbnail_image']);
$data['restaurant'][$k]['image'] = ListingImageUrl('news_article', $val['image']);
$data['restaurant'][$k]['image'] = ListingImageUrl('news_article_image', $val['image']);
}
return $data;
@@ -133,6 +123,11 @@ class CMSApiServices
->get()
->toArray();
$data['restaurant'] = Termsandconditions::select('id', 'message')
->where('category_xid', '2')
->get()
->toArray();
return $data;
} catch (Exception $ex) {
Log::error('Terms and condition Get service failed : ' . $ex->getMessage());

View File

@@ -23,7 +23,8 @@ class CustomerApiServices
'phone_number',
'date_of_birth',
'state_xid',
'profile_photo'
'profile_photo',
'referral_code'
)->find($user->id);

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Services\APIs\CustomerAPIs;
use App\Models\ManageFeedback;
use App\Models\IamPrincipal;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use Exception;
use Carbon\Carbon;
class FeedbackApiServices
{
public function storeFeedback($customerIamId, $request)
{
try {
DB::beginTransaction();
$user_data = IamPrincipal::where('id', $customerIamId)->first();
$now = Carbon::now();
$reaction = $request->input('reaction');
$comment = $request->input('comment');
$feedbackData = [
'principal_xid' => $user_data->id,
'feedback_reaction_xid' => $reaction,
'comment' => $comment,
'is_app_feedback' => $request->is_app_feedback,
'is_restaurant_feedback' => $request->is_restaurant_feedback,
'restaurant_id' => $request->restaurant_id,
];
$feedback = ManageFeedback::create($feedbackData);
DB::commit();
Log::info('Feedback added successfully');
return jsonResponseWithSuccessMessageApi(__('auth.feedback_store'), [], 200);
} catch (Exception $ex) {
DB::rollBack();
Log::error('Update Quantity service failed: ' . $ex->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Services\APIs\CustomerAPIs;
use App\Models\CheckReferralCode;
use App\Models\IamPrincipal;
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 {
$isExist = IamPrincipal::where('referral_code', $request->referral_code)
->where('id', '!=', $customerIamId)
->exists();
if (!$isExist) {
return jsonResponseWithErrorMessage(__('auth.invalid_referral_code'), 404);
}
// Check already used 3 times
$referralCodeCount = CheckReferralCode::where('referral_code', $request->referral_code)->count();
if ($referralCodeCount >= 3) {
return jsonResponseWithErrorMessage(__('auth.limitation_over'), 404);
}
// Check if the referral code is already used by the same customer
$usedByUser = CheckReferralCode::where('referral_code', $request->referral_code)
->where('iam_principal_xid', $customerIamId)
->exists();
if ($usedByUser) {
return jsonResponseWithErrorMessage(__('auth.already_used_code'), 404);
}
$storeId = new CheckReferralCode();
$storeId->iam_principal_xid = $customerIamId;
$storeId->referral_code = $request->referral_code;
$storeId->save();
return jsonResponseWithSuccessMessageApi(__('success.redeemed_successfully'), 200);
} catch (Exception $ex) {
Log::error('Check referral code service failed: ' . $ex->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
}

View File

@@ -5,8 +5,11 @@ namespace App\Services\APIs\CustomerAPIs;
use Illuminate\Support\Facades\DB;
use App\Models\CustomerFavouriteRestaurant;
use App\Models\IamPrincipal;
use App\Models\IamPrincipalRestaurantRole;
use App\Models\ManageRestaurant;
use App\Models\RedeemRestaurant;
use App\Helpers\onesignalhelper;
use Exception;
use Illuminate\Support\Facades\Log;
@@ -107,20 +110,37 @@ class RestaurantApiServices
{
try {
$rest = ManageRestaurant::with('operatingHours')->select('id', 'short_id', 'name', 'description', 'restaurant_id', 'address', 'image', 'bio', 'try_on_1', 'try_on_2', 'try_on_3', 'try_on_4', 'exclusion', 'latitude', 'longtitude')->where('short_id', $id)->where('is_active', '1')->first();
if ($rest) {
$rest->image = ListingImageUrl('restaurant_images', $rest->image);
$isFavourite = CustomerFavouriteRestaurant::where('principal_xid', $customerIamId)
->where('restaurant_xid', $rest->id)
->exists();
$rest->is_favourite = $isFavourite;
$redeem = RedeemRestaurant::where('iam_principal_xid', $customerIamId)
->where('manage_restaurants_xid', $rest->id)
->where('is_redeem', "1")
->first();
if ($redeem) {
$rest->is_Redeemed = true;
$rest->redeem_date = \Carbon\Carbon::parse($redeem->redeem_date)->addHours(4)->toDateTimeString();
} else {
$rest->is_Redeemed = false;
$rest->redeem_date = null;
}
}
if (!$rest) {
return jsonResponseWithErrorMessage(__('auth.restaurant_data_not_found'), 404);
}
return jsonResponseWithSuccessMessage(__('auth.data_fetched_successfully'), $rest, 200);
} catch (\Exception $ex) {
Log::error('DetailRestaurant service failed: ' . $ex->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
} catch (Exception $e) {
Log::error("Error fetching restaurant data: " . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
@@ -171,7 +191,10 @@ class RestaurantApiServices
$restaurantsQuery->where(function ($query) use ($searchData) {
$query->where('name', 'like', "%$searchData%")
->orWhere('description', 'like', "%$searchData%")
->orWhere('address', 'like', "%$searchData%");
->orWhere('address', 'like', "%$searchData%")
->orWhereHas('state', function ($stateQuery) use ($searchData) {
$stateQuery->where('name', 'like', "%$searchData%");
});
});
}
@@ -202,12 +225,27 @@ class RestaurantApiServices
return jsonResponseWithErrorMessageApi(__('auth.restaurant_not_found'), 404);
}
// Check if the restaurant has already redeemed
$restaurantExist = RedeemRestaurant::where('manage_restaurants_xid', $restaurant->id)->first();
// Check if the restaurant has already been redeemed
$restaurantExist = RedeemRestaurant::where('manage_restaurants_xid', $restaurant->id)->where('iam_principal_xid', $customerIamId)
->where('is_redeem', 1)
->first();
if ($restaurantExist) {
return jsonResponseWithErrorMessageApi(__('auth.restaurant_already_redeemed'), 400);
}
// Check if there's an existing entry for the restaurant and update it
$restexist = RedeemRestaurant::where('manage_restaurants_xid', $restaurant->id)->where('iam_principal_xid', $customerIamId)->first();
if ($restexist) {
$restexist->is_redeem = 1;
$restexist->redeem_date = now();
$restexist->is_redeemption_undone = 0;
$restexist->redeemption_undone_date = null;
$restexist->save();
return jsonResponseWithSuccessMessageApi(__('success.restaurant_redeem'), $restexist, 200);
}
// Create a new redeem entry if it doesn't exist
$redeemRestaurant = new RedeemRestaurant();
$redeemRestaurant->iam_principal_xid = $customerIamId;
$redeemRestaurant->manage_restaurants_xid = $restaurant->id;
@@ -217,12 +255,96 @@ class RestaurantApiServices
$redeemRestaurant->redeemption_undone_date = null;
$redeemRestaurant->save();
return jsonResponseWithSuccessMessageApi(__('success.restaurant_redeem'), $redeemRestaurant, 200);
$imagePath = ListingImageUrl('restaurant_images', $restaurant->image);
$customerTitle = "Your Redemption was successful for " . $restaurant->name;
$customerMessage = $restaurant->name . " Voucher Redeemed Successfully";
$customerContentType = 'Voucher_Redemption';
$customerImageUrl = $imagePath;
$customerData = IamPrincipal::where('id', $customerIamId)->where('notification_status', 1)->where('principal_type_xid', 3)->first();
$restaurants = IamPrincipalRestaurantRole::select('id', 'principal_xid')->where('restaurant_xid', $restaurant->id)->get();
foreach ($restaurants as $restaurant) {
$restUser = IamPrincipal::where('id', $restaurant->principal_xid)->where('notification_status', 1)->where('principal_type_xid', 4)->first();
if ($restUser) {
$restImagePath = ListingImageUrl('restaurant_images', $restaurant->image);
$restTitle = "New redemption for " . $restaurant->name;
$restMessage = $restaurant->name . " new voucher Redeemed Successfully";
$restContent_type = 'Voucher_Redemption';
$restImageUrl = $restImagePath;
// Sending notification to restaurant
$pushNotificationToRestaurant = onesignalhelper::restSendNotificationApi(
$restUser->one_signal_player_id,
$restTitle,
$restMessage,
$restContent_type,
$restImageUrl,
$id = null
);
onesignalhelper::StoreNotificationDetails($restUser->id, $restContent_type, $restTitle, $restImageUrl);
}
}
if ($customerData) {
// Sending notification to customer
$pushNotificationToCustomer = onesignalhelper::sendNotificationApi(
$customerData->one_signal_player_id,
$customerTitle,
$customerMessage,
$customerContentType,
$customerImageUrl,
$id = null
);
onesignalhelper::StoreNotificationDetails($customerData->id, $customerContentType, $customerTitle, $customerImageUrl);
}
return jsonResponseWithSuccessMessageApi(__('success.restaurant_redeem'), $redeemRestaurant, 200);
} catch (Exception $ex) {
Log::error('Restaurant Redeem service failed: ' . $ex->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
public function searchRestaurant($customerIamId, $request)
{
try {
$restaurantsQuery = ManageRestaurant::with(['operatingHours', 'state'])
->where('is_active', '1');
$searchData = $request->input('search_data');
if (!empty($searchData)) {
$restaurantsQuery->where(function ($query) use ($searchData) {
$query->where('name', 'like', "%$searchData%")
->orWhere('description', 'like', "%$searchData%")
->orWhere('address', 'like', "%$searchData%")
->orWhereHas('state', function ($stateQuery) use ($searchData) {
$stateQuery->where('name', 'like', "%$searchData%");
});
});
}
$restaurants = $restaurantsQuery->get();
foreach ($restaurants as &$res) {
$res['image'] = ListingImageUrl('restaurant_images', $res['image']);
$res['is_favourite'] = CustomerFavouriteRestaurant::where('principal_xid', $customerIamId)
->where('restaurant_xid', $res->id)
->exists();
}
return jsonResponseWithSuccessMessageApi(__('auth.restaurant_search'), $restaurants, 200);
} catch (Exception $ex) {
Log::error('Search from restaurant service failed: ' . $ex->getMessage());
return response()->json([
'message' => __('auth.something_went_wrong')
], 500);
}
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Services\APIs\CustomerAPIs;
use App\Models\ManageRule;
use Illuminate\Support\Facades\Log;
use Exception;
class RulesApiServices
{
public function getVoucherRules()
{
try {
$data = ManageRule::select('id', 'title', 'message')
->get()
->toArray();
return $data;
} catch (Exception $ex) {
Log::error('Voucher rules and regulation Get service failed : ' . $ex->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
}

View File

@@ -6,102 +6,110 @@ 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 App\Models\RedeemRestaurant;
use Exception;
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();
$restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')
->where('principal_xid', $rest->id)
->first();
$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);
$restDetail = RedeemRestaurant::with([
'customer:id,first_name,last_name,profile_photo',
'restaurant:id,short_id,image,name'
])
->select('id', 'iam_principal_xid', 'manage_restaurants_xid', 'redeem_date', 'is_active', 'count')
->where('manage_restaurants_xid', $restaurantRoles->restaurant_xid)
->where('is_redeem', 1)
->get();
foreach ($restDetail as $detail) {
if ($detail->customer) {
$detail->customer->profile_photo = $detail->customer->profile_photo
? ListingImageUrl('profile_image', $detail->customer->profile_photo)
: asset('public/assets/img/blankProfile.png');
}
$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;
if ($detail->restaurant) {
// Check if the image is already a URL
if (!filter_var($detail->restaurant->image, FILTER_VALIDATE_URL)) {
$detail->restaurant->image = ListingImageUrl('restaurant_images', $detail->restaurant->image);
} else {
Log::error('User detail not found for IAM principal ID: ' . $voucher->iam_principal_xid);
// Fallback if the image is already a URL
$detail->restaurant->image = $detail->restaurant->image
? $detail->restaurant->image
: asset('public/assets/img/blankProfile.png');
}
}
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;
}
$restDetailArray = $restDetail->toArray();
$restundoresumptionDetail = RedeemRestaurant::with([
'customer:id,first_name,last_name,profile_photo',
'restaurant:id,short_id,image,name'
])
->select('id', 'iam_principal_xid', 'manage_restaurants_xid', 'redeem_date', 'is_active', 'count', 'redeemption_undone_date')
->where('manage_restaurants_xid', $restaurantRoles->restaurant_xid)
->where('is_redeemption_undone', 1)
->get();
foreach ($restundoresumptionDetail as $detail) {
if ($detail->customer) {
$detail->customer->profile_photo = $detail->customer->profile_photo
? ListingImageUrl('profile_image', $detail->customer->profile_photo)
: asset('public/assets/img/blankProfile.png');
}
if ($detail->restaurant) {
// Check if the image is already a URL
if (!filter_var($detail->restaurant->image, FILTER_VALIDATE_URL)) {
$detail->restaurant->image = ListingImageUrl('restaurant_images', $detail->restaurant->image);
} else {
// Fallback if the image is already a URL
$detail->restaurant->image = $detail->restaurant->image
? $detail->restaurant->image
: asset('public/assets/img/blankProfile.png');
}
}
}
$restundoRedumption = $restundoresumptionDetail->toArray();
$restaurantDetail = [
'redeemed_vouchers' => $restDetailArray,
'redemption_undone_vouchers' => $restundoRedumption,
];
return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $restaurantDetail, 200);
} catch (Exception $ex) {
Log::error('Restaurant Get data service failed : ' . $ex->getMessage());
Log::error('Redeem 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();
$voucherDetail = RedeemRestaurant::where('id', $request->voucher_id)->first();
$rest = ManageRestaurant::where('id', $voucherDetail->manage_restaurants_xid)->first();
if ($voucherDetail) {
$voucherDetail->update([
'is_redeem' => 0,
@@ -110,9 +118,9 @@ class RedeemApiService
'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";
$imagePath = ListingImageUrl('restaurant_images', $rest->image);
$customerTitle = "Your voucher was successfully undo redemption for " . $rest->name;
$customerMessage = $rest->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();
@@ -130,9 +138,9 @@ class RedeemApiService
}
$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";
$restImagePath = ListingImageUrl('voucher_images', $rest->image);
$restTitle = "voucher Undo redemption successful for " . $rest->name;
$restMessage = $rest->image . " Voucher Undo Redemption Successfully";
$restContentType = 'Voucher_UndoRedemption';
$restImageUrl = $restImagePath;
@@ -152,13 +160,16 @@ class RedeemApiService
return jsonResponseWithErrorMessageApi(__('auth.voucher_not_found'), 404);
}
} catch (Exception $ex) {
Log::error('Restaurant update profile service failed: ' . $ex->getMessage());
Log::error('Undo redumption service failed: ' . $ex->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
public function searchRedemption($restIamId, $request)
public function searchRedemption($restIamId, $request)
{
try {
$searchQuery = $request->input('search_data');
@@ -166,83 +177,105 @@ class RedeemApiService
$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)
->first();
$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;
$query = RedeemRestaurant::with([
'customer:id,first_name,last_name,profile_photo',
'restaurant:id,image,name'
])
->select('id', 'iam_principal_xid', 'manage_restaurants_xid', 'redeem_date', 'is_active', 'count')
->where('manage_restaurants_xid', $restaurantRoles->restaurant_xid)
->where('is_redeem', 1);
$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();
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');
}
$voucher->user_detail = $userDetail;
$redeemedVouchers[] = $voucher;
} else {
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();
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');
}
$undone->user_detail = $userDetail;
$redemptionUndoneVouchers[] = $undone;
} else {
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;
}
$restaurantDetail['redeemed_vouchers'] = $redeemedVouchers;
$restaurantDetail['redemption_undone_vouchers'] = $redemptionUndoneVouchers;
if ($searchQuery) {
$query->where(function ($q) use ($searchQuery) {
$q->where('id', $searchQuery)
->orWhereHas('customer', function ($q) use ($searchQuery) {
$q->where('first_name', 'like', '%' . $searchQuery . '%')
->orWhere('last_name', 'like', '%' . $searchQuery . '%');
})
->orWhereDate('redeem_date', $searchQuery);
});
}
$restDetail = $query->get();
foreach ($restDetail as $detail) {
if ($detail->customer) {
$detail->customer->profile_photo = $detail->customer->profile_photo
? ListingImageUrl('profile_image', $detail->customer->profile_photo)
: asset('public/assets/img/blankProfile.png');
}
if ($detail->restaurant) {
if (!filter_var($detail->restaurant->image, FILTER_VALIDATE_URL)) {
$detail->restaurant->image = ListingImageUrl('restaurant_images', $detail->restaurant->image);
} else {
$detail->restaurant->image = $detail->restaurant->image
? $detail->restaurant->image
: asset('public/assets/img/blankProfile.png');
}
}
}
$restDetailArray = $restDetail->toArray();
$queryUndo = RedeemRestaurant::with([
'customer:id,first_name,last_name,profile_photo',
'restaurant:id,image,name'
])
->select('id', 'iam_principal_xid', 'manage_restaurants_xid', 'redeem_date', 'is_active', 'count', 'redeemption_undone_date')
->where('manage_restaurants_xid', $restaurantRoles->restaurant_xid)
->where('is_redeemption_undone', 1);
if ($searchQuery) {
$queryUndo->where(function ($q) use ($searchQuery) {
$q->where('id', $searchQuery)
->orWhereHas('customer', function ($q) use ($searchQuery) {
$q->where('first_name', 'like', '%' . $searchQuery . '%')
->orWhere('last_name', 'like', '%' . $searchQuery . '%');
})
->orWhereDate('redeemption_undone_date', $searchQuery);
});
}
$restundoresumptionDetail = $queryUndo->get();
foreach ($restundoresumptionDetail as $detail) {
if ($detail->customer) {
$detail->customer->profile_photo = $detail->customer->profile_photo
? ListingImageUrl('profile_image', $detail->customer->profile_photo)
: asset('public/assets/img/blankProfile.png');
}
if ($detail->restaurant) {
if (!filter_var($detail->restaurant->image, FILTER_VALIDATE_URL)) {
$detail->restaurant->image = ListingImageUrl('restaurant_images', $detail->restaurant->image);
} else {
$detail->restaurant->image = $detail->restaurant->image
? $detail->restaurant->image
: asset('public/assets/img/blankProfile.png');
}
}
}
$restundoRedumption = $restundoresumptionDetail->toArray();
$restaurantDetail = [
'redeemed_vouchers' => $restDetailArray,
'redemption_undone_vouchers' => $restundoRedumption,
];
return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $restaurantDetail, 200);
} catch (Exception $ex) {
Log::error('Restaurant Get data service failed : ' . $ex->getMessage());
Log::error('Search voucher service failed: ' . $ex->getMessage());
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
}
}
}

View File

@@ -25,7 +25,7 @@ class RestAuthApiService
public function viewresyaurant()
{
try {
$data = ManageRestaurant::select('id', 'name','description','restaurant_id','address','image','bio','try_on_1','try_on_2','try_on_3','try_on_4','exclusion','latitude','longtitude')->where('is_active', 1)->get()->toArray();
$data = ManageRestaurant::select('id', 'name', 'description', 'restaurant_id', 'address', 'image', 'bio', 'try_on_1', 'try_on_2', 'try_on_3', 'try_on_4', 'exclusion', 'latitude', 'longtitude')->where('is_active', 1)->get()->toArray();
return $data;
} catch (Exception $ex) {
DB::rollBack();
@@ -69,7 +69,7 @@ class RestAuthApiService
'phone_number' => $request->phone_number,
'date_of_birth' => $request->date_of_birth,
'is_active' => '0',
'state_xid' => $request->state_xid
// 'state_xid' => $request->state_xid
]);
$restaurantUserRole = IamPrincipalRestaurantRole::create([
@@ -226,32 +226,36 @@ class RestAuthApiService
if (!$iamPrincipal) {
$errors[] = __('auth.failed_to_verify_otp');
return jsonResponseWithErrorMessageApi(
$errors,403
);
$errors,
403
);
}
// Check if the provided OTP matches the stored OTP
if ($iamPrincipal->otp_code !== $request->otp) {
$errors[] = __('auth.invalid_otp');
return jsonResponseWithErrorMessageApi(
$errors,403
);
$errors,
403
);
}
// Check if the OTP is still valid
if (Carbon::now()->gt($iamPrincipal->valid_till)) {
$errors[] = __('auth.otp_expired');
return jsonResponseWithErrorMessageApi(
$errors,403
);
$errors,
403
);
}
// Check if the OTP has already been used
if ($iamPrincipal->is_used === 1) {
$errors[] = __('auth.otp_already_used');
return jsonResponseWithErrorMessageApi(
$errors,403
);
$errors,
403
);
}
@@ -373,4 +377,27 @@ class RestAuthApiService
}
return $otp;
}
public function searchRest($request)
{
try {
$searchQuery = $request->input('search_data');
$query = ManageRestaurant::select('id', 'name')->where('is_active', 1);
if ($searchQuery) {
$query->where(function ($q) use ($searchQuery) {
$q->where('name', 'like', '%' . $searchQuery . '%')
->orWhere('address', 'like', '%' . $searchQuery . '%');
});
}
$restaurants = $query->get();
return jsonResponseWithSuccessMessageApi(__('auth.data_fetched_successfully'), $restaurants, 200);
} catch (\Exception $e) {
Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage());
return response()->json(__('something_went_wrong'), 500);
}
}
}

View File

@@ -104,8 +104,8 @@ class RestCMSService
public function RestNewsArticles()
{
try {
$data['customer'] = NewsArticle::select('id', 'news_articles_category_xid','name', 'description', 'thumbnail_image', 'image',)
->where([['is_active', '0'], ['news_articles_category_xid', '1']])
$data['customer'] = NewsArticle::select('id', 'name', 'description', 'thumbnail_image', 'image')
->where([['is_active', '1'], ['news_articles_category_xid', '1']])
->get()
->map(function ($item) {
$item['description'] = strip_tags($item['description']);
@@ -114,7 +114,7 @@ class RestCMSService
->toArray();
$data['restaurant'] = NewsArticle::select('id', 'news_articles_category_xid','name', 'description', 'thumbnail_image', 'image')
->where([['is_active', '0'], ['news_articles_category_xid', '2']])
->where([['is_active', '1'], ['news_articles_category_xid', '2']])
->get()
->map(function ($item) {
$item['description'] = strip_tags($item['description']);

View File

@@ -1,7 +1,8 @@
<?php
namespace App\Services\APIs\RestaurantService;
use App\Models\IamPrincipal;
use App\Models\IamPrincipal;
use App\Models\admin\ManageVoucherModel;
use App\Models\admin\Mana;
use App\Models\ManageRestaurant;
@@ -42,7 +43,7 @@ class RestaurantApi_Service
// $restaurantDetails = [];
foreach ($restaurantRoles as $restaurantRole) {
$restaurant =ManageRestaurant::select('id', 'name', 'description', 'restaurant_id', 'address', 'image', 'bio', 'try_on_1', 'try_on_2', 'try_on_3', 'try_on_4', 'exclusion', 'latitude','longtitude','is_active','created_by','modified_by','deleted_at','created_at','updated_at')
$restaurant = ManageRestaurant::select('id', 'name', 'description', 'restaurant_id', 'address', 'image', 'bio', 'try_on_1', 'phone_number', 'try_on_2', 'try_on_3', 'try_on_4', 'exclusion', 'latitude', 'longtitude', 'is_active', 'created_by', 'modified_by', 'deleted_at', 'created_at', 'updated_at')
->where('id', $restaurantRole->restaurant_xid)
->where('is_active', 1)
->first();
@@ -72,7 +73,7 @@ class RestaurantApi_Service
public function updateRestaurantDetail($restIamId, $request)
{
try {
@@ -98,11 +99,12 @@ class RestaurantApi_Service
'name' => $request['name'],
'address' => $request['address'],
'bio' => $request['bio'],
'phone_number' => $request['phone_number'],
'try_on_1' => $request['try_on_1'],
'try_on_2' => $request['try_on_2'],
'try_on_3' => $request['try_on_3'],
'try_on_4' => $request['try_on_4'],
]);
$restaurant->description = strip_tags($restaurant->description);
@@ -131,7 +133,6 @@ class RestaurantApi_Service
$tnormalImage = saveSingleImageWithoutCrop($image, 'profile_image', null);
$data->update(['profile_photo' => $tnormalImage]);
DB::commit();
}
if ($request->has('first_name')) {
$data->first_name = $request->first_name;

View File

@@ -19,7 +19,7 @@ return new class extends Migration
$table->longText('description');
$table->string('thumbnail_image');
$table->string('image');
$table->enum('is_active',['0','1'])->comment('0 = Active, 1 = Inactive');
$table->enum('is_active',['0','1'])->default(1)->comment('0 = Active, 1 = Inactive');
$table->softDeletes();
$table->timestamps();

View File

@@ -0,0 +1,31 @@
<?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('feedback_reaction', function (Blueprint $table) {
$table->id();
$table->integer('feedback_reaction_xid')->nullable();
$table->string('feedback_reaction_title')->nullable();
$table->integer('created_by')->nullable();
$table->integer('modified_by')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('feedback_reaction');
}
};

View File

@@ -0,0 +1,48 @@
<?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('manage_feedback', function (Blueprint $table) {
$table->id();
// Foreign key references for principal
$table->unsignedBigInteger('principal_xid');
$table->foreign('principal_xid')->references('id')->on('iam_principal')->onDelete('cascade');
// Feedback reaction and comment columns
$table->unsignedBigInteger('feedback_reaction_xid');
$table->foreign('feedback_reaction_xid')->references('id')->on('feedback_reaction')->onDelete('cascade');
$table->longtext('comment')->nullable();
$table->boolean('is_app_feedback')->default(0);
$table->boolean('is_restaurant_feedback')->default(0);
$table->integer('restaurant_id')->nullable();
// Soft deletes, timestamps, and additional columns
$table->softDeletes();
$table->timestamps();
$table->boolean('is_active')->default(1)->comment('1=Active, 0=Deactive');
$table->integer('created_by')->nullable();
$table->integer('modified_by')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('manage_feedback');
}
};

View File

@@ -15,19 +15,25 @@ return new class extends Migration
Schema::create('manage_restaurants', function (Blueprint $table) {
$table->id();
$table->string('short_id')->unique();
$table->string('name',255)->nullable();
$table->string('name', 255)->nullable();
$table->longText('description')->nullable();
$table->string('phone_number', 15)->nullable();
$table->bigInteger('state_xid')->nullable();
$table->string('restaurant_id')->nullable();
$table->string('address',255)->nullable();
$table->string('address', 255)->nullable();
$table->string('image')->nullable();
$table->string('bio')->nullable();
$table->text('try_on_1')->nullable();
$table->text('try_on_2')->nullable();
$table->text('try_on_3')->nullable();
$table->text('try_on_4')->nullable();
$table->string('exclusion',255)->nullable();
$table->string('exclusion', 255)->nullable();
$table->string('latitude');
$table->string('longtitude');
$table->integer('time_hours')->default(1)->comment('Time in hours between redeeming two cocktails');
$table->integer('max_numb_day')->default(1)->comment('Maximum number of cocktails per day');
$table->integer('max_numb_week')->default(1)->comment('Maximum number of cocktails per week');
$table->integer('max_numb_month')->default(1)->comment('Maximum number of cocktails per month');
$table->boolean('is_active')->default(1)->comment('1=Active, 0=Expired');
$table->integer('created_by')->nullable();
$table->integer('modified_by')->nullable();

View File

@@ -15,7 +15,7 @@ return new class extends Migration
$table->id();
$table->unsignedBigInteger('principal_xid');
$table->foreign('principal_xid')->references('id')->on('iam_principal')->onDelete('cascade');
$table->integer('type');
$table->string('type');
$table->longText('description');
$table->string('image')->nullable();
$table->timestamp('date_added')->useCurrent();

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
$users = DB::table('iam_principal')->where('principal_type_xid', 3)->whereNull('referral_code')->orWhere('referral_code', '')->get();
foreach ($users as $user) {
do {
$referral_code = \Str::random(10);
} while (DB::table('iam_principal')->where('referral_code', $referral_code)->exists());
DB::table('iam_principal')
->where('id', $user->id)
->update(['referral_code' => $referral_code]);
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('iam_principal', function (Blueprint $table) {
//
});
}
};

View File

@@ -0,0 +1,28 @@
<?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::table('iam_principal', function (Blueprint $table) {
$table->string('referral_code')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('iam_principal', function (Blueprint $table) {
$table->string('referral_code')->nullable(false)->change();
});
}
};

View File

@@ -0,0 +1,31 @@
<?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('check_referral_code', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('iam_principal_xid');
$table->string('referral_code');
$table->enum('is_active', [1, 0])->default(1)->comment('1=Active, 0=InActive');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('check_referral_code');
}
};

View File

@@ -0,0 +1,29 @@
<?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('manage_rules', function (Blueprint $table) {
$table->id();
$table->longtext('title')->nullable();
$table->longtext('message')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('manage_rules');
}
};

View File

@@ -1,5 +1,9 @@
/*# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlcyI6WyJjdXN0b20uc2NzcyJdLCJzb3VyY2VzQ29udGVudCI6WyIiXSwiZmlsZSI6ImN1c3RvbS5jc3MifQ== */
.arrow-icon-spacing {
margin-left: 10px;
}
.notification-scroll h2 {
font-size: 20px;
font-weight: bold;
@@ -1373,7 +1377,7 @@ label {
/* to change error class color */
label#email-error ,label#password-error {
color: red;
}
font-weight: 600;}
.error-message {
@@ -1560,3 +1564,33 @@ a.download-btn.reply-button:hover {
width: fit-content !important;
padding: 10px 20px;
}
/*
.random_cl li {
list-style: circle !important;
} */
.random_cl li a {
position: relative;
display: flex;
justify-content: space-between;
padding: 10.2px 16px 10.2px 24px;
margin-left: 34px;
font-size: 15px;
color: #000;
}
.random_cl li a:before {
content: "";
background-color: #000;
position: absolute;
height: 7px;
width: 7px;
top: 15px;
left: 5px;
border-radius: 50%;
}
.random_cl li a:hover {
color: #fff;
background: #05244d;
}

View File

@@ -536,7 +536,7 @@ input[type=search]::-ms-reveal {
/* Form Group Label */
.form-group label, label {
font-size: 15px;
color: #0e1726;
color: #1a1919;
letter-spacing: 1px;
display: inline-block;
margin-bottom: 0.5rem;

View File

@@ -1,13 +1,13 @@
// Login js
$(document).on("click", "#admin_login_btn", function (e) {
$('#admin_login_form').validate({
$("#admin_login_form").validate({
rules: {
email: {
required: true,
},
password: {
required: true,
}
},
},
messages: {
email: {
@@ -15,7 +15,7 @@ $(document).on("click", "#admin_login_btn", function (e) {
},
password: {
required: "Please enter the password.",
}
},
},
submitHandler: function (form) {
e.preventDefault();
@@ -23,64 +23,68 @@ $(document).on("click", "#admin_login_btn", function (e) {
var formData = new FormData(form);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr(
"content"
),
},
});
$.ajax({
url: base_url + '/check_login',
type: 'POST',
url: base_url + "/check_login",
type: "POST",
data: formData,
beforeSend:function(){
$('#admin_login_btn').text('Please wait...');
$('#admin_login_btn').attr('disabled', true);
beforeSend: function () {
$("#admin_login_btn").text("Please wait...");
$("#admin_login_btn").attr("disabled", true);
},
processData: false,
contentType: false,
success: function (response) {
if (response.status == 200) {
$('#admin_login_btn').prop('disabled', false);
$('#admin_login_btn').text('Login');
$("#admin_login_btn").prop("disabled", false);
$("#admin_login_btn").text("Login");
window.location.href = base_url + "/dashboard";
}
}
if (response.status == 401) {
toastr.error(response.message);
form.reset();
$('#admin_login_btn').prop('disabled', false);
$('#admin_login_btn').text('Sign In');
$("#admin_login_btn").prop("disabled", false);
$("#admin_login_btn").text("Sign In");
}
},
});
}
},
});
});
// forgot password js
$(document).on("click", "#forgot_password_btn", function (e) {
let base_url = url_path;
$('#forgot_pass_form').validate({
$("#forgot_pass_form").validate({
ignore: [],
debug: false,
rules: {
email: {
required: true
}
required: true,
},
},
messages: {
email: {
required: "Please Enter email"
}
required: "Please Enter email",
},
},
submitHandler: function (form) {
var formData = new FormData(form);
e.preventDefault(),
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr(
"content"
),
},
});
$.ajax({
url: base_url + '/send_otp',
type: 'POST',
url: base_url + "/send_otp",
type: "POST",
data: formData,
processData: false,
contentType: false,
@@ -88,51 +92,53 @@ $(document).on("click", "#forgot_password_btn", function (e) {
console.log(response);
if (response.status == 200) {
form.reset();
toastr.success('Otp send it your mail id please check');
toastr.success("Otp send it your mail id please check");
setTimeout(function () {
// toastr.info('Please check your email to reset your password. The link is valid for 5 minutes.');
// toastr.info('Please check your email to reset your password. The link is valid for 5 minutes.');
window.location.href = base_url + "/otp";
}, 1000);
}else if (response.status == 404) {
toastr.error('This email id is not exits');
}
else {
} else if (response.status == 404) {
toastr.error("This email id is not exits");
} else {
toastr.error("Something went wrong");
}
},
});
}
},
});
});
// otp varification
$(document).on('click', '#otp_verify_button', function(e) {
$(document).on("click", "#otp_verify_button", function (e) {
e.preventDefault();
// Get base URL
let base_url = url_path;
// Get admin ID
var id = $('#admin_otp_id').val();
var id = $("#admin_otp_id").val();
// Get OTP by concatenating values of all OTP input fields
var otp = $('.otp').map(function() {
return this.value;
}).get().join('');
var otp = $(".otp")
.map(function () {
return this.value;
})
.get()
.join("");
// Send AJAX request for OTP verification
$.ajax({
url: base_url + '/otp_verify',
type: 'POST',
url: base_url + "/otp_verify",
type: "POST",
data: {
id: id,
otp: otp,
'_token': $('meta[name="csrf-token"]').attr('content')
_token: $('meta[name="csrf-token"]').attr("content"),
},
success: function (response) {
if (response.status == 200) {
// Display success message
toastr.success('Otp Verify Successfully');
toastr.success("Otp Verify Successfully");
// Redirect to the dashboard after a delay
setTimeout(function () {
window.location.href = base_url + "/password_reset";
@@ -148,34 +154,35 @@ $(document).on('click', '#otp_verify_button', function(e) {
});
});
$(document).on('input', '.otp', function() {
this.value = this.value.replace(/[^0-9]/g, '');
$(document).on("input", ".otp", function () {
this.value = this.value.replace(/[^0-9]/g, "");
if (this.value.length >= this.maxLength) {
$(this).next('.otp').focus();
$(this).next(".otp").focus();
}
});
// Reset Password
$(document).on("click", "#password_reset", function (e) {
$('#password_reset_form').validate({
$("#password_reset_form").validate({
rules: {
password: {
required: true,
minlength: 8,
},
confirm_password: {
required: true,
equalTo: "#password"
equalTo: "#password",
},
},
messages: {
password: {
required: "Please enter a password.",
minlength: "The password field must be at least 8 characters.",
},
confirm_password: {
required: "Please Confirm Your Password",
equalTo: "Your Password Do Not Match"
equalTo: "Your Password Do Not Match",
},
},
submitHandler: function (form) {
@@ -185,43 +192,47 @@ $(document).on("click", "#password_reset", function (e) {
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr(
"content"
),
},
});
$.ajax({
url: base_url + '/password_update',
type: 'POST',
url: base_url + "/password_update",
type: "POST",
data: formData,
processData: false,
contentType: false,
success: function (response) {
if (response.status == 200) {
$('#password_reset').prop('disabled', false);
$('#password_reset').text('Login');
window.location.href = base_url + "/";
}
if (response.status == 401) {
if (response.status_code == 200) {
$("#password_reset").prop("disabled", false);
$("#password_reset").text("Login");
toastr.success(response.message);
setTimeout(function () {
window.location.href = base_url + "/";
}, 1000);
}
if (response.status_code == 401) {
toastr.error(response.message);
form.reset();
$('#password_reset').prop('disabled', false);
$('#password_reset').text('Sign In');
$("#password_reset").prop("disabled", false);
$("#password_reset").text("Sign In");
}
},
});
}
},
});
});
$('#passwordToggle').click(function () {
var passwordInput = $('#password');
var eyeIcon = $('#passwordToggle');
$("#passwordToggle").click(function () {
var passwordInput = $("#password");
var eyeIcon = $("#passwordToggle");
if (passwordInput.attr('type') === 'password') {
passwordInput.attr('type', 'text');
eyeIcon.removeClass('fa-eye-slash').addClass('fa-eye');
if (passwordInput.attr("type") === "password") {
passwordInput.attr("type", "text");
eyeIcon.removeClass("fa-eye-slash").addClass("fa-eye");
} else {
passwordInput.attr('type', 'password');
eyeIcon.removeClass('fa-eye').addClass('fa-eye-slash');
passwordInput.attr("type", "password");
eyeIcon.removeClass("fa-eye").addClass("fa-eye-slash");
}
});

View File

@@ -1,95 +1,97 @@
// $('#add_newsletter').on("click", function (e) {
// $.validator.addMethod("quillNotEmpty", function(value, element) {
// var quill = new Quill('#news-quill-add');
// return quill.getText().trim().length > 0;
// }, "Please enter description ");
$('#add_newsletter').on("click", function (e) {
// alert('jh');
// $.validator.addMethod("quillNotEmpty", function(value, element) {
// var quill = new Quill('#news-quill-add');
// return quill.getText().trim().length > 0;
// }, "Please enter description ");
// $('#add_blog_form').validate({
// ignore: [],
// debug: false,
// rules: {
// article_name: {
// required: true
// },
// article_dis: {
// required: true,
// quillNotEmpty: true
// },
// article_image: {
// required: true
// },
// article_thmb: {
// required: true
// },
// category: {
// required: true
// },
// },
// messages: {
// article_name: {
// required: "Please Enter Article name"
// },
// article_dis: {
// required: "Please Enter Description"
// },
// article_image: {
// required: "Please Select Image"
// },
// category: {
// required: "Please Select Article Category"
// },
// },
// errorClass: 'error-message',
// submitHandler: function (form) {
// let base_url = url_path;
// var formData = new FormData(form);
// $('#add_newsletter').text('Please wait...').attr('disabled', true);
$('#add_blog_form').validate({
// ignore: [],
// debug: false,
rules: {
article_name: {
required: true
},
article_dis: {
required: true,
quillNotEmpty: true
},
article_image: {
required: true
},
article_thmb: {
required: true
},
category: {
required: true
},
},
messages: {
article_name: {
required: "Please Enter Article name"
},
article_dis: {
required: "Please Enter Description"
},
article_image: {
required: "Please Select Image"
},
category: {
required: "Please Select Article Category"
},
},
errorClass: 'error-message',
submitHandler: function (form) {
// $.ajaxSetup({
// headers: {
// "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
// },
// });
var quillContent = quill.root.innerHTML;
$('#article_des').val(quillContent);base_url = url_path;
var formData = new FormData(form);
$('#add_newsletter').text('Please wait...').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
// $.ajax({
// url: base_url + '/manage_insert_news',
// type: 'POST',
// data: formData,
// processData: false,
// contentType: false,
// success: function (response) {
// if (response.status == 200) {
// toastr.success('News and Article Added Successfully');
// setTimeout(function () {
// window.location.href = base_url + "/manage_news";
// }, 1000);
// } else {
// toastr.error("Something went wrong");
// }
// $('#add_newsletter').attr('disabled', false).text('Submit');
// },
// });
// }
// });
// });
$.ajax({
url: base_url + '/manage_insert_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (response) {
if (response.status == 200) {
toastr.success('News and Article Added Successfully');
setTimeout(function () {
window.location.href = base_url + "/manage-new-articles";
}, 1000);
} else {
toastr.error("Something went wrong");
}
$('#add_newsletter').attr('disabled', false).text('Submit');
},
});
}
});
});
// selectThumbnailImage.onchange = evt => {
// preview = document.getElementById('previewthumbnailimage');
// preview.style.display = 'block';
// const [file] = selectThumbnailImage.files
// if (file) {
// preview.src = URL.createObjectURL(file)
// }
// }
selectThumbnailImage.onchange = evt => {
preview = document.getElementById('previewthumbnailimage');
preview.style.display = 'block';
const [file] = selectThumbnailImage.files
if (file) {
preview.src = URL.createObjectURL(file)
}
}
// selectImage.onchange = evt => {
// preview = document.getElementById('preview');
// preview.style.display = 'block';
// const [file] = selectImage.files
// if (file) {
// preview.src = URL.createObjectURL(file)
// }
// }
selectImage.onchange = evt => {
preview = document.getElementById('preview');
preview.style.display = 'block';
const [file] = selectImage.files
if (file) {
preview.src = URL.createObjectURL(file)
}
}

View File

@@ -76,57 +76,83 @@ $(document).ready(function() {
});
$(document).ready(function() {
var quill = new Quill('#termsRest-quill-edit', {
theme: 'snow'
});
var storedMessage = document.getElementById('stored-terms-rest-message').value;
quill.clipboard.dangerouslyPasteHTML(storedMessage);
$('#update_termsrest').on("click", function(e) {
e.preventDefault();
$('#terms_rest_form').validate({
ignore: [],
debug: false,
rules: {
termsrest_des: {
required: true,
minlength:1000,
}
},
messages: {
termsrest_des: {
required: "Please Enter Terms and Condition",
minlength:"Please Enter Terms and Condition"
}
},
errorClass: 'error-message',
submitHandler: function(form) {
// Get the HTML content from Quill editor
var termsrest_des = quill.root.innerHTML;
if (termsrest_des.trim() === '<p><br></p>') {
toastr.error("Please Enter Terms and Condition");
return false;
}
let base_url = url_path;
var termRest_id = document.querySelector('input[name="termRest_id"]').value;
// Create a form data object
var formData = new FormData(form);
formData.append('termsrest_des', termsrest_des);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/update_terms_rest',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.status == 200) {
toastr.success('Terms and Condition Data Updated Successfully');
setTimeout(function() {
window.location.href = base_url + "/terms";
}, 1000);
} else {
toastr.error("Something went wrong");
}
},
error: function(response) {
toastr.error("An error occurred while updating the terms");
}
});
}
});
// Trigger form validation
$('#terms_rest_form').submit();
});
});
// privacy policy for rest
// $('#update_terms_rest').on("click", function (e) {
// $('#update_terms_rest_form').validate({
// ignore: [],
// debug: false,
// rules: {
// article_des_rest: {
// required: true,
// quillNotEmpty: true
// }
// },
// messages: {
// article_des_rest: {
// required: "Please Enter Terms and Condition"
// }
// },
// errorClass: 'error-message',
// submitHandler: function (form) {
// let base_url = url_path;
// var formData = new FormData(form);
// $.ajaxSetup({
// headers: {
// "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
// },
// });
// $.ajax({
// url: base_url + '/update_terms_rest',
// type: 'POST',
// data: formData,
// processData: false,
// contentType: false,
// success: function (response) {
// if (response.status == 200) {
// toastr.success('Terms and Condtion Data Updated Successfully');
// setTimeout(function () {
// window.location.href = base_url + "/terms";
// }, 1000);
// }
// else if (response.status == 204) {
// toastr.error(response.error);
// }
// else {
// toastr.error("Something went wrong");
// }
// },
// });
// }
// });
// });

View File

@@ -17,7 +17,7 @@ $(document).on("click", "#customer_user_btn", function (e) {
required: true,
fullNameCharactersOnly: true
},
email_id: {
email_address: {
required: true,
email: true,
},
@@ -34,7 +34,7 @@ $(document).on("click", "#customer_user_btn", function (e) {
required: "Enter Passport Name",
alphaCharactersOnly: "Please enter only alphabetical characters"
},
email_id: {
email_address: {
required: "Enter email address",
email: "Please enter a valid email address"
},
@@ -66,14 +66,15 @@ $(document).on("click", "#customer_user_btn", function (e) {
processData: false,
contentType: false,
success: function(result) {
console.log(result);
if (result.status_code == 200) {
toastr.success('Customer Updated Sucessfully');
toastr.success('Customer Updated Successfully');
setTimeout(function() {
window.location.href = base_url + "/manage-customer";
}, 2000);
} else {
toastr.error('Something Went Wrong');
toastr.error(result.message);
setTimeout(function() {
window.location.href = base_url + "/manage-customer";
}, 2000);
@@ -81,11 +82,29 @@ $(document).on("click", "#customer_user_btn", function (e) {
$('#customer_user_btn').attr('disabled', false);
$('#customer_user_btn').text('Submit');
},
error: function(xhr) {
console.log(xhr);
if (xhr.status === 422) {
var errors = xhr.responseJSON.errors;
for (var key in errors) {
if (errors.hasOwnProperty(key)) {
toastr.error(errors[key][0]); // Show the first error message for each field
}
}
} else {
toastr.error('Something Went Wrong');
}
$('#customer_user_btn').attr('disabled', false);
$('#customer_user_btn').text('Submit');
}
});
$('#customer_user_btn').attr('disabled', false);
$('#customer_user_btn').text('Submit');
}
});
});
});

View File

@@ -15,7 +15,7 @@ $('#zero-config').DataTable({
"pageLength": 10,
"ordering": true, // Enable global ordering
"columnDefs": [
{ "orderable": false, "targets": [0, 1, 2] } // Disable ordering for the first column (checkboxes) and the eighth column
// { "orderable": false, "targets": [0, 1, 2] } // Disable ordering for the first column (checkboxes) and the eighth column
]
});
@@ -70,7 +70,7 @@ $(document).on("click", ".customer_unarchive", function (e) {
url: base_url + "/manage_customer_unarchive/" + archive_id,
success: function (response) {
if (response.status == 200) {
toastr.success('Record has been ');
toastr.success('The user has been unarchived.');
setTimeout(function () {
window.location.href = base_url + "/manage-customer";
}, 1000);
@@ -140,3 +140,11 @@ $(document).on("click", ".more", function (e) {

View File

@@ -1,3 +1,45 @@
// $(document).on("click", "#submit_location", function (e) {
// $('#store_location').validate({
// rules: {
// location_name: {
// required: true,
// }
// },
// messages: {
// location_name: {
// required: "Please enter the state.",
// }
// },
// errorClass: 'error-message',
// submitHandler: function (form) {
// e.preventDefault();
// let base_url = url_path;
// var formData = new FormData(form);
// $.ajaxSetup({
// headers: {
// "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
// },
// });
// $.ajax({
// url: base_url + '/insert_location',
// type: 'POST',
// data: formData,
// processData: false,
// contentType: false,
// success: function (response) {
// if (response.status == 200) {
// toastr.success('Location added successfully');
// setTimeout(function () {
// window.location.href = base_url + "/manage_location";
// }, 1000);
// } else {
// toastr.error("Something went wrong");
// }
// },
// });
// }
// });
// });
$(document).on("click", "#submit_location", function (e) {
$('#store_location').validate({
rules: {
@@ -7,7 +49,7 @@ $(document).on("click", "#submit_location", function (e) {
},
messages: {
location_name: {
required: "Please enter the city.",
required: "Please enter the state.",
}
},
errorClass: 'error-message',
@@ -32,11 +74,21 @@ $(document).on("click", "#submit_location", function (e) {
setTimeout(function () {
window.location.href = base_url + "/manage_location";
}, 1000);
} else if (response.status == 422 && response.error === 'Location name already exists') {
toastr.error('Location name already exists');
} else {
toastr.error("Something went wrong");
}
},
error: function (xhr, status, error) {
// Handle the case where the server returns an error
if (xhr.status == 422 && xhr.responseJSON.error === 'Location name already exists') {
toastr.error('Location name already exists');
} else {
toastr.error("An error occurred");
}
}
});
}
});
});
});

View File

@@ -6,6 +6,7 @@ $(document).on("click", ".edit_location_value", function (e) {
});
$('#edit_location').validate({
rules: {
location_name: {
@@ -14,14 +15,14 @@ $('#edit_location').validate({
},
messages: {
location_name: {
required: "Please enter the city.",
required: "Please enter the state.",
}
},
errorClass: 'error-message',
submitHandler: function (form) {
var formData = new FormData(form);
$('#update_passport_btn').text('Please wait...');
$('#update_passport_btn').attr('disabled', true);
$('#update_passport_btn').attr('disabled', true);
let base_url = url_path;
$.ajax({
url: base_url + '/update_location',
@@ -30,13 +31,16 @@ $('#edit_location').validate({
processData: false,
contentType: false,
success: function(result) {
if (result.status_code == 200) {
if (result.status === 200) {
toastr.success('Location Updated successfully');
setTimeout(function() {
window.location.href = base_url + "/manage_location";
}, 2000);
} else {
}
else if (result.status === 422 && result.error === 'Location name already exists') {
toastr.error('Location name already exists');
}
else {
toastr.error('Something Went Wrong');
setTimeout(function() {
window.location.href = base_url + "/manage_location";
@@ -45,8 +49,11 @@ $('#edit_location').validate({
$('#update_passport_btn').attr('disabled', false);
$('#update_passport_btn').text('Submit');
},
error: function(xhr, status, error) {
toastr.error('Something Went Wrong');
$('#update_passport_btn').attr('disabled', false);
$('#update_passport_btn').text('Submit');
}
});
$('#update_passport_btn').attr('disabled', false);
$('#update_passport_btn').text('Submit');
}
});
});

View File

@@ -6,7 +6,7 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
name: {
required: true
},
description: {
state_xid: {
required: true,
},
rest_id: {
@@ -18,7 +18,7 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
image: {
required: true,
},
exclusion: {
phone_number: {
required: true,
},
latitude: {
@@ -50,13 +50,33 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
try_on_4: {
required: true,
},
timeHours: {
required: true,
number: true,
min: 1
},
maxNumbDay: {
required: true,
number: true,
min: 1
},
maxNumbWeek: {
required: true,
number: true,
min: 1
},
maxNumbMonth: {
required: true,
number: true,
min: 1
}
},
messages: {
name: {
required: "Enter restaurant Name",
},
description: {
required: "Enter Description",
state_xid: {
required: "Please Select state",
},
rest_id: {
required: "Enter restaurant Id",
@@ -67,8 +87,8 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
image: {
required: "Please insert image",
},
exclusion: {
required: "Please enter exclusion",
phone_number: {
required: "Please enter phone number",
},
latitude: {
required: "Please enter latitude",
@@ -93,6 +113,26 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
try_on_4: {
required: "Please enter this field",
},
timeHours: {
required: "Please enter the time in hours between redeeming two cocktails",
number: "Time must be a number",
min: "Time must be greater than 0"
},
maxNumbDay: {
required: "Please enter the maximum number of cocktails per day",
number: "Value must be a number",
min: "Value must be greater than 0"
},
maxNumbWeek: {
required: "Please enter the maximum number of cocktails per week",
number: "Value must be a number",
min: "Value must be greater than 0"
},
maxNumbMonth: {
required: "Please enter the maximum number of cocktails per month",
number: "Value must be a number",
min: "Value must be greater than 0"
}
},
errorClass: 'error-message',
submitHandler: function (form) {
@@ -144,3 +184,4 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
});
});

View File

@@ -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) {
// }
// });
// })

View File

@@ -0,0 +1,91 @@
// $(document).ready(function() {
// var quillTitle = new Quill('#rules-quill-edit-title', {
// theme: 'snow'
// });
// // var quillMessage = new Quill('#rules-quill-edit-message', {
// // theme: 'snow'
// // });
// var storedTitle = document.getElementById('stored-title-message').value;
// quillTitle.clipboard.dangerouslyPasteHTML(storedTitle);
// // var storedMessage = document.getElementById('stored-message-message').value;
// // quillMessage.clipboard.dangerouslyPasteHTML(storedMessage);
// $('#update_rules').on("click", function(e) {
// e.preventDefault();
// $('#rules_form').validate({
// ignore: [],
// debug: false,
// rules: {
// article_des_title: {
// required: true,
// minlength: 10,
// },
// article_des_message: {
// required: true,
// minlength: 10,
// }
// },
// messages: {
// article_des_title: {
// required: "Please Enter Rules Title",
// minlength: "Please Enter Rules Title"
// },
// article_des_message: {
// required: "Please Enter Rules Message",
// minlength: "Please Enter Rules Message"
// }
// },
// errorClass: 'error-message',
// submitHandler: function(form) {
// var article_des_title = quillTitle.root.innerHTML;
// var article_des_message = quillMessage.root.innerHTML;
// if (article_des_title.trim() === '<p><br></p>' || article_des_message.trim() === '<p><br></p>') {
// toastr.error("Please Enter Rules");
// return false;
// }
// let base_url = url_path;
// var rule_id = document.querySelector('input[name="rule_id"]').value;
// var formData = new FormData(form);
// formData.append('article_des_title', article_des_title);
// formData.append('article_des_message', article_des_message);
// $.ajaxSetup({
// headers: {
// "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
// },
// });
// $.ajax({
// url: base_url + '/update_rules',
// type: 'POST',
// data: formData,
// processData: false,
// contentType: false,
// success: function(response) {
// if (response.status == 200) {
// toastr.success('Rules Data Updated Successfully');
// setTimeout(function() {
// window.location.href = base_url + "/manage_rules";
// }, 1000);
// } else {
// toastr.error("Something went wrong");
// }
// },
// error: function(xhr, textStatus, errorThrown) {
// console.error(xhr.responseText);
// toastr.error("An error occurred while updating the rules");
// }
// });
// }
// });
// $('#rules_form').submit();
// });
// });

View File

@@ -11,6 +11,11 @@ $(document).on("click", "#add_sub_admin_form_btn", function (e) {
required: true,
lettersOnly: true
},
sub_admin_lname: {
required: true,
lettersOnly: true
},
sub_admin_email: {
required: true,
@@ -26,18 +31,22 @@ $(document).on("click", "#add_sub_admin_form_btn", function (e) {
},
messages: {
sub_admin_name: {
required: 'Please enter this filed',
required: 'Please enter this field',
},
sub_admin_lname: {
required: 'Please enter this field',
},
sub_admin_email: {
required: 'Please enter this filed',
required: 'Please enter this field',
email: 'Please enter a valid email address'
},
password: {
required: 'Please enter this filed'
required: 'Please enter this field'
},
"module_id[]":{
required: 'Please enter this filed'
required: 'Please enter this field'
}
},
errorClass: 'error-message',

View File

@@ -1,4 +1,5 @@
$('#update_admin_btn').on("click", function (e) {
// alert('sdhjgf');
$('#update_sub_admin').validate({
ignore: [],
debug: false,
@@ -6,16 +7,23 @@ $('#update_admin_btn').on("click", function (e) {
sub_admin_name: {
required: true
},
sub_admin_lname: {
required: true,
},
sub_admin_email: {
required: true
}
},
messages: {
sub_admin_name: {
required: 'Please enter this filed'
required: 'Please enter this field'
},
ssub_admin_lname: {
required: 'Please enter this field'
},
sub_admin_email: {
required: 'Please enter this filed'
required: 'Please enter this field'
}
},
errorClass: 'error-message',

View File

@@ -12,9 +12,9 @@ return [
| these language lines according to your application's requirements.
|
*/
'logout'=>'Your account has been logged out successfully.',
'try_resend_otp'=>'You can resend OTP only after a 2-minutes interval',
'otp_already_used'=>'OTP has been used already .',
'logout' => 'Your account has been logged out successfully.',
'try_resend_otp' => 'You can resend OTP only after a 2-minutes interval',
'otp_already_used' => 'OTP has been used already .',
'failed' => 'These credentials do not match our records.',
'email' => 'Email not found.',
'password' => 'The provided password is incorrect.',
@@ -25,7 +25,7 @@ return [
'something_went_wrong' => 'Something went wrong.',
'number_blocked' => 'Your number is blocked for next 24 hours.',
'otp_sent_successfully' => 'OTP sent successfully.',
'otp_resend_sent_successfully'=>'OTP resend Successfully',
'otp_resend_sent_successfully' => 'OTP resend Successfully',
'failed_otp' => 'OTP Failed.',
'otp_expired' => 'OTP expired.',
'invalid_otp' => 'Invalid OTP.',
@@ -107,5 +107,8 @@ return [
'restaurant_already_favourite' => 'restaurant already in favourite list',
'restaurant_redeem' => 'Restaurant redeem successfully',
'restaurant_already_redeemed' => 'Restaurant is already redeemed',
'invalid_referral_code' => 'The provided referral code is invalid.',
'limitation_over' => 'The redemption limit for this referral code has been reached.',
'already_used_code' => 'This referral code has already been used.',
];

View File

@@ -12,18 +12,18 @@ return [
| these language lines according to your application's requirements.
|
*/
'payment_intent_created'=>'Payment Intent Created Successfully',
'payment_intent_created' => 'Payment Intent Created Successfully',
'data_fetched_successfully' => 'Data Fetched Successfully.',
'otp_sent_successfully' => 'OTP sent successfully.',
'data_not_found' => 'Data not found.',
'password_reset' => 'Password Reset Successfully.',
'reply_sent' =>'Reply Send Successfully.',
'reply_sent' => 'Reply Send Successfully.',
'delete' => 'Data Deleted Successfully.',
'update_data' => 'Data Updated Successfully.',
'save_data' => 'Data Saved Successfully.',
'data_already_saved' => 'Data has been saved.',
'change_status' => 'Published.',
'inactive' =>'Unpublished.',
'inactive' => 'Unpublished.',
'validation' => 'Validation Failed. ',
'update_status_active' => 'Status Activate successfully.',
'update_status_inactive' => 'Status Deactivate successfully.',
@@ -31,7 +31,8 @@ return [
'date_check' => 'Date must be greater than today date',
'redeem_voucher' => 'Voucher redeemed successfully.',
'sent_mail' => 'Mail sent successfully',
'authentic_success' => 'Authentication successful',
'authentic_success' => 'Authentication Successful',
'confirmed_password' => 'please confirm your passsword',
'redeemed_successfully' => 'Referral code redeemed successfully.',
];

File diff suppressed because it is too large Load Diff

View File

@@ -100,59 +100,39 @@
</div>
</a>
</li>
@if (Auth::guard('admin')->user()->getPermissionGranted(Auth::guard('admin')->user()->id, 'manage-users'))
<button class="dropdown-btn-users mb-1 active">
<div class="icons d-flex align-items-center justify-content-start w-100">
<img src="{{ asset('public/assets/img/Group 57904.svg') }}" />
<span class="text-1">Manage Users</span>
</div>
<i class="fa fa-angle-down mr-3" aria-hidden="true"></i>
</button>
<button class="dropdown-btn-users mb-1">
<div class="icons d-flex align-items-center justify-content-start w-100">
<img src="{{ asset('public/assets/img/Group 57904.svg') }}" />
<span class="text-1">Manage Users</span>
<div class="dropdown-container"
style="{{ $currentPage == 'manage-customer' || $currentPage == 'manage-restaurant_app' || $currentPage == 'sub-admins' ? 'display: block;' : 'display: none;' }}">
<ul class="random_cl">
<li class="tooltip-element {{ $currentPage == 'manage-customer' ? 'active' : '' }}"
data-tooltip="1">
<a href="{{ route('manage.customer') }}" data-active="1">Customer App
</a>
</li>
<li class="tooltip-element {{ $currentPage == 'manage-restaurant_app' ? 'active' : '' }}"
data-tooltip="1">
<a href="{{ route('restraunt_users') }}" data-active="1">Restaurant App
</a>
</li>
<li class="tooltip-element {{ $currentPage == 'sub-admins' ? 'active' : '' }}"
data-tooltip="1">
<a href="{{ route('manage.subAdmin') }}" data-active="1">Sub Admins
</a>
</li>
</ul>
</div>
<i class="fa fa-angle-down mr-3" aria-hidden="true"></i>
</button>
<div class="dropdown-container">
<ul>
<li class="tooltip-element <?php
if ($currentPage == 'manage-patient') {
echo 'active';
}
?>" data-tooltip="1">
<a href="{{ route('manage.customer') }}" data-active="1">
<div class="icons">
<img src="{{ asset('public/assets/img/single-user.svg') }}" />
<span class="text">Customer App</span>
</div>
</a>
</li>
<li class="tooltip-element <?php
if ($currentPage == 'manage-restaurant_app') {
echo 'active';
}
?>" data-tooltip="1">
<a href="{{ route('restraunt_users') }}" data-active="1">
<div class="icons">
<img src="{{ asset('public/assets/img/restraunt.svg') }}" />
<span class="text">Restaurant App</span>
</div>
</a>
</li>
<li class="tooltip-element <?php
if ($currentPage == 'sub-admins') {
echo 'active';
}
?>" data-tooltip="1">
<a href="{{ route('manage.subAdmin') }}" data-active="1">
<div class="icons">
<img src="{{ asset('public/assets/img/Group 57906.svg') }}">
<span class=" text">Sub Admins</span>
</div>
</a>
</li>
</ul>
</div>
@endif
{{-- <li class="tooltip-element <?php
@@ -167,25 +147,25 @@
</div>
</a>
</li> --}}
@if (Auth::guard('admin')->user()->getPermissionGranted(Auth::guard('admin')->user()->id, 'manage-restaurant'))
<li class="tooltip-element <?php
if ($currentPage == 'manage-restaurant') {
echo 'active';
}
?>" data-tooltip="3">
<a href="{{ route('manage.restaurants') }}" data-active="3">
<div class="icons">
<img src="{{ asset('public/assets/img/coupon 1.svg') }}" />
<span class="text">Manage Restaurant</span>
</div>
</a>
</li>
<li class="tooltip-element <?php
if ($currentPage == 'manage-vouchers') {
echo 'active';
}
?>" data-tooltip="3">
<a href="{{ route('manage.restaurants') }}" data-active="3">
<div class="icons">
<img src="{{ asset('public/assets/img/coupon 1.svg') }}" />
<span class="text">Manage Restaurant</span>
</div>
</a>
</li>
{{-- <li class="tooltip-element <?php
if ($currentPage == 'manage-vouchers') {
echo 'active';
}
?>" data-tooltip="3">
{{-- <li class="tooltip-element <?php
if ($currentPage == 'manage-vouchers') {
echo 'active';
}
?>" data-tooltip="3">
<a href="{{ route('manage.voucher') }}" data-active="3">
<div class="icons">
<img src="{{ asset('public/assets/img/fluent-mdl2_coupon.svg') }}" >
@@ -193,19 +173,36 @@
</div>
</a>
</li> --}}
@endif
@if (Auth::guard('admin')->user()->getPermissionGranted(Auth::guard('admin')->user()->id, 'manage-contact-us'))
<li class="tooltip-element <?php
if ($currentPage == 'manage-contact-us') {
echo 'active';
}
?>" data-tooltip="4">
<a href="{{ route('manage.contact') }}" data-active="4">
<div class="icons">
<img src="{{ asset('public/assets/img/call(1) 3.svg') }}" />
<span class="text">Manage Contact Us</span>
</div>
</a>
</li>
@endif
<li class="tooltip-element <?php
if ($currentPage == 'manage-contact') {
echo 'active';
}
?>" data-tooltip="4">
<a href="{{ route('manage.contact') }}" data-active="4">
<div class="icons">
<img src="{{ asset('public/assets/img/call(1) 3.svg') }}" />
<span class="text">Manage Contact Us</span>
</div>
</a>
</li>
@if (Auth::guard('admin')->user()->getPermissionGranted(Auth::guard('admin')->user()->id, 'manage-state'))
<li class="tooltip-element <?php
if ($currentPage == 'manage-location') {
echo 'active';
}
?>" data-tooltip="4">
<a href="{{ route('manage_location') }}" data-active="4">
<div class="icons">
<img src="{{ asset('public/assets/img/location.png') }}" />
<span class="text">Manage States</span>
</div>
</a>
</li>
@endif
@@ -300,58 +297,79 @@
</ul>
</div> -->
@if (Auth::guard('admin')->user()->getPermissionGranted(Auth::guard('admin')->user()->id, 'manage-cms'))
<li class="tooltip-element <?php
if ($currentPage == 'manage-cms') {
echo 'active';
}
?>" data-tooltip="7">
<a href="{{ route('manage.cms') }}" data-active="7">
<div class="icons">
<img src="{{ asset('public/assets/img/article-line.svg') }}" />
<span class="text">Manage CMS</span>
</div>
</a>
</li>
@endif
@if (Auth::guard('admin')->user()->getPermissionGranted(Auth::guard('admin')->user()->id, 'manage-reports-analysis'))
<li class="tooltip-element <?php
if ($currentPage == 'manage-reports') {
echo 'active';
}
?>" data-tooltip="5">
<a href="{{ route('manage.reports') }}" data-active="5">
<div class="icons">
<img src="{{ asset('public/assets/img/admin 2.svg') }}" />
<span class="text">Manage Reports</span>
</div>
</a>
</li>
@endif
<li class="tooltip-element <?php
if ($currentPage == 'manage-cms') {
echo 'active';
}
?>" data-tooltip="7">
<a href="{{ route('manage.cms') }}" data-active="7">
<div class="icons">
<img src="{{ asset('public/assets/img/article-line.svg') }}" />
<span class="text">Manage CMS</span>
</div>
</a>
</li>
@if (Auth::guard('admin')->user()->getPermissionGranted(Auth::guard('admin')->user()->id, 'manage-feedback'))
<li class="tooltip-element <?php
if ($currentPage == 'manage-feedback') {
echo 'active';
}
?>" data-tooltip="6">
<a href="{{ route('manage.feedback') }}" data-active="6">
<div class="icons">
<img src="{{ asset('public/assets/img/Group 51242.svg') }}" />
<span class="text">Manage Feedback</span>
</div>
</a>
</li>
@endif
<li class="tooltip-element <?php
if ($currentPage == 'manage-reports') {
echo 'active';
}
?>" data-tooltip="5">
<a href="{{ route('manage.reports') }}" data-active="5">
<div class="icons">
<img src="{{ asset('public/assets/img/admin 2.svg') }}" />
<span class="text">Manage Reports</span>
</div>
</a>
</li>
@if (Auth::guard('admin')->user()->getPermissionGranted(Auth::guard('admin')->user()->id, 'manage-rules'))
<li class="tooltip-element <?php
if ($currentPage == 'manage-rules') {
echo 'active';
}
?>" data-tooltip="6">
<a href="{{ route('manage_rules') }}" data-active="6">
<div class="icons">
<img src="{{ asset('public/assets/img/Group.svg') }}" />
<span class="text">Manage Rules</span>
</div>
</a>
</li>
@endif
<li class="tooltip-element <?php
if ($currentPage == 'manage-feedback') {
echo 'active';
}
?>" data-tooltip="6">
<a href="{{ route('manage.feedback') }}" data-active="6">
<div class="icons">
<img src="{{ asset('public/assets/img/Group 51242.svg') }}" />
<span class="text">Manage Feedback</span>
</div>
</a>
</li>
<li class="tooltip-element <?php
if ($currentPage == 'manage-notification') {
echo 'active';
}
?>" data-tooltip="6">
<a href="{{ route('manage.notification') }}" data-active="6">
<div class="icons">
<img src="{{ asset('public/assets/img/Vector(1).svg') }}" />
<span class="text">Manage Notification</span>
</div>
</a>
</li>
@if (Auth::guard('admin')->user()->getPermissionGranted(Auth::guard('admin')->user()->id, 'manage-notification'))
<li class="tooltip-element <?php
if ($currentPage == 'manage-notification') {
echo 'active';
}
?>" data-tooltip="6">
<a href="{{ route('manage.notification') }}" data-active="6">
<div class="icons">
<img src="{{ asset('public/assets/img/Vector_31.svg') }}" />
<span class="text">Manage Notification</span>
</div>
</a>
</li>
@endif
<!-- <li class="tooltip-element <?php
@@ -428,3 +446,11 @@
</div>
@include('Admin.footer')
<script>
$(document).ready(function() {
$('#manageUsersButton').click(function() {
$('#usersDropdownContent').toggle(); // Toggle dropdown content visibility
$('#arrowIcon').toggleClass('fa-angle-down fa-angle-up'); // Toggle arrow icon class
});
});
</script>

View File

@@ -69,7 +69,7 @@ $(document).on("click", "#forgot_password_btn", function (e) {
console.log(response);
if (response.status_code == 200) {
form.reset();
toastr.success('Otp send it your mail id please check');
toastr.success('An OTP has been sent to your email address');
setTimeout(function() {
window.location.href = base_url + "/otp";
}, 2000);

View File

@@ -52,7 +52,11 @@ $(document).on('click', '#otp_verify_button', function(e) {
var otp = $('.otp').map(function() {
return this.value;
}).get().join('');
if (otp === '') {
toastr.error('Please enter OTP');
return;
}
// Send AJAX request for OTP verification
$.ajax({
url: base_url + '/otp_verify',

View File

@@ -1,6 +1,62 @@
@extends('Admin.layouts.app_login')
@section('title', 'Cheers To Season - Password Reset')
@section('content')
<style>
/* Target the label element with the id 'confirm_password-error' and class 'error' */
label#error.confirm_password-error {
color: red;
/* Sets the text color to red */
font-weight: bold;
/* Optional: Makes the text bold */
/* You can add more styles as needed */
}
/* Style for the eye icons */
.fa-eye,
.fa-eye-slash {
cursor: pointer;
position: relative;
top: 2px;
/* Adjust vertical alignment as needed */
}
/* Style for the eye icon when it's not showing the password */
.fa-eye-slash {
color: #777;
/* Adjust color as needed */
}
/* Transition effect for smooth icon change */
.fa-eye,
.fa-eye-slash {
transition: color 0.3s ease;
}
/* Style for the eye icons */
.fa-eye,
.fa-eye-slash {
cursor: pointer;
position: absolute;
right: 10px;
/* Adjust horizontal alignment as needed */
top: 50%;
transform: translateY(-50%);
z-index: 1;
/* Ensure the icon is above the input */
}
/* Style for the eye icon when it's not showing the password */
.fa-eye-slash {
color: #777;
/* Adjust color as needed */
}
/* Transition effect for smooth icon change */
.fa-eye,
.fa-eye-slash {
transition: color 0.3s ease;
}
</style>
<div class="row w-100" style="height: 100vh;">
<div class=" col-md-6 m-auto h-100 d-flex flex-column align-itms-center justify-content-center"
style="background-color: #05244D;">
@@ -15,18 +71,36 @@
<h3 class="text-start font-weight-bold mb-3 text-white">RESET PASSWORD</h3>
<form id="password_reset_form">
<div class="col-md-12">
<!-- <div class="mb-3 input-parent">
<i class="fa fa-lock" aria-hidden="true"></i>
<input type="hidden" id="admin_otp_id" name="reset_id" value="{{ session('admin_data.principal_xid') }}">
<input type="password" class="form-control" name="password" placeholder="Password">
</div> -->
<div class="mb-3 input-parent">
<i class="fa fa-lock" aria-hidden="true"></i>
<input type="hidden" id="admin_otp_id" name="reset_id"
value="{{ session('admin_data.principal_xid') }}">
<input type="password" class="form-control" name="password" placeholder="Password">
<input type="password" class="form-control" name="password" id="password"
placeholder="Password">
<i class="fa fa-eye-slash" aria-hidden="true" id="togglePassword"></i>
</div>
</div>
<!-- <div class="col-md-12">
<div class="mb-3 input-parent">
<i class="fa fa-lock" aria-hidden="true"></i>
<input type="password" class="form-control" name="confirm_password" id="confirm_password" placeholder="Confirm Password">
</div>
</div> -->
<div class="col-md-12">
<div class="mb-3 input-parent">
<i class="fa fa-lock" aria-hidden="true"></i>
<input type="password" class="form-control" name="confirm_password" id="password"
<input type="password" class="form-control" name="confirm_password" id="confirm_password"
placeholder="Confirm Password">
<i class="fa fa-eye-slash" aria-hidden="true" id="toggleConfirmPassword"></i>
</div>
</div>
<div class="col-md-12">
@@ -35,6 +109,11 @@
</div>
</div>
</form>
</div>
</div>
</div>
@@ -44,99 +123,119 @@
@section('scripts')
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script>
<script>
$(document).ready(function() {
// Password visibility toggle
$('#passwordToggle').click(function() {
var passwordInput = $('#password');
var eyeIcon = $('#passwordToggle');
<script src="{{ asset('public/assets/js/admin/auth/login.js') }}"></script>
if (passwordInput.attr('type') === 'password') {
passwordInput.attr('type', 'text');
eyeIcon.removeClass('fa-eye-slash').addClass('fa-eye');
<script>
document.getElementById('togglePassword').addEventListener('click', function() {
var passwordField = document.getElementById('password');
var icon = document.getElementById('togglePassword');
if (passwordField.type === 'password') {
passwordField.type = 'text';
icon.classList.remove('fa-eye-slash');
icon.classList.add('fa-eye');
} else {
passwordInput.attr('type', 'password');
eyeIcon.removeClass('fa-eye').addClass('fa-eye-slash');
passwordField.type = 'password';
icon.classList.remove('fa-eye');
icon.classList.add('fa-eye-slash');
}
});
document.getElementById('toggleConfirmPassword').addEventListener('click', function() {
var confirmPasswordField = document.getElementById('confirm_password');
var icon = document.getElementById('toggleConfirmPassword');
if (confirmPasswordField.type === 'password') {
confirmPasswordField.type = 'text';
icon.classList.remove('fa-eye-slash');
icon.classList.add('fa-eye');
} else {
confirmPasswordField.type = 'password';
icon.classList.remove('fa-eye');
icon.classList.add('fa-eye-slash');
}
});
</script>
<script>
// Form validation and submission
$('#password_reset_form').validate({
rules: {
password: {
required: true,
minlength: 8
},
confirm_password: {
required: true,
equalTo: "#password"
},
},
messages: {
password: {
required: "Please enter a password.",
minlength: "The password field must be at least 8 characters."
},
confirm_password: {
required: "Please Confirm Your Password",
equalTo: "Your Password Do Not Match"
},
},
invalidHandler: function(event, validator) {
var errors = validator.errorList;
$.each(errors, function(index, error) {
toastr.error(error.message);
});
},
submitHandler: function(form) {
let base_url = url_path;
var formData = new FormData(form);
// $('#password_reset_form').validate({
// rules: {
// password: {
// required: true,
// minlength: 8
// },
// confirm_password: {
// required: true,
// equalTo: "#password"
// },
// },
// messages: {
// password: {
// required: "Please enter a password.",
// minlength: "The password field must be at least 8 characters."
// },
// confirm_password: {
// required: "Please Confirm Your Password",
// equalTo: "Your Password Do Not Match"
// },
// },
// // invalidHandler: function(event, validator) {
// // var errors = validator.errorList;
// // $.each(errors, function(index, error) {
// // toastr.error(error.message);
// // });
// // },
// submitHandler: function(form) {
// let base_url = url_path;
// var formData = new FormData(form);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
// $.ajaxSetup({
// headers: {
// "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
// },
// });
$('#password_reset').prop('disabled', true).text('Processing...');
// $('#password_reset').prop('disabled', true).text('Processing...');
// $.ajax({
// url: base_url + '/password_update',
// type: 'POST',
// data: formData,
// processData: false,
// contentType: false,
// success: function(response) {
// if (response.status_code == 200) {
// toastr.success(response.message);
// window.location.href = base_url + "/";
// } else if (response.status_code == 404) {
// toastr.error(response.message);
// form.reset();
// }
// $('#password_reset').prop('disabled', false).text('Sign In');
// },
// error: function(xhr) {
// if (xhr.status === 422) {
// var errors = xhr.responseJSON.message;
// $.each(errors, function(index, value) {
// toastr.error(value);
// });
// } else {
// toastr.error('An unexpected error occurred. Please try again.');
// }
// $('#password_reset').prop('disabled', false).text('Sign In');
// }
// });
// }
// });
// $(document).on("click", "#password_reset", function(e) {
// e.preventDefault();
// $('#password_reset_form').submit();
// });
// });
</script>
$.ajax({
url: base_url + '/password_update',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.status_code == 200) {
toastr.success(response.message);
window.location.href = base_url + "/";
} else if (response.status_code == 401) {
toastr.error(response.message);
form.reset();
}
$('#password_reset').prop('disabled', false).text('Sign In');
},
error: function(xhr) {
if (xhr.status === 422) {
var errors = xhr.responseJSON.message;
$.each(errors, function(index, value) {
toastr.error(value);
});
} else {
toastr.error('An unexpected error occurred. Please try again.');
}
$('#password_reset').prop('disabled', false).text('Sign In');
}
});
}
});
$(document).on("click", "#password_reset", function(e) {
e.preventDefault();
$('#password_reset_form').submit();
});
});
</script>

View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Contact Query Reply</title>
</head>
<body>
<p>Hello {{ $query->name }},</p>
<p>Your contact query has been answered:</p>
<p>{{ $query->reply_message }}</p>
<p>Thank you for reaching out!</p>
</body>
</html>

View File

@@ -16,7 +16,7 @@
<div class="col-md-12 left d-flex align-items-center justify-content-between"
style="gap: 15px;">
<h6 class="card-title pl-2">Customer About Us</h6>
<a class="view-details-btn mr-2" href="{{ url('/about_us_edit/'. $view_about [0]['id']) }}">
<a class="view-details-btn mr-2" href="{{ url('/about_us_edit/'. $view_about[0]['id']) }}">
<span>Edit Details</span>
</a>
</div>

View File

@@ -26,15 +26,15 @@
<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">
<form id="privacy_policy_form">
<form id="about_us_form">
<div class="row">
<div class="col-md-12">
<input type="hidden" name="privacy_custom_id" value="{{ $edit_privacy_policy['id'] }}">
<div id="terms-quill-edit" value="{{ $edit_privacy_policy['description'] }}" name="privacy_policy" class="editor-quill" style="height: 300px;">{!! $edit_privacy_policy['description'] !!}</div>
<input type="hidden" id="privacy_policy" name="privacy_policy" value="{{ $edit_privacy_policy['description'] }}" />
<input type="hidden" name="about_custom_id" value="{{ $edit_aboutUs_cust['id'] }}">
<div id="terms-quill-edit" value="{{ $edit_aboutUs_cust['description'] }}" name="about_us" class="editor-quill" style="height: 300px;">{!! $edit_aboutUs_cust['description'] !!}</div>
<input type="hidden" id="about_us" name="about_us" value="{{ $edit_aboutUs_cust['description'] }}" />
</div>
<div class="col-md-12">
<button type="submit" id="update_privacy_policy" class="download-btn-custom mt-3 custom-width-10" >
<button type="submit" id="update_about_us" class="download-btn-custom mt-3 custom-width-10" >
<span>Update</span>
</button>
</div>
@@ -69,5 +69,57 @@
</script>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script>
<script src="{{ asset('public/assets/js/admin/manage_cms/manage_privacy_policy/privacy_policy.js')}}"></script>
<script>
$('#update_about_us').on("click", function (e) {
$.validator.addMethod("quillNotEmpty", function(value, element) {
var quill = new Quill('#terms-quill-edit');
return quill.getText().trim().length > 0;
}, "Please enter about us ");
$('#about_us_form').validate({
ignore: [],
debug: false,
rules: {
about_us: {
required: true,
quillNotEmpty: true
}
},
messages: {
about_us: {
required: "Please Enter about us for customer"
}
},
errorClass: 'error-message',
submitHandler: function (form) {
var quillContent = quill.root.innerHTML;
$('#about_us').val(quillContent);base_url = url_path;
var formData = new FormData(form);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/aboutus_cust_update',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (response) {
if (response.status == 200) {
toastr.success('About Us Customer Data Updated Successfully');
setTimeout(function () {
window.location.href = base_url + "/manage-about-us";
}, 1000);
} else {
toastr.error("Something went wrong");
}
},
});
}
});
});
</script>
@endsection

View File

@@ -24,7 +24,7 @@
<div class="top-tabel">
<div class="row">
<div class="col-md-12 left d-flex align-items-center justify-content-between" style="gap: 15px;">
<a class="d-flex align-items-center justify-content-center pl-2" href="">
<a class="d-flex align-items-center justify-content-center pl-2" href="{{route('manage.aboutUs')}}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
<h6 class="card-title p-0">Edit Details of Resturant</h6>
</a>
@@ -38,15 +38,15 @@
<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">
<form id="privacy_policy_form">
<form id="aboutus_rest_form">
<div class="row">
<div class="col-md-12">
<input type="hidden" name="" value="{{ $edit_about_rest['id'] }}">
<div id="terms-quill-edit" value="{{$edit_about_rest['description'] }}" name="privacy_policy" class="editor-quill" style="height: 300px;">{!! $edit_about_rest['description'] !!}</div>
<input type="hidden" id="privacy_policy" name="privacy_policy" value="{{ $edit_about_rest['description'] }}" />
<input type="hidden" name="about_rest_id" value="{{ $edit_about_rest['id'] }}">
<div id="terms-quill-edit" value="{{$edit_about_rest['description'] }}" name="about_rest" id="about_rest" class="editor-quill" style="height: 300px;">{!! $edit_about_rest['description'] !!}</div>
<input type="hidden" id="about_rest" name="about_rest" value="{{ $edit_about_rest['description'] }}" />
</div>
<div class="col-md-12">
<button type="submit" id="" class="download-btn-custom mt-3 custom-width-10" >
<button type="submit" id="update_aboutUS_rest" class="download-btn-custom mt-3 custom-width-10" >
<span>Update</span>
</button>
</div>
@@ -65,7 +65,7 @@
@endsection
@section('section_script')
<script>
var quill = new Quill('#about-quill-edit', {
var quill = new Quill('#terms-quill-edit', {
theme: 'snow'
});
// Listen for changes and update the hidden input with the HTML content
@@ -77,4 +77,57 @@
</script>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script>
<script>
$('#update_aboutUS_rest').on("click", function (e) {
$.validator.addMethod("quillNotEmpty", function(value, element) {
var quill = new Quill('#terms-quill-edit');
return quill.getText().trim().length > 0;
}, "Please enter about us ");
$('#aboutus_rest_form').validate({
ignore: [],
debug: false,
rules: {
about_rest: {
required: true,
quillNotEmpty: true
}
},
messages: {
about_rest: {
required: "Please Enter about us for restaturant"
}
},
errorClass: 'error-message',
submitHandler: function (form) {
var quillContent = quill.root.innerHTML;
$('#about_rest').val(quillContent);base_url = url_path;
var formData = new FormData(form);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/aboutus_rest_update',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (response) {
if (response.status == 200) {
toastr.success('About Us Restaturant Data Updated Successfully');
setTimeout(function () {
window.location.href = base_url + "/manage-about-us";
}, 1000);
} else {
toastr.error("Something went wrong");
}
},
});
}
});
});
</script>
@endsection

View File

@@ -35,22 +35,17 @@ $currentPage = 'manage-faq';
}
</style>
<div class="layout-px-spacing">
<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="row">
<div class="col-md-4">
<h6 class="card-title">Manage FAQ</h6>
</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" style="overflow: auto;">
<table id="zero-config" class="table dt-table-hover" style="width:100%">
<thead class="text-center">
@@ -64,7 +59,7 @@ $currentPage = 'manage-faq';
<th class="no-content">Action</th>
</tr>
</thead>
<tbody class="text-center">
<tbody class="text-center" id="faq-tbody">
@foreach ($faq as $index => $faqs)
<tr>
<td class="text-start">{{ $index + 1 }}</td>
@@ -86,50 +81,6 @@ $currentPage = 'manage-faq';
{{ \Carbon\Carbon::parse($faqs['created_at'])->format('m/d/Y') }}
@endif
</td>
<!-- <td>
<div class="dropout">
<button class="more">
<span></span>
<span></span>
<span></span>
</button>
<ul>
<li>
<div class="switch-btn">
<input data-id="{{ $faqs['id'] }}"
{{ $faqs['is_active'] ? 'checked' : '' }} type="checkbox"
class="active_newsletter" id="switch{{ $faqs['id'] }}"
switch="bool" />
<label for="switch{{ $faqs['id'] }}" data-on-label="Active"
data-off-label="Expired"></label>
</div>
</li>
<li>
<a href="#" data-toggle="modal" data-target="#edit-faq-modal"
class="edit-faq-btn" data-faq-id="{{ $faqs['id'] }}"
data-faq-question="{{ $faqs['question'] }}"
data-faq-answer="{{ $faqs['answers'] }}"
data-faq-category="{{ $faqs['faq_category_id'] }}">
<img src="{{ asset('public/assets/img/edit.svg') }}" />
<span>Edit</span>
</a>
</li>
<li>
<a href="#" class="delete-faq-btn"
data-faq-id="{{ $faqs['id'] }}"
data-faq-question="{{ $faqs['question'] }}"
data-faq-answer="{{ $faqs['answers'] }}"
data-faq-category="{{ $faqs['faq_category_id'] }}">
<img src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a>
</li>
</ul>
</div>
</td> -->
<td>
<div class="action-buttons">
<!-- Active Switch Button -->
@@ -141,25 +92,15 @@ $currentPage = 'manage-faq';
<!-- Edit Button -->
<a href="#" data-toggle="modal" data-target="#edit-faq-modal" class="edit-faq-btn" data-faq-id="{{ $faqs['id'] }}" data-faq-question="{{ $faqs['question'] }}" data-faq-answer="{{ $faqs['answers'] }}" data-faq-category="{{ $faqs['faq_category_id'] }}">
<img src="{{ asset('public/assets/img/edit.svg') }}" />
</a>
<!-- Delete Button -->
<!-- <a href="#" class="delete-faq-btn" data-faq-id="{{ $faqs['id'] }}" data-faq-question="{{ $faqs['question'] }}" data-faq-answer="{{ $faqs['answers'] }}" data-faq-category="{{ $faqs['faq_category_id'] }}">
<img src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a> -->
<a href="#" class="delete_about" data-faq-id="{{ $faqs['id'] }}" data-toggle="modal" data-target="#delete-modal">
<img src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
</a>
<input type="hidden" id="delete_about_id">
</div>
</td>
</tr>
@endforeach
</tbody>
@@ -169,89 +110,86 @@ $currentPage = 'manage-faq';
</div>
</div>
</div>
<div class="modal fade" id="add_faq_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header p-0">
<h5 class="modal-title">Add FAQ</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="row">
<form id="store_faq">
@csrf
<div class="col-md-12 mb-3">
<label for="add-faq-question">Question</label>
<input id="add_faq_question" name="question" class="form-control" type="text">
</div>
<div class="col-md-12">
<label for="add-faq-answer">Answer</label>
<textarea id="add_faq_answer" name="answer" rows="5" cols="50" class="form-control"></textarea>
</div>
<div class="col-md-12">
<label for="add-faq-category">Select Category</label>
<select class="form-control input_class w-30 mr-2" name="faq_categ" id="add_faq_category">
<option value="">Select</option>
<option value="1">Customer</option>
<option value="2">Restaurant</option>
</select>
</div>
<button type="submit" id="submit_faq" class="download-btn-custom mt-4 mx-auto w-25">
<span>Save</span>
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="edit-faq-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header p-0">
<h5 class="modal-title">Edit FAQ</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="row">
<form id="edit_faq">
<div class="col-md-12 mb-3">
@csrf
<label for="">Question</label>
<input class="form-control" name="question" type="text"
value="{{ $faqs['question'] }}" id="edit-question">
</div>
<input type="hidden" value="{{ $faqs['id'] }}">
<div class="col-md-12">
<label for="">Answer</label>
<textarea name="answer" id="edit-answer" rows="5" cols="50" class="form-control">{{ $faqs['answers'] }}</textarea>
</div>
<div class="col-md-12">
<label for="add-faq-category">Select Category</label>
<select class="form-control w-30 mr-2 input_class" name="faq_categ" id="add_faq_category">
<option value="">Select</option>
<option value="1" {{ $faqs['faq_category_id'] == 1 ? 'selected' : '' }}>Customer
</option>
<option value="2" {{ $faqs['faq_category_id'] == 2 ? 'selected' : '' }}>
Restaurant</option>
</select>
</div>
<button type="submit" id="update_faq" class="download-btn-custom mt-4 mx-auto w-25">
<span>Save</span>
</button>
</form>
</div>
<div class="modal fade" id="add_faq_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header p-0">
<h5 class="modal-title">Add FAQ</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="row">
<form id="store_faq">
@csrf
<div class="col-md-12 mb-3">
<label for="add-faq-question">Question</label>
<input id="add_faq_question" name="question" class="form-control" type="text">
</div>
<div class="col-md-12">
<label for="add-faq-answer">Answer</label>
<textarea id="add_faq_answer" name="answer" rows="5" cols="50" class="form-control"></textarea>
</div>
<div class="col-md-12">
<label for="add-faq-category">Select Category</label>
<select class="form-control input_class w-30 mr-2" name="faq_categ" id="add_faq_category">
<option value="">Select</option>
<option value="1">Customer</option>
<option value="2">Restaurant</option>
</select>
</div>
<button type="submit" id="submit_faq" class="download-btn-custom mt-4 mx-auto w-25">
<span>Save</span>
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="edit-faq-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header p-0">
<h5 class="modal-title">Edit FAQ</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="row">
<form id="edit_faq">
<div class="col-md-12 mb-3">
@csrf
<label for="">Question</label>
<input class="form-control" name="question" type="text" id="edit-question">
</div>
<input type="hidden" id="edit-faq-id">
<div class="col-md-12">
<label for="">Answer</label>
<textarea name="answer" id="edit-answer" rows="5" cols="50" class="form-control"></textarea>
</div>
<div class="col-md-12">
<label for="add-faq-category">Select Category</label>
<select class="form-control w-30 mr-2 input_class" name="faq_categ" id="edit_faq_category">
<option value="">Select</option>
<option value="1">Customer</option>
<option value="2">Restaurant</option>
</select>
</div>
<button type="submit" id="update_faq" class="download-btn-custom mt-4 mx-auto w-25">
<span>Save</span>
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
@@ -262,31 +200,52 @@ $currentPage = 'manage-faq';
</div>
<div class="modal-body">
<input type="hidden" id="delete_about_id" name="about_id">
<!-- <p class="modal-text">Are you sure you want to<br>Delete </p> -->
<p class="modal-text">Are you sure you ? </p>
<!-- <h6>Are you sure want to delete this content</h6> -->
<div class="modal-btn d-flex ">
<p class="modal-text">Are you sure you ?</p>
<div class="modal-btn d-flex">
<a type="button" class="extra-btn" data-dismiss="modal">Cancel</a>
<a type="button" class="download-btn-custom delete_about_button" data-dismiss="modal">Delete</a>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('section_script')
<script src="{{ asset('public/assets/js/admin/manage_cms/manage_faq/main.js') }}"></script>
<script src="{{ asset('public/assets/js/admin/manage_cms/manage_faq/add_faq.js') }}"></script>
<script src="{{ asset('public/assets/js/admin/manage_cms/manage_faq/edit_faq.js') }}"></script>
<script>
$(document).ready(function() {
$(' <button><a class="extra-btn width-max-content" data-toggle="modal" data-target="#add_faq_modal" href="">Add</a></button>')
// Insert Add button
$('<button><a class="extra-btn width-max-content" data-toggle="modal" data-target="#add_faq_modal" href="">Add</a></button>')
.insertBefore("#zero-config_filter label");
// Insert Filter dropdown
$('<select id="filter" class="form-control"><option value="all">All</option><option value="1">Customer</option><option value="2">Restaurant</option></select>')
.insertBefore("#zero-config_filter label");
// Filter FAQ
$('#filter').on('change', function() {
var filterValue = $(this).val();
filterFAQs(filterValue);
});
function filterFAQs(filterValue) {
if (filterValue === "all") {
$("#faq-tbody tr").show();
} else {
$("#faq-tbody tr").each(function() {
var category = $(this).find('td:eq(3)').text().trim();
if ((filterValue == 1 && category === 'Customer') || (filterValue == 2 && category === 'Restaurant')) {
$(this).show();
} else {
$(this).hide();
}
});
}
}
});
</script>
@endsection

View File

@@ -1,103 +1,107 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage-news';
@endphp
@php
$currentPage = 'manage-news';
@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">
<h6 class="card-title">Manage News & Articles</h6>
</div>
<div class="col-md-8">
<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">
<h6 class="card-title">Manage News & Articles</h6>
</div>
<div class="col-md-8">
</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" style="overflow: auto;">
<table id="zero-config" class="table dt-table-hover news_letter_table" style="width:100%">
<thead class="text-center">
<th class="w-10px pe-2">
<div class="form-check form-check-sm form-check-custom form-check-solid me-3">
<input class="form-check-input" type="checkbox" data-kt-check="true" data-kt-check-target="#kt_table_users .form-check-input" value="1" />
</div>
</th>
<th class="text-start">Sr no</th>
<th class="text-start">Article Name</th>
<th class="text-start">Added Date </th>
<th class="">Image</th>
<th class="no-content">Action</th>
</tr>
</thead>
<tbody class="text-center">
@foreach ($news_article as $news_articles)
<tr>
<td>
<div class="form-check form-check-sm form-check-custom form-check-solid">
<input class="form-check-input" type="checkbox" value="1" />
</div>
</td>
<td class="text-start">{{$loop->iteration}}</td>
<td class="text-start">{{ $news_articles['name'] }}</td>
<td class="text-start">{{ \Carbon\Carbon::parse($news_articles['created_at'])->format('m/d/Y') }}</td>
<!-- <td><img src="../src/assets/img/video.png"></td> -->
<td><img src="{{ asset('storage/app/public/' . $news_articles['thumbnail_image']) }}" height="50px" width="50px"></td>
<td>
<div class="dropout">
<button class="more">
<span></span>
<span></span>
<span></span>
</button>
<ul>
<li>
<div class="switch-btn">
<input data-id="{{ $news_articles['id'] }}" {{ $news_articles['is_active'] ? 'checked' : '' }} type="checkbox" class="active_newsletter" id="switch{{ $news_articles['id'] }}" switch="bool" />
<label for="switch{{ $news_articles['id'] }}" data-on-label="Active" data-off-label="Expired"></label>
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
<div class="widget-content widget-content-area br-8 position-btn" style="overflow: auto;">
<table id="zero-config" class="table dt-table-hover news_letter_table" style="width:100%">
<thead class="text-center">
<!-- <th class="w-10px pe-2">
<div class="form-check form-check-sm form-check-custom form-check-solid me-3">
<input class="form-check-input" type="checkbox" data-kt-check="true" data-kt-check-target="#kt_table_users .form-check-input" value="1" />
</div>
</th> -->
<th class="text-start">Sr no</th>
<th class="text-start">Article Name</th>
<th class="text-start">Added Date </th>
<th class="">Image</th>
<th class="text-start">Category</th>
<th class="no-content">Action</th>
</tr>
</thead>
<tbody class="text-center">
@foreach ($news_article as $news_articles)
<tr>
<td class="text-start">{{ $loop->iteration }}</td>
<td class="text-start">{{ $news_articles['name'] }}</td>
<td class="text-start">
{{ \Carbon\Carbon::parse($news_articles['created_at'])->format('m/d/Y') }}</td>
<td><img src="{{ asset('storage/app/public/' . $news_articles['thumbnail_image']) }}"
height="50px" width="50px"></td>
<td class="text-start">
{{ $news_articles['category']['name'] }}</td>
<td>
<div class="dropout">
<button class="more">
<span></span>
<span></span>
<span></span>
</button>
<ul>
<li>
<div class="switch-btn">
<input data-id="{{ $news_articles['id'] }}"
{{ $news_articles['is_active'] ? 'checked' : '' }}
type="checkbox" class="active_newsletter"
id="switch{{ $news_articles['id'] }}" switch="bool" />
<label for="switch{{ $news_articles['id'] }}"
data-on-label="Active" data-off-label="Expired"></label>
</div>
</li>
<li>
<a href="{{ url('manage_edit_news/' . $news_articles['id']) }}">
<img src="{{ asset('public/assets/img/edit.svg') }}" />
<span>Edit</span>
</a>
</li>
<li>
<!-- <a href="" data-toggle="modal" data-target="#delete-modal">
<img src="{{ asset('assets/img/delete-recycle.svg') }}" />
</li>
<li>
<a href="{{ url('manage_edit_news/' . $news_articles['id']) }}">
<img src="{{ asset('public/assets/img/edit.svg') }}" />
<span>Edit</span>
</a>
</li>
<li>
<!-- <a href="" data-toggle="modal" data-target="#delete-modal">
<img src="{{ asset('assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a> -->
<a class="delete_news" data-id="{{ $news_articles['id'] }}"
data-toggle="modal" data-target="#delete-modal">
<img
src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a> -->
<a class="delete_news" data-id="{{ $news_articles['id'] }}" data-toggle="modal" data-target="#delete-modal">
<img src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a>
</li>
</ul>
</div>
</td>
</tr>
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
@@ -122,91 +126,90 @@ $currentPage = 'manage-news';
@section('section_script')
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": {
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
},
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
var manageAddNewsRoute = "{{ route('manage_add_news') }}";
</script>
<script>
// $(document).ready(function() {
// $('<button><a class="extra-btn width-max-content" href="{{ route('manage_add_news')}}">Add New</a ></button > ').insertBefore("#zero-config_filter label");
// });
// $('<button><a class="extra-btn width-max-content" href="' + manageAddNewsRoute + '">Add New </a></button>').insertBefore("#zero-config_filter label");
$(document).ready(function() {
$('<button><a class="extra-btn width-max-content" href="' + manageAddNewsRoute + '"> Add New </a></button>').insertBefore("#zero-config_filter label");
});
</script>
<script>
$(".news_letter_table").on("change", ".active_newsletter", function() {
let base_url = url_path;
var status = $(this).prop("checked") == true ? 1 : 0;
var program_id = $(this).data("id");
$.ajax({
type: "GET",
dataType: "json",
url: base_url + '/change-article-Status',
data: {
status: status,
program_id: program_id,
},
success: function(data) {
if (status == 1) {
toastr.options = {
"timeOut": 500
}
toastr.success("Status Activate successfully. !!");
} else {
toastr.error("Status Deactivate successfully. !!");
}
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": {
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
},
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
var manageAddNewsRoute = "{{ route('manage_add_news') }}";
</script>
<script>
// $(document).ready(function() {
// $('<button><a class="extra-btn width-max-content" href="{{ route('manage_add_news') }}">Add New</a ></button > ').insertBefore("#zero-config_filter label");
// });
// $('<button><a class="extra-btn width-max-content" href="' + manageAddNewsRoute + '">Add New </a></button>').insertBefore("#zero-config_filter label");
$(document).ready(function() {
$('<button><a class="extra-btn width-max-content" href="' + manageAddNewsRoute +
'"> Add New </a></button>').insertBefore("#zero-config_filter label");
});
</script>
<script>
$(".news_letter_table").on("change", ".active_newsletter", function() {
let base_url = url_path;
var status = $(this).prop("checked") == true ? 1 : 0;
var program_id = $(this).data("id");
$.ajax({
type: "GET",
dataType: "json",
url: base_url + '/change-article-Status',
data: {
status: status,
program_id: program_id,
},
success: function(data) {
if (status == 1) {
toastr.options = {
"timeOut": 500
}
toastr.success("Status Activate successfully. !!");
} else {
toastr.error("Status Deactivate successfully. !!");
}
},
});
});
</script>
<script>
$(document).on("click", ".delete_news", function() {
var delete_id = $(this).data('id');
$('#delete_news_id').val(delete_id);
});
});
</script>
<script>
$(document).on("click", ".delete_news", function () {
var delete_id = $(this).data('id');
$('#delete_news_id').val(delete_id);
});
$(document).on("click", ".delete_news_button", function (e) {
e.preventDefault();
let base_url = url_path;
var delete_id = $('#delete_news_id').val();
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
type: "DELETE",
url: base_url + "/delete_article/" + delete_id,
success: function (response) {
console.log(response);
toastr.success("Blog Deleted Successfully");
window.location.href = base_url + "/manage-new-articles";
}
});
});
$(document).on("click", ".delete_news_button", function(e) {
e.preventDefault();
let base_url = url_path;
var delete_id = $('#delete_news_id').val();
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
type: "DELETE",
url: base_url + "/delete_article/" + delete_id,
success: function(response) {
console.log(response);
toastr.success("Blog Deleted Successfully");
window.location.href = base_url + "/manage-new-articles";
}
});
});
</script>
@endsection

View File

@@ -1,137 +1,138 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage_cms';
@endphp
<style>
.error-message {
color: #FF0000;
}
@php
$currentPage = 'manage_cms';
@endphp
<style>
.error-message {
color: #FF0000;
}
form .error-message {
color: red;
/* Set your desired color here */
}
form .error-message {
color: red;
/* Set your desired color here */
}
form .input_class.error-message {
color: #0e1726;
}
</style>
form .input_class.error-message {
color: #0e1726;
}
</style>
<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">
<a class="d-flex align-items-center justify-content-center pl-2" href="{{ route('manage.Newarticles') }}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
<h6 class="card-title p-0">Add News & Articles </h6>
</a>
</div>
<div class="col-md-8">
</div>
</div>
<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">
<a class="d-flex align-items-center justify-content-center pl-2" href="{{ route('manage.Newarticles') }}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
<h6 class="card-title p-0">Add News & Articles </h6>
</a>
</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 h-10">
<div class="view-details Article">
<form id="add_blog_form" enctype="multipart/form-data">
<div class="col-md-8">
</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 h-10">
<div class="view-details Article">
<form id="add_blog_form" enctype="multipart/form-data">
@csrf
<div class="row">
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Article Name</label>
<input type="text" name="article_name" class="form-control input_class">
<div class="row">
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Article Name</label>
<input type="text" name="article_name" class="form-control input_class">
</div>
</div>
<!-- <div class="col-md-12">
<div class="form-group mt-3">
<label class="mr-2 mb-3" style="font-weight: 600;">Image Upload :</label>
<div class="multiple-file-upload">
<input type="file" class="filepond pan-frontside" accept="image/*" name="article_image" id="imageInputNormal" data-max-file-size="3MB">
<div id="imageInputPreviewNormal" style="width: 30%;">
<img src="" alt="Image Preview" style="width: 40%;">
</div>
</div>
</div>
<!-- <div class="col-md-6">
</div> -->
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Image Upload</label>
<input type="file" name="article_image" class="form-control input_class" id="selectImage">
<img id="preview" src="#" alt="your image" class="mt-3 " style="display:none;width:20%;"/>
</div>
</div> -->
<div class="col-md-12">
<div class="form-group mt-3">
<label class="mr-2 mb-3" style="font-weight: 600;">Image Upload </label>
<div class="multiple-file-upload">
<input type="file" class="filepond pan-frontside"
name="article_image" id="imageInputNormal" accept="image/*" data-max-file-size="3MB">
<div id="imageInputPreviewNormal" style="width: 30%;">
<img src="" alt="Image Preview" style="width: 40%;">
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Description</label>
<div id="news-quill-add" class="editor-quill" style="height: 100px;"></div>
<input type="hidden" id="article_des" name="article_des">
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Thumbnail Image:</label>
<input type="file" name="article_thmb" class="form-control input_class" accept="image/*" id="selectThumbnailImage">
<img id="previewthumbnailimage" src="#" alt="your image" class="mt-3 w-20" style="display:none;width:20%;"/>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="company-name" class="label">Select Category</label>
<select class="form-control input_class" id="company-name" name="category">
<option value="">Select Category</option>
@foreach ($news_categories as $news_category)
<option value="{{ $news_category['id'] }}">{{ $news_category['name'] }}
</option>
@endforeach
<!-- Add more options as needed -->
</select>
</div>
</div>
<div class="col-md-12">
<button type="submit" id="add_newsletter"
class="download-btn-custom mt-3 custom-width-10">
<span>Save</span>
</button>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Description</label>
<div id="news-quill-add" class="editor-quill" style="height: 100px;"></div>
<input type="hidden" id="article_des" name="article_des">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="company-name" class="label">Thumbnail Image:</label>
<input type="file" name="article_thmb" class="form-control input_class" id="selectThumbnailImage">
<div id="imagePreviewThumb" style="width: 30%;">
<img id="previewthumbnailimage" src="#" alt="Preview Image" class="mt-3 w-20" style="display:none; width:50%;" />
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="company-name" class="label">Select Category</label>
<select class="form-control input_class" id="company-name" name="category">
<option value="">Select Category</option>
@foreach ($news_categories as $news_category)
<option value="{{ $news_category['id'] }}">{{ $news_category['name'] }}
</option>
@endforeach
<!-- Add more options as needed -->
</select>
</div>
</div>
<div class="col-md-12">
<button type="submit" id="add_newsletter" class="download-btn-custom mt-3 custom-width-10">
<span>Save</span>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection
</div>
</div>
@endsection
@section('section_script')
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script src="{{ asset('public/assets/js/admin/manage_cms/manage_news/add_news.js') }}"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"oPaginate": {
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
},
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
@@ -141,100 +142,100 @@
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
$(document).ready(function () {
$(document).ready(function() {
$('<button><a class="extra-btn width-max-content" href="archive-manage-customers.php">View Archive List</a></button><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>Export</h3></div></div></a><div class="dropdown-menu position-absolute" aria-labelledby="actionDropdown"><div class="dropdown-item"><a href="#"><span>Download Overview</span></a></div><div class="dropdown-item"><a href="#"><span>Download Patient Data</span></a></div><div class="dropdown-item"><a href="#"> <span>Download Selected</span></a></div></div></li></ul></button>').insertBefore("#zero-config_filter label");
});
// var quill = new Quill('#news-quill-add', {
// theme: 'snow'
// });
</script>
<script>
var quill = new Quill('#news-quill-add', {
var quill = new Quill('#news-quill-add', {
theme: 'snow'
});
$('#add_newsletter').on("click", function (e) {
// alert('sdkjfb');
</script>
<!-- <script>
var quill = new Quill('#news-quill-add', {
theme: 'snow'
});
$('#add_newsletter').on("click", function(e) {
// alert('sdkjfb');
$('#add_blog_form').validate({
debug: false,
rules: {
article_name: {
required: true
},
article_des: {
required: true,
},
// article_image: {
// required: true
// },
article_thmb: {
required: true
},
category: {
required: true
},
$('#add_blog_form').validate({
debug: false,
rules: {
article_name: {
required: true
},
article_des: {
required: true,
},
article_image: {
required: true
},
article_thmb: {
required: true
},
category: {
required: true
},
},
messages: {
article_name: {
required: "Please Enter Article name"
},
article_des: {
required: "Please Enter Description"
},
article_thmb: {
required: "Please Select Image"
},
category: {
required: "Please Select Article Category"
},
},
errorClass: 'error-message',
submitHandler: function (form) {
// Set the hidden input value to the HTML content of the Quill editor
var quillContent = quill.root.innerHTML;
$('#article_des').val(quillContent);
let base_url = url_path;
var formData = new FormData(form);
$('#add_newsletter').text('Please wait...').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
messages: {
article_name: {
required: "Please Enter Article name"
},
article_des: {
required: "Please Enter Description"
},
article_thmb: {
required: "Please Select Image"
},
article_image: {
required: "Please Select Image"
},
category: {
required: "Please Select Article Category"
},
$.ajax({
url: base_url + '/manage_insert_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (response) {
if (response.status == 200) {
toastr.success('News and Article Added Successfully');
setTimeout(function () {
window.location.href = base_url + "/manage-new-articles";
}, 3000);
} else {
toastr.error("Something went wrong");
}
$('#add_newsletter').attr('disabled', false).text('Submit');
},
errorClass: 'error-message',
submitHandler: function(form) {
// Set the hidden input value to the HTML content of the Quill editor
var quillContent = quill.root.innerHTML;
$('#article_des').val(quillContent);
let base_url = url_path;
var formData = new FormData(form);
$('#add_newsletter').text('Please wait...').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/manage_insert_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.status == 200) {
toastr.success('News and Article Added Successfully');
setTimeout(function() {
window.location.href = base_url + "/manage-new-articles";
}, 3000);
} else {
toastr.error("Something went wrong");
}
$('#add_newsletter').attr('disabled', false).text('Submit');
},
});
}
});
}
});
});
</script>
});
</script> -->
<script>
FilePond.registerPlugin(
@@ -251,4 +252,32 @@ $('#add_blog_form').validate({
);
</script>
@endsection
<script>
const imageInput = document.getElementById('selectThumbnailImage');
const imagePreview = document.getElementById('previewthumbnailimage');
imageInput.addEventListener('change', function() {
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
imagePreview.style.display = 'block'; // Show the image preview container
imagePreview.src = event.target.result; // Set the source of the image preview to the selected image
};
reader.readAsDataURL(file);
} else {
imagePreview.style.display = 'none'; // Hide the image preview container if no file is selected
}
});
</script>
<script>
selectImage.onchange = evt => {
preview = document.getElementById('preview');
preview.style.display = 'block';
const [file] = selectImage.files
if (file) {
preview.src = URL.createObjectURL(file)
}
}
</script>
@endsection

View File

@@ -1,350 +1,330 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage_cms';
@endphp
<style>
.error-message {
color: #FF0000;
}
@php
$currentPage = 'manage_cms';
@endphp
<style>
.error-message {
color: #FF0000;
}
form .error-message {
color: red;
/* Set your desired color here */
}
form .error-message {
color: red;
/* Set your desired color here */
}
form .input_class.error-message {
color: #0e1726;
}
</style>
form .input_class.error-message {
color: #0e1726;
}
</style>
<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">
<a class="d-flex align-items-center justify-content-center pl-2" href="{{ route('manage.Newarticles')}}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg')}}">
<h6 class="card-title p-0">Edit News & Articles </h6>
</a>
</div>
<div class="col-md-8">
<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">
<a class="d-flex align-items-center justify-content-center pl-2"
href="{{ route('manage.Newarticles') }}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
<h6 class="card-title p-0">Edit News & Articles </h6>
</a>
</div>
<div class="col-md-8">
</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 h-10">
<div class="view-details Article">
<form id="update_news" enctype="multipart/form-data">
<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_news" enctype="multipart/form-data">
<div class="row">
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Article Name</label>
<input type="hidden" name="article_id" value="{{ $news_article_data['id'] }}" class="form-control">
<input type="text" class="form-control" value="{{ $news_article_data['name'] }}" name="article_name">
<div class="row">
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Article Name</label>
<input type="hidden" name="article_id" value="{{ $news_article_data['id'] }}"
class="form-control">
<input type="text" class="form-control"
value="{{ $news_article_data['name'] }}" name="article_name">
</div>
</div>
</div>
<div class="col-md-6">
<!-- <div class="form-group ">
<label for="company-name" class="label">Image Upload</label> -->
<!-- <input type="file" class="form-control"> -->
<!-- <input type="file" class="filepond pan-frontside"
name="pancard_image_front" id="product-images"
data-max-file-size="3MB">
<div class="col-md-6">
</div> -->
<div class="col-md-12">
<div class="form-group mt-3">
<label class="mr-2 mb-3" style="font-weight: 600;">Image Upload :</label>
<div class="multiple-file-upload">
<input type="file" class="filepond pan-frontside" name="article_image" id="imageInputNormal" data-max-file-size="3MB">
<!-- <div class="col-md-12">
<div class="form-group mt-3">
<label class="mr-2 mb-3" style="font-weight: 600;">Image Upload :</label>
<div class="multiple-file-upload">
<input type="file" class="filepond pan-frontside" name="article_image" id="imageInputNormal" data-max-file-size="3MB">
<div id="imageInputPreviewNormal" style="width: 30%;">
<img src="{{ asset('storage/app/public/' . $news_article_data['image']) }}" alt="Image Preview" style="width: 40%;">
</div>
</div>
</div>
</div> -->
<!--
<div class="col-md-12">
<div class="form-group mt-3">
<label class="mr-2 mb-3" style="font-weight: 600;">Image Upload :</label>
<div class="multiple-file-upload">
<input type="file" class="filepond pan-frontside" name="article_image" id="imageInputNormal" data-max-file-size="3MB">
@if ($news_article_data->image)
<div id="imageInputPreviewNormal" style="width: 30%;">
<img src="{{ asset('storage/app/public' . $news_article_data->image) }}" alt="Image Preview" style="width: 40%;">
</div>
@endif
</div>
</div>
</div> -->
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Image Upload</label>
<input type="file" name="article_image" id="imageInputNormal"
class="form-control">
<div id="imageInputPreviewNormal" style="width: 30%;">
<img src="{{ asset('storage/app/public/' . $news_article_data['image']) }}" alt="Image Preview" style="width: 40%;">
<img src="{{ asset('storage/app/public/' . $news_article_data['image']) }}"
alt="Image Preview" style="width: 40%;">
</div>
</div>
</div>
</div>
<div class="col-md-6">
<!-- <div class="form-group ">
<label for="company-name" class="label">Description</label>
<div id="news-quill-edit" class="editor-quill" style="height: 100px;">{!! $news_article_data['description'] !!}</div>
<input type="hidden" id="article_dis" name="article_dis" value="{{ $news_article_data['description'] }}">
</div> -->
<div class="form-group">
<label for="company-name" class="label">Description</label>
<div id="news-quill-edit" class="editor-quill" style="height: 100px;">
{!! $news_article_data['description'] !!}</div>
<input type="hidden" id="article_dis" name="article_dis"
value="{{ $news_article_data['description'] }}">
</div>
</div>
<div class="col-md-6">
<!-- <div class="form-group ">
<label for="company-name" class="label">Description</label>
<div id="news-quill-edit" class="editor-quill" style="height: 100px;">{!! $news_article_data['description'] !!}</div>
<input type="hidden" id="article_dis" name="article_dis" value="{{ $news_article_data['description'] }}">
</div> -->
<div class="form-group">
<label for="company-name" class="label">Description</label>
<div id="news-quill-edit" class="editor-quill" style="height: 100px;">{!! $news_article_data['description'] !!}</div>
<input type="hidden" id="article_dis" name="article_dis" value="{{ $news_article_data['description'] }}">
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Thumbnail Image:</label>
<input type="file" name="article_thmb" id="imageInputThumb" class="form-control">
<div id="imagePreviewThumb" style="width: 30%;">
<img src="{{ asset('storage/app/public/' . $news_article_data['thumbnail_image']) }}" alt="Image Preview" style="width: 40%;">
<div class="col-md-6">
<div class="form-group">
<label for="state" class="label">Select Category</label>
<select id="state" name="category_xid" class="form-control">
<option value="">Select Category</option>
@foreach ($news_categories as $news_category)
<option value="{{ $news_category['id'] }}"
{{ $news_article_data->news_articles_category_xid == $news_category['id'] ? 'selected' : '' }}>
{{ $news_category['name'] }}
</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Thumbnail Image:</label>
<input type="file" name="article_thmb" id="imageInputThumb"
class="form-control">
<div id="imagePreviewThumb" style="width: 30%;">
<img src="{{ asset('storage/app/public/' . $news_article_data['thumbnail_image']) }}"
alt="Image Preview" style="width: 40%;">
</div>
</div>
</div>
<div class="col-md-12">
<button class="download-btn-custom mt-3 custom-width-10" id="update_news_btn">
<span>Save</span>
</a>
</div>
</div>
<div class="col-md-12">
<button class="download-btn-custom mt-3 custom-width-10" id="update_news_btn">
<span>Save</span>
</a>
</div>
</div>
</form>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('section_script')
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": {
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": {
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
},
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
$(document).ready(function() {
$('<button><a class="extra-btn width-max-content" href="archive-manage-customers.php">View Archive List</a></button><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>Export</h3></div></div></a><div class="dropdown-menu position-absolute" aria-labelledby="actionDropdown"><div class="dropdown-item"><a href="#"><span>Download Overview</span></a></div><div class="dropdown-item"><a href="#"><span>Download Patient Data</span></a></div><div class="dropdown-item"><a href="#"> <span>Download Selected</span></a></div></div></li></ul></button>').insertBefore("#zero-config_filter label");
});
// var quill = new Quill('#news-quill-edit', {
// theme: 'snow'
// });
</script>
<!-- <script>
$('#update_news_btn').on("click", function(e) {
// alert('kjh');
$('#update_news').validate({
// ignore: [],
debug: false,
rules: {
article_name: {
required: true
},
article_dis: {
required: true
},
// category: {
// required: true
// },
},
messages: {
article_name: {
required: "Please Enter Article name"
},
article_dis: {
required: "Please Enter Description"
},
// category: {
// required: "Please Select Article Category"
// },
},
errorClass: 'error-message',
submitHandler: function(form) {
let base_url = url_path;
var formData = new FormData(form);
$('#update_news_btn').text('Please wait...');
$('#update_news_btn').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/manage_update_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.status == 200) {
toastr.success('News and Article Updated Successfully');
setTimeout(function() {
window.location.href = base_url + "/manage-new-articles";
}, 1000);
} else if (response.status == 204) {
toastr.error(response.error);
} else {
toastr.error("Something went wrong");
}
$('#update_news_btn').attr('disabled', false);
$('#update_news_btn').text('Submit');
},
});
}
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
});
</script> -->
<script>
// Initialize Quill editor
var quill = new Quill('#news-quill-edit', {
theme: 'snow'
});
$('#update_news_btn').on("click", function(e) {
$('#update_news').validate({
debug: false,
rules: {
article_name: {
required: true
},
article_dis: {
required: true
},
article_image: {
required: true
},
article_thmb: {
required: true
},
},
messages: {
article_name: {
required: "Please Enter Article name"
},
article_dis: {
required: "Please Enter Description"
},
article_image: {
required: "Please select image"
},
article_thmb: {
required: "Please select image"
},
},
errorClass: 'error-message',
submitHandler: function(form) {
// Set the hidden input value to the HTML content of the Quill editor
var quillContent = quill.root.innerHTML;
$('#article_dis').val(quillContent);
let base_url = url_path;
var formData = new FormData(form);
$('#update_news_btn').text('Please wait...');
$('#update_news_btn').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/manage_update_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.status == 200) {
toastr.success('News and Article Updated Successfully');
setTimeout(function() {
window.location.href = base_url + "/manage-new-articles";
}, 1000);
} else if (response.status == 204) {
toastr.error(response.error);
} else {
toastr.error("Something went wrong");
}
$('#update_news_btn').attr('disabled', false);
$('#update_news_btn').text('Submit');
},
});
}
</script>
<script>
$(document).ready(function() {
$('<button><a class="extra-btn width-max-content" href="archive-manage-customers.php">View Archive List</a></button><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>Export</h3></div></div></a><div class="dropdown-menu position-absolute" aria-labelledby="actionDropdown"><div class="dropdown-item"><a href="#"><span>Download Overview</span></a></div><div class="dropdown-item"><a href="#"><span>Download Patient Data</span></a></div><div class="dropdown-item"><a href="#"> <span>Download Selected</span></a></div></div></li></ul></button>')
.insertBefore("#zero-config_filter label");
});
});
</script>
<script>
const imageInputEdit = document.getElementById('imageInputNormal');
const imagePreviewEdit = document.getElementById('imageInputPreviewNormal');
// var quill = new Quill('#news-quill-edit', {
// theme: 'snow'
// });
</script>
<script>
// Initialize Quill editor
var quill = new Quill('#news-quill-edit', {
theme: 'snow'
});
imageInputEdit.addEventListener('change', function() {
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const img = document.createElement('img');
img.src = event.target.result;
img.style.maxWidth = '200px';
img.style.maxHeight = '200px';
$('#update_news_btn').on("click", function(e) {
$('#update_news').validate({
debug: false,
rules: {
article_name: {
required: true
},
article_dis: {
required: true
},
category_xid: {
required: true
},
// article_image: {
// required: true
// },
// article_thmb: {
// required: true
// },
},
messages: {
article_name: {
required: "Please Enter Article name"
},
article_dis: {
required: "Please Enter Description"
},
category_xid: {
required: "Please Enter Category"
},
// article_image: {
// required: "Please select image"
// },
// article_thmb: {
// required: "Please select image"
// },
},
errorClass: 'error-message',
submitHandler: function(form) {
// Set the hidden input value to the HTML content of the Quill editor
var quillContent = quill.root.innerHTML;
$('#article_dis').val(quillContent);
let base_url = url_path;
var formData = new FormData(form);
$('#update_news_btn').text('Please wait...');
$('#update_news_btn').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/manage_update_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.status == 200) {
toastr.success('News and Article Updated Successfully');
setTimeout(function() {
window.location.href = base_url +
"/manage-new-articles";
}, 1000);
} else if (response.status == 204) {
toastr.error(response.error);
} else {
toastr.error("Something went wrong");
}
$('#update_news_btn').attr('disabled', false);
$('#update_news_btn').text('Submit');
},
});
}
});
});
</script>
<script>
const imageInputEdit = document.getElementById('imageInputNormal');
const imagePreviewEdit = document.getElementById('imageInputPreviewNormal');
imageInputEdit.addEventListener('change', function() {
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const img = document.createElement('img');
img.src = event.target.result;
img.style.maxWidth = '200px';
img.style.maxHeight = '200px';
imagePreviewEdit.innerHTML = '';
imagePreviewEdit.appendChild(img);
};
reader.readAsDataURL(file);
} else {
imagePreviewEdit.innerHTML = '';
imagePreviewEdit.appendChild(img);
};
reader.readAsDataURL(file);
} else {
imagePreviewEdit.innerHTML = '';
}
});
}
});
const imageInput = document.getElementById('imageInputThumb');
const imagePreview = document.getElementById('imagePreviewThumb');
const imageInput = document.getElementById('imageInputThumb');
const imagePreview = document.getElementById('imagePreviewThumb');
imageInput.addEventListener('change', function() {
console.log("in change kjbck");
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const img = document.createElement('img');
img.src = event.target.result;
img.style.maxWidth = '200px';
img.style.maxHeight = '200px';
imageInput.addEventListener('change', function() {
console.log("in change kjbck");
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const img = document.createElement('img');
img.src = event.target.result;
img.style.maxWidth = '200px';
img.style.maxHeight = '200px';
imagePreview.innerHTML = '';
imagePreview.appendChild(img);
};
reader.readAsDataURL(file);
} else {
imagePreview.innerHTML = '';
imagePreview.appendChild(img);
};
reader.readAsDataURL(file);
} else {
imagePreview.innerHTML = '';
}
});
</script>
<script>
FilePond.registerPlugin(
FilePondPluginImagePreview,
FilePondPluginImageExifOrientation,
FilePondPluginFileValidateSize,
);
FilePond.create(
document.querySelector('.pan-frontside')
);
</script>
}
});
</script>
<script>
FilePond.registerPlugin(
FilePondPluginImagePreview,
FilePondPluginImageExifOrientation,
FilePondPluginFileValidateSize,
);
FilePond.create(
document.querySelector('.pan-frontside')
);
</script>
@endsection

View File

@@ -14,7 +14,7 @@
<div class="row">
<div class="col-md-12 left d-flex align-items-center justify-content-between"
style="gap: 15px;">
<h6 class="card-title pl-2">Terms & Conditions</h6>
<h6 class="card-title pl-2"> Customer Terms & Conditions </h6>
<a class="view-details-btn mr-2"
href="{{ route('terms_edit', ['id' => $terms_condition[0]['id']]) }}"
data-id="{{ $terms_condition[0]['id'] }}">
@@ -51,6 +51,49 @@
</div>
<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-12 left d-flex align-items-center justify-content-between"
style="gap: 15px;">
<h6 class="card-title pl-2"> Restaturant Terms & Conditions</h6>
<a class="view-details-btn mr-2"
href="{{ route('terms_edit_rest', ['id' => $terms_condition[1]['id']]) }}"
data-id="{{ $terms_condition[1]['id'] }}">
<span>Edit</span>
</a>
</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">
@csrf
<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-12">
<p>
{!! $terms_condition[1]['message'] !!}
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('section_script')

View File

@@ -5,19 +5,19 @@
$currentPage = 'manage-terms';
@endphp
<style>
.error-message {
color: #FF0000;
}
.error-message {
color: #FF0000;
}
form .error-message {
color: red;
/* Set your desired color here */
}
form .error-message {
color: red;
/* Set your desired color here */
}
form .input_class.error-message {
color: #0e1726;
}
</style>
form .input_class.error-message {
color: #0e1726;
}
</style>
@@ -62,35 +62,35 @@ $currentPage = 'manage-terms';
</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">
@csrf
<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">
<form id="terms_form">
<div class="col-md-12">
<input type="hidden" name="custom_id" value="{{ $terms->id }}">
<input type="hidden" id="stored-terms-message" value="{{ $terms->message }}" >
<div id="terms-quill-edit" name="article_des" class="editor-quill" style="height: 300px;" minlength="10" ></div>
<span class="error-message" id="error-message"></span>
<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">
@csrf
<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">
<form id="terms_form">
<div class="col-md-12">
<input type="hidden" name="custom_id" value="{{ $terms->id }}">
<input type="hidden" id="stored-terms-message" value="{{ $terms->message }}">
<div id="terms-quill-edit" name="article_des" class="editor-quill" style="height: 300px;" minlength="10"></div>
<span class="error-message" id="error-message"></span>
</div>
<div class="col-md-12">
<button type="submit" id="update_terms" class="download-btn-custom mt-3 custom-width-10">
<span>Update</span>
</button>
</div>
</form>
</div>
</div>
<div class="col-md-12">
<button type="submit" id="update_terms" class="download-btn-custom mt-3 custom-width-10">
<span>Update</span>
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -111,4 +111,4 @@ $currentPage = 'manage-terms';
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script>
<script src="{{ asset('public/assets/js/admin/manage_cms/manage_terms_cond/manage_terms_condition.js')}}"></script>
@endsection
@endsection

View File

@@ -0,0 +1,97 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage_cms';
@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-12 left d-flex align-items-center justify-content-between" style="gap: 15px;">
<a class="d-flex align-items-center justify-content-center pl-2" href="{{ route('manage.terms') }}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
<h6 class="card-title p-0">Edit Details</h6>
</a>
</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-12">
<div id="terms-quill-edit" class="editor-quill"
style="height: 300px;"></div>
</div>
<div class="col-md-12">
<a class="download-btn-custom mt-3 custom-width-10" href="">
<span>Update</span>
</a>
</div>
</div>
</div>
</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">
@csrf
<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">
<form id="terms_rest_form">
<div class="col-md-12">
<input type="hidden" name="termRest_id" value="{{$edit_terms_rest->id}}">
<input type="hidden" id="stored-terms-rest-message" value="{{ $edit_terms_rest->message }}">
<div id="termsRest-quill-edit" name="termsrest_des" class="editor-quill" style="height: 300px;" minlength="10"></div>
<span class="error-message" id="error-message"></span>
</div>
<div class="col-md-12">
<button type="submit" id="update_termsrest" class="download-btn-custom mt-3 custom-width-10">
<span>Update</span>
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('section_script')
<!-- <script>
var quill = new Quill('#terms-quill-edit', {
theme: 'snow'
});
</script> -->
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script>
<script src="{{ asset('public/assets/js/admin/manage_cms/manage_terms_cond/manage_terms_condition.js')}}"></script>
@endsection

View File

@@ -1,185 +1,478 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage-contact-us';
@endphp
<style>
.action-buttons {
display: flex;
gap: 10px; /* Adjust the gap between buttons as needed */
margin: 10px 0; /* Add margin if needed to separate from other elements */
}
@php
$currentPage = 'manage-contact-us';
@endphp
<style>
.action-buttons {
display: flex;
gap: 10px;
/* Adjust the gap between buttons as needed */
margin: 10px 0;
/* Add margin if needed to separate from other elements */
}
.action-btn {
display: flex;
align-items: center;
text-decoration: none;
color: inherit;
background-color: #f1f1f1; /* Adjust background color as needed */
padding: 10px 15px; /* Adjust padding as needed */
border-radius: 5px; /* Adjust border radius as needed */
transition: background 0.3s;
border: 1px solid #ccc; /* Add border for better visibility */
}
.action-btn {
display: flex;
align-items: center;
text-decoration: none;
color: inherit;
background-color: #f1f1f1;
/* Adjust background color as needed */
padding: 10px 15px;
/* Adjust padding as needed */
border-radius: 5px;
/* Adjust border radius as needed */
transition: background 0.3s;
border: 1px solid #ccc;
/* Add border for better visibility */
}
.action-btn img {
margin-right: 5px; /* Adjust spacing between icon and text as needed */
width: 16px; /* Set a fixed width for the icon */
height: 16px; /* Set a fixed height for the icon */
}
.action-btn img {
margin-right: 5px;
/* Adjust spacing between icon and text as needed */
width: 16px;
/* Set a fixed width for the icon */
height: 16px;
/* Set a fixed height for the icon */
}
.action-btn:hover {
background-color: #e0e0e0; /* Adjust hover background color as needed */
}
.action-btn span {
font-size: 14px; /* Adjust font size as needed */
line-height: 1.5; /* Adjust line height as needed */
}
.action-btn:hover {
background-color: #e0e0e0;
/* Adjust hover background color as needed */
}
.action-btn span {
font-size: 14px;
/* Adjust font size as needed */
line-height: 1.5;
/* Adjust line height as needed */
}
</style>
<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">
<h6 class="card-title">Manage Contact Us</h6>
</div>
<div class="col-md-8">
<div class="btns-datatabel">
<div class="row">
<div class="col-md-7"></div>
<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">
<h6 class="card-title">Manage Contact Us</h6>
</div>
<div class="col-md-8">
<div class="btns-datatabel">
<div class="row">
<div class="col-md-7"></div>
</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">
<table id="zero-config" class="table dt-table-hover" style="width:100%">
<thead class="text-center">
<tr>
<th class="text-start">Sr No.</th>
<th class="text-start">First Name</th>
<th class="text-start">Last Name</th>
<th class="text-start">Email address</th>
<th class="text-start">Date</th>
<th class="text-start">Recipients</th>
<th class="text-start">Message</th>
<th class="text-start">Status</th>
<th class="no-content">Actions</th>
</tr>
</thead>
<tbody class="text-center">
@foreach ($queries as $querie)
<tr>
<td class="text-start">{{ $loop->iteration }}</td>
<td class="text-start">{{ $querie->customer?->first_name ?? 'N/A' }}</td>
<td class="text-start">{{ $querie->customer?->last_name ?? 'N/A' }}</td>
<td class="text-start">{{ $querie['email'] }}</td>
<td class="text-start">{{ $querie['created_at']->format('m/d/y') }}</td>
<td class="text-start">
@if ($querie->customer)
@if ($querie->customer->principal_type_xid == 3)
Customer
@else
Restaurant
@endif
@else
No category
@endif
</td>
<td>
<a class="view-btn m-0" href="#" data-toggle="modal"
data-target="#view-message-modal" data-ids="{{ $querie['id'] }}"
data-message="{{ $querie['message'] }}">View</a>
</td>
<td class="text-center">
<form>
<div class="switch-btn" id="status-change">
<input type="checkbox" id="switch{{ $querie['id'] }}" switch="bool"
data-id="{{ $querie['id'] }}" name="status" value="1"
{{ $querie['is_reply'] ? 'checked' : '' }} disabled />
<label for="switch{{ $querie['id'] }}" data-on-label="Resolved" data-off-label="Pending"></label>
</div>
</form>
</td>
<td>
<!-- <div class="dropout">
</div> -->
@if (!$querie['is_reply'])
<div class="action-buttons">
<a href="#" class="action-btn reply-button" data-toggle="modal"
data-target="#reply-modal" data-query-id="{{ $querie['id'] }}"
data-query-name="{{ $querie['name'] }}">
<img src="{{ asset('public/assets/img/restore.svg') }}" />
<span>Reply</span>
</a>
@endif
@if ($querie['is_reply'])
<div class="action-buttons">
<a href="#" class="action-btn replymessage-button"
data-toggle="modal" data-query-id="{{ $querie['id'] }}"
data-query-name="{{ $querie['name'] }}"
data-reply-message="{{ $querie['reply_message'] }}"
data-target="#replymessage-modal">
<span>View reply</span>
</a>
@endif
<a class="action-btn delete_user" data-id="{{ $querie['id'] }}"
data-toggle="modal" data-target="#delete-modal">
</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">
<table id="zero-config" class="table dt-table-hover" style="width:100%">
<thead class="text-center">
<tr>
<th class="text-start">Sr No.</th>
<th class="text-start">Name</th>
<th class="text-start">Email address</th>
<th class="text-start">Message</th>
<th class="no-content">Actions</th>
</tr>
</thead>
<tbody class="text-center">
@foreach ($queries as $querie)
<img src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a>
</tr>
@endforeach
</table>
</div>
<tr>
<td class="text-start">{{ $loop->iteration }}</td>
<td class="text-start">{{ $querie['name'] }}</td>
<td class="text-start">{{ $querie['email'] }}</td>
<td>
<a class="view-btn m-0" href="#" data-toggle="modal" data-target="#view-message-modal" data-ids="{{ $querie['id'] }}" data-message="{{ $querie['message'] }}">View</a>
</td>
<td>
<!-- <div class="dropout">
<button class="more">
<span></span>
<span></span>
<span></span>
</td>
<div class="modal fade" id="view-message-modal" tabindex="-1" role="dialog"
aria-labelledby="viewMessageModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header">
<h5 class="modal-title" id="viewMessageModalLabel">Message</h5>
<button type="button" class="close" data-dismiss="mo
dal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<ul>
<li>
<a href="" data-toggle="modal" data-target="#reply-modal">
<img src="../src/assets/img/restore.svg" />
<span>Reply</span>
</a>
</li>
<li>
<a href="" data-toggle="modal" data-target="#delete-modal">
<img src="../src/assets/img/delete-recycle.svg" />
<span>Delete</span>
</a>
</li>
</ul>
</div> -->
<div class="action-buttons">
<a class="action-btn" href="#" data-toggle="modal" data-target="#reply-modal">
<img src="{{ asset('public/assets/img/restore.svg') }}" />
<span>Reply</span>
</a>
<a class="action-btn" href="#" data-toggle="modal" data-target="#delete-modal">
<img src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a>
</div>
</div>
<p id="message-content"></p>
</div>
</div>
</div>
</div>
</td>
<div class="modal fade" id="view-message-modal" tabindex="-1" role="dialog" aria-labelledby="viewMessageModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header">
<h5 class="modal-title" id="viewMessageModalLabel">Message</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<p id="message-content"></p>
</div>
</tbody>
<form action="{{ route('send.reply', ['id' => $querie['id']]) }}" method="post" id="replyForm">
@csrf
<div class="modal fade" id="reply-modal" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Reply to
<span id="query-name"></span>
</h5>
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="col-xxl-12">
<textarea name="reply_message" class="form-control" id="post-meta-description" cols="10" rows="5"
required></textarea>
<button type="submit" class="download-btn reply_user_button">Reply</button>
</div>
</div>
</div>
</tr>
</div>
</div>
</form>
<div class="modal fade" id="replymessage-modal" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Reply Message:
<span id="query-name"></span>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="col-xxl-12">
<p><span id="reply-message"></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close">
x
</button>
</div>
<div class="modal-body">
<input type="hidden" id="delete_user_id" name="user_id">
<p class="modal-text">Are you sure you want to<br>Delete </p>
<div class="modal-btn d-flex ">
<a type="button" href="route{{ 'manage.contact' }}" class="extra-btn"
data-dismiss="modal">No</a>
<a type="button" class="download-btn-custom delete_user_button" data-dismiss="modal">Yes</a>
</div>
</tbody>
@endforeach
</table>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('section_script')
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": {
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": {
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
},
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
$(document).ready(function() {
$('.view-btn').click(function() {
var message = $(this).data('message');
var id = $(this).data('ids');
$('#view-message-modal #message-content').text(message);
$('#view-message-modal').modal('show');
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10,
"ordering": true, // Enable global ordering
"columnDefs": [
// { "orderable": false, "targets": [0, 1, 2] } // Disable ordering for the first column (checkboxes) and the eighth column
]
});
});
</script>
</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");
@endsection
// 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() {
var delete_id = $(this).data('id');
$('#delete_user_id').val(delete_id); // Fix the selector here
});
$(document).on("click", ".delete_user_button", function(e) {
e.preventDefault();
let base_url = url_path;
var delete_id = $('#delete_user_id').val();
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
type: "POST", // Change the type to POST since you're using Route::post in Laravel
url: base_url + "/delete_user/" + delete_id,
data: {
_method: 'post', // Laravel requires a hidden _method field for DELETE requests
},
success: function(response) {
console.log(response);
toastr.info("Contact Deleted Successfully");
window.location.reload();
}
});
});
</script>
<script>
$(document).ready(function() {
$('.view-btn').click(function() {
var message = $(this).data('message');
var id = $(this).data('ids');
$('#view-message-modal #message-content').text(message);
$('#view-message-modal').modal('show');
});
});
</script>
<script>
$(document).on("click", ".reply-button", function() {
var queryId = $(this).data('query-id');
var queryName = $(this).data('query-name');
$('#query-name').text(queryName);
$('#reply-modal').data('query-id', queryId);
$('#reply-modal').modal('show');
});
$(document).on("click", "#reply-button", function(e) {
e.preventDefault();
var queryId = $('#reply-modal').data('query-id');
$('#reply-modal').modal('hide');
});
</script>
<script>
$(document).on("click", ".replymessage-button", function() {
var queryId = $(this).data('query-id');
var queryName = $(this).data('query-name');
var replyMessage = $(this).data('reply-message');
// Set the query name and reply message in the modal
$('#query-name').text(queryName);
$('#reply-message').text(replyMessage);
// Set the query ID as a data attribute for future use
$('#replymessage-modal').data('query-id', queryId);
// Show the modal
$('#replymessage-modal').modal('show');
});
$(document).on("click", "#replymessage-button", function(e) {
e.preventDefault();
// Get the query ID from the modal data attribute
var queryId = $('#replymessage-modal').data('query-id');
// Your other AJAX code for handling the reply
// ...
// Hide the modal after handling the reply
$('#replymessage-modal').modal('hide');
});
</script>
<script>
$(document).ready(function() {
$('.reply_user_button').on('click', function(event) {
event.preventDefault();
var replyMessage = $('#post-meta-description').val().trim();
if (replyMessage === "") {
toastr.error("Please enter a reply message.");
return;
}
var csrfToken = $('meta[name="csrf-token"]').attr('content');
var queryId = $('#reply-modal').data('query-id');
$.ajax({
url: "{{ route('send.reply') }}",
type: 'POST',
data: {
reply_message: replyMessage,
user_id: queryId,
_token: csrfToken
},
dataType: 'json',
success: function(response) {
console.log(response);
toastr.success('Reply sent successfully');
window.location.reload();
$('#reply-modal').modal('hide');
},
error: function(error) {
console.error(error);
toastr.error("An error occurred. Please try again.");
}
});
});
});
</script>
<script>
$(document).ready(function() {
// Handle click event on the "View" button
$('.view-btn').click(function() {
// Get the message and id from the data attributes
var message = $(this).data('message');
var id = $(this).data('ids');
// Set the message in the modal
$('#message-modal-' + id + ' .modal-body').html('<p id="modal-message-' + id + '">' +
message + '</p>');
});
});
</script>
@endsection

View File

@@ -1,118 +1,214 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage-feedback';
@endphp
@php
$currentPage = 'manage-feedback';
@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">
<h6 class="card-title">Manage Feedback</h6>
</div>
<div class="col-md-8">
</div>
<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">
<h6 class="card-title">Manage Feedback</h6>
</div>
<div class="col-md-8">
</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">
</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">
<form action="{{ route('export-selected-feedback') }}" method="POST" id="restaurant-form">
@csrf
<input type="hidden" name="all_id" id="all_id" value="all" disabled>
<!-- ... existing table and content ... -->
<table id="zero-config" class="table dt-table-hover" style="width:100%">
<thead class="text-center">
<tr>
<th class="text-start">Sr No.</th>
<th class="text-start">User ID</th>
<th class="text-start">User Name</th>
<th class="text-start">User Type</th>
<th class="text-start">Feedback Type</th>
<th class="text-start">Reactions</th>
<th class="text-start">Commnet</th>
<th class="text-start">Comment</th>
<th class="text-start">Date Received</th>
<th class="no-content">Actions</th>
</tr>
</thead>
<tbody class="text-center">
<tr>
<td class="text-start">1</td>
<td class="text-start">345678</td>
<td class="text-start">Raj Shinde</td>
<td class="text-start">Customer</td>
<td class="text-start">Good</td>
<td>
<a class="view-btn m-0" href="" data-toggle="modal"
data-target="#comment-modal">View</a>
</td>
<td class="text-start">08/22/2023</td>
<td>
<a class="d-flex justify-content-center align-items-center"
style="gap: 7px;" href="" data-toggle="modal"
data-target="#delete-modal">
<img width="15" src="{{ asset('public/assets/img/delete-recycle.svg')}}" />
<span>Delete</span>
</a>
</td>
</tr>
<tr>
<td class="text-start">2</td>
<td class="text-start">345678</td>
<td class="text-start">Raj Shinde</td>
<td class="text-start">Customer</td>
<td class="text-start">Amazing</td>
<td>
<a class="view-btn m-0" href="" data-toggle="modal"
data-target="#comment-modal">View</a>
</td>
<td class="text-start">08/22/2023</td>
<td>
<a class="d-flex justify-content-center align-items-center"
style="gap: 7px;" href="" data-toggle="modal"
data-target="#delete-modal">
<img width="15" src="{{ asset('public/assets/img/delete-recycle.svg')}}" />
<span>Delete</span>
</a>
</td>
</tr>
@foreach ($feedback as $feedbacks)
<tr>
<td class="text-start">{{ $loop->iteration }}</td>
<td class="text-start">{{ $feedbacks->principal->id }}</td>
<td class="text-start">{{ $feedbacks->principal->first_name }}
{{ $feedbacks->principal->last_name }}</td>
<td class="text-start">
@if ($feedbacks->is_app_feedback == 1)
App Feedback
@elseif ($feedbacks->is_restaurant_feedback == 1)
{{ $feedbacks->restaurant->name }} Restaurant
@else
Unknown
@endif
</td>
<td class="text-start">
{{ $feedbacks->feedbackReaction->feedback_reaction_title }}</td>
<td>
<a class="view-btn m-0" href="#" data-toggle="modal"
data-target="#comment-modal" data-ids="{{ $feedbacks->id }}"
data-comment="{{ $feedbacks->comment }}">View</a>
</td>
<td class="text-start">
{{ \Carbon\Carbon::parse($feedbacks->created_at)->format('m/d/Y') }}
</td>
<td>
<a class="delete_feedback" data-id="{{ $feedbacks['id'] }}"
style="gap: 7px;" href="" data-toggle="modal"
data-target="#delete-modal">
<img width="15"
src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="comment-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header p-0">
<h5 class="modal-title">Comment</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<p id="comment-content"></p>
</div>
</div>
</div>
</div>
@endsection
<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close">
x
</button>
</div>
<div class="modal-body">
<input type="hidden" id="delete_feedback_id" name="feedback_id">
<p class="modal-text">Are you sure you want to<br>Delete </p>
<div class="modal-btn d-flex ">
<a class="extra-btn" href="route{{ 'manage_feedback' }}" data-dismiss="modal">No</a>
<a type="button" class="download-btn-custom delete_feedback_button" data-dismiss="modal">Yes</a>
@section('section_script')
</div>
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"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="#"><span>Customer</span></a></div><div class="dropdown-item"><a href="#"><span>Restraunt</span></a></div></div></li></ul></button>').insertBefore("#zero-config_filter label");
});
</script>
</div>
</div>
</div>
</div>
@endsection
@section('section_script')
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": {
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
},
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
$(document).ready(function() {
// Create the button element with the correct structure
var downloadButton = $(
'<button class="extra-btn width-max-content" id="download_all">Download Overview</button>');
// Insert the button before the #zero-config_filter label
downloadButton.insertBefore("#zero-config_filter label");
// Handle the button click event
$(document).on("click", "#download_all", function(e) {
e.preventDefault();
$('#all_id').prop('disabled', false); // Enable the hidden input
$('#restaurant-form').submit(); // Submit the form
});
});
</script>
<script>
$(document).ready(function() {
$('.view-btn').click(function() {
var commentId = $(this).data('ids');
var commentContent = $(this).data('comment');
$('#comment-content').text(commentContent); // Ensure correct modal content ID
$('#comment-modal').modal('show'); // Show the modal
});
});
</script>
<script>
$(document).on("click", ".delete_feedback", function() {
var delete_id = $(this).data('id');
$('#delete_feedback_id').val(delete_id);
});
$(document).on("click", ".delete_feedback_button", function(e) {
e.preventDefault();
let base_url = url_path;
var delete_id = $('#delete_feedback_id').val();
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
type: "POST",
url: base_url + "/delete_feedback/" + delete_id,
data: {
_method: 'post',
},
success: function(response) {
console.log(response);
toastr.success("Feedback Deleted Successfully");
window.location.reload();
}
});
});
</script>
@endsection

View File

@@ -8,141 +8,179 @@
<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">
<h6 class="card-title">Manage Notification</h6>
</div>
<div class="col-md-8">
</div>
<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">
<h6 class="card-title">Manage Notification</h6>
</div>
<div class="col-md-8">
</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">
<table id="zero-config" class="table dt-table-hover" style="width:100%">
<thead class="text-center">
<tr>
<th class="text-start">Sr No.</th>
<th class="text-start">Notification content</th>
<th class="text-start">Created Date</th>
<th class="text-start">Recipients</th>
<th class="text-start">Date sent</th>
<th class="no-content">Status</th>
</tr>
</thead>
<tbody class="text-center">
<tr>
<td class="text-start">1</td>
<td class="text-start">Lorem Ipsum</td>
<td class="text-start">08/22/2023</td>
<td class="text-start">Customer</td>
<td class="text-start">20/22/2023</td>
<td>
<div class="dropout">
<button class="more">
<span></span>
<span></span>
<span></span>
</button>
<ul>
<li>
<a href="manage-notification-view.php">
<img src="../src/assets/img/view.svg" />
<span>View</span>
</a>
</li>
<li>
<a href="manage-notification-edit.php">
<img src="../src/assets/img/edit.svg" />
<span>Edit</span>
</a>
</li>
<li>
<a href="" data-toggle="modal" data-target="#delete-modal">
<img src="../src/assets/img/delete-recycle.svg" />
<span>Delete</span>
</a>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<td class="text-start">1</td>
<td class="text-start">Lorem Ipsum</td>
<td class="text-start">08/22/2023</td>
<td class="text-start">Customer</td>
<td class="text-start">20/22/2023</td>
<td>
<div class="dropout">
<button class="more">
<span></span>
<span></span>
<span></span>
</button>
<ul>
<li>
<a href="manage-vouchers-view.php">
<img src="../src/assets/img/view.svg" />
<span>View</span>
</a>
</li>
<li>
<a href="manage-vouchers-edit.php">
<img src="../src/assets/img/edit.svg" />
<span>Edit</span>
</a>
</li>
<li>
<a href="" data-toggle="modal" data-target="#delete-modal">
<img src="../src/assets/img/delete-recycle.svg" />
<span>Delete</span>
</a>
</li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
</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">
<table id="zero-config" class="table dt-table-hover" style="width:100%">
<thead class="text-center">
<tr>
<th class="text-start">Sr No.</th>
<th class="text-start">Notification content</th>
<th class="text-start">Email</th>
<th class="text-start">Created Date</th>
<th class="text-start">Recipients</th>
<th class="text-start">Date sent</th>
<th class="no-content">Status</th>
</tr>
</thead>
<tbody class="text-center">
@foreach ($notifications as $notification)
<tr>
<td class="text-start">{{ $loop->iteration }}</td>
<td class="text-start">{{ $notification->type }}</td>
<td class="text-start">{{ $notification->Notification->email_address }}</td>
<td class="text-start">
{{ \Carbon\Carbon::parse($notification->created_at)->format('m/d/Y') }}</td>
<td class="text-start">
@if ($notification->Notification->principal_type_xid == '3')
Customer
@else
Resturant
@endif
</td>
<td class="text-start">
{{ \Carbon\Carbon::parse($notification->date_added)->format('m/d/Y') }}</td>
<td>
<div class="dropout">
<button class="more">
<span></span>
<span></span>
<span></span>
</button>
<ul>
<li>
<a
href="{{ url('/manage_view_notifications/' . $notification->id) }}">
<img src="{{ asset('public/assets/img/view.svg') }}" />
<span>View</span>
</a>
</li>
{{-- <li>
<a href="{{ route('manage_edit_notifications') }}">
<img src="{{ asset('public/assets/img/edit.svg') }}" />
<span>Edit</span>
</a>
</li> --}}
{{-- <li>
<a href="" data-toggle="modal" data-target="#delete-modal">
<img
src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a>
</li> --}}
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@section('section_script')
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
$(document).ready(function () {
$('<button><a class="extra-btn width-max-content" href="manage-notification-add.php">Add</a></button><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="#"><span>All</span></a></div><div class="dropdown-item"><a href="#"><span>Customer</span></a></div><div class="dropdown-item"><a href="#"> <span>Restaurant</span></a></div></div></li></ul></button>').insertBefore("#zero-config_filter label");
});
</script>
</div>
@endsection
@section('section_script')
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": {
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
},
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
$(document).ready(function() {
$('<button><a class="extra-btn width-max-content" href="{{ route('manage_add_notifications') }}">Add</a></button><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.notification') }}" id="allFilter"><span>All</span></a></div><div class="dropdown-item"><a href="{{ route('manage.notification', ['active' => 4]) }}" id="activeFilter"><span>Customer</span></a></div><div class="dropdown-item"><a href="{{ route('manage.notification', ['active' => 3]) }}" id="expiredFilter"> <span>Restaurant</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');
});
});
// Define handleChange function
function handleChange(filterType) {
// Reset background color of all filters
$('#activeFilter, #expiredFilter, #allFilter').css('background-color', '');
// Set background color based on filter type
if (filterType === 'active') {
$('#activeFilter').css({
'padding': '4px 8px',
'background-color': 'rgb(233, 233, 234)',
'color': 'rgb(191, 191, 196)'
}); // Set color for active filter
} else if (filterType === 'expired') {
$('#expiredFilter').css({
'padding': '4px 8px',
'background-color': 'rgb(233, 233, 234)',
'color': 'rgb(191, 191, 196)'
}); // Set color for expired filter
} else if (filterType === 'all') {
$('#allFilter').css({
'padding': '4px 8px',
'background-color': 'rgb(233, 233, 234)',
'color': 'rgb(191, 191, 196)'
});
}
}
</script>
@endsection

View File

@@ -0,0 +1,235 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage_notification';
@endphp
<style>
.error-message {
color: #FF0000;
}
form .error-message {
color: red;
/* Set your desired color here */
}
form .input_class.error-message {
color: #0e1726;
}
</style>
<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">
<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">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="widget-content widget-content-area br-8 position-btn h-10">
<div class="view-details Article">
<form id="send_notification_form">
@csrf
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="company-name" class="label">Notification Content</label>
<input type="text" class="form-control" name="title">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="company-name" class="label">Description</label>
<textarea type="text" class="form-control" name="description"></textarea>
</div>
</div>
<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/*">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="location" class="label">When should this message start
sending:</label>
<div class="form-check form-check-sm form-check-custom form-check-solid me-3">
<input class="form-check-input" type="radio" name="user_type"
value="1" id="select-all-ids" />
<label class="form-check-label" for="select-all-ids">Send to unsubscribed
users who are in their respective states</label><br>
<div id="dropdown-1"
style="display: none; max-height: 200px; overflow-y: auto;">
@foreach ($state as $states)
<div class="form-check">&nbsp;
<input class="form-check-input" type="checkbox" name="states[]"
value="{{ $states['id'] }}"
id="state-{{ $states['id'] }}" />
<label class="form-check-label"
for="state-{{ $states['id'] }}">{{ $states['name'] }}</label>
</div>
@endforeach
</div>
<input class="form-check-input" type="radio" name="user_type"
id="select-popular-ids" value="2" />
<label class="form-check-label" for="select-popular-ids">Send to subscribed
users who are in their respective states</label><br>
<div id="dropdown-2"
style="display: none; max-height: 200px; overflow-y: auto;">
@foreach ($state as $states)
<div class="form-check">&nbsp;
<input class="form-check-input" type="checkbox" name="states[]"
value="{{ $states['id'] }}"
id="state-{{ $states['id'] }}" />
<label class="form-check-label"
for="state-{{ $states['id'] }}">{{ $states['name'] }}</label>
</div>
@endforeach
</div>
</div>
</div>
</div>
<div class="col-md-12">
<button class="download-btn-custom mt-3 custom-width-10" type="submit"
id="store_notification_btn">
<span>Submit</span>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('section_script')
<script>
$(document).ready(function() {
// Validate the form
$('#send_notification_form').validate({
ignore: [],
debug: false,
rules: {
title: {
required: true
},
description: {
required: true
},
image: {
required: true
},
recipients: {
required: true
}
},
messages: {
title: {
required: 'Please enter this field'
},
description: {
required: 'Please enter this field'
},
image: {
required: 'Please upload an image file'
},
recipients: {
required: 'Please select at least one category'
}
},
errorClass: 'error-message',
errorPlacement: function(error, element) {
if (element.attr("name") == "user_type") {
error.insertAfter("#select-popular-ids").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('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);
}
$('#store_notification_btn').attr('disabled', false);
$('#store_notification_btn').text('Submit');
},
});
}
});
});
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
function handleUserTypeChange() {
var dropdown1 = document.getElementById('dropdown-1');
var dropdown2 = document.getElementById('dropdown-2');
dropdown1.style.display = this.value === '1' ? 'block' : 'none';
dropdown2.style.display = this.value === '2' ? 'block' : 'none';
}
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);
}
});
</script>
@endsection

View File

@@ -0,0 +1,83 @@
@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>
</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">
<td>@if($notification->notification->principal_type_xid == '3')
Customer
@else
Resturant
@endif
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -9,24 +9,24 @@ $currentPage = 'manage_profile';
<!-- BEGIN LOADER -->
<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">
<h6 class="card-title">Profile</h6>
</div>
<div class="col-md-8">
<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">
<h6 class="card-title">Profile</h6>
</div>
<div class="col-md-8">
</div>
</div>
</div>
</div>
<div class="row widget-content widget-content-area br-8 position-btn m-auto py-3" style="overflow: auto;">
<div class="row m-0 p-0 w-100">
<div class="col-md-6 d-flex align-items-center justify-content-start mb-4" style="gap: 25px;">
<!-- <div>
</div>
</div>
<div class="row widget-content widget-content-area br-8 position-btn m-auto py-3" style="overflow: auto;">
<div class="row m-0 p-0 w-100">
<div class="col-md-6 d-flex align-items-center justify-content-start mb-4" style="gap: 25px;">
<!-- <div>
<label id="image-upload-button" for="profileImage">
<i class="fa fa-camera" aria-hidden="true"></i>
</label>
@@ -34,74 +34,80 @@ $currentPage = 'manage_profile';
<div id="imagePreview" style="background-image: url('../src/assets/img/mahima.jpg')">
</div>
</div> -->
<!-- <div class="col-md-6 mb-3">
<label id="image-upload-button" for="profileImage">
<i class="fa fa-camera" aria-hidden="true"></i>
</label>
<input class="d-none" type="file" id="profileImage" name="profile_photo" accept="image/*" onchange="previewImage(event)"> -->
<!-- <div id="imagePreview" name="imagePreview" style="background-image: url('{{ $user->profile_photo ? asset('storage/app/public/uploads/admin_images/' . $user->profile_photo) : asset('storage/app/public/uploads/admin_images/user.png') }}')">
</div>
</div> -->
<div>
@if(isset($user))
<h5 class="mb-1" style="font-weight: 700;">{{ $user->first_name }}</h5>
<p class="m-0">{{ $user->phone_number }}</p>
<p class="m-0">{{ $user->address_line1 }}</p>
@else
<p>No user found with ID 1.</p>
@endif
</div>
</div>
<div class="col-md-6 d-flex justify-content-end">
<a class="download-btn-custom mt-3 custom-width-15 m-0" href="{{route('logout')}}" style="height: fit-content;">
<span>Logout</span>
</a>
</div>
</div>
<form method="post" action="" id="updateProfileForm" enctype="multipart/form-data">
@csrf
<div class="row m-0 p-0 w-75 mx-auto">
<div class="col-md-6 mb-3">
<label id="image-upload-button" for="profileImage">
<i class="fa fa-camera" aria-hidden="true"></i>
</label>
<input class="d-none" type="file" id="profileImage" name="profile_photo" accept="image/*" onchange="previewImage(event)">
<!-- <input class="d-none" type="file" id="profileImage" name="profile_photo" accept="image/*"> -->
<div id="imagePreview" name="imagePreview" style="background-image: url('{{ $user->profile_photo ? asset('storage/app/public/uploads/admin_images/' . $user->profile_photo) : asset('storage/app/public/uploads/admin_images/user.png') }}')">
</div>
</div>
<!-- <div>
<h5 class="mb-1" style="font-weight: 700;">Akanksha Surve</h5>
<p class="m-0">12345678</p>
<p class="m-0">Mumbai, Maharashtra</p>
</div> -->
<div>
@if(isset($user))
<h5 class="mb-1" style="font-weight: 700;">{{ $user->first_name }}</h5>
<p class="m-0">{{ $user->phone_number }}</p>
<p class="m-0">{{ $user->address_line1 }}</p>
@else
<p>No user found with ID 1.</p>
@endif
</div>
</div>
<div class="col-md-6 d-flex justify-content-end">
<a class="download-btn-custom mt-3 custom-width-15 m-0" href="{{route('logout')}}" style="height: fit-content;">
<span>Logout</span>
</a>
</div>
<div class="col-md-6 mb-3">
</div>
<form method="post" action="" id="updateProfileForm" enctype="multipart/form-data">
@csrf
<div class="row m-0 p-0 w-75 mx-auto">
<div class="col-md-6 mb-3">
<label for="">First Name</label>
<input class="form-control" type="text" value="{{ $user->first_name }}" id="first_name"
name="first_name" maxlength="15" required>
</div>
<div class="col-md-6 mb-3">
<label for="">Last Name</label>
<input class="form-control" type="text" value="{{ $user->last_name }}" id="last_name"
name="last_name" maxlength="15" required>
</div>
<div class="col-md-6">
<label for="">Phone Number</label>
<input class="form-control" type="tel" value="{{ $user->phone_number }}" id="phone_number"
name="phone_number" maxlength="10" required>
</div>
<div class="col-md-6">
<label for="">Email Address</label>
<input class="form-control" type="email" value="{{ $user->email_address }}"
id="email_address" name="email_address" required
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$">
</div>
<div class="col-md-12 mt-3">
<button type="submit" class="download-btn-custom mt-3 custom-width-10 mx-auto update_profile"
id="updates_profile">Save</button>
</div>
</div>
</form>
<div class="col-md-6 mb-3">
<label for="">First Name</label>
<input class="form-control" type="text" value="{{ $user->first_name }}" id="first_name" name="first_name" maxlength="15" required>
</div>
<div class="col-md-6 mb-3">
<label for="">Last Name</label>
<input class="form-control" type="text" value="{{ $user->last_name }}" id="last_name" name="last_name" maxlength="15" required>
</div>
<div class="col-md-6">
<label for="">Phone Number</label>
<input class="form-control" type="tel" value="{{ $user->phone_number }}" id="phone_number" name="phone_number" maxlength="10" required>
</div>
<div class="col-md-6">
<label for="">Email Address</label>
<input class="form-control" type="email" value="{{ $user->email_address }}" id="email_address" name="email_address" required pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$">
</div>
<div class="col-md-12 mt-3">
<button type="submit" class="download-btn-custom mt-3 custom-width-10 mx-auto update_profile" id="updates_profile">Save</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
@@ -149,106 +155,106 @@ $currentPage = 'manage_profile';
}
</script>
<script>
$(document).ready(function() {
let base_url = url_path;
// Initialize form validation
$(document).ready(function() {
let base_url = url_path;
// Initialize form validation
$.validator.addMethod("lettersOnly", function(value, element) {
return this.optional(element) || /^[a-zA-Z]+$/.test(value);
}, "Please enter alphabetic characters only and spaces are not allowed");
$.validator.addMethod("lettersOnly", function(value, element) {
return this.optional(element) || /^[a-zA-Z]+$/.test(value);
}, "Please enter alphabetic characters only and spaces are not allowed");
$('#updateProfileForm').validate({
rules: {
first_name: {
required: true,
lettersOnly: true
},
last_name: {
required: true,
lettersOnly: true
},
phone_number: {
required: true,
minlength: 10,
maxlength: 10,
digits: true // Ensure only digits are entered
},
email_address: {
required: true,
email: true // Ensure valid email format
},
profileImage: {
required: true,
accept: 'image/*' // Ensure only image files are accepted
}
$('#updateProfileForm').validate({
rules: {
first_name: {
required: true,
lettersOnly: true
},
messages: {
// Custom error messages for each field if needed
first_name: {
required: 'Please enter your first name',
},
last_name: {
required: 'Please enter your last name',
},
phone_number: {
required: 'Please enter your phone number',
minlength: 'Phone number must be 10 digits long',
maxlength: 'Phone number must be 10 digits long',
digits: 'Please enter only digits'
},
email_address: {
required: 'Please enter your email address',
email: 'Please enter a valid email address'
},
profileImage: {
required: 'Please select a profile photo',
accept: 'Only image files are allowed'
}
last_name: {
required: true,
lettersOnly: true
},
errorClass: 'error-message',
submitHandler: function(form) {
// Form is valid, proceed with form submission
var formData = new FormData(form);
// Get the selected image file
var profileImage = $('#profileImage')[0].files[0];
// Append the image file to the FormData object
formData.append('profile_photo', profileImage);
$.ajax({
type: 'POST',
url: '{{ route('update.profile') }}',
data: formData,
beforeSend:function(){
$('#updates_profile').html('Please wait...');
$('#updates_profile').attr('disabled', true);
},
processData: false,
contentType: false,
success: function(response) {
if (response.status === 200) {
toastr.success("Profile Updated Successfully");
window.location.href = base_url + "/profile";
} else {
toastr.error("Error updating profile");
}
},
error: function(xhr, status, error) {
if (xhr.responseJSON && xhr.responseJSON.error) {
toastr.error(xhr.responseJSON.error);
} else {
toastr.error('Error updating profile');
}
console.log(xhr.responseText);
}
});
$('#updates_profile').attr('disabled', false);
$('#updates_profile').text('Submit');
phone_number: {
required: true,
minlength: 10,
maxlength: 10,
digits: true // Ensure only digits are entered
},
email_address: {
required: true,
email: true // Ensure valid email format
},
profileImage: {
required: true,
accept: 'image/*' // Ensure only image files are accepted
}
},
messages: {
// Custom error messages for each field if needed
first_name: {
required: 'Please enter your first name',
},
last_name: {
required: 'Please enter your last name',
},
phone_number: {
required: 'Please enter your phone number',
minlength: 'Phone number must be 10 digits long',
maxlength: 'Phone number must be 10 digits long',
digits: 'Please enter only digits'
},
email_address: {
required: 'Please enter your email address',
email: 'Please enter a valid email address'
},
profileImage: {
required: 'Please select a profile photo',
accept: 'Only image files are allowed'
}
},
errorClass: 'error-message',
submitHandler: function(form) {
// Form is valid, proceed with form submission
var formData = new FormData(form);
// Get the selected image file
var profileImage = $('#profileImage')[0].files[0];
// Append the image file to the FormData object
formData.append('profile_photo', profileImage);
$.ajax({
type: 'POST',
url: '{{ route('update.profile') }}',
data: formData,
beforeSend: function() {
$('#updates_profile').html('Please wait...');
$('#updates_profile').attr('disabled', true);
},
processData: false,
contentType: false,
success: function(response) {
if (response.status === 200) {
toastr.success("Profile Updated Successfully");
window.location.href = base_url + "/profile";
} else {
toastr.error("Error updating profile");
}
},
error: function(xhr, status, error) {
if (xhr.responseJSON && xhr.responseJSON.error) {
toastr.error(xhr.responseJSON.error);
} else {
toastr.error('Error updating profile');
}
console.log(xhr.responseText);
}
});
$('#updates_profile').attr('disabled', false);
$('#updates_profile').text('Submit');
}
});
});
</script>
});
</script>
@endsection
@endsection

View File

@@ -47,12 +47,6 @@
<input type="text" class="form-control" name="name" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Description</label>
<textarea type="text" class="form-control" name="description" required></textarea>
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Restaurant ID</label>
@@ -61,7 +55,7 @@
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="location" class="label">Location</label>
<label for="location" class="label">Address</label>
<input type="text" class="form-control" name="address" required>
</div>
</div>
@@ -79,9 +73,21 @@
<div class="col-md-6">
<div class="form-group ">
<label for="location" class="label">Exclusion</label>
<input type="text" class="form-control" name="exclusion" required>
<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>
<div class="col-md-6">
<div class="form-group ">
<label for="location" class="label">Latitude</label>
@@ -94,6 +100,13 @@
<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>
<input type="text" class="form-control" name="phone_number" maxlength="15"
required>
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Bio</label>
@@ -119,6 +132,39 @@
@endforeach
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="timeHours" class="label">Time in hours between redeeming two
cocktails in hours</label>
<input type="number" class="form-control" id="timeHours" name="timeHours"
required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="maxNumbDay" class="label">Maximum number of cocktails per
day</label>
<input type="number" class="form-control" id="maxNumbDay" name="maxNumbDay"
required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="maxNumbWeek" class="label">Maximum number of cocktails per
week</label>
<input type="number" class="form-control" id="maxNumbWeek"
name="maxNumbWeek" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="maxNumbMonth" class="label">Maximum number of cocktails per
month</label>
<input type="number" class="form-control" id="maxNumbMonth"
name="maxNumbMonth" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">While at Restaurant be sure to

Some files were not shown because too many files have changed in this diff Show More