From c2c83feeec646ab82105e55e2520459a41f98298 Mon Sep 17 00:00:00 2001 From: Shailesh-1981 <86923815+Shailesh-1981@users.noreply.github.com> Date: Wed, 29 May 2024 13:22:54 +0530 Subject: [PATCH 1/4] Subadmin and email add --- .../Admin/ManageSubAdminController.php | 156 ++++++++++- app/Mail/Add_Subadmin.php | 61 +++++ app/Models/IamPrincipal.php | 4 +- app/Models/ManageFeedback.php | 34 +++ app/Models/ManageModule.php | 17 ++ app/Models/ManageModuleLink.php | 26 ++ composer.lock | 130 +++------- ...5_28_075849_create_manage_module_table.php | 33 +++ ...101851_create_manage_module_link_table.php | 32 +++ .../assets/js/admin/manage_sub_admin/add.js | 10 +- .../assets/js/admin/manage_sub_admin/edit.js | 8 +- .../assets/js/admin/manage_sub_admin/main.js | 4 +- .../manage_sub_admin/create.blade.php | 100 +++++++ .../manage_sub_admin/edit.blade.php | 82 ++++++ .../manage_subadmin.blade.php | 154 ++++++----- resources/views/mail/subadmin.blade.php | 244 ++++++++++++++++++ routes/web.php | 6 + 17 files changed, 930 insertions(+), 171 deletions(-) create mode 100644 app/Mail/Add_Subadmin.php create mode 100644 app/Models/ManageFeedback.php create mode 100644 app/Models/ManageModule.php create mode 100644 app/Models/ManageModuleLink.php create mode 100644 database/migrations/2024_05_28_075849_create_manage_module_table.php create mode 100644 database/migrations/2024_05_28_101851_create_manage_module_link_table.php create mode 100644 resources/views/Admin/pages/manage_users/manage_sub_admin/create.blade.php create mode 100644 resources/views/Admin/pages/manage_users/manage_sub_admin/edit.blade.php create mode 100644 resources/views/mail/subadmin.blade.php diff --git a/app/Http/Controllers/Admin/ManageSubAdminController.php b/app/Http/Controllers/Admin/ManageSubAdminController.php index 1cdf337..28c804a 100644 --- a/app/Http/Controllers/Admin/ManageSubAdminController.php +++ b/app/Http/Controllers/Admin/ManageSubAdminController.php @@ -4,10 +4,162 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use Illuminate\Http\Request; - +use App\Models\ManageModule; +use App\Models\IamPrincipal; +use App\Models\ManageModuleLink; +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; +use Exception; +use Illuminate\Support\Facades\Mail; +use App\Mail\Add_Subadmin; class ManageSubAdminController extends Controller { public function index(){ - return view('Admin.pages.manage_users.manage_sub_admin.manage_subadmin'); + $sub_admins_module = ManageModule::latest()->get(); + $sub_admins_data = IamPrincipal::where('principal_type_xid', 2)->latest()->get(); + + return view('Admin.pages.manage_users.manage_sub_admin.manage_subadmin',compact('sub_admins_data','sub_admins_module')); } + + public function create() + { + $sub_admins_module = ManageModule::latest()->get(); + + return view('admin.pages.manage_users.manage_sub_admin.create', compact('sub_admins_module')); + } + + public function store_subadmin(Request $request) + { + + + /* + Created By : Megha + Created at : 12 Feb 2024 + Use : To store sub admin form. + */ + try { + + // DB::beginTransaction(); + + + $sub_admin = new IamPrincipal(); + $sub_admin->first_name = $request->input('sub_admin_name'); + $sub_admin->user_name = 'sub_admin'; + $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'); + $sub_admin->password = bcrypt($request->input('password')); + $sub_admin->save(); + + + $moduleIds = $request->input('module_id'); + + foreach ($moduleIds as $moduleId) { + + $sub_admin_permission = new ManageModuleLink; + $sub_admin_permission->principal_xid = $sub_admin->id; + $sub_admin_permission->manage_modules_xid = $moduleId; + $sub_admin_permission->save(); + + } + + $mailData =[ + 'username'=>$request->input('sub_admin_name'), + 'password'=>$request->input('password'), + ]; + + + + // Mail::to($sub_admin->email_address)->send(new Add_Subadmin($mailData)); + $mail = Mail::to($request->input('sub_admin_email'))->send(new Add_Subadmin($mailData)); + // dd($mail); + + // DB::commit(); + return jsonResponseWithSuccessMessage(__('success.save_data')); + // return response()->json(['status'=>200]); + // return $voucher_data; + } catch (Exception $e) { + DB::rollBack(); + Log::error("restaurant Store Page Load Failed " . $e->getMessage()); + return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500); + } + } + public function edit($id) + { + // dd($id); + $sub_admins_module = ManageModule::latest()->get(); + $edit_sub_admin = IamPrincipal::with(['moduleLinks' => function ($query) { + $query->with('module'); + }])->find($id); + return view('admin.pages.manage_users.manage_sub_admin.edit', compact('edit_sub_admin', 'sub_admins_module')); + } + + public function delete_sub_admin($id) + { + /* + Created By : Megha + Created at : 14 Feb 2024 + Use : To Delete Admin. + */ + try { + DB::beginTransaction(); + + $passport = IamPrincipal::find($id); + $passport->delete(); + + DB::commit(); + + return response()->json(['success' => 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')]); + } + } + + public function update_subadmin(Request $request) + { + /* + Created By : Megha + Created at : 14 Feb 2024 + Use : To update sub admin form. + */ + try { + DB::beginTransaction(); + + $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->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'); + // $sub_admin->password = bcrypt($request->input('password')); + $sub_admin->save(); + + $moduleIds = $request->input('module_id'); + // dd($moduleIds); + $update_module = ManageModuleLink::where('principal_xid', $sub_admin->id)->delete(); + + foreach ($moduleIds as $moduleId) { + $sub_admin_permission = new ManageModuleLink; + $sub_admin_permission->principal_xid = $sub_admin->id; + $sub_admin_permission->manage_modules_xid = $moduleId; + $sub_admin_permission->save(); + } + + + DB::commit(); + return jsonResponseWithSuccessMessage(__('success.save_data')); + // return $voucher_data; + } catch (Exception $e) { + DB::rollBack(); + Log::error("restaurant Store Page Load Failed " . $e->getMessage()); + return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500); + } + } + + + + } diff --git a/app/Mail/Add_Subadmin.php b/app/Mail/Add_Subadmin.php new file mode 100644 index 0000000..7de4d5e --- /dev/null +++ b/app/Mail/Add_Subadmin.php @@ -0,0 +1,61 @@ +mailData = $mailData; + } + + /** + * Get the message envelope. + */ + // public function envelope(): Envelope + // { + // return new Envelope( + // subject: 'You add in subadmin ', + // ); + // } + + // /** + // * Get the message content definition. + // */ + // public function content(): Content + // { + // return new Content( + // view: 'mail.subadmin', + // ); + // } + + // /** + // * Get the attachments for the message. + // * + // * @return array + // */ + // public function attachments(): array + // { + // return []; + // } + + public function build() + { + // $otp = $this->otp; + return $this->subject('OTP From Cheers to the Session')->view('mail.subadmin'); + } +} diff --git a/app/Models/IamPrincipal.php b/app/Models/IamPrincipal.php index 55052b6..f812a6f 100644 --- a/app/Models/IamPrincipal.php +++ b/app/Models/IamPrincipal.php @@ -9,8 +9,8 @@ use Tymon\JWTAuth\Contracts\JWTSubject; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use App\Models\admin\ManageFeedback; -use App\Models\admin\ManageModuleLink; -use App\Models\admin\ManageModule; +use App\Models\ManageModuleLink; +use App\Models\ManageModule; use App\Models\OrderedPassport; diff --git a/app/Models/ManageFeedback.php b/app/Models/ManageFeedback.php new file mode 100644 index 0000000..867825b --- /dev/null +++ b/app/Models/ManageFeedback.php @@ -0,0 +1,34 @@ +belongsTo(IamPrincipal::class, 'principal_xid', 'id')->withDefault([ + 'id' => null, // Default id value + // Add more default attributes as needed + ]); + } + + + public function feedbackReaction() + { + return $this->belongsTo(FeedbackReaction::class, 'feedback_reaction_xid', 'feedback_reaction_xid'); + } + + + +} diff --git a/app/Models/ManageModule.php b/app/Models/ManageModule.php new file mode 100644 index 0000000..3220f70 --- /dev/null +++ b/app/Models/ManageModule.php @@ -0,0 +1,17 @@ +belongsTo(IamPrincipal::class); + } + + public function module() + { + return $this->belongsTo(ManageModule::class); + } +} diff --git a/composer.lock b/composer.lock index ac7b1f8..e5fb268 100644 --- a/composer.lock +++ b/composer.lock @@ -1741,31 +1741,34 @@ }, { "name": "lcobucci/clock", - "version": "2.2.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/lcobucci/clock.git", - "reference": "fb533e093fd61321bfcbac08b131ce805fe183d3" + "reference": "6f28b826ea01306b07980cb8320ab30b966cd715" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/clock/zipball/fb533e093fd61321bfcbac08b131ce805fe183d3", - "reference": "fb533e093fd61321bfcbac08b131ce805fe183d3", + "url": "https://api.github.com/repos/lcobucci/clock/zipball/6f28b826ea01306b07980cb8320ab30b966cd715", + "reference": "6f28b826ea01306b07980cb8320ab30b966cd715", "shasum": "" }, "require": { - "php": "^8.0", - "stella-maris/clock": "^0.1.4" + "php": "~8.2.0 || ~8.3.0", + "psr/clock": "^1.0" + }, + "provide": { + "psr/clock-implementation": "1.0" }, "require-dev": { - "infection/infection": "^0.26", - "lcobucci/coding-standard": "^8.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-deprecation-rules": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^9.5" + "infection/infection": "^0.27", + "lcobucci/coding-standard": "^11.0.0", + "phpstan/extension-installer": "^1.3.1", + "phpstan/phpstan": "^1.10.25", + "phpstan/phpstan-deprecation-rules": "^1.1.3", + "phpstan/phpstan-phpunit": "^1.3.13", + "phpstan/phpstan-strict-rules": "^1.5.1", + "phpunit/phpunit": "^10.2.3" }, "type": "library", "autoload": { @@ -1786,7 +1789,7 @@ "description": "Yet another clock abstraction", "support": { "issues": "https://github.com/lcobucci/clock/issues", - "source": "https://github.com/lcobucci/clock/tree/2.2.0" + "source": "https://github.com/lcobucci/clock/tree/3.2.0" }, "funding": [ { @@ -1798,47 +1801,45 @@ "type": "patreon" } ], - "time": "2022-04-19T19:34:17+00:00" + "time": "2023-11-17T17:00:27+00:00" }, { "name": "lcobucci/jwt", - "version": "4.0.4", + "version": "4.3.0", "source": { "type": "git", "url": "https://github.com/lcobucci/jwt.git", - "reference": "55564265fddf810504110bd68ca311932324b0e9" + "reference": "4d7de2fe0d51a96418c0d04004986e410e87f6b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/jwt/zipball/55564265fddf810504110bd68ca311932324b0e9", - "reference": "55564265fddf810504110bd68ca311932324b0e9", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/4d7de2fe0d51a96418c0d04004986e410e87f6b4", + "reference": "4d7de2fe0d51a96418c0d04004986e410e87f6b4", "shasum": "" }, "require": { + "ext-hash": "*", + "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", - "lcobucci/clock": "^2.0", + "ext-sodium": "*", + "lcobucci/clock": "^2.0 || ^3.0", "php": "^7.4 || ^8.0" }, "require-dev": { - "infection/infection": "^0.20", + "infection/infection": "^0.21", "lcobucci/coding-standard": "^6.0", - "mikey179/vfsstream": "^1.6", - "phpbench/phpbench": "^0.17", + "mikey179/vfsstream": "^1.6.7", + "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-deprecation-rules": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", "phpunit/php-invoker": "^3.1", - "phpunit/phpunit": "^9.4" + "phpunit/phpunit": "^9.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, "autoload": { "psr-4": { "Lcobucci\\JWT\\": "src" @@ -1862,7 +1863,7 @@ ], "support": { "issues": "https://github.com/lcobucci/jwt/issues", - "source": "https://github.com/lcobucci/jwt/tree/4.0.4" + "source": "https://github.com/lcobucci/jwt/tree/4.3.0" }, "funding": [ { @@ -1874,7 +1875,7 @@ "type": "patreon" } ], - "time": "2021-09-28T19:18:28+00:00" + "time": "2023-01-02T13:28:00+00:00" }, { "name": "league/commonmark", @@ -2495,16 +2496,16 @@ }, { "name": "nesbot/carbon", - "version": "3.3.1", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "8ff64b92c1b1ec84fcde9f8bb9ff2ca34cb8a77a" + "reference": "8eab8983c83c30e0bacbef8d311e3f3b8172727f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8ff64b92c1b1ec84fcde9f8bb9ff2ca34cb8a77a", - "reference": "8ff64b92c1b1ec84fcde9f8bb9ff2ca34cb8a77a", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8eab8983c83c30e0bacbef8d311e3f3b8172727f", + "reference": "8eab8983c83c30e0bacbef8d311e3f3b8172727f", "shasum": "" }, "require": { @@ -2597,7 +2598,7 @@ "type": "tidelift" } ], - "time": "2024-05-01T06:54:22+00:00" + "time": "2024-05-24T14:26:34+00:00" }, { "name": "nette/schema", @@ -3803,53 +3804,6 @@ ], "time": "2024-04-27T21:32:50+00:00" }, - { - "name": "stella-maris/clock", - "version": "0.1.7", - "source": { - "type": "git", - "url": "https://github.com/stella-maris-solutions/clock.git", - "reference": "fa23ce16019289a18bb3446fdecd45befcdd94f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/stella-maris-solutions/clock/zipball/fa23ce16019289a18bb3446fdecd45befcdd94f8", - "reference": "fa23ce16019289a18bb3446fdecd45befcdd94f8", - "shasum": "" - }, - "require": { - "php": "^7.0|^8.0", - "psr/clock": "^1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "StellaMaris\\Clock\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andreas Heigl", - "role": "Maintainer" - } - ], - "description": "A pre-release of the proposed PSR-20 Clock-Interface", - "homepage": "https://gitlab.com/stella-maris/clock", - "keywords": [ - "clock", - "datetime", - "point in time", - "psr20" - ], - "support": { - "source": "https://github.com/stella-maris-solutions/clock/tree/0.1.7" - }, - "time": "2022-11-25T16:15:06+00:00" - }, { "name": "symfony/clock", "version": "v7.0.7", diff --git a/database/migrations/2024_05_28_075849_create_manage_module_table.php b/database/migrations/2024_05_28_075849_create_manage_module_table.php new file mode 100644 index 0000000..b3e2775 --- /dev/null +++ b/database/migrations/2024_05_28_075849_create_manage_module_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('name'); + $table->string('slug'); + $table->integer('created_by')->nullable(); + $table->integer('modified_by')->nullable(); + $table->softDeletes(); + $table->timestamps(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('manage_module'); + } +}; diff --git a/database/migrations/2024_05_28_101851_create_manage_module_link_table.php b/database/migrations/2024_05_28_101851_create_manage_module_link_table.php new file mode 100644 index 0000000..10a94fc --- /dev/null +++ b/database/migrations/2024_05_28_101851_create_manage_module_link_table.php @@ -0,0 +1,32 @@ +id(); + $table->unsignedBigInteger('principal_xid'); + $table->foreign('principal_xid')->references('id')->on('iam_principal')->onDelete('cascade'); + $table->unsignedBigInteger('manage_modules_xid'); + $table->foreign('manage_modules_xid')->references('id')->on('manage_module')->onDelete('cascade'); + $table->timestamps(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('manage_module_link'); + } +}; diff --git a/public/assets/js/admin/manage_sub_admin/add.js b/public/assets/js/admin/manage_sub_admin/add.js index f9fef86..32bffaf 100644 --- a/public/assets/js/admin/manage_sub_admin/add.js +++ b/public/assets/js/admin/manage_sub_admin/add.js @@ -20,6 +20,9 @@ $(document).on("click", "#add_sub_admin_form_btn", function (e) { password: { required: true } + ,"module_id[]":{ + required: true + } }, messages: { sub_admin_name: { @@ -32,6 +35,9 @@ $(document).on("click", "#add_sub_admin_form_btn", function (e) { }, password: { required: 'Please enter this filed' + }, + "module_id[]":{ + required: 'Please enter this filed' } }, errorClass: 'error-message', @@ -58,12 +64,12 @@ $(document).on("click", "#add_sub_admin_form_btn", function (e) { if (result.status_code == 200) { toastr.success('Data Added Sucessfully'); setTimeout(function () { - window.location.href = base_url + "/manage_sub_admin"; + window.location.href = base_url + "/manage-sub-admin"; }, 2000); } else { toastr.error('Something Went Wrong'); setTimeout(function () { - window.location.href = base_url + "/manage_sub_admin"; + window.location.href = base_url + "/manage-sub-admin"; }, 2000); } $('#add_sub_admin_form_btn').attr('disabled', false); diff --git a/public/assets/js/admin/manage_sub_admin/edit.js b/public/assets/js/admin/manage_sub_admin/edit.js index b1b176a..7d33c6d 100644 --- a/public/assets/js/admin/manage_sub_admin/edit.js +++ b/public/assets/js/admin/manage_sub_admin/edit.js @@ -43,22 +43,22 @@ $('#update_admin_btn').on("click", function (e) { if (result.status_code == 200) { toastr.success('Data Updated Sucessfully'); setTimeout(function() { - window.location.href = base_url + "/manage_sub_admin"; + window.location.href = base_url + "/manage-sub-admin"; }, 2000); } else { toastr.error('Something Went Wrong'); setTimeout(function() { - window.location.href = base_url + "/manage_sub_admin"; + window.location.href = base_url + "/manage-sub-admin"; }, 2000); } $('#update_admin_btn').attr('disabled', false); $('#update_admin_btn').text('Submit'); }, - + }); // $('#update_admin_btn').attr('disabled', false); // $('#update_admin_btn').text('Submit'); } }); -}); \ No newline at end of file +}); diff --git a/public/assets/js/admin/manage_sub_admin/main.js b/public/assets/js/admin/manage_sub_admin/main.js index 27638db..bc058ab 100644 --- a/public/assets/js/admin/manage_sub_admin/main.js +++ b/public/assets/js/admin/manage_sub_admin/main.js @@ -48,7 +48,7 @@ $(document).on("click", ".admin_delete", function (e) { if (response.status == 200) { toastr.success('Deleted Successfully'); setTimeout(function () { - window.location.href = base_url + "/manage_sub_admin"; + window.location.href = base_url + "/manage-sub-admin"; }, 1000); } else { toastr.error("Something went wrong"); @@ -80,4 +80,4 @@ $(".sub_admin_table").on("change", ".active_admin", function () { } }, }); -}); \ No newline at end of file +}); diff --git a/resources/views/Admin/pages/manage_users/manage_sub_admin/create.blade.php b/resources/views/Admin/pages/manage_users/manage_sub_admin/create.blade.php new file mode 100644 index 0000000..2ab11ac --- /dev/null +++ b/resources/views/Admin/pages/manage_users/manage_sub_admin/create.blade.php @@ -0,0 +1,100 @@ +@extends('admin.layouts.master') + +@section('content') + + + +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+ + + + +
+
+
+
+ + + + +
+
+ +
+
+ + +
+
+ @foreach ($sub_admins_module as $sub_admins_modules) +
+ + +
+ @endforeach + +
+
+
+
+ + +
+
+
+ +
+
+
+
+
+
+
+
+
+@endsection + + +@section('section_script') + +@endsection diff --git a/resources/views/Admin/pages/manage_users/manage_sub_admin/edit.blade.php b/resources/views/Admin/pages/manage_users/manage_sub_admin/edit.blade.php new file mode 100644 index 0000000..8ed88f6 --- /dev/null +++ b/resources/views/Admin/pages/manage_users/manage_sub_admin/edit.blade.php @@ -0,0 +1,82 @@ +@extends('admin.layouts.master') + +@section('content') + + +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ +
+
+ @foreach ($sub_admins_module as $sub_admin_module) +
+ moduleLinks->contains('manage_modules_xid', $sub_admin_module->id)) checked @endif> + +
+ @endforeach +
+
+
+ +
+
+
+
+
+
+ +
+
+
+ +@endsection + + +@section('section_script') + + + +@endsection diff --git a/resources/views/Admin/pages/manage_users/manage_sub_admin/manage_subadmin.blade.php b/resources/views/Admin/pages/manage_users/manage_sub_admin/manage_subadmin.blade.php index 4d5128e..f05f130 100644 --- a/resources/views/Admin/pages/manage_users/manage_sub_admin/manage_subadmin.blade.php +++ b/resources/views/Admin/pages/manage_users/manage_sub_admin/manage_subadmin.blade.php @@ -39,6 +39,7 @@ + @foreach ( $sub_admins_data as $sub_admins)
@@ -46,11 +47,11 @@
1 - Akanksha - akanksha@gmail.com - 08/22/2023 + {{ $sub_admins->first_name }} + {{ $sub_admins->email_address }} + {{ \Carbon\Carbon::parse($sub_admins->created_at)->format('d/m/y') }} - View + View
@@ -62,19 +63,19 @@
- - -
- -
- - 1 - Akanksha - akanksha@gmail.com - 08/22/2023 - - View - - -
- - -
- - - + @endforeach + @@ -134,32 +93,85 @@ + {{-- Premission-modal --}} + +{{-- Premission-modal End--}} + +{{-- Delete-modal --}} + +{{-- Delete-modal --}} @endsection + @section('section_script') + + + + -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/mail/subadmin.blade.php b/resources/views/mail/subadmin.blade.php new file mode 100644 index 0000000..7b1fd78 --- /dev/null +++ b/resources/views/mail/subadmin.blade.php @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + +
+
+ {{-- --}} +
+
+
+

+

+ {{--

Dear {{ $data['first_name'] }},

--}} +

Dear {{$mailData['username']}},

+ +

Congratulations! Your sub-admin account with Cheers to the session + has been successfully approved.

+ +

Your login credentials are as follows:

+
    +
  • User Name: {{$mailData['username']}}
  • + +
  • Password: {{$mailData['password']}}
  • +
+ +

You can now log in to your sub-admin dashboard to access your + account .

+ +

Please click on the link below to access your dashboard:

+

https://ctts.betadelivery.com +

+ +

If you have any questions or need further assistance, please + feel free to contact us.

+` +

Best regards,
Cheers to the session

+
+
+
+
+ + + + diff --git a/routes/web.php b/routes/web.php index aa5be89..e89a4d2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -46,6 +46,12 @@ Route::get('/manage-customer', [ ManageCustomerController ::class, 'index'])->na Route::get('/manage-restaurants', [ManageRestrauntController ::class, 'index'])->name('manage.restaurants'); //*******************************************************manage subadmin******************************************************** Route::get('/manage-sub-admin', [ ManageSubAdminController ::class, 'index'])->name('manage.subAdmin'); +Route::get('/create_sub_admin', [ManageSubAdminController::class, 'create'])->name('manage.sub_admin_create'); +Route::post('/insert_sub_admin', [ManageSubAdminController::class, 'store_subadmin']); +Route::delete('/manage_sub_admin/{id}', [ManageSubAdminController::class, 'delete_sub_admin']); +Route::get('/edit_sub_admin/{id}', [ManageSubAdminController::class, 'edit'])->name('sub_admin_edit'); +Route::post('/update_sub_admin', [ManageSubAdminController::class, 'update_subadmin']); +Route::get('/change_admin_status', [ManageSubAdminController::class, 'change_admin_status']); //*******************************************************manage passport******************************************************** Route::get('/manage-passport', [ ManagePassportController ::class, 'index'])->name('manage.passport'); //*******************************************************manage voucher******************************************************** From 6aa37e8ba0e3f65a9f6857cee83c58ddef8c52f1 Mon Sep 17 00:00:00 2001 From: sayaliparab Date: Wed, 29 May 2024 14:53:06 +0530 Subject: [PATCH 2/4] Changestoday --- .../RestaurantApi/RestAuthApiController.php | 69 ++++ .../Controllers/Admin/DashboardController.php | 143 ++++++- app/Models/ManageRestaurant.php | 23 ++ .../RestaurantService/RedeemApiService.php | 248 ++++++++++++ .../RestaurantService/RestAuthApiService.php | 364 ++++++++++++++++++ .../APIs/RestaurantService/RestCMSService.php | 176 +++++++++ .../RestaurantApiService.php | 213 ++++++++++ resources/views/Admin/dashboard.blade.php | 59 ++- .../pages/manage_cms/manage_cms.blade.php | 25 +- .../manage_new/manage_news_add.blade.php | 2 +- .../manage_privacy/manage_privacy.blade.php | 11 +- routes/restaurant_api.php | 54 +++ routes/web.php | 3 +- 13 files changed, 1361 insertions(+), 29 deletions(-) create mode 100644 app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php create mode 100644 app/Services/APIs/RestaurantService/RedeemApiService.php create mode 100644 app/Services/APIs/RestaurantService/RestAuthApiService.php create mode 100644 app/Services/APIs/RestaurantService/RestCMSService.php create mode 100644 app/Services/APIs/RestaurantService/RestaurantApiService.php create mode 100644 routes/restaurant_api.php diff --git a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php new file mode 100644 index 0000000..fcc87a3 --- /dev/null +++ b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php @@ -0,0 +1,69 @@ +RestAuthApiService = $RestAuthApiService; + } + + public function viewresyaurant() + { + try { + $response = $this->RestAuthApiService->viewresyaurant(); + return jsonResponseWithSuccessMessageApi(__('success.data_fetched_successfully'), $response, 200); + } catch (\Exception $e) { + Log::error('FAW get data controller function failed: ' . $e->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + public function restRegister(Request $request) + { + try { + $validator = Validator::make($request->all(), [ + 'first_name' => 'required|string|min:2|max:100', + 'last_name' => 'required|string|min:2|max:100', + 'role' => 'required|string|min:2|max:100', + 'restaurant_xid' => 'required', + 'date_of_birth' => 'required|date', + 'email_address' => [ + 'required', + 'string', + 'email', + 'max:100', + Rule::unique('iam_principal')->where(function ($query) { + return $query->where('principal_type_xid', 4)->whereNull('deleted_at'); + }), + ], + 'phone_number' => 'required|min:10', + ]); + + if ($validator->fails()) { + $validationErrors = $validator->errors()->all(); + Log::error("Registration validation error: " . implode(", ", $validationErrors)); + return jsonResponseWithErrorMessageApi($validationErrors, 403); + } + return $this->RestAuthApiService->restRegister($request); + } catch (\Exception $ex) { + Log::error("Registration API Failed: " . $ex->getMessage()); + return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500); + } + } + +} diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 0a49154..dc3adc9 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -4,12 +4,151 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use Illuminate\Http\Request; +use App\Models\IamPrincipal; +use Illuminate\Support\Facades\DB; +use App\Models\ManageRestaurant; + class DashboardController extends Controller { - public function index(){ + // public function showDashboard(){ - return view('Admin.dashboard'); + // 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]) + ->whereYear('created_at', date('Y')) + ->groupBy(DB::raw("MONTH(created_at)")) + ->orderBy(DB::raw("MONTH(created_at)")) + ->pluck('count', 'month') + ->toArray(); + + $dataMonthlyWithType4 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("MONTH(created_at) as month")) + ->whereIn('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; + } + } + + $dataQuarterlyWithType4 = IamPrincipal::select( + DB::raw("COUNT(*) as count"), + DB::raw("QUARTER(created_at) as quarter") + ) + ->whereIn('principal_type_xid', [4]) + ->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; + } + } + + // Yearly data + $dataYearlyWithType3 = IamPrincipal::select(DB::raw("COUNT(*) as count"), DB::raw("YEAR(created_at) as year")) + ->whereIn('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]) + ->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')); + } } diff --git a/app/Models/ManageRestaurant.php b/app/Models/ManageRestaurant.php index 1f2b4bf..dd3d597 100644 --- a/app/Models/ManageRestaurant.php +++ b/app/Models/ManageRestaurant.php @@ -8,7 +8,30 @@ use Illuminate\Database\Eloquent\Model; class ManageRestaurant extends Model { use HasFactory; + protected $table='manage_restaurants'; + protected $fillable=[ + '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' + ]; public function operatingHours() { return $this->hasMany(OperatingHour::class, 'manage_restaurant_xid'); diff --git a/app/Services/APIs/RestaurantService/RedeemApiService.php b/app/Services/APIs/RestaurantService/RedeemApiService.php new file mode 100644 index 0000000..6146e93 --- /dev/null +++ b/app/Services/APIs/RestaurantService/RedeemApiService.php @@ -0,0 +1,248 @@ +find($rest->id); + + $restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')->where('principal_xid', $rest->id)->get(); + + $restaurantDetail = []; + foreach ($restaurantRoles as $role) { + $restaurantImage = ManageVoucherModel::select('id', 'coupon_name', 'description', 'thumbnail_image', 'image', 'location_name')->find($role->restaurant_xid); + if ($restaurantImage) { + $restaurantImage->thumbnail_image = ListingImageUrl('voucher_thumbnail_images', $restaurantImage->thumbnail_image); + $restaurantImage->image = ListingImageUrl('voucher_images', $restaurantImage->image); + } + $restaurantDetail[] = $restaurantImage; + + $redeemedVouchers = []; + $redemptionUndoneVouchers = []; + + $vouchers = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone') + ->where('manage_vouchers_xid', $role->restaurant_xid) + ->where('is_redeem', 1) + ->get(); + + $redeemptionUndone = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone', 'redeemption_undone_date') + ->where('manage_vouchers_xid', $role->restaurant_xid) + ->where([['is_redeem', 0], ['is_redeemption_undone', 1]]) + ->get(); + + foreach ($vouchers as $voucher) { + $userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1') + ->where('id', $voucher->iam_principal_xid) + ->first(); + + if ($userDetail) { + if ($userDetail->profile_photo) { + $userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo); + } else { + $userDetail->profile_photo = asset('public/assets/img/blankProfile.png'); + } + + $voucher->user_detail = $userDetail; + $redeemedVouchers[] = $voucher; + } else { + + Log::error('User detail not found for IAM principal ID: ' . $voucher->iam_principal_xid); + } + } + + + foreach ($redeemptionUndone as $undone) { + $userDetail = IamPrincipal::select('id', 'first_name', 'email_address', 'profile_photo', 'address_line1') + ->where('id', $undone->iam_principal_xid) + ->first(); + + if ($userDetail) { + if ($userDetail->profile_photo) { + $userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo); + } else { + $userDetail->profile_photo = asset('public/assets/img/blankProfile.png'); + } + + $undone->user_detail = $userDetail; + $redemptionUndoneVouchers[] = $undone; + } else { + + Log::error('User detail not found for IAM principal ID: ' . $undone->iam_principal_xid); + } + } + + + $restaurantDetail['redeemed_vouchers'] = $redeemedVouchers; + $restaurantDetail['redemption_undone_vouchers'] = $redemptionUndoneVouchers; + } + + return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $restaurantDetail, 200); + } catch (Exception $ex) { + Log::error('Restaurant Get data service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + + + public function undoRedemption($restIamId, $request) + { + try { + $voucherDetail = MyPassportVoucher::with('passportData', 'voucherData')->where('id', $request->voucher_id)->first(); + if ($voucherDetail) { + $voucherDetail->update([ + 'is_redeem' => 0, + 'redeem_date' => null, + 'is_redeemption_undone' => 1, + 'redeemption_undone_date' => now(), + + ]); + $imagePath = ListingImageUrl('voucher_images', $voucherDetail->voucherData->image); + $customerTitle = "Your voucher was successfully undo redemption for " . $voucherDetail->passportData->passport_name; + $customerMessage = $voucherDetail->voucherData->coupon_name . " Voucher Undo Redemption Successfully"; + $customerContentType = 'Voucher_UndoRedemption'; + $customerImageUrl = $imagePath; + $customerData = IamPrincipal::where('id', $voucherDetail->iam_principal_xid)->where('notification_status', 1)->where('principal_type_xid', 3)->first(); + if ($customerData) { + $pushNotificationToCustomer = onesignalhelper::sendNotificationApi( + $customerData->one_signal_player_id, + $customerTitle, + $customerMessage, + $customerContentType, + $customerImageUrl, + $id = null + ); + + onesignalhelper::StoreNotificationDetails($customerData->id, $customerContentType, $customerTitle, $customerImageUrl); + } + $restUser = IamPrincipal::where('id', $restIamId)->where('notification_status', 1)->where('principal_type_xid', 4)->first(); + if ($restUser) { + $restImagePath = ListingImageUrl('voucher_images', $voucherDetail->voucherData->image); + $restTitle = "voucher Undo redemption successful for " . $voucherDetail->passportData->passport_name; + $restMessage = $voucherDetail->voucherData->coupon_name . " Voucher Undo Redemption Successfully"; + $restContentType = 'Voucher_UndoRedemption'; + $restImageUrl = $restImagePath; + + $pushNotificationToCustomer = onesignalhelper::restSendNotificationApi( + $restUser->one_signal_player_id, + $restTitle, + $restMessage, + $restContentType, + $restImageUrl, + $id = null + ); + + onesignalhelper::StoreNotificationDetails($restUser->id, $restContentType, $restTitle, $restImageUrl); + } + return jsonResponseWithSuccessMessageApi(__('auth.data_updated_successfully'), 200); + } else { + return jsonResponseWithErrorMessageApi(__('auth.voucher_not_found'), 404); + } + } catch (Exception $ex) { + Log::error('Restaurant update profile service failed: ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + + public function searchRedemption($restIamId, $request) + { + try { + $searchQuery = $request->input('search_data'); + + $rest = IamPrincipal::findOrFail($restIamId); + $data['user_detail'] = IamPrincipal::select('id', 'first_name', 'last_name', 'email_address', 'phone_number', 'date_of_birth')->find($rest->id); + + $restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')->where('principal_xid', $rest->id)->get(); + + $restaurantDetail = []; + foreach ($restaurantRoles as $role) { + $restaurantImage = ManageVoucherModel::select('id', 'coupon_name', 'description', 'thumbnail_image', 'image', 'location_name')->find($role->restaurant_xid); + if ($restaurantImage) { + $restaurantImage->thumbnail_image = ListingImageUrl('voucher_thumbnail_images', $restaurantImage->thumbnail_image); + $restaurantImage->image = ListingImageUrl('voucher_images', $restaurantImage->image); + } + $restaurantDetail[] = $restaurantImage; + + $redeemedVouchers = []; + $redemptionUndoneVouchers = []; + + $vouchers = MyPassportVoucher::select('id', 'order_xid', 'iam_principal_xid', 'manage_passports_xid', 'manage_vouchers_xid', 'is_redeem', 'count', 'redeem_date', 'is_redeemption_undone') + ->where('manage_vouchers_xid', $role->restaurant_xid) + ->where('is_redeem', 1) + ->get(); + + 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; + } + + return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $restaurantDetail, 200); + } catch (Exception $ex) { + Log::error('Restaurant Get data service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } +} diff --git a/app/Services/APIs/RestaurantService/RestAuthApiService.php b/app/Services/APIs/RestaurantService/RestAuthApiService.php new file mode 100644 index 0000000..9529edb --- /dev/null +++ b/app/Services/APIs/RestaurantService/RestAuthApiService.php @@ -0,0 +1,364 @@ +where('is_active', 1)->get()->toArray(); + return $data; + } catch (Exception $ex) { + DB::rollBack(); + Log::error('Terms and condition Get service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + + public function restRegister($request) + { + try { + DB::beginTransaction(); + $restaurantId = $request->input('restaurant_xid'); + + // Fetch the restaurant details based on the selected restaurantId + $selectedRestaurant = ManageVoucherModel::find($restaurantId); + + if (!$selectedRestaurant) { + return jsonResponseWithErrorMessageApi(__('auth.restaurant_data_not_found'), 403); + } + + // Create a new restaurant user record + $restaurantuser = 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('Cheers@123'), + 'principal_type_xid' => 4, //4 for restaurant + 'principal_source_xid' => 2, //2 for mobile + 'phone_number' => $request->phone_number, + 'date_of_birth' => $request->date_of_birth, + 'is_active' => '0', + ]); + + $restaurantUserRole = IamPrincipalRestaurantRole::create([ + 'principal_xid' => $restaurantuser->id, + 'role' => $request->role, + 'restaurant_xid' => $restaurantId, + ]); + + DB::commit(); + + // $token = auth()->login($restaurantuser); + + // Return response with user details, access token, and status + $response = [ + 'user' => $restaurantuser, + // 'restaurant_details' => $restaurantId, + // 'access_token' => $token, + 'token_type' => 'bearer', + 'status' => 'Your request has been sent. Kindly check your email.' + ]; + return jsonResponseWithSuccessMessage(__('auth.Rest_user_created'), $response, 200); + } catch (QueryException $e) { + // Rollback transaction in case of an error + DB::rollBack(); + Log::error('Restaurant Registration Failed ' . $e->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.authentication_failed'), 403); + } + } + + + public function login($request) + { + try { + $credentials = [ + 'email_address' => $request->email_address, + 'password' => $request->password, + ]; + + $isExistEmail = IamPrincipal::where('email_address', $request->email_address) + ->where('principal_type_xid', 4) + ->whereNull('deleted_at') + ->first(); + if ($isExistEmail == null) { + Log::error('Email not exist'); + return jsonResponseWithErrorMessageApi(__('auth.incorrect_email_passport'), 403); + } + if ($isExistEmail && !(Hash::check($request->password, $isExistEmail->password))) { + Log::error('Entered Password is wrong.'); + return jsonResponseWithErrorMessageApi(__('auth.incorrect_email_passport'), 403); + } + if (!$token = auth()->login($isExistEmail)) { + Log::error('Customer Login Failed'); + return jsonResponseWithErrorMessageApi(__('auth.authentication_failed'), 403); + } + + $isExistEmail->one_signal_player_id = $request->one_signal_player_id; + $isExistEmail->save(); + $response = [ + 'userId' => $isExistEmail->id, + 'access_token' => $token, + ]; + return jsonResponseWithSuccessMessage(__('auth.data_fetched_successfully'), $response, 200); + } catch (QueryException $e) { + + + Log::error('Customer Login Failed ' . $e->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.authentication_failed'), 403); + } + } + + + protected function responseWithToken($token, $isExistEmail) + { + return [ + 'message' => 'You have logged in successfully', + 'access_token' => $token, + 'token_type' => 'bearer', + 'status' => 'success', + 'iam_principal_id' => $isExistEmail->id + ]; + } + + + public function restForgotPassword($request) + { + try { + DB::beginTransaction(); + $user = IamPrincipal::where('email_address', $request->email_address) + ->where('principal_type_xid', 4) + ->whereNull('deleted_at') + ->first(); + //use this for both customer and restaurant just change principal_type_xid 4 + if ($user == null) { + Log::error('Email not exist'); + return jsonResponseWithErrorMessageApi(__('auth.incorrect_email'), 403); + } + // Define the generateOTP function + $otp = $this->generateOTP(); + + IamPrincipalOTP::updateOrCreate( + ['principal_xid' => $user->id], + [ + 'otp_code' => $otp, + 'otp_purpose' => 'forgot password', + 'valid_till' => Carbon::now()->addMinutes(2), + 'is_used' => 0, + ] + ); + + // $this->email_address = $user->email_address; + + $mail = Mail::send( + 'frontend.Mail.customer_forgot_password_mail', + [ + 'user' => $user, + 'otp_code' => $otp, + 'valid_till' => Carbon::now()->addMinutes(2) + ], + function ($message) use ($user) { + $message->to($user->email_address); + $message->subject('Forgot Password Mail Page'); + } + ); + + //sendmail end + $response = ['iam_principal_xid' => $user->id]; + DB::commit(); + Log::info('Customer Forgot Password otp sent successfully'); + return jsonResponseWithSuccessMessage(__('auth.otp_sent_successfully'), $response, 200); + } catch (\Exception $e) { + DB::rollBack(); + Log::error('Customer Forgot Password OTP function failed: ' . $e->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + public function restVerifyOTP($request) + { + try { + DB::beginTransaction(); + // Retrieve the user's OTP record + $User = IamPrincipal::where('email_address', $request->email_address) + ->where('principal_type_xid', 4) + ->whereNull('deleted_at') + ->first(); + + + $iamPrincipal = IamPrincipalOTP::where('principal_xid', $User->id) + ->first(); + + // Check if OTP record exists for the user + $errors = []; + + if (!$iamPrincipal) { + $errors[] = __('auth.failed_to_verify_otp'); + return jsonResponseWithErrorMessageApi( + $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 + ); + } + + // Check if the OTP is still valid + if (Carbon::now()->gt($iamPrincipal->valid_till)) { + $errors[] = __('auth.otp_expired'); + return jsonResponseWithErrorMessageApi( + $errors,403 + ); + } + + // Check if the OTP has already been used + if ($iamPrincipal->is_used === 1) { + $errors[] = __('auth.otp_already_used'); + return jsonResponseWithErrorMessageApi( + $errors,403 + ); + } + + + + // Mark OTP as used + $iamPrincipal->is_used = 1; + $iamPrincipal->save(); + DB::commit(); + $response = [ + 'iam_principal_xid' => $User->id + ]; + Log::info('Customer OTP verified successfully'); + return jsonResponseWithSuccessMessageApi(__('auth.otp_verified'), $response, 200); + } catch (\Exception $e) { + DB::rollBack(); + Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + public function restChangePassword($request) + { + try { + DB::beginTransaction(); + + $User = IamPrincipal::where('id', $request->iam_principal_xid) + ->where('is_active', 1) + ->first(); + + + $User->password = Hash::make($request->password); + $User->save(); + DB::commit(); + return $User; + } catch (\Exception $e) { + DB::rollBack(); + Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage()); + return response()->json(__('something_went_wrong'), 500); + } + } + public function restResendOtp($request) + { + try { + DB::beginTransaction(); + // Retrieve the user's OTP record + $iamPrincipal = IamPrincipalOTP::where('principal_xid', $request->iam_principal_xid) + ->first(); + $user = IamPrincipal::where('id', $request->iam_principal_xid) + ->where('is_active', '1') + ->first(); + + // Check if OTP record exists for the user + if (!$iamPrincipal) { + return jsonResponseWithErrorMessageApi(__('auth.not_found_otp'), 203); + } + + // Calculate the allowed resend interval (2 minutes) + $allowedResendInterval = Carbon::now()->subMinutes(2); + + // Check if the user can resend OTP only after a 2-minute interval + if ($iamPrincipal->updated_at >= $allowedResendInterval) { + + return jsonResponseWithErrorMessageApi(__('auth.try_resend_otp'), 429); + } + + // Generate a new OTP for the user + $otp = $this->generateOTP(); + + // Update the OTP record with the new OTP and validity + $iamPrincipal->principal_xid = $request->iam_principal_xid; + $iamPrincipal->otp_code = $otp; + $iamPrincipal->otp_purpose = $request->otp_purpose; + $iamPrincipal->valid_till = Carbon::now()->addMinutes(2); + $iamPrincipal->is_used = 0; + $iamPrincipal->save(); + + + // $this->email_address = $user->email_address; + + $mail = Mail::send( + 'frontend.Mail.customer_forgot_password_mail', + [ + 'user' => $user, + 'otp_code' => $otp, + 'valid_till' => Carbon::now()->addMinutes(2) + ], + function ($message) use ($user) { + $message->to($user->email_address); + $message->subject('Forgot Password Mail Page'); + } + ); + + + DB::commit(); + $response = [ + 'iam_principal_xid' => $iamPrincipal->principal_xid, + 'email_address' => $user->email_address + + ]; + + return jsonResponseWithSuccessMessageApi(__('auth.otp_resend_sent_successfully'), $response, 200); + } catch (\Exception $e) { + + DB::rollBack(); + Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage()); + return response()->json(__('something_went_wrong'), 500); + } + } + + function generateOTP() + { + // Define the length of the OTP + $otpLength = 4; + + // Generate a random OTP with $otpLength digits + $otp = ''; + for ($i = 0; $i < $otpLength; $i++) { + $otp .= rand(0, 9); + } + return $otp; + } +} diff --git a/app/Services/APIs/RestaurantService/RestCMSService.php b/app/Services/APIs/RestaurantService/RestCMSService.php new file mode 100644 index 0000000..ac13202 --- /dev/null +++ b/app/Services/APIs/RestaurantService/RestCMSService.php @@ -0,0 +1,176 @@ +where([['is_active', '1'], ['faq_category_id', '1']]) + ->get() + ->toArray(); + + $data['restaurant'] = Faq::select('id', 'question', 'answers') + ->where([['is_active', '1'], ['faq_category_id', '2']]) + ->get() + ->toArray(); + + return $data; + } catch (Exception $ex) { + DB::rollBack(); + Log::error('Faq Get service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + public function RestAboutUs() + { + try { + $data['customer'] = Aboutus::select('id', 'title', 'thumbnail_image', 'description', 'aboutus_category_xid') + ->where('aboutus_category_xid', '1') + ->get() + ->map(function ($item) { + $item['description'] = strip_tags($item['description']); + return $item; + }) + ->toArray(); + + $data['restaurant'] = Aboutus::select('id', 'title', 'thumbnail_image', 'description', 'aboutus_category_xid') + ->where('aboutus_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']); + } + + foreach ($data['restaurant'] as $k => $val) { + $data['restaurant'][$k]['thumbnail_image'] = ListingImageUrl('about_images', $val['thumbnail_image']); + } + + return $data; + } catch (Exception $ex) { + DB::rollBack(); + Log::error('About us Get service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + public function RestPrivacyPolicy() + { + try { + $data['customer'] = PrivacyPolicy::select('id', 'description') + ->where('terms_category_id', '1') + ->get() + ->map(function ($item) { + $item['description'] = strip_tags($item['description']); + return $item; + }) + ->toArray(); + + $data['restaurant'] = PrivacyPolicy::select('id', 'description') + ->where('terms_category_id', '2') + ->get() + ->map(function ($item) { + $item['description'] = strip_tags($item['description']); + return $item; + }) + ->toArray(); + return $data; + } catch (Exception $ex) { + DB::rollBack(); + Log::error('Privacy policy Get service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + public function RestNewsArticles() + { + try { + $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']); + return $item; + }) + ->toArray(); + + $data['restaurant'] = NewsArticle::select('id', 'name', 'description', 'thumbnail_image', 'image') + ->where([['is_active', '1'], ['news_articles_category_xid', '2']]) + ->get() + ->map(function ($item) { + $item['description'] = strip_tags($item['description']); + return $item; + }) + ->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']); + } + + //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']); + } + + return $data; + } catch (Exception $ex) { + DB::rollBack(); + Log::error('News and articles Get service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + public function RestContactUs($request) + { + try { + DB::beginTransaction(); + //create user_data + $user_data = IamPrincipal::where('id', $request['iam_principal_id'])->first(); + if ($user_data) { + // Create a new instance of ManageContactus model + $contact = new ManageContactus(); + $contact->principal_xid = $user_data->id; + $contact->name = $request->name; + $contact->email = $request->email; + $contact->message = $request->message; + // Save the contact data + $contact->save(); + + DB::commit(); + + //response data + Log::info('Contact form data Created successfully'); + return jsonResponseWithSuccessMessageApi(__('success.save_data'), [], 201); + } else { + Log::error('Contact not found in addVendorContactForm.'); + return jsonResponseWithErrorMessageApi(__('auth.validation_failed'), 403); + } + } catch (Throwable $ex) { + DB::rollBack(); + Log::error('Contact API failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } +} diff --git a/app/Services/APIs/RestaurantService/RestaurantApiService.php b/app/Services/APIs/RestaurantService/RestaurantApiService.php new file mode 100644 index 0000000..4ff9e9a --- /dev/null +++ b/app/Services/APIs/RestaurantService/RestaurantApiService.php @@ -0,0 +1,213 @@ +findOrFail($restIamId); + + // Set profile photo + if ($userDetail->profile_photo) { + $userDetail->profile_photo = ListingImageUrl('profile_image', $userDetail->profile_photo); + } else { + $userDetail->profile_photo = asset('public/assets/img/blankProfile.png'); + } + + // Find restaurant roles associated with the user + $restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role') + ->where('principal_xid', $userDetail->id) + ->get(); + + // $restaurantDetails = []; + + foreach ($restaurantRoles as $restaurantRole) { + $restaurant = ManageVoucherModel::select('id', 'coupon_name', 'description', 'coupon_id', 'thumbnail_image', 'image', 'location_name', 'bio', 'try_on_1', 'try_on_2', 'try_on_3', 'try_on_4', 'try_on_5', 'phone_number') + ->where('id', $restaurantRole->restaurant_xid) + ->where('is_active', 1) + ->first(); + + if ($restaurant) { + $restaurant->image = ListingImageUrl('voucher_images', $restaurant->image); + $restaurant->thumbnail_image = ListingImageUrl('voucher_thumbnail_images', $restaurant->thumbnail_image); + $restaurant->description = strip_tags($restaurant->description); + + // $restaurantDetails[] = $restaurant; + } + } + + // Construct response + $response = [ + 'user_detail' => $userDetail, + 'restaurant_details' => $restaurant, + ]; + + // Return JSON response with success message + return jsonResponseWithSuccessMessageApi(__('auth.User_details_fetch'), $response, 200); + } catch (Exception $ex) { + // Log error and return error response + Log::error('Restaurant Get data service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + + + public function updateRestaurantDetail($restIamId, $request) + { + try { + DB::beginTransaction(); + $data = IamPrincipal::findOrFail($restIamId); + if (!$data) { + DB::rollBack(); + return jsonResponseWithErrorMessageApi(__('auth.user_not_found'), 404); + } + $restaurantRoles = IamPrincipalRestaurantRole::select('id', 'principal_xid', 'restaurant_xid', 'role')->where('principal_xid', $restIamId)->get(); + if ($restaurantRoles->isEmpty()) { + DB::rollBack(); + return jsonResponseWithErrorMessageApi(__('auth.restaurant_data_not_found'), 404); + } + $restaurantRole = $restaurantRoles->first(); + $restaurant = ManageVoucherModel::findOrFail($restaurantRole->restaurant_xid); + if (!$restaurant) { + DB::rollBack(); + return jsonResponseWithErrorMessageApi(__('error_message.restaurant_data_not_found'), 404); + } + + $restaurant->update([ + 'coupon_name' => $request['restaurant_name'], + 'description' => $request['description'], + 'location_name' => $request['location'], + 'bio' => $request['bio'], + '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'], + 'try_on_5' => $request['try_on_5'], + 'phone_number' => $request['phone_number'], + ]); + $restaurant->description = strip_tags($restaurant->description); + + DB::commit(); + return jsonResponseWithSuccessMessageApi(__('auth.data_updated_successfully'), $restaurant, 200); + } catch (Exception $ex) { + DB::rollBack(); + Log::error('Restaurant update profile service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + + + public function updateRestProfileDetail($restIamId, $request) + { + try { + DB::beginTransaction(); + $data = IamPrincipal::select('id', 'first_name', 'last_name', 'email_address', 'phone_number', 'date_of_birth')->findOrFail($restIamId); + if (!$data) { + DB::rollBack(); + return jsonResponseWithErrorMessage(__('error_message.user_details_not_found'), 404); + } + + if ($request->has('image')) { + $image = $request->image; + $tnormalImage = saveSingleImageWithoutCrop($image, 'profile_image', null); + $data->update(['profile_photo' => $tnormalImage]); + DB::commit(); + + } + if ($request->has('first_name')) { + $data->first_name = $request->first_name; + $data->save(); + DB::commit(); + } + if ($request->has('last_name')) { + $data->last_name = $request->last_name; + $data->save(); + DB::commit(); + } + if ($request->has('date_of_birth')) { + $data->date_of_birth = $request->date_of_birth; + $data->save(); + DB::commit(); + } + if ($request->has('phone_number')) { + $data->phone_number = $request->phone_number; + $data->save(); + DB::commit(); + } + + if ($request->has('email_address')) { + $email = $request->input('email_address'); + if ($email !== $data->email_address) { + $existingUser = IamPrincipal::where('email_address', $email) + ->where('id', '!=', $restIamId) + ->whereNull('deleted_at') + ->where('principal_type_xid', 4) + ->exists(); + + if ($existingUser) { + DB::rollBack(); + return jsonResponseWithErrorMessageApi(__('auth.email_already_exist'), 400); + } + } + } + // $data->update([ + // 'first_name' => $request['first_name'], + // 'last_name' => $request['last_name'], + // 'email_address' => $request['email_address'], + // 'phone_number' => $request['phone_number'], + // 'date_of_birth' => $request['date_of_birth'], + // ]); + $data->save(); + DB::commit(); + return jsonResponseWithSuccessMessageApi(__('auth.data_updated_successfully'), $data, 200); + } catch (Exception $ex) { + DB::rollBack(); + + Log::error('Restaurant update profile service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } + + public function resetRestPassword($restIamId, $request) + { + try { + DB::beginTransaction(); + $user = IamPrincipal::findOrFail($restIamId); + if (!Hash::check($request->current_password, $user->password)) { + DB::rollBack(); + return jsonResponseWithErrorMessageApi(__('auth.invalid_current_passsword'), 403); + } else { + $user->update([ + 'password' => Hash::make($request->new_password) + ]); + DB::commit(); + return jsonResponseWithSuccessMessageApi(__('auth.password_updated_successfully'), $user); + } + } catch (Exception $ex) { + DB::rollBack(); + Log::error('Update password service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } +} diff --git a/resources/views/Admin/dashboard.blade.php b/resources/views/Admin/dashboard.blade.php index 2afaced..b6b7578 100644 --- a/resources/views/Admin/dashboard.blade.php +++ b/resources/views/Admin/dashboard.blade.php @@ -18,7 +18,7 @@
No of Customers
-

08

+

{{ $customerCount }}

@@ -55,7 +55,7 @@
No of Restaurants
-

05

+

{{ $restaurantCount }}

@@ -66,7 +66,7 @@
User Graph
- @@ -664,5 +664,58 @@ // --------- Sales chart ends ------------ }); + // Add event listener to the filter select element + document.getElementById('graph-filter').addEventListener('change', function(event) { + var selectedFilter = event.target.value; + userChartData = getUserChartData(selectedFilter); // Get data based on selected filter + userCategories = getUserChartCategories(selectedFilter); // Update x-axis categories + + userChart.updateSeries(userChartData); // Update chart data + userChart.updateOptions({ + xaxis: { + categories: userCategories + } + }); // Update chart options + }); + // Function to fetch data based on selected filter + function getUserChartData(filter) { + switch (filter) { + case 'monthly': + return [{ + name: 'Customer', + data: + }, + { + name: 'Restaurant', + data: + } + ]; + case 'quarterly': + return [{ + name: 'Customer', + data: + }, + { + name: 'Restaurant', + data: + } + ]; + case 'yearly': + return [{ + name: 'Customer', + data: + }, + { + name: 'Restaurant', + data: + } + ]; + default: + return []; + } + } + + + @endsection diff --git a/resources/views/Admin/pages/manage_cms/manage_cms.blade.php b/resources/views/Admin/pages/manage_cms/manage_cms.blade.php index 9dc2ab6..63b8326 100644 --- a/resources/views/Admin/pages/manage_cms/manage_cms.blade.php +++ b/resources/views/Admin/pages/manage_cms/manage_cms.blade.php @@ -30,18 +30,7 @@
- + + diff --git a/resources/views/Admin/pages/manage_cms/manage_new/manage_news_add.blade.php b/resources/views/Admin/pages/manage_cms/manage_new/manage_news_add.blade.php index 243e64f..c3d4393 100644 --- a/resources/views/Admin/pages/manage_cms/manage_new/manage_news_add.blade.php +++ b/resources/views/Admin/pages/manage_cms/manage_new/manage_news_add.blade.php @@ -28,7 +28,7 @@
diff --git a/resources/views/Admin/pages/manage_cms/manage_privacy/manage_privacy.blade.php b/resources/views/Admin/pages/manage_cms/manage_privacy/manage_privacy.blade.php index 94af4d4..8d97a15 100644 --- a/resources/views/Admin/pages/manage_cms/manage_privacy/manage_privacy.blade.php +++ b/resources/views/Admin/pages/manage_cms/manage_privacy/manage_privacy.blade.php @@ -81,14 +81,6 @@ $currentPage = 'manage-privacy';
-->
-<<<<<<< HEAD -
-
-
-
-
-
Privacy Policy Customer
-=======
@@ -102,9 +94,8 @@ $currentPage = 'manage-privacy'; Edit Details @else -

No privacy policy found.

+ @endif ->>>>>>> 33b9291463be7ddd790f7b5ed76ca2194c266440 @if(!empty($view_privacy )) diff --git a/routes/restaurant_api.php b/routes/restaurant_api.php new file mode 100644 index 0000000..a640150 --- /dev/null +++ b/routes/restaurant_api.php @@ -0,0 +1,54 @@ +group(function () { + // Define your routes here + Route::get('/v1/list-restaurant', [RestAuthApiController::class, 'viewresyaurant']); + Route::post('/v1/rest-register', [RestAuthApiController::class, 'restRegister']); + Route::post('/v1/rest-login', [RestAuthApiController::class, 'login']); + Route::post('/v1/rest-forgot-password', [RestAuthApiController::class, 'restForgotPassword']); + Route::post('/v1/rest-verify-otp', [RestAuthApiController::class, 'restVerifyOTP']); + Route::post('/v1/rest-change-password', [RestAuthApiController::class, 'restChangePassword']); + Route::post('/v1/rest-resend-otp', [RestAuthApiController::class, 'restResendOtp']); + + // Route::group(['middleware' => ['restaurant.jwt.verify']], function () { + // //*******************************************************Restaurant profile******************************************************** + // Route::get('/v1/fetch-restaurant-profile', [RestaurantControllerApi::class, 'getRestProfileDetail']); + // Route::post('/v1/update-restaurant-profile', [RestaurantControllerApi::class, 'updateRestProfileDetail']); + // Route::post('/v1/update-restaurant-detail', [RestaurantControllerApi::class, 'updateRestaurantDetail']); + // Route::post('/v1/reset-restaurant-password', [RestaurantControllerApi::class, 'resetRestPassword']); + // Route::post('/v1/restaurant-logout', [RestaurantControllerApi::class, 'restaurantLogout']); + // Route::post('/v1/restaurant-delete_account', [RestaurantControllerApi::class, 'restDeleteAccount']); + + + + + // //*******************************************************Redeemption Data******************************************************** + + // Route::get('/v1/fetch-redeem-data', [RedeemControllerApi::class, 'getRedemedData']); + // Route::post('/v1/undo-redemption', [RedeemControllerApi::class, 'undoRedemption']); + // Route::post('/v1/search-Redemption-data', [RedeemControllerApi::class, 'searchRedemption']); + + // //*******************************************************CMS******************************************************** + + // Route::get('/v1/list-of-restaurant-faqs', [RestCMSController::class, 'RestGetFaq']); + // Route::get('/v1/list-of-restaurant-about-us', [RestCMSController::class, 'RestAboutUs']); + // Route::get('/v1/list-of-restaurant-privacy-policy', [RestCMSController::class, 'RestPrivacyPolicy']); + // Route::get('/v1/list-of-restaurant-news-articles', [RestCMSController::class, 'RestNewsArticles']); + // Route::post('/v1/restaurant-contact-us', [RestCMSController::class, 'RestContactUs']); + + + // //*******************************************************notification******************************************************** + // Route::get('/v1/get-notification', [RestNotificationController::class, 'getRestNotificationApi']); + // Route::post('/v1/send-notification', [RestNotificationController::class, 'sendRestNotificationApi']); + // Route::post('/v1/alert-notification', [RestNotificationController::class, 'sendAlertNotificationApi']); + // }); +}); diff --git a/routes/web.php b/routes/web.php index d7581a9..8d49a8b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -35,7 +35,8 @@ Route::get('/logout', [LoginController::class, 'logout'])->name('logout'); Route::group(['middleware' => ['checkStatus']], function () { -Route::get('/dashboard', [DashboardController ::class, 'index'])->name('dashboard'); +// Route::get('/dashboard', [DashboardController ::class, 'index'])->name('dashboard'); +Route::get('/dashboard', [DashboardController::class, 'showDashboard'])->name('dashboard'); Route::get('/profile', [ManageProfileController ::class, 'index'])->name('profile'); From cda59f7828f18b093c96109bb9787f38e786e240 Mon Sep 17 00:00:00 2001 From: Shailesh-1981 <86923815+Shailesh-1981@users.noreply.github.com> Date: Wed, 29 May 2024 14:54:27 +0530 Subject: [PATCH 3/4] change paths --- .../Controllers/Admin/ManageSubAdminController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Admin/ManageSubAdminController.php b/app/Http/Controllers/Admin/ManageSubAdminController.php index 28c804a..d6a20e0 100644 --- a/app/Http/Controllers/Admin/ManageSubAdminController.php +++ b/app/Http/Controllers/Admin/ManageSubAdminController.php @@ -25,8 +25,8 @@ class ManageSubAdminController extends Controller public function create() { $sub_admins_module = ManageModule::latest()->get(); - - return view('admin.pages.manage_users.manage_sub_admin.create', compact('sub_admins_module')); + + return view('Admin.pages.manage_users.manage_sub_admin.create', compact('sub_admins_module')); } public function store_subadmin(Request $request) @@ -34,9 +34,9 @@ class ManageSubAdminController extends Controller /* - Created By : Megha - Created at : 12 Feb 2024 - Use : To store sub admin form. + Created By : shailesh Gupta + Created at : 29 May 2024 + Use : To store sub admin form and email */ try { @@ -92,7 +92,7 @@ class ManageSubAdminController extends Controller $edit_sub_admin = IamPrincipal::with(['moduleLinks' => function ($query) { $query->with('module'); }])->find($id); - return view('admin.pages.manage_users.manage_sub_admin.edit', compact('edit_sub_admin', 'sub_admins_module')); + return view('Admin.pages.manage_users.manage_sub_admin.edit', compact('edit_sub_admin', 'sub_admins_module')); } public function delete_sub_admin($id) From 821b3c352d617177ce36ede615b2e11dac04c43c Mon Sep 17 00:00:00 2001 From: Shailesh-1981 <86923815+Shailesh-1981@users.noreply.github.com> Date: Wed, 29 May 2024 15:02:13 +0530 Subject: [PATCH 4/4] change paths --- .../Admin/pages/manage_users/manage_sub_admin/create.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/Admin/pages/manage_users/manage_sub_admin/create.blade.php b/resources/views/Admin/pages/manage_users/manage_sub_admin/create.blade.php index 2ab11ac..6496cf3 100644 --- a/resources/views/Admin/pages/manage_users/manage_sub_admin/create.blade.php +++ b/resources/views/Admin/pages/manage_users/manage_sub_admin/create.blade.php @@ -1,4 +1,4 @@ -@extends('admin.layouts.master') +@extends('Admin.layouts.master') @section('content')