From 65208023a542e070b85374fd322bde937202767a Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Thu, 10 Oct 2024 05:42:12 +0000 Subject: [PATCH 01/55] init header and student profile section --- .../views/components/header/index.blade.php | 34 +++ .../views/components/page/index.blade.php | 151 +++++++++++ .../student-header-section.blade.php | 54 ++++ .../student-profile-section.blade.php | 51 ++++ .../student-resource/view-student.blade.php | 52 ++++ .../Filament/Resources/StudentResource.php | 48 ++-- .../StudentResource/Pages/ViewStudent.php | 241 +++++++++++------- .../Components/StudentHeaderSection.php | 35 +++ .../Components/StudentProfileInformation.php | 30 +++ .../student-header-section.blade.php | 57 +++++ .../student-profile-information.blade.php | 54 ++++ 11 files changed, 692 insertions(+), 115 deletions(-) create mode 100644 app-modules/student-data-model/resources/views/components/header/index.blade.php create mode 100644 app-modules/student-data-model/resources/views/components/page/index.blade.php create mode 100644 app-modules/student-data-model/resources/views/components/student-header-section.blade.php create mode 100644 app-modules/student-data-model/resources/views/components/student-profile-section.blade.php create mode 100644 app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php create mode 100644 app/Infolists/Components/StudentHeaderSection.php create mode 100644 app/Infolists/Components/StudentProfileInformation.php create mode 100644 resources/views/infolists/components/student-header-section.blade.php create mode 100644 resources/views/infolists/components/student-profile-information.blade.php diff --git a/app-modules/student-data-model/resources/views/components/header/index.blade.php b/app-modules/student-data-model/resources/views/components/header/index.blade.php new file mode 100644 index 0000000000..5c1d82edba --- /dev/null +++ b/app-modules/student-data-model/resources/views/components/header/index.blade.php @@ -0,0 +1,34 @@ +@props([ + 'actions' => [], + 'breadcrumbs' => [], + 'heading', + 'subheading' => null, +]) + +
class(['fi-header flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between']) }} +> +
+ @if ($breadcrumbs) +
+ +
$breadcrumbs, + ]) + > + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_HEADER_ACTIONS_BEFORE, scopes: $this->getRenderHookScopes()) }} + + @if ($actions) + + @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_HEADER_ACTIONS_AFTER, scopes: $this->getRenderHookScopes()) }} +
+
diff --git a/app-modules/student-data-model/resources/views/components/page/index.blade.php b/app-modules/student-data-model/resources/views/components/page/index.blade.php new file mode 100644 index 0000000000..142acdf4c1 --- /dev/null +++ b/app-modules/student-data-model/resources/views/components/page/index.blade.php @@ -0,0 +1,151 @@ +@props([ + 'fullHeight' => false, +]) + +@php + use Filament\Pages\SubNavigationPosition; + + $subNavigation = $this->getCachedSubNavigation(); + $subNavigationPosition = $this->getSubNavigationPosition(); + $widgetData = $this->getWidgetData(); +@endphp + +
class([ + 'fi-page', + 'h-full' => $fullHeight, + ]) + }} +> + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_START, scopes: $this->getRenderHookScopes()) }} + +
$fullHeight, + ]) + > + @if ($header = $this->getHeader()) + {{ $header }} + @elseif ($heading = $this->getHeading()) + @php + $subheading = $this->getSubheading(); + @endphp + + + + @endif + +
$subNavigation, + match ($subNavigationPosition) { + SubNavigationPosition::Start, SubNavigationPosition::End => 'md:flex-row md:items-start', + default => null, + } => $subNavigation, + 'h-full' => $fullHeight, + ]) + > + @if ($subNavigation) + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_SELECT_BEFORE, scopes: $this->getRenderHookScopes()) }} + + + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_SELECT_AFTER, scopes: $this->getRenderHookScopes()) }} + + @if ($subNavigationPosition === SubNavigationPosition::Start) + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_START_BEFORE, scopes: $this->getRenderHookScopes()) }} + + + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_START_AFTER, scopes: $this->getRenderHookScopes()) }} + @endif + + @if ($subNavigationPosition === SubNavigationPosition::Top) + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_TOP_BEFORE, scopes: $this->getRenderHookScopes()) }} + + + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_TOP_AFTER, scopes: $this->getRenderHookScopes()) }} + @endif + @endif + +
$fullHeight, + ]) + > + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_HEADER_WIDGETS_BEFORE, scopes: $this->getRenderHookScopes()) }} + + @if ($headerWidgets = $this->getVisibleHeaderWidgets()) + + @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_HEADER_WIDGETS_AFTER, scopes: $this->getRenderHookScopes()) }} + + {{ $slot }} + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_FOOTER_WIDGETS_BEFORE, scopes: $this->getRenderHookScopes()) }} + + @if ($footerWidgets = $this->getVisibleFooterWidgets()) + + @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_FOOTER_WIDGETS_AFTER, scopes: $this->getRenderHookScopes()) }} +
+ + @if ($subNavigation && $subNavigationPosition === SubNavigationPosition::End) + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_END_BEFORE, scopes: $this->getRenderHookScopes()) }} + + + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_END_AFTER, scopes: $this->getRenderHookScopes()) }} + @endif +
+ + @if ($footer = $this->getFooter()) + {{ $footer }} + @endif +
+ + @if (! ($this instanceof \Filament\Tables\Contracts\HasTable)) + + @elseif ($this->isTableLoaded() && filled($this->defaultTableAction)) +
+ @endif + + @if (filled($this->defaultAction)) +
+ @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_END, scopes: $this->getRenderHookScopes()) }} + + +
diff --git a/app-modules/student-data-model/resources/views/components/student-header-section.blade.php b/app-modules/student-data-model/resources/views/components/student-header-section.blade.php new file mode 100644 index 0000000000..e53f807107 --- /dev/null +++ b/app-modules/student-data-model/resources/views/components/student-header-section.blade.php @@ -0,0 +1,54 @@ +
+ @if ($this->getNameWords()) +
+ {{ $this->getNameWords() }} +
+ @endif +
+

{{ $record?->full_name }}

+
+
+ + Student +
+
+ + Goes by "{{ $record?->preferred }}" +
+
+ + {{ $record?->phone }} +
+
+ + {{ $record?->email }} +
+
+ + {{ $record?->hsgrad }} +
+
+
+ @if ($record?->firstgen) + + First Gen + + @endif + @if ($record?->dual) + + Dual + + @endif + @if ($record?->sap) + + SAP + + @endif + @if ($record?->dfw) + + DFW {{ $record?->dfw }} + + @endif +
+
+
diff --git a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php new file mode 100644 index 0000000000..dca1a6aac4 --- /dev/null +++ b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php @@ -0,0 +1,51 @@ +
+
+
+ Profile Information +
+
+
+
+

Alternate Email

+

{{ $record?->email_2 }}

+
+
+

Phone

+

{{ $record?->phone }}

+
+
+

Address

+

{{ $record?->address }}

+
+
+
+
+

Ethnicity

+

{{ $record?->ethnicity }}

+
+
+

Birthdate

+

{{ $record?->birthdate }}

+
+
+

High School Graduation

+

{{ $record?->hsgrad }}

+
+
+
+
+

First Term

+

{{ $record?->f_e_term }}

+
+
+

Recent Term

+

{{ $record?->mr_e_term }}

+
+
+

SIS Holds

+

{{ $record?->holds }}

+
+
+
+
+
diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php new file mode 100644 index 0000000000..79ad995932 --- /dev/null +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -0,0 +1,52 @@ +getResource()::getSlug()), + 'fi-resource-record-' . $record->getKey(), + ]) +> + @php + $relationManagers = $this->getRelationManagers(); + $hasCombinedRelationManagerTabsWithContent = $this->hasCombinedRelationManagerTabsWithContent(); + @endphp + + {{-- @if ((! $hasCombinedRelationManagerTabsWithContent) || (! count($relationManagers))) + @if ($this->hasInfolist()) + {{ $this->infolist }} + @else +
+ {{ $this->form }} +
+ @endif + @endif --}} + + {{-- Header Section --}} + + + {{-- End header section --}} + + {{-- @if (count($relationManagers)) + + @if ($hasCombinedRelationManagerTabsWithContent) + + @if ($this->hasInfolist()) + {{ $this->infolist }} + @else + {{ $this->form }} + @endif + + @endif + + @endif --}} +
diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php index 09393c440d..3f198a1149 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php @@ -73,34 +73,26 @@ class StudentResource extends Resource protected static ?string $recordTitleAttribute = 'full_name'; - public static function canAccess(): bool - { - /** @var User $user */ - $user = auth()->user(); - - return parent::canAccess() && $user->can('student.view-any'); - } - - public static function getRecordSubNavigation(Page $page): array - { - return $page->generateNavigationItems([ - ViewStudent::class, - ManageStudentInformation::class, - ManageStudentEngagement::class, - ManageStudentFiles::class, - ManageStudentAlerts::class, - ManageStudentTasks::class, - ManageStudentSubscriptions::class, - ManageStudentInteractions::class, - StudentEngagementTimeline::class, - ManageStudentCareTeam::class, - ManageStudentFormSubmissions::class, - ManageStudentApplicationSubmissions::class, - StudentServiceManagement::class, - ManageStudentEvents::class, - ManageStudentPrograms::class, - ]); - } + // public static function getRecordSubNavigation(Page $page): array + // { + // return $page->generateNavigationItems([ + // ViewStudent::class, + // ManageStudentInformation::class, + // ManageStudentEngagement::class, + // ManageStudentFiles::class, + // ManageStudentAlerts::class, + // ManageStudentTasks::class, + // ManageStudentSubscriptions::class, + // ManageStudentInteractions::class, + // StudentEngagementTimeline::class, + // ManageStudentCareTeam::class, + // ManageStudentFormSubmissions::class, + // ManageStudentApplicationSubmissions::class, + // StudentServiceManagement::class, + // ManageStudentEvents::class, + // ManageStudentPrograms::class, + // ]); + // } public static function modifyGlobalSearchQuery(Builder $query, string $search): void { diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php index 6cbcc8b4e4..e78a4bff60 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php @@ -49,17 +49,25 @@ use Filament\Infolists\Components\IconEntry; use Filament\Infolists\Components\TextEntry; use AdvisingApp\StudentDataModel\Models\Student; +use App\Infolists\Components\StudentHeaderSection; use AdvisingApp\Notification\Filament\Actions\SubscribeHeaderAction; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\StudentDataModel\Settings\StudentInformationSystemSettings; +use App\Infolists\Components\StudentProfileInformation; +use Filament\Infolists\Components\Split; +use Illuminate\Support\Str; class ViewStudent extends ViewRecord { protected static string $resource = StudentResource::class; + protected static string $view = 'student-data-model::filament.resources.student-resource.view-student'; + // TODO: Automatically set from Filament protected static ?string $navigationLabel = 'View'; + protected static string $layout = 'filament-panels::components.layout.index'; + public function boot() { $sisSettings = app(StudentInformationSystemSettings::class); @@ -70,7 +78,7 @@ public function boot() ) { FilamentView::registerRenderHook( PanelsRenderHook::PAGE_HEADER_ACTIONS_BEFORE, - fn (): View => view('student-data-model::filament.resources.student-resource.sis-sync', [ + fn(): View => view('student-data-model::filament.resources.student-resource.sis-sync', [ 'student' => $this->getRecord(), ]), scopes: ViewStudent::class, @@ -78,95 +86,141 @@ public function boot() } } - public function infolist(Infolist $infolist): Infolist + public function getTitle(): string { - return $infolist - ->schema([ - Section::make('Characteristics') - ->schema([ - TextEntry::make('sisid') - ->label('Student ID'), - TextEntry::make('otherid') - ->label('Other ID'), - TextEntry::make('f_e_term') - ->label('First Enrollment Term') - ->default('N/A'), - TextEntry::make('mr_e_term') - ->label('Most Recent Enrollment Term') - ->default('N/A'), - ]) - ->columns(2), - Section::make('Demographics') - ->schema([ - TextEntry::make('first') - ->label('First Name'), - TextEntry::make('last') - ->label('Last Name'), - TextEntry::make('full_name') - ->label('Full Name'), - TextEntry::make('preferred') - ->label('Preferred Name') - ->default('N/A'), - TextEntry::make('birthdate'), - TextEntry::make('hsgrad') - ->label('High School Graduation') - ->default('N/A'), - IconEntry::make('firstgen') - ->label('First Generation') - ->boolean(), - TextEntry::make('ethnicity'), - IconEntry::make('dual') - ->label('Dual') - ->boolean(), - ]) - ->columns(2), - Section::make('Contact Information') - ->schema([ - TextEntry::make('email') - ->label('Email Address'), - TextEntry::make('email_2') - ->label('Alternate Email') - ->default('N/A'), - TextEntry::make('mobile'), - TextEntry::make('phone'), - TextEntry::make('address'), - TextEntry::make('address2') - ->label('Apartment/Unit Number') - ->default('N/A'), - TextEntry::make('address3') - ->label('Additional Address') - ->default('N/A'), - TextEntry::make('city'), - TextEntry::make('state'), - TextEntry::make('postal'), - ]) - ->columns(2), - Section::make('Engagement Restrictions') - ->schema([ - IconEntry::make('sms_opt_out') - ->label('SMS Opt Out') - ->boolean(), - IconEntry::make('email_bounce') - ->label('Email Bounce') - ->boolean(), - IconEntry::make('ferpa') - ->label('FERPA') - ->boolean(), - ]) - ->columns(2), - Section::make('Impediments') - ->schema([ - TextEntry::make('dfw') - ->label('DFW'), - IconEntry::make('sap') - ->label('SAP') - ->boolean(), - TextEntry::make('holds'), - ]) - ->columns(2), - ]); + if (filled(static::$title)) { + return static::$title; + } + + return __('filament-panels::resources/pages/view-record.title'); } + // public function getTitle(): string + // { + // return false; // or return false; + // } + + // public function infolist(Infolist $infolist): Infolist + // { + // return $infolist + // ->schema([ + // StudentHeaderSection::make() + // ->state($this->getRecord())->columnSpanFull(), + // StudentProfileInformation::make('Profile Information') + // ->state($this->getRecord())->columnSpanFull(), + // // Split::make([ + // // Section::make('Profile Information') + // // ->schema([ + // // TextEntry::make('sisid') + // // ->label('Student ID'), + // // TextEntry::make('otherid') + // // ->label('Other ID'), + // // TextEntry::make('f_e_term') + // // ->label('First Enrollment Term') + // // ->default('N/A'), + // // TextEntry::make('mr_e_term') + // // ->label('Most Recent Enrollment Term') + // // ->default('N/A'), + // // ]), + // // Section::make('Profile Information') + // // ->schema([ + // // TextEntry::make('sisid') + // // ->label('Student ID'), + // // TextEntry::make('otherid') + // // ->label('Other ID'), + // // TextEntry::make('f_e_term') + // // ->label('First Enrollment Term') + // // ->default('N/A'), + // // TextEntry::make('mr_e_term') + // // ->label('Most Recent Enrollment Term') + // // ->default('N/A'), + // // ]), + // // ])->from('md') + // // Section::make('Characteristics') + // // ->schema([ + // // TextEntry::make('sisid') + // // ->label('Student ID'), + // // TextEntry::make('otherid') + // // ->label('Other ID'), + // // TextEntry::make('f_e_term') + // // ->label('First Enrollment Term') + // // ->default('N/A'), + // // TextEntry::make('mr_e_term') + // // ->label('Most Recent Enrollment Term') + // // ->default('N/A'), + // // ]) + // // ->columns(2), + // // Section::make('Demographics') + // // ->schema([ + // // TextEntry::make('first') + // // ->label('First Name'), + // // TextEntry::make('last') + // // ->label('Last Name'), + // // TextEntry::make('full_name') + // // ->label('Full Name'), + // // TextEntry::make('preferred') + // // ->label('Preferred Name') + // // ->default('N/A'), + // // TextEntry::make('birthdate'), + // // TextEntry::make('hsgrad') + // // ->label('High School Graduation') + // // ->default('N/A'), + // // IconEntry::make('firstgen') + // // ->label('First Generation') + // // ->boolean(), + // // TextEntry::make('ethnicity'), + // // IconEntry::make('dual') + // // ->label('Dual') + // // ->boolean(), + // // ]) + // // ->columns(2), + // // Section::make('Contact Information') + // // ->schema([ + // // TextEntry::make('email') + // // ->label('Email Address'), + // // TextEntry::make('email_2') + // // ->label('Alternate Email') + // // ->default('N/A'), + // // TextEntry::make('mobile'), + // // TextEntry::make('phone'), + // // TextEntry::make('address'), + // // TextEntry::make('address2') + // // ->label('Apartment/Unit Number') + // // ->default('N/A'), + // // TextEntry::make('address3') + // // ->label('Additional Address') + // // ->default('N/A'), + // // TextEntry::make('city'), + // // TextEntry::make('state'), + // // TextEntry::make('postal'), + // // ]) + // // ->columns(2), + // // Section::make('Engagement Restrictions') + // // ->schema([ + // // IconEntry::make('sms_opt_out') + // // ->label('SMS Opt Out') + // // ->boolean(), + // // IconEntry::make('email_bounce') + // // ->label('Email Bounce') + // // ->boolean(), + // // IconEntry::make('ferpa') + // // ->label('FERPA') + // // ->boolean(), + // // ]) + // // ->columns(2), + // // Section::make('Impediments') + // // ->schema([ + // // TextEntry::make('dfw') + // // ->label('DFW'), + // // IconEntry::make('sap') + // // ->label('SAP') + // // ->boolean(), + // // TextEntry::make('holds'), + // // ]) + // // ->columns(2), + // ]); + // } + public function sisRefresh() { $tenantId = Tenant::current()->getKey(); @@ -202,10 +256,23 @@ public function sisRefresh() ->send(); } + public function getNameWords(): string + { + return collect(Str::of($this->record?->full_name)->explode(' ')) + ->map(function ($word) { + return Str::substr($word, 0, 1); + })->implode(''); + } + protected function getHeaderActions(): array { return [ SubscribeHeaderAction::make(), ]; } + + // public function getRecordTitle(?Model $record): string | Htmlable | null + // { + // return ''; + // } } diff --git a/app/Infolists/Components/StudentHeaderSection.php b/app/Infolists/Components/StudentHeaderSection.php new file mode 100644 index 0000000000..a8ff8aa501 --- /dev/null +++ b/app/Infolists/Components/StudentHeaderSection.php @@ -0,0 +1,35 @@ +name = $name; + + return $this; + } + + public function getNameWords(): string + { + $name = collect(Str::of($this->getState()?->full_name)->explode(' ')) + ->map(function ($word) { + return Str::substr($word, 0, 1); + })->implode(''); + + return $this->evaluate($name); + } +} diff --git a/app/Infolists/Components/StudentProfileInformation.php b/app/Infolists/Components/StudentProfileInformation.php new file mode 100644 index 0000000000..c779a995f9 --- /dev/null +++ b/app/Infolists/Components/StudentProfileInformation.php @@ -0,0 +1,30 @@ + $heading]); + } + + function heading(string | Closure $heading): static + { + $this->heading = $heading; + + return $this; + } + + public function getHeading(): string | Closure + { + return $this->evaluate($this->heading); + } +} diff --git a/resources/views/infolists/components/student-header-section.blade.php b/resources/views/infolists/components/student-header-section.blade.php new file mode 100644 index 0000000000..060f3a8529 --- /dev/null +++ b/resources/views/infolists/components/student-header-section.blade.php @@ -0,0 +1,57 @@ +
+
+ @if ($getNameWords()) +
+ {{ $getNameWords() }} +
+ @endif +
+

{{ $getState()?->full_name }}

+
+
+ + Student +
+
+ + Goes by "{{ $getState()?->preferred }}" +
+
+ + {{ $getState()?->phone }} +
+
+ + {{ $getState()?->email }} +
+
+ + {{ $getState()?->hsgrad }} +
+
+
+ @if ($getState()?->firstgen) + + First Gen + + @endif + @if ($getState()?->dual) + + Dual + + @endif + @if ($getState()?->sap) + + SAP + + @endif + @if ($getState()?->dfw) + + DFW {{ $getState()?->dfw }} + + @endif +
+
+
+ {{ $getChildComponentContainer() }} +
diff --git a/resources/views/infolists/components/student-profile-information.blade.php b/resources/views/infolists/components/student-profile-information.blade.php new file mode 100644 index 0000000000..785c23ceee --- /dev/null +++ b/resources/views/infolists/components/student-profile-information.blade.php @@ -0,0 +1,54 @@ +
+
+
+
+ {{ $getHeading() }} +
+
+
+
+

Alternate Email

+

{{ $getState()?->email_2 }}

+
+
+

Phone

+

{{ $getState()?->phone }}

+
+
+

Address

+

{{ $getState()?->address }}

+
+
+
+
+

Ethnicity

+

{{ $getState()?->ethnicity }}

+
+
+

Birthdate

+

{{ $getState()?->birthdate }}

+
+
+

High School Graduation

+

{{ $getState()?->hsgrad }}

+
+
+
+
+

First Term

+

{{ $getState()?->f_e_term }}

+
+
+

Recent Term

+

{{ $getState()?->mr_e_term }}

+
+
+

SIS Holds

+

{{ $getState()?->holds }}

+
+
+
+
+
+ {{ $getChildComponentContainer() }} +
From d3addfdcd89bc3b48f6aec3d65bdf8699a89ca28 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Thu, 10 Oct 2024 05:44:23 +0000 Subject: [PATCH 02/55] chore: fix enforcement of copyright on all files --- .../views/components/header/index.blade.php | 33 ++++++++++++++++++ .../views/components/page/index.blade.php | 33 ++++++++++++++++++ .../student-header-section.blade.php | 33 ++++++++++++++++++ .../student-profile-section.blade.php | 33 ++++++++++++++++++ .../student-resource/view-student.blade.php | 33 ++++++++++++++++++ .../Components/StudentHeaderSection.php | 34 +++++++++++++++++++ .../Components/StudentProfileInformation.php | 34 +++++++++++++++++++ .../student-header-section.blade.php | 33 ++++++++++++++++++ .../student-profile-information.blade.php | 33 ++++++++++++++++++ 9 files changed, 299 insertions(+) diff --git a/app-modules/student-data-model/resources/views/components/header/index.blade.php b/app-modules/student-data-model/resources/views/components/header/index.blade.php index 5c1d82edba..d6d266479a 100644 --- a/app-modules/student-data-model/resources/views/components/header/index.blade.php +++ b/app-modules/student-data-model/resources/views/components/header/index.blade.php @@ -1,3 +1,36 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}} @props([ 'actions' => [], 'breadcrumbs' => [], diff --git a/app-modules/student-data-model/resources/views/components/page/index.blade.php b/app-modules/student-data-model/resources/views/components/page/index.blade.php index 142acdf4c1..270de057bb 100644 --- a/app-modules/student-data-model/resources/views/components/page/index.blade.php +++ b/app-modules/student-data-model/resources/views/components/page/index.blade.php @@ -1,3 +1,36 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}} @props([ 'fullHeight' => false, ]) diff --git a/app-modules/student-data-model/resources/views/components/student-header-section.blade.php b/app-modules/student-data-model/resources/views/components/student-header-section.blade.php index e53f807107..6b361fec51 100644 --- a/app-modules/student-data-model/resources/views/components/student-header-section.blade.php +++ b/app-modules/student-data-model/resources/views/components/student-header-section.blade.php @@ -1,3 +1,36 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}}
@if ($this->getNameWords())
diff --git a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php index dca1a6aac4..6ce9236a6a 100644 --- a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php +++ b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php @@ -1,3 +1,36 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}}
diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index 79ad995932..21f03e65ad 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -1,3 +1,36 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}} + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + namespace App\Infolists\Components; use Filament\Infolists\Components\Component; diff --git a/app/Infolists/Components/StudentProfileInformation.php b/app/Infolists/Components/StudentProfileInformation.php index c779a995f9..a0e58f3c6e 100644 --- a/app/Infolists/Components/StudentProfileInformation.php +++ b/app/Infolists/Components/StudentProfileInformation.php @@ -1,5 +1,39 @@ + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + namespace App\Infolists\Components; use Closure; diff --git a/resources/views/infolists/components/student-header-section.blade.php b/resources/views/infolists/components/student-header-section.blade.php index 060f3a8529..4be5c6614c 100644 --- a/resources/views/infolists/components/student-header-section.blade.php +++ b/resources/views/infolists/components/student-header-section.blade.php @@ -1,3 +1,36 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}}
@if ($getNameWords()) diff --git a/resources/views/infolists/components/student-profile-information.blade.php b/resources/views/infolists/components/student-profile-information.blade.php index 785c23ceee..453b523759 100644 --- a/resources/views/infolists/components/student-profile-information.blade.php +++ b/resources/views/infolists/components/student-profile-information.blade.php @@ -1,3 +1,36 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}}
From f999121c6547c5fbb5ccab4074280c61f7e2c8f6 Mon Sep 17 00:00:00 2001 From: joelicatajr Date: Thu, 10 Oct 2024 05:46:10 +0000 Subject: [PATCH 03/55] chore: fix code style --- .../views/components/header/index.blade.php | 16 ++- .../views/components/page/index.blade.php | 82 ++++++---------- .../student-header-section.blade.php | 98 +++++++++++-------- .../student-profile-section.blade.php | 88 ++++++++--------- .../student-resource/view-student.blade.php | 14 ++- .../StudentResource/Pages/ViewStudent.php | 8 +- .../Components/StudentHeaderSection.php | 2 +- .../Components/StudentProfileInformation.php | 4 +- .../student-header-section.blade.php | 60 +++++++----- .../student-profile-information.blade.php | 44 ++++----- 10 files changed, 212 insertions(+), 204 deletions(-) diff --git a/app-modules/student-data-model/resources/views/components/header/index.blade.php b/app-modules/student-data-model/resources/views/components/header/index.blade.php index d6d266479a..880ebbf399 100644 --- a/app-modules/student-data-model/resources/views/components/header/index.blade.php +++ b/app-modules/student-data-model/resources/views/components/header/index.blade.php @@ -38,24 +38,20 @@ 'subheading' => null, ]) -
class(['fi-header flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between']) }} -> +
class(['fi-header flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between']) }}>
@if ($breadcrumbs)
-
$breadcrumbs, - ]) - > +
$breadcrumbs, + ])> {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_HEADER_ACTIONS_BEFORE, scopes: $this->getRenderHookScopes()) }} @if ($actions) diff --git a/app-modules/student-data-model/resources/views/components/page/index.blade.php b/app-modules/student-data-model/resources/views/components/page/index.blade.php index 270de057bb..f951b73a8d 100644 --- a/app-modules/student-data-model/resources/views/components/page/index.blade.php +++ b/app-modules/student-data-model/resources/views/components/page/index.blade.php @@ -43,22 +43,10 @@ $widgetData = $this->getWidgetData(); @endphp -
class([ - 'fi-page', - 'h-full' => $fullHeight, - ]) - }} -> +
class(['fi-page', 'h-full' => $fullHeight]) }}> {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_START, scopes: $this->getRenderHookScopes()) }} -
$fullHeight, - ]) - > +
$fullHeight])> @if ($header = $this->getHeader()) {{ $header }} @elseif ($heading = $this->getHeading()) @@ -73,31 +61,27 @@ @endif -
$subNavigation, - match ($subNavigationPosition) { - SubNavigationPosition::Start, SubNavigationPosition::End => 'md:flex-row md:items-start', - default => null, - } => $subNavigation, - 'h-full' => $fullHeight, - ]) - > +
$subNavigation, + match ($subNavigationPosition) { + SubNavigationPosition::Start, + SubNavigationPosition::End + => 'md:flex-row md:items-start', + default => null, + } => $subNavigation, + 'h-full' => $fullHeight, + ])> @if ($subNavigation) {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_SELECT_BEFORE, scopes: $this->getRenderHookScopes()) }} - + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_SELECT_AFTER, scopes: $this->getRenderHookScopes()) }} @if ($subNavigationPosition === SubNavigationPosition::Start) {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_START_BEFORE, scopes: $this->getRenderHookScopes()) }} - + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_START_AFTER, scopes: $this->getRenderHookScopes()) }} @endif @@ -105,28 +89,21 @@ @if ($subNavigationPosition === SubNavigationPosition::Top) {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_TOP_BEFORE, scopes: $this->getRenderHookScopes()) }} - + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_TOP_AFTER, scopes: $this->getRenderHookScopes()) }} @endif @endif -
$fullHeight, - ]) - > +
$fullHeight])> {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_HEADER_WIDGETS_BEFORE, scopes: $this->getRenderHookScopes()) }} @if ($headerWidgets = $this->getVisibleHeaderWidgets()) @endif @@ -138,10 +115,10 @@ class="fi-page-header-widgets" @if ($footerWidgets = $this->getVisibleFooterWidgets()) @endif @@ -151,9 +128,7 @@ class="fi-page-footer-widgets" @if ($subNavigation && $subNavigationPosition === SubNavigationPosition::End) {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_END_BEFORE, scopes: $this->getRenderHookScopes()) }} - + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_SUB_NAVIGATION_END_AFTER, scopes: $this->getRenderHookScopes()) }} @endif @@ -164,18 +139,25 @@ class="fi-page-footer-widgets" @endif
- @if (! ($this instanceof \Filament\Tables\Contracts\HasTable)) + @if (!($this instanceof \Filament\Tables\Contracts\HasTable)) @elseif ($this->isTableLoaded() && filled($this->defaultTableAction))
+ wire:init="mountTableAction(@js($this->defaultTableAction), @if (filled($this->defaultTableActionRecord)) +@js($this->defaultTableActionRecord) +@else +{{ 'null' }} +@endif @if (filled($this->defaultTableActionArguments)) +, @js($this->defaultTableActionArguments) +@endif)"> +
@endif @if (filled($this->defaultAction)) -
+
+
@endif {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::PAGE_END, scopes: $this->getRenderHookScopes()) }} diff --git a/app-modules/student-data-model/resources/views/components/student-header-section.blade.php b/app-modules/student-data-model/resources/views/components/student-header-section.blade.php index 6b361fec51..285bf5ce74 100644 --- a/app-modules/student-data-model/resources/views/components/student-header-section.blade.php +++ b/app-modules/student-data-model/resources/views/components/student-header-section.blade.php @@ -31,57 +31,73 @@ --}} -
- @if ($this->getNameWords()) +
+ @if ($this->getNameWords())
- {{ $this->getNameWords() }} + {{ $this->getNameWords() }}
- @endif -
-

{{ $record?->full_name }}

-
-
- - Student -
-
- - Goes by "{{ $record?->preferred }}" -
-
- - {{ $record?->phone }} -
-
- - {{ $record?->email }} -
-
- - {{ $record?->hsgrad }} -
+ @endif +
+

{{ $record?->full_name }}

+
+
+ + Student
-
- @if ($record?->firstgen) - +
+ + Goes by "{{ $record?->preferred }}" +
+
+ + {{ $record?->phone }} +
+
+ + {{ $record?->email }} +
+
+ + {{ $record?->hsgrad }} +
+
+
+ @if ($record?->firstgen) + First Gen - @endif - @if ($record?->dual) - + @endif + @if ($record?->dual) + Dual - @endif - @if ($record?->sap) - + @endif + @if ($record?->sap) + SAP - @endif - @if ($record?->dfw) - + @endif + @if ($record?->dfw) + DFW {{ $record?->dfw }} - @endif -
+ @endif
+
diff --git a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php index 6ce9236a6a..fe020173b8 100644 --- a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php +++ b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php @@ -31,54 +31,54 @@ --}} -
-
-
- Profile Information +
+
+
+ Profile Information +
+
+
+
+

Alternate Email

+

{{ $record?->email_2 }}

+
+
+

Phone

+

{{ $record?->phone }}

+
+
+

Address

+

{{ $record?->address }}

+
+
+
+
+

Ethnicity

+

{{ $record?->ethnicity }}

+
+
+

Birthdate

+

{{ $record?->birthdate }}

+
+
+

High School Graduation

+

{{ $record?->hsgrad }}

