From c52d8c676aefe0a6453875473ba4f3e135f95c9b Mon Sep 17 00:00:00 2001 From: kdmnk Date: Wed, 7 Aug 2024 19:49:07 +0200 Subject: [PATCH 01/10] finalise application backend --- .../Controllers/Auth/AdmissionController.php | 82 ++++----- app/Models/Application.php | 8 +- ...95958_add_fields_to_applications_table.php | 34 ++++ tests/Feature/AdmissionTest.php | 162 ++++++++++-------- 4 files changed, 172 insertions(+), 114 deletions(-) create mode 100644 database/migrations/2024_07_23_195958_add_fields_to_applications_table.php diff --git a/app/Http/Controllers/Auth/AdmissionController.php b/app/Http/Controllers/Auth/AdmissionController.php index 1ca8e8ae1..119c0532e 100644 --- a/app/Http/Controllers/Auth/AdmissionController.php +++ b/app/Http/Controllers/Auth/AdmissionController.php @@ -5,6 +5,7 @@ use App\Exports\ApplicantsExport; use App\Http\Controllers\Controller; use App\Models\Application; +use App\Models\ApplicationWorkshop; use App\Models\Semester; use App\Models\User; use App\Models\RoleUser; @@ -172,47 +173,46 @@ public function updateNote(Request $request, Application $application): Redirect */ public function finalize(): RedirectResponse { - // $this->authorize('finalizeApplicationProcess', User::class); - // Cache::forget('collegists'); - // $not_handled_applicants = User::query()->withoutGlobalScope('verified') - // ->where('verified', 0) - // ->whereHas('application', function ($query) { - // $query->where('submitted', true); - // }) - // ->count(); - // if ($not_handled_applicants > 0) { - // return redirect()->back()->with('error', 'Még vannak feldolgozatlan jelentkezések!'); - // } - // DB::transaction(function () { - // User::query()->withoutGlobalScope('verified') - // ->where('verified', 0) - // ->whereHas('application', function ($query) { - // $query->where('status', Application::STATUS_ACCEPTED); - // }) - // ->update(['verified' => true]); - // $usersToDelete = User::query()->withoutGlobalScope('verified') - // ->where('verified', 0)->whereHas('application'); - // foreach ($usersToDelete->get() as $user) { - // if ($user->profilePicture!=null) { - // Storage::delete($user->profilePicture->path); - // $user->profilePicture()->delete(); - // } - // } - // $files = File::where('application_id', '!=', null); - // foreach ($files->get() as $file) { - // Storage::delete($file->path); - // } - // $files->delete(); - // Application::query()->delete(); - // $usersToDelete->forceDelete(); - // - // RoleUser::where('role_id', Role::get(Role::APPLICATION_COMMITTEE_MEMBER)->id)->delete(); - // RoleUser::where('role_id', Role::get(Role::AGGREGATED_APPLICATION_COMMITTEE_MEMBER)->id)->delete(); - // }); - // - // Cache::clear(); - // return back()->with('message', 'Sikeresen jóváhagyta az elfogadott jelentkezőket'); - return back()->with('error', 'Még nincs implementálva.'); + $this->authorize('finalize', Application::class); + Cache::forget('collegists'); + DB::transaction(function () { + $admitted_applications = Application::query() + ->whereHas('applicationWorkshops', function ($query) { + $query->where('admitted', true); + })->get(); + $not_admitted_applications = Application::whereNotIn('id', $admitted_applications->pluck('id'))->get(); + // admit users + foreach ($admitted_applications as $application) { + $application->user->update(['verified' => true]); + if($application->admitted_for_resident_status) { + $application->user->setResident(); + } else { + $application->user->setExtern(); + } + $application->user->workshops()->sync($application->applicationWorkshops()->where('admitted', true)->pluck('workshop_id')); + } + // delete data for not admitted users + $files = File::query() + ->whereIn('application_id', $not_admitted_applications->pluck('id')) // application files + ->orWhereIn('user_id', $not_admitted_applications->pluck('user_id')); // profile pictures + foreach ($files->get() as $file) { + Storage::delete($file->path); + } + $files->delete(); + // soft deletes application, keep them for future reference + // (see https://github.com/EotvosCollegium/mars/issues/332#issuecomment-2014058021) + Application::whereIn('id', $admitted_applications->pluck('id'))->delete(); + Application::whereNotIn('id', $admitted_applications->pluck('id'))->forceDelete(); + ApplicationWorkshop::query()->delete(); + + User::query()->withoutGlobalScope('verified')->whereIn('id', $not_admitted_applications->pluck('user_id'))->forceDelete(); + + RoleUser::where('role_id', Role::get(Role::APPLICATION_COMMITTEE_MEMBER)->id)->delete(); + RoleUser::where('role_id', Role::get(Role::AGGREGATED_APPLICATION_COMMITTEE_MEMBER)->id)->delete(); + }); + + Cache::clear(); + return back()->with('message', 'Sikeresen jóváhagyta az elfogadott jelentkezőket és törölte a fel nem vett jelentkezőket.'); } /** diff --git a/app/Models/Application.php b/app/Models/Application.php index 0e694d8a0..12f2fc1de 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasManyThrough; +use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Collection; /** @@ -18,6 +19,8 @@ * @property Collection $files * @property boolean $submitted * @property string $graduation_average + * @property boolean $applied_for_resident_status + * @property boolean $admitted_for_resident_status * @property array $semester_average * @property array $language_exam * @property array $competition @@ -63,11 +66,13 @@ class Application extends Model { use HasFactory; + use SoftDeletes; protected $fillable = [ 'user_id', 'submitted', 'applied_for_resident_status', + 'admitted_for_resident_status', 'graduation_average', 'semester_average', 'language_exam', @@ -85,7 +90,8 @@ class Application extends Model protected $casts = [ 'submitted' => 'bool', - 'applied_for_resident_status' => 'bool' + 'applied_for_resident_status' => 'bool', + 'admitted_for_resident_status' => 'bool' ]; public const QUESTION_1 = [ diff --git a/database/migrations/2024_07_23_195958_add_fields_to_applications_table.php b/database/migrations/2024_07_23_195958_add_fields_to_applications_table.php new file mode 100644 index 000000000..772f08752 --- /dev/null +++ b/database/migrations/2024_07_23_195958_add_fields_to_applications_table.php @@ -0,0 +1,34 @@ +boolean('admitted_for_resident_status')->default(false)->after('applied_for_resident_status'); + $table->softDeletes(); + }); + Schema::table('application_workshops', function (Blueprint $table) { + $table->dropForeign('application_workshops_application_id_foreign'); + $table->foreign('application_id')->references('id')->on('applications')->onDelete('cascade'); + }); + + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('applications', function (Blueprint $table) { + $table->dropSoftDeletes(); + }); + } +}; diff --git a/tests/Feature/AdmissionTest.php b/tests/Feature/AdmissionTest.php index a57cd104a..f4b40c91d 100644 --- a/tests/Feature/AdmissionTest.php +++ b/tests/Feature/AdmissionTest.php @@ -5,6 +5,7 @@ use App\Http\Controllers\Auth\AdmissionController; use App\Http\Controllers\Auth\ApplicationController; use App\Models\Application; +use App\Models\ApplicationWorkshop; use App\Models\Faculty; use App\Models\PeriodicEvent; use App\Models\Role; @@ -298,79 +299,96 @@ public function test_view_applications_with_mixed_roles() $this->assertDontSeeUnsubmitted(); } + /** + * Test the admin finalization + * + * @return void + */ + public function test_finalize() + { + $user = User::factory()->create(['verified' => true]); + $user->addRole(Role::firstWhere('name', Role::SYS_ADMIN)); + //to test that these roles gets deleted + $user->addRole(Role::firstWhere('name', Role::APPLICATION_COMMITTEE_MEMBER)); + $user->addRole(Role::firstWhere('name', Role::AGGREGATED_APPLICATION_COMMITTEE_MEMBER)); + + $this->actingAs($user); + + $aurelion = Workshop::firstWhere('name', Workshop::AURELION)->id; + $info = Workshop::firstWhere('name', Workshop::INFORMATIKA)->id; + $maths = Workshop::firstWhere('name', Workshop::MATEMATIKA)->id; + + //data should be deleted + $applicant_in_progress = User::factory()->create(['verified' => false]); + $applicant_in_progress->application()->create(['submitted' => false]); + + //data should be deleted + $applicant_not_admitted = User::factory()->create(['verified' => false]); + $applicant_not_admitted->application()->create(['submitted' => true, 'admitted_for_resident_status' => true]); // even if this is true + $applicant_not_admitted->application->applicationWorkshops()->create([ + 'workshop_id' => $aurelion, + 'called_in' => true, + 'admitted' => false + ]); + + // should be admitted to aurelion as extern + $applicant_admitted_extern = User::factory()->create(['verified' => false]); + $applicant_admitted_extern->application()->create(['submitted' => true, 'admitted_for_resident_status' => false]); + $applicant_admitted_extern->application->applicationWorkshops()->create([ + 'workshop_id' => $aurelion, + 'called_in' => true, + 'admitted' => true + ]); + + // should be admitted to aurelion and maths as resident + $applicant_admitted_resident = User::factory()->create(['verified' => false]); + $applicant_admitted_resident->application()->create(['submitted' => true, 'admitted_for_resident_status' => true]); + $applicant_admitted_resident->application->applicationWorkshops()->create([ + 'workshop_id' => $aurelion, + 'called_in' => true, + 'admitted' => true + ]); + $applicant_admitted_resident->application->applicationWorkshops()->create([ + 'workshop_id' => $info, + 'called_in' => true, + 'admitted' => false + ]); + $applicant_admitted_resident->application->applicationWorkshops()->create([ + 'workshop_id' => $maths, + 'called_in' => false, // even if this is false + 'admitted' => true + ]); + + + $response = $this->post(route('admission.finalize')); + $response->assertStatus(302); + $response->assertSessionHas('message', 'Sikeresen jóváhagyta az elfogadott jelentkezőket és törölte a fel nem vett jelentkezőket.'); - // /** - // * Test the admin finalization - // * - // * @return void - // */ - // public function test_cannot_finalize() - // { - // $user = User::factory()->create(); - // $user->addRole(Role::firstWhere('name', Role::SYS_ADMIN)); - // $this->actingAs($user); - // - // $applicant_in_progress = User::factory()->create(['verified' => false]); - // $applicant_in_progress->application->update(['submitted' => false]); - // - // $applicant_submitted = User::factory()->create(['verified' => false]); - // $applicant_submitted->application->update(['submitted' => true]); - //// - //// $applicant_called_in = User::factory()->create(['verified' => false]); - //// $applicant_called_in->application->update(['status' => Application::STATUS_CALLED_IN]); - //// - //// $applicant_accepted = User::factory()->create(['verified' => false]); - //// $applicant_accepted->application->update(['status' => Application::STATUS_ACCEPTED]); - //// - //// $applicant_banished = User::factory()->create(['verified' => false]); - //// $applicant_banished->application->update(['status' => Application::STATUS_BANISHED]); - // - // $response = $this->post('/application/finalize'); - // $response->assertStatus(302); - // $response->assertSessionHas('error', 'Még vannak feldolgozatlan jelentkezések!'); - // } - - // /** - // * Test the admin finalization - // * - // * @return void - // */ - // public function test_finalize() - // { - // $user = User::factory()->create(['verified' => true]); - // $user->addRole(Role::firstWhere('name', Role::SYS_ADMIN)); - // $user->addRole(Role::firstWhere('name', Role::APPLICATION_COMMITTEE_MEMBER)); - // $user->addRole(Role::firstWhere('name', Role::AGGREGATED_APPLICATION_COMMITTEE_MEMBER)); - // Config::set('custom.application_deadline', now()->subWeeks(3)); - // $this->actingAs($user); - // - // Application::query()->delete(); - // $applicant_in_progress = User::factory()->create(['verified' => false]); - // $applicant_in_progress->application->update(['status' => Application::STATUS_IN_PROGRESS]); - // - // $applicant_accepted = User::factory()->create(['verified' => false]); - // $applicant_accepted->application->update(['status' => Application::STATUS_ACCEPTED]); - // - // $applicant_banished = User::factory()->create(['verified' => false]); - // $applicant_banished->application->update(['status' => Application::STATUS_BANISHED]); - // - // - // $response = $this->post('/application/finalize'); - // $response->assertStatus(302); - // $response->assertSessionHas('message', 'Sikeresen jóváhagyta az elfogadott jelentkezőket'); - // - // $applicant_accepted->refresh(); - // $this->assertTrue($applicant_accepted->verified == 1); - // $this->assertNull(User::find($applicant_banished->id)); - // $this->assertNull(User::find($applicant_in_progress->id)); - // - // $this->assertTrue(Application::count() == 0); - // - // $user->refresh(); - // $this->assertTrue($user->hasRole(Role::firstWhere('name', Role::SYS_ADMIN))); - // $this->assertFalse($user->hasRole(Role::firstWhere('name', Role::APPLICATION_COMMITTEE_MEMBER))); - // $this->assertFalse($user->hasRole(Role::firstWhere('name', Role::AGGREGATED_APPLICATION_COMMITTEE_MEMBER))); - // } + $applicant_admitted_extern->refresh(); + $applicant_admitted_resident->refresh(); + + $this->assertTrue($applicant_admitted_extern->verified == 1); + $this->assertTrue($applicant_admitted_extern->hasRole([Role::COLLEGIST => Role::EXTERN])); + $this->assertTrue($applicant_admitted_extern->workshops->contains($aurelion)); + $this->assertTrue($applicant_admitted_extern->workshops->count() == 1); + $this->assertTrue($applicant_admitted_resident->verified == 1); + $this->assertTrue($applicant_admitted_resident->hasRole([Role::COLLEGIST => Role::RESIDENT])); + $this->assertTrue($applicant_admitted_resident->workshops->contains($aurelion)); + $this->assertTrue($applicant_admitted_resident->workshops->contains($maths)); + $this->assertTrue($applicant_admitted_resident->workshops->count() == 2); + + + $this->assertNull(User::withoutGlobalScope('verified')->find($applicant_in_progress->id)); + $this->assertNull(User::withoutGlobalScope('verified')->find($applicant_not_admitted->id)); + + $this->assertTrue(Application::count() == 0); + $this->assertTrue(ApplicationWorkshop::count() == 0); + + $user->refresh(); + $this->assertTrue($user->hasRole(Role::firstWhere('name', Role::SYS_ADMIN))); + $this->assertFalse($user->hasRole(Role::firstWhere('name', Role::APPLICATION_COMMITTEE_MEMBER))); + $this->assertFalse($user->hasRole(Role::firstWhere('name', Role::AGGREGATED_APPLICATION_COMMITTEE_MEMBER))); + } } From dbf0da7f2f17bee8c722f84435d49c94b4969d5e Mon Sep 17 00:00:00 2001 From: kdmnk Date: Thu, 8 Aug 2024 12:03:59 +0200 Subject: [PATCH 02/10] UI --- .../Controllers/Auth/AdmissionController.php | 45 +++++++++-- app/Livewire/ApplicationRoleStatusUpdate.php | 53 ++++++++++++ ...hp => ApplicationWorkshopStatusUpdate.php} | 4 +- app/Models/Application.php | 42 ++++++++++ .../views/auth/admission/finalize.blade.php | 80 +++++++++++++++++++ .../views/auth/admission/index.blade.php | 24 +----- .../auth/application/application.blade.php | 8 +- .../role_status_update_component.blade.php | 18 +++++ ...orkshop_status_update_component.blade.php} | 0 routes/web.php | 1 + tests/Feature/AdmissionTest.php | 24 ++++-- 11 files changed, 259 insertions(+), 40 deletions(-) create mode 100644 app/Livewire/ApplicationRoleStatusUpdate.php rename app/Livewire/{ApplicationStatusUpdate.php => ApplicationWorkshopStatusUpdate.php} (92%) create mode 100644 resources/views/auth/admission/finalize.blade.php create mode 100644 resources/views/auth/application/role_status_update_component.blade.php rename resources/views/auth/application/{status_update_component.blade.php => workshop_status_update_component.blade.php} (100%) diff --git a/app/Http/Controllers/Auth/AdmissionController.php b/app/Http/Controllers/Auth/AdmissionController.php index 119c0532e..9100d6966 100644 --- a/app/Http/Controllers/Auth/AdmissionController.php +++ b/app/Http/Controllers/Auth/AdmissionController.php @@ -7,6 +7,7 @@ use App\Models\Application; use App\Models\ApplicationWorkshop; use App\Models\Semester; +use App\Models\SemesterStatus; use App\Models\User; use App\Models\RoleUser; use App\Models\File; @@ -16,6 +17,7 @@ use App\Utils\HasPeriodicEvent; use Carbon\Carbon; use Illuminate\Auth\Access\AuthorizationException; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; @@ -166,6 +168,25 @@ public function updateNote(Request $request, Application $application): Redirect return redirect()->back(); } + public function indexFinalize() + { + $this->authorize('finalize', Application::class); + $admitted = Application::query()->with(['user', 'applicationWorkshops'])->admitted()->get()->sortBy('user.name'); + $not_admitted = Application::query()->whereNotIn('id', $admitted->pluck('id'))->get(); + return view('auth.admission.finalize', [ + 'admitted_applications' => $admitted, + 'users_to_delete' => User::query() + ->withoutGlobalScope('verified') + ->with('application') + ->whereIn('id', $not_admitted->pluck('user_id')) + //ignore users with any existing role + ->whereDoesntHave('roles') + ->orderBy('name') + ->get() + ]); + } + + /** * Accept and delete applciations. * @return RedirectResponse @@ -174,13 +195,14 @@ public function updateNote(Request $request, Application $application): Redirect public function finalize(): RedirectResponse { $this->authorize('finalize', Application::class); - Cache::forget('collegists'); + if(!$this->semester()) { + throw new \InvalidArgumentException('No semester can be retrieved from the application periodic event.'); + } + //TODO set semester status + //TODO set wifi access DB::transaction(function () { - $admitted_applications = Application::query() - ->whereHas('applicationWorkshops', function ($query) { - $query->where('admitted', true); - })->get(); - $not_admitted_applications = Application::whereNotIn('id', $admitted_applications->pluck('id'))->get(); + $admitted_applications = Application::query()->admitted()->get(); + $not_admitted_applications = Application::query()->whereNotIn('id', $admitted_applications->pluck('id'))->get(); // admit users foreach ($admitted_applications as $application) { $application->user->update(['verified' => true]); @@ -189,7 +211,9 @@ public function finalize(): RedirectResponse } else { $application->user->setExtern(); } - $application->user->workshops()->sync($application->applicationWorkshops()->where('admitted', true)->pluck('workshop_id')); + $application->user->workshops()->sync($application->admittedWorkshops); + $application->user->setStatusFor($this->semester(), SemesterStatus::ACTIVE); + $application->user->internetAccess->extendInternetAccess($this->semester()->getStartDate()->addMonth()); } // delete data for not admitted users $files = File::query() @@ -205,7 +229,12 @@ public function finalize(): RedirectResponse Application::whereNotIn('id', $admitted_applications->pluck('id'))->forceDelete(); ApplicationWorkshop::query()->delete(); - User::query()->withoutGlobalScope('verified')->whereIn('id', $not_admitted_applications->pluck('user_id'))->forceDelete(); + // Note: users with a not submitted applications will also be deleted + User::query()->withoutGlobalScope('verified') + ->whereIn('id', $not_admitted_applications->pluck('user_id')) + //ignore users with any existing role + ->whereDoesntHave('roles') + ->forceDelete(); RoleUser::where('role_id', Role::get(Role::APPLICATION_COMMITTEE_MEMBER)->id)->delete(); RoleUser::where('role_id', Role::get(Role::AGGREGATED_APPLICATION_COMMITTEE_MEMBER)->id)->delete(); diff --git a/app/Livewire/ApplicationRoleStatusUpdate.php b/app/Livewire/ApplicationRoleStatusUpdate.php new file mode 100644 index 000000000..fcd7e8d22 --- /dev/null +++ b/app/Livewire/ApplicationRoleStatusUpdate.php @@ -0,0 +1,53 @@ +application = $application; + $this->lastUpdated = Carbon::now()->subSeconds(2); + } + + /** + * Update whether the applicant has been admitted as resident or not. + * @param $workshop + */ + public function switchResidentRole() + { + $this->application->update(['admitted_for_resident_status' => !$this->application->admitted_for_resident_status]); + $this->lastUpdated = Carbon::now(); + } + + /** + * $this->updated + * @return bool + */ + public function getUpdatedProperty() + { + return $this->lastUpdated > Carbon::now()->subSeconds(2); + } + + /** + * Render the component + * @return \Illuminate\View\View + */ + public function render() + { + return view('auth.application.role_status_update_component'); + } +} diff --git a/app/Livewire/ApplicationStatusUpdate.php b/app/Livewire/ApplicationWorkshopStatusUpdate.php similarity index 92% rename from app/Livewire/ApplicationStatusUpdate.php rename to app/Livewire/ApplicationWorkshopStatusUpdate.php index 9c1b0a9ba..83dd3273c 100644 --- a/app/Livewire/ApplicationStatusUpdate.php +++ b/app/Livewire/ApplicationWorkshopStatusUpdate.php @@ -7,7 +7,7 @@ use Carbon\Carbon; use Livewire\Component; -class ApplicationStatusUpdate extends Component +class ApplicationWorkshopStatusUpdate extends Component { public Application $application; public ApplicationWorkshop $workshop; @@ -61,6 +61,6 @@ public function getUpdatedProperty() */ public function render() { - return view('auth.application.status_update_component'); + return view('auth.application.workshop_status_update_component'); } } diff --git a/app/Models/Application.php b/app/Models/Application.php index 12f2fc1de..7c8e1cc14 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Utils\DataCompresser; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -131,6 +132,7 @@ public function applicationWorkshops(): HasMany return $this->hasMany(ApplicationWorkshop::class); } + /** * The Workshop models that the user applied for. * @return HasManyThrough @@ -147,6 +149,14 @@ public function appliedWorkshops(): HasManyThrough ); } + /** + * The Workshop models that the user admitted to. + */ + public function admittedWorkshops(): HasManyThrough + { + return $this->appliedWorkshops()->where('application_workshops.admitted', true); + } + /** * Uploaded files * @return HasMany @@ -156,12 +166,44 @@ public function files(): HasMany return $this->hasMany('App\Models\File'); } + + /* + |-------------------------------------------------------------------------- + | Local scopes + |-------------------------------------------------------------------------- + */ + + /** + * Scope a query to only include applications admitted to any workshop. + * @param Builder $query + * @return Builder + */ + public function scopeAdmitted(Builder $query): Builder + { + return $query->whereHas('applicationWorkshops', function ($query) { + $query->where('admitted', true); + }); + } + + /* |-------------------------------------------------------------------------- | Accessors & Mutators |-------------------------------------------------------------------------- */ + /** + * Get a bool whether the applicant has been admitted to any workshops. + * + * @return Attribute + */ + protected function admitted(): Attribute + { + return Attribute::make( + get: fn () => $this->applicationWorkshops()->where('admitted', true)->exists(), + ); + } + /** * Get/set the application's semester_average attribute. * diff --git a/resources/views/auth/admission/finalize.blade.php b/resources/views/auth/admission/finalize.blade.php new file mode 100644 index 000000000..e161be723 --- /dev/null +++ b/resources/views/auth/admission/finalize.blade.php @@ -0,0 +1,80 @@ +@extends('layouts.app') +@section('title') + Felvételi + jelentkezők + Felvételi véglegesítés +@endsection + +@section('content') +
+
+
+
+ Hogyha a felvételi eljárás befejeződött, akkor a felvett jelentkezőket itt lehet + jóváhagyni. +
Figyelem, újrafelvételiző collegisták esetén a felhasználók adatai a lentiek alapján + felülíródnak. Ha továbbra se nyerték el a bentlakó státuszt, akkor felvett bejáró hallgatóként + kell szerepelniük a listában. +
+
+
+ + + + + + + + + + @foreach($admitted_applications as $application) + + + + + + @endforeach + +
Felvett neveStátuszaMűhelye(i)
+ + {{ $application->user->name }} + {{ $application->admitted_for_resident_status ? 'Bentlakó' : 'Bejáró'}} + @include('user.workshop_tags', ['user' => $application->user, 'workshops' => $application->admittedWorkshops, 'newline' => true]) +
+
+
+
+
+

Összesen:

+
    +
  • Felvett: {{ $admitted_applications->count() }}
  • +
  • Bentlakó: {{ $admitted_applications->where('admitted_for_resident_status', true)->count() }}
  • +
  • Bejáró: {{ $admitted_applications->where('admitted_for_resident_status', false)->count() }}
  • + @foreach($admitted_applications->flatMap(fn ($a) => $a->admittedWorkshops)->countBy(fn ($w) => $w->name) as $workshop => $count) +
  • {{ $workshop }}: {{ $count }}
  • + @endforeach +
+
+
+
+
+
Ezzel együtt minden más felvételiző elutasításra, anyagai törlésre, valamint az összes + felvételihez kapcsolódó (felvételiztető) jog elvételre kerül. Az alábbi felhasználók kerülnek törlésre:
+ @foreach($users_to_delete as $user) + + {{ $user->name }} +
+ @endforeach +
+
+
A művelet végrehajtása előtt ajánlott biztonsági mentést készíteni az adatbázisról.
+
+ @csrf + + +
+
+
+
+@endsection diff --git a/resources/views/auth/admission/index.blade.php b/resources/views/auth/admission/index.blade.php index b70abbe5e..7c1ff4aee 100644 --- a/resources/views/auth/admission/index.blade.php +++ b/resources/views/auth/admission/index.blade.php @@ -73,27 +73,9 @@
Összesen: {{$applications->count()}} jelentkező
@can('finalize', \App\Models\Application::class) - @if($applicationDeadline?->addWeeks(1) < now()) -
-
-
-
- @csrf -
- Hogyha a felvételi eljárás befejeződött, akkor a felvett jelentkezőket itt lehet - jóváhagyni. - Ezzel együtt minden más felvételiző elutasításra, anyagai törlésre, valamint az összes - felvételihez kapcsolódó (felvételiztető) jog elvételre kerül. - A "Véglegesítve" és "Behívva" státuszú jelentkezőket előbb el kell utasítani, vagy fel - kell venni. -
- - -
-
-
- @endif + + + @endcan @can('viewAll', \App\Models\Application::class)
diff --git a/resources/views/auth/application/application.blade.php b/resources/views/auth/application/application.blade.php index 23510b3e9..ebb6c6207 100644 --- a/resources/views/auth/application/application.blade.php +++ b/resources/views/auth/application/application.blade.php @@ -11,8 +11,7 @@ @endif
- -
+
@can('viewUnfinished', \App\Models\Application::class) @if(!$user->application->submitted) hiányzó státusz
@endif + @can('editStatus', [\App\Models\Application::class]) + @livewire('application-role-status-update', ['application' => $user->application]) + @endcan
@foreach($user->application->applicationWorkshops as $workshop) @can('editStatus', [\App\Models\Application::class, $workshop->workshop]) - @livewire('application-status-update', ['application' => $user->application, 'workshop' => $workshop]) + @livewire('application-workshop-status-update', ['application' => $user->application, 'workshop' => $workshop]) @else @if(isset($application))