From 36949c015888c92e65a8ce92d54c9ceb9c9aa031 Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 12:10:09 +0200 Subject: [PATCH 01/13] copy case from another tenant --- .../Pages/CreateBeneficiary.php | 40 ++++++++++++++----- .../EditBeneficiaryPersonalInformation.php | 6 +-- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php index c4d4f420..233eca5c 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php @@ -13,6 +13,7 @@ use App\Models\Organization; use App\Models\Scopes\BelongsToCurrentTenant; use App\Rules\ValidCNP; +use Carbon\Carbon; use Filament\Facades\Filament; use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\Checkbox; @@ -270,23 +271,35 @@ protected function getSteps(): array ->toArray() ) ->withoutGlobalScopes([BelongsToCurrentTenant::class]) - ->with(['effective_residence', 'legal_residence']) + ->with([ + 'effective_residence', + 'legal_residence', + 'children', + 'aggressors', + 'details', + ]) ->first(); $ignoredFields = [ 'id', 'initial_id', - 'doesnt_have_children', - 'children_total_count', - 'children_care_count', - 'children_under_18_care_count', - 'children_18_care_count', - 'children_accompanying_count', ]; - foreach ($beneficiary->toArray() as $beneficiaryKey => $beneficiaryValue) { + + $beneficiaryArray = $beneficiary->toArray(); + foreach ($beneficiaryArray['children'] as &$child) { + $child['birthdate'] = $child['birthdate'] ? Carbon::parse($child['birthdate'])->format('d.m.Y') : null; + $child['age'] = $child['birthdate'] ? Carbon::createFromFormat('d.m.Y', $child['birthdate'])->diffInYears(now()) : null; + } + + foreach ($beneficiaryArray as $beneficiaryKey => $beneficiaryValue) { if (\in_array($beneficiaryKey, $ignoredFields)) { continue; } + + if ($beneficiaryKey === 'birthdate' && $beneficiaryValue) { + $beneficiaryValue = Carbon::parse($beneficiaryValue)->format('d.m.Y'); + } + $set($beneficiaryKey, $beneficiaryValue); } @@ -334,7 +347,16 @@ protected function getSteps(): array Step::make('children') ->label(__('beneficiary.wizard.children.label')) ->schema(EditChildrenIdentity::getChildrenIdentityFormSchema()) - ->afterStateHydrated(fn (Set $set) => $set('children', $this->parentBeneficiary?->children->toArray())), + ->afterStateHydrated( + function (Set $set) { + $children = $this->parentBeneficiary?->children->toArray() ?? []; + foreach ($children as &$child) { + $child['birthdate'] = $child['birthdate'] ? Carbon::parse($child['birthdate'])->format('d.m.Y') : null; + $child['age'] = $child['birthdate'] ? Carbon::createFromFormat('d.m.Y', $child['birthdate'])->diffInYears(now()) : null; + } + $set('children', $children); + } + ), Step::make('personal_information') ->label(__('beneficiary.wizard.personal_information.label')) diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/EditBeneficiaryPersonalInformation.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/EditBeneficiaryPersonalInformation.php index 5633d8ca..a6346351 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/EditBeneficiaryPersonalInformation.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/EditBeneficiaryPersonalInformation.php @@ -114,19 +114,19 @@ public static function beneficiarySection(): array Textarea::make('observations_chronic_diseases') ->label(__('beneficiary.section.personal_information.label.observations_chronic_diseases')) ->columnSpanFull() - ->visible(fn (Get $get) => \in_array(Diseases::CHRONIC_DISEASES->value, $get('health_status'))) + ->visible(fn (Get $get) => $get('health_status') && \in_array(Diseases::CHRONIC_DISEASES->value, $get('health_status'))) ->maxLength(250), Textarea::make('observations_degenerative_diseases') ->label(__('beneficiary.section.personal_information.label.observations_degenerative_diseases')) ->columnSpanFull() - ->visible(fn (Get $get) => \in_array(Diseases::DEGENERATIVE_DISEASES->value, $get('health_status'))) + ->visible(fn (Get $get) => $get('health_status') && \in_array(Diseases::DEGENERATIVE_DISEASES->value, $get('health_status'))) ->maxLength(250), Textarea::make('observations_mental_illness') ->label(__('beneficiary.section.personal_information.label.observations_mental_illness')) ->columnSpanFull() - ->visible(fn (Get $get) => \in_array(Diseases::MENTAL_ILLNESSES->value, $get('health_status'))) + ->visible(fn (Get $get) => $get('health_status') && \in_array(Diseases::MENTAL_ILLNESSES->value, $get('health_status'))) ->maxLength(250), ]), From 5328edb317d46e780f512a5e1696097dd7030c54 Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 13:11:27 +0200 Subject: [PATCH 02/13] Beneficiary history - filters --- .../Pages/ListBeneficiaryHistories.php | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/app/Filament/Organizations/Resources/BeneficiaryHistoryResource/Pages/ListBeneficiaryHistories.php b/app/Filament/Organizations/Resources/BeneficiaryHistoryResource/Pages/ListBeneficiaryHistories.php index 088ee92e..107fa811 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryHistoryResource/Pages/ListBeneficiaryHistories.php +++ b/app/Filament/Organizations/Resources/BeneficiaryHistoryResource/Pages/ListBeneficiaryHistories.php @@ -7,14 +7,16 @@ use App\Concerns\HasParentResource; use App\Enums\ActivityDescription; use App\Filament\Organizations\Resources\BeneficiaryHistoryResource; +use App\Filters\DateFilter; use App\Models\Activity; use App\Models\Beneficiary; +use App\Models\User; use App\Services\Breadcrumb\BeneficiaryBreadcrumb; use App\Tables\Columns\DateColumn; +use App\Tables\Filters\SelectFilter; use Filament\Resources\Pages\ListRecords; use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\TextColumn; -use Filament\Tables\Filters\SelectFilter; use Filament\Tables\Table; use Illuminate\Contracts\Support\Htmlable; use Illuminate\Database\Eloquent\Builder; @@ -51,8 +53,8 @@ public function getTitle(): string|Htmlable public function table(Table $table): Table { return $table - ->query( - fn () => Activity::whereMorphedTo('subject', $this->parent) + ->modifyQueryUsing( + fn (Builder $query) => $query->whereMorphedTo('subject', $this->parent) ->when( ! auth()->user()->hasAccessToAllCases() && ! auth()->user()->isNgoAdmin(), fn (Builder $query) => $query->whereHasMorph( @@ -108,11 +110,14 @@ public function table(Table $table): Table ? $query->where('description', $state['value']) : $query ), - ]); - } - protected function applyFiltersToTableQuery(Builder $query): Builder - { - return $query; + SelectFilter::make('causer_id') + ->label(__('beneficiary.section.history.labels.user')) + ->options(User::getTenantOrganizationUsers()), + + DateFilter::make('created_at') + ->label(__('beneficiary.section.history.labels.date')), + + ]); } } From ec7698c4661c307a679df47232d04741a2a84039 Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 14:52:25 +0200 Subject: [PATCH 03/13] Edit ngo admin --- app/Concerns/HasPermissions.php | 7 ++++++- app/Filament/Organizations/Resources/UserResource.php | 9 ++++----- app/Policies/UserPolicy.php | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/Concerns/HasPermissions.php b/app/Concerns/HasPermissions.php index 3653d678..d535bd12 100644 --- a/app/Concerns/HasPermissions.php +++ b/app/Concerns/HasPermissions.php @@ -7,6 +7,7 @@ use App\Enums\AdminPermission; use App\Enums\CasePermission; use App\Models\Beneficiary; +use App\Models\User; use Filament\Facades\Filament; trait HasPermissions @@ -53,7 +54,7 @@ public function hasAccessToBeneficiary(Beneficiary $beneficiary): bool return false; } - public function hasAccessToStaff(): bool + public function hasAccessToStaff(?User $model = null): bool { if ($this->isAdmin()) { return true; @@ -63,6 +64,10 @@ public function hasAccessToStaff(): bool return true; } + if ($model && $model->isNgoAdmin()) { + return false; + } + return (bool) $this->permissions?->admin_permissions->contains(AdminPermission::CAN_CHANGE_STAFF); } diff --git a/app/Filament/Organizations/Resources/UserResource.php b/app/Filament/Organizations/Resources/UserResource.php index 849e3c8d..2610f943 100644 --- a/app/Filament/Organizations/Resources/UserResource.php +++ b/app/Filament/Organizations/Resources/UserResource.php @@ -8,12 +8,10 @@ use App\Enums\CasePermission; use App\Filament\Organizations\Resources\UserResource\Pages; use App\Forms\Components\Select; -use App\Infolists\Components\DateTimeEntry; use App\Models\OrganizationUserPermissions; use App\Models\Role; use App\Models\User; use App\Tables\Columns\DateTimeColumn; -use Carbon\Carbon; use Filament\Facades\Filament; use Filament\Forms\Components\CheckboxList; use Filament\Forms\Components\Group; @@ -73,6 +71,7 @@ public static function table(Table $table): Table { return $table ->modifyQueryUsing(fn (Builder $query) => $query->with(['rolesInOrganization', 'userStatus'])) + ->heading(__('user.heading.table')) ->columns([ TextColumn::make('first_name') ->sortable() @@ -89,7 +88,8 @@ public static function table(Table $table): Table TextColumn::make('userStatus.status') ->sortable() - ->label(__('user.labels.account_status')), + ->label(__('user.labels.account_status')) + ->suffix(fn (User $record) => $record->isNgoAdmin() ? '**' : ''), DateTimeColumn::make('last_login_at') ->sortable() @@ -101,8 +101,7 @@ public static function table(Table $table): Table ->actions([ Tables\Actions\ViewAction::make() ->label(__('general.action.view_details')), - ]) - ->heading(__('user.heading.table')); + ]); } public static function getPages(): array diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php index f013697d..a52140da 100644 --- a/app/Policies/UserPolicy.php +++ b/app/Policies/UserPolicy.php @@ -21,7 +21,7 @@ public function viewAny(User $user): bool */ public function view(User $user, User $model): bool { - return $user->hasAccessToStaff(); + return $user->hasAccessToStaff($model); } /** @@ -37,7 +37,7 @@ public function create(User $user): bool */ public function update(User $user, User $model): bool { - return $user->hasAccessToStaff(); + return $user->hasAccessToStaff($model); } /** From 90fe8e9e82a8100792f4f38ad7ec9437f785addc Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 15:47:21 +0200 Subject: [PATCH 04/13] Filter specialist by status in case team --- .../Widgets/ListSpecialistsWidget.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Widgets/ListSpecialistsWidget.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Widgets/ListSpecialistsWidget.php index 9bf65eae..81398315 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Widgets/ListSpecialistsWidget.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Widgets/ListSpecialistsWidget.php @@ -63,7 +63,7 @@ public function table(Table $table): Table EditAction::make() ->form($this->getFormSchema()) ->fillForm(function (Specialist $record) { - if (!$record->role_id) { + if (! $record->role_id) { $record->role_id = -1; } @@ -128,7 +128,7 @@ public function getFormSchema(): array ->label(__('beneficiary.section.specialists.labels.name')) ->options( function (Get $get, $state) { - $roleID = (int)$get('role_id'); + $roleID = (int) $get('role_id'); if ($roleID === -1) { if ($state) { return [$state => User::find($state)->full_name]; @@ -155,7 +155,11 @@ function (Get $get, $state) { fn (Specialist $specialist) => $specialist->role_id === (int) $get('role_id') && $specialist->user_id !== $record?->user_id ) ->map(fn (Specialist $specialist) => $specialist->user_id) - ->contains($value) + ->contains($value) || + ! User::query() + ->find($value) + ->userStatus + ->isActive() ) ->searchable() ->preload() From 0bf3239058329fb30ae3d6f2ae30cd1189781942 Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 16:29:08 +0200 Subject: [PATCH 05/13] Infolist EditAction --- .../Pages/ViewInstitution.php | 7 ++----- .../OrganizationsRelationManager.php | 7 ++----- .../Pages/ViewUserInstitution.php | 6 ++---- .../Pages/ViewBeneficiaryIntervention.php | 7 ++----- .../Pages/ViewMeetings.php | 5 ++--- .../Pages/CloseFile/ViewCloseFile.php | 6 +++--- .../ViewDetailedEvaluation.php | 10 +++++----- .../InitialEvaluation/ViewInitialEvaluation.php | 17 +++++++---------- .../Pages/ViewBeneficiaryIdentity.php | 6 +++--- .../ViewBeneficiaryPersonalInformation.php | 10 +++++----- .../Widgets/CounselingSheetWidget.php | 8 +++----- .../MonitoringResource/Pages/ViewMonitoring.php | 8 ++++---- .../Pages/ViewMonthlyPlan.php | 10 +++------- .../Resources/UserResource/Pages/ViewUser.php | 8 +++----- .../Actions/{Edit.php => EditAction.php} | 3 ++- 15 files changed, 48 insertions(+), 70 deletions(-) rename app/Infolists/Components/Actions/{Edit.php => EditAction.php} (85%) diff --git a/app/Filament/Admin/Resources/InstitutionResource/Pages/ViewInstitution.php b/app/Filament/Admin/Resources/InstitutionResource/Pages/ViewInstitution.php index a01184e6..60b90b4f 100644 --- a/app/Filament/Admin/Resources/InstitutionResource/Pages/ViewInstitution.php +++ b/app/Filament/Admin/Resources/InstitutionResource/Pages/ViewInstitution.php @@ -8,9 +8,9 @@ use App\Filament\Admin\Resources\InstitutionResource; use App\Filament\Admin\Resources\InstitutionResource\Actions\ActivateInstitution; use App\Filament\Admin\Resources\InstitutionResource\Actions\InactivateInstitution; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\DocumentPreview; use App\Infolists\Components\Location; -use Filament\Infolists\Components\Actions\Action; use Filament\Infolists\Components\Section; use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Infolist; @@ -51,10 +51,7 @@ public function infolist(Infolist $infolist): Infolist return $infolist->schema([ Section::make(__('institution.headings.institution_details')) ->headerActions([ - Action::make('edit') - ->label(__('general.action.edit')) - ->icon('heroicon-o-pencil') - ->link() + EditAction::make() ->url(self::$resource::getUrl('edit_institution_details', ['record' => $this->getRecord()])), ]) ->maxWidth('3xl') diff --git a/app/Filament/Admin/Resources/InstitutionResource/RelationManagers/OrganizationsRelationManager.php b/app/Filament/Admin/Resources/InstitutionResource/RelationManagers/OrganizationsRelationManager.php index 235a58f8..003e5ef3 100644 --- a/app/Filament/Admin/Resources/InstitutionResource/RelationManagers/OrganizationsRelationManager.php +++ b/app/Filament/Admin/Resources/InstitutionResource/RelationManagers/OrganizationsRelationManager.php @@ -5,11 +5,11 @@ namespace App\Filament\Admin\Resources\InstitutionResource\RelationManagers; use App\Filament\Admin\Resources\InstitutionResource; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\DocumentPreview; use App\Infolists\Components\SectionHeader; use App\Models\Institution; use Filament\Facades\Filament; -use Filament\Infolists\Components\Actions\Action; use Filament\Infolists\Components\RepeatableEntry; use Filament\Infolists\Components\Section; use Filament\Infolists\Components\TextEntry; @@ -37,10 +37,7 @@ public function infolist(Infolist $infolist): Infolist SectionHeader::make('center_details') ->state(__('institution.headings.center_details')) ->action( - Action::make('edit_centers') - ->label(__('general.action.edit')) - ->icon('heroicon-o-pencil') - ->link() + EditAction::make('edit_centers') ->url(InstitutionResource::getUrl('edit_institution_centers', ['record' => $this->getOwnerRecord()])) ), diff --git a/app/Filament/Admin/Resources/UserInstitutionResource/Pages/ViewUserInstitution.php b/app/Filament/Admin/Resources/UserInstitutionResource/Pages/ViewUserInstitution.php index 12c8337d..053d2ccc 100644 --- a/app/Filament/Admin/Resources/UserInstitutionResource/Pages/ViewUserInstitution.php +++ b/app/Filament/Admin/Resources/UserInstitutionResource/Pages/ViewUserInstitution.php @@ -11,9 +11,9 @@ use App\Filament\Admin\Resources\UserInstitutionResource\Actions\ActivateUserAction; use App\Filament\Admin\Resources\UserInstitutionResource\Actions\DeactivateUserAction; use App\Filament\Admin\Resources\UserInstitutionResource\Actions\ResendInvitationAction; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\DateTimeEntry; use App\Infolists\Components\SectionHeader; -use Filament\Infolists\Components\Actions\Action; use Filament\Infolists\Components\Section; use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Infolist; @@ -85,9 +85,7 @@ public function infolist(Infolist $infolist): Infolist SectionHeader::make('edit_user') ->state(__('user.heading.specialist_details')) ->action( - Action::make('edit') - ->label(__('general.action.edit')) - ->link() + EditAction::make() ->url(self::getParentResource()::getUrl('user.edit', [ 'parent' => $this->parent, 'record' => $this->getRecord(), diff --git a/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/ViewBeneficiaryIntervention.php b/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/ViewBeneficiaryIntervention.php index 20fdcec6..72c6b295 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/ViewBeneficiaryIntervention.php +++ b/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/ViewBeneficiaryIntervention.php @@ -10,8 +10,8 @@ use App\Filament\Organizations\Resources\BeneficiaryInterventionResource; use App\Filament\Organizations\Resources\InterventionPlanResource; use App\Filament\Organizations\Resources\InterventionServiceResource; +use App\Infolists\Components\Actions\EditAction; use App\Services\Breadcrumb\InterventionPlanBreadcrumb; -use Filament\Infolists\Components\Actions\Action; use Filament\Infolists\Components\Grid; use Filament\Infolists\Components\Section; use Filament\Infolists\Components\TextEntry; @@ -58,10 +58,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('intervention_plan.headings.intervention_indicators')) ->headerActions([ - Action::make('edit_intervention') - ->label(__('general.action.edit')) - ->icon('heroicon-o-pencil') - ->link() + EditAction::make('edit_intervention') ->url(fn () => InterventionServiceResource::getUrl('edit_intervention', [ 'parent' => $this->record->interventionService, 'record' => $this->record, diff --git a/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/ViewMeetings.php b/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/ViewMeetings.php index 4f7f7d82..c75ef701 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/ViewMeetings.php +++ b/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/ViewMeetings.php @@ -14,7 +14,7 @@ use App\Forms\Components\DatePicker; use App\Forms\Components\Select; use App\Infolists\Components\Actions\CreateAction; -use App\Infolists\Components\Actions\Edit; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\SectionHeader; use App\Models\InterventionMeeting; use App\Services\Breadcrumb\InterventionPlanBreadcrumb; @@ -140,8 +140,7 @@ public function infolist(Infolist $infolist): Infolist }) ->badge(fn (InterventionMeeting $record) => $record->status) ->action( - Edit::make('edit') - ->icon('heroicon-o-pencil') + EditAction::make() ->modalHeading(__('general.action.edit')) ->form($this->getFormSchema()) ->fillForm(fn (InterventionMeeting $record) => $record->toArray()) diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/ViewCloseFile.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/ViewCloseFile.php index 6296a447..c21af740 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/ViewCloseFile.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/ViewCloseFile.php @@ -7,7 +7,7 @@ use App\Actions\BackAction; use App\Enums\CloseMethod; use App\Filament\Organizations\Resources\BeneficiaryResource; -use App\Infolists\Components\Actions\Edit; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\DateEntry; use App\Infolists\Components\Notice; use App\Models\Beneficiary; @@ -73,7 +73,7 @@ public function infolist(Infolist $infolist): Infolist ->columns() ->relationship('closeFile') ->headerActions([ - Edit::make('edit_details') + EditAction::make('edit_details') ->url(self::getResource()::getUrl('edit_close_file_details', ['record' => $this->getRecord()])), ]) ->schema([ @@ -131,7 +131,7 @@ public function infolist(Infolist $infolist): Infolist ->columns() ->relationship('closeFile') ->headerActions([ - Edit::make('edit_details') + EditAction::make('edit_details') ->url(self::getResource()::getUrl('edit_close_file_general_details', ['record' => $this->getRecord()])), ]) ->schema([ diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/DetailedEvaluation/ViewDetailedEvaluation.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/DetailedEvaluation/ViewDetailedEvaluation.php index d14176c9..f91e9457 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/DetailedEvaluation/ViewDetailedEvaluation.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/DetailedEvaluation/ViewDetailedEvaluation.php @@ -10,7 +10,7 @@ use App\Enums\Ternary; use App\Filament\Organizations\Resources\BeneficiaryResource; use App\Filament\Organizations\Resources\BeneficiaryResource\Pages\ViewBeneficiaryIdentity; -use App\Infolists\Components\Actions\Edit; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\DateEntry; use App\Infolists\Components\Location; use App\Services\Breadcrumb\BeneficiaryBreadcrumb; @@ -59,7 +59,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('beneficiary.wizard.detailed_evaluation.label')) ->headerActions([ - Edit::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl( 'edit_detailed_evaluation', ['record' => $record] @@ -85,7 +85,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('beneficiary.section.detailed_evaluation.heading.partner')) ->headerActions([ - Edit::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl( 'edit_beneficiary_partner', ['record' => $record] @@ -100,7 +100,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('beneficiary.wizard.multidisciplinary_evaluation.label')) ->headerActions([ - Edit::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl( 'edit_multidisciplinary_evaluation', ['record' => $record] @@ -117,7 +117,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('beneficiary.wizard.results.label')) ->headerActions([ - Edit::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl( 'edit_detailed_evaluation_result', ['record' => $record] diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/ViewInitialEvaluation.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/ViewInitialEvaluation.php index 7cc8c78f..8d5f560f 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/ViewInitialEvaluation.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/ViewInitialEvaluation.php @@ -9,11 +9,10 @@ use App\Enums\Ternary; use App\Filament\Organizations\Resources\BeneficiaryResource; use App\Filament\Organizations\Resources\BeneficiaryResource\Pages\ViewBeneficiaryIdentity; -use App\Infolists\Components\Actions\Edit; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\Notice; use App\Infolists\Components\SectionHeader; use App\Services\Breadcrumb\BeneficiaryBreadcrumb; -use Filament\Infolists\Components\Actions\Action; use Filament\Infolists\Components\Section; use Filament\Infolists\Components\Tabs; use Filament\Infolists\Components\TextEntry; @@ -56,7 +55,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('beneficiary.wizard.details.label')) ->headerActions([ - Edit::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl( 'edit_initial_evaluation_details', ['record' => $record] @@ -77,7 +76,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('beneficiary.wizard.violence.label')) ->headerActions([ - Edit::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl( 'edit_initial_evaluation_violence', ['record' => $record] @@ -94,13 +93,11 @@ public function infolist(Infolist $infolist): Infolist SectionHeader::make('riskFactors') ->state(__('beneficiary.wizard.risk_factors.label')) ->action( - Action::make('view') - ->label(__('general.action.edit')) + EditAction::make() ->url(BeneficiaryResource::getUrl( 'edit_initial_evaluation_risk_factors', ['record' => $this->getRecord()] - )) - ->link(), + )), ), ...EditRiskFactors::getInfoListSchema(), @@ -111,7 +108,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('beneficiary.wizard.requested_services.label')) ->headerActions([ - Edit::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl( 'edit_initial_evaluation_requested_services', ['record' => $record] @@ -123,7 +120,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('beneficiary.wizard.beneficiary_situation.label')) ->headerActions([ - Edit::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl( 'edit_initial_evaluation_beneficiary_situation', ['record' => $record] diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryIdentity.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryIdentity.php index 72200414..9e1eeee7 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryIdentity.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryIdentity.php @@ -7,7 +7,7 @@ use App\Actions\BackAction; use App\Enums\AddressType; use App\Filament\Organizations\Resources\BeneficiaryResource; -use App\Infolists\Components\Actions\Edit; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\DateEntry; use App\Infolists\Components\EnumEntry; use App\Infolists\Components\Location; @@ -72,7 +72,7 @@ public static function getBeneficiaryIdentityFormSchema(): array return [ Section::make(__('beneficiary.section.identity.tab.beneficiary')) ->headerActions([ - Edit::make('edit') + EditAction::make('edit') ->url(fn ($record) => BeneficiaryResource::getUrl('edit_identity', ['record' => $record])), ]) ->schema(self::identitySchema()), @@ -210,7 +210,7 @@ public static function getChildrenIdentityFormSchema(): array return [ Section::make(__('beneficiary.section.identity.tab.children')) ->headerActions([ - Edit::make('edit') + EditAction::make('edit') ->url(fn ($record) => BeneficiaryResource::getUrl('edit_children', ['record' => $record])), ]) ->schema(self::childrenSchema()), diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryPersonalInformation.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryPersonalInformation.php index b3d1ff99..656d449e 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryPersonalInformation.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryPersonalInformation.php @@ -9,7 +9,7 @@ use App\Enums\Diseases; use App\Enums\Ternary; use App\Filament\Organizations\Resources\BeneficiaryResource; -use App\Infolists\Components\Actions\Edit; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\EnumEntry; use App\Infolists\Components\SectionHeader; use App\Models\Aggressor; @@ -91,7 +91,7 @@ protected static function beneficiarySection(): array ->columns() ->relationship('details') ->headerActions([ - Edit::make('edit') + EditAction::make('edit') ->url(fn ($record) => BeneficiaryResource::getUrl('edit_personal_information', ['record' => $record])), ]) ->extraAttributes([ @@ -240,7 +240,7 @@ protected static function aggressorSection(): array Section::make(__('beneficiary.section.personal_information.section.aggressor')) ->columns() ->headerActions([ - Edit::make('edit') + EditAction::make('edit') ->url(fn ($record) => BeneficiaryResource::getUrl('edit_aggressor', ['record' => $record])), ]) ->extraAttributes([ @@ -360,7 +360,7 @@ protected static function antecedentsSection(): array ->columns() ->relationship('antecedents') ->headerActions([ - Edit::make('edit') + EditAction::make('edit') ->url(fn ($record) => BeneficiaryResource::getUrl('edit_antecedents', ['record' => $record])), ]) ->extraAttributes([ @@ -404,7 +404,7 @@ protected static function flowSection(): array ->columns() ->relationship('flowPresentation') ->headerActions([ - Edit::make('edit') + EditAction::make('edit') ->url(fn ($record) => BeneficiaryResource::getUrl('edit_flow_presentation', ['record' => $record])), ]) ->extraAttributes([ diff --git a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php index a1156b97..0483cf44 100644 --- a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php +++ b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php @@ -18,6 +18,7 @@ use App\Enums\Ternary; use App\Filament\Organizations\Resources\BeneficiaryResource; use App\Filament\Organizations\Resources\InterventionPlanResource; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\EnumEntry; use App\Infolists\Components\SectionHeader; use App\Models\InterventionService; @@ -77,17 +78,14 @@ protected function getInfoListSchema(): array SectionHeader::make('counseling_sheet') ->state(__('intervention_plan.headings.counseling_sheet')) ->action( - Action::make('view') - ->label(__('general.action.edit')) - ->icon('heroicon-o-pencil') + EditAction::make('view') ->url(InterventionPlanResource::getUrl( 'edit_counseling_sheet', [ 'parent' => $this->record->interventionPlan, 'record' => $this->record, ] - )) - ->link(), + )), ), ...$schema]), ]; diff --git a/app/Filament/Organizations/Resources/MonitoringResource/Pages/ViewMonitoring.php b/app/Filament/Organizations/Resources/MonitoringResource/Pages/ViewMonitoring.php index 2c8be481..3627878e 100644 --- a/app/Filament/Organizations/Resources/MonitoringResource/Pages/ViewMonitoring.php +++ b/app/Filament/Organizations/Resources/MonitoringResource/Pages/ViewMonitoring.php @@ -9,7 +9,7 @@ use App\Filament\Organizations\Resources\BeneficiaryResource; use App\Filament\Organizations\Resources\BeneficiaryResource\Pages\ViewBeneficiaryIdentity; use App\Filament\Organizations\Resources\MonitoringResource; -use App\Infolists\Components\Actions\Edit; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\DateEntry; use App\Infolists\Components\SectionHeader; use App\Services\Breadcrumb\BeneficiaryBreadcrumb; @@ -71,7 +71,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('monitoring.headings.details')) ->headerActions([ - Edit::make('edit_details') + EditAction::make() ->url(self::getParentResource()::getUrl('monitoring.edit_details', [ 'parent' => $this->parent, 'record' => $this->getRecord(), @@ -110,7 +110,7 @@ public function infolist(Infolist $infolist): Infolist Section::make(__('monitoring.headings.child_info')) ->visible(fn () => $this->getRecord()->children->isNotEmpty()) ->headerActions([ - Edit::make('edit_details') + EditAction::make() ->url(self::getParentResource()::getUrl('monitoring.edit_children', [ 'parent' => $this->parent, 'record' => $this->getRecord(), @@ -165,7 +165,7 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Section::make(__('monitoring.headings.general')) ->headerActions([ - Edit::make('edit_details') + EditAction::make() ->url(self::getParentResource()::getUrl('monitoring.edit_general', [ 'parent' => $this->parent, 'record' => $this->getRecord(), diff --git a/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/ViewMonthlyPlan.php b/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/ViewMonthlyPlan.php index b3eeb9bd..34936468 100644 --- a/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/ViewMonthlyPlan.php +++ b/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/ViewMonthlyPlan.php @@ -9,13 +9,13 @@ use App\Filament\Organizations\Resources\BeneficiaryResource; use App\Filament\Organizations\Resources\InterventionPlanResource; use App\Filament\Organizations\Resources\MonthlyPlanResource; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\SectionHeader; use App\Infolists\Components\TableEntry; use App\Models\Specialist; use App\Services\Breadcrumb\InterventionPlanBreadcrumb; use Carbon\Carbon; use Filament\Actions\DeleteAction; -use Filament\Infolists\Components\Actions\Action; use Filament\Infolists\Components\RepeatableEntry; use Filament\Infolists\Components\Section; use Filament\Infolists\Components\Tabs; @@ -87,9 +87,7 @@ public function infolist(Infolist $infolist): Infolist SectionHeader::make('monthly_plan_details') ->state(__('intervention_plan.headings.monthly_plan_details')) ->action( - Action::make('edit_details') - ->label(__('general.action.edit')) - ->link() + EditAction::make() ->url( InterventionPlanResource::getUrl('edit_monthly_plan_details', [ 'parent' => $this->parent, @@ -137,9 +135,7 @@ public function infolist(Infolist $infolist): Infolist SectionHeader::make('monthly_plan_details') ->state(__('intervention_plan.headings.services_and_interventions')) ->action( - Action::make('edit_details') - ->label(__('general.action.edit')) - ->link() + EditAction::make() ->url( InterventionPlanResource::getUrl('edit_monthly_plan_services_and_interventions', [ 'parent' => $this->parent, diff --git a/app/Filament/Organizations/Resources/UserResource/Pages/ViewUser.php b/app/Filament/Organizations/Resources/UserResource/Pages/ViewUser.php index 71cdd779..1782e81b 100644 --- a/app/Filament/Organizations/Resources/UserResource/Pages/ViewUser.php +++ b/app/Filament/Organizations/Resources/UserResource/Pages/ViewUser.php @@ -13,10 +13,10 @@ use App\Filament\Organizations\Resources\UserResource\Actions\ReactivateUserAction; use App\Filament\Organizations\Resources\UserResource\Actions\ResendInvitationAction; use App\Filament\Organizations\Resources\UserResource\Actions\ResetPasswordAction; +use App\Infolists\Components\Actions\EditAction; use App\Infolists\Components\DateTimeEntry; use App\Infolists\Components\SectionHeader; use App\Models\User; -use Filament\Infolists\Components\Actions\Action; use Filament\Infolists\Components\Group; use Filament\Infolists\Components\Section; use Filament\Infolists\Components\TextEntry; @@ -44,10 +44,8 @@ public function infolist(Infolist $infolist): Infolist ->columns() ->maxWidth('3xl') ->headerActions([ - Action::make('edit') - ->label(__('general.action.edit')) - ->url(self::$resource::getUrl('edit', ['record' => $this->getRecord()])) - ->link(), + EditAction::make() + ->url(self::$resource::getUrl('edit', ['record' => $this->getRecord()])), ]) ->schema([ diff --git a/app/Infolists/Components/Actions/Edit.php b/app/Infolists/Components/Actions/EditAction.php similarity index 85% rename from app/Infolists/Components/Actions/Edit.php rename to app/Infolists/Components/Actions/EditAction.php index dad0cc62..0f7355c3 100644 --- a/app/Infolists/Components/Actions/Edit.php +++ b/app/Infolists/Components/Actions/EditAction.php @@ -7,7 +7,7 @@ use App\Concerns\HasModalExtraFooterActionsAlignment; use Filament\Infolists\Components\Actions\Action; -class Edit extends Action +class EditAction extends Action { use HasModalExtraFooterActionsAlignment; @@ -21,6 +21,7 @@ protected function setUp(): void parent::setUp(); $this->label(__('general.action.edit')); + $this->icon('heroicon-o-pencil-square'); $this->link(); } From 89c6e17c4d8350b139c38d0c9ff41a7fd0b79a4e Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 17:07:00 +0200 Subject: [PATCH 06/13] Table EditAction --- .../RelationManagers/UsersRelationManager.php | 3 +- .../Admin/Resources/ResultResource.php | 5 +-- app/Filament/Admin/Resources/RoleResource.php | 5 +-- app/Filament/Admin/Resources/UserResource.php | 3 +- .../BeneficiaryInterventionResource.php | 3 +- .../Widgets/ListSpecialistsWidget.php | 5 +-- .../Widgets/BenefitsWidget.php | 1 - .../Widgets/ResultsWidget.php | 1 - .../Resources/InterventionServiceResource.php | 37 ------------------- .../Widgets/ServiceDescriptionWidget.php | 8 +--- .../Resources/MonitoringResource.php | 26 ------------- app/Tables/Actions/EditAction.php | 8 ++++ lang/ro/beneficiary.php | 1 - lang/ro/intervention_plan.php | 1 - lang/ro/nomenclature.php | 1 - 15 files changed, 22 insertions(+), 86 deletions(-) diff --git a/app/Filament/Admin/Resources/OrganizationResource/RelationManagers/UsersRelationManager.php b/app/Filament/Admin/Resources/OrganizationResource/RelationManagers/UsersRelationManager.php index 56b3823b..355854e4 100644 --- a/app/Filament/Admin/Resources/OrganizationResource/RelationManagers/UsersRelationManager.php +++ b/app/Filament/Admin/Resources/OrganizationResource/RelationManagers/UsersRelationManager.php @@ -4,6 +4,7 @@ namespace App\Filament\Admin\Resources\OrganizationResource\RelationManagers; +use App\Tables\Actions\EditAction; use Filament\Forms; use Filament\Forms\Form; use Filament\Resources\RelationManagers\RelationManager; @@ -52,7 +53,7 @@ public function table(Table $table): Table Tables\Actions\CreateAction::make(), ]) ->actions([ - Tables\Actions\EditAction::make(), + EditAction::make(), Tables\Actions\DeleteAction::make(), ]) ->bulkActions([ diff --git a/app/Filament/Admin/Resources/ResultResource.php b/app/Filament/Admin/Resources/ResultResource.php index d7961773..a501dce3 100644 --- a/app/Filament/Admin/Resources/ResultResource.php +++ b/app/Filament/Admin/Resources/ResultResource.php @@ -7,12 +7,12 @@ use App\Enums\GeneralStatus; use App\Filament\Admin\Resources\ResultResource\Pages; use App\Models\Result; +use App\Tables\Actions\EditAction; use App\Tables\Filters\SelectFilter; use Filament\Forms\Components\Section; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Resources\Resource; -use Filament\Tables; use Filament\Tables\Actions\CreateAction; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -66,8 +66,7 @@ public static function table(Table $table): Table ->options(GeneralStatus::options()), ]) ->actions([ - Tables\Actions\EditAction::make() - ->label(__('general.action.change')), + EditAction::make(), ]) ->emptyStateHeading(__('nomenclature.headings.empty_state_results_table')) ->emptyStateDescription(null) diff --git a/app/Filament/Admin/Resources/RoleResource.php b/app/Filament/Admin/Resources/RoleResource.php index 9609cef5..859dcd05 100644 --- a/app/Filament/Admin/Resources/RoleResource.php +++ b/app/Filament/Admin/Resources/RoleResource.php @@ -10,6 +10,7 @@ use App\Filament\Admin\Resources\RoleResource\Pages; use App\Forms\Components\Spacer; use App\Models\Role; +use App\Tables\Actions\EditAction; use Filament\Forms\Components\CheckboxList; use Filament\Forms\Components\Placeholder; use Filament\Forms\Components\Section; @@ -17,7 +18,6 @@ use Filament\Forms\Components\Toggle; use Filament\Forms\Form; use Filament\Resources\Resource; -use Filament\Tables; use Filament\Tables\Actions\CreateAction; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Filters\SelectFilter; @@ -106,8 +106,7 @@ public static function table(Table $table): Table ->options(GeneralStatus::options()), ]) ->actions([ - Tables\Actions\EditAction::make() - ->label(__('nomenclature.actions.edit')), + EditAction::make(), ]) ->emptyStateHeading(__('nomenclature.labels.empty_state_role_table')) ->emptyStateDescription(null) diff --git a/app/Filament/Admin/Resources/UserResource.php b/app/Filament/Admin/Resources/UserResource.php index b4d6a90a..021f314d 100644 --- a/app/Filament/Admin/Resources/UserResource.php +++ b/app/Filament/Admin/Resources/UserResource.php @@ -7,6 +7,7 @@ use App\Filament\Admin\Resources\UserResource\Pages; use App\Forms\Components\Select; use App\Models\User; +use App\Tables\Actions\EditAction; use Filament\Forms\Components\Radio; use Filament\Forms\Components\Section; use Filament\Forms\Components\TextInput; @@ -126,7 +127,7 @@ public static function table(Table $table): Table ->multiple(), ]) ->actions([ - Tables\Actions\EditAction::make(), + EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ diff --git a/app/Filament/Organizations/Resources/BeneficiaryInterventionResource.php b/app/Filament/Organizations/Resources/BeneficiaryInterventionResource.php index b865abee..c48d1e6f 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryInterventionResource.php +++ b/app/Filament/Organizations/Resources/BeneficiaryInterventionResource.php @@ -11,6 +11,7 @@ use App\Models\BeneficiaryIntervention; use App\Models\InterventionService; use App\Models\OrganizationServiceIntervention; +use App\Tables\Actions\EditAction; use Filament\Forms\Components\Grid; use Filament\Forms\Components\Group; use Filament\Forms\Components\Section; @@ -127,7 +128,7 @@ public static function table(Table $table): Table // ]) ->actions([ - Tables\Actions\EditAction::make(), + EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Widgets/ListSpecialistsWidget.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Widgets/ListSpecialistsWidget.php index 9bf65eae..ab827b87 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Widgets/ListSpecialistsWidget.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Widgets/ListSpecialistsWidget.php @@ -63,13 +63,12 @@ public function table(Table $table): Table EditAction::make() ->form($this->getFormSchema()) ->fillForm(function (Specialist $record) { - if (!$record->role_id) { + if (! $record->role_id) { $record->role_id = -1; } return $record->toArray(); }) - ->label(__('beneficiary.section.specialists.change_action')) ->modalHeading(__('beneficiary.section.specialists.heading.edit_modal')) ->extraModalFooterActions([ DeleteAction::make() @@ -128,7 +127,7 @@ public function getFormSchema(): array ->label(__('beneficiary.section.specialists.labels.name')) ->options( function (Get $get, $state) { - $roleID = (int)$get('role_id'); + $roleID = (int) $get('role_id'); if ($roleID === -1) { if ($state) { return [$state => User::find($state)->full_name]; diff --git a/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/BenefitsWidget.php b/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/BenefitsWidget.php index 07825311..0d29e85b 100644 --- a/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/BenefitsWidget.php +++ b/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/BenefitsWidget.php @@ -59,7 +59,6 @@ public function table(Table $table): Table ]) ->actions([ EditAction::make() - ->label(__('intervention_plan.actions.edit')) ->form($this->getBenefitSchema()) ->extraModalFooterActions([ DeleteAction::make() diff --git a/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/ResultsWidget.php b/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/ResultsWidget.php index dfdf2d7e..66c9ce3f 100644 --- a/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/ResultsWidget.php +++ b/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/ResultsWidget.php @@ -75,7 +75,6 @@ public function table(Table $table): Table ]) ->actions([ EditAction::make() - ->label(__('general.action.change')) ->form($this->getFormSchema()) ->modalHeading(__('intervention_plan.headings.edit_result')) ->extraModalFooterActions([ diff --git a/app/Filament/Organizations/Resources/InterventionServiceResource.php b/app/Filament/Organizations/Resources/InterventionServiceResource.php index 45e4f329..c3a28ce6 100644 --- a/app/Filament/Organizations/Resources/InterventionServiceResource.php +++ b/app/Filament/Organizations/Resources/InterventionServiceResource.php @@ -10,10 +10,7 @@ use App\Filament\Organizations\Resources\BeneficiaryInterventionResource\Pages\ViewUnfoldedMeetings; use App\Filament\Organizations\Resources\InterventionServiceResource\Pages; use App\Models\InterventionService; -use Filament\Forms\Form; use Filament\Resources\Resource; -use Filament\Tables; -use Filament\Tables\Table; class InterventionServiceResource extends Resource { @@ -23,40 +20,6 @@ class InterventionServiceResource extends Resource public static string $parentResource = InterventionPlanResource::class; - public static function form(Form $form): Form - { - return $form - ->schema([ - - ]); - } - - public static function table(Table $table): Table - { - return $table - ->columns([ - // - ]) - ->filters([ - // - ]) - ->actions([ - Tables\Actions\EditAction::make(), - ]) - ->bulkActions([ - Tables\Actions\BulkActionGroup::make([ - Tables\Actions\DeleteBulkAction::make(), - ]), - ]); - } - - public static function getRelations(): array - { - return [ - // - ]; - } - public static function getPages(): array { return [ diff --git a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/ServiceDescriptionWidget.php b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/ServiceDescriptionWidget.php index 2f89bbb5..02790080 100644 --- a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/ServiceDescriptionWidget.php +++ b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/ServiceDescriptionWidget.php @@ -5,10 +5,9 @@ namespace App\Filament\Organizations\Resources\InterventionServiceResource\Widgets; use App\Filament\Organizations\Resources\InterventionPlanResource; +use App\Infolists\Components\Actions\EditAction; use App\Models\InterventionService; use App\Widgets\InfolistWidget; -use Filament\Infolists\Components\Actions\Action; -//use Filament\Actions\Action; use Filament\Infolists\Components\Section; use Filament\Infolists\Components\TextEntry; @@ -28,10 +27,7 @@ protected function getInfolistSchema(): array ->maxWidth('3xl') ->columns() ->headerActions([ - Action::make('edit') - ->label(__('intervention_plan.actions.edit')) - ->icon('heroicon-o-pencil') - ->link() + EditAction::make('edit') ->url(InterventionPlanResource::getUrl('edit_intervention_service', [ 'parent' => $this->record->interventionPlan, 'record' => $this->record, diff --git a/app/Filament/Organizations/Resources/MonitoringResource.php b/app/Filament/Organizations/Resources/MonitoringResource.php index 62ef05e8..439ee179 100644 --- a/app/Filament/Organizations/Resources/MonitoringResource.php +++ b/app/Filament/Organizations/Resources/MonitoringResource.php @@ -25,30 +25,4 @@ public static function getRecordTitle(Model|null $record): string|null|Htmlable return $record->number; } - public static function form(Form $form): Form - { - return $form - ->schema([ - // - ]); - } - - public static function table(Table $table): Table - { - return $table - ->columns([ - // - ]) - ->filters([ - // - ]) - ->actions([ - Tables\Actions\EditAction::make(), - ]) - ->bulkActions([ - Tables\Actions\BulkActionGroup::make([ - Tables\Actions\DeleteBulkAction::make(), - ]), - ]); - } } diff --git a/app/Tables/Actions/EditAction.php b/app/Tables/Actions/EditAction.php index c8fbf262..05ec3d4a 100644 --- a/app/Tables/Actions/EditAction.php +++ b/app/Tables/Actions/EditAction.php @@ -10,4 +10,12 @@ class EditAction extends BaseEditAction { use HasModalExtraFooterActionsAlignment; + + protected function setUp(): void + { + parent::setUp(); + + $this->label(__('general.action.change')); + $this->icon(null); + } } diff --git a/lang/ro/beneficiary.php b/lang/ro/beneficiary.php index 67d468eb..2b3e298d 100644 --- a/lang/ro/beneficiary.php +++ b/lang/ro/beneficiary.php @@ -311,7 +311,6 @@ 'specialists' => [ 'title' => 'Echipa de caz', 'add_action' => 'Adaugă membru echipă', - 'change_action' => 'Modifică', 'heading' => [ 'add_modal' => 'Adaugă membru în echipă', 'edit_modal' => 'Modifică membru în echipă', diff --git a/lang/ro/intervention_plan.php b/lang/ro/intervention_plan.php index 8ce307b9..56d2ba90 100644 --- a/lang/ro/intervention_plan.php +++ b/lang/ro/intervention_plan.php @@ -253,7 +253,6 @@ 'actions' => [ 'create' => 'Creează plan', - 'edit' => 'Editează', 'edit_intervention_plan' => 'Actualizează detalii', 'add_service' => 'Adaugă serviciu', 'add_service_repeater' => 'Adaugă încă un serviciu', diff --git a/lang/ro/nomenclature.php b/lang/ro/nomenclature.php index d752a62a..2b74e9c6 100644 --- a/lang/ro/nomenclature.php +++ b/lang/ro/nomenclature.php @@ -83,7 +83,6 @@ 'add_role' => 'Adaugă rol specialist', 'edit_role' => 'Modifică rol specialist', 'delete_role' => 'Șterge rol', - 'edit' => 'Modifică', 'add_benefit' => 'Adaugă beneficiu social', 'add_benefit_type' => 'Adaugă încă un tip', 'edit_benefit' => 'Modifică beneficiu', From 3ec7bf3ecc7d05543fa071515d529ae27f8f8a22 Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 17:16:15 +0200 Subject: [PATCH 07/13] min --- .../Pages/ViewBeneficiaryPersonalInformation.php | 8 ++++---- .../Widgets/CounselingSheetWidget.php | 2 +- .../Widgets/ServiceDescriptionWidget.php | 2 +- .../Organizations/Resources/MonitoringResource.php | 4 ---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryPersonalInformation.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryPersonalInformation.php index 656d449e..00bb1c46 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryPersonalInformation.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/ViewBeneficiaryPersonalInformation.php @@ -91,7 +91,7 @@ protected static function beneficiarySection(): array ->columns() ->relationship('details') ->headerActions([ - EditAction::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl('edit_personal_information', ['record' => $record])), ]) ->extraAttributes([ @@ -240,7 +240,7 @@ protected static function aggressorSection(): array Section::make(__('beneficiary.section.personal_information.section.aggressor')) ->columns() ->headerActions([ - EditAction::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl('edit_aggressor', ['record' => $record])), ]) ->extraAttributes([ @@ -360,7 +360,7 @@ protected static function antecedentsSection(): array ->columns() ->relationship('antecedents') ->headerActions([ - EditAction::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl('edit_antecedents', ['record' => $record])), ]) ->extraAttributes([ @@ -404,7 +404,7 @@ protected static function flowSection(): array ->columns() ->relationship('flowPresentation') ->headerActions([ - EditAction::make('edit') + EditAction::make() ->url(fn ($record) => BeneficiaryResource::getUrl('edit_flow_presentation', ['record' => $record])), ]) ->extraAttributes([ diff --git a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php index 0483cf44..e4465170 100644 --- a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php +++ b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php @@ -78,7 +78,7 @@ protected function getInfoListSchema(): array SectionHeader::make('counseling_sheet') ->state(__('intervention_plan.headings.counseling_sheet')) ->action( - EditAction::make('view') + EditAction::make() ->url(InterventionPlanResource::getUrl( 'edit_counseling_sheet', [ diff --git a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/ServiceDescriptionWidget.php b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/ServiceDescriptionWidget.php index 02790080..f3f2e254 100644 --- a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/ServiceDescriptionWidget.php +++ b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/ServiceDescriptionWidget.php @@ -27,7 +27,7 @@ protected function getInfolistSchema(): array ->maxWidth('3xl') ->columns() ->headerActions([ - EditAction::make('edit') + EditAction::make() ->url(InterventionPlanResource::getUrl('edit_intervention_service', [ 'parent' => $this->record->interventionPlan, 'record' => $this->record, diff --git a/app/Filament/Organizations/Resources/MonitoringResource.php b/app/Filament/Organizations/Resources/MonitoringResource.php index 439ee179..5d33cadd 100644 --- a/app/Filament/Organizations/Resources/MonitoringResource.php +++ b/app/Filament/Organizations/Resources/MonitoringResource.php @@ -5,10 +5,7 @@ namespace App\Filament\Organizations\Resources; use App\Models\Monitoring; -use Filament\Forms\Form; use Filament\Resources\Resource; -use Filament\Tables; -use Filament\Tables\Table; use Illuminate\Contracts\Support\Htmlable; use Illuminate\Database\Eloquent\Model; @@ -24,5 +21,4 @@ public static function getRecordTitle(Model|null $record): string|null|Htmlable { return $record->number; } - } From 70bafeacb8652ef5e942fa1ecd3831b152eed688 Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 19:20:32 +0200 Subject: [PATCH 08/13] Action - labels --- .../BeneficiaryResource/Pages/CreateBeneficiary.php | 9 ++++++--- .../Resources/UserResource/Pages/CreateUser.php | 7 +++++++ .../Resources/UserResource/Pages/ListUsers.php | 3 ++- lang/ro/general.php | 5 +++-- lang/ro/user.php | 1 + 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php index d7ef66dc..a8ab1a34 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php @@ -93,7 +93,10 @@ public function form(Form $form): Form ]) ->startOnStep($this->getStartStep()) ->cancelAction($this->getCancelFormAction()) - ->submitAction($this->getSubmitFormAction()) + ->submitAction( + $this->getSubmitFormAction() + ->label(__('general.action.finish')) + ) ->skippable($this->hasSkippableSteps()), ]) ->columns(null); @@ -371,8 +374,8 @@ protected function getSteps(): array return $roles; }) ->disableOptionWhen(fn (Get $get, string $value) => $value === '-1' ? - array_diff($get('roles'), ['-1']): - in_array('-1', $get('roles'))) + array_diff($get('roles'), ['-1']) : + \in_array('-1', $get('roles'))) ->live(), ]), ]), diff --git a/app/Filament/Organizations/Resources/UserResource/Pages/CreateUser.php b/app/Filament/Organizations/Resources/UserResource/Pages/CreateUser.php index d37979d7..b833f9a7 100644 --- a/app/Filament/Organizations/Resources/UserResource/Pages/CreateUser.php +++ b/app/Filament/Organizations/Resources/UserResource/Pages/CreateUser.php @@ -9,6 +9,7 @@ use App\Concerns\PreventSubmitFormOnEnter; use App\Filament\Organizations\Resources\UserResource; use App\Models\User; +use Filament\Actions\Action; use Filament\Facades\Filament; use Filament\Resources\Pages\CreateRecord; use Illuminate\Contracts\Support\Htmlable; @@ -36,6 +37,12 @@ protected function getHeaderActions(): array ]; } + protected function getCreateFormAction(): Action + { + return parent::getCreateFormAction() + ->label(__('user.actions.add_specialist')); + } + protected function afterSave(): void { /** @var User $user */ diff --git a/app/Filament/Organizations/Resources/UserResource/Pages/ListUsers.php b/app/Filament/Organizations/Resources/UserResource/Pages/ListUsers.php index 236f8830..e79e42d6 100644 --- a/app/Filament/Organizations/Resources/UserResource/Pages/ListUsers.php +++ b/app/Filament/Organizations/Resources/UserResource/Pages/ListUsers.php @@ -15,7 +15,8 @@ class ListUsers extends ListRecords protected function getHeaderActions(): array { return [ - Actions\CreateAction::make(), + Actions\CreateAction::make() + ->label(__('user.actions.add_specialist')), ]; } diff --git a/lang/ro/general.php b/lang/ro/general.php index 95852a2b..383dc486 100644 --- a/lang/ro/general.php +++ b/lang/ro/general.php @@ -15,6 +15,7 @@ 'delete' => 'Șterge', 'view_observations' => 'Vezi observații', 'change' => 'Modifică', + 'finish' => 'Finalizează', ], 'filters' => [ @@ -35,6 +36,6 @@ ], 'placeholders' => [ - 'date' => 'zz-ll-aaaa' - ] + 'date' => 'zz-ll-aaaa', + ], ]; diff --git a/lang/ro/user.php b/lang/ro/user.php index 0b88b5de..f101cd00 100644 --- a/lang/ro/user.php +++ b/lang/ro/user.php @@ -64,6 +64,7 @@ 'reset_password' => 'Resetează parola', 'resend_invitation' => 'Retrimite invitația', 'activate' => 'Reactivează cont', + 'add_specialist' => 'Adaugă specialist', ], 'action_resend_invitation_confirm' => [ From ff3f4b5c6f58413b0229bcdc785cf35225dcedbb Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 21:42:11 +0200 Subject: [PATCH 09/13] Dashboard heading --- app/Filament/Organizations/Pages/Dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Filament/Organizations/Pages/Dashboard.php b/app/Filament/Organizations/Pages/Dashboard.php index 8113f623..00b08810 100644 --- a/app/Filament/Organizations/Pages/Dashboard.php +++ b/app/Filament/Organizations/Pages/Dashboard.php @@ -12,7 +12,7 @@ class Dashboard extends BaseDashboard public function getHeading(): string | Htmlable { return __('dashboard.welcome', [ - 'name' => auth()->user()->first_name, + 'name' => auth()->user()->last_name, ]); } From 56a34673a4b8f13a5f89b3d34c3a2e325edda50e Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 22:52:01 +0200 Subject: [PATCH 10/13] add fields for risk factors --- .../InitialEvaluation/EditRiskFactors.php | 48 +++++++++++++++---- app/Models/RiskFactors.php | 23 ++++++++- lang/ro/beneficiary.php | 2 + 3 files changed, 63 insertions(+), 10 deletions(-) diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/EditRiskFactors.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/EditRiskFactors.php index b41b034c..66fb953e 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/EditRiskFactors.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/EditRiskFactors.php @@ -17,11 +17,13 @@ use App\Infolists\Components\EnumEntry; use App\Models\Beneficiary; use App\Services\Breadcrumb\BeneficiaryBreadcrumb; +use Filament\Forms\Components\Checkbox; use Filament\Forms\Components\Group; use Filament\Forms\Components\Radio; use Filament\Forms\Components\Section; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; +use Filament\Forms\Get; use Filament\Infolists\Components\Group as InfolistGroup; use Filament\Infolists\Components\Section as InfolistSection; use Filament\Infolists\Components\TextEntry; @@ -117,14 +119,32 @@ public static function getAggravatingFactorsSchema(): array public static function getSocialSupportSchema(): array { return [ - Select::make('extended_family_can_provide') - ->label(__('beneficiary.section.initial_evaluation.labels.extended_family_can_provide')) - ->multiple() - ->options(Helps::options()), - Select::make('friends_can_provide') - ->label(__('beneficiary.section.initial_evaluation.labels.friends_can_provide')) - ->multiple() - ->options(Helps::options()), + Group::make() + ->schema([ + Select::make('extended_family_can_provide') + ->label(__('beneficiary.section.initial_evaluation.labels.extended_family_can_provide')) + ->multiple() + ->options(Helps::options()) + ->disabled(fn (Get $get) => $get('extended_family_can_not_provide')), + + Checkbox::make('extended_family_can_not_provide') + ->label(__('beneficiary.section.initial_evaluation.labels.extended_family_can_not_provide')) + ->live(), + ]), + + Group::make() + ->schema([ + Select::make('friends_can_provide') + ->label(__('beneficiary.section.initial_evaluation.labels.friends_can_provide')) + ->multiple() + ->options(Helps::options()) + ->disabled(fn (Get $get) => $get('friends_can_not_provide')), + + Checkbox::make('friends_can_not_provide') + ->label(__('beneficiary.section.initial_evaluation.labels.friends_can_not_provide')) + ->live(), + ]), + ]; } @@ -197,10 +217,22 @@ public static function getSocialSupportInfolistSchema(): array return [ EnumEntry::make('extended_family_can_provide') ->label(__('beneficiary.section.initial_evaluation.labels.extended_family_can_provide')) + ->formatStateUsing( + fn (Beneficiary $record, $state) => $record->riskFactors->extended_family_can_not_provide ? + __('beneficiary.section.initial_evaluation.labels.extended_family_can_not_provide') : + $state + ) ->badge(), + EnumEntry::make('friends_can_provide') ->label(__('beneficiary.section.initial_evaluation.labels.friends_can_provide')) + ->formatStateUsing( + fn (Beneficiary $record, $state) => $record->riskFactors->friends_can_not_provide ? + __('beneficiary.section.initial_evaluation.labels.friends_can_not_provide') : + $state + ) ->badge(), + ]; } diff --git a/app/Models/RiskFactors.php b/app/Models/RiskFactors.php index f487d478..44d1bc89 100644 --- a/app/Models/RiskFactors.php +++ b/app/Models/RiskFactors.php @@ -24,7 +24,9 @@ class RiskFactors extends Model protected $fillable = [ 'risk_factors', 'extended_family_can_provide', + 'extended_family_can_not_provide', 'friends_can_provide', + 'friends_can_not_provide', 'risk_level', ]; @@ -38,9 +40,26 @@ class RiskFactors extends Model protected static function boot() { parent::boot(); - self::creating(fn (RiskFactors $model) => self::calculateRiskLevel($model)); + self::creating(function (RiskFactors $model) { + self::formatSocialSupport($model); + self::calculateRiskLevel($model); + }); + + self::updating(function (RiskFactors $model) { + self::formatSocialSupport($model); + self::calculateRiskLevel($model); + }); + } - self::updating(fn (RiskFactors $model) => self::calculateRiskLevel($model)); + public static function formatSocialSupport(self $model): void + { + if ($model->extended_family_can_not_provide) { + $model->extended_family_can_provide = []; + } + + if ($model->friends_can_not_provide) { + $model->friends_can_provide = []; + } } public static function calculateRiskLevel(self $model): void diff --git a/lang/ro/beneficiary.php b/lang/ro/beneficiary.php index 67d468eb..5aad5f8a 100644 --- a/lang/ro/beneficiary.php +++ b/lang/ro/beneficiary.php @@ -240,7 +240,9 @@ 'domestic_violence_during_pregnancy' => '23. Au existat acte de violență domestică în timpul sarcinii?', 'extended_family_can_provide' => '24. Familia extinsă poate oferi', + 'extended_family_can_not_provide' => 'Familia extinsă nu poate oferi suport social', 'friends_can_provide' => '25. Vecinii/ prietenii pot oferi', + 'friends_can_not_provide' => 'Vecinii/ prietenii nu pot oferi suport social', 'moment_of_evaluation' => 'Momentul evaluării situației', 'description_of_situation' => 'A se include și situația juridică - acțiuni în instanță, situația socio-familială, situația medicală actuală):', From e484f5e9ecf63527c2df3e1e2c11d05b1e292a47 Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Mon, 30 Dec 2024 22:52:45 +0200 Subject: [PATCH 11/13] migration --- ...195954_add_fields_in_risk_factors_table.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 database/migrations/2024_12_30_195954_add_fields_in_risk_factors_table.php diff --git a/database/migrations/2024_12_30_195954_add_fields_in_risk_factors_table.php b/database/migrations/2024_12_30_195954_add_fields_in_risk_factors_table.php new file mode 100644 index 00000000..050383c6 --- /dev/null +++ b/database/migrations/2024_12_30_195954_add_fields_in_risk_factors_table.php @@ -0,0 +1,18 @@ +boolean('extended_family_can_not_provide')->nullable(); + $table->boolean('friends_can_not_provide')->nullable(); + }); + } +}; From 72653369438f1482973db0ba54d526605712f3c5 Mon Sep 17 00:00:00 2001 From: Lupu Gheorghe Date: Tue, 31 Dec 2024 12:37:22 +0200 Subject: [PATCH 12/13] fix fise --- app/Enums/AllowancePerson.php | 24 ++++ app/Enums/FileDocumentType.php | 2 + app/Enums/PaymentMethod.php | 2 - .../Pages/EditCounselingSheet.php | 134 ++++++++++-------- .../Widgets/CounselingSheetWidget.php | 16 +-- app/Http/Middleware/EnsureUserIsActive.php | 1 + lang/ro/enum.php | 9 +- lang/ro/intervention_plan.php | 35 ++++- 8 files changed, 148 insertions(+), 75 deletions(-) create mode 100644 app/Enums/AllowancePerson.php diff --git a/app/Enums/AllowancePerson.php b/app/Enums/AllowancePerson.php new file mode 100644 index 00000000..26b03e62 --- /dev/null +++ b/app/Enums/AllowancePerson.php @@ -0,0 +1,24 @@ +schema([ Select::make('data.patrimony') ->label(__('intervention_plan.labels.patrimony')) + ->placeholder(__('intervention_plan.placeholders.juridic_file.chose_option')) ->options(Patrimony::options()), Select::make('data.possession_mode') ->label(__('intervention_plan.labels.possession_mode')) ->options(PossessionMode::options()) + ->placeholder(__('intervention_plan.placeholders.juridic_file.chose_option')) ->live(), Textarea::make('data.possession_observation') @@ -128,29 +131,29 @@ public static function getLegalAssistanceForm(): array ->schema([ Group::make() ->schema([ - CheckboxList::make('data.original_documents') - ->label(__('intervention_plan.labels.original_documents')) + CheckboxList::make('data.copy_documents') + ->label(__('intervention_plan.labels.copy_documents')) ->options(FileDocumentType::options()) ->live(), - Textarea::make('data.original_documents_observation') - ->label(__('intervention_plan.labels.original_documents_observation')) + Textarea::make('data.copy_documents_observation') + ->label(__('intervention_plan.labels.copy_documents_observation')) ->maxLength(100) - ->visible(fn (Get $get) => \in_array(FileDocumentType::OTHER->value, $get('data.original_documents'))), + ->visible(fn (Get $get) => \in_array(FileDocumentType::OTHER->value, $get('data.copy_documents'))), ]), - Group::make() ->schema([ - CheckboxList::make('data.copy_documents') - ->label(__('intervention_plan.labels.copy_documents')) + CheckboxList::make('data.original_documents') + ->label(__('intervention_plan.labels.original_documents')) ->options(FileDocumentType::options()) ->live(), - Textarea::make('data.copy_documents_observation') - ->label(__('intervention_plan.labels.copy_documents_observation')) + Textarea::make('data.original_documents_observation') + ->label(__('intervention_plan.labels.original_documents_observation')) ->maxLength(100) - ->visible(fn (Get $get) => \in_array(FileDocumentType::OTHER->value, $get('data.copy_documents'))), + ->visible(fn (Get $get) => \in_array(FileDocumentType::OTHER->value, $get('data.original_documents'))), ]), + ]), Section::make(__('intervention_plan.headings.institution_contacted')) @@ -162,6 +165,7 @@ public static function getLegalAssistanceForm(): array ->schema([ TextInput::make('institution') ->label(__('intervention_plan.labels.responsible_institution')) + ->placeholder(__('intervention_plan.placeholders.juridic_file.responsible_institution')) ->maxLength(100), DatePicker::make('contact_date') @@ -169,11 +173,12 @@ public static function getLegalAssistanceForm(): array TextInput::make('phone') ->label(__('intervention_plan.labels.phone')) - ->tel() - ->maxLength(14), + ->placeholder(__('intervention_plan.placeholders.juridic_file.phone')) + ->maxLength(50), TextInput::make('contact_person') ->label(__('intervention_plan.labels.contact_person')) + ->placeholder(__('intervention_plan.placeholders.juridic_file.contact_person')) ->maxLength(100), ]), @@ -184,6 +189,7 @@ public static function getLegalAssistanceForm(): array ->schema([ RichEditor::make('data.observations') ->label(__('intervention_plan.labels.final_observation')) + ->placeholder(__('intervention_plan.placeholders.juridic_file.final_observation')) ->maxLength(2500) ->columnSpanFull(), ]), @@ -415,42 +421,42 @@ public static function getSchemaForSocialAssistance(?InterventionService $interv Select::make('relationship') ->label(__('intervention_plan.labels.relationship')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(FamilyRelationship::options()), TextInput::make('first_and_last_name') ->label(__('intervention_plan.labels.first_and_last_name')) - ->placeholder(__('intervention_plan.placeholders.first_and_last_name')) + ->placeholder(__('intervention_plan.placeholders.social_file.first_and_last_name')) ->maxLength(100), TextInput::make('age') ->label(__('intervention_plan.labels.age')) - ->placeholder(__('intervention_plan.placeholders.age')) + ->placeholder(__('intervention_plan.placeholders.social_file.age')) ->mask('999'), TextInput::make('locality') ->label(__('intervention_plan.labels.locality')) - ->placeholder(__('intervention_plan.placeholders.locality')) + ->placeholder(__('intervention_plan.placeholders.social_file.locality')) ->maxLength(100), TextInput::make('occupation') ->label(__('intervention_plan.labels.occupation')) - ->placeholder(__('intervention_plan.placeholders.occupation')) + ->placeholder(__('intervention_plan.placeholders.social_file.occupation')) ->maxLength(100), TextInput::make('relationship_observation') ->label(__('intervention_plan.labels.relationship_observation')) - ->placeholder(__('intervention_plan.placeholders.relationship_observation')) + ->placeholder(__('intervention_plan.placeholders.social_file.relationship_observation')) ->maxLength(250), Select::make('support') ->label(__('intervention_plan.labels.support')) - ->placeholder(__('intervention_plan.placeholders.support')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('support_observations') ->label(__('intervention_plan.labels.support_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.support_observations')) ->maxLength(250), ]), @@ -475,22 +481,22 @@ public static function getSchemaForSocialAssistance(?InterventionService $interv ->schema([ Select::make('relationship') ->label(__('intervention_plan.labels.relationship')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(SocialRelationship::options()), TextInput::make('full_name') ->label(__('intervention_plan.labels.person_or_group_name')) - ->placeholder(__('intervention_plan.placeholders.person_or_group_name')) + ->placeholder(__('intervention_plan.placeholders.social_file.person_or_group_name')) ->maxLength(200), Select::make('support') ->label(__('intervention_plan.labels.support')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('support_observations') ->label(__('intervention_plan.labels.support_observations')) - ->placeholder(__('intervention_plan.placeholders.support_observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.support_observations')) ->maxLength(250), ]), ]), @@ -502,27 +508,27 @@ public static function getSchemaForSocialAssistance(?InterventionService $interv ->schema([ Select::make('data.home_type') ->label(__('intervention_plan.labels.home_type')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(HomeType::options()), TextInput::make('data.rooms') ->label(__('intervention_plan.labels.rooms')) - ->placeholder(__('intervention_plan.placeholders.rooms')) + ->placeholder(__('intervention_plan.placeholders.social_file.rooms')) ->mask('999'), TextInput::make('data.peoples') ->label(__('intervention_plan.labels.peoples')) - ->placeholder(__('intervention_plan.placeholders.peoples')) + ->placeholder(__('intervention_plan.placeholders.social_file.peoples')) ->mask('999'), TextInput::make('data.utilities') ->label(__('intervention_plan.labels.utilities')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(250), Textarea::make('data.living_observations') ->label(__('intervention_plan.labels.living_observations')) - ->placeholder(__('intervention_plan.placeholders.add_details')) + ->placeholder(__('intervention_plan.placeholders.social_file.add_details')) ->columnSpanFull() ->maxLength(1000), ]), @@ -533,7 +539,7 @@ public static function getSchemaForSocialAssistance(?InterventionService $interv ->schema([ Textarea::make('data.professional_experience') ->label(__('intervention_plan.labels.professional_experience')) - ->placeholder(__('intervention_plan.placeholders.add_details')) + ->placeholder(__('intervention_plan.placeholders.social_file.add_details')) ->maxWidth('3xl') ->maxLength(1000), ]), @@ -623,34 +629,34 @@ public static function getSchemaForSocialAssistance(?InterventionService $interv ->schema([ Select::make('paternity_recognized') ->label(__('intervention_plan.labels.paternity_recognized')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), Select::make('another_person_care') ->label(__('intervention_plan.labels.another_person_care')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('quality_person') ->label(__('intervention_plan.labels.quality_person')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(100), Select::make('protection_measuring') ->label(__('intervention_plan.labels.protection_measuring')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()) ->live(), Select::make('protection_measuring_type') ->label(__('intervention_plan.labels.protection_measuring_type')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(ProtectionMeasuringType::options()) ->visible(fn (Get $get) => Ternary::isYes($get('protection_measuring'))), Select::make('establishment_year') ->label(__('intervention_plan.labels.establishment_year')) - ->placeholder(__('intervention_plan.placeholders.select_age')) + ->placeholder(__('intervention_plan.placeholders.social_file.select_age')) ->options(function () { $options = []; for ($year = date('Y'); $year >= 1900; $year--) { @@ -668,13 +674,19 @@ public static function getSchemaForSocialAssistance(?InterventionService $interv ->schema([ Select::make('allowance') ->label(__('intervention_plan.labels.allowance')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()) ->live(), + Select::make('allowance_person') + ->label(__('intervention_plan.labels.allowance_person')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) + ->options(AllowancePerson::options()) + ->visible(fn (Get $get) => Ternary::isYes($get('allowance'))), + Select::make('payment_method') ->label(__('intervention_plan.labels.payment_method')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(PaymentMethod::options()) ->visible(fn (Get $get) => Ternary::isYes($get('allowance'))), ]), @@ -684,28 +696,28 @@ public static function getSchemaForSocialAssistance(?InterventionService $interv ->schema([ Select::make('family_medic') ->label(__('intervention_plan.labels.family_medic')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('family_doctor_contact') ->label(__('intervention_plan.labels.family_doctor_contact')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(100), TextInput::make('health_status') ->label(__('intervention_plan.labels.health_status')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(250), ]), TextInput::make('school_coordinator') ->label(__('intervention_plan.labels.school_coordinator')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(500), Textarea::make('relationship_details') ->label(__('intervention_plan.labels.relationship_details')) - ->placeholder(__('intervention_plan.placeholders.add_details')) + ->placeholder(__('intervention_plan.placeholders.social_file.add_details')) ->maxWidth('3xl') ->maxLength(1000), ]), @@ -717,87 +729,87 @@ public static function getSchemaForSocialAssistance(?InterventionService $interv ->schema([ Select::make('data.communication') ->label(__('intervention_plan.labels.communication')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('data.communication_observations') ->label(__('intervention_plan.labels.communication_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(100), Select::make('data.socialization') ->label(__('intervention_plan.labels.socialization')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('data.socialization_observations') ->label(__('intervention_plan.labels.socialization_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(100), Select::make('data.rules_compliance') ->label(__('intervention_plan.labels.rules_compliance')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('data.rules_compliance_observations') ->label(__('intervention_plan.labels.rules_compliance_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(100), Select::make('data.participation_in_individual_counseling') ->label(__('intervention_plan.labels.participation_in_individual_counseling')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('data.participation_in_individual_counseling_observations') ->label(__('intervention_plan.labels.participation_in_individual_counseling_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(100), Select::make('data.participation_in_joint_activities') ->label(__('intervention_plan.labels.participation_in_joint_activities')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('data.participation_in_joint_activities_observations') ->label(__('intervention_plan.labels.participation_in_joint_activities_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(100), Select::make('data.self_management') ->label(__('intervention_plan.labels.self_management')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('data.self_management_observations') ->label(__('intervention_plan.labels.self_management_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(100), Select::make('data.addictive_behavior') ->label(__('intervention_plan.labels.addictive_behavior')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('data.addictive_behavior_observations') ->label(__('intervention_plan.labels.addictive_behavior_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(100), Select::make('data.financial_education') ->label(__('intervention_plan.labels.financial_education')) - ->placeholder(__('intervention_plan.placeholders.select')) + ->placeholder(__('intervention_plan.placeholders.social_file.select')) ->options(Ternary::options()), TextInput::make('data.financial_education_observations') ->label(__('intervention_plan.labels.financial_education_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->maxLength(100), Textarea::make('data.integration_and_participation_in_social_service_observations') ->label(__('intervention_plan.labels.integration_and_participation_in_social_service_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')) + ->placeholder(__('intervention_plan.placeholders.social_file.observations')) ->columnSpanFull() ->maxLength(1000), ]), diff --git a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php index e4465170..89d5d511 100644 --- a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php +++ b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php @@ -110,6 +110,14 @@ private function getSchemaForLegalAssistance(): array Section::make(__('intervention_plan.headings.file_documents')) ->columns() ->schema([ + Group::make() + ->schema([ + EnumEntry::make('data.copy_documents') + ->label(__('intervention_plan.labels.copy_documents')) + ->enumClass(FileDocumentType::class), + TextEntry::make('data.copy_documents_observation') + ->label(__('intervention_plan.labels.copy_documents_observation')), + ]), Group::make() ->schema([ EnumEntry::make('data.original_documents') @@ -119,14 +127,6 @@ private function getSchemaForLegalAssistance(): array ->label(__('intervention_plan.labels.original_documents_observation')), ]), - Group::make() - ->schema([ - EnumEntry::make('data.copy_documents') - ->label(__('intervention_plan.labels.copy_documents')) - ->enumClass(FileDocumentType::class), - TextEntry::make('data.copy_documents_observation') - ->label(__('intervention_plan.labels.copy_documents_observation')), - ]), ]), Section::make(__('intervention_plan.headings.institution_contacted')) diff --git a/app/Http/Middleware/EnsureUserIsActive.php b/app/Http/Middleware/EnsureUserIsActive.php index 804f9d69..66117685 100644 --- a/app/Http/Middleware/EnsureUserIsActive.php +++ b/app/Http/Middleware/EnsureUserIsActive.php @@ -39,6 +39,7 @@ public function handle(Request $request, Closure $next): Response ) ->first(); +// dd($activeOrganization); if ($activeOrganization) { auth()->user()->update(['latest_organization_id' => $activeOrganization->organization_id]); diff --git a/lang/ro/enum.php b/lang/ro/enum.php index 6ed6799c..0f933952 100644 --- a/lang/ro/enum.php +++ b/lang/ro/enum.php @@ -423,8 +423,15 @@ 'rental_agreement' => 'Contract închiriere', 'sale_purchase_agreement' => 'Contract vânzare-cumpărare', 'iml_certificate' => 'Certificat IML', + 'court_sentences' => 'Sentințe judecătorești', 'other' => 'Altele', ], + 'allowance_person' => [ + + 'beneficiary' => 'Beneficiara', + 'other' => 'Altǎ persoanǎ', + 'unknown' => 'Nu știe/ Nu răspunde', + ], 'protection_order' => [ 'temporary' => 'Provizoriu', @@ -476,7 +483,7 @@ 'deaf' => 'Surdocecitate', 'somatic' => 'Somatic', 'mental' => 'Mintal', - 'neuropsychic' => 'Neuropsihic', + 'neuropsychic' => 'Neuropsihic', 'hiv_aids' => 'HIV/SIDA', 'associate' => 'Asociat', 'rare_diseases' => 'Boli rare', diff --git a/lang/ro/intervention_plan.php b/lang/ro/intervention_plan.php index 56d2ba90..d7d825e8 100644 --- a/lang/ro/intervention_plan.php +++ b/lang/ro/intervention_plan.php @@ -37,7 +37,7 @@ 'copy_documents_observation' => 'Observații acte în copie depuse la dosar (altele)', 'institution' => 'Instituția', 'contact_date' => 'Data contactării', - 'phone' => 'Telefon', + 'phone' => 'Contact(telefon/email)', 'contact_person' => 'Persoana de contact', 'final_observation' => 'Observații finale evaluare', @@ -134,10 +134,11 @@ 'protection_measuring_type' => 'Tip măsură de protecție', 'establishment_year' => 'Anul instituirii', 'allowance' => 'Alocație de stat', + 'allowance_person' => 'Reprezentant alocație', 'payment_method' => 'Modalitate de plată', 'family_medic' => 'Medic de familie', 'family_doctor_contact' => 'Date de contact medic de familie', - 'health_status' => 'Stare de sănătate', + 'health_status' => 'Probleme de sănătate', 'school_coordinator' => 'Dacă este școlarizat, detalii învățător/diriginte', 'relationship_details' => 'Caracterizarea relației', 'communication' => 'Comunicare', @@ -190,7 +191,7 @@ 'patrimony_data' => 'Date patrimoniu', 'file_documents' => 'Acte depuse la dosar', 'final_observations' => 'Observații finale', - 'institution_contacted' => 'Instituții contactate', + 'institution_contacted' => 'Instituții contactate în baza planului de intervenție', 'medical_details' => 'Date medicale', 'history' => 'Istoric ', 'violence_forms' => 'Forme de violență', @@ -309,5 +310,33 @@ 'monthly_plan_observations' => 'Specifică observații', 'search_by_beneficiary_or_specialist' => 'Caută caz sau specialist', 'service_details' => 'Adaugă orice detalii relevante acordării intervenției sau intervențiilor', + 'juridic_file' => [ + 'chose_option' => 'Alege un rǎspuns', + 'responsible_institution' => 'Introdu o instituție', + 'contact_date' => 'Alege o dată', + 'phone' => 'Intordu date de contact ', + 'contact_person' => 'Introdu nume persoanǎ', + 'final_observation' => 'Adaugǎ detalii', + + ], + 'social_file' => [ + 'select' => 'Alege un răspuns', + 'first_and_last_name' => 'Introdu numele persoanei', + 'age' => 'Introdu vârsta', + 'locality' => 'Introdu localitatea', + 'occupation' => 'Introdu ocupația', + 'relationship_observation' => 'Specificați relația', + 'support_observations' => 'Specificați', + 'person_or_group_name' => 'Introdu numele sau denumirea', + 'rooms' => 'Total încăperi de locuit', + 'peoples' => 'Introdu un număr', + 'observations' => 'Specificați', + 'add_details' => 'Adaugă detalii', + 'select_age' => 'Alege un an', + + + + ], + ], ]; From d2bda7fe28589e672645d8f4f78253b302a85a75 Mon Sep 17 00:00:00 2001 From: Lupu Gheorghe Date: Tue, 31 Dec 2024 13:07:50 +0200 Subject: [PATCH 13/13] wip working session --- .../Organizations/Pages/ReportsPage.php | 59 +++++-------------- .../Pages/CloseFile/EditCloseFileDetails.php | 5 -- .../CloseFile/EditCloseFileGeneralDetails.php | 2 +- .../Pages/CloseFile/ViewCloseFile.php | 4 -- ...ditMonthlyPlanServicesAndInterventions.php | 5 +- .../Pages/ViewMonthlyPlan.php | 2 +- app/Models/CloseFile.php | 1 - database/factories/CloseFileFactory.php | 1 - ..._10_09_183227_create_close_files_table.php | 1 - lang/ro/beneficiary.php | 9 +-- lang/ro/intervention_plan.php | 3 +- 11 files changed, 27 insertions(+), 65 deletions(-) diff --git a/app/Filament/Organizations/Pages/ReportsPage.php b/app/Filament/Organizations/Pages/ReportsPage.php index a1497c3c..52de903c 100644 --- a/app/Filament/Organizations/Pages/ReportsPage.php +++ b/app/Filament/Organizations/Pages/ReportsPage.php @@ -21,10 +21,6 @@ use Filament\Pages\Page; use Illuminate\Contracts\Support\Htmlable; use Illuminate\Contracts\View\View; -use Illuminate\Support\Arr; -use Illuminate\Support\Facades\Blade; -use Illuminate\Support\HtmlString; -use function Filament\Support\get_color_css_variables; class ReportsPage extends Page implements Forms\Contracts\HasForms, HasInfolists { @@ -82,70 +78,47 @@ protected function getFormSchema(): array { return [ Forms\Components\Section::make() - ->columns(4) + ->columns(12) ->schema([ Select::make('report_type') ->key('report_type') ->label(__('report.labels.report_type')) - ->columnSpan(2) + ->columnSpan(6) ->options(ReportType::options()) ->searchable(), DatePicker::make('start_date') ->label(__('report.labels.start_date')) ->default(now()->startOfMonth()) + ->columnSpan(3) ->maxDate(fn (Get $get) => $get('end_date') ? $get('end_date') : now()) ->live(), DatePicker::make('end_date') ->label(__('report.labels.end_date')) ->default(now()) + ->columnSpan(3) ->minDate(fn (Get $get) => $get('start_date') ?? null) ->maxDate(now()) ->live(), Checkbox::make('add_cases_in_monitoring') - ->label(function () { - $icon = 'heroicon-o-information-circle'; - - $iconClasses = Arr::toCssClasses([ - 'fi-in-text-item-icon h-5 w-5 shrink-0', - 'text-custom-500', - ]); - - $iconColor = 'grey'; - $iconStyles = Arr::toCssStyles([ - get_color_css_variables($iconColor, shades: [500]) => $iconColor !== 'gray', - ]); - - $label = Blade::render(' -
-
- {{ $label }} -
- - - -
', [ - 'helper' => __('report.helpers.add_cases_in_monitoring'), - 'label' => __('report.labels.add_cases_in_monitoring'), - 'icon' => $icon, - 'iconClasses' => $iconClasses, - 'iconStyles' => $iconStyles, - ]); - - return new HtmlString($label); - }) - ->columnSpan(2), + ->hintIcon('heroicon-o-information-circle', __('report.helpers.add_cases_in_monitoring')) + ->hintColor('black') + ->columnSpan(2) + ->extraAttributes([ + 'class' => 'justify-start', + ]) + ->label(__('report.labels.add_cases_in_monitoring')) + ->default(true), Checkbox::make('show_missing_values') ->label(__('report.labels.show_missing_values')) ->default(true) - ->columnSpan(2), + ->extraAttributes([ + 'class' => 'ml-16' + ]) + ->columnSpan(4), ]), ]; } diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/EditCloseFileDetails.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/EditCloseFileDetails.php index 17758a2c..be25ad76 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/EditCloseFileDetails.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/EditCloseFileDetails.php @@ -61,11 +61,6 @@ public static function getSchema(?Beneficiary $recordParam = null): array ->label(__('beneficiary.section.close_file.labels.date')) ->required(), - TextInput::make('number') - ->label(__('beneficiary.section.close_file.labels.number')) - ->maxLength(50) - ->required(), - DatePicker::make('admittance_date') ->label(__('beneficiary.section.close_file.labels.admittance_date')) ->required(), diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/EditCloseFileGeneralDetails.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/EditCloseFileGeneralDetails.php index 3ed5c12a..ce51bc7d 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/EditCloseFileGeneralDetails.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/EditCloseFileGeneralDetails.php @@ -92,7 +92,7 @@ public static function getSchema(): array RichEditor::make('close_situation') ->label(__('beneficiary.section.close_file.labels.close_situation')) - ->placeholder(__('beneficiary.section.close_file.placeholder.close_situation'))->columnSpanFull() + ->placeholder(__('beneficiary.section.close_file.placeholders.close_situation'))->columnSpanFull() ->maxLength(2500), ]; diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/ViewCloseFile.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/ViewCloseFile.php index c21af740..7bcbcc9d 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/ViewCloseFile.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/ViewCloseFile.php @@ -79,10 +79,6 @@ public function infolist(Infolist $infolist): Infolist ->schema([ DateEntry::make('date') ->label(__('beneficiary.section.close_file.labels.date')), - - TextEntry::make('number') - ->label(__('beneficiary.section.close_file.labels.number')), - DateEntry::make('admittance_date') ->label(__('beneficiary.section.close_file.labels.admittance_date')), diff --git a/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/EditMonthlyPlanServicesAndInterventions.php b/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/EditMonthlyPlanServicesAndInterventions.php index b65fb475..08f604b5 100644 --- a/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/EditMonthlyPlanServicesAndInterventions.php +++ b/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/EditMonthlyPlanServicesAndInterventions.php @@ -19,6 +19,7 @@ use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\Grid; use Filament\Forms\Components\Placeholder; +use Filament\Forms\Components\RichEditor; use Filament\Forms\Components\Section; use Filament\Forms\Components\Textarea; use Filament\Forms\Components\TextInput; @@ -190,8 +191,8 @@ function (Get $get, ?int $state) { ->maxLength(200), ]), - Textarea::make('service_details') - ->label(__('intervention_plan.labels.service_details')) + RichEditor::make('service_details') + ->label(__('intervention_plan.labels.intervention_details')) ->placeholder(__('intervention_plan.placeholders.service_details')), ]), ]; diff --git a/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/ViewMonthlyPlan.php b/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/ViewMonthlyPlan.php index 34936468..8be6e2c3 100644 --- a/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/ViewMonthlyPlan.php +++ b/app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/ViewMonthlyPlan.php @@ -190,7 +190,7 @@ public function infolist(Infolist $infolist): Infolist ]), TextEntry::make('service_details') - ->label(__('intervention_plan.labels.service_details')) + ->label(__('intervention_plan.labels.intervention_details')) ->columnSpanFull(), ]), ]), diff --git a/app/Models/CloseFile.php b/app/Models/CloseFile.php index e9ed2064..f42d4ec0 100644 --- a/app/Models/CloseFile.php +++ b/app/Models/CloseFile.php @@ -21,7 +21,6 @@ class CloseFile extends Model protected $fillable = [ 'date', - 'number', 'admittance_date', 'exit_date', 'specialist_id', diff --git a/database/factories/CloseFileFactory.php b/database/factories/CloseFileFactory.php index 2d0d52b6..5bcce545 100644 --- a/database/factories/CloseFileFactory.php +++ b/database/factories/CloseFileFactory.php @@ -24,7 +24,6 @@ public function definition(): array return [ 'date' => $this->faker->date(), - 'number' => $this->faker->randomNumber(), 'admittance_date' => $this->faker->date(), 'exit_date' => $this->faker->date(), 'admittance_reason' => $this->faker->randomElements(AdmittanceReason::values(), rand(0, 5)), diff --git a/database/migrations/2024_10_09_183227_create_close_files_table.php b/database/migrations/2024_10_09_183227_create_close_files_table.php index 190006a1..7e8069c7 100644 --- a/database/migrations/2024_10_09_183227_create_close_files_table.php +++ b/database/migrations/2024_10_09_183227_create_close_files_table.php @@ -20,7 +20,6 @@ public function up(): void $table->foreignIdFor(Beneficiary::class)->constrained()->cascadeOnDelete(); $table->foreignIdFor(Specialist::class)->nullable()->constrained()->cascadeOnDelete(); $table->date('date')->nullable(); - $table->string('number')->nullable(); $table->date('admittance_date')->nullable(); $table->date('exit_date')->nullable(); $table->string('admittance_reason')->nullable(); diff --git a/lang/ro/beneficiary.php b/lang/ro/beneficiary.php index 2b3e298d..d1b48ec3 100644 --- a/lang/ro/beneficiary.php +++ b/lang/ro/beneficiary.php @@ -423,9 +423,9 @@ 'admittance_reason' => 'Motivul admiterii în Centru', 'admittance_details' => 'Detalii motiv admitere', 'close_method' => 'Modalitatea de închidere a cazului', - 'institution_name' => 'Numele instituției', - 'beneficiary_request' => 'Descrie motivul beneficiarei', - 'other_details' => 'Descrie altă situație', + 'institution_name' => 'Specificǎ instituția/serviciul unde s-a realizat transferul', + 'beneficiary_request' => 'Specificǎ motivul beneficiarei', + 'other_details' => 'Specificǎ altă situație', 'close_situation' => 'Situația cazului la închidere', 'close_date' => 'Închis la data', 'close_method_widget' => 'Modalitatea de închidere', @@ -440,9 +440,10 @@ ], 'placeholders' => [ 'admittance_details' => 'Adaugă detalii referitoare la motivul admiterii', - 'institution_name' => 'Adaugă numele instituției la care s-a transferat beneficiara', + 'institution_name' => 'Introdu instituția/serviciului', 'add_details' => 'Adaugă detalii', 'close_situation' => 'Descrieți situația cazului la închidere', + '', ], 'notifications' => [ diff --git a/lang/ro/intervention_plan.php b/lang/ro/intervention_plan.php index d7d825e8..f56c311a 100644 --- a/lang/ro/intervention_plan.php +++ b/lang/ro/intervention_plan.php @@ -174,6 +174,7 @@ 'actions' => 'Acțiuni', 'selected_interval' => 'Interval selectat', 'service_details' => 'Detalii acordare serviciu', + 'intervention_details' => 'Detalii acordare intervenții', ], 'headings' => [ @@ -334,8 +335,6 @@ 'add_details' => 'Adaugă detalii', 'select_age' => 'Alege un an', - - ], ],