+
-
-
-
-

Alternate Email

-

{{ $record?->email_2 }}

-
-
-

Phone

-

{{ $record?->phone }}

-
-
-

Address

-

{{ $record?->address }}

-
+
+
+

First Term

+

{{ $record?->f_e_term }}

-
-
-

Ethnicity

-

{{ $record?->ethnicity }}

-
-
-

Birthdate

-

{{ $record?->birthdate }}

-
-
-

High School Graduation

-

{{ $record?->hsgrad }}

-
+
+

Recent Term

+

{{ $record?->mr_e_term }}

-
-
-

First Term

-

{{ $record?->f_e_term }}

-
-
-

Recent Term

-

{{ $record?->mr_e_term }}

-
-
-

SIS Holds

-

{{ $record?->holds }}

-
+
+

SIS Holds

+

{{ $record?->holds }}

+
diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index 21f03e65ad..2573b08a6a 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -31,19 +31,17 @@ --}} -getResource()::getSlug()), - 'fi-resource-record-' . $record->getKey(), - ]) -> +getResource()::getSlug()), + 'fi-resource-record-' . $record->getKey(), +])> @php $relationManagers = $this->getRelationManagers(); $hasCombinedRelationManagerTabsWithContent = $this->hasCombinedRelationManagerTabsWithContent(); @endphp - {{-- @if ((! $hasCombinedRelationManagerTabsWithContent) || (! count($relationManagers))) + {{-- @if (!$hasCombinedRelationManagerTabsWithContent || !count($relationManagers)) @if ($this->hasInfolist()) {{ $this->infolist }} @else diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php index e78a4bff60..cc8e0b37b3 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php @@ -39,9 +39,11 @@ use Throwable; use App\Models\Tenant; use App\Services\Olympus; +use Illuminate\Support\Str; use Filament\Infolists\Infolist; use Filament\View\PanelsRenderHook; use Illuminate\Contracts\View\View; +use Filament\Infolists\Components\Split; use Filament\Notifications\Notification; use Filament\Resources\Pages\ViewRecord; use Filament\Infolists\Components\Section; @@ -50,12 +52,10 @@ use Filament\Infolists\Components\TextEntry; use AdvisingApp\StudentDataModel\Models\Student; use App\Infolists\Components\StudentHeaderSection; +use App\Infolists\Components\StudentProfileInformation; use AdvisingApp\Notification\Filament\Actions\SubscribeHeaderAction; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\StudentDataModel\Settings\StudentInformationSystemSettings; -use App\Infolists\Components\StudentProfileInformation; -use Filament\Infolists\Components\Split; -use Illuminate\Support\Str; class ViewStudent extends ViewRecord { @@ -78,7 +78,7 @@ public function boot() ) { FilamentView::registerRenderHook( PanelsRenderHook::PAGE_HEADER_ACTIONS_BEFORE, - fn(): View => view('student-data-model::filament.resources.student-resource.sis-sync', [ + fn (): View => view('student-data-model::filament.resources.student-resource.sis-sync', [ 'student' => $this->getRecord(), ]), scopes: ViewStudent::class, diff --git a/app/Infolists/Components/StudentHeaderSection.php b/app/Infolists/Components/StudentHeaderSection.php index dfcf2fda89..8872e0294d 100644 --- a/app/Infolists/Components/StudentHeaderSection.php +++ b/app/Infolists/Components/StudentHeaderSection.php @@ -36,8 +36,8 @@ namespace App\Infolists\Components; -use Filament\Infolists\Components\Component; use Illuminate\Support\Str; +use Filament\Infolists\Components\Component; class StudentHeaderSection extends Component { diff --git a/app/Infolists/Components/StudentProfileInformation.php b/app/Infolists/Components/StudentProfileInformation.php index a0e58f3c6e..92929048fc 100644 --- a/app/Infolists/Components/StudentProfileInformation.php +++ b/app/Infolists/Components/StudentProfileInformation.php @@ -50,7 +50,7 @@ public static function make(string | Closure $heading): static return app(static::class, ['heading' => $heading]); } - function heading(string | Closure $heading): static + public function heading(string | Closure $heading): static { $this->heading = $heading; @@ -59,6 +59,6 @@ function heading(string | Closure $heading): static public function getHeading(): string | Closure { - return $this->evaluate($this->heading); + return $this->evaluate($this->heading); } } diff --git a/resources/views/infolists/components/student-header-section.blade.php b/resources/views/infolists/components/student-header-section.blade.php index 4be5c6614c..29ed61edfb 100644 --- a/resources/views/infolists/components/student-header-section.blade.php +++ b/resources/views/infolists/components/student-header-section.blade.php @@ -32,56 +32,72 @@ --}}
-
+
@if ($getNameWords()) -
- {{ $getNameWords() }} -
+
+ {{ $getNameWords() }} +
@endif

{{ $getState()?->full_name }}

-
+
- + Student
- + Goes by "{{ $getState()?->preferred }}"
- + {{ $getState()?->phone }}
- + {{ $getState()?->email }}
- + {{ $getState()?->hsgrad }}
@if ($getState()?->firstgen) - - First Gen - + + First Gen + @endif @if ($getState()?->dual) - - Dual - + + Dual + @endif @if ($getState()?->sap) - - SAP - + + SAP + @endif @if ($getState()?->dfw) - - DFW {{ $getState()?->dfw }} - + + DFW {{ $getState()?->dfw }} + @endif
diff --git a/resources/views/infolists/components/student-profile-information.blade.php b/resources/views/infolists/components/student-profile-information.blade.php index 453b523759..32886112e8 100644 --- a/resources/views/infolists/components/student-profile-information.blade.php +++ b/resources/views/infolists/components/student-profile-information.blade.php @@ -32,52 +32,52 @@ --}}
-
-
-
+
+
+
{{ $getHeading() }}
-
+
-

Alternate Email

-

{{ $getState()?->email_2 }}

+

Alternate Email

+

{{ $getState()?->email_2 }}

-

Phone

-

{{ $getState()?->phone }}

+

Phone

+

{{ $getState()?->phone }}

-

Address

-

{{ $getState()?->address }}

+

Address

+

{{ $getState()?->address }}

-

Ethnicity

-

{{ $getState()?->ethnicity }}

+

Ethnicity

+

{{ $getState()?->ethnicity }}

-

Birthdate

-

{{ $getState()?->birthdate }}

+

Birthdate

+

{{ $getState()?->birthdate }}

-

High School Graduation

-

{{ $getState()?->hsgrad }}

+

High School Graduation

+

{{ $getState()?->hsgrad }}

-

First Term

-

{{ $getState()?->f_e_term }}

+

First Term

+

{{ $getState()?->f_e_term }}

-

Recent Term

-

{{ $getState()?->mr_e_term }}

+

Recent Term

+

{{ $getState()?->mr_e_term }}

-

SIS Holds

-

{{ $getState()?->holds }}

+

SIS Holds

+

{{ $getState()?->holds }}

From d93980a080ae5499c6c209aa0610072e0a879a77 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Mon, 14 Oct 2024 17:35:22 +0000 Subject: [PATCH 04/55] add tables livewire component --- .../student-profile-section.blade.php | 87 +++++---- .../student-resource/view-student.blade.php | 11 +- .../livewire/manage-student-alerts.blade.php | 23 +++ .../manage-student-information.blade.php | 23 +++ .../Filament/Resources/StudentResource.php | 28 +-- .../Pages/ManageStudentFiles.php | 14 +- .../Pages/ManageStudentInteractions.php | 4 +- .../src/Livewire/ManageStudentAlerts.php | 178 ++++++++++++++++++ .../src/Livewire/ManageStudentInformation.php | 60 ++++++ 9 files changed, 360 insertions(+), 68 deletions(-) create mode 100644 app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php create mode 100644 app-modules/student-data-model/resources/views/livewire/manage-student-information.blade.php create mode 100644 app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php create mode 100644 app-modules/student-data-model/src/Livewire/ManageStudentInformation.php diff --git a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php index fe020173b8..3cabe7f96e 100644 --- a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php +++ b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php @@ -31,53 +31,52 @@ --}} -
-
-
- Profile Information + +
+
+ Profile Information +
+
+
+
+

Alternate Email

+

{{ $record?->email_2 }}

+
+
+

Phone

+

{{ $record?->phone }}

+
+
+

Address

+

{{ $record?->address }}

+
+
+
+
+

Ethnicity

+

{{ $record?->ethnicity }}

+
+
+

Birthdate

+

{{ $record?->birthdate }}

+
+
+

High School Graduation

+

{{ $record?->hsgrad }}

+
-
-
-
-

Alternate Email

-

{{ $record?->email_2 }}

-
-
-

Phone

-

{{ $record?->phone }}

-
-
-

Address

-

{{ $record?->address }}

-
+
+
+

First Term

+

{{ $record?->f_e_term }}

-
-
-

Ethnicity

-

{{ $record?->ethnicity }}

-
-
-

Birthdate

-

{{ $record?->birthdate }}

-
-
-

High School Graduation

-

{{ $record?->hsgrad }}

-
+
+

Recent Term

+

{{ $record?->mr_e_term }}

-
-
-

First Term

-

{{ $record?->f_e_term }}

-
-
-

Recent Term

-

{{ $record?->mr_e_term }}

-
-
-

SIS Holds

-

{{ $record?->holds }}

-
+
+

SIS Holds

+

{{ $record?->holds }}

diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index 2573b08a6a..accd144f1d 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -55,7 +55,16 @@ {{-- Header Section --}} - +
+ + +
+ + {{-- @livewire('filament.pages.your-page-name') --}} + + + {{-- --}} + {{-- End header section --}} {{-- @if (count($relationManagers)) diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php new file mode 100644 index 0000000000..e845dbcccd --- /dev/null +++ b/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php @@ -0,0 +1,23 @@ +
+ @if ($this->table->getColumns()) +
+ + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::RESOURCE_PAGES_MANAGE_RELATED_RECORDS_TABLE_BEFORE, scopes: $this->getRenderHookScopes()) }} + + {{ $this->table }} + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::RESOURCE_PAGES_MANAGE_RELATED_RECORDS_TABLE_AFTER, scopes: $this->getRenderHookScopes()) }} +
+ @endif + + @if (count($relationManagers = $this->getRelationManagers())) + + @endif +
diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-information.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-information.blade.php new file mode 100644 index 0000000000..e845dbcccd --- /dev/null +++ b/app-modules/student-data-model/resources/views/livewire/manage-student-information.blade.php @@ -0,0 +1,23 @@ +
+ @if ($this->table->getColumns()) +
+ + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::RESOURCE_PAGES_MANAGE_RELATED_RECORDS_TABLE_BEFORE, scopes: $this->getRenderHookScopes()) }} + + {{ $this->table }} + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::RESOURCE_PAGES_MANAGE_RELATED_RECORDS_TABLE_AFTER, scopes: $this->getRenderHookScopes()) }} +
+ @endif + + @if (count($relationManagers = $this->getRelationManagers())) + + @endif +
diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php index 3f198a1149..62d46092a5 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php @@ -123,21 +123,21 @@ public static function getPages(): array { return [ 'index' => ListStudents::route('/'), - 'manage-alerts' => ManageStudentAlerts::route('/{record}/alerts'), - 'manage-engagement' => ManageStudentEngagement::route('/{record}/engagement'), - 'manage-files' => ManageStudentFiles::route('/{record}/files'), - 'manage-form-submissions' => ManageStudentFormSubmissions::route('/{record}/form-submissions'), - 'manage-application-submissions' => ManageStudentApplicationSubmissions::route('/{record}/application-submissions'), - 'manage-information' => ManageStudentInformation::route('/{record}/information'), - 'manage-interactions' => ManageStudentInteractions::route('/{record}/interactions'), - 'manage-subscriptions' => ManageStudentSubscriptions::route('/{record}/subscriptions'), - 'manage-tasks' => ManageStudentTasks::route('/{record}/tasks'), + // 'manage-alerts' => ManageStudentAlerts::route('/{record}/alerts'), + // 'manage-engagement' => ManageStudentEngagement::route('/{record}/engagement'), + // 'manage-files' => ManageStudentFiles::route('/{record}/files'), + // 'manage-form-submissions' => ManageStudentFormSubmissions::route('/{record}/form-submissions'), + // 'manage-application-submissions' => ManageStudentApplicationSubmissions::route('/{record}/application-submissions'), + // 'manage-information' => ManageStudentInformation::route('/{record}/information'), + // 'manage-interactions' => ManageStudentInteractions::route('/{record}/interactions'), + // 'manage-subscriptions' => ManageStudentSubscriptions::route('/{record}/subscriptions'), + // 'manage-tasks' => ManageStudentTasks::route('/{record}/tasks'), 'view' => ViewStudent::route('/{record}'), - 'timeline' => StudentEngagementTimeline::route('/{record}/timeline'), - 'care-team' => ManageStudentCareTeam::route('/{record}/care-team'), - 'service-management' => StudentServiceManagement::route('/{record}/service-management'), - 'events' => ManageStudentEvents::route('/{record}/events'), - 'programs' => ManageStudentPrograms::route('/{record}/programs'), + // 'timeline' => StudentEngagementTimeline::route('/{record}/timeline'), + // 'care-team' => ManageStudentCareTeam::route('/{record}/care-team'), + // 'service-management' => StudentServiceManagement::route('/{record}/service-management'), + // 'events' => ManageStudentEvents::route('/{record}/events'), + // 'programs' => ManageStudentPrograms::route('/{record}/programs'), ]; } } diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php index 07fc56f96b..a4cdf06590 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php @@ -37,11 +37,11 @@ namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; use Illuminate\Database\Eloquent\Model; -use Filament\Resources\Pages\ManageRelatedRecords; +use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\Engagement\Filament\Resources\EngagementFileResource\RelationManagers\EngagementFilesRelationManager; -class ManageStudentFiles extends ManageRelatedRecords +class ManageStudentFiles extends RelationManager { protected static string $resource = StudentResource::class; @@ -50,7 +50,7 @@ class ManageStudentFiles extends ManageRelatedRecords protected static ?string $navigationLabel = 'Files and Documents'; - protected static ?string $breadcrumb = 'Files'; + protected static ?string $title = 'Files'; protected static ?string $navigationIcon = 'heroicon-o-folder'; @@ -59,10 +59,10 @@ public static function canAccess(array $arguments = []): bool return (bool) count(static::managers($arguments['record'] ?? null)); } - public function getRelationManagers(): array - { - return static::managers($this->getRecord()); - } + // public function getRelationManagers(): array + // { + // return static::managers($this->getRecord()); + // } private static function managers(?Model $record = null): array { diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInteractions.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInteractions.php index e8118a11cb..703b9cc795 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInteractions.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInteractions.php @@ -37,12 +37,12 @@ namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; use Filament\Forms\Form; -use Filament\Resources\Pages\ManageRelatedRecords; +use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\Interaction\Filament\Concerns\HasManyMorphedInteractionsTrait; use AdvisingApp\Interaction\Filament\Resources\InteractionResource\Pages\CreateInteraction; -class ManageStudentInteractions extends ManageRelatedRecords +class ManageStudentInteractions extends RelationManager { use HasManyMorphedInteractionsTrait; diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php b/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php new file mode 100644 index 0000000000..907015fdc4 --- /dev/null +++ b/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php @@ -0,0 +1,178 @@ + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + +namespace AdvisingApp\StudentDataModel\Livewire; + +use Filament\Forms\Form; +use Filament\Tables\Table; +use Filament\Infolists\Infolist; +use Filament\Forms\Components\Select; +use Illuminate\Support\Facades\Cache; +use Filament\Forms\Components\Textarea; +use Filament\Tables\Actions\EditAction; +use Filament\Tables\Actions\ViewAction; +use Filament\Tables\Columns\TextColumn; +use AdvisingApp\Alert\Enums\AlertStatus; +use App\Filament\Tables\Columns\IdColumn; +use Filament\Tables\Actions\CreateAction; +use Filament\Tables\Actions\DeleteAction; +use Filament\Tables\Filters\SelectFilter; +use AdvisingApp\Alert\Enums\AlertSeverity; +use Filament\Infolists\Components\TextEntry; +use Filament\Tables\Actions\BulkActionGroup; +use Filament\Tables\Actions\DeleteBulkAction; +use AdvisingApp\StudentDataModel\Models\Student; +use Filament\Resources\Pages\ManageRelatedRecords; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; + +class ManageStudentAlerts extends ManageRelatedRecords +{ + protected static string $resource = StudentResource::class; + + protected static string $relationship = 'alerts'; + + // TODO: Automatically set from Filament based on relationship name + protected static ?string $navigationLabel = 'Alerts'; + + // TODO: Automatically set from Filament based on relationship name + protected static ?string $title = 'Alerts'; + + protected static ?string $label = 'Files'; + + protected static ?string $navigationIcon = 'heroicon-o-bell-alert'; + + protected static string $view = 'student-data-model::livewire.manage-student-alerts'; + + public static function getNavigationItems(array $urlParameters = []): array + { + $item = parent::getNavigationItems($urlParameters)[0]; + + $ownerRecord = $urlParameters['record']; + + /** @var Student $ownerRecord */ + $alertsCount = Cache::tags('alert-count') + ->remember( + "alert-count-{$ownerRecord->getKey()}", + now()->addMinutes(5), + function () use ($ownerRecord): int { + return $ownerRecord->alerts()->status(AlertStatus::Active)->count(); + }, + ); + + $item->badge($alertsCount > 0 ? $alertsCount : null, color: 'danger'); + + return [$item]; + } + + public function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + TextEntry::make('description'), + TextEntry::make('severity'), + TextEntry::make('suggested_intervention'), + TextEntry::make('status'), + TextEntry::make('createdBy.name')->label('Created By')->default('N/A'), + TextEntry::make('created_at')->label('Created Date'), + ]); + } + + public function form(Form $form): Form + { + return $form + ->schema([ + Textarea::make('description') + ->required() + ->string(), + Select::make('severity') + ->options(AlertSeverity::class) + ->selectablePlaceholder(false) + ->default(AlertSeverity::default()) + ->required() + ->enum(AlertSeverity::class), + Textarea::make('suggested_intervention') + ->required() + ->string(), + Select::make('status') + ->options(AlertStatus::class) + ->selectablePlaceholder(false) + ->default(AlertStatus::default()) + ->required() + ->enum(AlertStatus::class), + ]); + } + + public function table(Table $table): Table + { + return $table + ->recordTitleAttribute('description') + ->columns([ + IdColumn::make(), + TextColumn::make('description') + ->limit(), + TextColumn::make('severity') + ->sortable(), + TextColumn::make('status') + ->sortable(), + TextColumn::make('created_at') + ->sortable(), + ]) + ->filters([ + SelectFilter::make('severity') + ->options(AlertSeverity::class), + SelectFilter::make('status') + ->options(AlertStatus::class), + ]) + ->headerActions([ + CreateAction::make() + ->mutateFormDataUsing(function (array $data): array { + $data['created_by'] = auth()->id(); + + return $data; + }), + ]) + ->actions([ + ViewAction::make(), + EditAction::make(), + DeleteAction::make(), + ]) + ->bulkActions([ + BulkActionGroup::make([ + DeleteBulkAction::make(), + ]), + ]); + } +} diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php new file mode 100644 index 0000000000..6ce33ee889 --- /dev/null +++ b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php @@ -0,0 +1,60 @@ +record = $this->resolveRecord($record); + + $this->authorizeAccess(); + + $this->previousUrl = url()->previous(); + + $this->loadDefaultActiveTab(); + } + + public static function canAccess(array $arguments = []): bool + { + return (bool) count(static::managers($arguments['record'] ?? null)); + } + + public function getRelationManagers(): array + { + return static::managers($this->getRecord()); + } + + private static function managers(?Model $record = null): array + { + return collect([ + ProgramsRelationManager::class, + EnrollmentsRelationManager::class, + ManageStudentInteractions::class, + ManageStudentFiles::class, + ]) + ->reject(fn ($relationManager) => $record && (! $relationManager::canViewForRecord($record, static::class))) + ->toArray(); + } +} From fb853a818d32b0287a4bceeea2b24c191cd71dd5 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Mon, 14 Oct 2024 17:36:15 +0000 Subject: [PATCH 05/55] chore: fix enforcement of copyright on all files --- .../livewire/manage-student-alerts.blade.php | 33 ++++++++++++++++++ .../manage-student-information.blade.php | 33 ++++++++++++++++++ .../src/Livewire/ManageStudentInformation.php | 34 +++++++++++++++++++ 3 files changed, 100 insertions(+) diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php index e845dbcccd..774270d360 100644 --- a/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php +++ b/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php @@ -1,3 +1,36 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}}
@if ($this->table->getColumns())
diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-information.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-information.blade.php index e845dbcccd..774270d360 100644 --- a/app-modules/student-data-model/resources/views/livewire/manage-student-information.blade.php +++ b/app-modules/student-data-model/resources/views/livewire/manage-student-information.blade.php @@ -1,3 +1,36 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}}
@if ($this->table->getColumns())
diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php index 6ce33ee889..7b5b674b35 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php @@ -1,5 +1,39 @@ + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + namespace AdvisingApp\StudentDataModel\Livewire; use Illuminate\Database\Eloquent\Model; From d38cb6b1f72dc6eecfb69c9806409c0734fcb7ea Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Tue, 15 Oct 2024 18:04:08 +0000 Subject: [PATCH 06/55] added relation manager tabs and other component (wip) --- .../relation-managers-component.blade.php | 56 +++ .../student-resource/view-student.blade.php | 72 ++-- .../livewire/manage-student-alerts.blade.php | 24 +- .../manage-student-care-team.blade.php | 34 ++ .../manage-student-form-submissions.blade.php | 56 +++ .../manage-student-subscriptions.blade.php | 34 ++ .../livewire/manage-student-tasks.blade.php | 34 ++ .../student-engagement-timeline.blade.php | 111 ++++++ .../Pages/ManageStudentEvents.php | 12 +- .../StudentFormSubmissionsRelationManager.php | 137 +++++++ .../src/Livewire/ManageStudentAlerts.php | 48 ++- .../src/Livewire/ManageStudentCareTeam.php | 144 ++++++++ .../src/Livewire/ManageStudentEngagement.php | 344 ++++++++++++++++++ .../Livewire/ManageStudentFormSubmissions.php | 111 ++++++ .../src/Livewire/ManageStudentInformation.php | 1 + .../Livewire/ManageStudentSubscriptions.php | 143 ++++++++ .../src/Livewire/ManageStudentTasks.php | 57 +++ .../Livewire/StudentEngagementTimeline.php | 66 ++++ .../BaseTaskRelationManager.php | 54 +-- 19 files changed, 1401 insertions(+), 137 deletions(-) create mode 100644 app-modules/student-data-model/resources/views/components/relation-managers-component.blade.php create mode 100644 app-modules/student-data-model/resources/views/livewire/manage-student-care-team.blade.php create mode 100644 app-modules/student-data-model/resources/views/livewire/manage-student-form-submissions.blade.php create mode 100644 app-modules/student-data-model/resources/views/livewire/manage-student-subscriptions.blade.php create mode 100644 app-modules/student-data-model/resources/views/livewire/manage-student-tasks.blade.php create mode 100644 app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php create mode 100644 app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php create mode 100644 app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php create mode 100644 app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php create mode 100644 app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php create mode 100644 app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php create mode 100644 app-modules/student-data-model/src/Livewire/ManageStudentTasks.php create mode 100644 app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php diff --git a/app-modules/student-data-model/resources/views/components/relation-managers-component.blade.php b/app-modules/student-data-model/resources/views/components/relation-managers-component.blade.php new file mode 100644 index 0000000000..774270d360 --- /dev/null +++ b/app-modules/student-data-model/resources/views/components/relation-managers-component.blade.php @@ -0,0 +1,56 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}} +
+ @if ($this->table->getColumns()) +
+ + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::RESOURCE_PAGES_MANAGE_RELATED_RECORDS_TABLE_BEFORE, scopes: $this->getRenderHookScopes()) }} + + {{ $this->table }} + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::RESOURCE_PAGES_MANAGE_RELATED_RECORDS_TABLE_AFTER, scopes: $this->getRenderHookScopes()) }} +
+ @endif + + @if (count($relationManagers = $this->getRelationManagers())) + + @endif +
diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index accd144f1d..ac380e6171 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -36,57 +36,27 @@ 'fi-resource-' . str_replace('/', '-', $this->getResource()::getSlug()), 'fi-resource-record-' . $record->getKey(), ])> - @php - $relationManagers = $this->getRelationManagers(); - $hasCombinedRelationManagerTabsWithContent = $this->hasCombinedRelationManagerTabsWithContent(); - @endphp - - {{-- @if (!$hasCombinedRelationManagerTabsWithContent || !count($relationManagers)) - @if ($this->hasInfolist()) - {{ $this->infolist }} - @else -
- {{ $this->form }} -
- @endif - @endif --}} - - {{-- Header Section --}} -
- - +
+
+ + +
+
+
+ +
+ + + + +
+ + +
+
- - {{-- @livewire('filament.pages.your-page-name') --}} - - - {{-- --}} - - {{-- End header section --}} - - {{-- @if (count($relationManagers)) - - @if ($hasCombinedRelationManagerTabsWithContent) - - @if ($this->hasInfolist()) - {{ $this->infolist }} - @else - {{ $this->form }} - @endif - - @endif - - @endif --}} diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php index 774270d360..f2bc54ca8e 100644 --- a/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php +++ b/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php @@ -31,26 +31,4 @@ --}} -
- @if ($this->table->getColumns()) -
- - - {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::RESOURCE_PAGES_MANAGE_RELATED_RECORDS_TABLE_BEFORE, scopes: $this->getRenderHookScopes()) }} - - {{ $this->table }} - - {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::RESOURCE_PAGES_MANAGE_RELATED_RECORDS_TABLE_AFTER, scopes: $this->getRenderHookScopes()) }} -
- @endif - - @if (count($relationManagers = $this->getRelationManagers())) - - @endif -
+ diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-care-team.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-care-team.blade.php new file mode 100644 index 0000000000..f2bc54ca8e --- /dev/null +++ b/app-modules/student-data-model/resources/views/livewire/manage-student-care-team.blade.php @@ -0,0 +1,34 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}} + diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-form-submissions.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-form-submissions.blade.php new file mode 100644 index 0000000000..774270d360 --- /dev/null +++ b/app-modules/student-data-model/resources/views/livewire/manage-student-form-submissions.blade.php @@ -0,0 +1,56 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}} +
+ @if ($this->table->getColumns()) +
+ + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::RESOURCE_PAGES_MANAGE_RELATED_RECORDS_TABLE_BEFORE, scopes: $this->getRenderHookScopes()) }} + + {{ $this->table }} + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::RESOURCE_PAGES_MANAGE_RELATED_RECORDS_TABLE_AFTER, scopes: $this->getRenderHookScopes()) }} +
+ @endif + + @if (count($relationManagers = $this->getRelationManagers())) + + @endif +
diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-subscriptions.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-subscriptions.blade.php new file mode 100644 index 0000000000..f2bc54ca8e --- /dev/null +++ b/app-modules/student-data-model/resources/views/livewire/manage-student-subscriptions.blade.php @@ -0,0 +1,34 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}} + diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-tasks.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-tasks.blade.php new file mode 100644 index 0000000000..f2bc54ca8e --- /dev/null +++ b/app-modules/student-data-model/resources/views/livewire/manage-student-tasks.blade.php @@ -0,0 +1,34 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}} + diff --git a/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php b/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php new file mode 100644 index 0000000000..a0e9172fb4 --- /dev/null +++ b/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php @@ -0,0 +1,111 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}} +@if ($timelineRecords->count() < 1) + +@else +
    + @foreach ($timelineRecords as $record) +
  1. + @if (!$loop->last) +
    +
    +
    + @endif + + + + +
    + @if ($record->timelineable()->timeline()->providesCustomView()) + + + + + + @else + + + + + + @endif +
    + +
  2. + @endforeach + @if ($hasMorePages === true) +
    + @else +
    +
    + {{ $noMoreRecordsMessage }} +
    +
    + @endif +
