diff --git a/app/Http/Controllers/Admin/RestaurantAppController.php b/app/Http/Controllers/Admin/RestaurantAppController.php index 3f1b79b..5c75911 100644 --- a/app/Http/Controllers/Admin/RestaurantAppController.php +++ b/app/Http/Controllers/Admin/RestaurantAppController.php @@ -9,6 +9,7 @@ use Illuminate\Support\Facades\DB; use App\Models\IamPrincipal; use App\Models\ManageRestaurant; use App\Mail\RestUserApproval; +use App\Models\IamPrincipalRestaurantRole; use Illuminate\Support\Facades\Mail; @@ -18,7 +19,10 @@ use Exception; class RestaurantAppController extends Controller { - + + + + public function index_restraunt_users(Request $request) { @@ -37,7 +41,8 @@ class RestaurantAppController extends Controller } foreach ($restaurant_users as $user) { $restaurantIds = $user->getresturant->pluck('restaurant_xid')->toArray(); - // $user->vouchers = ManageVoucherModel::whereIn('id', $restaurantIds)->get(); + + // $user->vouchers = ManageRestaurant::whereIn('id', $restaurantIds)->get(); } return view('admin.pages.manage_users.restaurants_app.restaurants_users', compact('restaurant_users')); } catch (Exception $e) { @@ -129,6 +134,79 @@ class RestaurantAppController extends Controller } } +// public function view_rest($id) +// { + +// try { +// $restaurantView = IamPrincipal::findOrFail($id); +// // dd($restaurantView); +// return view('Admin.pages.manage_users.restaurants_app.view_restaurant_users', compact('restaurantView')); +// } catch (Exception $e) { +// Log::error("Manage Voucher Page Not Load " . $e->getMessage()); +// return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500); +// } +// } + +// public function view_rest($id) +// { +// try { +// $restaurantView = IamPrincipal::findOrFail($id); +// return view('Admin.pages.manage_users.restaurants_app.view_restaurant_users', compact('restaurantView')); +// } catch (Exception $e) { +// Log::error("Manage Voucher Page Not Load " . $e->getMessage()); +// return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500); +// } +// } + +public function view_rest($id) +{ + try { + $restaurantView = IamPrincipal::with('restaurant')->findOrFail($id); + return view('Admin.pages.manage_users.restaurants_app.view_restaurant_users', compact('restaurantView')); + } catch (Exception $e) { + Log::error("Manage Voucher Page Not Load " . $e->getMessage()); + return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500); + } +} + + + + + +public function edit_Restaurant($id) + { + + try { + $editRest = IamPrincipal::findOrFail($id); + return view('Admin.pages.manage_users.restaurants_app.edit_restaurant_users', compact('editRest')); + } catch (Exception $e) { + Log::error("Manage Voucher Page Not Load " . $e->getMessage()); + return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500); + } + } + + 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); + } + } } diff --git a/app/Models/IamPrincipal.php b/app/Models/IamPrincipal.php index 30673c0..d9a245b 100644 --- a/app/Models/IamPrincipal.php +++ b/app/Models/IamPrincipal.php @@ -62,7 +62,7 @@ class IamPrincipal extends Authenticatable implements JWTSubject return $customerCount; } - + // protected $fillable = @@ -173,4 +173,18 @@ class IamPrincipal extends Authenticatable implements JWTSubject { return $this->belongsTo(ManageState::class, 'state_xid', 'id'); } + public function roles() + { + return $this->hasMany(IamPrincipalRestaurantRole::class, 'id', 'principal_xid'); + } + // public function restaurants() + // { + // return $this->hasMany(ManageRestaurant::class, 'restaurant_id', 'id'); + // } + + public function restaurant() +{ + return $this->hasMany(ManageRestaurant::class, 'id', 'restaurant_xid'); +} + } diff --git a/app/Models/IamPrincipalRestaurantRole.php b/app/Models/IamPrincipalRestaurantRole.php index e15a2e8..5fcc673 100644 --- a/app/Models/IamPrincipalRestaurantRole.php +++ b/app/Models/IamPrincipalRestaurantRole.php @@ -17,4 +17,7 @@ class IamPrincipalRestaurantRole extends Model 'created_by', 'modified_by', ]; + + + } diff --git a/app/Models/ManageRestaurant.php b/app/Models/ManageRestaurant.php index 9b5dcc7..8fd0202 100644 --- a/app/Models/ManageRestaurant.php +++ b/app/Models/ManageRestaurant.php @@ -10,6 +10,8 @@ use Illuminate\Support\Str; use Illuminate\Database\Eloquent\Model; use App\Models\ManageState; +use App\Models\IamPrincipalRestaurantRole; + class ManageRestaurant extends Model @@ -51,4 +53,7 @@ class ManageRestaurant extends Model { return $this->belongsTo(ManageState::class, 'state_xid', 'id'); } + + + } diff --git a/public/assets/js/admin/manage_restaurant/main.js b/public/assets/js/admin/manage_restaurant/main.js index 426115e..c68e454 100644 --- a/public/assets/js/admin/manage_restaurant/main.js +++ b/public/assets/js/admin/manage_restaurant/main.js @@ -256,3 +256,106 @@ $(document).on("click", ".restaurant_unarchive", function (e) { }); + $('#restaurant_user_form').validate({ + ignore: [], + debug: false, + rules: { + restaurant_name: { + required: true, + fullNameCharactersOnly: true + }, + restaurant_des:{ + required: true, + }, + restaurant_Id:{ + required: true, + }, + restaurant_loc:{ + required: true, + }, + restaurant_email: { + required: true, + email: true, + }, + restaurant_image: { + required: true, + }, + restaurant_phone: { + required: true, + numericCharactersOnly: true + }, + restaurant_bio:{ + required: true, + }, + }, + messages: { + restaurant_name: { + required: "Enter Passport Name", + alphaCharactersOnly: "Please enter only alphabetical characters" + }, + restaurant_des:{ + required: "Please enter description", + }, + restaurant_Id:{ + required: "Please enter restaurant Id", + }, + restaurant_loc:{ + required: "Please enter location", + }, + restaurant_email: { + required: "Enter email address", + email: "Please enter a valid email address" + }, + restaurant_image: { + required: "Please select the image", + }, + restaurant_phone: { + required: "Enter Phone Number", + numericCharactersOnly: "Please enter only numeric characters" + }, + restaurant_bio:{ + required: "Please enter bio", + }, + }, + errorClass: 'error-message', + submitHandler: function(form) { + let base_url = url_path; + var formData = new FormData(form); + + $('#restaturant_user_btn').text('Please wait...'); + $('#restaturant_user_btn').attr('disabled', true); + + $.ajaxSetup({ + headers: { + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') + } + }); + $.ajax({ + url: base_url + '/update_restaurant', + type: 'POST', + data: formData, + processData: false, + contentType: false, + success: function(result) { + + if (result.status_code == 200) { + toastr.success('Restaurant Updated Sucessfully'); + setTimeout(function() { + window.location.href = base_url + "/restaurant_users"; + }, 2000); + } else { + toastr.error('Something Went Wrong'); + setTimeout(function() { + window.location.href = base_url + "/restaurant_users"; + }, 2000); + } + $('#restaturant_user_btn').attr('disabled', false); + $('#restaturant_user_btn').text('Submit'); + }, + + }); + + $('#restaturant_user_btn').attr('disabled', false); + $('#restaturant_user_btn').text('Submit'); + } + }); \ No newline at end of file diff --git a/resources/views/Admin/pages/manage_users/restaurants_app/edit_restaurant_users.blade.php b/resources/views/Admin/pages/manage_users/restaurants_app/edit_restaurant_users.blade.php new file mode 100644 index 0000000..8730824 --- /dev/null +++ b/resources/views/Admin/pages/manage_users/restaurants_app/edit_restaurant_users.blade.php @@ -0,0 +1,147 @@ +@extends('Admin.layouts.master') + +@section('content') +@php +$currentPage = 'manage-restaurant_app'; +@endphp + + + + +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ + +
+
+
+
+ + + + + +
+
+
+ +
+
+
+
+
+
+ +
+
+
+ + +@endsection +@section('section_script') + + + + +@endsection \ No newline at end of file diff --git a/resources/views/Admin/pages/manage_users/restaurants_app/restaurants_users.blade.php b/resources/views/Admin/pages/manage_users/restaurants_app/restaurants_users.blade.php index 4848c9c..3b8f631 100644 --- a/resources/views/Admin/pages/manage_users/restaurants_app/restaurants_users.blade.php +++ b/resources/views/Admin/pages/manage_users/restaurants_app/restaurants_users.blade.php @@ -33,6 +33,54 @@ $currentPage = 'manage-restaurant_app'; color: #fff; } + +
@@ -67,6 +115,7 @@ $currentPage = 'manage-restaurant_app'; Approve/Disapprove Action + @@ -81,7 +130,11 @@ $currentPage = 'manage-restaurant_app';
--}} {{ $loop->iteration }} - {{ $restaurant_user->first_name }} + {{ $restaurant_user->first_name}} + + + + {{ $restaurant_user->id }} {{ $restaurant_user->email_address }} @@ -119,10 +172,10 @@ $currentPage = 'manage-restaurant_app';
- {{-- + + + + + + View + + + Edit + + + Archive + + @endforeach @@ -284,4 +349,9 @@ $currentPage = 'manage-restaurant_app'; } } + @endsection \ No newline at end of file diff --git a/resources/views/Admin/pages/manage_users/restaurants_app/view_restaurant_users.blade.php b/resources/views/Admin/pages/manage_users/restaurants_app/view_restaurant_users.blade.php new file mode 100644 index 0000000..b24a8ea --- /dev/null +++ b/resources/views/Admin/pages/manage_users/restaurants_app/view_restaurant_users.blade.php @@ -0,0 +1,133 @@ +@extends('Admin.layouts.master') + +@section('content') +@php +$currentPage = 'manage-restaurant_app'; +@endphp + + + + +
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + +
Restaurants Name :Restaurant ID :Email ID :Description :Start Date :Image :
{{ $restaurantView->first_name ?? 'NA' }}{{ $restaurantView->id }}{{ $restaurantView->email_address }}{{ $restaurantView->description }}{{ \Carbon\Carbon::parse($restaurantView->date_of_birth)->format('d/m/Y') }}
+ +
+
+ + + + + + + + + + + + + + + + + + +
Location :Onboarded date :Phone Number :Bio :End Date :While at Restaurant be sure to try :
{{ $restaurantView->state->name}}{{ \Carbon\Carbon::parse($restaurantView->created_at)->format('d-m-y') }}{{ $restaurantView->phone_number}}lorem ipsum19/12/2023 +

