Skip to content

Commit 3ecd49b

Browse files
feat: add new migration files, schemas, and feature tests for interventions and counseling
- Introduced new fields: `violence_means` and `violence_means_specify` in `violences` table, and multiple fields in `monthly_plan_interventions` table for better tracking. - Added `CounselingSheetInfolistSchemas` to define schemas for legal, psychological, and social assistance. - Created feature test for editing intervention indicators in beneficiary intervention detail page. - Added Blade components for displaying intervention and meeting cards with enhanced UI and dynamic data rendering.
1 parent c54a286 commit 3ecd49b

30 files changed

+1811
-270
lines changed

app/Enums/ViolenceMeans.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Enums;
6+
7+
use App\Concerns\Enums;
8+
use App\Concerns\Enums\Arrayable;
9+
use App\Concerns\Enums\Comparable;
10+
use Filament\Support\Contracts\HasLabel;
11+
12+
enum ViolenceMeans: string implements HasLabel
13+
{
14+
use Arrayable;
15+
use Comparable;
16+
use Enums\HasLabel;
17+
18+
case BODY_PARTS = 'body_parts';
19+
case CUTTING_OBJECTS = 'cutting_objects';
20+
case PIERCING_OBJECTS = 'piercing_objects';
21+
case BLUNT_OBJECTS = 'blunt_objects';
22+
case FIREARMS = 'firearms';
23+
case NO_ANSWER = 'no_answer';
24+
case OTHER = 'other';
25+
26+
protected function labelKeyPrefix(): ?string
27+
{
28+
return 'enum.violence_means';
29+
}
30+
}

app/Filament/Organizations/Resources/Cases/CaseResource.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use App\Filament\Organizations\Resources\Cases\Pages\InterventionPlan\CreateCaseInterventionPlan;
2121
use App\Filament\Organizations\Resources\Cases\Pages\InterventionPlan\CreateCaseMonthlyPlan;
2222
use App\Filament\Organizations\Resources\Cases\Pages\InterventionPlan\EditCaseMonthlyPlanDetails;
23+
use App\Filament\Organizations\Resources\Cases\Pages\InterventionPlan\ViewCaseBeneficiaryIntervention;
2324
use App\Filament\Organizations\Resources\Cases\Pages\InterventionPlan\ViewCaseInterventionPlan;
2425
use App\Filament\Organizations\Resources\Cases\Pages\InterventionPlan\ViewCaseInterventionService;
2526
use App\Filament\Organizations\Resources\Cases\Pages\InterventionPlan\ViewCaseMonthlyPlan;
@@ -158,6 +159,7 @@ public static function getPages(): array
158159
'create_intervention_plan' => CreateCaseInterventionPlan::route('/{record}/intervention-plan/create'),
159160
'view_intervention_plan' => ViewCaseInterventionPlan::route('/{record}/intervention-plan'),
160161
'view_intervention_service' => ViewCaseInterventionService::route('/{record}/intervention-plan/services/{interventionService}'),
162+
'view_beneficiary_intervention' => ViewCaseBeneficiaryIntervention::route('/{record}/intervention-plan/services/{interventionService}/interventions/{beneficiaryIntervention}'),
161163
'create_monthly_plan' => CreateCaseMonthlyPlan::route('/{case}/intervention-plan/monthly-plans/create'),
162164
'view_monthly_plan' => ViewCaseMonthlyPlan::route('/{record}/intervention-plan/monthly-plans/{monthlyPlan}'),
163165
'edit_monthly_plan_details' => EditCaseMonthlyPlanDetails::route('/{record}/intervention-plan/monthly-plans/{monthlyPlan}/edit-details'),