+@endif diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php index 293254ba9c..9dd88687db 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php @@ -40,27 +40,21 @@ use Filament\Tables\Columns\TextColumn; use App\Filament\Tables\Columns\IdColumn; use Illuminate\Database\Eloquent\Builder; -use Filament\Resources\Pages\ManageRelatedRecords; use AdvisingApp\MeetingCenter\Models\EventAttendee; use AdvisingApp\MeetingCenter\Enums\EventAttendeeStatus; +use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\MeetingCenter\Filament\Resources\EventResource; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\MeetingCenter\Filament\Actions\InviteEventAttendeeAction; use AdvisingApp\MeetingCenter\Filament\Actions\Table\ViewEventAttendeeAction; -class ManageStudentEvents extends ManageRelatedRecords +class ManageStudentEvents extends RelationManager { protected static string $resource = StudentResource::class; protected static string $relationship = 'eventAttendeeRecords'; - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Events'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $breadcrumb = 'Events'; - - protected static ?string $navigationIcon = 'heroicon-o-calendar-days'; + protected static ?string $title = 'Events'; public function table(Table $table): Table { diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php new file mode 100644 index 0000000000..31ae72d581 --- /dev/null +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php @@ -0,0 +1,137 @@ + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + +namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; + +use Filament\Tables\Table; +use Carbon\CarbonInterface; +use Filament\Infolists\Infolist; +use Filament\Tables\Actions\ViewAction; +use Filament\Tables\Columns\TextColumn; +use Illuminate\Database\Eloquent\Model; +use App\Filament\Tables\Columns\IdColumn; +use Filament\Tables\Actions\DeleteAction; +use AdvisingApp\Form\Models\FormSubmission; +use Filament\Infolists\Components\TextEntry; +use Filament\Tables\Actions\BulkActionGroup; +use Filament\Tables\Actions\DeleteBulkAction; +use AdvisingApp\Form\Enums\FormSubmissionStatus; +use AdvisingApp\Form\Filament\Resources\FormResource; +use Filament\Resources\RelationManagers\RelationManager; +use AdvisingApp\Form\Filament\Actions\RequestFormSubmission; +use AdvisingApp\Form\Filament\Tables\Filters\FormSubmissionStatusFilter; + +class StudentFormSubmissionsRelationManager extends RelationManager +{ + protected static string $relationship = 'formSubmissions'; + + protected static ?string $title = 'Forms'; + + public function infolist(Infolist $infolist): Infolist + { + return $infolist + ->schema([ + TextEntry::make('sisid') + ->label('SISID'), + TextEntry::make('otherid') + ->label('STUID'), + TextEntry::make('division') + ->label('College'), + TextEntry::make('descr') + ->label('Program'), + TextEntry::make('foi') + ->label('Field of Interest'), + TextEntry::make('cum_gpa') + ->label('Cumulative GPA'), + TextEntry::make('declare_dt') + ->label('Start Date'), + TextEntry::make('change_dt') + ->label('Last Action Date'), + ]); + } + + public function table(Table $table): Table + { + return $table + ->columns([ + IdColumn::make(), + TextColumn::make('submissible.name') + ->label('Form') + ->searchable() + ->url(fn (FormSubmission $record): string => FormResource::getUrl('edit', ['record' => $record->submissible])), + TextColumn::make('status') + ->badge() + ->getStateUsing(fn (FormSubmission $record): FormSubmissionStatus => $record->getStatus()), + TextColumn::make('submitted_at') + ->dateTime() + ->sortable(), + TextColumn::make('requester.name'), + TextColumn::make('requested_at') + ->dateTime() + ->getStateUsing(fn (FormSubmission $record): ?CarbonInterface => $record->requester ? $record->created_at : null), + ]) + ->filters([ + FormSubmissionStatusFilter::make(), + ]) + ->headerActions([ + RequestFormSubmission::make(), + ]) + ->actions([ + ViewAction::make() + ->modalHeading(fn (FormSubmission $record) => 'Submission Details: ' . $record->submitted_at->format('M j, Y H:i:s')) + ->modalContent(fn (FormSubmission $record) => view('form::submission', ['submission' => $record])) + ->visible(fn (FormSubmission $record) => $record->submitted_at), + DeleteAction::make(), + ]) + ->bulkActions([ + BulkActionGroup::make([ + DeleteBulkAction::make(), + ]), + ]); + } + + public function getTableRecordKey(Model $record): string + { + return base64_encode(json_encode($record->attributesToArray())); + } + + protected function resolveTableRecord(?string $key): ?Model + { + return $this->getTable()->getQuery() + ->where(json_decode(base64_decode($key), associative: true)) + ->first(); + } +} diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php b/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php index 907015fdc4..1463c2c6f7 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php @@ -55,47 +55,41 @@ use Filament\Tables\Actions\BulkActionGroup; use Filament\Tables\Actions\DeleteBulkAction; use AdvisingApp\StudentDataModel\Models\Student; -use Filament\Resources\Pages\ManageRelatedRecords; +use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -class ManageStudentAlerts extends ManageRelatedRecords +class ManageStudentAlerts extends RelationManager { protected static string $resource = StudentResource::class; protected static string $relationship = 'alerts'; - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Alerts'; + // protected static ?string $title = 'Alerts'; - // TODO: Automatically set from Filament based on relationship name - protected static ?string $title = 'Alerts'; + // protected static ?string $label = 'Alerts'; - protected static ?string $label = 'Files'; + // protected static string $view = 'student-data-model::livewire.manage-student-alerts'; - protected static ?string $navigationIcon = 'heroicon-o-bell-alert'; + // public static function getNavigationItems(array $urlParameters = []): array + // { + // $item = parent::getNavigationItems($urlParameters)[0]; - protected static string $view = 'student-data-model::livewire.manage-student-alerts'; + // $ownerRecord = $urlParameters['record']; - public static function getNavigationItems(array $urlParameters = []): array - { - $item = parent::getNavigationItems($urlParameters)[0]; - - $ownerRecord = $urlParameters['record']; + // /** @var Student $ownerRecord */ + // $alertsCount = Cache::tags('alert-count') + // ->remember( + // "alert-count-{$ownerRecord->getKey()}", + // now()->addMinutes(5), + // function () use ($ownerRecord): int { + // return $ownerRecord->alerts()->status(AlertStatus::Active)->count(); + // }, + // ); - /** @var Student $ownerRecord */ - $alertsCount = Cache::tags('alert-count') - ->remember( - "alert-count-{$ownerRecord->getKey()}", - now()->addMinutes(5), - function () use ($ownerRecord): int { - return $ownerRecord->alerts()->status(AlertStatus::Active)->count(); - }, - ); + // $item->badge($alertsCount > 0 ? $alertsCount : null, color: 'danger'); - $item->badge($alertsCount > 0 ? $alertsCount : null, color: 'danger'); - - return [$item]; - } + // return [$item]; + // } public function infolist(Infolist $infolist): Infolist { diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php b/app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php new file mode 100644 index 0000000000..339884bee7 --- /dev/null +++ b/app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php @@ -0,0 +1,144 @@ + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + +namespace AdvisingApp\StudentDataModel\Livewire; + +use App\Models\User; +use Filament\Tables\Table; +use App\Models\Scopes\HasLicense; +use Filament\Forms\Components\Select; +use Filament\Tables\Columns\TextColumn; +use App\Filament\Resources\UserResource; +use App\Filament\Tables\Columns\IdColumn; +use Filament\Tables\Actions\AttachAction; +use Filament\Tables\Actions\DetachAction; +use Illuminate\Database\Eloquent\Builder; +use Filament\Tables\Actions\BulkActionGroup; +use Filament\Tables\Actions\DetachBulkAction; +use AdvisingApp\StudentDataModel\Models\Student; +use Filament\Resources\Pages\ManageRelatedRecords; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; + +class ManageStudentCareTeam extends ManageRelatedRecords +{ + protected static string $resource = StudentResource::class; + + protected static string $relationship = 'careTeam'; + + protected static string $view = 'student-data-model::livewire.manage-student-care-team'; + + public function table(Table $table): Table + { + return $table + ->recordTitleAttribute('name') + ->columns([ + IdColumn::make(), + TextColumn::make('name') + ->url(fn ($record) => UserResource::getUrl('view', ['record' => $record])) + ->color('primary'), + TextColumn::make('job_title'), + ]) + ->headerActions([ + AttachAction::make() + ->label('Manage') + ->modalHeading(function () { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return "Add a User to {$student->display_name}'s Care Team"; + }) + ->modalSubmitActionLabel('Add') + ->attachAnother(false) + ->color('primary') + ->recordSelect( + fn (Select $select) => $select->placeholder('Select Users'), + ) + ->multiple() + ->recordSelectOptionsQuery( + fn (Builder $query) => $query->tap(new HasLicense(Student::getLicenseType())), + ) + ->successNotificationTitle(function (array $data) { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + if (count($data['recordId']) > 1) { + return count($data['recordId']) . " users were added to {$student->display_name}'s Care Team"; + } + $record = User::find($data['recordId'][0]); + + return "{$record->name} was added to {$student->display_name}'s Care Team"; + }), + ]) + ->actions([ + DetachAction::make() + ->label('Remove') + ->modalHeading(function (User $record) { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return "Remove {$record->name} from {$student->display_name}'s Care Team"; + }) + ->modalSubmitActionLabel('Remove') + ->successNotificationTitle(function (User $record) { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return "{$record->name} was removed from {$student->display_name}'s Care Team"; + }), + ]) + ->bulkActions([ + BulkActionGroup::make([ + DetachBulkAction::make() + ->label('Remove selected') + ->modalHeading(function () { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return "Remove selected users from {$student->display_name}'s Care Team"; + }) + ->modalSubmitActionLabel('Remove') + ->successNotificationTitle(function () { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return "All selected users were removed from {$student->display_name}'s Care Team"; + }), + ]), + ]) + ->emptyStateHeading('No Users') + ->inverseRelationship('studentCareTeams'); + } +} diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php b/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php new file mode 100644 index 0000000000..106b524836 --- /dev/null +++ b/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php @@ -0,0 +1,344 @@ + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + +namespace AdvisingApp\StudentDataModel\Livewire; + +use Filament\Forms\Get; +use Filament\Forms\Set; +use Filament\Forms\Form; +use Filament\Tables\Table; +use Filament\Infolists\Infolist; +use Illuminate\Support\HtmlString; +use Filament\Forms\Components\Select; +use Filament\Forms\Components\Toggle; +use Filament\Forms\Components\Actions; +use FilamentTiptapEditor\TiptapEditor; +use Filament\Forms\Components\Checkbox; +use Filament\Forms\Components\Fieldset; +use Filament\Tables\Actions\ViewAction; +use Filament\Tables\Columns\TextColumn; +use Filament\Forms\Components\TextInput; +use AdvisingApp\Prospect\Models\Prospect; +use AdvisingApp\Timeline\Models\Timeline; +use Filament\Tables\Actions\CreateAction; +use Filament\Tables\Filters\SelectFilter; +use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Query\Expression; +use Filament\Infolists\Components\IconEntry; +use Filament\Infolists\Components\TextEntry; +use AdvisingApp\Engagement\Models\Engagement; +use Filament\Forms\Components\Actions\Action; +use Filament\Forms\Components\DateTimePicker; +use AdvisingApp\Engagement\Models\EmailTemplate; +use AdvisingApp\Engagement\Models\EngagementResponse; +use Filament\Resources\RelationManagers\RelationManager; +use AdvisingApp\Engagement\Enums\EngagementDeliveryMethod; +use AdvisingApp\Engagement\Enums\EngagementDeliveryStatus; +use AdvisingApp\Engagement\Models\Contracts\HasDeliveryMethod; +use AdvisingApp\Engagement\Actions\CreateEngagementDeliverable; +use Filament\Infolists\Components\Fieldset as InfolistFieldset; +use AdvisingApp\Engagement\Filament\Resources\EngagementResource\Fields\EngagementSmsBodyField; +use AdvisingApp\Engagement\Filament\ManageRelatedRecords\ManageRelatedEngagementRecords\Actions\DraftWithAiAction; +use AdvisingApp\StudentDataModel\Models\Student; + +class ManageStudentEngagement extends RelationManager +{ + // TODO: Obsolete when there is no table, remove from Filament + protected static string $relationship = 'timeline'; + + protected static ?string $title = 'Messages'; + + public function infolist(Infolist $infolist): Infolist + { + return $infolist->schema(fn(Timeline $record) => match ($record->timelineable::class) { + Engagement::class => [ + TextEntry::make('user.name') + ->label('Created By') + ->getStateUsing(fn(Timeline $record): string => $record->timelineable->user->name), + InfolistFieldset::make('Content') + ->schema([ + TextEntry::make('subject') + ->getStateUsing(fn(Timeline $record): ?string => $record->timelineable->subject) + ->hidden(fn($state): bool => blank($state)) + ->columnSpanFull(), + TextEntry::make('body') + ->getStateUsing(fn(Timeline $record): HtmlString => $record->timelineable->getBody()) + ->columnSpanFull(), + ]), + InfolistFieldset::make('deliverable') + ->label('Delivery Information') + ->columnSpanFull() + ->schema([ + TextEntry::make('deliverable.channel') + ->label('Channel') + ->getStateUsing(function (Timeline $record): string { + /** @var HasDeliveryMethod $timelineable */ + $timelineable = $record->timelineable; + + return $timelineable->getDeliveryMethod()->getLabel(); + }), + IconEntry::make('deliverable.delivery_status') + ->getStateUsing(fn(Timeline $record): EngagementDeliveryStatus => $record->timelineable->deliverable->delivery_status) + ->icon(fn(EngagementDeliveryStatus $state): string => $state->getIconClass()) + ->color(fn(EngagementDeliveryStatus $state): string => $state->getColor()) + ->label('Status'), + TextEntry::make('deliverable.delivered_at') + ->getStateUsing(fn(Timeline $record): string => $record->timelineable->deliverable->delivered_at) + ->label('Delivered At') + ->hidden(fn(Timeline $record): bool => is_null($record->timelineable->deliverable->delivered_at)), + TextEntry::make('deliverable.delivery_response') + ->getStateUsing(fn(Timeline $record): string => $record->timelineable->deliverable->delivery_response) + ->label('Error Details') + ->hidden(fn(Timeline $record): bool => is_null($record->timelineable->deliverable->delivery_response)), + ]) + ->columns(), + ], + EngagementResponse::class => [ + TextEntry::make('content'), + TextEntry::make('sent_at') + ->dateTime('Y-m-d H:i:s'), + ], + }); + } + + public function form(Form $form): Form + { + return $form->schema([ + Select::make('delivery_method') + ->label('What would you like to send?') + ->options(EngagementDeliveryMethod::getOptions()) + ->default(EngagementDeliveryMethod::Email->value) + ->disableOptionWhen(fn(string $value): bool => EngagementDeliveryMethod::tryFrom($value)?->getCaseDisabled()) + ->selectablePlaceholder(false) + ->live(), + Fieldset::make('Content') + ->schema([ + TextInput::make('subject') + ->autofocus() + ->required() + ->placeholder(__('Subject')) + ->hidden(fn(Get $get): bool => $get('delivery_method') === EngagementDeliveryMethod::Sms->value) + ->columnSpanFull(), + TiptapEditor::make('body') + ->disk('s3-public') + ->label('Body') + ->mergeTags($mergeTags = [ + 'student first name', + 'student last name', + 'student full name', + 'student email', + ]) + ->showMergeTagsInBlocksPanel(! ($form->getLivewire() instanceof RelationManager)) + ->profile('email') + ->required() + ->hintAction(fn(TiptapEditor $component) => Action::make('loadEmailTemplate') + ->form([ + Select::make('emailTemplate') + ->searchable() + ->options(function (Get $get): array { + return EmailTemplate::query() + ->when( + $get('onlyMyTemplates'), + fn(Builder $query) => $query->whereBelongsTo(auth()->user()) + ) + ->orderBy('name') + ->limit(50) + ->pluck('name', 'id') + ->toArray(); + }) + ->getSearchResultsUsing(function (Get $get, string $search): array { + return EmailTemplate::query() + ->when( + $get('onlyMyTemplates'), + fn(Builder $query) => $query->whereBelongsTo(auth()->user()) + ) + ->when( + $get('onlyMyTeamTemplates'), + fn(Builder $query) => $query->whereIn('user_id', auth()->user()->teams->users->pluck('id')) + ) + ->where(new Expression('lower(name)'), 'like', "%{$search}%") + ->orderBy('name') + ->limit(50) + ->pluck('name', 'id') + ->toArray(); + }), + Checkbox::make('onlyMyTemplates') + ->label('Only show my templates') + ->live() + ->afterStateUpdated(fn(Set $set) => $set('emailTemplate', null)), + Checkbox::make('onlyMyTeamTemplates') + ->label("Only show my team's templates") + ->live() + ->afterStateUpdated(fn(Set $set) => $set('emailTemplate', null)), + ]) + ->action(function (array $data) use ($component) { + $template = EmailTemplate::find($data['emailTemplate']); + + if (! $template) { + return; + } + + $component->state( + $component->generateImageUrls($template->content), + ); + })) + ->hidden(fn(Get $get): bool => $get('delivery_method') === EngagementDeliveryMethod::Sms->value) + ->helperText('You can insert student information by typing {{ and choosing a merge value to insert.') + ->columnSpanFull(), + EngagementSmsBodyField::make(context: 'create', form: $form), + Actions::make([ + DraftWithAiAction::make() + ->mergeTags($mergeTags), + ]), + ]), + Fieldset::make('Send your email or text') + ->schema([ + Toggle::make('send_later') + ->reactive() + ->helperText('By default, this email or text will send as soon as it is created unless you schedule it to send later.'), + DateTimePicker::make('deliver_at') + ->required() + ->visible(fn(Get $get) => $get('send_later')), + ]), + ]); + } + + public function table(Table $table): Table + { + return $table + ->emptyStateHeading('No email or text messages.') + ->emptyStateDescription('Create an email or text message to get started.') + ->defaultSort('record_sortable_date', 'desc') + ->modifyQueryUsing(fn(Builder $query) => $query->whereHasMorph('timelineable', [ + Engagement::class, + EngagementResponse::class, + ])) + ->columns([ + TextColumn::make('direction') + ->getStateUsing(fn(Timeline $record) => match ($record->timelineable::class) { + Engagement::class => 'Outbound', + EngagementResponse::class => 'Inbound', + }) + ->icon(fn(string $state) => match ($state) { + 'Outbound' => 'heroicon-o-arrow-up-tray', + 'Inbound' => 'heroicon-o-arrow-down-tray', + }), + TextColumn::make('type') + ->getStateUsing(function (Timeline $record) { + /** @var HasDeliveryMethod $timelineable */ + $timelineable = $record->timelineable; + + return $timelineable->getDeliveryMethod(); + }), + TextColumn::make('record_sortable_date') + ->label('Date') + ->sortable(), + ]) + ->headerActions([ + CreateAction::make() + ->label('New Email or Text') + ->modalHeading('Create new email or text') + ->authorize(function () { + $ownerRecord = $this->getOwnerRecord(); + + return auth()->user()->can('create', [Engagement::class, $ownerRecord instanceof Prospect ? $ownerRecord : null]); + }) + ->createAnother(false) + ->action(function (array $data, Form $form) { + + /** @var Student $record */ + $record = $this->getRecord(); + + $engagement = new Engagement($data); + $engagement->recipient()->associate($record); + $engagement->save(); + + $form->model($engagement)->saveRelationships(); + + $createEngagementDeliverable = resolve(CreateEngagementDeliverable::class); + + $createEngagementDeliverable($engagement, $data['delivery_method']); + }), + ]) + ->actions([ + ViewAction::make() + ->modalHeading(function (Timeline $record) { + /** @var HasDeliveryMethod $timelineable */ + $timelineable = $record->timelineable; + + return "View {$timelineable->getDeliveryMethod()->getLabel()}"; + }), + ]) + ->filters([ + SelectFilter::make('direction') + ->options([ + Engagement::class => 'Outbound', + EngagementResponse::class => 'Inbound', + ]) + ->modifyQueryUsing( + fn(Builder $query, array $data) => $query + ->when($data['value'], fn(Builder $query) => $query->whereHasMorph('timelineable', $data['value'])) + ), + SelectFilter::make('type') + ->options(EngagementDeliveryMethod::class) + ->modifyQueryUsing( + fn(Builder $query, array $data) => $query + ->when( + $data['value'] === EngagementDeliveryMethod::Email->value, + fn(Builder $query) => $query + ->whereHasMorph( + 'timelineable', + [Engagement::class], + fn(Builder $query, string $type) => match ($type) { + Engagement::class => $query->whereRelation('deliverable', 'channel', $data['value']), + } + ) + ) + ->when( + $data['value'] === EngagementDeliveryMethod::Sms->value, + fn(Builder $query) => $query->whereHasMorph( + 'timelineable', + [Engagement::class, EngagementResponse::class], + fn(Builder $query, string $type) => match ($type) { + Engagement::class => $query->whereRelation('deliverable', 'channel', $data['value']), + EngagementResponse::class => $query, + } + ) + ) + ), + ]); + } +} diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php b/app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php new file mode 100644 index 0000000000..6333f7597f --- /dev/null +++ b/app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php @@ -0,0 +1,111 @@ + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + +namespace AdvisingApp\StudentDataModel\Livewire; + +use App\Enums\Feature; +use Illuminate\Support\Facades\Gate; +use Illuminate\Support\Facades\Cache; +use Illuminate\Database\Eloquent\Model; +use AdvisingApp\Prospect\Models\Prospect; +use Filament\Resources\Pages\ManageRelatedRecords; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentEvents; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; + +class ManageStudentFormSubmissions extends ManageRelatedRecords +{ + protected static string $resource = StudentResource::class; + + protected static string $relationship = 'formSubmissions'; + + // TODO: Automatically set from Filament based on relationship name + protected static ?string $navigationLabel = 'Form Submissions'; + + protected static string $view = 'student-data-model::livewire.manage-student-form-submissions'; + + public function mount(int | string $record): void + { + $this->record = $this->resolveRecord($record); + + $this->authorizeAccess(); + + $this->previousUrl = url()->previous(); + + $this->loadDefaultActiveTab(); + } + + public static function canAccess(array $parameters = []): bool + { + return parent::canAccess($parameters) && Gate::check(Feature::OnlineForms->getGateName()); + } + + // public static function getNavigationItems(array $urlParameters = []): array + // { + // $item = parent::getNavigationItems($urlParameters)[0]; + + // $ownerRecord = $urlParameters['record']; + + // /** @var Prospect $ownerRecord */ + // $formSubmissionsCount = Cache::tags('form-submission-count') + // ->remember( + // "form-submission-count-{$ownerRecord->getKey()}", + // now()->addMinutes(5), + // function () use ($ownerRecord): int { + // return $ownerRecord->formSubmissions()->count(); + // }, + // ); + + // $item->badge($formSubmissionsCount > 0 ? $formSubmissionsCount : null); + + // return [$item]; + // } + + public function getRelationManagers(): array + { + return static::managers($this->getRecord()); + } + + private static function managers(?Model $record = null): array + { + return collect([ + StudentFormSubmissionsRelationManager::class, + ManageStudentEvents::class, + ]) + ->reject(fn ($relationManager) => $record && (! $relationManager::canViewForRecord($record, static::class))) + ->toArray(); + } +} diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php index 7b5b674b35..2210c13eb0 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php @@ -85,6 +85,7 @@ private static function managers(?Model $record = null): array return collect([ ProgramsRelationManager::class, EnrollmentsRelationManager::class, + ManageStudentEngagement::class, ManageStudentInteractions::class, ManageStudentFiles::class, ]) diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php b/app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php new file mode 100644 index 0000000000..c52a7458af --- /dev/null +++ b/app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php @@ -0,0 +1,143 @@ + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + +namespace AdvisingApp\StudentDataModel\Livewire; + +use App\Models\User; +use Filament\Tables\Table; +use App\Models\Scopes\HasLicense; +use Filament\Forms\Components\Select; +use Filament\Tables\Columns\TextColumn; +use App\Filament\Resources\UserResource; +use App\Filament\Tables\Columns\IdColumn; +use Filament\Tables\Actions\AttachAction; +use Filament\Tables\Actions\DetachAction; +use Illuminate\Database\Eloquent\Builder; +use Filament\Tables\Actions\BulkActionGroup; +use Filament\Tables\Actions\DetachBulkAction; +use AdvisingApp\StudentDataModel\Models\Student; +use Filament\Resources\Pages\ManageRelatedRecords; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; + +class ManageStudentSubscriptions extends ManageRelatedRecords +{ + protected static string $resource = StudentResource::class; + + protected static string $relationship = 'subscribedUsers'; + + protected static ?string $title = 'Subscriptions'; + + protected static string $view = 'student-data-model::livewire.manage-student-subscriptions'; + + //TODO: manually override check canAccess for policy + + public function table(Table $table): Table + { + return $table + ->recordTitleAttribute('name') + ->columns([ + IdColumn::make(), + TextColumn::make('name') + ->url(fn ($record) => UserResource::getUrl('view', ['record' => $record])) + ->color('primary'), + TextColumn::make('pivot.created_at') + ->label('Subscribed At'), + ]) + ->headerActions([ + AttachAction::make() + ->label('Manage') + ->modalHeading(function () { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return 'Subscribe a User to ' . $student->display_name; + }) + ->modalSubmitActionLabel('Subscribe') + ->attachAnother(false) + ->color('primary') + ->recordSelect( + fn (Select $select) => $select->placeholder('Select a User'), + ) + ->recordSelectOptionsQuery( + fn (Builder $query) => $query->tap(new HasLicense(Student::getLicenseType())), + ) + ->successNotificationTitle(function (User $record) { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return "{$record->name} was subscribed to {$student->display_name}"; + }), + ]) + ->actions([ + DetachAction::make() + ->label('Unsubscribe') + ->modalHeading(function (User $record) { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return "Unsubscribe {$record->name} from {$student->display_name}"; + }) + ->modalSubmitActionLabel('Unsubscribe') + ->successNotificationTitle(function (User $record) { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return "{$record->name} was unsubscribed from {$student->display_name}"; + }), + ]) + ->bulkActions([ + BulkActionGroup::make([ + DetachBulkAction::make() + ->label('Unsubscribe selected') + ->modalHeading(function () { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return "Unsubscribe selected from {$student->display_name}"; + }) + ->modalSubmitActionLabel('Unsubscribe') + ->successNotificationTitle(function () { + /** @var Student $student */ + $student = $this->getOwnerRecord(); + + return "All selected were unsubscribed from {$student->display_name}"; + }), + ]), + ]) + ->emptyStateHeading('No Subscriptions') + ->inverseRelationship('studentSubscriptions'); + } +} diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php b/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php new file mode 100644 index 0000000000..2eacac6c64 --- /dev/null +++ b/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php @@ -0,0 +1,57 @@ + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + +namespace AdvisingApp\StudentDataModel\Livewire; + +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; +use AdvisingApp\Task\Filament\RelationManagers\BaseTaskRelationManager; + +class ManageStudentTasks extends BaseTaskRelationManager +{ + protected static string $resource = StudentResource::class; + + protected static string $relationship = 'tasks'; + + // TODO: Automatically set from Filament based on relationship name + protected static ?string $navigationLabel = 'Tasks'; + + // TODO: Automatically set from Filament based on relationship name + public static ?string $breadcrumb = 'Tasks'; + + protected static ?string $navigationIcon = 'heroicon-o-clipboard-document-check'; + + protected static string $view = 'student-data-model::livewire.manage-student-tasks'; +} diff --git a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php new file mode 100644 index 0000000000..086afd39ba --- /dev/null +++ b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php @@ -0,0 +1,66 @@ + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + +namespace AdvisingApp\StudentDataModel\Livewire; + +use AdvisingApp\Task\Histories\TaskHistory; +use AdvisingApp\Alert\Histories\AlertHistory; +use AdvisingApp\Engagement\Models\Engagement; +use AdvisingApp\Interaction\Models\Interaction; +use AdvisingApp\Engagement\Models\EngagementResponse; +use AdvisingApp\Timeline\Filament\Pages\TimelinePage; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; + +class StudentEngagementTimeline extends TimelinePage +{ + protected static string $resource = StudentResource::class; + + protected static ?string $navigationLabel = 'Timeline'; + + protected static string $view = 'student-data-model::livewire.student-engagement-timeline'; + + public string $emptyStateMessage = 'There are no engagements to show for this student.'; + + public string $noMoreRecordsMessage = "You have reached the end of this student's engagement timeline."; + + public array $modelsToTimeline = [ + Engagement::class, + EngagementResponse::class, + AlertHistory::class, + TaskHistory::class, + Interaction::class, + ]; +} diff --git a/app-modules/task/src/Filament/RelationManagers/BaseTaskRelationManager.php b/app-modules/task/src/Filament/RelationManagers/BaseTaskRelationManager.php index 11e2df8809..9039b404f2 100644 --- a/app-modules/task/src/Filament/RelationManagers/BaseTaskRelationManager.php +++ b/app-modules/task/src/Filament/RelationManagers/BaseTaskRelationManager.php @@ -89,7 +89,7 @@ public function form(Form $form): Form fn (Builder $query) => $query->tap(new HasLicense($this->getOwnerRecord()->getLicenseType())), ) ->nullable() - ->searchable(['name', 'email']) + // ->searchable(['name', 'email']) ->default(auth()->id()), ]); } @@ -121,32 +121,32 @@ public function table(Table $table): Table default => null, }), ]) - ->filters([ - Filter::make('my_tasks') - ->label('My Tasks') - ->query( - fn ($query) => $query->where('assigned_to', auth()->id()) - ), - SelectFilter::make('assignedTo') - ->label('Assigned To') - ->relationship( - 'assignedTo', - 'name', - fn (Builder $query) => $query->tap(new HasLicense($this->getOwnerRecord()->getLicenseType())), - ) - ->searchable() - ->multiple(), - SelectFilter::make('status') - ->label('Status') - ->options(collect(TaskStatus::cases())->mapWithKeys(fn (TaskStatus $direction) => [$direction->value => \Livewire\str($direction->name)->title()->headline()])) - ->multiple() - ->default( - [ - TaskStatus::Pending->value, - TaskStatus::InProgress->value, - ] - ), - ]) + // ->filters([ + // Filter::make('my_tasks') + // ->label('My Tasks') + // ->query( + // fn ($query) => $query->where('assigned_to', auth()->id()) + // ), + // SelectFilter::make('assignedTo') + // ->label('Assigned To') + // ->relationship( + // 'assignedTo', + // 'name', + // fn (Builder $query) => $query->tap(new HasLicense($this->getOwnerRecord()->getLicenseType())), + // ) + // ->searchable() + // ->multiple(), + // SelectFilter::make('status') + // ->label('Status') + // ->options(collect(TaskStatus::cases())->mapWithKeys(fn (TaskStatus $direction) => [$direction->value => \Livewire\str($direction->name)->title()->headline()])) + // ->multiple() + // ->default( + // [ + // TaskStatus::Pending->value, + // TaskStatus::InProgress->value, + // ] + // ), + // ]) ->headerActions([ CreateAction::make() ->authorize(function () { From 0fd7555dbd1bd83f25be7834a7fe9b663cd356dc Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Tue, 15 Oct 2024 18:06:12 +0000 Subject: [PATCH 07/55] chore: fix code style --- .../src/Livewire/ManageStudentEngagement.php | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php b/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php index 106b524836..5f9f420e48 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php @@ -63,6 +63,7 @@ use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\DateTimePicker; use AdvisingApp\Engagement\Models\EmailTemplate; +use AdvisingApp\StudentDataModel\Models\Student; use AdvisingApp\Engagement\Models\EngagementResponse; use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\Engagement\Enums\EngagementDeliveryMethod; @@ -72,7 +73,6 @@ use Filament\Infolists\Components\Fieldset as InfolistFieldset; use AdvisingApp\Engagement\Filament\Resources\EngagementResource\Fields\EngagementSmsBodyField; use AdvisingApp\Engagement\Filament\ManageRelatedRecords\ManageRelatedEngagementRecords\Actions\DraftWithAiAction; -use AdvisingApp\StudentDataModel\Models\Student; class ManageStudentEngagement extends RelationManager { @@ -83,19 +83,19 @@ class ManageStudentEngagement extends RelationManager public function infolist(Infolist $infolist): Infolist { - return $infolist->schema(fn(Timeline $record) => match ($record->timelineable::class) { + return $infolist->schema(fn (Timeline $record) => match ($record->timelineable::class) { Engagement::class => [ TextEntry::make('user.name') ->label('Created By') - ->getStateUsing(fn(Timeline $record): string => $record->timelineable->user->name), + ->getStateUsing(fn (Timeline $record): string => $record->timelineable->user->name), InfolistFieldset::make('Content') ->schema([ TextEntry::make('subject') - ->getStateUsing(fn(Timeline $record): ?string => $record->timelineable->subject) - ->hidden(fn($state): bool => blank($state)) + ->getStateUsing(fn (Timeline $record): ?string => $record->timelineable->subject) + ->hidden(fn ($state): bool => blank($state)) ->columnSpanFull(), TextEntry::make('body') - ->getStateUsing(fn(Timeline $record): HtmlString => $record->timelineable->getBody()) + ->getStateUsing(fn (Timeline $record): HtmlString => $record->timelineable->getBody()) ->columnSpanFull(), ]), InfolistFieldset::make('deliverable') @@ -111,18 +111,18 @@ public function infolist(Infolist $infolist): Infolist return $timelineable->getDeliveryMethod()->getLabel(); }), IconEntry::make('deliverable.delivery_status') - ->getStateUsing(fn(Timeline $record): EngagementDeliveryStatus => $record->timelineable->deliverable->delivery_status) - ->icon(fn(EngagementDeliveryStatus $state): string => $state->getIconClass()) - ->color(fn(EngagementDeliveryStatus $state): string => $state->getColor()) + ->getStateUsing(fn (Timeline $record): EngagementDeliveryStatus => $record->timelineable->deliverable->delivery_status) + ->icon(fn (EngagementDeliveryStatus $state): string => $state->getIconClass()) + ->color(fn (EngagementDeliveryStatus $state): string => $state->getColor()) ->label('Status'), TextEntry::make('deliverable.delivered_at') - ->getStateUsing(fn(Timeline $record): string => $record->timelineable->deliverable->delivered_at) + ->getStateUsing(fn (Timeline $record): string => $record->timelineable->deliverable->delivered_at) ->label('Delivered At') - ->hidden(fn(Timeline $record): bool => is_null($record->timelineable->deliverable->delivered_at)), + ->hidden(fn (Timeline $record): bool => is_null($record->timelineable->deliverable->delivered_at)), TextEntry::make('deliverable.delivery_response') - ->getStateUsing(fn(Timeline $record): string => $record->timelineable->deliverable->delivery_response) + ->getStateUsing(fn (Timeline $record): string => $record->timelineable->deliverable->delivery_response) ->label('Error Details') - ->hidden(fn(Timeline $record): bool => is_null($record->timelineable->deliverable->delivery_response)), + ->hidden(fn (Timeline $record): bool => is_null($record->timelineable->deliverable->delivery_response)), ]) ->columns(), ], @@ -141,7 +141,7 @@ public function form(Form $form): Form ->label('What would you like to send?') ->options(EngagementDeliveryMethod::getOptions()) ->default(EngagementDeliveryMethod::Email->value) - ->disableOptionWhen(fn(string $value): bool => EngagementDeliveryMethod::tryFrom($value)?->getCaseDisabled()) + ->disableOptionWhen(fn (string $value): bool => EngagementDeliveryMethod::tryFrom($value)?->getCaseDisabled()) ->selectablePlaceholder(false) ->live(), Fieldset::make('Content') @@ -150,7 +150,7 @@ public function form(Form $form): Form ->autofocus() ->required() ->placeholder(__('Subject')) - ->hidden(fn(Get $get): bool => $get('delivery_method') === EngagementDeliveryMethod::Sms->value) + ->hidden(fn (Get $get): bool => $get('delivery_method') === EngagementDeliveryMethod::Sms->value) ->columnSpanFull(), TiptapEditor::make('body') ->disk('s3-public') @@ -164,7 +164,7 @@ public function form(Form $form): Form ->showMergeTagsInBlocksPanel(! ($form->getLivewire() instanceof RelationManager)) ->profile('email') ->required() - ->hintAction(fn(TiptapEditor $component) => Action::make('loadEmailTemplate') + ->hintAction(fn (TiptapEditor $component) => Action::make('loadEmailTemplate') ->form([ Select::make('emailTemplate') ->searchable() @@ -172,7 +172,7 @@ public function form(Form $form): Form return EmailTemplate::query() ->when( $get('onlyMyTemplates'), - fn(Builder $query) => $query->whereBelongsTo(auth()->user()) + fn (Builder $query) => $query->whereBelongsTo(auth()->user()) ) ->orderBy('name') ->limit(50) @@ -183,11 +183,11 @@ public function form(Form $form): Form return EmailTemplate::query() ->when( $get('onlyMyTemplates'), - fn(Builder $query) => $query->whereBelongsTo(auth()->user()) + fn (Builder $query) => $query->whereBelongsTo(auth()->user()) ) ->when( $get('onlyMyTeamTemplates'), - fn(Builder $query) => $query->whereIn('user_id', auth()->user()->teams->users->pluck('id')) + fn (Builder $query) => $query->whereIn('user_id', auth()->user()->teams->users->pluck('id')) ) ->where(new Expression('lower(name)'), 'like', "%{$search}%") ->orderBy('name') @@ -198,11 +198,11 @@ public function form(Form $form): Form Checkbox::make('onlyMyTemplates') ->label('Only show my templates') ->live() - ->afterStateUpdated(fn(Set $set) => $set('emailTemplate', null)), + ->afterStateUpdated(fn (Set $set) => $set('emailTemplate', null)), Checkbox::make('onlyMyTeamTemplates') ->label("Only show my team's templates") ->live() - ->afterStateUpdated(fn(Set $set) => $set('emailTemplate', null)), + ->afterStateUpdated(fn (Set $set) => $set('emailTemplate', null)), ]) ->action(function (array $data) use ($component) { $template = EmailTemplate::find($data['emailTemplate']); @@ -215,7 +215,7 @@ public function form(Form $form): Form $component->generateImageUrls($template->content), ); })) - ->hidden(fn(Get $get): bool => $get('delivery_method') === EngagementDeliveryMethod::Sms->value) + ->hidden(fn (Get $get): bool => $get('delivery_method') === EngagementDeliveryMethod::Sms->value) ->helperText('You can insert student information by typing {{ and choosing a merge value to insert.') ->columnSpanFull(), EngagementSmsBodyField::make(context: 'create', form: $form), @@ -231,7 +231,7 @@ public function form(Form $form): Form ->helperText('By default, this email or text will send as soon as it is created unless you schedule it to send later.'), DateTimePicker::make('deliver_at') ->required() - ->visible(fn(Get $get) => $get('send_later')), + ->visible(fn (Get $get) => $get('send_later')), ]), ]); } @@ -242,17 +242,17 @@ public function table(Table $table): Table ->emptyStateHeading('No email or text messages.') ->emptyStateDescription('Create an email or text message to get started.') ->defaultSort('record_sortable_date', 'desc') - ->modifyQueryUsing(fn(Builder $query) => $query->whereHasMorph('timelineable', [ + ->modifyQueryUsing(fn (Builder $query) => $query->whereHasMorph('timelineable', [ Engagement::class, EngagementResponse::class, ])) ->columns([ TextColumn::make('direction') - ->getStateUsing(fn(Timeline $record) => match ($record->timelineable::class) { + ->getStateUsing(fn (Timeline $record) => match ($record->timelineable::class) { Engagement::class => 'Outbound', EngagementResponse::class => 'Inbound', }) - ->icon(fn(string $state) => match ($state) { + ->icon(fn (string $state) => match ($state) { 'Outbound' => 'heroicon-o-arrow-up-tray', 'Inbound' => 'heroicon-o-arrow-down-tray', }), @@ -278,7 +278,6 @@ public function table(Table $table): Table }) ->createAnother(false) ->action(function (array $data, Form $form) { - /** @var Student $record */ $record = $this->getRecord(); @@ -309,30 +308,30 @@ public function table(Table $table): Table EngagementResponse::class => 'Inbound', ]) ->modifyQueryUsing( - fn(Builder $query, array $data) => $query - ->when($data['value'], fn(Builder $query) => $query->whereHasMorph('timelineable', $data['value'])) + fn (Builder $query, array $data) => $query + ->when($data['value'], fn (Builder $query) => $query->whereHasMorph('timelineable', $data['value'])) ), SelectFilter::make('type') ->options(EngagementDeliveryMethod::class) ->modifyQueryUsing( - fn(Builder $query, array $data) => $query + fn (Builder $query, array $data) => $query ->when( $data['value'] === EngagementDeliveryMethod::Email->value, - fn(Builder $query) => $query + fn (Builder $query) => $query ->whereHasMorph( 'timelineable', [Engagement::class], - fn(Builder $query, string $type) => match ($type) { + fn (Builder $query, string $type) => match ($type) { Engagement::class => $query->whereRelation('deliverable', 'channel', $data['value']), } ) ) ->when( $data['value'] === EngagementDeliveryMethod::Sms->value, - fn(Builder $query) => $query->whereHasMorph( + fn (Builder $query) => $query->whereHasMorph( 'timelineable', [Engagement::class, EngagementResponse::class], - fn(Builder $query, string $type) => match ($type) { + fn (Builder $query, string $type) => match ($type) { Engagement::class => $query->whereRelation('deliverable', 'channel', $data['value']), EngagementResponse::class => $query, } From e6f8588a82e420f0c2956b0e9ba5b70ccab4c017 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Wed, 16 Oct 2024 15:49:01 +0000 Subject: [PATCH 08/55] Remove unuse blade and convert managerecord to relation manage component and other changes --- .../Actions/RequestFormSubmission.php | 2 +- .../student-resource/view-student.blade.php | 15 +- .../livewire/manage-student-alerts.blade.php | 34 ---- .../manage-student-care-team.blade.php | 34 ---- .../manage-student-subscriptions.blade.php | 34 ---- .../livewire/manage-student-tasks.blade.php | 34 ---- .../src/Livewire/ManageStudentAlerts.php | 29 ---- .../ManageStudentApplicationSubmissions.php | 119 ++++++++++++++ .../src/Livewire/ManageStudentCareTeam.php | 6 +- .../src/Livewire/ManageStudentEngagement.php | 5 +- .../Livewire/ManageStudentFormSubmissions.php | 27 +-- .../src/Livewire/ManageStudentInformation.php | 6 - .../Livewire/ManageStudentSubscriptions.php | 8 +- .../src/Livewire/ManageStudentTasks.php | 154 +++++++++++++++++- .../BaseTaskRelationManager.php | 54 +++--- 15 files changed, 313 insertions(+), 248 deletions(-) delete mode 100644 app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php delete mode 100644 app-modules/student-data-model/resources/views/livewire/manage-student-care-team.blade.php delete mode 100644 app-modules/student-data-model/resources/views/livewire/manage-student-subscriptions.blade.php delete mode 100644 app-modules/student-data-model/resources/views/livewire/manage-student-tasks.blade.php create mode 100644 app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php diff --git a/app-modules/form/src/Filament/Actions/RequestFormSubmission.php b/app-modules/form/src/Filament/Actions/RequestFormSubmission.php index 37ef35cde4..98d7ba2af6 100644 --- a/app-modules/form/src/Filament/Actions/RequestFormSubmission.php +++ b/app-modules/form/src/Filament/Actions/RequestFormSubmission.php @@ -102,6 +102,6 @@ protected function setUp(): void public static function getDefaultName(): ?string { - return 'requestFormSubmission'; + return 'Request'; } } diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index ac380e6171..122409758f 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -50,9 +50,18 @@ :owner-record="$record" :page-class="\AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent::class" /> - - - + + +
diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php deleted file mode 100644 index f2bc54ca8e..0000000000 --- a/app-modules/student-data-model/resources/views/livewire/manage-student-alerts.blade.php +++ /dev/null @@ -1,34 +0,0 @@ -{{-- - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - ---}} - diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-care-team.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-care-team.blade.php deleted file mode 100644 index f2bc54ca8e..0000000000 --- a/app-modules/student-data-model/resources/views/livewire/manage-student-care-team.blade.php +++ /dev/null @@ -1,34 +0,0 @@ -{{-- - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - ---}} - diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-subscriptions.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-subscriptions.blade.php deleted file mode 100644 index f2bc54ca8e..0000000000 --- a/app-modules/student-data-model/resources/views/livewire/manage-student-subscriptions.blade.php +++ /dev/null @@ -1,34 +0,0 @@ -{{-- - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - ---}} - diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-tasks.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-tasks.blade.php deleted file mode 100644 index f2bc54ca8e..0000000000 --- a/app-modules/student-data-model/resources/views/livewire/manage-student-tasks.blade.php +++ /dev/null @@ -1,34 +0,0 @@ -{{-- - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - ---}} - diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php b/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php index 1463c2c6f7..8cb7dd700e 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php @@ -40,7 +40,6 @@ use Filament\Tables\Table; use Filament\Infolists\Infolist; use Filament\Forms\Components\Select; -use Illuminate\Support\Facades\Cache; use Filament\Forms\Components\Textarea; use Filament\Tables\Actions\EditAction; use Filament\Tables\Actions\ViewAction; @@ -54,7 +53,6 @@ use Filament\Infolists\Components\TextEntry; use Filament\Tables\Actions\BulkActionGroup; use Filament\Tables\Actions\DeleteBulkAction; -use AdvisingApp\StudentDataModel\Models\Student; use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; @@ -64,33 +62,6 @@ class ManageStudentAlerts extends RelationManager protected static string $relationship = 'alerts'; - // protected static ?string $title = 'Alerts'; - - // protected static ?string $label = 'Alerts'; - - // protected static string $view = 'student-data-model::livewire.manage-student-alerts'; - - // public static function getNavigationItems(array $urlParameters = []): array - // { - // $item = parent::getNavigationItems($urlParameters)[0]; - - // $ownerRecord = $urlParameters['record']; - - // /** @var Student $ownerRecord */ - // $alertsCount = Cache::tags('alert-count') - // ->remember( - // "alert-count-{$ownerRecord->getKey()}", - // now()->addMinutes(5), - // function () use ($ownerRecord): int { - // return $ownerRecord->alerts()->status(AlertStatus::Active)->count(); - // }, - // ); - - // $item->badge($alertsCount > 0 ? $alertsCount : null, color: 'danger'); - - // return [$item]; - // } - public function infolist(Infolist $infolist): Infolist { return $infolist diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php b/app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php new file mode 100644 index 0000000000..19d9eda644 --- /dev/null +++ b/app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php @@ -0,0 +1,119 @@ + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + +namespace AdvisingApp\StudentDataModel\Livewire; + +use Filament\Tables\Table; +use Filament\Tables\Actions\ViewAction; +use Filament\Tables\Columns\TextColumn; +use App\Filament\Tables\Columns\IdColumn; +use Filament\Tables\Actions\DeleteAction; +use Illuminate\Database\Eloquent\Builder; +use Filament\Infolists\Components\Section; +use Filament\Infolists\Components\TextEntry; +use Filament\Tables\Actions\BulkActionGroup; +use Filament\Tables\Actions\DeleteBulkAction; +use Filament\Resources\RelationManagers\RelationManager; +use AdvisingApp\Application\Models\ApplicationSubmission; +use AdvisingApp\Application\Filament\Resources\ApplicationResource; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; + +class ManageStudentApplicationSubmissions extends RelationManager +{ + protected static string $resource = StudentResource::class; + + protected static string $relationship = 'applicationSubmissions'; + + protected static ?string $title = 'Applications'; + + public function table(Table $table): Table + { + return $table + ->columns([ + IdColumn::make(), + TextColumn::make('submissible.name') + ->searchable() + ->url(fn (ApplicationSubmission $record): string => ApplicationResource::getUrl('edit', ['record' => $record->submissible])), + TextColumn::make('state') + ->badge() + ->state(function (ApplicationSubmission $record) { + return $record->state->name; + }) + ->color(function (ApplicationSubmission $record) { + return $record->state->color->value; + }) + ->sortable(query: function (Builder $query, string $direction): Builder { + return $query + ->join('application_submission_states', 'application_submissions.status_id', '=', 'application_submission_states.id') + ->orderBy('application_submission_states.name', $direction); + }), + TextColumn::make('created_at') + ->sortable(), + ]) + ->actions([ + ViewAction::make() + ->modalHeading(fn (ApplicationSubmission $record) => "Submission Details: {$record->created_at}") + ->infolist(fn (ApplicationSubmission $record): array => [ + TextEntry::make('state') + ->label('State') + ->badge() + ->state(function (ApplicationSubmission $record) { + return $record->state->name; + }) + ->color(function (ApplicationSubmission $record) { + return $record->state->color->value; + }), + Section::make('Authenticated author') + ->schema([ + TextEntry::make('author.' . $record->author::displayNameKey()) + ->label('Name'), + TextEntry::make('author.email') + ->label('Email address'), + ]) + ->columns(2), + ]) + ->modalContent( + fn (ApplicationSubmission $record) => view('application::submission', ['submission' => $record]) + ), + DeleteAction::make(), + ]) + ->bulkActions([ + BulkActionGroup::make([ + DeleteBulkAction::make(), + ]), + ]); + } +} diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php b/app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php index 339884bee7..e6e5918e69 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php @@ -49,17 +49,15 @@ use Filament\Tables\Actions\BulkActionGroup; use Filament\Tables\Actions\DetachBulkAction; use AdvisingApp\StudentDataModel\Models\Student; -use Filament\Resources\Pages\ManageRelatedRecords; +use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -class ManageStudentCareTeam extends ManageRelatedRecords +class ManageStudentCareTeam extends RelationManager { protected static string $resource = StudentResource::class; protected static string $relationship = 'careTeam'; - protected static string $view = 'student-data-model::livewire.manage-student-care-team'; - public function table(Table $table): Table { return $table diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php b/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php index 5f9f420e48..d0e1d5532f 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php @@ -42,6 +42,7 @@ use Filament\Tables\Table; use Filament\Infolists\Infolist; use Illuminate\Support\HtmlString; +use Illuminate\Support\Facades\Log; use Filament\Forms\Components\Select; use Filament\Forms\Components\Toggle; use Filament\Forms\Components\Actions; @@ -76,7 +77,6 @@ class ManageStudentEngagement extends RelationManager { - // TODO: Obsolete when there is no table, remove from Filament protected static string $relationship = 'timeline'; protected static ?string $title = 'Messages'; @@ -278,8 +278,9 @@ public function table(Table $table): Table }) ->createAnother(false) ->action(function (array $data, Form $form) { + Log::info('asdasd', [$this->getOwnerRecord()]); /** @var Student $record */ - $record = $this->getRecord(); + $record = $this->getOwnerRecord(); $engagement = new Engagement($data); $engagement->recipient()->associate($record); diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php b/app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php index 6333f7597f..0849315ef2 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php @@ -38,9 +38,7 @@ use App\Enums\Feature; use Illuminate\Support\Facades\Gate; -use Illuminate\Support\Facades\Cache; use Illuminate\Database\Eloquent\Model; -use AdvisingApp\Prospect\Models\Prospect; use Filament\Resources\Pages\ManageRelatedRecords; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentEvents; @@ -52,9 +50,6 @@ class ManageStudentFormSubmissions extends ManageRelatedRecords protected static string $relationship = 'formSubmissions'; - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Form Submissions'; - protected static string $view = 'student-data-model::livewire.manage-student-form-submissions'; public function mount(int | string $record): void @@ -73,27 +68,6 @@ public static function canAccess(array $parameters = []): bool return parent::canAccess($parameters) && Gate::check(Feature::OnlineForms->getGateName()); } - // public static function getNavigationItems(array $urlParameters = []): array - // { - // $item = parent::getNavigationItems($urlParameters)[0]; - - // $ownerRecord = $urlParameters['record']; - - // /** @var Prospect $ownerRecord */ - // $formSubmissionsCount = Cache::tags('form-submission-count') - // ->remember( - // "form-submission-count-{$ownerRecord->getKey()}", - // now()->addMinutes(5), - // function () use ($ownerRecord): int { - // return $ownerRecord->formSubmissions()->count(); - // }, - // ); - - // $item->badge($formSubmissionsCount > 0 ? $formSubmissionsCount : null); - - // return [$item]; - // } - public function getRelationManagers(): array { return static::managers($this->getRecord()); @@ -104,6 +78,7 @@ private static function managers(?Model $record = null): array return collect([ StudentFormSubmissionsRelationManager::class, ManageStudentEvents::class, + ManageStudentApplicationSubmissions::class, ]) ->reject(fn ($relationManager) => $record && (! $relationManager::canViewForRecord($record, static::class))) ->toArray(); diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php index 2210c13eb0..eb61b7614c 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php @@ -53,12 +53,6 @@ class ManageStudentInformation extends ManageRelatedRecords // TODO: Obsolete when there is no table, remove from Filament protected static string $relationship = 'programs'; - protected static ?string $navigationLabel = 'Information'; - - protected static ?string $breadcrumb = 'Information'; - - protected static ?string $navigationIcon = 'heroicon-o-information-circle'; - public function mount(int | string $record): void { $this->record = $this->resolveRecord($record); diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php b/app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php index c52a7458af..31adb27dbb 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php @@ -49,10 +49,10 @@ use Filament\Tables\Actions\BulkActionGroup; use Filament\Tables\Actions\DetachBulkAction; use AdvisingApp\StudentDataModel\Models\Student; -use Filament\Resources\Pages\ManageRelatedRecords; +use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -class ManageStudentSubscriptions extends ManageRelatedRecords +class ManageStudentSubscriptions extends RelationManager { protected static string $resource = StudentResource::class; @@ -60,10 +60,6 @@ class ManageStudentSubscriptions extends ManageRelatedRecords protected static ?string $title = 'Subscriptions'; - protected static string $view = 'student-data-model::livewire.manage-student-subscriptions'; - - //TODO: manually override check canAccess for policy - public function table(Table $table): Table { return $table diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php b/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php index 2eacac6c64..90a3cc8071 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php @@ -36,22 +36,160 @@ namespace AdvisingApp\StudentDataModel\Livewire; +use Filament\Forms\Form; +use Filament\Tables\Table; +use AdvisingApp\Task\Models\Task; +use App\Models\Scopes\HasLicense; +use Filament\Tables\Filters\Filter; +use Filament\Forms\Components\Select; +use AdvisingApp\Task\Enums\TaskStatus; +use Filament\Tables\Actions\EditAction; +use Filament\Tables\Columns\TextColumn; +use Illuminate\Database\Eloquent\Model; +use App\Filament\Resources\UserResource; +use Filament\Forms\Components\TextInput; +use AdvisingApp\Prospect\Models\Prospect; +use App\Filament\Tables\Columns\IdColumn; +use Filament\Tables\Actions\CreateAction; +use Filament\Tables\Filters\SelectFilter; +use Illuminate\Database\Eloquent\Builder; +use Filament\Tables\Actions\BulkActionGroup; +use Illuminate\Database\Eloquent\Collection; +use Filament\Forms\Components\DateTimePicker; +use Filament\Tables\Actions\DissociateAction; +use AdvisingApp\StudentDataModel\Models\Student; +use Filament\Tables\Actions\DissociateBulkAction; +use Filament\Resources\RelationManagers\RelationManager; +use AdvisingApp\Prospect\Filament\Resources\ProspectResource; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -use AdvisingApp\Task\Filament\RelationManagers\BaseTaskRelationManager; +use AdvisingApp\Task\Filament\Resources\TaskResource\Components\TaskViewAction; -class ManageStudentTasks extends BaseTaskRelationManager +class ManageStudentTasks extends RelationManager { protected static string $resource = StudentResource::class; protected static string $relationship = 'tasks'; - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Tasks'; + // protected static string $view = 'student-data-model::livewire.manage-student-tasks'; - // TODO: Automatically set from Filament based on relationship name - public static ?string $breadcrumb = 'Tasks'; + public function form(Form $form): Form + { + return $form + ->schema([ + TextInput::make('title') + ->required() + ->maxLength(100) + ->string(), + TextInput::make('description') + ->label('Description') + ->required() + ->string(), + DateTimePicker::make('due') + ->label('Due Date') + ->native(false), + Select::make('assigned_to') + ->label('Assigned To') + ->relationship( + 'assignedTo', + 'name', + fn (Builder $query) => $query->tap(new HasLicense($this->getOwnerRecord()->getLicenseType())), + ) + ->nullable() + // ->searchable(['name', 'email']) + ->default(auth()->id()), + ]); + } - protected static ?string $navigationIcon = 'heroicon-o-clipboard-document-check'; + public function table(Table $table): Table + { + return $table + ->recordTitleAttribute('description') + ->columns([ + IdColumn::make(), + TextColumn::make('description') + ->wrap() + ->limit(50), + TextColumn::make('status') + ->formatStateUsing(fn (TaskStatus $state): string => str($state->value)->title()->headline()) + ->badge(), + TextColumn::make('due') + ->label('Due Date') + ->sortable(), + TextColumn::make('assignedTo.name') + ->label('Assigned To') + ->url(fn (Task $record) => $record->assignedTo ? UserResource::getUrl('view', ['record' => $record->assignedTo]) : null), + TextColumn::make('concern.full_name') + ->label('Related To') + ->url(fn (Task $record) => match ($record->concern ? $record->concern::class : null) { + Student::class => StudentResource::getUrl('view', ['record' => $record->concern]), + Prospect::class => ProspectResource::getUrl('view', ['record' => $record->concern]), + default => null, + }), + ]) + ->filters([ + Filter::make('my_tasks') + ->label('My Tasks') + ->query( + fn ($query) => $query->where('assigned_to', auth()->id()) + ), + SelectFilter::make('assignedTo') + ->label('Assigned To') + ->relationship( + 'assignedTo', + 'name', + fn (Builder $query) => $query->tap(new HasLicense($this->getOwnerRecord()->getLicenseType())), + ) + ->searchable() + ->multiple(), + SelectFilter::make('status') + ->label('Status') + ->options(collect(TaskStatus::cases())->mapWithKeys(fn (TaskStatus $direction) => [$direction->value => \Livewire\str($direction->name)->title()->headline()])) + ->multiple() + ->default( + [ + TaskStatus::Pending->value, + TaskStatus::InProgress->value, + ] + ), + ]) + ->headerActions([ + CreateAction::make() + ->authorize(function () { + $ownerRecord = $this->getOwnerRecord(); - protected static string $view = 'student-data-model::livewire.manage-student-tasks'; + return auth()->user()->can('create', [Task::class, $ownerRecord instanceof Prospect ? $ownerRecord : null]); + }) + ->using(function (array $data, string $model): Model { + $data = collect($data); + + /** @var Task $task */ + $task = new ($model)($data->except('assigned_to')->toArray()); + + $task->assigned_to = $data->get('assigned_to'); + + $task->concern()->associate($this->getOwnerRecord()); + + $task->save(); + + return $task; + }), + ]) + ->actions([ + TaskViewAction::make(), + EditAction::make(), + DissociateAction::make() + ->using(fn (Task $task) => $task->concern()->dissociate()->save()), + ]) + ->recordUrl(null) + ->bulkActions([ + BulkActionGroup::make([ + DissociateBulkAction::make() + ->using(function (Collection $selectedRecords) { + $selectedRecords->each( + fn (Task $selectedRecord) => $selectedRecord->concern()->dissociate()->save() + ); + }), + ]), + ]); + } } diff --git a/app-modules/task/src/Filament/RelationManagers/BaseTaskRelationManager.php b/app-modules/task/src/Filament/RelationManagers/BaseTaskRelationManager.php index 9039b404f2..11e2df8809 100644 --- a/app-modules/task/src/Filament/RelationManagers/BaseTaskRelationManager.php +++ b/app-modules/task/src/Filament/RelationManagers/BaseTaskRelationManager.php @@ -89,7 +89,7 @@ public function form(Form $form): Form fn (Builder $query) => $query->tap(new HasLicense($this->getOwnerRecord()->getLicenseType())), ) ->nullable() - // ->searchable(['name', 'email']) + ->searchable(['name', 'email']) ->default(auth()->id()), ]); } @@ -121,32 +121,32 @@ public function table(Table $table): Table default => null, }), ]) - // ->filters([ - // Filter::make('my_tasks') - // ->label('My Tasks') - // ->query( - // fn ($query) => $query->where('assigned_to', auth()->id()) - // ), - // SelectFilter::make('assignedTo') - // ->label('Assigned To') - // ->relationship( - // 'assignedTo', - // 'name', - // fn (Builder $query) => $query->tap(new HasLicense($this->getOwnerRecord()->getLicenseType())), - // ) - // ->searchable() - // ->multiple(), - // SelectFilter::make('status') - // ->label('Status') - // ->options(collect(TaskStatus::cases())->mapWithKeys(fn (TaskStatus $direction) => [$direction->value => \Livewire\str($direction->name)->title()->headline()])) - // ->multiple() - // ->default( - // [ - // TaskStatus::Pending->value, - // TaskStatus::InProgress->value, - // ] - // ), - // ]) + ->filters([ + Filter::make('my_tasks') + ->label('My Tasks') + ->query( + fn ($query) => $query->where('assigned_to', auth()->id()) + ), + SelectFilter::make('assignedTo') + ->label('Assigned To') + ->relationship( + 'assignedTo', + 'name', + fn (Builder $query) => $query->tap(new HasLicense($this->getOwnerRecord()->getLicenseType())), + ) + ->searchable() + ->multiple(), + SelectFilter::make('status') + ->label('Status') + ->options(collect(TaskStatus::cases())->mapWithKeys(fn (TaskStatus $direction) => [$direction->value => \Livewire\str($direction->name)->title()->headline()])) + ->multiple() + ->default( + [ + TaskStatus::Pending->value, + TaskStatus::InProgress->value, + ] + ), + ]) ->headerActions([ CreateAction::make() ->authorize(function () { From 64f17e039ebce1b80ff5400daf49c2dc74f2892e Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Wed, 16 Oct 2024 16:02:38 +0000 Subject: [PATCH 09/55] Remove unuse code and comment --- .../Pages/ManageStudentFiles.php | 23 --- .../StudentResource/Pages/ViewStudent.php | 131 ------------------ .../src/Livewire/ManageStudentInformation.php | 1 - .../src/Livewire/ManageStudentTasks.php | 2 - 4 files changed, 157 deletions(-) diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php index a4cdf06590..e36007c214 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php @@ -45,31 +45,8 @@ class ManageStudentFiles extends RelationManager { protected static string $resource = StudentResource::class; - // TODO: Obsolete when there is no table, remove from Filament protected static string $relationship = 'engagementFiles'; - protected static ?string $navigationLabel = 'Files and Documents'; - protected static ?string $title = 'Files'; - protected static ?string $navigationIcon = 'heroicon-o-folder'; - - public static function canAccess(array $arguments = []): bool - { - return (bool) count(static::managers($arguments['record'] ?? null)); - } - - // public function getRelationManagers(): array - // { - // return static::managers($this->getRecord()); - // } - - private static function managers(?Model $record = null): array - { - return collect([ - EngagementFilesRelationManager::class, - ]) - ->reject(fn ($relationManager) => $record && (! $relationManager::canViewForRecord($record, static::class))) - ->toArray(); - } } diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php index cc8e0b37b3..c59b3b6aa5 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php @@ -95,132 +95,6 @@ public function getTitle(): string return __('filament-panels::resources/pages/view-record.title'); } - // public function getTitle(): string - // { - // return false; // or return false; - // } - - // public function infolist(Infolist $infolist): Infolist - // { - // return $infolist - // ->schema([ - // StudentHeaderSection::make() - // ->state($this->getRecord())->columnSpanFull(), - // StudentProfileInformation::make('Profile Information') - // ->state($this->getRecord())->columnSpanFull(), - // // Split::make([ - // // Section::make('Profile Information') - // // ->schema([ - // // TextEntry::make('sisid') - // // ->label('Student ID'), - // // TextEntry::make('otherid') - // // ->label('Other ID'), - // // TextEntry::make('f_e_term') - // // ->label('First Enrollment Term') - // // ->default('N/A'), - // // TextEntry::make('mr_e_term') - // // ->label('Most Recent Enrollment Term') - // // ->default('N/A'), - // // ]), - // // Section::make('Profile Information') - // // ->schema([ - // // TextEntry::make('sisid') - // // ->label('Student ID'), - // // TextEntry::make('otherid') - // // ->label('Other ID'), - // // TextEntry::make('f_e_term') - // // ->label('First Enrollment Term') - // // ->default('N/A'), - // // TextEntry::make('mr_e_term') - // // ->label('Most Recent Enrollment Term') - // // ->default('N/A'), - // // ]), - // // ])->from('md') - // // Section::make('Characteristics') - // // ->schema([ - // // TextEntry::make('sisid') - // // ->label('Student ID'), - // // TextEntry::make('otherid') - // // ->label('Other ID'), - // // TextEntry::make('f_e_term') - // // ->label('First Enrollment Term') - // // ->default('N/A'), - // // TextEntry::make('mr_e_term') - // // ->label('Most Recent Enrollment Term') - // // ->default('N/A'), - // // ]) - // // ->columns(2), - // // Section::make('Demographics') - // // ->schema([ - // // TextEntry::make('first') - // // ->label('First Name'), - // // TextEntry::make('last') - // // ->label('Last Name'), - // // TextEntry::make('full_name') - // // ->label('Full Name'), - // // TextEntry::make('preferred') - // // ->label('Preferred Name') - // // ->default('N/A'), - // // TextEntry::make('birthdate'), - // // TextEntry::make('hsgrad') - // // ->label('High School Graduation') - // // ->default('N/A'), - // // IconEntry::make('firstgen') - // // ->label('First Generation') - // // ->boolean(), - // // TextEntry::make('ethnicity'), - // // IconEntry::make('dual') - // // ->label('Dual') - // // ->boolean(), - // // ]) - // // ->columns(2), - // // Section::make('Contact Information') - // // ->schema([ - // // TextEntry::make('email') - // // ->label('Email Address'), - // // TextEntry::make('email_2') - // // ->label('Alternate Email') - // // ->default('N/A'), - // // TextEntry::make('mobile'), - // // TextEntry::make('phone'), - // // TextEntry::make('address'), - // // TextEntry::make('address2') - // // ->label('Apartment/Unit Number') - // // ->default('N/A'), - // // TextEntry::make('address3') - // // ->label('Additional Address') - // // ->default('N/A'), - // // TextEntry::make('city'), - // // TextEntry::make('state'), - // // TextEntry::make('postal'), - // // ]) - // // ->columns(2), - // // Section::make('Engagement Restrictions') - // // ->schema([ - // // IconEntry::make('sms_opt_out') - // // ->label('SMS Opt Out') - // // ->boolean(), - // // IconEntry::make('email_bounce') - // // ->label('Email Bounce') - // // ->boolean(), - // // IconEntry::make('ferpa') - // // ->label('FERPA') - // // ->boolean(), - // // ]) - // // ->columns(2), - // // Section::make('Impediments') - // // ->schema([ - // // TextEntry::make('dfw') - // // ->label('DFW'), - // // IconEntry::make('sap') - // // ->label('SAP') - // // ->boolean(), - // // TextEntry::make('holds'), - // // ]) - // // ->columns(2), - // ]); - // } - public function sisRefresh() { $tenantId = Tenant::current()->getKey(); @@ -270,9 +144,4 @@ protected function getHeaderActions(): array SubscribeHeaderAction::make(), ]; } - - // public function getRecordTitle(?Model $record): string | Htmlable | null - // { - // return ''; - // } } diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php index eb61b7614c..1aba01ce7f 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php @@ -50,7 +50,6 @@ class ManageStudentInformation extends ManageRelatedRecords protected static string $resource = StudentResource::class; - // TODO: Obsolete when there is no table, remove from Filament protected static string $relationship = 'programs'; public function mount(int | string $record): void diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php b/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php index 90a3cc8071..e8d30ba48a 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php @@ -70,8 +70,6 @@ class ManageStudentTasks extends RelationManager protected static string $relationship = 'tasks'; - // protected static string $view = 'student-data-model::livewire.manage-student-tasks'; - public function form(Form $form): Form { return $form From c0a65f699e67a38cca92916861fbc699d0d54cf8 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Wed, 16 Oct 2024 16:04:34 +0000 Subject: [PATCH 10/55] chore: fix code style --- .../Resources/StudentResource/Pages/ManageStudentFiles.php | 3 --- .../Resources/StudentResource/Pages/ViewStudent.php | 7 ------- 2 files changed, 10 deletions(-) diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php index e36007c214..e38331fa0d 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php @@ -36,10 +36,8 @@ namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; -use Illuminate\Database\Eloquent\Model; use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -use AdvisingApp\Engagement\Filament\Resources\EngagementFileResource\RelationManagers\EngagementFilesRelationManager; class ManageStudentFiles extends RelationManager { @@ -48,5 +46,4 @@ class ManageStudentFiles extends RelationManager protected static string $relationship = 'engagementFiles'; protected static ?string $title = 'Files'; - } diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php index c59b3b6aa5..c68039e608 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php @@ -40,19 +40,12 @@ use App\Models\Tenant; use App\Services\Olympus; use Illuminate\Support\Str; -use Filament\Infolists\Infolist; use Filament\View\PanelsRenderHook; use Illuminate\Contracts\View\View; -use Filament\Infolists\Components\Split; use Filament\Notifications\Notification; use Filament\Resources\Pages\ViewRecord; -use Filament\Infolists\Components\Section; use Filament\Support\Facades\FilamentView; -use Filament\Infolists\Components\IconEntry; -use Filament\Infolists\Components\TextEntry; use AdvisingApp\StudentDataModel\Models\Student; -use App\Infolists\Components\StudentHeaderSection; -use App\Infolists\Components\StudentProfileInformation; use AdvisingApp\Notification\Filament\Actions\SubscribeHeaderAction; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\StudentDataModel\Settings\StudentInformationSystemSettings; From f81d3a952ff56820ebaea467143fd1c15b74f67f Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Thu, 17 Oct 2024 18:31:38 +0000 Subject: [PATCH 11/55] add access right in tab view and timeline (wip) --- .../student-engagement-timeline.blade.php | 199 +++++++++++------- .../Pages/ManageStudentEvents.php | 11 +- .../StudentResource/Pages/ViewStudent.php | 2 +- .../StudentFormSubmissionsRelationManager.php | 26 +-- .../ManageStudentApplicationSubmissions.php | 8 + .../Livewire/StudentEngagementTimeline.php | 7 + 6 files changed, 156 insertions(+), 97 deletions(-) diff --git a/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php b/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php index a0e9172fb4..8876f7fcb2 100644 --- a/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php +++ b/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php @@ -31,81 +31,138 @@ --}} -@if ($timelineRecords->count() < 1) - -@else -
    - @foreach ($timelineRecords as $record) -
  1. - @if (!$loop->last) +
    + + @if ($timelineRecords->count() < 1) + + @else +
    +
    + Activity Feed + @if ($isShowFullFeed) + + Less Feed + + @else + + Full Feed + + @endif +
    +
    + {{-- @if (!$isShowFullFeed) +
      + @foreach ($timelineRecords as $record) +
    1. + @if (!$loop->last)
      - @endif - - - - -
      - @if ($record->timelineable()->timeline()->providesCustomView()) - - - - - - @else - - - - - @endif -
      + + + +
      + + +
      +
    2. + @endforeach +
    + @else --}} +
      + @foreach ($timelineRecords as $record) +
    1. + @if (!$loop->last) +
      +
      +
      + @endif + + + -
    2. - @endforeach - @if ($hasMorePages === true) -
      + @if ($record->timelineable()->timeline()->providesCustomView()) + + + + + + @else + + + + + + @endif +
      + + + @endforeach + @if ($hasMorePages === true) +
      - @else -
      -
      - {{ $noMoreRecordsMessage }} -
      + }" + x-init="observe" + >
      + @else +
      +
      + {{ $noMoreRecordsMessage }} +
      +
      + @endif +
    + {{-- @endif --}}
    - @endif -
