From 5da562ab214341cd7c3e7b160abce42ee6e14f54 Mon Sep 17 00:00:00 2001 From: Lupu Gheorghe Date: Mon, 26 Jun 2023 04:39:45 +0300 Subject: [PATCH] fix issue #34 fix #35 fix #36 --- .../Controllers/Ngo/VolunteerController.php | 24 +++ .../js/Components/modals/ModalAction.vue | 164 +++++++++++++----- .../Pages/AdminOng/Volunteers/Volunteers.vue | 27 +-- routes/volunteers.php | 3 + 4 files changed, 164 insertions(+), 54 deletions(-) diff --git a/app/Http/Controllers/Ngo/VolunteerController.php b/app/Http/Controllers/Ngo/VolunteerController.php index d50a54db..428ab12b 100644 --- a/app/Http/Controllers/Ngo/VolunteerController.php +++ b/app/Http/Controllers/Ngo/VolunteerController.php @@ -26,4 +26,28 @@ public function index(Request $request, $status = '') ] ); } + + public function approve(Request $request, $id) + { + $volunteer = Volunteer::findOrFail($id); + $volunteer->status = 'approved'; + $volunteer->save(); + return redirect()->back()->with('success', 'Voluntarul a fost aprobat cu succes'); + } + + public function reject(Request $request, $id) + { + $volunteer = Volunteer::findOrFail($id); + $volunteer->status = 'rejected'; + $volunteer->save(); + return redirect()->back()->with('success', 'Voluntarul a fost respins cu succes'); + } + +public function delete(Request $request, $id) + { + $volunteer = Volunteer::findOrFail($id); + $projectsIds =$request->get('project_ids',[]); + $volunteer->projects()->detach($projectsIds); + return redirect()->back()->with('success', 'Voluntarul a fost sters cu succes'); + } } diff --git a/resources/js/Components/modals/ModalAction.vue b/resources/js/Components/modals/ModalAction.vue index 35692a9d..66bad8a2 100644 --- a/resources/js/Components/modals/ModalAction.vue +++ b/resources/js/Components/modals/ModalAction.vue @@ -10,21 +10,31 @@ - -
+ +
- - + +
-
-