app/Filament/Organizations/Resources/Cases/Pages/DetailedEvaluation/ViewCaseDetailedEvaluation.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use App\Enums\AddressType;
99
use App\Filament\Organizations\Resources\Cases\CaseResource;
1010
use App\Filament\Organizations\Resources\Cases\Schemas\IdentityInfolist;
11+
use App\Filament\Schemas\Components\SectionWithRecordActions;
1112
use App\Infolists\Components\Actions\EditAction;
1213
use App\Infolists\Components\DateEntry;
1314
use App\Infolists\Components\EnumEntry;
@@ -60,6 +61,7 @@ protected function getHeaderActions(): array
6061
BackAction::make()
6162
->url(CaseResource::getUrl('view', ['record' => $this->getRecord()])),
6263
\Filament\Actions\EditAction::make()
64+
->record($this->getRecord())
6365
->url(CaseResource::getUrl('edit_detailed_evaluation', ['record' => $this->getRecord()])),
6466
];
6567
}
@@ -106,7 +108,7 @@ public function infolist(Schema $schema): Schema
106108
protected function getDetaliiEvaluareSchema(): array
107109
{
108110
return [
109-
Section::make(__('beneficiary.wizard.details.label'))
111+
SectionWithRecordActions::make(__('beneficiary.wizard.details.label'))
110112
->headerActions([
111113
EditAction::make('edit')
112114
->url(fn (Beneficiary $record): string => CaseResource::getUrl('edit_detailed_evaluation', ['record' => $record])),
@@ -169,6 +171,7 @@ protected function getIdentitateBeneficiarSchema(): array
169171
->registerActions([
170172
\Filament\Actions\Action::make('go_identity')
171173
->label(__('case.view.identity'))
174+
->record($this->getRecord())
172175
->url(fn (Beneficiary $record): string => CaseResource::getUrl('identity', ['record' => $record]))
173176
->link(),
174177
]),
@@ -188,6 +191,7 @@ protected function getIdentitateCopiiSchema(): array
188191
->registerActions([
189192
\Filament\Actions\Action::make('go_identity')
190193
->label(__('case.view.identity'))
194+
->record($this->getRecord())
191195
->url(fn (Beneficiary $record): string => CaseResource::getUrl('identity', ['record' => $record]))
192196
->link(),
193197
]),
@@ -244,7 +248,7 @@ protected function getPartenerSchema(): array
244248
Group::make()
245249
->relationship('partner')
246250
->schema([
247-
Section::make(__('beneficiary.section.detailed_evaluation.heading.partner'))
251+
SectionWithRecordActions::make(__('beneficiary.section.detailed_evaluation.heading.partner'))
248252
->headerActions([
249253
EditAction::make('edit')
250254
->url(fn (BeneficiaryPartner $record): string => CaseResource::getUrl('edit_detailed_evaluation', ['record' => $record->beneficiary])),
@@ -292,7 +296,7 @@ protected function getEvaluareMultidisciplinaraSchema(): array
292296
Group::make()
293297
->relationship('multidisciplinaryEvaluation')
294298
->schema([
295-
Section::make(__('beneficiary.section.detailed_evaluation.heading.reasons_for_start_evaluation'))
299+
SectionWithRecordActions::make(__('beneficiary.section.detailed_evaluation.heading.reasons_for_start_evaluation'))
296300
->compact()
297301
->headerActions([
298302
EditAction::make('edit')
@@ -380,7 +384,7 @@ protected function getRezultateSchema(): array
380384
Group::make()
381385
->relationship('detailedEvaluationResult')
382386
->schema([
383-
Section::make(__('beneficiary.wizard.results.label'))
387+
SectionWithRecordActions::make(__('beneficiary.wizard.results.label'))
384388
->headerActions([
385389
EditAction::make('edit')
386390
->url(fn (DetailedEvaluationResult $record): string => CaseResource::getUrl('edit_detailed_evaluation', ['record' => $record->beneficiary])),

app/Filament/Organizations/Resources/Cases/Pages/InterventionPlan/CreateCaseMonthlyPlan.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ private function duplicateLastMonthlyPlan(InterventionPlan $plan): ?MonthlyPlan
214214
'service_intervention_id' => $oldIntervention->service_intervention_id,
215215
'objections' => $oldIntervention->objections,
216216
'observations' => $oldIntervention->observations,
217+
'expected_results' => $oldIntervention->expected_results,
218+
'procedure' => $oldIntervention->procedure,
219+
'indicators' => $oldIntervention->indicators,
220+
'achievement_degree' => $oldIntervention->achievement_degree,
217221
]);
218222
}
219223
}

0 commit comments

Comments
 (0)