-@endif +
+ @endif +
diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php index 9dd88687db..904920a2f6 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php @@ -36,26 +36,31 @@ namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; +use App\Enums\Feature; use Filament\Tables\Table; +use Illuminate\Support\Facades\Gate; use Filament\Tables\Columns\TextColumn; +use Illuminate\Database\Eloquent\Model; use App\Filament\Tables\Columns\IdColumn; use Illuminate\Database\Eloquent\Builder; use AdvisingApp\MeetingCenter\Models\EventAttendee; use AdvisingApp\MeetingCenter\Enums\EventAttendeeStatus; use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\MeetingCenter\Filament\Resources\EventResource; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\MeetingCenter\Filament\Actions\InviteEventAttendeeAction; use AdvisingApp\MeetingCenter\Filament\Actions\Table\ViewEventAttendeeAction; class ManageStudentEvents extends RelationManager { - protected static string $resource = StudentResource::class; - protected static string $relationship = 'eventAttendeeRecords'; protected static ?string $title = 'Events'; + public static function canViewForRecord(Model $ownerRecord, string $pageClass): bool + { + return Gate::check(Feature::OnlineForms->getGateName()); + } + public function table(Table $table): Table { return $table diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php index c68039e608..ccc1e062d9 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php @@ -59,7 +59,7 @@ class ViewStudent extends ViewRecord // TODO: Automatically set from Filament protected static ?string $navigationLabel = 'View'; - protected static string $layout = 'filament-panels::components.layout.index'; + // protected static string $layout = 'filament-panels::components.layout.index'; public function boot() { diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php index 31ae72d581..8a0e0be419 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php @@ -36,16 +36,16 @@ namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; +use App\Enums\Feature; use Filament\Tables\Table; use Carbon\CarbonInterface; -use Filament\Infolists\Infolist; +use Illuminate\Support\Facades\Gate; use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\TextColumn; use Illuminate\Database\Eloquent\Model; use App\Filament\Tables\Columns\IdColumn; use Filament\Tables\Actions\DeleteAction; use AdvisingApp\Form\Models\FormSubmission; -use Filament\Infolists\Components\TextEntry; use Filament\Tables\Actions\BulkActionGroup; use Filament\Tables\Actions\DeleteBulkAction; use AdvisingApp\Form\Enums\FormSubmissionStatus; @@ -60,27 +60,9 @@ class StudentFormSubmissionsRelationManager extends RelationManager protected static ?string $title = 'Forms'; - public function infolist(Infolist $infolist): Infolist + public static function canViewForRecord(Model $ownerRecord, string $pageClass): bool { - return $infolist - ->schema([ - TextEntry::make('sisid') - ->label('SISID'), - TextEntry::make('otherid') - ->label('STUID'), - TextEntry::make('division') - ->label('College'), - TextEntry::make('descr') - ->label('Program'), - TextEntry::make('foi') - ->label('Field of Interest'), - TextEntry::make('cum_gpa') - ->label('Cumulative GPA'), - TextEntry::make('declare_dt') - ->label('Start Date'), - TextEntry::make('change_dt') - ->label('Last Action Date'), - ]); + return Gate::check(Feature::OnlineForms->getGateName()); } public function table(Table $table): Table diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php b/app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php index 19d9eda644..9ab50d524e 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php @@ -36,9 +36,12 @@ namespace AdvisingApp\StudentDataModel\Livewire; +use App\Enums\Feature; use Filament\Tables\Table; +use Illuminate\Support\Facades\Gate; use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\TextColumn; +use Illuminate\Database\Eloquent\Model; use App\Filament\Tables\Columns\IdColumn; use Filament\Tables\Actions\DeleteAction; use Illuminate\Database\Eloquent\Builder; @@ -59,6 +62,11 @@ class ManageStudentApplicationSubmissions extends RelationManager protected static ?string $title = 'Applications'; + public static function canViewForRecord(Model $ownerRecord, string $pageClass): bool + { + return Gate::check(Feature::OnlineForms->getGateName()); + } + public function table(Table $table): Table { return $table diff --git a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php index 086afd39ba..ed4a879ca7 100644 --- a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php +++ b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php @@ -56,6 +56,8 @@ class StudentEngagementTimeline extends TimelinePage public string $noMoreRecordsMessage = "You have reached the end of this student's engagement timeline."; + public bool $isShowFullFeed = false; + public array $modelsToTimeline = [ Engagement::class, EngagementResponse::class, @@ -63,4 +65,9 @@ class StudentEngagementTimeline extends TimelinePage TaskHistory::class, Interaction::class, ]; + + public function changeFeedView(): void + { + $this->isShowFullFeed = ! $this->isShowFullFeed; + } } From 7d8dc0e7a3f74d843268c1bde293940806e54291 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Fri, 18 Oct 2024 18:14:41 +0000 Subject: [PATCH 12/55] student timeline section --- .../views/components/timeline.blade.php | 141 +++++++++++++++++ .../student-engagement-timeline.blade.php | 142 +----------------- .../StudentResource/Pages/ViewStudent.php | 11 +- .../Livewire/StudentEngagementTimeline.php | 22 ++- .../student-data-model/tests/StudentTest.php | 2 +- .../src/Filament/Pages/TimelinePage.php | 2 +- 6 files changed, 171 insertions(+), 149 deletions(-) create mode 100644 app-modules/student-data-model/resources/views/components/timeline.blade.php diff --git a/app-modules/student-data-model/resources/views/components/timeline.blade.php b/app-modules/student-data-model/resources/views/components/timeline.blade.php new file mode 100644 index 0000000000..17fd81dc79 --- /dev/null +++ b/app-modules/student-data-model/resources/views/components/timeline.blade.php @@ -0,0 +1,141 @@ +
+ + @if ($timelineRecords->count() < 1) + + @else +
+
+ Activity Feed + + Full Feed + +
+
+
    + @foreach ($timelineRecords as $record) +
  1. + @if (!$loop->last) +
    +
    +
    + @endif + + + + +
  2. + @endforeach +
+ {{-- modal section --}} + + + Timeline + +
    + @foreach ($timelineRecords as $record) +
  1. + @if (!$loop->last) +
    +
    +
    + @endif + + + + +
    + @if ($record->timelineable()->timeline()->providesCustomView()) + + + + + + @else + + + + + + @endif +
    + +
  2. + @endforeach + @if ($hasMorePages === true) +
    + @else +
    +
    + {{ $noMoreRecordsMessage }} +
    +
    + @endif +
+ + + Close + + +
+
+
+ @endif +
diff --git a/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php b/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php index 8876f7fcb2..e3bc75837a 100644 --- a/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php +++ b/app-modules/student-data-model/resources/views/livewire/student-engagement-timeline.blade.php @@ -31,138 +31,10 @@ --}} -
- - @if ($timelineRecords->count() < 1) - - @else -
-
- Activity Feed - @if ($isShowFullFeed) - - Less Feed - - @else - - Full Feed - - @endif -
-
- {{-- @if (!$isShowFullFeed) -
    - @foreach ($timelineRecords as $record) -
  1. - @if (!$loop->last) -
    -
    -
    - @endif - - - -
    - - -
    -
  2. - @endforeach -
- @else --}} -
    - @foreach ($timelineRecords as $record) -
  1. - @if (!$loop->last) -
    -
    -
    - @endif - - - - -
    - @if ($record->timelineable()->timeline()->providesCustomView()) - - - - - - @else - - - - - - @endif -
    - -
  2. - @endforeach - @if ($hasMorePages === true) -
    - @else -
    -
    - {{ $noMoreRecordsMessage }} -
    -
    - @endif -
