feat; add apply with discord btns to home page

Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
2022-10-23 20:42:06 +01:00
parent d2de57c55d
commit ad4571db2a
3 changed files with 29 additions and 4 deletions

View File

@@ -84,6 +84,13 @@ class ApplicationController extends Controller
}
public function discordApply(Request $request, $vacancySlug) {
$request->session()->put('discordApplicationRedirectedSlug', $vacancySlug);
return redirect(route('discordRedirect'));
}
public function renderApplicationForm($vacancySlug)
{
try {

View File

@@ -94,18 +94,33 @@
<div class="card-footer text-center">
@auth
<button {{($isEligibleForApplication) ? '' : 'disabled'}} type="button" class="btn btn-success" onclick="window.location.href='{{route('renderApplicationForm', ['vacancySlug' => $position->vacancySlug])}}'">{{__('Apply')}}</button>
@if ($position->requiresDiscord)
@if(Auth::user()->hasDiscordConnection())
<button {{($isEligibleForApplication) ? '' : 'disabled'}} type="button" class="btn btn-success" onclick="window.location.href='{{route('renderApplicationForm', ['vacancySlug' => $position->vacancySlug])}}'">{{__('Apply')}}</button>
@else
<button {{($isEligibleForApplication) ? '' : 'disabled'}} style="background-color: #5865F2; color: white" type="button" class="btn" onclick="window.location.href='{{route('renderApplicationForm', ['vacancySlug' => $position->vacancySlug])}}'"><i class="fab fa-discord"></i> {{__('Apply with Discord')}}</button>
@endif
@else
<button {{($isEligibleForApplication) ? '' : 'disabled'}} type="button" class="btn btn-success" onclick="window.location.href='{{route('renderApplicationForm', ['vacancySlug' => $position->vacancySlug])}}'">{{__('Apply')}}</button>
@endif
@if(!$isEligibleForApplication)
<span class="badge-warning badge"><i class="fa fa-info"></i> {{__('Ineligible (:days) day(s) remaining', ['days' => $eligibilityDaysRemaining])}}</span>
@endif
@endauth
<button type="button" class="btn btn-info" onclick="$('#{{ $position->vacancySlug }}-details').modal('show')">{{__('Learn more')}}</button>
@guest
<button type="button" class="btn btn-success" onclick="window.location.href='{{route('renderApplicationForm', ['vacancySlug' => $position->vacancySlug])}}'">{{__('Apply')}}</button>
@if ($position->requiresDiscord)
<button style="background-color: #5865F2; color: white" type="button" class="btn" onclick="window.location.href='{{route('discord-apply', ['vacancySlug' => $position->vacancySlug])}}'"><i class="fab fa-discord"></i> {{__('Apply with Discord')}}</button>
@else
<button type="button" class="btn btn-success" onclick="window.location.href='{{route('renderApplicationForm', ['vacancySlug' => $position->vacancySlug])}}'">{{__('Apply')}}</button>
@endif
@endguest
<button type="button" class="btn btn-info" onclick="$('#{{ $position->vacancySlug }}-details').modal('show')">{{__('Learn more')}}</button>
</div>
</div>

View File

@@ -98,6 +98,9 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['lo
Route::get('/accounts/{accountID}/dg/process-delete/{action}', [UserController::class, 'processDeleteConfirmation'])
->name('processDeleteConfirmation');
Route::get('/apply/discord/{vacancySlug}', [ApplicationController::class, 'discordApply'])
->name('discord-apply');
Route::group(['middleware' => ['auth', 'forcelogout', 'passwordexpiration', '2fa', 'verified']], function () {