From bce9a430aa5bed2d32cbfb5e0f0d91ca5c3b6ef3 Mon Sep 17 00:00:00 2001 From: ro Date: Thu, 8 Feb 2024 14:37:34 -0600 Subject: [PATCH] Appeal Process upgrade Changed the appeal process so that each request is tracked in the database to make reviewing and time limits easier to manage. An email is still sent but it's just a notifcation to let the admin know an appeal has been filed. --- app/Http/Controllers/AppealController.php | 49 +++++++++++++++++++ app/Http/Controllers/AppealMailController.php | 30 ------------ app/Models/Appeal.php | 34 +++++++++++++ public/assets/css/global/frame.css | 5 ++ resources/views/email/appeal.blade.php | 4 +- resources/views/front/appeals.blade.php | 7 ++- routes/web.php | 4 +- 7 files changed, 96 insertions(+), 37 deletions(-) create mode 100644 app/Http/Controllers/AppealController.php delete mode 100644 app/Http/Controllers/AppealMailController.php create mode 100644 app/Models/Appeal.php diff --git a/app/Http/Controllers/AppealController.php b/app/Http/Controllers/AppealController.php new file mode 100644 index 0000000..c676a3d --- /dev/null +++ b/app/Http/Controllers/AppealController.php @@ -0,0 +1,49 @@ +order_id); + $token = csrf_token(); + + if ($request->h1 != '' || $request->question != 2) { + return back()->withErrors([ + 'error' => 'Invalid Request', + ]); + } else { + $check = Appeal::where("location", $request->location)->first(); + + if ($check) { + return back()->withErrors([ + 'error' => 'Appeal already in process for Location', + ]); + } else { + $new = Appeal::create([ + 'uuid' => Uuid::uuid4(), + 'location' => $request->location, + 'location_admin' => $request->location_admin, + 'sponsor' => $request->sponsor, + 'description' => $request->appeal_description, + 'approved' => false, + 'reviewed' => false, + ]); + Mail::to(env('TBS_ADMIN_EMAIL'))->send(new LocationAppeal($request->location, $request->sponsor)); + } + + //return redirect('/appeals'); + return back()->with('message', "Appeal Filed"); + }; + } +} diff --git a/app/Http/Controllers/AppealMailController.php b/app/Http/Controllers/AppealMailController.php deleted file mode 100644 index 476c830..0000000 --- a/app/Http/Controllers/AppealMailController.php +++ /dev/null @@ -1,30 +0,0 @@ -order_id); - $token = csrf_token(); - - if ($request->h1 != '' || $request->question != 2) { - return back()->withErrors([ - 'error' => 'Invalid Request', - ]); - } else { - Mail::to(env('TBS_ADMIN_EMAIL'))->send(new LocationAppeal($request->location, $request->sponsor)); - - //return redirect('/appeals'); - return back()->with('message', "Appeal Filed"); - }; - } -} diff --git a/app/Models/Appeal.php b/app/Models/Appeal.php new file mode 100644 index 0000000..9072639 --- /dev/null +++ b/app/Models/Appeal.php @@ -0,0 +1,34 @@ + section > article { min-height: 400px; } +textarea[name="appeal_description"] { + width: 300px; + height: 200px; +} + /* NAV */ #main-nav { diff --git a/resources/views/email/appeal.blade.php b/resources/views/email/appeal.blade.php index eb5b3ac..d1fc601 100644 --- a/resources/views/email/appeal.blade.php +++ b/resources/views/email/appeal.blade.php @@ -1,5 +1,3 @@
- A quick test to see if it works.
- Appeal for: {{$location}}
- Appeal Sponsor: {{$sponsor}}
+ Appeal filed for: {{$location}}
\ No newline at end of file diff --git a/resources/views/front/appeals.blade.php b/resources/views/front/appeals.blade.php index ae8f716..d633ba6 100644 --- a/resources/views/front/appeals.blade.php +++ b/resources/views/front/appeals.blade.php @@ -45,12 +45,15 @@
@csrf
- -
+
+
+




+
+
diff --git a/routes/web.php b/routes/web.php index 2eca38f..fbab175 100644 --- a/routes/web.php +++ b/routes/web.php @@ -6,7 +6,7 @@ use App\Http\Controllers\AuthController; use App\Http\Controllers\DenController; use App\Http\Controllers\LocationController; use App\Http\Controllers\ExportController; -use App\Http\Controllers\AppealMailController; +use App\Http\Controllers\AppealController; /* |-------------------------------------------------------------------------- @@ -26,7 +26,7 @@ Route::get("/about", [FrontIndexController::class, 'about']); Route::get("/location/{uuid}", [FrontIndexController::class, 'location']); Route::get("/appeals", [FrontIndexController::class, 'appeals']); Route::post("/search", [FrontIndexController::class, 'indexSearch']); -Route::post("/appeal", [AppealMailController::class, 'sendAppeal']); +Route::post("/appeal", [AppealController::class, 'sendAppeal']); //exports Route::get("/exports", [ExportController::class, 'exportIndex']);