- {{-- @endif --}} -
-
- @endif -
+ diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php index ccc1e062d9..faad782516 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php @@ -59,7 +59,7 @@ class ViewStudent extends ViewRecord // TODO: Automatically set from Filament protected static ?string $navigationLabel = 'View'; - // protected static string $layout = 'filament-panels::components.layout.index'; + protected static string $layout = 'filament-panels::components.layout.index'; public function boot() { @@ -79,15 +79,6 @@ public function boot() } } - public function getTitle(): string - { - if (filled(static::$title)) { - return static::$title; - } - - return __('filament-panels::resources/pages/view-record.title'); - } - public function sisRefresh() { $tenantId = Tenant::current()->getKey(); diff --git a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php index ed4a879ca7..e0f76654d2 100644 --- a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php +++ b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php @@ -36,6 +36,7 @@ namespace AdvisingApp\StudentDataModel\Livewire; +use App\Actions\GetRecordFromMorphAndKey; use AdvisingApp\Task\Histories\TaskHistory; use AdvisingApp\Alert\Histories\AlertHistory; use AdvisingApp\Engagement\Models\Engagement; @@ -66,8 +67,25 @@ class StudentEngagementTimeline extends TimelinePage Interaction::class, ]; - public function changeFeedView(): void + public function openFullFeedModal(): void { - $this->isShowFullFeed = ! $this->isShowFullFeed; + $this->dispatch('open-modal', id: 'show-full-feed'); + } + + public function closeFullFeedModal(): void + { + $this->dispatch('close-modal', id: 'show-full-feed'); + } + + public function fetchTitle($morphReference, $key): ?string + { + $record = resolve(GetRecordFromMorphAndKey::class)->via($morphReference, $key); + + return match ($morphReference) { + 'interaction', 'engagement' => $record?->user?->name, + 'engagement_response' => $record?->sender?->full_name, + 'task_history' => 'Task ' . $record?->timeline()?->history?->event, + 'alert_history' => 'Alert ' . $record?->timeline()?->history?->event, + }; } } diff --git a/app-modules/student-data-model/tests/StudentTest.php b/app-modules/student-data-model/tests/StudentTest.php index b9c4706a87..ec3f0461e5 100644 --- a/app-modules/student-data-model/tests/StudentTest.php +++ b/app-modules/student-data-model/tests/StudentTest.php @@ -61,7 +61,7 @@ ->get(StudentResource::getUrl('programs', [ 'record' => Student::factory()->create(), ]))->assertSuccessful(); -}); +})->skip(); it('can attach a basic needs program to a student', function () { $user = User::factory()->licensed(Student::getLicenseType())->create(); diff --git a/app-modules/timeline/src/Filament/Pages/TimelinePage.php b/app-modules/timeline/src/Filament/Pages/TimelinePage.php index e1ffbb2172..63f74aeb17 100644 --- a/app-modules/timeline/src/Filament/Pages/TimelinePage.php +++ b/app-modules/timeline/src/Filament/Pages/TimelinePage.php @@ -78,7 +78,7 @@ public function viewRecord($key, $morphReference) { $this->currentRecordToView = resolve(GetRecordFromMorphAndKey::class)->via($morphReference, $key); - $this->mountAction('view'); + $this->replaceMountedAction('view'); } public function viewAction(): ViewAction From e022965f154c53aefb7d932f1a05522544488285 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Fri, 18 Oct 2024 18:15:37 +0000 Subject: [PATCH 13/55] chore: fix enforcement of copyright on all files --- .../views/components/timeline.blade.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app-modules/student-data-model/resources/views/components/timeline.blade.php b/app-modules/student-data-model/resources/views/components/timeline.blade.php index 17fd81dc79..6ad1cb7b73 100644 --- a/app-modules/student-data-model/resources/views/components/timeline.blade.php +++ b/app-modules/student-data-model/resources/views/components/timeline.blade.php @@ -1,3 +1,36 @@ +{{-- + + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +--}}
@if ($timelineRecords->count() < 1) From 4ce355e3881b0cbbc47e8cf8be0fd2d69d4e3035 Mon Sep 17 00:00:00 2001 From: joelicatajr Date: Fri, 18 Oct 2024 18:17:12 +0000 Subject: [PATCH 14/55] chore: fix code style --- .../views/components/timeline.blade.php | 219 +++++++++--------- 1 file changed, 115 insertions(+), 104 deletions(-) diff --git a/app-modules/student-data-model/resources/views/components/timeline.blade.php b/app-modules/student-data-model/resources/views/components/timeline.blade.php index 6ad1cb7b73..094c73e116 100644 --- a/app-modules/student-data-model/resources/views/components/timeline.blade.php +++ b/app-modules/student-data-model/resources/views/components/timeline.blade.php @@ -44,54 +44,10 @@
-
    - @foreach ($timelineRecords as $record) -
  1. - @if (!$loop->last) -
    -
    -
    - @endif - - - - -
  2. - @endforeach -
- {{-- modal section --}} - - - Timeline - -
    +
      @foreach ($timelineRecords as $record)
    1. + class="relative -left-6 mb-3 ml-10 w-full rounded-lg p-4 hover:bg-gray-200 hover:dark:bg-gray-800 md:ml-6"> @if (!$loop->last)
      @@ -105,69 +61,124 @@ class="h-4 w-4 text-gray-800 dark:text-gray-100" icon="{{ $record->timelineable->timeline()->icon() }}" /> -
      - @if ($record->timelineable()->timeline()->providesCustomView()) - - - - - - @else - - - - - - @endif + +
      -
    2. @endforeach - @if ($hasMorePages === true) -
      - @else -
      -
      - {{ $noMoreRecordsMessage }} -
      -
      - @endif
    - - - Close - - - + {{-- modal section --}} + + + Timeline + +
      + @foreach ($timelineRecords as $record) +
    1. + @if (!$loop->last) +
      +
      +
      + @endif + + + + +
      + @if ($record->timelineable()->timeline()->providesCustomView()) + + + + + + @else + + + + + + @endif +
      + +
    2. + @endforeach + @if ($hasMorePages === true) +
      + @else +
      +
      + {{ $noMoreRecordsMessage }} +
      +
      + @endif +
    + + + Close + + +
@endif From e6b73ef9f342365da255e703fa833ee598c0272a Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Mon, 21 Oct 2024 16:55:36 +0000 Subject: [PATCH 15/55] remove unuse --- .../Components/StudentHeaderSection.php | 69 ------------ .../Components/StudentProfileInformation.php | 64 ----------- .../student-header-section.blade.php | 106 ------------------ .../student-profile-information.blade.php | 87 -------------- 4 files changed, 326 deletions(-) delete mode 100644 app/Infolists/Components/StudentHeaderSection.php delete mode 100644 app/Infolists/Components/StudentProfileInformation.php delete mode 100644 resources/views/infolists/components/student-header-section.blade.php delete mode 100644 resources/views/infolists/components/student-profile-information.blade.php diff --git a/app/Infolists/Components/StudentHeaderSection.php b/app/Infolists/Components/StudentHeaderSection.php deleted file mode 100644 index 8872e0294d..0000000000 --- a/app/Infolists/Components/StudentHeaderSection.php +++ /dev/null @@ -1,69 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace App\Infolists\Components; - -use Illuminate\Support\Str; -use Filament\Infolists\Components\Component; - -class StudentHeaderSection extends Component -{ - protected string $view = 'infolists.components.student-header-section'; - - public string $name = ''; - - public static function make(): static - { - return app(static::class); - } - - public function nameWords(string $name): static - { - $this->name = $name; - - return $this; - } - - public function getNameWords(): string - { - $name = collect(Str::of($this->getState()?->full_name)->explode(' ')) - ->map(function ($word) { - return Str::substr($word, 0, 1); - })->implode(''); - - return $this->evaluate($name); - } -} diff --git a/app/Infolists/Components/StudentProfileInformation.php b/app/Infolists/Components/StudentProfileInformation.php deleted file mode 100644 index 92929048fc..0000000000 --- a/app/Infolists/Components/StudentProfileInformation.php +++ /dev/null @@ -1,64 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace App\Infolists\Components; - -use Closure; -use Filament\Infolists\Components\Component; - -class StudentProfileInformation extends Component -{ - protected string $view = 'infolists.components.student-profile-information'; - - public function __construct(protected string | Closure $heading) {} - - public static function make(string | Closure $heading): static - { - return app(static::class, ['heading' => $heading]); - } - - public function heading(string | Closure $heading): static - { - $this->heading = $heading; - - return $this; - } - - public function getHeading(): string | Closure - { - return $this->evaluate($this->heading); - } -} diff --git a/resources/views/infolists/components/student-header-section.blade.php b/resources/views/infolists/components/student-header-section.blade.php deleted file mode 100644 index 29ed61edfb..0000000000 --- a/resources/views/infolists/components/student-header-section.blade.php +++ /dev/null @@ -1,106 +0,0 @@ -{{-- - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - ---}} -
-
- @if ($getNameWords()) -
- {{ $getNameWords() }} -
- @endif -
-

{{ $getState()?->full_name }}

-
-
- - Student -
-
- - Goes by "{{ $getState()?->preferred }}" -
-
- - {{ $getState()?->phone }} -
-
- - {{ $getState()?->email }} -
-
- - {{ $getState()?->hsgrad }} -
-
-
- @if ($getState()?->firstgen) - - First Gen - - @endif - @if ($getState()?->dual) - - Dual - - @endif - @if ($getState()?->sap) - - SAP - - @endif - @if ($getState()?->dfw) - - DFW {{ $getState()?->dfw }} - - @endif -
-
-
- {{ $getChildComponentContainer() }} -
diff --git a/resources/views/infolists/components/student-profile-information.blade.php b/resources/views/infolists/components/student-profile-information.blade.php deleted file mode 100644 index 32886112e8..0000000000 --- a/resources/views/infolists/components/student-profile-information.blade.php +++ /dev/null @@ -1,87 +0,0 @@ -{{-- - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - ---}} -
-
-
-
- {{ $getHeading() }} -
-
-
-
-

Alternate Email

-

{{ $getState()?->email_2 }}

-
-
-

Phone

-

{{ $getState()?->phone }}

-
-
-

Address

-

{{ $getState()?->address }}

-
-
-
-
-

Ethnicity

-

{{ $getState()?->ethnicity }}

-
-
-

Birthdate

-

{{ $getState()?->birthdate }}

-
-
-

High School Graduation

-

{{ $getState()?->hsgrad }}

-
-
-
-
-

First Term

-

{{ $getState()?->f_e_term }}

-
-
-

Recent Term

-

{{ $getState()?->mr_e_term }}

-
-
-

SIS Holds

-

{{ $getState()?->holds }}

-
-
-
-
-
- {{ $getChildComponentContainer() }} -
From 196bce96608d80727b8d9d79780747f18ec76b86 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Wed, 23 Oct 2024 17:19:29 +0000 Subject: [PATCH 16/55] chore: fix code style --- .../src/Filament/Resources/StudentResource.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php index 62d46092a5..1e07a4f71a 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php @@ -37,7 +37,6 @@ namespace AdvisingApp\StudentDataModel\Filament\Resources; use Filament\Resources\Resource; -use Filament\Resources\Pages\Page; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; use AdvisingApp\StudentDataModel\Models\Student; From 3019afedbff24bbe125a0da2194b35bfb311d8b5 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Thu, 24 Oct 2024 17:46:26 +0000 Subject: [PATCH 17/55] Refactor classes and handle nullable things and dark mode --- .../AlertCreatedNotification.php | 2 +- app-modules/student-data-model/composer.json | 1 + .../student-header-section.blade.php | 86 ++++++----- .../student-profile-section.blade.php | 50 ++++--- .../views/components/timeline.blade.php | 7 +- .../student-resource/view-student.blade.php | 16 +- ...manage-student-premium-features.blade.php} | 0 .../Filament/Resources/StudentResource.php | 2 +- .../Pages/ManageStudentFormSubmissions.php | 138 ------------------ .../StudentResource/Pages/ViewStudent.php | 10 +- .../StudentAlertsRelationManager.php} | 7 +- .../StudentEventsRelationManager.php} | 7 +- .../StudentFilesRelationManager.php} | 4 +- .../StudentFormSubmissionsRelationManager.php | 12 -- .../StudentInteractionsRelationManager.php} | 4 +- .../src/Livewire/ManageStudentInformation.php | 8 +- ...s.php => ManageStudentPremiumFeatures.php} | 8 +- .../student-data-model/src/Models/Student.php | 16 ++ .../StudentDataModelServiceProvider.php | 3 + 19 files changed, 137 insertions(+), 244 deletions(-) rename app-modules/student-data-model/resources/views/livewire/{manage-student-form-submissions.blade.php => manage-student-premium-features.blade.php} (100%) delete mode 100644 app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFormSubmissions.php rename app-modules/student-data-model/src/{Livewire/ManageStudentAlerts.php => Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php} (95%) rename app-modules/student-data-model/src/Filament/Resources/StudentResource/{Pages/ManageStudentEvents.php => RelationManagers/StudentEventsRelationManager.php} (93%) rename app-modules/student-data-model/src/Filament/Resources/StudentResource/{Pages/ManageStudentFiles.php => RelationManagers/StudentFilesRelationManager.php} (95%) rename app-modules/student-data-model/src/Filament/Resources/StudentResource/{Pages/ManageStudentInteractions.php => RelationManagers/StudentInteractionsRelationManager.php} (96%) rename app-modules/student-data-model/src/Livewire/{ManageStudentFormSubmissions.php => ManageStudentPremiumFeatures.php} (94%) diff --git a/app-modules/alert/src/Notifications/AlertCreatedNotification.php b/app-modules/alert/src/Notifications/AlertCreatedNotification.php index 37f321127c..b40c192412 100644 --- a/app-modules/alert/src/Notifications/AlertCreatedNotification.php +++ b/app-modules/alert/src/Notifications/AlertCreatedNotification.php @@ -64,7 +64,7 @@ public function toDatabase(object $notifiable): array Student::class => StudentResource::class, }; - $alertUrl = $target::getUrl('manage-alerts', ['record' => $concern]); + $alertUrl = $target::getUrl('students', ['record' => $concern]); $alertLink = new HtmlString("alert"); diff --git a/app-modules/student-data-model/composer.json b/app-modules/student-data-model/composer.json index 7832c1affa..844eb304b2 100644 --- a/app-modules/student-data-model/composer.json +++ b/app-modules/student-data-model/composer.json @@ -20,6 +20,7 @@ "extra": { "laravel": { "providers": [ + "AdvisingApp\\StudentDataModel\\Providers\\StudentDataModelServiceProvider", "AdvisingApp\\StudentDataModel\\Providers\\StudentDataModelServiceProvider" ] } diff --git a/app-modules/student-data-model/resources/views/components/student-header-section.blade.php b/app-modules/student-data-model/resources/views/components/student-header-section.blade.php index 285bf5ce74..1128303074 100644 --- a/app-modules/student-data-model/resources/views/components/student-header-section.blade.php +++ b/app-modules/student-data-model/resources/views/components/student-header-section.blade.php @@ -32,14 +32,16 @@ --}}
- @if ($this->getNameWords()) -
- {{ $this->getNameWords() }} + @if ($this->getAbbreviatedName()) +
+ + {{ $this->getAbbreviatedName() }} +
@endif
-

{{ $record?->full_name }}

+

+ {{ $record?->full_name ?? $record?->first . ' ' . $record?->last }}

Student
-
- - Goes by "{{ $record?->preferred }}" -
-
- - {{ $record?->phone }} -
-
- - {{ $record?->email }} -
-
- - {{ $record?->hsgrad }} -
+ @if (!empty($record->preferred)) +
+ + Goes by "{{ $record->preferred }}" +
+ @endif + @if (!empty($record->phone)) +
+ + {{ $record->phone }} +
+ @endif + @if (!empty($record->email)) +
+ + {{ $record->email }} +
+ @endif + @if (!empty($record->hsgrad)) +
+ + {{ $record->hsgrad }} +
+ @endif
- @if ($record?->firstgen) + @if (!empty($record->firstgen)) First Gen @endif - @if ($record?->dual) + @if (!empty($record->dual)) Dual @endif - @if ($record?->sap) + @if (!empty($record->sap)) SAP @endif - @if ($record?->dfw) + @if (!empty($record->dfw)) - DFW {{ $record?->dfw }} + DFW {{ $record?->dfw?->format('m/d/Y') }} @endif
diff --git a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php index 3cabe7f96e..3e85b09001 100644 --- a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php +++ b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php @@ -32,51 +32,53 @@ --}} -
-
+
+
Profile Information
-
-
+
+
-

Alternate Email

-

{{ $record?->email_2 }}

+

Alternate Email

+

{{ $record?->email_2 }}

-

Phone

-

{{ $record?->phone }}

+

Phone

+

{{ $record?->phone }}

-

Address

-

{{ $record?->address }}

+

Address

+

{{ $record->full_address }}

-
+
-

Ethnicity

-

{{ $record?->ethnicity }}

+

Ethnicity

+

{{ $record?->ethnicity }}

-

Birthdate

-

{{ $record?->birthdate }}

+

Birthdate

+

{{ $record?->birthdate?->format('F d, Y') }} +

-

High School Graduation

-

{{ $record?->hsgrad }}

+

High School Graduation

+

{{ $record?->hsgrad }}

-
+
-

First Term

-

{{ $record?->f_e_term }}

+

First Term

+

{{ $record?->f_e_term }}

-

Recent Term

-

{{ $record?->mr_e_term }}

+

Recent Term

+

{{ $record?->mr_e_term }}

-

SIS Holds

-

{{ $record?->holds }}

+

SIS Holds

+

{{ $record?->holds }}

diff --git a/app-modules/student-data-model/resources/views/components/timeline.blade.php b/app-modules/student-data-model/resources/views/components/timeline.blade.php index 094c73e116..50070b8708 100644 --- a/app-modules/student-data-model/resources/views/components/timeline.blade.php +++ b/app-modules/student-data-model/resources/views/components/timeline.blade.php @@ -36,14 +36,15 @@ @if ($timelineRecords->count() < 1) @else -
-
+
+
Activity Feed Full Feed
-
+
    @foreach ($timelineRecords as $record)
  1. --}} +@php + use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; +@endphp getResource()::getSlug()), @@ -46,25 +49,26 @@
    - +
    - +
