From 5be9fe62a1f87ab186fd1f5a5835726f6a27e42e Mon Sep 17 00:00:00 2001 From: Derek Goetz Date: Fri, 1 Mar 2024 14:10:49 -0500 Subject: [PATCH 1/2] Remove caseloads. --- README.md | 1 - _ide_helper_models.php | 110 +----- .../AlertResource/Pages/ListAlerts.php | 40 --- app-modules/caseload-management/composer.json | 26 -- .../config/permissions/api/custom.php | 37 -- .../config/permissions/web/custom.php | 37 -- .../config/roles/api/caseload_management.php | 37 -- .../config/roles/web/caseload_management.php | 43 --- .../database/factories/CaseloadFactory.php | 62 ---- ...23_09_19_173213_create_caseloads_table.php | 59 ---- ..._142344_create_caseload_subjects_table.php | 58 ---- .../database/seeders/.gitkeep | 0 .../caseloads/pages/edit-caseload.blade.php | 83 ----- .../src/Actions/TranslateCaseloadFilters.php | 64 ---- .../src/CaseloadManagementPlugin.php | 63 ---- .../Console/Commands/TranslateCaseload.php | 59 ---- .../src/Enums/CaseloadModel.php | 108 ------ .../src/Enums/CaseloadType.php | 68 ---- .../Filament/Resources/CaseloadResource.php | 71 ---- .../CaseloadResource/Pages/CreateCaseload.php | 315 ------------------ .../CaseloadResource/Pages/EditCaseload.php | 147 -------- .../Pages/GetCaseloadQuery.php | 98 ------ .../CaseloadResource/Pages/ListCaseloads.php | 97 ------ .../ContactCaseloadSubjectImporter.php | 90 ----- .../StudentCaseloadSubjectImporter.php | 90 ----- .../src/Models/Caseload.php | 124 ------- .../src/Models/CaseloadSubject.php | 65 ---- .../src/Observers/CaseloadObserver.php | 76 ----- .../src/Policies/CaseloadPolicy.php | 134 -------- .../CaseloadManagementServiceProvider.php | 72 ---- .../CaseloadManagementRbacRegistry.php | 71 ---- .../CaseloadResource/CreateCaseloadTest.php | 59 ---- .../CaseloadResource/EditCaseloadTest.php | 62 ---- .../CaseloadResource/ListCaseloadsTest.php | 58 ---- .../ContactResource/Pages/ListContacts.php | 36 -- .../src/Filament/Widgets/ContactStats.php | 5 - .../StudentResource/Pages/ListStudents.php | 37 -- .../src/Filament/Widgets/StudentStats.php | 5 - app/Models/User.php | 6 - composer.json | 1 - composer.lock | 39 +-- 41 files changed, 4 insertions(+), 2709 deletions(-) delete mode 100644 app-modules/caseload-management/composer.json delete mode 100644 app-modules/caseload-management/config/permissions/api/custom.php delete mode 100644 app-modules/caseload-management/config/permissions/web/custom.php delete mode 100644 app-modules/caseload-management/config/roles/api/caseload_management.php delete mode 100644 app-modules/caseload-management/config/roles/web/caseload_management.php delete mode 100644 app-modules/caseload-management/database/factories/CaseloadFactory.php delete mode 100644 app-modules/caseload-management/database/migrations/2023_09_19_173213_create_caseloads_table.php delete mode 100644 app-modules/caseload-management/database/migrations/2023_09_21_142344_create_caseload_subjects_table.php delete mode 100644 app-modules/caseload-management/database/seeders/.gitkeep delete mode 100644 app-modules/caseload-management/resources/views/filament/resources/caseloads/pages/edit-caseload.blade.php delete mode 100644 app-modules/caseload-management/src/Actions/TranslateCaseloadFilters.php delete mode 100644 app-modules/caseload-management/src/CaseloadManagementPlugin.php delete mode 100644 app-modules/caseload-management/src/Console/Commands/TranslateCaseload.php delete mode 100644 app-modules/caseload-management/src/Enums/CaseloadModel.php delete mode 100644 app-modules/caseload-management/src/Enums/CaseloadType.php delete mode 100644 app-modules/caseload-management/src/Filament/Resources/CaseloadResource.php delete mode 100644 app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/CreateCaseload.php delete mode 100644 app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/EditCaseload.php delete mode 100644 app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/GetCaseloadQuery.php delete mode 100644 app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/ListCaseloads.php delete mode 100644 app-modules/caseload-management/src/Importers/ContactCaseloadSubjectImporter.php delete mode 100644 app-modules/caseload-management/src/Importers/StudentCaseloadSubjectImporter.php delete mode 100644 app-modules/caseload-management/src/Models/Caseload.php delete mode 100644 app-modules/caseload-management/src/Models/CaseloadSubject.php delete mode 100644 app-modules/caseload-management/src/Observers/CaseloadObserver.php delete mode 100644 app-modules/caseload-management/src/Policies/CaseloadPolicy.php delete mode 100644 app-modules/caseload-management/src/Providers/CaseloadManagementServiceProvider.php delete mode 100644 app-modules/caseload-management/src/Registries/CaseloadManagementRbacRegistry.php delete mode 100644 app-modules/caseload-management/tests/Filament/CaseloadResource/CreateCaseloadTest.php delete mode 100644 app-modules/caseload-management/tests/Filament/CaseloadResource/EditCaseloadTest.php delete mode 100644 app-modules/caseload-management/tests/Filament/CaseloadResource/ListCaseloadsTest.php diff --git a/README.md b/README.md index d6d32d6c6..c498edc57 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,6 @@ Our student service CRM is designed to support the management of enrolled studen * Record Mangement * Email and SMS * Service Management -* Caseload Management * Task Management * Interaction Tracking * Files and Documents diff --git a/_ide_helper_models.php b/_ide_helper_models.php index 23468b87e..97e232543 100644 --- a/_ide_helper_models.php +++ b/_ide_helper_models.php @@ -1,39 +1,5 @@ - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - // @formatter:off // phpcs:ignoreFile /** @@ -444,8 +410,6 @@ class IdeHelperTenant {} * @property-read \AdvisingApp\MeetingCenter\Models\Calendar|null $calendar * @property-read \Illuminate\Database\Eloquent\Collection $careTeams * @property-read int|null $care_teams_count - * @property-read \Illuminate\Database\Eloquent\Collection $caseloads - * @property-read int|null $caseloads_count * @property-read \Illuminate\Database\Eloquent\Collection $changeRequestResponses * @property-read int|null $change_request_responses_count * @property-read \Illuminate\Database\Eloquent\Collection $changeRequestTypes @@ -1144,76 +1108,6 @@ class IdeHelperRoleGroup {} class IdeHelperCareTeam {} } -namespace AdvisingApp\CaseloadManagement\Models{ -/** - * AdvisingApp\CaseloadManagement\Models\Caseload - * - * @property string $id - * @property string $name - * @property string|null $description - * @property array|null $filters - * @property \AdvisingApp\CaseloadManagement\Enums\CaseloadModel $model - * @property \AdvisingApp\CaseloadManagement\Enums\CaseloadType $type - * @property string $user_id - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at - * @property string|null $deleted_at - * @property-read \Illuminate\Database\Eloquent\Collection $subjects - * @property-read int|null $subjects_count - * @property-read \App\Models\User $user - * @method static \AdvisingApp\CaseloadManagement\Database\Factories\CaseloadFactory factory($count = null, $state = []) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload model(\AdvisingApp\CaseloadManagement\Enums\CaseloadModel $model) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|Caseload newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|Caseload query() - * @method static \Illuminate\Database\Eloquent\Builder|Caseload whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload whereDeletedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload whereDescription($value) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload whereFilters($value) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload whereModel($value) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload whereName($value) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload whereType($value) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload whereUpdatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|Caseload whereUserId($value) - * @mixin \Eloquent - */ - #[\AllowDynamicProperties] - class IdeHelperCaseload {} -} - -namespace AdvisingApp\CaseloadManagement\Models{ -/** - * AdvisingApp\CaseloadManagement\Models\CaseloadSubject - * - * @property string $id - * @property string $subject_id - * @property string $subject_type - * @property string $caseload_id - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at - * @property \Illuminate\Support\Carbon|null $deleted_at - * @property-read \AdvisingApp\CaseloadManagement\Models\Caseload $caseload - * @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $subject - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject onlyTrashed() - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject query() - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject whereCaseloadId($value) - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject whereDeletedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject whereSubjectId($value) - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject whereSubjectType($value) - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject whereUpdatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject withTrashed() - * @method static \Illuminate\Database\Eloquent\Builder|CaseloadSubject withoutTrashed() - * @mixin \Eloquent - */ - #[\AllowDynamicProperties] - class IdeHelperCaseloadSubject {} -} - namespace AdvisingApp\Consent\Models{ /** * AdvisingApp\Consent\Models\ConsentAgreement @@ -4067,7 +3961,7 @@ class IdeHelperEnrollment {} * @property int $cum_att * @property int $cum_ern * @property int $pct_ern - * @property float $cum_gpa + * @property string $cum_gpa * @property \Illuminate\Support\Carbon $max_dt * @property-read \AdvisingApp\StudentDataModel\Models\Student|null $student * @method static \AdvisingApp\StudentDataModel\Database\Factories\PerformanceFactory factory($count = null, $state = []) @@ -4099,7 +3993,7 @@ class IdeHelperPerformance {} * @property string $division * @property string $acad_plan * @property string $prog_status - * @property float $cum_gpa + * @property string $cum_gpa * @property string $semester * @property string $descr * @property string $foi diff --git a/app-modules/alert/src/Filament/Resources/AlertResource/Pages/ListAlerts.php b/app-modules/alert/src/Filament/Resources/AlertResource/Pages/ListAlerts.php index d75ddd347..eac6bec36 100644 --- a/app-modules/alert/src/Filament/Resources/AlertResource/Pages/ListAlerts.php +++ b/app-modules/alert/src/Filament/Resources/AlertResource/Pages/ListAlerts.php @@ -47,7 +47,6 @@ use Filament\Forms\Components\Textarea; use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\TextColumn; -use Illuminate\Database\Eloquent\Model; use AdvisingApp\Alert\Enums\AlertStatus; use App\Filament\Tables\Columns\IdColumn; use Filament\Resources\Pages\ListRecords; @@ -58,11 +57,9 @@ use Filament\Tables\Actions\BulkActionGroup; use Filament\Tables\Actions\DeleteBulkAction; use AdvisingApp\StudentDataModel\Models\Student; -use AdvisingApp\CaseloadManagement\Models\Caseload; use App\Filament\Forms\Components\EducatableSelect; use AdvisingApp\Alert\Filament\Resources\AlertResource; use AdvisingApp\StudentDataModel\Models\Scopes\EducatableSearch; -use AdvisingApp\CaseloadManagement\Actions\TranslateCaseloadFilters; use AdvisingApp\Contact\Filament\Resources\ContactResource\Pages\ManageContactAlerts; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentAlerts; @@ -132,24 +129,6 @@ public function table(Table $table): Table callback: fn (Builder $query) => $query->whereRelation('careTeam', 'user_id', auth()->id()) ) ), - SelectFilter::make('my_caseloads') - ->label('My Caseloads') - ->options( - auth()->user()->caseloads() - ->pluck('name', 'id'), - ) - ->searchable() - ->optionsLimit(20) - ->query(fn (Builder $query, array $data) => $this->caseloadFilter($query, $data)), - SelectFilter::make('all_caseloads') - ->label('All Caseloads') - ->options( - Caseload::all() - ->pluck('name', 'id'), - ) - ->searchable() - ->optionsLimit(20) - ->query(fn (Builder $query, array $data) => $this->caseloadFilter($query, $data)), SelectFilter::make('severity') ->options(AlertSeverity::class), SelectFilter::make('status') @@ -201,23 +180,4 @@ protected function getHeaderActions(): array ]), ]; } - - protected function caseloadFilter(Builder $query, array $data): void - { - if (blank($data['value'])) { - return; - } - - $caseload = Caseload::find($data['value']); - - /** @var Model $model */ - $model = resolve($caseload->model->class()); - - $query->whereIn( - 'concern_id', - app(TranslateCaseloadFilters::class) - ->handle($data['value']) - ->pluck($model->getQualifiedKeyName()), - ); - } } diff --git a/app-modules/caseload-management/composer.json b/app-modules/caseload-management/composer.json deleted file mode 100644 index a684302c1..000000000 --- a/app-modules/caseload-management/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "canyon-gbs/advising-app-caseload-management", - "description": "", - "type": "library", - "version": "1.0", - "license": "proprietary", - "require": { - "filament/filament": "^3.0.0" - }, - "autoload": { - "psr-4": { - "AdvisingApp\\CaseloadManagement\\": "src/", - "AdvisingApp\\CaseloadManagement\\Tests\\": "tests/", - "AdvisingApp\\CaseloadManagement\\Database\\Factories\\": "database/factories/", - "AdvisingApp\\CaseloadManagement\\Database\\Seeders\\": "database/seeders/" - } - }, - "minimum-stability": "dev", - "extra": { - "laravel": { - "providers": [ - "AdvisingApp\\CaseloadManagement\\Providers\\CaseloadManagementServiceProvider" - ] - } - } -} diff --git a/app-modules/caseload-management/config/permissions/api/custom.php b/app-modules/caseload-management/config/permissions/api/custom.php deleted file mode 100644 index a897d8797..000000000 --- a/app-modules/caseload-management/config/permissions/api/custom.php +++ /dev/null @@ -1,37 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -return []; diff --git a/app-modules/caseload-management/config/permissions/web/custom.php b/app-modules/caseload-management/config/permissions/web/custom.php deleted file mode 100644 index a897d8797..000000000 --- a/app-modules/caseload-management/config/permissions/web/custom.php +++ /dev/null @@ -1,37 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -return []; diff --git a/app-modules/caseload-management/config/roles/api/caseload_management.php b/app-modules/caseload-management/config/roles/api/caseload_management.php deleted file mode 100644 index a897d8797..000000000 --- a/app-modules/caseload-management/config/roles/api/caseload_management.php +++ /dev/null @@ -1,37 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -return []; diff --git a/app-modules/caseload-management/config/roles/web/caseload_management.php b/app-modules/caseload-management/config/roles/web/caseload_management.php deleted file mode 100644 index 7947d4745..000000000 --- a/app-modules/caseload-management/config/roles/web/caseload_management.php +++ /dev/null @@ -1,43 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -return [ - 'model' => [ - 'caseload' => [ - '*', - ], - ], -]; diff --git a/app-modules/caseload-management/database/factories/CaseloadFactory.php b/app-modules/caseload-management/database/factories/CaseloadFactory.php deleted file mode 100644 index 58e5e6724..000000000 --- a/app-modules/caseload-management/database/factories/CaseloadFactory.php +++ /dev/null @@ -1,62 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Database\Factories; - -use App\Models\User; -use AdvisingApp\CaseloadManagement\Models\Caseload; -use Illuminate\Database\Eloquent\Factories\Factory; -use AdvisingApp\CaseloadManagement\Enums\CaseloadType; -use AdvisingApp\CaseloadManagement\Enums\CaseloadModel; - -/** - * @extends Factory - */ -class CaseloadFactory extends Factory -{ - /** - * @return array - */ - public function definition(): array - { - return [ - 'name' => fake()->words(asText: true), - 'model' => fake()->randomElement(CaseloadModel::cases()), - 'type' => CaseloadType::Dynamic, //TODO: add static later - 'user_id' => User::inRandomOrder()->first()?->getKey() ?? User::factory()->create()?->getKey(), - ]; - } -} diff --git a/app-modules/caseload-management/database/migrations/2023_09_19_173213_create_caseloads_table.php b/app-modules/caseload-management/database/migrations/2023_09_19_173213_create_caseloads_table.php deleted file mode 100644 index bfd2b521e..000000000 --- a/app-modules/caseload-management/database/migrations/2023_09_19_173213_create_caseloads_table.php +++ /dev/null @@ -1,59 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -use Illuminate\Support\Facades\Schema; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Migrations\Migration; - -return new class () extends Migration { - public function up(): void - { - Schema::create('caseloads', function (Blueprint $table) { - $table->uuid('id')->primary(); - - $table->string('name'); - $table->text('description')->nullable(); - $table->json('filters')->nullable(); - $table->string('model'); - $table->string('type'); - - $table->foreignUuid('user_id')->constrained('users'); - - $table->timestamps(); - $table->softDeletes(); - }); - } -}; diff --git a/app-modules/caseload-management/database/migrations/2023_09_21_142344_create_caseload_subjects_table.php b/app-modules/caseload-management/database/migrations/2023_09_21_142344_create_caseload_subjects_table.php deleted file mode 100644 index 539bf518a..000000000 --- a/app-modules/caseload-management/database/migrations/2023_09_21_142344_create_caseload_subjects_table.php +++ /dev/null @@ -1,58 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -use Illuminate\Support\Facades\Schema; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Migrations\Migration; - -return new class () extends Migration { - public function up(): void - { - Schema::create('caseload_subjects', function (Blueprint $table) { - $table->uuid('id')->primary(); - - $table->string('subject_id'); - $table->string('subject_type'); - - $table->foreignUuid('caseload_id')->constrained('caseloads')->cascadeOnDelete(); - - $table->index(['subject_type', 'subject_id']); - - $table->timestamps(); - $table->softDeletes(); - }); - } -}; diff --git a/app-modules/caseload-management/database/seeders/.gitkeep b/app-modules/caseload-management/database/seeders/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/app-modules/caseload-management/resources/views/filament/resources/caseloads/pages/edit-caseload.blade.php b/app-modules/caseload-management/resources/views/filament/resources/caseloads/pages/edit-caseload.blade.php deleted file mode 100644 index 648cb3e19..000000000 --- a/app-modules/caseload-management/resources/views/filament/resources/caseloads/pages/edit-caseload.blade.php +++ /dev/null @@ -1,83 +0,0 @@ -{{-- - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - ---}} -getResource()::getSlug()), - 'fi-resource-record-' . $record->getKey(), -])> - @capture($form) - - {{ $this->form }} - - - - @endcapture - - @php - $relationManagers = $this->getRelationManagers(); - $hasCombinedRelationManagerTabsWithContent = $this->hasCombinedRelationManagerTabsWithContent(); - @endphp - - @if (!$hasCombinedRelationManagerTabsWithContent || !count($relationManagers)) - {{ $form() }} - @endif - - @if (count($relationManagers)) - - @if ($hasCombinedRelationManagerTabsWithContent) - - {{ $form() }} - - @endif - - @endif - - @if ($data['model']) - {{ $this->table }} - @endif - diff --git a/app-modules/caseload-management/src/Actions/TranslateCaseloadFilters.php b/app-modules/caseload-management/src/Actions/TranslateCaseloadFilters.php deleted file mode 100644 index 03ff9ae8a..000000000 --- a/app-modules/caseload-management/src/Actions/TranslateCaseloadFilters.php +++ /dev/null @@ -1,64 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Actions; - -use function Livewire\trigger; - -use Illuminate\Database\Eloquent\Builder; -use AdvisingApp\CaseloadManagement\Models\Caseload; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource\Pages\EditCaseload; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource\Pages\GetCaseloadQuery; - -class TranslateCaseloadFilters -{ - public function handle(Caseload | string $caseload): Builder - { - // Create a fake Livewire component to replicate the table on the EditCaseload page. - $page = app('livewire')->new(GetCaseloadQuery::class); - - if ($caseload instanceof Caseload) { - $caseload = $caseload->getKey(); - } - - // Mount the fake Livewire component with the desired caseload. - trigger('mount', $page, [$caseload], null, null); - - // Extract the filtered table query from the fake Livewire component, - // which already respects both dynamic and static populations. - return $page->getFilteredTableQuery(); - } -} diff --git a/app-modules/caseload-management/src/CaseloadManagementPlugin.php b/app-modules/caseload-management/src/CaseloadManagementPlugin.php deleted file mode 100644 index a6c37ea46..000000000 --- a/app-modules/caseload-management/src/CaseloadManagementPlugin.php +++ /dev/null @@ -1,63 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement; - -use Filament\Panel; -use Filament\Contracts\Plugin; - -class CaseloadManagementPlugin implements Plugin -{ - public function getId(): string - { - return 'caseload-management'; - } - - public function register(Panel $panel): void - { - $panel->discoverResources( - in: __DIR__ . '/Filament/Resources', - for: 'AdvisingApp\\CaseloadManagement\\Filament\\Resources' - ); - - $panel->discoverPages( - in: __DIR__ . '/Filament/Pages', - for: 'AdvisingApp\\CaseloadManagement\\Filament\\Pages' - ); - } - - public function boot(Panel $panel): void {} -} diff --git a/app-modules/caseload-management/src/Console/Commands/TranslateCaseload.php b/app-modules/caseload-management/src/Console/Commands/TranslateCaseload.php deleted file mode 100644 index 973972280..000000000 --- a/app-modules/caseload-management/src/Console/Commands/TranslateCaseload.php +++ /dev/null @@ -1,59 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Console\Commands; - -use Illuminate\Console\Command; -use AdvisingApp\CaseloadManagement\Models\Caseload; -use Spatie\Multitenancy\Commands\Concerns\TenantAware; -use AdvisingApp\CaseloadManagement\Actions\TranslateCaseloadFilters; - -class TranslateCaseload extends Command -{ - use TenantAware; - - protected $signature = 'caseloads:translate {--tenant=*}'; - - protected $description = 'Translate caseload filters.'; - - public function handle(): void - { - Caseload::all() - ->each(function (Caseload $caseload) { - ray(resolve(TranslateCaseloadFilters::class)->handle($caseload)->get()); - }); - } -} diff --git a/app-modules/caseload-management/src/Enums/CaseloadModel.php b/app-modules/caseload-management/src/Enums/CaseloadModel.php deleted file mode 100644 index 99c325a1d..000000000 --- a/app-modules/caseload-management/src/Enums/CaseloadModel.php +++ /dev/null @@ -1,108 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Enums; - -use Filament\Tables\Table; -use AdvisingApp\Contact\Models\Contact; -use Filament\Support\Contracts\HasLabel; -use Illuminate\Database\Eloquent\Builder; -use AdvisingApp\StudentDataModel\Models\Student; -use AdvisingApp\Contact\Filament\Tables\ContactsTable; -use AdvisingApp\StudentDataModel\Filament\Tables\StudentsTable; -use AdvisingApp\CaseloadManagement\Importers\ContactCaseloadSubjectImporter; -use AdvisingApp\CaseloadManagement\Importers\StudentCaseloadSubjectImporter; - -enum CaseloadModel: string implements HasLabel -{ - case Contact = 'contact'; - - case Student = 'student'; - - public function getLabel(): ?string - { - return $this->name; - } - - public static function default(): static - { - return static::Student; - } - - public function query(): Builder - { - return match ($this) { - static::Student => Student::query(), - static::Contact => Contact::query(), - }; - } - - public function class(): string - { - return match ($this) { - static::Student => Student::class, - static::Contact => Contact::class, - }; - } - - public function table(Table $table): Table - { - return $table->tap(app(match ($this) { - static::Student => StudentsTable::class, - static::Contact => ContactsTable::class, - })); - } - - public static function tryFromCaseOrValue(CaseloadModel | string $value): ?static - { - if ($value instanceof CaseloadModel) { - return $value; - } - - return static::tryFrom($value); - } - - /** - * @return class-string - */ - public function getSubjectImporter(): string - { - return match ($this) { - static::Contact => ContactCaseloadSubjectImporter::class, - static::Student => StudentCaseloadSubjectImporter::class, - }; - } -} diff --git a/app-modules/caseload-management/src/Enums/CaseloadType.php b/app-modules/caseload-management/src/Enums/CaseloadType.php deleted file mode 100644 index a682c93bf..000000000 --- a/app-modules/caseload-management/src/Enums/CaseloadType.php +++ /dev/null @@ -1,68 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Enums; - -use Filament\Support\Contracts\HasLabel; - -enum CaseloadType: string implements HasLabel -{ - case Dynamic = 'dynamic'; - - case Static = 'static'; - - public function getLabel(): ?string - { - return match ($this) { - static::Static => 'Static', - default => $this->name, - }; - } - - public static function default(): static - { - return static::Dynamic; - } - - public static function tryFromCaseOrValue(CaseloadType | string $value): ?static - { - if ($value instanceof static) { - return $value; - } - - return static::tryFrom($value); - } -} diff --git a/app-modules/caseload-management/src/Filament/Resources/CaseloadResource.php b/app-modules/caseload-management/src/Filament/Resources/CaseloadResource.php deleted file mode 100644 index 94a6ffb85..000000000 --- a/app-modules/caseload-management/src/Filament/Resources/CaseloadResource.php +++ /dev/null @@ -1,71 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Filament\Resources; - -use Filament\Resources\Resource; -use AdvisingApp\CaseloadManagement\Models\Caseload; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource\Pages\EditCaseload; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource\Pages\ListCaseloads; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource\Pages\CreateCaseload; - -class CaseloadResource extends Resource -{ - protected static ?string $model = Caseload::class; - - protected static ?string $navigationIcon = 'heroicon-o-inbox-stack'; - - protected static ?string $navigationGroup = 'Engagement Features'; - - protected static ?int $navigationSort = 20; - - protected static ?string $navigationLabel = 'Caseload Management'; - - protected static ?string $breadcrumb = 'Caseload Management'; - - protected static ?string $modelLabel = 'Caseload'; - - protected static ?string $pluralModelLabel = 'Caseloads'; - - public static function getPages(): array - { - return [ - 'index' => ListCaseloads::route('/'), - 'create' => CreateCaseload::route('/create'), - 'edit' => EditCaseload::route('/{record}/edit'), - ]; - } -} diff --git a/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/CreateCaseload.php b/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/CreateCaseload.php deleted file mode 100644 index a9da26b31..000000000 --- a/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/CreateCaseload.php +++ /dev/null @@ -1,315 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource\Pages; - -use Iterator; -use Exception; -use App\Models\User; -use App\Models\Import; -use Filament\Forms\Get; -use Filament\Tables\Table; -use Illuminate\Support\Arr; -use Illuminate\Support\Str; -use App\Support\ChunkIterator; -use Filament\Forms\Components\View; -use Illuminate\Support\Facades\Bus; -use Filament\Forms\Components\Select; -use AdvisingApp\Contact\Models\Contact; -use Filament\Forms\Components\Textarea; -use Filament\Tables\Contracts\HasTable; -use Illuminate\Support\Facades\Storage; -use Filament\Forms\Components\TextInput; -use Filament\Notifications\Notification; -use Filament\Forms\Components\FileUpload; -use Illuminate\Filesystem\AwsS3V3Adapter; -use Filament\Forms\Components\Wizard\Step; -use Filament\Resources\Pages\CreateRecord; -use Filament\Actions\Imports\Jobs\ImportCsv; -use AdvisingApp\StudentDataModel\Models\Student; -use Filament\Tables\Concerns\InteractsWithTable; -use AdvisingApp\CaseloadManagement\Enums\CaseloadType; -use AdvisingApp\CaseloadManagement\Enums\CaseloadModel; -use Livewire\Features\SupportFileUploads\TemporaryUploadedFile; -use Filament\Notifications\Actions\Action as NotificationAction; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource; - -class CreateCaseload extends CreateRecord implements HasTable -{ - use InteractsWithTable; - use CreateRecord\Concerns\HasWizard; - - protected static string $resource = CaseloadResource::class; - - public function getSteps(): array - { - return [ - Step::make('Characteristics') - ->schema([ - TextInput::make('name') - ->autocomplete(false) - ->string() - ->required(), - Textarea::make('description'), - ]), - Step::make('Caseload Type') - ->schema([ - Select::make('model') - ->label('Population') - ->options(CaseloadModel::class) - ->required() - ->default(CaseloadModel::default()) - ->selectablePlaceholder(false) - ->afterStateUpdated(function () { - $this->cacheForms(); - $this->bootedInteractsWithTable(); - $this->resetTableFiltersForm(); - }), - ]) - ->columns(2) - ->visible(auth()->user()->hasLicense([Student::getLicenseType(), Contact::getLicenseType()])), - Step::make('Identify Population') - ->schema([ - Select::make('type') - ->options(CaseloadType::class) - ->default(CaseloadType::default()) - ->selectablePlaceholder(false) - ->required(), - ]) - ->columns(2), - Step::make('Create Caseload') - ->schema([ - View::make('filament.forms.components.table') - ->visible(fn (Get $get): bool => CaseloadType::tryFromCaseOrValue($get('type')) === CaseloadType::Dynamic), - FileUpload::make('file') - ->acceptedFileTypes(['text/csv', 'text/plain']) - ->storeFiles(false) - ->visibility('private') - ->required() - ->hiddenLabel() - ->visible(fn (Get $get): bool => CaseloadType::tryFromCaseOrValue($get('type')) === CaseloadType::Static) - ->helperText(fn (): string => match ($this->getCaseloadModel()) { - CaseloadModel::Student => 'Upload a file of Student IDs or Other IDs, with each on a new line.', - CaseloadModel::Contact => 'Upload a file of contact email addresses, with each on a new line.', - }), - ]), - ]; - } - - public function table(Table $table): Table - { - return $this->getCaseloadModel()->table($table); - } - - /** - * @return resource | false - */ - public function getUploadedFileStream(TemporaryUploadedFile $file) - { - $filePath = $file->getRealPath(); - - if (config('filament.default_filesystem_disk') !== 's3') { - return fopen($filePath, mode: 'r'); - } - - /** @var AwsS3V3Adapter $s3Adapter */ - $s3Adapter = Storage::disk('s3')->getAdapter(); - - invade($s3Adapter)->client->registerStreamWrapper(); - - $fileS3Path = 's3://' . config('filesystems.disks.s3.bucket') . '/' . $filePath; - - return fopen($fileS3Path, mode: 'r', context: stream_context_create([ - 's3' => [ - 'seekable' => true, - ], - ])); - } - - protected function afterCreate(): void - { - $data = $this->form->getRawState(); - - if (CaseloadType::tryFromCaseOrValue($data['type']) === CaseloadType::Dynamic) { - return; - } - - /** @var TemporaryUploadedFile $file */ - $file = Arr::first($data['file']); - - $fileStream = $this->getUploadedFileStream($file); - - if (! $fileStream) { - return; - } - - $totalRows = 0; - - while (! feof($fileStream)) { - fgets($fileStream); - - $totalRows++; - } - - fclose($fileStream); - - $maxRows = 100000; - - if ($maxRows < $totalRows) { - Notification::make() - ->title('That file is too large to import') - ->body('You may not import more than ' . number_format($maxRows) . ' at once.') - ->success() - ->send(); - - return; - } - - $user = auth()->user(); - - $import = new Import(); - $import->user()->associate($user); - $import->file_name = $file->getClientOriginalName(); - $import->file_path = $file->getRealPath(); - $import->importer = $this->getCaseloadModel()->getSubjectImporter(); - $import->total_rows = $totalRows; - $import->save(); - - $importChunkIterator = new ChunkIterator((function () use ($file): Iterator { - $fileStream = $this->getUploadedFileStream($file); - - if (! $fileStream) { - return; - } - - while (! feof($fileStream)) { - yield ['subject' => fgets($fileStream)]; - } - - fclose($fileStream); - })(), chunkSize: 100); - - /** @var array>> $importChunks */ - $importChunks = $importChunkIterator->get(); - - $importJobs = collect($importChunks) - ->map(fn (array $importChunk): object => new ImportCsv( - $import, - rows: $importChunk, - columnMap: [ - 'subject' => 'subject', - ], - options: [ - 'caseload_id' => $this->getRecord()->getKey(), - ], - )); - - Bus::batch($importJobs->all()) - ->allowFailures() - ->finally(function () use ($import) { - if ($import->failed_at) { - return; - } - - $import->touch('completed_at'); - - if (! $import->user instanceof User) { - return; - } - - $failedRowsCount = $import->getFailedRowsCount(); - - Notification::make() - ->title('Import completed') - ->body($import->importer::getCompletedNotificationBody($import)) - ->when( - ! $failedRowsCount, - fn (Notification $notification) => $notification->success(), - ) - ->when( - $failedRowsCount && ($failedRowsCount < $import->total_rows), - fn (Notification $notification) => $notification->warning(), - ) - ->when( - $failedRowsCount === $import->total_rows, - fn (Notification $notification) => $notification->danger(), - ) - ->when( - $failedRowsCount, - fn (Notification $notification) => $notification->actions([ - NotificationAction::make('downloadFailedRowsCsv') - ->label('Download information about the failed ' . Str::plural('row', $failedRowsCount)) - ->color('danger') - ->url(route('filament.imports.failed-rows.download', ['import' => $import])), - ]), - ) - ->sendToDatabase($import->user); - }) - ->dispatch(); - - Notification::make() - ->title('Import started') - ->body("Your import has begun and {$import->total_rows} rows will be processed in the background.") - ->success() - ->send(); - } - - protected function getCaseloadModel(): CaseloadModel - { - $canAccessStudents = auth()->user()->hasLicense(Student::getLicenseType()); - $canAccessContacts = auth()->user()->hasLicense(Contact::getLicenseType()); - - return match (true) { - $canAccessStudents && $canAccessContacts => CaseloadModel::tryFromCaseOrValue($this->form->getRawState()['model']) ?? throw new Exception('Neither students nor contacts were selected.'), - $canAccessStudents => CaseloadModel::Student, - $canAccessContacts => CaseloadModel::Contact, - default => throw new Exception('User cannot access students or contacts.'), - }; - } - - protected function mutateFormDataBeforeCreate(array $data): array - { - $data['model'] = $this->getCaseloadModel(); - - if (CaseloadType::tryFromCaseOrValue($data['type']) === CaseloadType::Dynamic) { - $data['filters'] = $this->tableFilters ?? []; - } else { - $data['filters'] = []; - } - - return $data; - } -} diff --git a/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/EditCaseload.php b/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/EditCaseload.php deleted file mode 100644 index 92900a31e..000000000 --- a/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/EditCaseload.php +++ /dev/null @@ -1,147 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource\Pages; - -use Filament\Forms\Form; -use Filament\Tables\Table; -use Filament\Actions\DeleteAction; -use Filament\Forms\Components\Grid; -use Filament\Forms\Components\Select; -use AdvisingApp\Contact\Models\Contact; -use Filament\Forms\Components\Textarea; -use Filament\Tables\Contracts\HasTable; -use Filament\Forms\Components\TextInput; -use Filament\Resources\Pages\EditRecord; -use Illuminate\Database\Eloquent\Builder; -use AdvisingApp\StudentDataModel\Models\Student; -use Filament\Tables\Concerns\InteractsWithTable; -use AdvisingApp\CaseloadManagement\Enums\CaseloadType; -use AdvisingApp\CaseloadManagement\Enums\CaseloadModel; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource; - -class EditCaseload extends EditRecord implements HasTable -{ - use InteractsWithTable { - bootedInteractsWithTable as baseBootedInteractsWithTable; - } - - protected static string $resource = CaseloadResource::class; - - protected static string $view = 'caseload-management::filament.resources.caseloads.pages.edit-caseload'; - - public function form(Form $form): Form - { - return $form - ->schema([ - TextInput::make('name') - ->autocomplete(false) - ->string() - ->required() - ->columnSpanFull(), - Textarea::make('description') - ->columnSpanFull(), - Grid::make() - ->schema([ - Select::make('type') - ->options(CaseloadType::class) - ->disabled(), - Select::make('model') - ->label('Population') - ->options(CaseloadModel::class) - ->disabled() - ->visible(auth()->user()->hasLicense([Student::getLicenseType(), Contact::getLicenseType()])), - TextInput::make('user.name') - ->label('User') - ->disabled(), - ]) - ->columns(3), - ]); - } - - public function table(Table $table): Table - { - $caseload = $this->getRecord(); - - $table = $caseload->model->table($table); - - if ($caseload->type === CaseloadType::Static) { - $keys = $caseload->subjects()->pluck('subject_id'); - - $table->modifyQueryUsing(fn (Builder $query) => $query->whereKey($keys)); - } - - return $table; - } - - public function bootedInteractsWithTable(): void - { - if ($this->shouldMountInteractsWithTable) { - $this->tableFilters = $this->getRecord()->filters; - } - - $this->baseBootedInteractsWithTable(); - } - - protected function mutateFormDataBeforeFill(array $data): array - { - $caseload = $this->getRecord(); - - $data['model'] = $caseload->model; - $data['type'] = $caseload->type; - $data['user']['name'] = $caseload->user->name; - - return $data; - } - - protected function getHeaderActions(): array - { - return [ - DeleteAction::make(), - ]; - } - - protected function mutateFormDataBeforeSave(array $data): array - { - if (CaseloadType::tryFromCaseOrValue($this->data['type']) === CaseloadType::Dynamic) { - $data['filters'] = $this->tableFilters ?? []; - } else { - $data['filters'] = []; - } - - return $data; - } -} diff --git a/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/GetCaseloadQuery.php b/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/GetCaseloadQuery.php deleted file mode 100644 index b44881736..000000000 --- a/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/GetCaseloadQuery.php +++ /dev/null @@ -1,98 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource\Pages; - -use Filament\Tables\Table; -use Filament\Tables\Contracts\HasTable; -use Filament\Resources\Pages\EditRecord; -use Illuminate\Database\Eloquent\Builder; -use Filament\Tables\Concerns\InteractsWithTable; -use AdvisingApp\CaseloadManagement\Enums\CaseloadType; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource; - -class GetCaseloadQuery extends EditRecord implements HasTable -{ - use InteractsWithTable { - bootedInteractsWithTable as baseBootedInteractsWithTable; - } - - protected static string $resource = CaseloadResource::class; - - public function mount(int | string $record): void - { - $this->record = $this->resolveRecord($record); - - $this->fillForm(); - - $this->previousUrl = url()->previous(); - } - - public function table(Table $table): Table - { - $caseload = $this->getRecord(); - - $table = $caseload->model->table($table); - - if ($caseload->type === CaseloadType::Static) { - $keys = $caseload->subjects()->pluck('subject_id'); - - $table->modifyQueryUsing(fn (Builder $query) => $query->whereKey($keys)); - } - - return $table; - } - - public function bootedInteractsWithTable(): void - { - if ($this->shouldMountInteractsWithTable) { - $this->tableFilters = $this->getRecord()->filters; - } - - $this->baseBootedInteractsWithTable(); - } - - protected function mutateFormDataBeforeFill(array $data): array - { - $caseload = $this->getRecord(); - - $data['model'] = $caseload->model; - $data['type'] = $caseload->type; - $data['user']['name'] = $caseload->user->name; - - return $data; - } -} diff --git a/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/ListCaseloads.php b/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/ListCaseloads.php deleted file mode 100644 index e27381429..000000000 --- a/app-modules/caseload-management/src/Filament/Resources/CaseloadResource/Pages/ListCaseloads.php +++ /dev/null @@ -1,97 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource\Pages; - -use Filament\Tables\Table; -use Filament\Actions\CreateAction; -use Filament\Tables\Filters\Filter; -use AdvisingApp\Contact\Models\Contact; -use Filament\Tables\Actions\EditAction; -use Filament\Tables\Columns\TextColumn; -use App\Filament\Tables\Columns\IdColumn; -use Filament\Resources\Pages\ListRecords; -use Filament\Tables\Actions\DeleteAction; -use AdvisingApp\StudentDataModel\Models\Student; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource; - -class ListCaseloads extends ListRecords -{ - protected ?string $heading = 'Caseload Management'; - - protected static string $resource = CaseloadResource::class; - - public function table(Table $table): Table - { - return $table - ->columns([ - IdColumn::make(), - TextColumn::make('name') - ->sortable(), - TextColumn::make('model') - ->label('Population') - ->sortable() - ->visible(auth()->user()->hasLicense([Student::getLicenseType(), Contact::getLicenseType()])), - TextColumn::make('type') - ->sortable(), - TextColumn::make('user.name') - ->label('Owner') - ->sortable() - ->hidden(function (Table $table) { - return $table->getFilter('my_caseloads')->getState()['isActive']; - }), - ]) - ->actions([ - EditAction::make(), - DeleteAction::make(), - ]) - ->filters([ - Filter::make('my_caseloads') - ->label('My Caseloads') - ->query( - fn ($query) => $query->where('user_id', auth()->id()) - ) - ->default(), - ]); - } - - protected function getHeaderActions(): array - { - return [ - CreateAction::make(), - ]; - } -} diff --git a/app-modules/caseload-management/src/Importers/ContactCaseloadSubjectImporter.php b/app-modules/caseload-management/src/Importers/ContactCaseloadSubjectImporter.php deleted file mode 100644 index df8bee1f8..000000000 --- a/app-modules/caseload-management/src/Importers/ContactCaseloadSubjectImporter.php +++ /dev/null @@ -1,90 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Importers; - -use Illuminate\Support\Str; -use Filament\Actions\Imports\Importer; -use AdvisingApp\Contact\Models\Contact; -use Illuminate\Database\Eloquent\Model; -use Filament\Actions\Imports\ImportColumn; -use Filament\Actions\Imports\Models\Import; -use AdvisingApp\CaseloadManagement\Models\CaseloadSubject; - -class ContactCaseloadSubjectImporter extends Importer -{ - protected static ?string $model = CaseloadSubject::class; - - public static function getColumns(): array - { - return [ - ImportColumn::make('subject') - ->label('Email address') - ->rules(['required', 'email']) - ->relationship( - resolveUsing: fn (mixed $state) => Contact::query() - ->where('email', $state) - ->orWhere('email_2', $state) - ->first(), - ) - ->requiredMapping(), - ]; - } - - public function resolveRecord(): ?Model - { - return new CaseloadSubject(); - } - - public function beforeCreate(): void - { - /** @var CaseloadSubject $record */ - $record = $this->record; - - $record->caseload()->associate($this->getOptions()['caseload_id']); - } - - public static function getCompletedNotificationBody(Import $import): string - { - $body = 'Your caseload import has completed and ' . number_format($import->successful_rows) . ' ' . Str::plural('contact', $import->successful_rows) . ' imported.'; - - if ($failedRowsCount = $import->getFailedRowsCount()) { - $body .= ' ' . number_format($failedRowsCount) . ' ' . Str::plural('contact', $failedRowsCount) . ' failed to import.'; - } - - return $body; - } -} diff --git a/app-modules/caseload-management/src/Importers/StudentCaseloadSubjectImporter.php b/app-modules/caseload-management/src/Importers/StudentCaseloadSubjectImporter.php deleted file mode 100644 index b5262ff91..000000000 --- a/app-modules/caseload-management/src/Importers/StudentCaseloadSubjectImporter.php +++ /dev/null @@ -1,90 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Importers; - -use Illuminate\Support\Str; -use Filament\Actions\Imports\Importer; -use Illuminate\Database\Eloquent\Model; -use Filament\Actions\Imports\ImportColumn; -use Filament\Actions\Imports\Models\Import; -use AdvisingApp\StudentDataModel\Models\Student; -use AdvisingApp\CaseloadManagement\Models\CaseloadSubject; - -class StudentCaseloadSubjectImporter extends Importer -{ - protected static ?string $model = CaseloadSubject::class; - - public static function getColumns(): array - { - return [ - ImportColumn::make('subject') - ->label('Student ID / Other ID') - ->rules(['required']) - ->relationship( - resolveUsing: fn (mixed $state) => Student::query() - ->where('sisid', $state) - ->orWhere('otherid', $state) - ->first(), - ) - ->requiredMapping(), - ]; - } - - public function resolveRecord(): ?Model - { - return new CaseloadSubject(); - } - - public function beforeCreate(): void - { - /** @var CaseloadSubject $record */ - $record = $this->record; - - $record->caseload()->associate($this->getOptions()['caseload_id']); - } - - public static function getCompletedNotificationBody(Import $import): string - { - $body = 'Your caseload import has completed and ' . number_format($import->successful_rows) . ' ' . Str::plural('student', $import->successful_rows) . ' imported.'; - - if ($failedRowsCount = $import->getFailedRowsCount()) { - $body .= ' ' . number_format($failedRowsCount) . ' ' . Str::plural('student', $failedRowsCount) . ' failed to import.'; - } - - return $body; - } -} diff --git a/app-modules/caseload-management/src/Models/Caseload.php b/app-modules/caseload-management/src/Models/Caseload.php deleted file mode 100644 index 7e3f70467..000000000 --- a/app-modules/caseload-management/src/Models/Caseload.php +++ /dev/null @@ -1,124 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Models; - -use App\Models\User; -use App\Models\BaseModel; -use App\Models\Authenticatable; -use Illuminate\Support\Collection; -use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Database\Eloquent\Relations\BelongsTo; -use AdvisingApp\CaseloadManagement\Enums\CaseloadType; -use AdvisingApp\CaseloadManagement\Enums\CaseloadModel; -use AdvisingApp\CaseloadManagement\Actions\TranslateCaseloadFilters; - -/** - * @mixin IdeHelperCaseload - */ -class Caseload extends BaseModel -{ - protected $fillable = [ - 'query', - 'filters', - 'name', - 'description', - 'model', - 'type', - ]; - - protected $casts = [ - 'filters' => 'array', - 'model' => CaseloadModel::class, - 'type' => CaseloadType::class, - ]; - - public function user(): BelongsTo - { - return $this->belongsTo(User::class); - } - - public function subjects(): HasMany - { - return $this->hasMany(CaseloadSubject::class); - } - - public function scopeModel(Builder $query, CaseloadModel $model): void - { - $query->where('model', $model); - } - - public function retrieveRecords(): Collection - { - if (count($this->subjects) > 0) { - return $this->subjects->map(function (CaseloadSubject $subject) { - return $subject->subject; - }); - } - - /** @var Builder $modelQueryBuilder */ - $modelQueryBuilder = $this->model->query(); - - $class = $this->model->class(); - - return $modelQueryBuilder - ->whereKey( - resolve(TranslateCaseloadFilters::class) - ->handle($this) - ->pluck(resolve($class)->getKeyName()), - ) - ->get(); - } - - protected static function booted(): void - { - static::addGlobalScope('licensed', function (Builder $builder) { - if (! auth()->check()) { - return; - } - - /** @var Authenticatable $user */ - $user = auth()->user(); - - foreach (CaseloadModel::cases() as $model) { - if (! $user->hasLicense($model->class()::getLicenseType())) { - $builder->where('model', '!=', $model); - } - } - }); - } -} diff --git a/app-modules/caseload-management/src/Models/CaseloadSubject.php b/app-modules/caseload-management/src/Models/CaseloadSubject.php deleted file mode 100644 index 7cc195a02..000000000 --- a/app-modules/caseload-management/src/Models/CaseloadSubject.php +++ /dev/null @@ -1,65 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Models; - -use App\Models\BaseModel; -use Illuminate\Database\Eloquent\SoftDeletes; -use Illuminate\Database\Eloquent\Relations\MorphTo; -use Illuminate\Database\Eloquent\Relations\BelongsTo; - -/** - * @mixin IdeHelperCaseloadSubject - */ -class CaseloadSubject extends BaseModel -{ - use SoftDeletes; - - protected $fillable = [ - 'subject_id', - 'subject_type', - ]; - - public function caseload(): BelongsTo - { - return $this->belongsTo(Caseload::class); - } - - public function subject(): MorphTo - { - return $this->morphTo(); - } -} diff --git a/app-modules/caseload-management/src/Observers/CaseloadObserver.php b/app-modules/caseload-management/src/Observers/CaseloadObserver.php deleted file mode 100644 index fcf13e6bd..000000000 --- a/app-modules/caseload-management/src/Observers/CaseloadObserver.php +++ /dev/null @@ -1,76 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Observers; - -use App\Models\User; -use Illuminate\Support\Facades\Cache; -use AdvisingApp\CaseloadManagement\Models\Caseload; -use AdvisingApp\CaseloadManagement\Enums\CaseloadModel; - -class CaseloadObserver -{ - public function creating(Caseload $caseload): void - { - $caseload->user()->associate($caseload->user ?? auth()->user()); - } - - public function created(Caseload $caseload): void - { - /** @var ?User $user */ - $user = auth()->user(); - - if ($user) { - Cache::tags([match ($caseload->model) { - CaseloadModel::Contact => "user-{$user->getKey()}-contact-caseloads", - CaseloadModel::Student => "user-{$user->getKey()}-student-caseloads", - }])->flush(); - } - } - - public function deleted(Caseload $caseload): void - { - /** @var ?User $user */ - $user = auth()->user(); - - if ($user) { - Cache::tags([match ($caseload->model) { - CaseloadModel::Contact => "user-{$user->getKey()}-contact-caseloads", - CaseloadModel::Student => "user-{$user->getKey()}-student-caseloads", - }])->flush(); - } - } -} diff --git a/app-modules/caseload-management/src/Policies/CaseloadPolicy.php b/app-modules/caseload-management/src/Policies/CaseloadPolicy.php deleted file mode 100644 index 82fb4428f..000000000 --- a/app-modules/caseload-management/src/Policies/CaseloadPolicy.php +++ /dev/null @@ -1,134 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Policies; - -use App\Models\Authenticatable; -use Illuminate\Auth\Access\Response; -use App\Concerns\PerformsLicenseChecks; -use AdvisingApp\Authorization\Enums\LicenseType; -use AdvisingApp\CaseloadManagement\Models\Caseload; -use App\Policies\Contracts\PerformsChecksBeforeAuthorization; - -class CaseloadPolicy implements PerformsChecksBeforeAuthorization -{ - use PerformsLicenseChecks; - - public function before(Authenticatable $authenticatable): ?Response - { - if (! is_null($response = $this->hasAnyLicense($authenticatable, [LicenseType::RetentionCrm, LicenseType::RecruitmentCrm]))) { - return $response; - } - - return null; - } - - public function viewAny(Authenticatable $authenticatable): Response - { - return $authenticatable->canOrElse( - abilities: 'caseload.view-any', - denyResponse: 'You do not have permission to view caseloads.' - ); - } - - public function view(Authenticatable $authenticatable, Caseload $caseload): Response - { - if (! $authenticatable->hasLicense($caseload->model?->class()::getLicenseType())) { - return Response::deny('You do not have permission to view this caseload.'); - } - - return $authenticatable->canOrElse( - abilities: ['caseload.*.view', "caseload.{$caseload->id}.view"], - denyResponse: 'You do not have permission to view this caseload.' - ); - } - - public function create(Authenticatable $authenticatable): Response - { - return $authenticatable->canOrElse( - abilities: 'caseload.create', - denyResponse: 'You do not have permission to create caseloads.' - ); - } - - public function update(Authenticatable $authenticatable, Caseload $caseload): Response - { - if (! $authenticatable->hasLicense($caseload->model?->class()::getLicenseType())) { - return Response::deny('You do not have permission to update this caseload.'); - } - - return $authenticatable->canOrElse( - abilities: ['caseload.*.update', "caseload.{$caseload->id}.update"], - denyResponse: 'You do not have permission to update this caseload.' - ); - } - - public function delete(Authenticatable $authenticatable, Caseload $caseload): Response - { - if (! $authenticatable->hasLicense($caseload->model?->class()::getLicenseType())) { - return Response::deny('You do not have permission to delete this caseload.'); - } - - return $authenticatable->canOrElse( - abilities: ['caseload.*.delete', "caseload.{$caseload->id}.delete"], - denyResponse: 'You do not have permission to delete this caseload.' - ); - } - - public function restore(Authenticatable $authenticatable, Caseload $caseload): Response - { - if (! $authenticatable->hasLicense($caseload->model?->class()::getLicenseType())) { - return Response::deny('You do not have permission to restore this caseload.'); - } - - return $authenticatable->canOrElse( - abilities: ['caseload.*.restore', "caseload.{$caseload->id}.restore"], - denyResponse: 'You do not have permission to restore this caseload.' - ); - } - - public function forceDelete(Authenticatable $authenticatable, Caseload $caseload): Response - { - if (! $authenticatable->hasLicense($caseload->model?->class()::getLicenseType())) { - return Response::deny('You do not have permission to permanently delete this caseload.'); - } - - return $authenticatable->canOrElse( - abilities: ['caseload.*.force-delete', "caseload.{$caseload->id}.force-delete"], - denyResponse: 'You do not have permission to permanently delete this caseload.' - ); - } -} diff --git a/app-modules/caseload-management/src/Providers/CaseloadManagementServiceProvider.php b/app-modules/caseload-management/src/Providers/CaseloadManagementServiceProvider.php deleted file mode 100644 index cd59bd2b4..000000000 --- a/app-modules/caseload-management/src/Providers/CaseloadManagementServiceProvider.php +++ /dev/null @@ -1,72 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Providers; - -use Filament\Panel; -use Illuminate\Support\ServiceProvider; -use App\Registries\RoleBasedAccessControlRegistry; -use AdvisingApp\CaseloadManagement\Models\Caseload; -use Illuminate\Database\Eloquent\Relations\Relation; -use AdvisingApp\CaseloadManagement\Models\CaseloadSubject; -use AdvisingApp\CaseloadManagement\CaseloadManagementPlugin; -use AdvisingApp\CaseloadManagement\Observers\CaseloadObserver; -use AdvisingApp\CaseloadManagement\Registries\CaseloadManagementRbacRegistry; - -class CaseloadManagementServiceProvider extends ServiceProvider -{ - public function register() - { - Panel::configureUsing(fn (Panel $panel) => ($panel->getId() !== 'admin') || $panel->plugin(new CaseloadManagementPlugin())); - } - - public function boot() - { - Relation::morphMap([ - 'caseload' => Caseload::class, - 'caseload_subject' => CaseloadSubject::class, - ]); - - $this->registerObservers(); - - RoleBasedAccessControlRegistry::register(CaseloadManagementRbacRegistry::class); - } - - protected function registerObservers(): void - { - Caseload::observe(CaseloadObserver::class); - } -} diff --git a/app-modules/caseload-management/src/Registries/CaseloadManagementRbacRegistry.php b/app-modules/caseload-management/src/Registries/CaseloadManagementRbacRegistry.php deleted file mode 100644 index 3f209b138..000000000 --- a/app-modules/caseload-management/src/Registries/CaseloadManagementRbacRegistry.php +++ /dev/null @@ -1,71 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\CaseloadManagement\Registries; - -use AdvisingApp\Authorization\AuthorizationRoleRegistry; -use App\Registries\Contracts\RegistersRolesAndPermissions; -use AdvisingApp\Authorization\AuthorizationPermissionRegistry; - -class CaseloadManagementRbacRegistry implements RegistersRolesAndPermissions -{ - public function registerRolesAndPermissions(): void - { - $permissionRegistry = app(AuthorizationPermissionRegistry::class); - - $permissionRegistry->registerApiPermissions( - module: 'caseload-management', - path: 'permissions/api/custom' - ); - - $permissionRegistry->registerWebPermissions( - module: 'caseload-management', - path: 'permissions/web/custom' - ); - - $roleRegistry = app(AuthorizationRoleRegistry::class); - - $roleRegistry->registerApiRoles( - module: 'caseload-management', - path: 'roles/api' - ); - - $roleRegistry->registerWebRoles( - module: 'caseload-management', - path: 'roles/web' - ); - } -} diff --git a/app-modules/caseload-management/tests/Filament/CaseloadResource/CreateCaseloadTest.php b/app-modules/caseload-management/tests/Filament/CaseloadResource/CreateCaseloadTest.php deleted file mode 100644 index 8c77a392f..000000000 --- a/app-modules/caseload-management/tests/Filament/CaseloadResource/CreateCaseloadTest.php +++ /dev/null @@ -1,59 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -use App\Models\User; - -use function Pest\Laravel\actingAs; - -use AdvisingApp\Authorization\Enums\LicenseType; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource; - -test('CreateCaseload is gated with proper access control', function () { - $user = User::factory()->licensed(LicenseType::cases())->create(); - - actingAs($user) - ->get( - CaseloadResource::getUrl('create') - )->assertForbidden(); - - $user->givePermissionTo('caseload.view-any'); - $user->givePermissionTo('caseload.create'); - - actingAs($user) - ->get( - CaseloadResource::getUrl('create') - )->assertSuccessful(); -}); diff --git a/app-modules/caseload-management/tests/Filament/CaseloadResource/EditCaseloadTest.php b/app-modules/caseload-management/tests/Filament/CaseloadResource/EditCaseloadTest.php deleted file mode 100644 index 68b27d947..000000000 --- a/app-modules/caseload-management/tests/Filament/CaseloadResource/EditCaseloadTest.php +++ /dev/null @@ -1,62 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -use App\Models\User; - -use function Pest\Laravel\actingAs; - -use AdvisingApp\Authorization\Enums\LicenseType; -use AdvisingApp\CaseloadManagement\Models\Caseload; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource; - -test('EditCaseload is gated with proper access control', function () { - $user = User::factory()->licensed(LicenseType::cases())->create(); - - $caseload = Caseload::factory()->create(); - - actingAs($user) - ->get( - CaseloadResource::getUrl('edit', ['record' => $caseload]) - )->assertForbidden(); - - $user->givePermissionTo('caseload.view-any'); - $user->givePermissionTo('caseload.*.update'); - - actingAs($user) - ->get( - CaseloadResource::getUrl('edit', ['record' => $caseload]) - )->assertSuccessful(); -}); diff --git a/app-modules/caseload-management/tests/Filament/CaseloadResource/ListCaseloadsTest.php b/app-modules/caseload-management/tests/Filament/CaseloadResource/ListCaseloadsTest.php deleted file mode 100644 index 84f35958e..000000000 --- a/app-modules/caseload-management/tests/Filament/CaseloadResource/ListCaseloadsTest.php +++ /dev/null @@ -1,58 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Aiding App™ is licensed under the Elastic License 2.0. For more details, - see - - Notice: - - - You may not provide the software to third parties as a hosted or managed - service, where the service provides users with access to any substantial set of - the features or functionality of the software. - - You may not move, change, disable, or circumvent the license key functionality - in the software, and you may not remove or obscure any functionality in the - software that is protected by the license key. - - You may not alter, remove, or obscure any licensing, copyright, or other notices - of the licensor in the software. Any use of the licensor’s trademarks is subject - to applicable law. - - Canyon GBS LLC respects the intellectual property rights of others and expects the - same in return. Canyon GBS™ and Aiding App™ are registered trademarks of - Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks - vigorously. - - The software solution, including services, infrastructure, and code, is offered as a - Software as a Service (SaaS) by Canyon GBS LLC. - - Use of this software implies agreement to the license terms and conditions as stated - in the Elastic License 2.0. - - For more information or inquiries please visit our website at - or contact us via email at legal@canyongbs.com. - - -*/ - -use App\Models\User; - -use function Pest\Laravel\actingAs; - -use AdvisingApp\Authorization\Enums\LicenseType; -use AdvisingApp\CaseloadManagement\Filament\Resources\CaseloadResource; - -test('ListCaseloads is gated with proper access control', function () { - $user = User::factory()->licensed(LicenseType::cases())->create(); - - actingAs($user) - ->get( - CaseloadResource::getUrl('index') - )->assertForbidden(); - - $user->givePermissionTo('caseload.view-any'); - - actingAs($user) - ->get( - CaseloadResource::getUrl('index') - )->assertSuccessful(); -}); diff --git a/app-modules/contact/src/Filament/Resources/ContactResource/Pages/ListContacts.php b/app-modules/contact/src/Filament/Resources/ContactResource/Pages/ListContacts.php index 15cfa4934..c0658a53d 100644 --- a/app-modules/contact/src/Filament/Resources/ContactResource/Pages/ListContacts.php +++ b/app-modules/contact/src/Filament/Resources/ContactResource/Pages/ListContacts.php @@ -62,14 +62,11 @@ use AdvisingApp\Contact\Models\ContactStatus; use Filament\Tables\Actions\DeleteBulkAction; use AdvisingApp\Contact\Imports\ContactImporter; -use AdvisingApp\CaseloadManagement\Models\Caseload; -use AdvisingApp\CaseloadManagement\Enums\CaseloadModel; use AdvisingApp\Contact\Filament\Resources\ContactResource; use AdvisingApp\Engagement\Filament\Actions\BulkEngagementAction; use AdvisingApp\Notification\Filament\Actions\SubscribeBulkAction; use AdvisingApp\CareTeam\Filament\Actions\ToggleCareTeamBulkAction; use AdvisingApp\Notification\Filament\Actions\SubscribeTableAction; -use AdvisingApp\CaseloadManagement\Actions\TranslateCaseloadFilters; use AdvisingApp\Engagement\Filament\Actions\Contracts\HasBulkEngagementAction; use AdvisingApp\Engagement\Filament\Actions\Concerns\ImplementsHasBulkEngagementAction; @@ -122,26 +119,6 @@ public function table(Table $table): Table ->sortable(), ]) ->filters([ - SelectFilter::make('my_caseloads') - ->label('My Caseloads') - ->options( - auth()->user()->caseloads() - ->where('model', CaseloadModel::Contact) - ->pluck('name', 'id'), - ) - ->searchable() - ->optionsLimit(20) - ->query(fn (Builder $query, array $data) => $this->caseloadFilter($query, $data)), - SelectFilter::make('all_caseloads') - ->label('All Caseloads') - ->options( - Caseload::all() - ->where('model', CaseloadModel::Contact) - ->pluck('name', 'id'), - ) - ->searchable() - ->optionsLimit(20) - ->query(fn (Builder $query, array $data) => $this->caseloadFilter($query, $data)), SelectFilter::make('status_id') ->relationship('status', 'name') ->multiple() @@ -252,19 +229,6 @@ function (Builder $query) { ]); } - protected function caseloadFilter(Builder $query, array $data): void - { - if (blank($data['value'])) { - return; - } - - $query->whereKey( - app(TranslateCaseloadFilters::class) - ->handle($data['value']) - ->pluck($query->getModel()->getQualifiedKeyName()), - ); - } - protected function getHeaderActions(): array { return [ diff --git a/app-modules/contact/src/Filament/Widgets/ContactStats.php b/app-modules/contact/src/Filament/Widgets/ContactStats.php index 345d8566a..3ff1a39c6 100644 --- a/app-modules/contact/src/Filament/Widgets/ContactStats.php +++ b/app-modules/contact/src/Filament/Widgets/ContactStats.php @@ -43,7 +43,6 @@ use AdvisingApp\Alert\Enums\AlertStatus; use Filament\Widgets\StatsOverviewWidget; use Filament\Widgets\StatsOverviewWidget\Stat; -use AdvisingApp\CaseloadManagement\Enums\CaseloadModel; class ContactStats extends StatsOverviewWidget { @@ -68,10 +67,6 @@ protected function getStats(): array ->remember("user-{$user->getKey()}-contact-alerts-count", now()->addHour(), function () use ($user): int { return $user->contactAlerts()->status(AlertStatus::Active)->count(); })), - Stat::make('Caseloads', Cache::tags(["user-{$user->getKey()}-contact-caseloads"]) - ->remember("user-{$user->getKey()}-contact-caseloads-count", now()->addHour(), function () use ($user): int { - return $user->caseloads()->model(CaseloadModel::Contact)->count(); - })), ]; } } diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ListStudents.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ListStudents.php index f35034bd0..4f021192b 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ListStudents.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ListStudents.php @@ -42,19 +42,15 @@ use Filament\Tables\Columns\TextColumn; use Filament\Forms\Components\TextInput; use Filament\Resources\Pages\ListRecords; -use Filament\Tables\Filters\SelectFilter; use Illuminate\Database\Eloquent\Builder; use Filament\Tables\Filters\TernaryFilter; use Filament\Tables\Actions\BulkActionGroup; use Filament\Tables\Actions\DeleteBulkAction; use AdvisingApp\StudentDataModel\Models\Student; -use AdvisingApp\CaseloadManagement\Models\Caseload; -use AdvisingApp\CaseloadManagement\Enums\CaseloadModel; use AdvisingApp\Engagement\Filament\Actions\BulkEngagementAction; use AdvisingApp\Notification\Filament\Actions\SubscribeBulkAction; use AdvisingApp\CareTeam\Filament\Actions\ToggleCareTeamBulkAction; use AdvisingApp\Notification\Filament\Actions\SubscribeTableAction; -use AdvisingApp\CaseloadManagement\Actions\TranslateCaseloadFilters; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\Engagement\Filament\Actions\Contracts\HasBulkEngagementAction; use AdvisingApp\Engagement\Filament\Actions\Concerns\ImplementsHasBulkEngagementAction; @@ -85,26 +81,6 @@ public function table(Table $table): Table ->searchable(), ]) ->filters([ - SelectFilter::make('my_caseloads') - ->label('My Caseloads') - ->options( - auth()->user()->caseloads() - ->where('model', CaseloadModel::Student) - ->pluck('name', 'id'), - ) - ->searchable() - ->optionsLimit(20) - ->query(fn (Builder $query, array $data) => $this->caseloadFilter($query, $data)), - SelectFilter::make('all_caseloads') - ->label('All Caseloads') - ->options( - Caseload::all() - ->where('model', CaseloadModel::Student) - ->pluck('name', 'id'), - ) - ->searchable() - ->optionsLimit(20) - ->query(fn (Builder $query, array $data) => $this->caseloadFilter($query, $data)), Filter::make('subscribed') ->query(fn (Builder $query): Builder => $query->whereRelation('subscriptions.user', 'id', auth()->id())), TernaryFilter::make('sap') @@ -147,19 +123,6 @@ function (Builder $query) { ]); } - protected function caseloadFilter(Builder $query, array $data): void - { - if (blank($data['value'])) { - return; - } - - $query->whereKey( - app(TranslateCaseloadFilters::class) - ->handle($data['value']) - ->pluck($query->getModel()->getQualifiedKeyName()), - ); - } - protected function getHeaderActions(): array { return []; diff --git a/app-modules/student-data-model/src/Filament/Widgets/StudentStats.php b/app-modules/student-data-model/src/Filament/Widgets/StudentStats.php index b6b3551bd..767d4a082 100644 --- a/app-modules/student-data-model/src/Filament/Widgets/StudentStats.php +++ b/app-modules/student-data-model/src/Filament/Widgets/StudentStats.php @@ -43,7 +43,6 @@ use Filament\Widgets\StatsOverviewWidget; use Filament\Widgets\StatsOverviewWidget\Stat; use AdvisingApp\StudentDataModel\Models\Student; -use AdvisingApp\CaseloadManagement\Enums\CaseloadModel; class StudentStats extends StatsOverviewWidget { @@ -68,10 +67,6 @@ protected function getStats(): array ->remember("user-{$user->getKey()}-student-alerts-count", now()->addHour(), function () use ($user): int { return $user->studentAlerts()->status(AlertStatus::Active)->count(); })), - Stat::make('Caseloads', Cache::tags(["user-{$user->getKey()}-student-caseloads"]) - ->remember("user-{$user->getKey()}-student-caseloads-count", now()->addHour(), function () use ($user): int { - return $user->caseloads()->model(CaseloadModel::Student)->count(); - })), ]; } } diff --git a/app/Models/User.php b/app/Models/User.php index aa2391107..3abbe3a9a 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -64,7 +64,6 @@ use Staudenmeir\EloquentHasManyDeep\HasManyDeep; use AdvisingApp\Notification\Models\Subscription; use Illuminate\Database\Eloquent\Relations\HasOne; -use AdvisingApp\CaseloadManagement\Models\Caseload; use AdvisingApp\Consent\Models\Concerns\CanConsent; use AdvisingApp\MeetingCenter\Models\CalendarEvent; use Illuminate\Database\Eloquent\Concerns\HasUuids; @@ -216,11 +215,6 @@ public function conversations(): BelongsToMany ->using(TwilioConversationUser::class); } - public function caseloads(): HasMany - { - return $this->hasMany(Caseload::class); - } - public function licenses(): HasMany { return $this->hasMany(License::class, 'user_id'); diff --git a/composer.json b/composer.json index 103b7da5e..213223015 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,6 @@ "canyon-gbs/advising-app-audit": "*", "canyon-gbs/advising-app-authorization": "*", "canyon-gbs/advising-app-care-team": "*", - "canyon-gbs/advising-app-caseload-management": "*", "canyon-gbs/advising-app-consent": "*", "canyon-gbs/advising-app-division": "*", "canyon-gbs/advising-app-engagement": "*", diff --git a/composer.lock b/composer.lock index d5251736c..39414c9a6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "84e126bc7834a508a7205fdb35e9648d", + "content-hash": "f9a7e1d7d6e216bf837bf71fa77135b2", "packages": [ { "name": "amphp/amp", @@ -1795,41 +1795,6 @@ "relative": true } }, - { - "name": "canyon-gbs/advising-app-caseload-management", - "version": "1.0", - "dist": { - "type": "path", - "url": "app-modules/caseload-management", - "reference": "8d0e90d94e710181086fd8087935b2f7370d0505" - }, - "require": { - "filament/filament": "^3.0.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "AdvisingApp\\CaseloadManagement\\Providers\\CaseloadManagementServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "AdvisingApp\\CaseloadManagement\\": "src/", - "AdvisingApp\\CaseloadManagement\\Tests\\": "tests/", - "AdvisingApp\\CaseloadManagement\\Database\\Factories\\": "database/factories/", - "AdvisingApp\\CaseloadManagement\\Database\\Seeders\\": "database/seeders/" - } - }, - "license": [ - "proprietary" - ], - "transport-options": { - "symlink": true, - "relative": true - } - }, { "name": "canyon-gbs/advising-app-consent", "version": "1.0", @@ -22915,5 +22880,5 @@ "ext-pdo": "*" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } From 74d7f2c225bf8170fc89c2ccd21db660281dc019 Mon Sep 17 00:00:00 2001 From: dgoetzit Date: Fri, 1 Mar 2024 21:13:43 +0000 Subject: [PATCH 2/2] chore: fix enforcement of copyright on all files --- _ide_helper_models.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/_ide_helper_models.php b/_ide_helper_models.php index 97e232543..51d4212a3 100644 --- a/_ide_helper_models.php +++ b/_ide_helper_models.php @@ -1,5 +1,39 @@ + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Aiding App™ is licensed under the Elastic License 2.0. For more details, + see + + Notice: + + - You may not provide the software to third parties as a hosted or managed + service, where the service provides users with access to any substantial set of + the features or functionality of the software. + - You may not move, change, disable, or circumvent the license key functionality + in the software, and you may not remove or obscure any functionality in the + software that is protected by the license key. + - You may not alter, remove, or obscure any licensing, copyright, or other notices + of the licensor in the software. Any use of the licensor’s trademarks is subject + to applicable law. + - Canyon GBS LLC respects the intellectual property rights of others and expects the + same in return. Canyon GBS™ and Aiding App™ are registered trademarks of + Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks + vigorously. + - The software solution, including services, infrastructure, and code, is offered as a + Software as a Service (SaaS) by Canyon GBS LLC. + - Use of this software implies agreement to the license terms and conditions as stated + in the Elastic License 2.0. + + For more information or inquiries please visit our website at + or contact us via email at legal@canyongbs.com. + + +*/ + // @formatter:off // phpcs:ignoreFile /**