Lorem Ipsum Lorem Ipsum

+

Lorem Ipsum Lorem Ipsum

+

Lorem Ipsum Lorem Ipsum

+

Lorem Ipsum Lorem Ipsum

+ +
+
+ +
+ +
+
+ +
+ + +
+ +
+
+
+
+
+ + + + +@endsection + +@section('section_script') + +@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 5ea5582..3a57799 100644 --- a/routes/web.php +++ b/routes/web.php @@ -61,6 +61,10 @@ Route::post('/manage_customer_unarchive/{id}', [ManageCustomerController::class, Route::get('/restaurant_users', [RestaurantAppController::class, 'index_restraunt_users'])->name('restraunt_users'); Route::get('/change_rest_status', [RestaurantAppController::class, 'change_rest_user_status']); +Route::get('/view_restaurant_users/{id}', [RestaurantAppController::class, 'view_rest'])->name('restaurantViewUsers'); +Route::get('/edit_restaurant_users/{id}', [RestaurantAppController::class, 'edit_Restaurant'])->name('EditRestUsers'); +Route::post('/update_restaurant', [RestaurantAppController::class, 'updateRest']); + //*******************************************************manage subadmin******************************************************** Route::get('/manage-sub-admin', [ ManageSubAdminController ::class, 'index'])->name('manage.subAdmin');