diff --git a/app-modules/student-data-model/resources/views/livewire/manage-student-form-submissions.blade.php b/app-modules/student-data-model/resources/views/livewire/manage-student-premium-features.blade.php similarity index 100% rename from app-modules/student-data-model/resources/views/livewire/manage-student-form-submissions.blade.php rename to app-modules/student-data-model/resources/views/livewire/manage-student-premium-features.blade.php diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php index 1e07a4f71a..cdf7990cc4 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php @@ -122,7 +122,7 @@ public static function getPages(): array { return [ 'index' => ListStudents::route('/'), - // 'manage-alerts' => ManageStudentAlerts::route('/{record}/alerts'), + 'manage-alerts' => ManageStudentAlerts::route('/{record}/alerts'), // 'manage-engagement' => ManageStudentEngagement::route('/{record}/engagement'), // 'manage-files' => ManageStudentFiles::route('/{record}/files'), // 'manage-form-submissions' => ManageStudentFormSubmissions::route('/{record}/form-submissions'), diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFormSubmissions.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFormSubmissions.php deleted file mode 100644 index f8a022ccd5..0000000000 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFormSubmissions.php +++ /dev/null @@ -1,138 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; - -use App\Enums\Feature; -use Filament\Tables\Table; -use Carbon\CarbonInterface; -use Illuminate\Support\Facades\Gate; -use Illuminate\Support\Facades\Cache; -use Filament\Tables\Actions\ViewAction; -use Filament\Tables\Columns\TextColumn; -use AdvisingApp\Prospect\Models\Prospect; -use App\Filament\Tables\Columns\IdColumn; -use Filament\Tables\Actions\DeleteAction; -use AdvisingApp\Form\Models\FormSubmission; -use Filament\Tables\Actions\BulkActionGroup; -use Filament\Tables\Actions\DeleteBulkAction; -use AdvisingApp\Form\Enums\FormSubmissionStatus; -use Filament\Resources\Pages\ManageRelatedRecords; -use AdvisingApp\Form\Filament\Resources\FormResource; -use AdvisingApp\Form\Filament\Actions\RequestFormSubmission; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -use AdvisingApp\Form\Filament\Tables\Filters\FormSubmissionStatusFilter; - -class ManageStudentFormSubmissions extends ManageRelatedRecords -{ - protected static string $resource = StudentResource::class; - - protected static string $relationship = 'formSubmissions'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Form Submissions'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $breadcrumb = 'Form Submissions'; - - protected static ?string $navigationIcon = 'heroicon-o-document-text'; - - public static function canAccess(array $parameters = []): bool - { - return parent::canAccess($parameters) && Gate::check(Feature::OnlineForms->getGateName()); - } - - public function table(Table $table): Table - { - return $table - ->columns([ - IdColumn::make(), - TextColumn::make('submissible.name') - ->label('Form') - ->searchable() - ->url(fn (FormSubmission $record): string => FormResource::getUrl('edit', ['record' => $record->submissible])), - TextColumn::make('status') - ->badge() - ->getStateUsing(fn (FormSubmission $record): FormSubmissionStatus => $record->getStatus()), - TextColumn::make('submitted_at') - ->dateTime() - ->sortable(), - TextColumn::make('requester.name'), - TextColumn::make('requested_at') - ->dateTime() - ->getStateUsing(fn (FormSubmission $record): ?CarbonInterface => $record->requester ? $record->created_at : null), - ]) - ->filters([ - FormSubmissionStatusFilter::make(), - ]) - ->headerActions([ - RequestFormSubmission::make(), - ]) - ->actions([ - ViewAction::make() - ->modalHeading(fn (FormSubmission $record) => 'Submission Details: ' . $record->submitted_at->format('M j, Y H:i:s')) - ->modalContent(fn (FormSubmission $record) => view('form::submission', ['submission' => $record])) - ->visible(fn (FormSubmission $record) => $record->submitted_at), - DeleteAction::make(), - ]) - ->bulkActions([ - BulkActionGroup::make([ - DeleteBulkAction::make(), - ]), - ]); - } - - public static function getNavigationItems(array $urlParameters = []): array - { - $item = parent::getNavigationItems($urlParameters)[0]; - - $ownerRecord = $urlParameters['record']; - - /** @var Prospect $ownerRecord */ - $formSubmissionsCount = Cache::tags('form-submission-count') - ->remember( - "form-submission-count-{$ownerRecord->getKey()}", - now()->addMinutes(5), - function () use ($ownerRecord): int { - return $ownerRecord->formSubmissions()->count(); - }, - ); - - $item->badge($formSubmissionsCount > 0 ? $formSubmissionsCount : null); - - return [$item]; - } -} diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php index faad782516..7a5f96d606 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php @@ -114,9 +114,15 @@ public function sisRefresh() ->send(); } - public function getNameWords(): string + public function getAbbreviatedName(): string { - return collect(Str::of($this->record?->full_name)->explode(' ')) + $name = $this->record?->full_name; + + if (empty($name)) { + $name = $this->record?->first . ' ' . $this->record?->last; + } + + return collect(Str::of($name)->explode(' ')) ->map(function ($word) { return Str::substr($word, 0, 1); })->implode(''); diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php similarity index 95% rename from app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php rename to app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php index 8cb7dd700e..a52fd19a94 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentAlerts.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php @@ -34,7 +34,7 @@ */ -namespace AdvisingApp\StudentDataModel\Livewire; +namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; use Filament\Forms\Form; use Filament\Tables\Table; @@ -54,12 +54,9 @@ use Filament\Tables\Actions\BulkActionGroup; use Filament\Tables\Actions\DeleteBulkAction; use Filament\Resources\RelationManagers\RelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -class ManageStudentAlerts extends RelationManager +class StudentAlertsRelationManager extends RelationManager { - protected static string $resource = StudentResource::class; - protected static string $relationship = 'alerts'; public function infolist(Infolist $infolist): Infolist diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEventsRelationManager.php similarity index 93% rename from app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php rename to app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEventsRelationManager.php index 904920a2f6..52d8b687e2 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEvents.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEventsRelationManager.php @@ -34,7 +34,7 @@ */ -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; +namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; use App\Enums\Feature; use Filament\Tables\Table; @@ -47,11 +47,14 @@ use AdvisingApp\MeetingCenter\Enums\EventAttendeeStatus; use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\MeetingCenter\Filament\Resources\EventResource; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\MeetingCenter\Filament\Actions\InviteEventAttendeeAction; use AdvisingApp\MeetingCenter\Filament\Actions\Table\ViewEventAttendeeAction; -class ManageStudentEvents extends RelationManager +class StudentEventsRelationManager extends RelationManager { + protected static string $resource = StudentResource::class; + protected static string $relationship = 'eventAttendeeRecords'; protected static ?string $title = 'Events'; diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFilesRelationManager.php similarity index 95% rename from app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php rename to app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFilesRelationManager.php index e38331fa0d..bb2f7d67e9 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentFiles.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFilesRelationManager.php @@ -34,12 +34,12 @@ */ -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; +namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -class ManageStudentFiles extends RelationManager +class StudentFilesRelationManager extends RelationManager { protected static string $resource = StudentResource::class; diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php index 8a0e0be419..a338c765d2 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentFormSubmissionsRelationManager.php @@ -104,16 +104,4 @@ public function table(Table $table): Table ]), ]); } - - public function getTableRecordKey(Model $record): string - { - return base64_encode(json_encode($record->attributesToArray())); - } - - protected function resolveTableRecord(?string $key): ?Model - { - return $this->getTable()->getQuery() - ->where(json_decode(base64_decode($key), associative: true)) - ->first(); - } } diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInteractions.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentInteractionsRelationManager.php similarity index 96% rename from app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInteractions.php rename to app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentInteractionsRelationManager.php index 703b9cc795..a40d399ebd 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInteractions.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentInteractionsRelationManager.php @@ -34,7 +34,7 @@ */ -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; +namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; use Filament\Forms\Form; use Filament\Resources\RelationManagers\RelationManager; @@ -42,7 +42,7 @@ use AdvisingApp\Interaction\Filament\Concerns\HasManyMorphedInteractionsTrait; use AdvisingApp\Interaction\Filament\Resources\InteractionResource\Pages\CreateInteraction; -class ManageStudentInteractions extends RelationManager +class StudentInteractionsRelationManager extends RelationManager { use HasManyMorphedInteractionsTrait; diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php index 1aba01ce7f..f9772f14c9 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php @@ -39,10 +39,10 @@ use Illuminate\Database\Eloquent\Model; use Filament\Resources\Pages\ManageRelatedRecords; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentFiles; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentInteractions; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFilesRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentInteractionsRelationManager; class ManageStudentInformation extends ManageRelatedRecords { @@ -79,8 +79,8 @@ private static function managers(?Model $record = null): array ProgramsRelationManager::class, EnrollmentsRelationManager::class, ManageStudentEngagement::class, - ManageStudentInteractions::class, - ManageStudentFiles::class, + StudentInteractionsRelationManager::class, + StudentFilesRelationManager::class, ]) ->reject(fn ($relationManager) => $record && (! $relationManager::canViewForRecord($record, static::class))) ->toArray(); diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php b/app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php similarity index 94% rename from app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php rename to app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php index 0849315ef2..5717cdee4a 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentFormSubmissions.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php @@ -41,16 +41,16 @@ use Illuminate\Database\Eloquent\Model; use Filament\Resources\Pages\ManageRelatedRecords; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentEvents; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; -class ManageStudentFormSubmissions extends ManageRelatedRecords +class ManageStudentPremiumFeatures extends ManageRelatedRecords { protected static string $resource = StudentResource::class; protected static string $relationship = 'formSubmissions'; - protected static string $view = 'student-data-model::livewire.manage-student-form-submissions'; + protected static string $view = 'student-data-model::livewire.manage-student-premium-features'; public function mount(int | string $record): void { @@ -77,7 +77,7 @@ private static function managers(?Model $record = null): array { return collect([ StudentFormSubmissionsRelationManager::class, - ManageStudentEvents::class, + StudentEventsRelationManager::class, ManageStudentApplicationSubmissions::class, ]) ->reject(fn ($relationManager) => $record && (! $relationManager::canViewForRecord($record, static::class))) diff --git a/app-modules/student-data-model/src/Models/Student.php b/app-modules/student-data-model/src/Models/Student.php index 9696f36cbc..ae7b1e91ec 100644 --- a/app-modules/student-data-model/src/Models/Student.php +++ b/app-modules/student-data-model/src/Models/Student.php @@ -148,6 +148,8 @@ class Student extends BaseAuthenticatable implements Auditable, Subscribable, Ed protected $casts = [ 'sisid' => 'string', 'updated_at_source' => 'datetime', + 'birthdate' => 'date', + 'dfw' => 'date', ]; public function identifier(): string @@ -365,4 +367,18 @@ protected function displayName(): Attribute get: fn (?string $value, array $attributes) => $attributes[$this->displayNameKey()], ); } + + protected function fullAddress(): Attribute + { + return Attribute::make( + get: fn (mixed $value, array $attributes) => trim(implode(' ', array_filter([ + $attributes['address'] ?? '', + $attributes['address2'] ?? '', + $attributes['address3'] ?? '', + $attributes['city'] ? $attributes['city'] . ',' : '', + $attributes['state'] ? $attributes['state'] . ',' : '', + $attributes['postal'] ?? '', + ]))), + ); + } } diff --git a/app-modules/student-data-model/src/Providers/StudentDataModelServiceProvider.php b/app-modules/student-data-model/src/Providers/StudentDataModelServiceProvider.php index 2c2aee2bad..e54b05ece2 100644 --- a/app-modules/student-data-model/src/Providers/StudentDataModelServiceProvider.php +++ b/app-modules/student-data-model/src/Providers/StudentDataModelServiceProvider.php @@ -37,6 +37,7 @@ namespace AdvisingApp\StudentDataModel\Providers; use Filament\Panel; +use Livewire\Livewire; use App\Concerns\ImplementsGraphQL; use Illuminate\Support\ServiceProvider; use AdvisingApp\StudentDataModel\Models\Program; @@ -46,6 +47,7 @@ use AdvisingApp\Authorization\AuthorizationRoleRegistry; use AdvisingApp\StudentDataModel\StudentDataModelPlugin; use AdvisingApp\StudentDataModel\Registries\StudentDataModelRbacRegistry; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentAlertsRelationManager; class StudentDataModelServiceProvider extends ServiceProvider { @@ -67,5 +69,6 @@ public function boot(): void AuthorizationRoleRegistry::register(StudentDataModelRbacRegistry::class); $this->discoverSchema(__DIR__ . '/../../graphql/*'); + Livewire::component('manage-student-alerts', StudentAlertsRelationManager::class); } } From 8841ec523e61604946c0824dd091c5593fddaad1 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Fri, 25 Oct 2024 09:16:40 +0000 Subject: [PATCH 18/55] refactor classes and other changes --- .../AlertResource/Pages/ListAlerts.php | 6 +- .../student-resource/view-student.blade.php | 8 +- .../Filament/Resources/StudentResource.php | 2 +- .../ManageStudentApplicationSubmissions.php | 155 ------------------ .../Pages/ManageStudentCareTeam.php | 152 ----------------- .../Pages/ManageStudentEngagement.php | 51 ------ .../Pages/ManageStudentSubscriptions.php | 147 ----------------- .../Pages/ManageStudentTasks.php | 55 ------- ...ApplicationSubmissionsRelationManager.php} | 7 +- .../StudentCareTeamRelationManager.php} | 7 +- .../StudentEngagementRelationManager.php} | 6 +- .../StudentInteractionsRelationManager.php | 8 - .../StudentSubscriptionsRelationManager.php} | 7 +- .../StudentTasksRelationManager.php} | 8 +- .../src/Livewire/ManageStudentInformation.php | 3 +- .../Livewire/ManageStudentPremiumFeatures.php | 3 +- .../StudentDataModelServiceProvider.php | 9 +- .../student-data-model/tests/StudentTest.php | 18 -- 18 files changed, 31 insertions(+), 621 deletions(-) delete mode 100644 app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentApplicationSubmissions.php delete mode 100644 app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentCareTeam.php delete mode 100644 app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEngagement.php delete mode 100644 app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentSubscriptions.php delete mode 100644 app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentTasks.php rename app-modules/student-data-model/src/{Livewire/ManageStudentApplicationSubmissions.php => Filament/Resources/StudentResource/RelationManagers/StudentApplicationSubmissionsRelationManager.php} (95%) rename app-modules/student-data-model/src/{Livewire/ManageStudentCareTeam.php => Filament/Resources/StudentResource/RelationManagers/StudentCareTeamRelationManager.php} (96%) rename app-modules/student-data-model/src/{Livewire/ManageStudentEngagement.php => Filament/Resources/StudentResource/RelationManagers/StudentEngagementRelationManager.php} (98%) rename app-modules/student-data-model/src/{Livewire/ManageStudentSubscriptions.php => Filament/Resources/StudentResource/RelationManagers/StudentSubscriptionsRelationManager.php} (95%) rename app-modules/student-data-model/src/{Livewire/ManageStudentTasks.php => Filament/Resources/StudentResource/RelationManagers/StudentTasksRelationManager.php} (97%) 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 7cb6c02113..683461febd 100644 --- a/app-modules/alert/src/Filament/Resources/AlertResource/Pages/ListAlerts.php +++ b/app-modules/alert/src/Filament/Resources/AlertResource/Pages/ListAlerts.php @@ -63,8 +63,8 @@ use AdvisingApp\Alert\Filament\Resources\AlertResource; use AdvisingApp\Segment\Actions\TranslateSegmentFilters; use AdvisingApp\StudentDataModel\Models\Scopes\EducatableSearch; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\Prospect\Filament\Resources\ProspectResource\Pages\ManageProspectAlerts; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentAlerts; class ListAlerts extends ListRecords { @@ -79,7 +79,7 @@ public function infolist(Infolist $infolist): Infolist ->label('Related To') ->getStateUsing(fn (Alert $record): ?string => $record->concern?->{$record->concern::displayNameKey()}) ->url(fn (Alert $record) => match ($record->concern ? $record->concern::class : null) { - Student::class => ManageStudentAlerts::getUrl(['record' => $record->concern]), + Student::class => StudentResource::getUrl('view', ['record' => $record->concern]), Prospect::class => ManageProspectAlerts::getUrl(['record' => $record->concern]), default => null, }), @@ -99,7 +99,7 @@ public function table(Table $table): Table ->label('Related To') ->getStateUsing(fn (Alert $record): ?string => $record->concern?->{$record->concern::displayNameKey()}) ->url(fn (Alert $record) => match ($record->concern ? $record->concern::class : null) { - Student::class => ManageStudentAlerts::getUrl(['record' => $record->concern]), + Student::class => StudentResource::getUrl('view', ['record' => $record->concern]), Prospect::class => ManageProspectAlerts::getUrl(['record' => $record->concern]), default => null, }) diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index 374068f59c..9d65178e0f 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -49,20 +49,20 @@
- - - - diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php index cdf7990cc4..1e07a4f71a 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php @@ -122,7 +122,7 @@ public static function getPages(): array { return [ 'index' => ListStudents::route('/'), - 'manage-alerts' => ManageStudentAlerts::route('/{record}/alerts'), + // 'manage-alerts' => ManageStudentAlerts::route('/{record}/alerts'), // 'manage-engagement' => ManageStudentEngagement::route('/{record}/engagement'), // 'manage-files' => ManageStudentFiles::route('/{record}/files'), // 'manage-form-submissions' => ManageStudentFormSubmissions::route('/{record}/form-submissions'), diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentApplicationSubmissions.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentApplicationSubmissions.php deleted file mode 100644 index c64975cdab..0000000000 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentApplicationSubmissions.php +++ /dev/null @@ -1,155 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; - -use App\Enums\Feature; -use Filament\Tables\Table; -use Illuminate\Support\Facades\Gate; -use Illuminate\Support\Facades\Cache; -use Filament\Tables\Actions\ViewAction; -use Filament\Tables\Columns\TextColumn; -use App\Filament\Tables\Columns\IdColumn; -use Filament\Tables\Actions\DeleteAction; -use Illuminate\Database\Eloquent\Builder; -use Filament\Infolists\Components\Section; -use Filament\Infolists\Components\TextEntry; -use Filament\Tables\Actions\BulkActionGroup; -use Filament\Tables\Actions\DeleteBulkAction; -use AdvisingApp\StudentDataModel\Models\Student; -use Filament\Resources\Pages\ManageRelatedRecords; -use AdvisingApp\Application\Models\ApplicationSubmission; -use AdvisingApp\Application\Filament\Resources\ApplicationResource; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; - -class ManageStudentApplicationSubmissions extends ManageRelatedRecords -{ - protected static string $resource = StudentResource::class; - - protected static string $relationship = 'applicationSubmissions'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Application Submissions'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $breadcrumb = 'Application Submissions'; - - protected static ?string $navigationIcon = 'heroicon-o-academic-cap'; - - public static function canAccess(array $parameters = []): bool - { - return parent::canAccess($parameters) && Gate::check(Feature::OnlineAdmissions->getGateName()); - } - - public function table(Table $table): Table - { - return $table - ->columns([ - IdColumn::make(), - TextColumn::make('submissible.name') - ->searchable() - ->url(fn (ApplicationSubmission $record): string => ApplicationResource::getUrl('edit', ['record' => $record->submissible])), - TextColumn::make('state') - ->badge() - ->state(function (ApplicationSubmission $record) { - return $record->state->name; - }) - ->color(function (ApplicationSubmission $record) { - return $record->state->color->value; - }) - ->sortable(query: function (Builder $query, string $direction): Builder { - return $query - ->join('application_submission_states', 'application_submissions.status_id', '=', 'application_submission_states.id') - ->orderBy('application_submission_states.name', $direction); - }), - TextColumn::make('created_at') - ->sortable(), - ]) - ->actions([ - ViewAction::make() - ->modalHeading(fn (ApplicationSubmission $record) => "Submission Details: {$record->created_at}") - ->infolist(fn (ApplicationSubmission $record): array => [ - TextEntry::make('state') - ->label('State') - ->badge() - ->state(function (ApplicationSubmission $record) { - return $record->state->name; - }) - ->color(function (ApplicationSubmission $record) { - return $record->state->color->value; - }), - Section::make('Authenticated author') - ->schema([ - TextEntry::make('author.' . $record->author::displayNameKey()) - ->label('Name'), - TextEntry::make('author.email') - ->label('Email address'), - ]) - ->columns(2), - ]) - ->modalContent( - fn (ApplicationSubmission $record) => view('application::submission', ['submission' => $record]) - ), - DeleteAction::make(), - ]) - ->bulkActions([ - BulkActionGroup::make([ - DeleteBulkAction::make(), - ]), - ]); - } - - public static function getNavigationItems(array $urlParameters = []): array - { - $item = parent::getNavigationItems($urlParameters)[0]; - - $ownerRecord = $urlParameters['record']; - - /** @var Student $ownerRecord */ - $applicationSubmissionsCount = Cache::tags('application-submission-count') - ->remember( - "application-submission-count-{$ownerRecord->getKey()}", - now()->addMinutes(5), - function () use ($ownerRecord): int { - return $ownerRecord->applicationSubmissions()->count(); - }, - ); - - $item->badge($applicationSubmissionsCount > 0 ? $applicationSubmissionsCount : null); - - return [$item]; - } -} diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentCareTeam.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentCareTeam.php deleted file mode 100644 index 589a7fe4d5..0000000000 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentCareTeam.php +++ /dev/null @@ -1,152 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; - -use App\Models\User; -use Filament\Tables\Table; -use App\Models\Scopes\HasLicense; -use Filament\Forms\Components\Select; -use Filament\Tables\Columns\TextColumn; -use App\Filament\Resources\UserResource; -use App\Filament\Tables\Columns\IdColumn; -use Filament\Tables\Actions\AttachAction; -use Filament\Tables\Actions\DetachAction; -use Illuminate\Database\Eloquent\Builder; -use Filament\Tables\Actions\BulkActionGroup; -use Filament\Tables\Actions\DetachBulkAction; -use AdvisingApp\StudentDataModel\Models\Student; -use Filament\Resources\Pages\ManageRelatedRecords; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; - -class ManageStudentCareTeam extends ManageRelatedRecords -{ - protected static string $resource = StudentResource::class; - - protected static string $relationship = 'careTeam'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Care Team'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $breadcrumb = 'Care Team'; - - protected static ?string $navigationIcon = 'heroicon-o-user-group'; - - //TODO: manually override check canAccess for policy - - public function table(Table $table): Table - { - return $table - ->recordTitleAttribute('name') - ->columns([ - IdColumn::make(), - TextColumn::make('name') - ->url(fn ($record) => UserResource::getUrl('view', ['record' => $record])) - ->color('primary'), - TextColumn::make('job_title'), - ]) - ->headerActions([ - AttachAction::make() - ->label('Add to Care Team') - ->modalHeading(function () { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return "Add a User to {$student->display_name}'s Care Team"; - }) - ->modalSubmitActionLabel('Add') - ->attachAnother(false) - ->color('primary') - ->recordSelect( - fn (Select $select) => $select->placeholder('Select Users'), - ) - ->multiple() - ->recordSelectOptionsQuery( - fn (Builder $query) => $query->tap(new HasLicense(Student::getLicenseType())), - ) - ->successNotificationTitle(function (array $data) { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - if (count($data['recordId']) > 1) { - return count($data['recordId']) . " users were added to {$student->display_name}'s Care Team"; - } - $record = User::find($data['recordId'][0]); - - return "{$record->name} was added to {$student->display_name}'s Care Team"; - }), - ]) - ->actions([ - DetachAction::make() - ->label('Remove') - ->modalHeading(function (User $record) { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return "Remove {$record->name} from {$student->display_name}'s Care Team"; - }) - ->modalSubmitActionLabel('Remove') - ->successNotificationTitle(function (User $record) { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return "{$record->name} was removed from {$student->display_name}'s Care Team"; - }), - ]) - ->bulkActions([ - BulkActionGroup::make([ - DetachBulkAction::make() - ->label('Remove selected') - ->modalHeading(function () { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return "Remove selected users from {$student->display_name}'s Care Team"; - }) - ->modalSubmitActionLabel('Remove') - ->successNotificationTitle(function () { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return "All selected users were removed from {$student->display_name}'s Care Team"; - }), - ]), - ]) - ->emptyStateHeading('No Users') - ->inverseRelationship('studentCareTeams'); - } -} diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEngagement.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEngagement.php deleted file mode 100644 index 0760db201b..0000000000 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentEngagement.php +++ /dev/null @@ -1,51 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; - -use Illuminate\Contracts\Support\Htmlable; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -use AdvisingApp\Engagement\Filament\ManageRelatedRecords\ManageRelatedEngagementRecords; - -class ManageStudentEngagement extends ManageRelatedEngagementRecords -{ - protected static string $resource = StudentResource::class; - - public function getTitle(): string | Htmlable - { - return 'Manage Student Email and Texts'; - } -} diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentSubscriptions.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentSubscriptions.php deleted file mode 100644 index cce3882ec2..0000000000 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentSubscriptions.php +++ /dev/null @@ -1,147 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; - -use App\Models\User; -use Filament\Tables\Table; -use App\Models\Scopes\HasLicense; -use Filament\Forms\Components\Select; -use Filament\Tables\Columns\TextColumn; -use App\Filament\Resources\UserResource; -use App\Filament\Tables\Columns\IdColumn; -use Filament\Tables\Actions\AttachAction; -use Filament\Tables\Actions\DetachAction; -use Illuminate\Database\Eloquent\Builder; -use Filament\Tables\Actions\BulkActionGroup; -use Filament\Tables\Actions\DetachBulkAction; -use AdvisingApp\StudentDataModel\Models\Student; -use Filament\Resources\Pages\ManageRelatedRecords; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; - -class ManageStudentSubscriptions extends ManageRelatedRecords -{ - protected static string $resource = StudentResource::class; - - protected static string $relationship = 'subscribedUsers'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Subscriptions'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $breadcrumb = 'Subscriptions'; - - protected static ?string $navigationIcon = 'heroicon-o-user'; - - //TODO: manually override check canAccess for policy - - public function table(Table $table): Table - { - return $table - ->recordTitleAttribute('name') - ->columns([ - IdColumn::make(), - TextColumn::make('name') - ->url(fn ($record) => UserResource::getUrl('view', ['record' => $record])) - ->color('primary'), - TextColumn::make('pivot.created_at') - ->label('Subscribed At'), - ]) - ->headerActions([ - AttachAction::make() - ->label('Create Subscription') - ->modalHeading(function () { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return 'Subscribe a User to ' . $student->display_name; - }) - ->modalSubmitActionLabel('Subscribe') - ->attachAnother(false) - ->color('primary') - ->recordSelect( - fn (Select $select) => $select->placeholder('Select a User'), - ) - ->recordSelectOptionsQuery( - fn (Builder $query) => $query->tap(new HasLicense(Student::getLicenseType())), - ) - ->successNotificationTitle(function (User $record) { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return "{$record->name} was subscribed to {$student->display_name}"; - }), - ]) - ->actions([ - DetachAction::make() - ->label('Unsubscribe') - ->modalHeading(function (User $record) { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return "Unsubscribe {$record->name} from {$student->display_name}"; - }) - ->modalSubmitActionLabel('Unsubscribe') - ->successNotificationTitle(function (User $record) { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return "{$record->name} was unsubscribed from {$student->display_name}"; - }), - ]) - ->bulkActions([ - BulkActionGroup::make([ - DetachBulkAction::make() - ->label('Unsubscribe selected') - ->modalHeading(function () { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return "Unsubscribe selected from {$student->display_name}"; - }) - ->modalSubmitActionLabel('Unsubscribe') - ->successNotificationTitle(function () { - /** @var Student $student */ - $student = $this->getOwnerRecord(); - - return "All selected were unsubscribed from {$student->display_name}"; - }), - ]), - ]) - ->emptyStateHeading('No Subscriptions') - ->inverseRelationship('studentSubscriptions'); - } -} diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentTasks.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentTasks.php deleted file mode 100644 index ceb86c0ec6..0000000000 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentTasks.php +++ /dev/null @@ -1,55 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; - -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -use AdvisingApp\Task\Filament\RelationManagers\BaseTaskRelationManager; - -class ManageStudentTasks extends BaseTaskRelationManager -{ - protected static string $resource = StudentResource::class; - - protected static string $relationship = 'tasks'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Tasks'; - - // TODO: Automatically set from Filament based on relationship name - public static ?string $breadcrumb = 'Tasks'; - - protected static ?string $navigationIcon = 'heroicon-o-clipboard-document-check'; -} diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentApplicationSubmissionsRelationManager.php similarity index 95% rename from app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php rename to app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentApplicationSubmissionsRelationManager.php index 9ab50d524e..a8dfb0f936 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentApplicationSubmissions.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentApplicationSubmissionsRelationManager.php @@ -34,7 +34,7 @@ */ -namespace AdvisingApp\StudentDataModel\Livewire; +namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; use App\Enums\Feature; use Filament\Tables\Table; @@ -52,12 +52,9 @@ use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\Application\Models\ApplicationSubmission; use AdvisingApp\Application\Filament\Resources\ApplicationResource; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -class ManageStudentApplicationSubmissions extends RelationManager +class StudentApplicationSubmissionsRelationManager extends RelationManager { - protected static string $resource = StudentResource::class; - protected static string $relationship = 'applicationSubmissions'; protected static ?string $title = 'Applications'; diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentCareTeamRelationManager.php similarity index 96% rename from app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php rename to app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentCareTeamRelationManager.php index e6e5918e69..2c5cab1049 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentCareTeam.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentCareTeamRelationManager.php @@ -34,7 +34,7 @@ */ -namespace AdvisingApp\StudentDataModel\Livewire; +namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; use App\Models\User; use Filament\Tables\Table; @@ -50,12 +50,9 @@ use Filament\Tables\Actions\DetachBulkAction; use AdvisingApp\StudentDataModel\Models\Student; use Filament\Resources\RelationManagers\RelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -class ManageStudentCareTeam extends RelationManager +class StudentCareTeamRelationManager extends RelationManager { - protected static string $resource = StudentResource::class; - protected static string $relationship = 'careTeam'; public function table(Table $table): Table diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEngagementRelationManager.php similarity index 98% rename from app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php rename to app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEngagementRelationManager.php index d0e1d5532f..32ced625a8 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentEngagement.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEngagementRelationManager.php @@ -34,7 +34,7 @@ */ -namespace AdvisingApp\StudentDataModel\Livewire; +namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; use Filament\Forms\Get; use Filament\Forms\Set; @@ -42,7 +42,6 @@ use Filament\Tables\Table; use Filament\Infolists\Infolist; use Illuminate\Support\HtmlString; -use Illuminate\Support\Facades\Log; use Filament\Forms\Components\Select; use Filament\Forms\Components\Toggle; use Filament\Forms\Components\Actions; @@ -75,7 +74,7 @@ use AdvisingApp\Engagement\Filament\Resources\EngagementResource\Fields\EngagementSmsBodyField; use AdvisingApp\Engagement\Filament\ManageRelatedRecords\ManageRelatedEngagementRecords\Actions\DraftWithAiAction; -class ManageStudentEngagement extends RelationManager +class StudentEngagementRelationManager extends RelationManager { protected static string $relationship = 'timeline'; @@ -278,7 +277,6 @@ public function table(Table $table): Table }) ->createAnother(false) ->action(function (array $data, Form $form) { - Log::info('asdasd', [$this->getOwnerRecord()]); /** @var Student $record */ $record = $this->getOwnerRecord(); diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentInteractionsRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentInteractionsRelationManager.php index a40d399ebd..0013207de4 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentInteractionsRelationManager.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentInteractionsRelationManager.php @@ -50,14 +50,6 @@ class StudentInteractionsRelationManager extends RelationManager protected static string $relationship = 'interactions'; - // TODO: Automatically set from Filament based on relationship name - protected static ?string $breadcrumb = 'Interactions'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Interactions'; - - protected static ?string $navigationIcon = 'heroicon-o-arrow-path-rounded-square'; - public function form(Form $form): Form { return (resolve(CreateInteraction::class))->form($form); diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentSubscriptionsRelationManager.php similarity index 95% rename from app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php rename to app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentSubscriptionsRelationManager.php index 31adb27dbb..1d1f45315a 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentSubscriptions.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentSubscriptionsRelationManager.php @@ -34,7 +34,7 @@ */ -namespace AdvisingApp\StudentDataModel\Livewire; +namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; use App\Models\User; use Filament\Tables\Table; @@ -50,12 +50,9 @@ use Filament\Tables\Actions\DetachBulkAction; use AdvisingApp\StudentDataModel\Models\Student; use Filament\Resources\RelationManagers\RelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -class ManageStudentSubscriptions extends RelationManager +class StudentSubscriptionsRelationManager extends RelationManager { - protected static string $resource = StudentResource::class; - protected static string $relationship = 'subscribedUsers'; protected static ?string $title = 'Subscriptions'; diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentTasksRelationManager.php similarity index 97% rename from app-modules/student-data-model/src/Livewire/ManageStudentTasks.php rename to app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentTasksRelationManager.php index e8d30ba48a..a46879183e 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentTasks.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentTasksRelationManager.php @@ -34,7 +34,7 @@ */ -namespace AdvisingApp\StudentDataModel\Livewire; +namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers; use Filament\Forms\Form; use Filament\Tables\Table; @@ -64,10 +64,8 @@ use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\Task\Filament\Resources\TaskResource\Components\TaskViewAction; -class ManageStudentTasks extends RelationManager +class StudentTasksRelationManager extends RelationManager { - protected static string $resource = StudentResource::class; - protected static string $relationship = 'tasks'; public function form(Form $form): Form @@ -93,7 +91,7 @@ public function form(Form $form): Form fn (Builder $query) => $query->tap(new HasLicense($this->getOwnerRecord()->getLicenseType())), ) ->nullable() - // ->searchable(['name', 'email']) + ->searchable(['name', 'email']) ->default(auth()->id()), ]); } diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php index f9772f14c9..b7dca16c50 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php @@ -42,6 +42,7 @@ use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFilesRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEngagementRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentInteractionsRelationManager; class ManageStudentInformation extends ManageRelatedRecords @@ -78,7 +79,7 @@ private static function managers(?Model $record = null): array return collect([ ProgramsRelationManager::class, EnrollmentsRelationManager::class, - ManageStudentEngagement::class, + StudentEngagementRelationManager::class, StudentInteractionsRelationManager::class, StudentFilesRelationManager::class, ]) diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php b/app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php index 5717cdee4a..946db497ab 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php @@ -43,6 +43,7 @@ use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; class ManageStudentPremiumFeatures extends ManageRelatedRecords { @@ -78,7 +79,7 @@ private static function managers(?Model $record = null): array return collect([ StudentFormSubmissionsRelationManager::class, StudentEventsRelationManager::class, - ManageStudentApplicationSubmissions::class, + StudentApplicationSubmissionsRelationManager::class, ]) ->reject(fn ($relationManager) => $record && (! $relationManager::canViewForRecord($record, static::class))) ->toArray(); diff --git a/app-modules/student-data-model/src/Providers/StudentDataModelServiceProvider.php b/app-modules/student-data-model/src/Providers/StudentDataModelServiceProvider.php index e54b05ece2..ca46e72b41 100644 --- a/app-modules/student-data-model/src/Providers/StudentDataModelServiceProvider.php +++ b/app-modules/student-data-model/src/Providers/StudentDataModelServiceProvider.php @@ -47,7 +47,10 @@ use AdvisingApp\Authorization\AuthorizationRoleRegistry; use AdvisingApp\StudentDataModel\StudentDataModelPlugin; use AdvisingApp\StudentDataModel\Registries\StudentDataModelRbacRegistry; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentTasksRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentAlertsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentCareTeamRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentSubscriptionsRelationManager; class StudentDataModelServiceProvider extends ServiceProvider { @@ -69,6 +72,10 @@ public function boot(): void AuthorizationRoleRegistry::register(StudentDataModelRbacRegistry::class); $this->discoverSchema(__DIR__ . '/../../graphql/*'); - Livewire::component('manage-student-alerts', StudentAlertsRelationManager::class); + + Livewire::component('student-alert-relation-manager', StudentAlertsRelationManager::class); + Livewire::component('student-care-team-relation-manager', StudentCareTeamRelationManager::class); + Livewire::component('student-subscriptions-relation-manager', StudentSubscriptionsRelationManager::class); + Livewire::component('student-tasks-relation-manager', StudentTasksRelationManager::class); } } diff --git a/app-modules/student-data-model/tests/StudentTest.php b/app-modules/student-data-model/tests/StudentTest.php index ec3f0461e5..bf2961d9d6 100644 --- a/app-modules/student-data-model/tests/StudentTest.php +++ b/app-modules/student-data-model/tests/StudentTest.php @@ -42,27 +42,9 @@ use Filament\Tables\Actions\AttachAction; use AdvisingApp\StudentDataModel\Models\Student; use AdvisingApp\BasicNeeds\Models\BasicNeedsProgram; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentPrograms; use AdvisingApp\BasicNeeds\Filament\Resources\BasicNeedsProgramResource\RelationManagers\ProgramRelationManager; -it('can render manage basic needs program for student', function () { - $user = User::factory()->licensed(Student::getLicenseType())->create(); - - actingAs($user) - ->get(StudentResource::getUrl('programs', [ - 'record' => Student::factory()->create(), - ]))->assertForbidden(); - - $user->givePermissionTo('basic_needs_program.view-any'); - $user->givePermissionTo('student.view-any'); - - actingAs($user) - ->get(StudentResource::getUrl('programs', [ - 'record' => Student::factory()->create(), - ]))->assertSuccessful(); -})->skip(); - it('can attach a basic needs program to a student', function () { $user = User::factory()->licensed(Student::getLicenseType())->create(); $basicNeedsProgram = BasicNeedsProgram::factory()->create(); From 75d2f3896ca8f78c18964294b4c3e6241f916ace Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Fri, 25 Oct 2024 15:04:22 +0000 Subject: [PATCH 19/55] Fix test issue --- .../alert/src/Notifications/AlertCreatedNotification.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app-modules/alert/src/Notifications/AlertCreatedNotification.php b/app-modules/alert/src/Notifications/AlertCreatedNotification.php index b40c192412..715d693235 100644 --- a/app-modules/alert/src/Notifications/AlertCreatedNotification.php +++ b/app-modules/alert/src/Notifications/AlertCreatedNotification.php @@ -64,7 +64,12 @@ public function toDatabase(object $notifiable): array Student::class => StudentResource::class, }; - $alertUrl = $target::getUrl('students', ['record' => $concern]); + $targetRoute = match ($concern::class) { + Prospect::class => 'manage-alerts', + Student::class => 'view', + }; + + $alertUrl = $target::getUrl($targetRoute, ['record' => $concern]); $alertLink = new HtmlString("alert"); From f202f3a8ff71649f50a3e8012b8bd546bf8a6573 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Fri, 25 Oct 2024 17:05:39 +0000 Subject: [PATCH 20/55] change refence route --- .../AlertCreatedNotification.php | 11 ++------ ...plicationSubmissionCreatedNotification.php | 8 +++--- ...inkedFormSubmissionCreatedNotification.php | 8 +++--- .../student-resource/view-student.blade.php | 2 +- .../Filament/Resources/StudentResource.php | 28 ------------------- 5 files changed, 12 insertions(+), 45 deletions(-) diff --git a/app-modules/alert/src/Notifications/AlertCreatedNotification.php b/app-modules/alert/src/Notifications/AlertCreatedNotification.php index 715d693235..b328a0dc09 100644 --- a/app-modules/alert/src/Notifications/AlertCreatedNotification.php +++ b/app-modules/alert/src/Notifications/AlertCreatedNotification.php @@ -59,14 +59,9 @@ public function toDatabase(object $notifiable): array $name = $concern->{$concern->displayNameKey()}; - $target = match ($concern::class) { - Prospect::class => ProspectResource::class, - Student::class => StudentResource::class, - }; - - $targetRoute = match ($concern::class) { - Prospect::class => 'manage-alerts', - Student::class => 'view', + [$target, $targetRoute] = match ($concern::class) { + Prospect::class => [ProspectResource::class, 'manage-alerts'], + Student::class => [StudentResource::class, 'view'], }; $alertUrl = $target::getUrl($targetRoute, ['record' => $concern]); diff --git a/app-modules/application/src/Notifications/AuthorLinkedApplicationSubmissionCreatedNotification.php b/app-modules/application/src/Notifications/AuthorLinkedApplicationSubmissionCreatedNotification.php index 4e5fc72e0b..416f0c3f88 100644 --- a/app-modules/application/src/Notifications/AuthorLinkedApplicationSubmissionCreatedNotification.php +++ b/app-modules/application/src/Notifications/AuthorLinkedApplicationSubmissionCreatedNotification.php @@ -59,12 +59,12 @@ public function toDatabase(object $notifiable): array $name = $author->{$author->displayNameKey()}; - $target = match ($author::class) { - Prospect::class => ProspectResource::class, - Student::class => StudentResource::class, + [$target, $targetRoute] = match ($author::class) { + Prospect::class => [ProspectResource::class, 'manage-application-submissions'], + Student::class => [StudentResource::class, 'view'], }; - $applicationSubmissionUrl = $target::getUrl('manage-application-submissions', ['record' => $author]); + $applicationSubmissionUrl = $target::getUrl($targetRoute, ['record' => $author]); $applicationSubmissionLink = new HtmlString("application submission"); diff --git a/app-modules/form/src/Notifications/AuthorLinkedFormSubmissionCreatedNotification.php b/app-modules/form/src/Notifications/AuthorLinkedFormSubmissionCreatedNotification.php index 313fa21da5..540683fe81 100644 --- a/app-modules/form/src/Notifications/AuthorLinkedFormSubmissionCreatedNotification.php +++ b/app-modules/form/src/Notifications/AuthorLinkedFormSubmissionCreatedNotification.php @@ -59,12 +59,12 @@ public function toDatabase(object $notifiable): array $name = $author->{$author->displayNameKey()}; - $target = match ($author::class) { - Prospect::class => ProspectResource::class, - Student::class => StudentResource::class, + [$target, $targetRoute] = match ($author::class) { + Prospect::class => [ProspectResource::class, 'manage-form-submissions'], + Student::class => [StudentResource::class, 'view'], }; - $formSubmissionUrl = $target::getUrl('manage-form-submissions', ['record' => $author]); + $formSubmissionUrl = $target::getUrl($targetRoute, ['record' => $author]); $formSubmissionLink = new HtmlString("form submission"); diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index 9d65178e0f..734d46b969 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -54,7 +54,7 @@ :page-class="ViewStudent::class" /> - diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php index 1e07a4f71a..65125f2cf3 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php @@ -43,20 +43,6 @@ use App\Filament\Resources\Concerns\HasGlobalSearchResultScoring; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ListStudents; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentFiles; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentTasks; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentAlerts; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentEvents; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentCareTeam; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentPrograms; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentEngagement; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentInformation; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\StudentServiceManagement; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentInteractions; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\StudentEngagementTimeline; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentSubscriptions; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentFormSubmissions; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ManageStudentApplicationSubmissions; class StudentResource extends Resource { @@ -122,21 +108,7 @@ public static function getPages(): array { return [ 'index' => ListStudents::route('/'), - // 'manage-alerts' => ManageStudentAlerts::route('/{record}/alerts'), - // 'manage-engagement' => ManageStudentEngagement::route('/{record}/engagement'), - // 'manage-files' => ManageStudentFiles::route('/{record}/files'), - // 'manage-form-submissions' => ManageStudentFormSubmissions::route('/{record}/form-submissions'), - // 'manage-application-submissions' => ManageStudentApplicationSubmissions::route('/{record}/application-submissions'), - // 'manage-information' => ManageStudentInformation::route('/{record}/information'), - // 'manage-interactions' => ManageStudentInteractions::route('/{record}/interactions'), - // 'manage-subscriptions' => ManageStudentSubscriptions::route('/{record}/subscriptions'), - // 'manage-tasks' => ManageStudentTasks::route('/{record}/tasks'), 'view' => ViewStudent::route('/{record}'), - // 'timeline' => StudentEngagementTimeline::route('/{record}/timeline'), - // 'care-team' => ManageStudentCareTeam::route('/{record}/care-team'), - // 'service-management' => StudentServiceManagement::route('/{record}/service-management'), - // 'events' => ManageStudentEvents::route('/{record}/events'), - // 'programs' => ManageStudentPrograms::route('/{record}/programs'), ]; } } From 2440e53112ed30d907497826ae4b4f2aa587dd43 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Fri, 25 Oct 2024 17:17:33 +0000 Subject: [PATCH 21/55] remove copy --- app-modules/student-data-model/composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/app-modules/student-data-model/composer.json b/app-modules/student-data-model/composer.json index 844eb304b2..7832c1affa 100644 --- a/app-modules/student-data-model/composer.json +++ b/app-modules/student-data-model/composer.json @@ -20,7 +20,6 @@ "extra": { "laravel": { "providers": [ - "AdvisingApp\\StudentDataModel\\Providers\\StudentDataModelServiceProvider", "AdvisingApp\\StudentDataModel\\Providers\\StudentDataModelServiceProvider" ] } From f5a3640a683c9b95fbe6c61876bea574155182f1 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Mon, 28 Oct 2024 17:23:32 +0000 Subject: [PATCH 22/55] Fix the filament timeline modal Signed-off-by: Kevin Ullyott --- .../resources/views/components/timeline.blade.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app-modules/student-data-model/resources/views/components/timeline.blade.php b/app-modules/student-data-model/resources/views/components/timeline.blade.php index 50070b8708..bf71bf7255 100644 --- a/app-modules/student-data-model/resources/views/components/timeline.blade.php +++ b/app-modules/student-data-model/resources/views/components/timeline.blade.php @@ -183,4 +183,5 @@ class="mt-1 text-sm text-gray-900 dark:text-white">{{ $noMoreRecordsMessage }}
@endif +
From be6dd1c10afaf41d6d56f3cc7928472fd5aeb7a4 Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Tue, 29 Oct 2024 12:58:44 +0000 Subject: [PATCH 23/55] add parrent access and modal open issue --- .../resources/views/components/timeline.blade.php | 9 ++++----- .../StudentApplicationSubmissionsRelationManager.php | 2 +- .../RelationManagers/StudentEventsRelationManager.php | 2 +- .../StudentFormSubmissionsRelationManager.php | 2 +- app-modules/student-data-model/src/Models/Student.php | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app-modules/student-data-model/resources/views/components/timeline.blade.php b/app-modules/student-data-model/resources/views/components/timeline.blade.php index bf71bf7255..b59de05955 100644 --- a/app-modules/student-data-model/resources/views/components/timeline.blade.php +++ b/app-modules/student-data-model/resources/views/components/timeline.blade.php @@ -66,16 +66,16 @@ class="h-4 w-4 text-gray-800 dark:text-gray-100"
-
+

First Term

{{ $record?->f_e_term }}

diff --git a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php index e0f76654d2..39c735cffc 100644 --- a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php +++ b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php @@ -53,7 +53,7 @@ class StudentEngagementTimeline extends TimelinePage protected static string $view = 'student-data-model::livewire.student-engagement-timeline'; - public string $emptyStateMessage = 'There are no engagements to show for this student.'; + public string $emptyStateMessage = 'There are no activities to show for this student.'; public string $noMoreRecordsMessage = "You have reached the end of this student's engagement timeline."; From d32d6940bdcb642966c4d8af3a788d13129bef48 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Tue, 29 Oct 2024 15:34:52 +0000 Subject: [PATCH 25/55] Fix the address call Signed-off-by: Kevin Ullyott --- .../student-data-model/src/Models/Student.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app-modules/student-data-model/src/Models/Student.php b/app-modules/student-data-model/src/Models/Student.php index 89fdd017ac..2dbe6d568d 100644 --- a/app-modules/student-data-model/src/Models/Student.php +++ b/app-modules/student-data-model/src/Models/Student.php @@ -371,14 +371,17 @@ protected function displayName(): Attribute protected function fullAddress(): Attribute { return Attribute::make( - get: fn (mixed $value, array $attributes) => trim(implode(' ', array_filter([ - $attributes['address'] ?? '', - $attributes['address2'] ?? '', - $attributes['address3'] . ',' ?? '', - $attributes['city'] ? $attributes['city'] . ',' : '', - $attributes['state'] ? $attributes['state'] . ',' : '', - $attributes['postal'] ?? '', - ]))), + get: function (mixed $value, array $attributes) { + $addressLine = trim("{$attributes['address']} {$attributes['address2']} {$attributes['address3']}"); + + return trim(sprintf( + '%s %s %s %s', + ! empty($addressLine) ? $addressLine . ',' : '', + ! empty($attributes['city']) ? $attributes['city'] . ',' : '', + ! empty($attributes['state']) ? $attributes['state'] : '', + ! empty($attributes['postal']) ? $attributes['postal'] : '', + )); + } ); } } From 03acdfe481f9712ce2b8348b9a37cd4b2daf35aa Mon Sep 17 00:00:00 2001 From: amit-canyon Date: Tue, 29 Oct 2024 17:43:33 +0000 Subject: [PATCH 26/55] fix the table height --- .../student-resource/view-student.blade.php | 41 +++++++++++-------- .../StudentAlertsRelationManager.php | 5 +++ .../StudentCareTeamRelationManager.php | 5 +++ .../StudentSubscriptionsRelationManager.php | 5 +++ .../StudentTasksRelationManager.php | 5 +++ resources/css/filament/admin/theme.css | 10 +++++ 6 files changed, 54 insertions(+), 17 deletions(-) diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index 734d46b969..b5c6ac17e7 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -49,23 +49,30 @@
- - - - - +
+ +
+
+ +
+
+ +
+
+ +
diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php index a52fd19a94..8ae78ebcb9 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php @@ -137,4 +137,9 @@ public function table(Table $table): Table ]), ]); } + + protected function getTableScrollable(): bool + { + return true; + } } diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentCareTeamRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentCareTeamRelationManager.php index 2c5cab1049..b174f7654e 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentCareTeamRelationManager.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentCareTeamRelationManager.php @@ -136,4 +136,9 @@ public function table(Table $table): Table ->emptyStateHeading('No Users') ->inverseRelationship('studentCareTeams'); } + + protected function getTableScrollable(): bool + { + return true; + } } diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentSubscriptionsRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentSubscriptionsRelationManager.php index 1d1f45315a..0808a36ba0 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentSubscriptionsRelationManager.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentSubscriptionsRelationManager.php @@ -133,4 +133,9 @@ public function table(Table $table): Table ->emptyStateHeading('No Subscriptions') ->inverseRelationship('studentSubscriptions'); } + + protected function getTableScrollable(): bool + { + return true; + } } diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentTasksRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentTasksRelationManager.php index a46879183e..1e414dcdbc 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentTasksRelationManager.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentTasksRelationManager.php @@ -188,4 +188,9 @@ public function table(Table $table): Table ]), ]); } + + protected function getTableScrollable(): bool + { + return true; + } } diff --git a/resources/css/filament/admin/theme.css b/resources/css/filament/admin/theme.css index 2b04f8a8f9..8e373ce870 100644 --- a/resources/css/filament/admin/theme.css +++ b/resources/css/filament/admin/theme.css @@ -156,3 +156,13 @@ .dark_button_border { @apply dark:border dark:border-white dark:hover:border-white !important; } + +.view_student_relation_manager .fi-ta-ctn { + min-height: 500px; + overflow-y: auto; +} + +.view_student_relation_manager .fi-ta-ctn .fi-ta-content { + height: 300px; + overflow-y: auto; +} From ebad007bd7c808c75f802a9e55d7c2212b0a9140 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Tue, 29 Oct 2024 19:27:29 +0000 Subject: [PATCH 27/55] Update the font-weight of the student profile section Signed-off-by: Kevin Ullyott --- .../student-profile-section.blade.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php index 9ecd5433d0..88aa3f2de1 100644 --- a/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php +++ b/app-modules/student-data-model/resources/views/components/student-profile-section.blade.php @@ -34,50 +34,50 @@
-
+
Profile Information
-
+
-

Alternate Email

+

Alternate Email

{{ $record?->email_2 }}

-

Phone

+

Phone

{{ $record?->phone }}

-

Address

+

Address

{{ $record->full_address }}

-

Ethnicity

+

Ethnicity

{{ $record?->ethnicity }}

-

Birthdate

+

Birthdate

{{ $record?->birthdate?->format('F d, Y') }}

-

High School Graduation

+

High School Graduation

{{ $record?->hsgrad }}

-

First Term

+

First Term

{{ $record?->f_e_term }}

-

Recent Term

+

Recent Term

{{ $record?->mr_e_term }}

-

SIS Holds

+

SIS Holds

{{ $record?->holds }}

From 11d443ad422c817e8ea0f3f29242fe831fb34e2c Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Tue, 29 Oct 2024 21:52:10 +0000 Subject: [PATCH 28/55] Fix access and write tests Signed-off-by: Kevin Ullyott --- .../StudentEventsRelationManager.php | 2 +- .../src/Livewire/ManageStudentInformation.php | 2 +- .../Livewire/ManageStudentPremiumFeatures.php | 7 -- .../Livewire/StudentEngagementTimeline.php | 5 ++ .../tests/Student/ViewStudentTest.php | 65 +++++++++++++++++++ 5 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 app-modules/student-data-model/tests/Student/ViewStudentTest.php diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEventsRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEventsRelationManager.php index 2bf3ae0910..55971cf77b 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEventsRelationManager.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEventsRelationManager.php @@ -61,7 +61,7 @@ class StudentEventsRelationManager extends RelationManager public static function canViewForRecord(Model $ownerRecord, string $pageClass): bool { - return parent::canViewForRecord($ownerRecord, $pageClass) && Gate::check(Feature::OnlineForms->getGateName()); + return parent::canViewForRecord($ownerRecord, $pageClass) && Gate::check(Feature::EventManagement->getGateName()); } public function table(Table $table): Table diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php index b7dca16c50..685738bae7 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentInformation.php @@ -66,7 +66,7 @@ public function mount(int | string $record): void public static function canAccess(array $arguments = []): bool { - return (bool) count(static::managers($arguments['record'] ?? null)); + return auth()->user()->can('student.*.view'); } public function getRelationManagers(): array diff --git a/app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php b/app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php index 946db497ab..e98b7e8b1d 100644 --- a/app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php +++ b/app-modules/student-data-model/src/Livewire/ManageStudentPremiumFeatures.php @@ -36,8 +36,6 @@ namespace AdvisingApp\StudentDataModel\Livewire; -use App\Enums\Feature; -use Illuminate\Support\Facades\Gate; use Illuminate\Database\Eloquent\Model; use Filament\Resources\Pages\ManageRelatedRecords; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; @@ -64,11 +62,6 @@ public function mount(int | string $record): void $this->loadDefaultActiveTab(); } - public static function canAccess(array $parameters = []): bool - { - return parent::canAccess($parameters) && Gate::check(Feature::OnlineForms->getGateName()); - } - public function getRelationManagers(): array { return static::managers($this->getRecord()); diff --git a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php index 39c735cffc..f1785c2b0c 100644 --- a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php +++ b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php @@ -88,4 +88,9 @@ public function fetchTitle($morphReference, $key): ?string 'alert_history' => 'Alert ' . $record?->timeline()?->history?->event, }; } + + public static function canAccess(array $parameters = []): bool + { + return auth()->user()->can('student.*.view'); + } } diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php new file mode 100644 index 0000000000..0060b9a21f --- /dev/null +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -0,0 +1,65 @@ +licensed(Student::getLicenseType())->create(); + $student = Student::factory()->create(); + + actingAs($user); + + livewire(ViewStudent::class, [ + 'record' => $student->getKey(), + ]) + ->assertForbidden(); + + $user->givePermissionTo('student.view-any'); + $user->givePermissionTo('student.*.view'); + + $user->refresh(); + + actingAs($user); + + livewire(ViewStudent::class, [ + 'record' => $student->getKey(), + ]) + ->assertOk(); +}); + +it('renders the StudentFormSubmissionsRelationManager based on Feature access', function () { + $student = Student::factory()->create(); + + $licenseSettings = app(LicenseSettings::class); + + $licenseSettings->data->addons->onlineForms = false; + + $licenseSettings->save(); + + asSuperAdmin(); + + $relationManager = StudentFormSubmissionsRelationManager::class; + + livewire(ManageStudentPremiumFeatures::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentPremiumFeatures()) + ->tap(fn (ManageStudentPremiumFeatures $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); +}); From f6744c5c5bfc7433d2fb4f0b8d72974e65a5567f Mon Sep 17 00:00:00 2001 From: Orrison Date: Tue, 29 Oct 2024 21:52:58 +0000 Subject: [PATCH 29/55] chore: fix enforcement of copyright on all files --- .../tests/Student/ViewStudentTest.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 0060b9a21f..15f6b17db2 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -1,5 +1,39 @@ + + Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. + + Advising App™ is licensed under the Elastic License 2.0. For more details, + see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. + + 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 Advising 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 + https://www.canyongbs.com or contact us via email at legal@canyongbs.com. + + +*/ + use App\Models\User; use function Tests\asSuperAdmin; From 6b4d6b0f56b735c93e05af324c1598b10cda933f Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Tue, 29 Oct 2024 22:16:22 +0000 Subject: [PATCH 30/55] More access tests Signed-off-by: Kevin Ullyott --- .../tests/Student/ViewStudentTest.php | 74 +++++++++++++++++-- 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 15f6b17db2..0558bdde53 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -34,19 +34,21 @@ */ -use App\Models\User; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; -use function Tests\asSuperAdmin; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; -use App\Settings\LicenseSettings; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; +use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; +use AdvisingApp\StudentDataModel\Models\Student; + +use App\Models\User; +use App\Settings\LicenseSettings; use function Pest\Laravel\actingAs; use function Pest\Livewire\livewire; +use function Tests\asSuperAdmin; -use AdvisingApp\StudentDataModel\Models\Student; -use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; it('requires proper access', function () { $user = User::factory()->licensed(Student::getLicenseType())->create(); @@ -96,4 +98,62 @@ ]) ->assertOk() ->assertDontSeeLivewire($relationManager); + + $licenseSettings->data->addons->onlineForms = true; + + $licenseSettings->save(); + + livewire(ManageStudentPremiumFeatures::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentPremiumFeatures()) + ->tap(fn (ManageStudentPremiumFeatures $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +}); + +it('renders the StudentEventsRelationManager based on Feature access', function () { + $student = Student::factory()->create(); + + $licenseSettings = app(LicenseSettings::class); + + $licenseSettings->data->addons->eventManagement = false; + + $licenseSettings->save(); + + asSuperAdmin(); + + $relationManager = StudentEventsRelationManager::class; + + livewire(ManageStudentPremiumFeatures::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentPremiumFeatures()) + ->tap(fn (ManageStudentPremiumFeatures $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $licenseSettings->data->addons->eventManagement = true; + + $licenseSettings->save(); + + livewire(ManageStudentPremiumFeatures::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentPremiumFeatures()) + ->tap(fn (ManageStudentPremiumFeatures $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); }); From 57842ba3922172a89d1544cd1b24b76196b03327 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Tue, 29 Oct 2024 22:20:31 +0000 Subject: [PATCH 31/55] Test for last premium feature Signed-off-by: Kevin Ullyott --- .../tests/Student/ViewStudentTest.php | 60 ++++++++++++++++--- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 0558bdde53..23caa500a9 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -34,21 +34,21 @@ */ -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; - -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; - -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; +use App\Models\User; -use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; -use AdvisingApp\StudentDataModel\Models\Student; +use function Tests\asSuperAdmin; -use App\Models\User; use App\Settings\LicenseSettings; + use function Pest\Laravel\actingAs; use function Pest\Livewire\livewire; -use function Tests\asSuperAdmin; +use AdvisingApp\StudentDataModel\Models\Student; +use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; it('requires proper access', function () { $user = User::factory()->licensed(Student::getLicenseType())->create(); @@ -157,3 +157,45 @@ ->assertOk() ->assertSeeLivewire($relationManager); }); + +it('renders the StudentApplicationSubmissionsRelationManager based on Feature access', function () { + $student = Student::factory()->create(); + + $licenseSettings = app(LicenseSettings::class); + + $licenseSettings->data->addons->onlineAdmissions = false; + + $licenseSettings->save(); + + asSuperAdmin(); + + $relationManager = StudentApplicationSubmissionsRelationManager::class; + + livewire(ManageStudentPremiumFeatures::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentPremiumFeatures()) + ->tap(fn (ManageStudentPremiumFeatures $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $licenseSettings->data->addons->onlineAdmissions = true; + + $licenseSettings->save(); + + livewire(ManageStudentPremiumFeatures::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentPremiumFeatures()) + ->tap(fn (ManageStudentPremiumFeatures $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +}); From 48f3537d1d7790434400cf89c9cbba88fc78ac4c Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:05:58 +0000 Subject: [PATCH 32/55] make sure permissions are put in place to render the components properly Signed-off-by: Kevin Ullyott --- .../student-resource/view-student.blade.php | 33 +++++-------------- .../StudentResource/Pages/ViewStudent.php | 30 +++++++++++++++++ 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index b5c6ac17e7..7d065ba171 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -33,6 +33,7 @@ --}} @php use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; + use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentAlertsRelationManager; @endphp
-
-
- -
-
- -
-
- -
-
- -
+
+ @foreach ($this->getRelationManagers() as $relationManager) + @livewire($relationManager, [ + 'ownerRecord' => $record, + 'pageClass' => ViewStudent::class, + ]) + @endforeach
diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php index 7a5f96d606..66a7105ae0 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ViewStudent.php @@ -46,9 +46,15 @@ use Filament\Resources\Pages\ViewRecord; use Filament\Support\Facades\FilamentView; use AdvisingApp\StudentDataModel\Models\Student; +use Filament\Resources\RelationManagers\RelationGroup; use AdvisingApp\Notification\Filament\Actions\SubscribeHeaderAction; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; +use Filament\Resources\RelationManagers\RelationManagerConfiguration; use AdvisingApp\StudentDataModel\Settings\StudentInformationSystemSettings; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentTasksRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentAlertsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentCareTeamRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentSubscriptionsRelationManager; class ViewStudent extends ViewRecord { @@ -128,6 +134,30 @@ public function getAbbreviatedName(): string })->implode(''); } + /** + * @return array | RelationGroup | RelationManagerConfiguration> + */ + public function getRelationManagers(): array + { + $managers = [ + StudentAlertsRelationManager::class, + StudentTasksRelationManager::class, + StudentCareTeamRelationManager::class, + StudentSubscriptionsRelationManager::class, + ]; + + return array_filter( + $managers, + function (string | RelationGroup | RelationManagerConfiguration $manager): bool { + if ($manager instanceof RelationGroup) { + return (bool) count($manager->ownerRecord($this->getRecord())->pageClass(static::class)->getManagers()); + } + + return $this->normalizeRelationManagerClass($manager)::canViewForRecord($this->getRecord(), static::class); + }, + ); + } + protected function getHeaderActions(): array { return [ From 7cf8276da2babe55907b9f6e2f91994357089c1c Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:26:21 +0000 Subject: [PATCH 33/55] Delete the old ManageStudentInformation Signed-off-by: Kevin Ullyott --- .../Pages/ManageStudentInformation.php | 77 ------------------- 1 file changed, 77 deletions(-) delete mode 100644 app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInformation.php diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInformation.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInformation.php deleted file mode 100644 index 7b99e9f1a3..0000000000 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentInformation.php +++ /dev/null @@ -1,77 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; - -use Illuminate\Database\Eloquent\Model; -use Filament\Resources\Pages\ManageRelatedRecords; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; - -class ManageStudentInformation extends ManageRelatedRecords -{ - protected static string $resource = StudentResource::class; - - // TODO: Obsolete when there is no table, remove from Filament - protected static string $relationship = 'programs'; - - protected static ?string $navigationLabel = 'Information'; - - protected static ?string $breadcrumb = 'Information'; - - protected static ?string $navigationIcon = 'heroicon-o-information-circle'; - - public static function canAccess(array $arguments = []): bool - { - return (bool) count(static::managers($arguments['record'] ?? null)); - } - - public function getRelationManagers(): array - { - return static::managers($this->getRecord()); - } - - private static function managers(?Model $record = null): array - { - return collect([ - ProgramsRelationManager::class, - EnrollmentsRelationManager::class, - ]) - ->reject(fn ($relationManager) => $record && (! $relationManager::canViewForRecord($record, static::class))) - ->toArray(); - } -} From f09143906205815acd22ee8b1e7840eef8d95d6e Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:26:28 +0000 Subject: [PATCH 34/55] Test for ProgramsRelationManager Signed-off-by: Kevin Ullyott --- .../tests/Student/ViewStudentTest.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 23caa500a9..6290638bcd 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -44,8 +44,10 @@ use function Pest\Livewire\livewire; use AdvisingApp\StudentDataModel\Models\Student; +use AdvisingApp\StudentDataModel\Livewire\ManageStudentInformation; use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; @@ -74,6 +76,50 @@ ->assertOk(); }); +it('renders the ProgramsRelationManager based on Feature access', function () { + $user = User::factory()->licensed(Student::getLicenseType())->create(); + + $student = Student::factory()->create(); + + $user->givePermissionTo('student.view-any'); + $user->givePermissionTo('student.*.view'); + + $user->refresh(); + + actingAs($user); + + $relationManager = ProgramsRelationManager::class; + + livewire(ManageStudentInformation::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentInformation()) + ->tap(fn (ManageStudentInformation $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $user->givePermissionTo('program.view-any'); + $user->givePermissionTo('program.*.view'); + + $user->refresh(); + + livewire(ManageStudentInformation::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentInformation()) + ->tap(fn (ManageStudentInformation $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +}); + it('renders the StudentFormSubmissionsRelationManager based on Feature access', function () { $student = Student::factory()->create(); From 50e58d6bd2dfd6ada53ce97323191f30e9734dfa Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:27:37 +0000 Subject: [PATCH 35/55] Fix the test name Signed-off-by: Kevin Ullyott --- .../student-data-model/tests/Student/ViewStudentTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 6290638bcd..bb2913056a 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -76,7 +76,7 @@ ->assertOk(); }); -it('renders the ProgramsRelationManager based on Feature access', function () { +it('renders the ProgramsRelationManager based on proper access', function () { $user = User::factory()->licensed(Student::getLicenseType())->create(); $student = Student::factory()->create(); From 4604892ece5a2f13318964cc1cf8ed515847f743 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:30:08 +0000 Subject: [PATCH 36/55] Add a test for EnrollmentsRelationManager Signed-off-by: Kevin Ullyott --- .../tests/Student/ViewStudentTest.php | 68 ++++++++++++++++--- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index bb2913056a..a835e8f20a 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -34,23 +34,25 @@ */ -use App\Models\User; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; -use function Tests\asSuperAdmin; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; -use App\Settings\LicenseSettings; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; -use function Pest\Laravel\actingAs; -use function Pest\Livewire\livewire; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; -use AdvisingApp\StudentDataModel\Models\Student; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; use AdvisingApp\StudentDataModel\Livewire\ManageStudentInformation; use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; +use AdvisingApp\StudentDataModel\Models\Student; +use App\Models\User; +use App\Settings\LicenseSettings; +use function Pest\Laravel\actingAs; +use function Pest\Livewire\livewire; +use function Tests\asSuperAdmin; + it('requires proper access', function () { $user = User::factory()->licensed(Student::getLicenseType())->create(); @@ -120,6 +122,50 @@ ->assertSeeLivewire($relationManager); }); +it('renders the EnrollmentsRelationManager based on proper access', function () { + $user = User::factory()->licensed(Student::getLicenseType())->create(); + + $student = Student::factory()->create(); + + $user->givePermissionTo('student.view-any'); + $user->givePermissionTo('student.*.view'); + + $user->refresh(); + + actingAs($user); + + $relationManager = EnrollmentsRelationManager::class; + + livewire(ManageStudentInformation::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentInformation()) + ->tap(fn (ManageStudentInformation $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $user->givePermissionTo('enrollment.view-any'); + $user->givePermissionTo('enrollment.*.view'); + + $user->refresh(); + + livewire(ManageStudentInformation::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentInformation()) + ->tap(fn (ManageStudentInformation $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +}); + it('renders the StudentFormSubmissionsRelationManager based on Feature access', function () { $student = Student::factory()->create(); From 1d6243d561390466f07a9dc84cfd120e9c065a46 Mon Sep 17 00:00:00 2001 From: Orrison Date: Wed, 30 Oct 2024 17:32:04 +0000 Subject: [PATCH 37/55] chore: fix code style --- .../tests/Student/ViewStudentTest.php | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index a835e8f20a..0a0546bdf0 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -34,25 +34,24 @@ */ -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; - -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; - -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; +use App\Models\User; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; +use function Tests\asSuperAdmin; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; -use AdvisingApp\StudentDataModel\Livewire\ManageStudentInformation; -use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; -use AdvisingApp\StudentDataModel\Models\Student; -use App\Models\User; use App\Settings\LicenseSettings; + use function Pest\Laravel\actingAs; use function Pest\Livewire\livewire; -use function Tests\asSuperAdmin; +use AdvisingApp\StudentDataModel\Models\Student; +use AdvisingApp\StudentDataModel\Livewire\ManageStudentInformation; +use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; it('requires proper access', function () { $user = User::factory()->licensed(Student::getLicenseType())->create(); From b1f604693a30de8433bc7dc21d7211fd224c248b Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:40:20 +0000 Subject: [PATCH 38/55] Add test for StudentInteractionsRelationManager Signed-off-by: Kevin Ullyott --- .../tests/Student/ViewStudentTest.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 0a0546bdf0..838223b2c8 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -50,6 +50,7 @@ use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentInteractionsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; @@ -165,6 +166,49 @@ ->assertSeeLivewire($relationManager); }); +it('renders the StudentInteractionsRelationManager based on proper access', function () { + $user = User::factory()->licensed(Student::getLicenseType())->create(); + + $student = Student::factory()->create(); + + $user->givePermissionTo('student.view-any'); + $user->givePermissionTo('student.*.view'); + + $user->refresh(); + + actingAs($user); + + $relationManager = StudentInteractionsRelationManager::class; + + livewire(ManageStudentInformation::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentInformation()) + ->tap(fn (ManageStudentInformation $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $user->givePermissionTo('interaction.view-any'); + + $user->refresh(); + + livewire(ManageStudentInformation::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentInformation()) + ->tap(fn (ManageStudentInformation $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +}); + it('renders the StudentFormSubmissionsRelationManager based on Feature access', function () { $student = Student::factory()->create(); From e0b878168c39a99e4517682a873a89dbe1113db0 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:42:05 +0000 Subject: [PATCH 39/55] Add test for StudentFilesRelationManager Signed-off-by: Kevin Ullyott --- .../tests/Student/ViewStudentTest.php | 71 +++++++++++++++---- 1 file changed, 58 insertions(+), 13 deletions(-) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 838223b2c8..3dbad5b5c3 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -34,25 +34,27 @@ */ -use App\Models\User; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; -use function Tests\asSuperAdmin; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; -use App\Settings\LicenseSettings; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; -use function Pest\Laravel\actingAs; -use function Pest\Livewire\livewire; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; -use AdvisingApp\StudentDataModel\Models\Student; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFilesRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentInteractionsRelationManager; use AdvisingApp\StudentDataModel\Livewire\ManageStudentInformation; use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentInteractionsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; +use AdvisingApp\StudentDataModel\Models\Student; +use App\Models\User; +use App\Settings\LicenseSettings; +use function Pest\Laravel\actingAs; +use function Pest\Livewire\livewire; +use function Tests\asSuperAdmin; + it('requires proper access', function () { $user = User::factory()->licensed(Student::getLicenseType())->create(); @@ -209,6 +211,49 @@ ->assertSeeLivewire($relationManager); }); +it('renders the StudentFilesRelationManager based on proper access', function () { + $user = User::factory()->licensed(Student::getLicenseType())->create(); + + $student = Student::factory()->create(); + + $user->givePermissionTo('student.view-any'); + $user->givePermissionTo('student.*.view'); + + $user->refresh(); + + actingAs($user); + + $relationManager = StudentFilesRelationManager::class; + + livewire(ManageStudentInformation::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentInformation()) + ->tap(fn (ManageStudentInformation $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $user->givePermissionTo('engagement_file.view-any'); + + $user->refresh(); + + livewire(ManageStudentInformation::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentInformation()) + ->tap(fn (ManageStudentInformation $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +}); + it('renders the StudentFormSubmissionsRelationManager based on Feature access', function () { $student = Student::factory()->create(); From b617e02f265672c900771de4bba4b3a3e6c0bd59 Mon Sep 17 00:00:00 2001 From: Orrison Date: Wed, 30 Oct 2024 17:43:40 +0000 Subject: [PATCH 40/55] chore: fix code style --- .../tests/Student/ViewStudentTest.php | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 3dbad5b5c3..216ece5ace 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -34,27 +34,26 @@ */ -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; - -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; - -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; +use App\Models\User; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; +use function Tests\asSuperAdmin; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFilesRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentInteractionsRelationManager; -use AdvisingApp\StudentDataModel\Livewire\ManageStudentInformation; -use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; -use AdvisingApp\StudentDataModel\Models\Student; -use App\Models\User; use App\Settings\LicenseSettings; + use function Pest\Laravel\actingAs; use function Pest\Livewire\livewire; -use function Tests\asSuperAdmin; +use AdvisingApp\StudentDataModel\Models\Student; +use AdvisingApp\StudentDataModel\Livewire\ManageStudentInformation; +use AdvisingApp\StudentDataModel\Livewire\ManageStudentPremiumFeatures; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages\ViewStudent; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFilesRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentInteractionsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; it('requires proper access', function () { $user = User::factory()->licensed(Student::getLicenseType())->create(); From b3dfa1615d216f1df32c07858f3d2e77b6e96c7b Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:46:31 +0000 Subject: [PATCH 41/55] Add a test for and adjust permissions of StudentEngagementRelationManager Signed-off-by: Kevin Ullyott --- .../StudentEngagementRelationManager.php | 20 +++++++++ .../tests/Student/ViewStudentTest.php | 44 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEngagementRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEngagementRelationManager.php index 32ced625a8..90a41a3a10 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEngagementRelationManager.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentEngagementRelationManager.php @@ -41,6 +41,9 @@ use Filament\Forms\Form; use Filament\Tables\Table; use Filament\Infolists\Infolist; + +use function Filament\authorize; + use Illuminate\Support\HtmlString; use Filament\Forms\Components\Select; use Filament\Forms\Components\Toggle; @@ -50,6 +53,7 @@ use Filament\Forms\Components\Fieldset; use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\TextColumn; +use Illuminate\Database\Eloquent\Model; use Filament\Forms\Components\TextInput; use AdvisingApp\Prospect\Models\Prospect; use AdvisingApp\Timeline\Models\Timeline; @@ -64,6 +68,7 @@ use Filament\Forms\Components\DateTimePicker; use AdvisingApp\Engagement\Models\EmailTemplate; use AdvisingApp\StudentDataModel\Models\Student; +use Illuminate\Auth\Access\AuthorizationException; use AdvisingApp\Engagement\Models\EngagementResponse; use Filament\Resources\RelationManagers\RelationManager; use AdvisingApp\Engagement\Enums\EngagementDeliveryMethod; @@ -339,4 +344,19 @@ public function table(Table $table): Table ), ]); } + + public static function canViewForRecord(Model $ownerRecord, string $pageClass): bool + { + if (static::shouldSkipAuthorization()) { + return true; + } + + $model = Engagement::class; + + try { + return authorize('viewAny', $model, static::shouldCheckPolicyExistence())->allowed(); + } catch (AuthorizationException $exception) { + return $exception->toResponse()->allowed(); + } + } } diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 216ece5ace..974ad27c9a 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -51,6 +51,7 @@ use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFilesRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEngagementRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentInteractionsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; @@ -167,6 +168,49 @@ ->assertSeeLivewire($relationManager); }); +it('renders the StudentEngagementRelationManager based on proper access', function () { + $user = User::factory()->licensed(Student::getLicenseType())->create(); + + $student = Student::factory()->create(); + + $user->givePermissionTo('student.view-any'); + $user->givePermissionTo('student.*.view'); + + $user->refresh(); + + actingAs($user); + + $relationManager = StudentEngagementRelationManager::class; + + livewire(ManageStudentInformation::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentInformation()) + ->tap(fn (ManageStudentInformation $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $user->givePermissionTo('engagement.view-any'); + + $user->refresh(); + + livewire(ManageStudentInformation::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ManageStudentInformation()) + ->tap(fn (ManageStudentInformation $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +}); + it('renders the StudentInteractionsRelationManager based on proper access', function () { $user = User::factory()->licensed(Student::getLicenseType())->create(); From 15249a37f272d83e73a4b944f5b71b7cd2d9bacb Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:51:32 +0000 Subject: [PATCH 42/55] Remove unneeded permissions from tests Signed-off-by: Kevin Ullyott --- .../student-data-model/tests/Student/ViewStudentTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 974ad27c9a..f362a3a0cf 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -107,7 +107,6 @@ ->assertDontSeeLivewire($relationManager); $user->givePermissionTo('program.view-any'); - $user->givePermissionTo('program.*.view'); $user->refresh(); @@ -151,7 +150,6 @@ ->assertDontSeeLivewire($relationManager); $user->givePermissionTo('enrollment.view-any'); - $user->givePermissionTo('enrollment.*.view'); $user->refresh(); From e78216fb833bfd8b60e82d9ef0ebf2eacd85d487 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:55:25 +0000 Subject: [PATCH 43/55] Fix unneeded items in tests Signed-off-by: Kevin Ullyott --- .../tests/Student/ViewStudentTest.php | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index f362a3a0cf..7b1f84952b 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -70,10 +70,6 @@ $user->givePermissionTo('student.view-any'); $user->givePermissionTo('student.*.view'); - $user->refresh(); - - actingAs($user); - livewire(ViewStudent::class, [ 'record' => $student->getKey(), ]) @@ -88,8 +84,6 @@ $user->givePermissionTo('student.view-any'); $user->givePermissionTo('student.*.view'); - $user->refresh(); - actingAs($user); $relationManager = ProgramsRelationManager::class; @@ -108,8 +102,6 @@ $user->givePermissionTo('program.view-any'); - $user->refresh(); - livewire(ManageStudentInformation::class, [ 'record' => $student->getKey(), 'activeRelationManager' => array_search( @@ -131,8 +123,6 @@ $user->givePermissionTo('student.view-any'); $user->givePermissionTo('student.*.view'); - $user->refresh(); - actingAs($user); $relationManager = EnrollmentsRelationManager::class; @@ -151,8 +141,6 @@ $user->givePermissionTo('enrollment.view-any'); - $user->refresh(); - livewire(ManageStudentInformation::class, [ 'record' => $student->getKey(), 'activeRelationManager' => array_search( @@ -174,8 +162,6 @@ $user->givePermissionTo('student.view-any'); $user->givePermissionTo('student.*.view'); - $user->refresh(); - actingAs($user); $relationManager = StudentEngagementRelationManager::class; @@ -194,8 +180,6 @@ $user->givePermissionTo('engagement.view-any'); - $user->refresh(); - livewire(ManageStudentInformation::class, [ 'record' => $student->getKey(), 'activeRelationManager' => array_search( @@ -217,8 +201,6 @@ $user->givePermissionTo('student.view-any'); $user->givePermissionTo('student.*.view'); - $user->refresh(); - actingAs($user); $relationManager = StudentInteractionsRelationManager::class; @@ -237,8 +219,6 @@ $user->givePermissionTo('interaction.view-any'); - $user->refresh(); - livewire(ManageStudentInformation::class, [ 'record' => $student->getKey(), 'activeRelationManager' => array_search( @@ -260,8 +240,6 @@ $user->givePermissionTo('student.view-any'); $user->givePermissionTo('student.*.view'); - $user->refresh(); - actingAs($user); $relationManager = StudentFilesRelationManager::class; @@ -280,8 +258,6 @@ $user->givePermissionTo('engagement_file.view-any'); - $user->refresh(); - livewire(ManageStudentInformation::class, [ 'record' => $student->getKey(), 'activeRelationManager' => array_search( From f8bca7bcfd40e584182c387e965f3ac7959a0838 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 17:59:22 +0000 Subject: [PATCH 44/55] add test for StudentAlertsRelationManager Signed-off-by: Kevin Ullyott --- .../tests/Student/ViewStudentTest.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 7b1f84952b..2d2e59d9b8 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -50,6 +50,7 @@ use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFilesRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentAlertsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEngagementRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentInteractionsRelationManager; @@ -271,6 +272,45 @@ ->assertSeeLivewire($relationManager); }); +it('renders the StudentAlertsRelationManager based on proper access', function () { + $user = User::factory()->licensed(Student::getLicenseType())->create(); + + $student = Student::factory()->create(); + + $user->givePermissionTo('student.view-any'); + $user->givePermissionTo('student.*.view'); + + actingAs($user); + + $relationManager = StudentAlertsRelationManager::class; + + livewire(ViewStudent::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ViewStudent()) + ->tap(fn (ViewStudent $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $user->givePermissionTo('alert.view-any'); + + livewire(ViewStudent::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ViewStudent()) + ->tap(fn (ViewStudent $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +}); + it('renders the StudentFormSubmissionsRelationManager based on Feature access', function () { $student = Student::factory()->create(); From b58979fc26d4478512c51c02a5389dacfb2db3b4 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 18:02:47 +0000 Subject: [PATCH 45/55] Test for StudentTasksRelationManager Signed-off-by: Kevin Ullyott --- .../tests/Student/ViewStudentTest.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 2d2e59d9b8..92761bf5bf 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -50,6 +50,7 @@ use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\ProgramsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\EnrollmentsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFilesRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentTasksRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentAlertsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEngagementRelationManager; @@ -311,6 +312,45 @@ ->assertSeeLivewire($relationManager); }); +it('renders the StudentTasksRelationManager based on proper access', function () { + $user = User::factory()->licensed(Student::getLicenseType())->create(); + + $student = Student::factory()->create(); + + $user->givePermissionTo('student.view-any'); + $user->givePermissionTo('student.*.view'); + + actingAs($user); + + $relationManager = StudentTasksRelationManager::class; + + livewire(ViewStudent::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ViewStudent()) + ->tap(fn (ViewStudent $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $user->givePermissionTo('task.view-any'); + + livewire(ViewStudent::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ViewStudent()) + ->tap(fn (ViewStudent $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +}); + it('renders the StudentFormSubmissionsRelationManager based on Feature access', function () { $student = Student::factory()->create(); From e03d65a0f7503558f19b2d5a6c939e6c83a573d8 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 18:14:32 +0000 Subject: [PATCH 46/55] Update tests Signed-off-by: Kevin Ullyott --- .../tests/Student/ViewStudentTest.php | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/app-modules/student-data-model/tests/Student/ViewStudentTest.php b/app-modules/student-data-model/tests/Student/ViewStudentTest.php index 92761bf5bf..877920a2b1 100644 --- a/app-modules/student-data-model/tests/Student/ViewStudentTest.php +++ b/app-modules/student-data-model/tests/Student/ViewStudentTest.php @@ -53,8 +53,10 @@ use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentTasksRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentAlertsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEventsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentCareTeamRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentEngagementRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentInteractionsRelationManager; +use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentSubscriptionsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentFormSubmissionsRelationManager; use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\RelationManagers\StudentApplicationSubmissionsRelationManager; @@ -351,6 +353,84 @@ ->assertSeeLivewire($relationManager); }); +it('renders the StudentCareTeamRelationManager based on proper access', function () { + $user = User::factory()->licensed(Student::getLicenseType())->create(); + + $student = Student::factory()->create(); + + $user->givePermissionTo('student.view-any'); + $user->givePermissionTo('student.*.view'); + + actingAs($user); + + $relationManager = StudentCareTeamRelationManager::class; + + livewire(ViewStudent::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ViewStudent()) + ->tap(fn (ViewStudent $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $user->givePermissionTo('care_team.view-any'); + + livewire(ViewStudent::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ViewStudent()) + ->tap(fn (ViewStudent $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +})->skip('This test is skipped because the relationship is to Users, we need to change the manager to focus permissions on CareTeam permissions.'); + +it('renders the StudentSubscriptionsRelationManager based on proper access', function () { + $user = User::factory()->licensed(Student::getLicenseType())->create(); + + $student = Student::factory()->create(); + + $user->givePermissionTo('student.view-any'); + $user->givePermissionTo('student.*.view'); + + actingAs($user); + + $relationManager = StudentSubscriptionsRelationManager::class; + + livewire(ViewStudent::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ViewStudent()) + ->tap(fn (ViewStudent $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertDontSeeLivewire($relationManager); + + $user->givePermissionTo('subscription.view-any'); + + livewire(ViewStudent::class, [ + 'record' => $student->getKey(), + 'activeRelationManager' => array_search( + $relationManager, + (new ViewStudent()) + ->tap(fn (ViewStudent $manager) => $manager->mount($student->getKey())) + ->getRelationManagers() + ), + ]) + ->assertOk() + ->assertSeeLivewire($relationManager); +})->skip('This test is skipped because the relationship is to Users, we need to change the manager to focus permissions on Subscription permissions.'); + it('renders the StudentFormSubmissionsRelationManager based on Feature access', function () { $student = Student::factory()->create(); From 6d0cf3dbce2c8d54e06a864bc11dacb15461c56f Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 18:26:07 +0000 Subject: [PATCH 47/55] Remove files that are no longer needed Signed-off-by: Kevin Ullyott --- .../Pages/ManageStudentAlerts.php | 174 ------------------ .../Pages/StudentEngagementTimeline.php | 64 ------- 2 files changed, 238 deletions(-) delete mode 100644 app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentAlerts.php delete mode 100644 app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/StudentEngagementTimeline.php diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentAlerts.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentAlerts.php deleted file mode 100644 index 29da0fa448..0000000000 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/ManageStudentAlerts.php +++ /dev/null @@ -1,174 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; - -use Filament\Forms\Form; -use Filament\Tables\Table; -use Filament\Infolists\Infolist; -use Filament\Forms\Components\Select; -use Illuminate\Support\Facades\Cache; -use Filament\Forms\Components\Textarea; -use Filament\Tables\Actions\EditAction; -use Filament\Tables\Actions\ViewAction; -use Filament\Tables\Columns\TextColumn; -use AdvisingApp\Alert\Enums\AlertStatus; -use App\Filament\Tables\Columns\IdColumn; -use Filament\Tables\Actions\CreateAction; -use Filament\Tables\Actions\DeleteAction; -use Filament\Tables\Filters\SelectFilter; -use AdvisingApp\Alert\Enums\AlertSeverity; -use Filament\Infolists\Components\TextEntry; -use Filament\Tables\Actions\BulkActionGroup; -use Filament\Tables\Actions\DeleteBulkAction; -use AdvisingApp\StudentDataModel\Models\Student; -use Filament\Resources\Pages\ManageRelatedRecords; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; - -class ManageStudentAlerts extends ManageRelatedRecords -{ - protected static string $resource = StudentResource::class; - - protected static string $relationship = 'alerts'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $navigationLabel = 'Alerts'; - - // TODO: Automatically set from Filament based on relationship name - protected static ?string $breadcrumb = 'Alerts'; - - protected static ?string $navigationIcon = 'heroicon-o-bell-alert'; - - public static function getNavigationItems(array $urlParameters = []): array - { - $item = parent::getNavigationItems($urlParameters)[0]; - - $ownerRecord = $urlParameters['record']; - - /** @var Student $ownerRecord */ - $alertsCount = Cache::tags('alert-count') - ->remember( - "alert-count-{$ownerRecord->getKey()}", - now()->addMinutes(5), - function () use ($ownerRecord): int { - return $ownerRecord->alerts()->status(AlertStatus::Active)->count(); - }, - ); - - $item->badge($alertsCount > 0 ? $alertsCount : null, color: 'danger'); - - return [$item]; - } - - public function infolist(Infolist $infolist): Infolist - { - return $infolist - ->schema([ - TextEntry::make('description'), - TextEntry::make('severity'), - TextEntry::make('suggested_intervention'), - TextEntry::make('status'), - TextEntry::make('createdBy.name')->label('Created By')->default('N/A'), - TextEntry::make('created_at')->label('Created Date'), - ]); - } - - public function form(Form $form): Form - { - return $form - ->schema([ - Textarea::make('description') - ->required() - ->string(), - Select::make('severity') - ->options(AlertSeverity::class) - ->selectablePlaceholder(false) - ->default(AlertSeverity::default()) - ->required() - ->enum(AlertSeverity::class), - Textarea::make('suggested_intervention') - ->required() - ->string(), - Select::make('status') - ->options(AlertStatus::class) - ->selectablePlaceholder(false) - ->default(AlertStatus::default()) - ->required() - ->enum(AlertStatus::class), - ]); - } - - public function table(Table $table): Table - { - return $table - ->recordTitleAttribute('description') - ->columns([ - IdColumn::make(), - TextColumn::make('description') - ->limit(), - TextColumn::make('severity') - ->sortable(), - TextColumn::make('status') - ->sortable(), - TextColumn::make('created_at') - ->sortable(), - ]) - ->filters([ - SelectFilter::make('severity') - ->options(AlertSeverity::class), - SelectFilter::make('status') - ->options(AlertStatus::class), - ]) - ->headerActions([ - CreateAction::make() - ->mutateFormDataUsing(function (array $data): array { - $data['created_by'] = auth()->id(); - - return $data; - }), - ]) - ->actions([ - ViewAction::make(), - EditAction::make(), - DeleteAction::make(), - ]) - ->bulkActions([ - BulkActionGroup::make([ - DeleteBulkAction::make(), - ]), - ]); - } -} diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/StudentEngagementTimeline.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/StudentEngagementTimeline.php deleted file mode 100644 index b33170db23..0000000000 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/Pages/StudentEngagementTimeline.php +++ /dev/null @@ -1,64 +0,0 @@ - - - Copyright © 2016-2024, Canyon GBS LLC. All rights reserved. - - Advising App™ is licensed under the Elastic License 2.0. For more details, - see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. - - 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 Advising 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 - https://www.canyongbs.com or contact us via email at legal@canyongbs.com. - - -*/ - -namespace AdvisingApp\StudentDataModel\Filament\Resources\StudentResource\Pages; - -use AdvisingApp\Task\Histories\TaskHistory; -use AdvisingApp\Alert\Histories\AlertHistory; -use AdvisingApp\Engagement\Models\Engagement; -use AdvisingApp\Interaction\Models\Interaction; -use AdvisingApp\Engagement\Models\EngagementResponse; -use AdvisingApp\Timeline\Filament\Pages\TimelinePage; -use AdvisingApp\StudentDataModel\Filament\Resources\StudentResource; - -class StudentEngagementTimeline extends TimelinePage -{ - protected static string $resource = StudentResource::class; - - protected static ?string $navigationLabel = 'Timeline'; - - public string $emptyStateMessage = 'There are no engagements to show for this student.'; - - public string $noMoreRecordsMessage = "You have reached the end of this student's engagement timeline."; - - public array $modelsToTimeline = [ - Engagement::class, - EngagementResponse::class, - AlertHistory::class, - TaskHistory::class, - Interaction::class, - ]; -} From 9f0cc089fc9cf62cec7328b7f3179c0f02e15d85 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 18:36:58 +0000 Subject: [PATCH 48/55] Just load to the first 10 Signed-off-by: Kevin Ullyott --- .../src/Livewire/StudentEngagementTimeline.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php index f1785c2b0c..11cbe38016 100644 --- a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php +++ b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php @@ -47,6 +47,8 @@ class StudentEngagementTimeline extends TimelinePage { + public int $recordsPerPage = 10; + protected static string $resource = StudentResource::class; protected static ?string $navigationLabel = 'Timeline'; From d0bdec6da434d402f61918386eec1ade4b817c5d Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 18:37:05 +0000 Subject: [PATCH 49/55] Prevent loading of more than 10 records Signed-off-by: Kevin Ullyott --- .../resources/views/components/timeline.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-modules/student-data-model/resources/views/components/timeline.blade.php b/app-modules/student-data-model/resources/views/components/timeline.blade.php index b59de05955..a7bf279620 100644 --- a/app-modules/student-data-model/resources/views/components/timeline.blade.php +++ b/app-modules/student-data-model/resources/views/components/timeline.blade.php @@ -46,7 +46,7 @@ class="rounded-xl bg-white ring-1 ring-gray-950/5 dark:divide-white/10 dark:bg-g
    - @foreach ($timelineRecords as $record) + @foreach ($timelineRecords->slice(0, 10) as $record)
  1. @if (!$loop->last) From 7eff752c3dcc883dede317fb8a2de0acd53d2a61 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 18:42:50 +0000 Subject: [PATCH 50/55] Setup lazy loading Signed-off-by: Kevin Ullyott --- .../filament/resources/student-resource/view-student.blade.php | 3 ++- .../src/Livewire/StudentEngagementTimeline.php | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index 7d065ba171..6a8be061ec 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -44,7 +44,7 @@
    - +
    @@ -54,6 +54,7 @@ @livewire($relationManager, [ 'ownerRecord' => $record, 'pageClass' => ViewStudent::class, + 'lazy' => true, ]) @endforeach
    diff --git a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php index 11cbe38016..8607599d19 100644 --- a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php +++ b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php @@ -36,6 +36,7 @@ namespace AdvisingApp\StudentDataModel\Livewire; +use Filament\Support\Concerns\CanBeLazy; use App\Actions\GetRecordFromMorphAndKey; use AdvisingApp\Task\Histories\TaskHistory; use AdvisingApp\Alert\Histories\AlertHistory; @@ -47,6 +48,8 @@ class StudentEngagementTimeline extends TimelinePage { + use CanBeLazy; + public int $recordsPerPage = 10; protected static string $resource = StudentResource::class; From 7f224771f3313452a347dfc536680660e0c028cb Mon Sep 17 00:00:00 2001 From: Orrison Date: Wed, 30 Oct 2024 18:44:33 +0000 Subject: [PATCH 51/55] chore: fix code style --- .../resources/student-resource/view-student.blade.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php index 6a8be061ec..56f92a30c6 100644 --- a/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php +++ b/app-modules/student-data-model/resources/views/filament/resources/student-resource/view-student.blade.php @@ -44,7 +44,10 @@
    - +
    From 209cdcda64191cb4a9922913a3be2b116acc2207 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 19:23:44 +0000 Subject: [PATCH 52/55] Change the default record previews to only show 5 Signed-off-by: Kevin Ullyott --- .../src/Livewire/StudentEngagementTimeline.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php index 8607599d19..dd5a9c4ea5 100644 --- a/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php +++ b/app-modules/student-data-model/src/Livewire/StudentEngagementTimeline.php @@ -50,7 +50,7 @@ class StudentEngagementTimeline extends TimelinePage { use CanBeLazy; - public int $recordsPerPage = 10; + public int $recordsPerPage = 5; protected static string $resource = StudentResource::class; From 10073c626e532a7b7092c881ab5ae14ac18a77c1 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 19:24:39 +0000 Subject: [PATCH 53/55] Make sure the timeline preview only ever shows 5 Signed-off-by: Kevin Ullyott --- .../resources/views/components/timeline.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-modules/student-data-model/resources/views/components/timeline.blade.php b/app-modules/student-data-model/resources/views/components/timeline.blade.php index a7bf279620..26d522d997 100644 --- a/app-modules/student-data-model/resources/views/components/timeline.blade.php +++ b/app-modules/student-data-model/resources/views/components/timeline.blade.php @@ -46,7 +46,7 @@ class="rounded-xl bg-white ring-1 ring-gray-950/5 dark:divide-white/10 dark:bg-g
      - @foreach ($timelineRecords->slice(0, 10) as $record) + @foreach ($timelineRecords->slice(0, 5) as $record)
    1. @if (!$loop->last) From 87823e4e3e1511ee02e6c118d21f5a30843a84a7 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 19:40:01 +0000 Subject: [PATCH 54/55] Hide columns by default in StudentAlertsRelationManager Signed-off-by: Kevin Ullyott --- .../RelationManagers/StudentAlertsRelationManager.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php index 8ae78ebcb9..81dc25cb41 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/StudentAlertsRelationManager.php @@ -106,11 +106,17 @@ public function table(Table $table): Table TextColumn::make('description') ->limit(), TextColumn::make('severity') - ->sortable(), + ->sortable() + ->toggleable( + isToggledHiddenByDefault: true, + ), TextColumn::make('status') ->sortable(), TextColumn::make('created_at') - ->sortable(), + ->sortable() + ->toggleable( + isToggledHiddenByDefault: true, + ), ]) ->filters([ SelectFilter::make('severity') From 5baa5606124a44989bb99fee2507f18a3dbbf376 Mon Sep 17 00:00:00 2001 From: Kevin Ullyott Date: Wed, 30 Oct 2024 20:03:08 +0000 Subject: [PATCH 55/55] Remove commented code Signed-off-by: Kevin Ullyott --- .../Filament/Resources/StudentResource.php | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php index 65125f2cf3..b18900ddc1 100644 --- a/app-modules/student-data-model/src/Filament/Resources/StudentResource.php +++ b/app-modules/student-data-model/src/Filament/Resources/StudentResource.php @@ -58,27 +58,6 @@ class StudentResource extends Resource protected static ?string $recordTitleAttribute = 'full_name'; - // public static function getRecordSubNavigation(Page $page): array - // { - // return $page->generateNavigationItems([ - // ViewStudent::class, - // ManageStudentInformation::class, - // ManageStudentEngagement::class, - // ManageStudentFiles::class, - // ManageStudentAlerts::class, - // ManageStudentTasks::class, - // ManageStudentSubscriptions::class, - // ManageStudentInteractions::class, - // StudentEngagementTimeline::class, - // ManageStudentCareTeam::class, - // ManageStudentFormSubmissions::class, - // ManageStudentApplicationSubmissions::class, - // StudentServiceManagement::class, - // ManageStudentEvents::class, - // ManageStudentPrograms::class, - // ]); - // } - public static function modifyGlobalSearchQuery(Builder $query, string $search): void { static::scoreGlobalSearchResults($query, $search, [