diff --git a/app/Enums/CounselingSheet.php b/app/Enums/CounselingSheet.php index cf2b929f..af42d351 100644 --- a/app/Enums/CounselingSheet.php +++ b/app/Enums/CounselingSheet.php @@ -15,6 +15,7 @@ enum CounselingSheet: string implements HasLabel case PSYCHOLOGICAL_ASSISTANCE = 'psychological_assistance'; case LEGAL_ASSISTANCE = 'legal_assistance'; + case SOCIAL_ASSISTANCE = 'social_assistance'; protected function labelKeyPrefix(): ?string { diff --git a/app/Enums/FamilyRelationship.php b/app/Enums/FamilyRelationship.php new file mode 100644 index 00000000..ad284b89 --- /dev/null +++ b/app/Enums/FamilyRelationship.php @@ -0,0 +1,27 @@ +disabledForm() @@ -90,7 +94,7 @@ protected function hasInfolist(): bool protected function getFooterWidgets(): array { return [ - InterventionsWidget::class + InterventionsWidget::class, ]; } } diff --git a/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/ResultsWidget.php b/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/ResultsWidget.php index 70e078c2..fa792b08 100644 --- a/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/ResultsWidget.php +++ b/app/Filament/Organizations/Resources/InterventionPlanResource/Widgets/ResultsWidget.php @@ -132,7 +132,7 @@ public function getFormSchema(): array RichEditor::make('observations') ->label(__('intervention_plan.labels.result_observations')) - ->placeholder(__('intervention_plan.placeholders.observations')), + ->placeholder(__('intervention_plan.placeholders.result_observations')), ]; } diff --git a/app/Filament/Organizations/Resources/InterventionServiceResource/Pages/EditCounselingSheet.php b/app/Filament/Organizations/Resources/InterventionServiceResource/Pages/EditCounselingSheet.php index 05770742..9ed1173c 100644 --- a/app/Filament/Organizations/Resources/InterventionServiceResource/Pages/EditCounselingSheet.php +++ b/app/Filament/Organizations/Resources/InterventionServiceResource/Pages/EditCounselingSheet.php @@ -5,24 +5,38 @@ namespace App\Filament\Organizations\Resources\InterventionServiceResource\Pages; use App\Enums\CounselingSheet; +use App\Enums\FamilyRelationship; use App\Enums\FileDocumentType; use App\Enums\Frequency; +use App\Enums\Gender; +use App\Enums\HomeType; use App\Enums\Patrimony; +use App\Enums\PaymentMethod; use App\Enums\PossessionMode; +use App\Enums\ProtectionMeasuringType; +use App\Enums\SocialRelationship; +use App\Enums\Ternary; use App\Filament\Organizations\Resources\InterventionPlanResource; use App\Filament\Organizations\Resources\InterventionServiceResource; use App\Forms\Components\DatePicker; +use App\Forms\Components\Repeater; use App\Forms\Components\Select; +use App\Models\Children; +use App\Models\InterventionService; use App\Services\Breadcrumb\InterventionPlanBreadcrumb; use Awcodes\FilamentTableRepeater\Components\TableRepeater; +use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\CheckboxList; +use Filament\Forms\Components\Grid; use Filament\Forms\Components\Group; +use Filament\Forms\Components\Placeholder; use Filament\Forms\Components\Radio; use Filament\Forms\Components\Section; use Filament\Forms\Components\Textarea; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Forms\Get; +use Filament\Forms\Set; use Filament\Resources\Pages\EditRecord; use Illuminate\Contracts\Support\Htmlable; @@ -60,6 +74,10 @@ public function form(Form $form): Form $schema = self::getSchemaForPsychologicalAssistance(); } + if (CounselingSheet::isValue($counselingSheet, CounselingSheet::SOCIAL_ASSISTANCE)) { + $schema = self::getSchemaForSocialAssistance($this->getRecord()); + } + return $form->schema([ Section::make() ->relationship('counselingSheet') @@ -311,4 +329,409 @@ public static function getSchemaForPsychologicalAssistance(): array ]; } + + public static function getSchemaForSocialAssistance(?InterventionService $interventionService = null): array + { + return [ + Section::make(__('intervention_plan.headings.family_relationship')) + ->schema([ + Repeater::make('data.family') + ->hiddenLabel() + ->itemLabel(function () { + static $index = 1; + + return __('intervention_plan.labels.family', ['number' => $index++]); + }) + ->columns() + ->addAction( + fn (Action $action) => $action->link() + ->label(__('intervention_plan.actions.add_social_relationship')) + ) + ->reorderable(false) + ->maxWidth('3xl') + ->schema([ + + Select::make('relationship') + ->label(__('intervention_plan.labels.relationship')) + ->placeholder(__('intervention_plan.placeholders.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')) + ->maxLength(100), + + TextInput::make('age') + ->label(__('intervention_plan.labels.age')) + ->placeholder(__('intervention_plan.placeholders.age')) + ->mask('999'), + + TextInput::make('locality') + ->label(__('intervention_plan.labels.locality')) + ->placeholder(__('intervention_plan.placeholders.locality')) + ->maxLength(100), + + TextInput::make('occupation') + ->label(__('intervention_plan.labels.occupation')) + ->placeholder(__('intervention_plan.placeholders.occupation')) + ->maxLength(100), + + TextInput::make('relationship_observation') + ->label(__('intervention_plan.labels.relationship_observation')) + ->placeholder(__('intervention_plan.placeholders.relationship_observation')) + ->maxLength(250), + + Select::make('support') + ->label(__('intervention_plan.labels.support')) + ->placeholder(__('intervention_plan.placeholders.support')) + ->options(Ternary::options()), + + TextInput::make('support_observations') + ->label(__('intervention_plan.labels.support_observations')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(250), + + ]), + ]), + + Section::make(__('intervention_plan.headings.support_group')) + ->schema([ + Repeater::make('data.support_group') + ->hiddenLabel() + ->itemLabel(function () { + static $index = 1; + + return __('intervention_plan.labels.social_relationship', ['number' => $index++]); + }) + ->columns() + ->addAction( + fn (Action $action) => $action->link() + ->label(__('intervention_plan.actions.add_social_relationship')) + ) + ->reorderable(false) + ->maxWidth('3xl') + ->schema([ + Select::make('relationship') + ->label(__('intervention_plan.labels.relationship')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(SocialRelationship::options()), + + TextInput::make('full_name') + ->label(__('intervention_plan.labels.person_or_group_name')) + ->placeholder(__('intervention_plan.placeholders.person_or_group_name')) + ->maxLength(200), + + Select::make('support') + ->label(__('intervention_plan.labels.support')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()), + + TextInput::make('support_observations') + ->label(__('intervention_plan.labels.support_observations')) + ->placeholder(__('intervention_plan.placeholders.support_observations')) + ->maxLength(250), + ]), + ]), + + Section::make(__('intervention_plan.headings.living_conditions')) + ->schema([ + Grid::make() + ->maxWidth('3xl') + ->schema([ + Select::make('data.home_type') + ->label(__('intervention_plan.labels.home_type')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(HomeType::options()), + + TextInput::make('data.rooms') + ->label(__('intervention_plan.labels.rooms')) + ->placeholder(__('intervention_plan.placeholders.rooms')) + ->mask('999'), + + TextInput::make('data.peoples') + ->label(__('intervention_plan.labels.peoples')) + ->placeholder(__('intervention_plan.placeholders.peoples')) + ->mask('999'), + + TextInput::make('data.utilities') + ->label(__('intervention_plan.labels.utilities')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(250), + + Textarea::make('data.living_observations') + ->label(__('intervention_plan.labels.living_observations')) + ->placeholder(__('intervention_plan.placeholders.add_details')) + ->columnSpanFull() + ->maxLength(1000), + ]), + + ]), + + Section::make(__('intervention_plan.headings.professional_experience')) + ->schema([ + Textarea::make('data.professional_experience') + ->label(__('intervention_plan.labels.professional_experience')) + ->placeholder(__('intervention_plan.placeholders.add_details')) + ->maxWidth('3xl') + ->maxLength(1000), + ]), + + Section::make(__('intervention_plan.headings.children_details')) + ->afterStateHydrated(function (Set $set, array $state) use ($interventionService) { + if (! $interventionService) { + return; + } + $childrenState = $state['data']['children']; + $beneficiaryChildren = $interventionService->beneficiary->children; + + $emptyState = true; + foreach ($childrenState as &$childState) { + $childState = array_filter($childState); + if (\count($childState) > 1) { + $emptyState = false; + $beneficiaryChild = $beneficiaryChildren->filter(fn (Children $child) => $child->id === $childState['id']) + ->first() + ?->toArray() ?? + []; + + $childState = array_merge($childState, $beneficiaryChild); + } + } + + if ($emptyState) { + $set('data.children', $beneficiaryChildren->toArray()); + + return; + } + + $set('data.children', $childrenState); + }) + ->schema([ + Repeater::make('data.children') + ->hiddenLabel() + ->deletable(false) + ->reorderable(false) + ->addAction(fn (Action $action) => $action->hidden()) + ->schema([ + Grid::make() + ->columns(7) + ->schema([ + Placeholder::make('count') + ->label(__('intervention_plan.labels.count')) + ->content(function () { + static $index = 1; + + return $index++; + }), + + TextInput::make('name') + ->label(__('intervention_plan.labels.children_name')) + ->disabled(), + + TextInput::make('age') + ->label(__('intervention_plan.labels.children_age')) + ->disabled(), + + Select::make('gender') + ->label(__('intervention_plan.labels.children_gender')) + ->options(Gender::options()) + ->disabled(), + + TextInput::make('current_address') + ->label(__('field.current_address')) + ->disabled(), + + TextInput::make('status') + ->label(__('field.child_status')) + ->disabled(), + + TextInput::make('workspace') + ->label(__('field.workspace')) + ->disabled(), + ]), + + Grid::make() + ->columns(3) + ->schema([ + Select::make('paternity_recognized') + ->label(__('intervention_plan.labels.paternity_recognized')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()), + + Select::make('another_person_care') + ->label(__('intervention_plan.labels.another_person_care')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()), + + TextInput::make('quality_person') + ->label(__('intervention_plan.labels.quality_person')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(100), + + Select::make('protection_measuring') + ->label(__('intervention_plan.labels.protection_measuring')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()) + ->live(), + + Select::make('protection_measuring_type') + ->label(__('intervention_plan.labels.protection_measuring_type')) + ->placeholder(__('intervention_plan.placeholders.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')) + ->options(function () { + $options = []; + for ($year = date('Y'); $year >= 1900; $year--) { + $options[$year] = $year; + } + + return $options; + }) + ->default(date('Y')) + ->visible(fn (Get $get) => Ternary::isYes($get('protection_measuring'))), + ]), + + Grid::make() + ->columns(3) + ->schema([ + Select::make('allowance') + ->label(__('intervention_plan.labels.allowance')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()) + ->live(), + + Select::make('payment_method') + ->label(__('intervention_plan.labels.payment_method')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(PaymentMethod::options()) + ->visible(fn (Get $get) => Ternary::isYes($get('allowance'))), + ]), + + Grid::make() + ->columns(3) + ->schema([ + Select::make('family_medic') + ->label(__('intervention_plan.labels.family_medic')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()), + + TextInput::make('family_doctor_contact') + ->label(__('intervention_plan.labels.family_doctor_contact')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(100), + + TextInput::make('health_status') + ->label(__('intervention_plan.labels.health_status')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(250), + ]), + + TextInput::make('school_coordinator') + ->label(__('intervention_plan.labels.school_coordinator')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(500), + + Textarea::make('relationship_details') + ->label(__('intervention_plan.labels.relationship_details')) + ->placeholder(__('intervention_plan.placeholders.add_details')) + ->maxWidth('3xl') + ->maxLength(1000), + ]), + ]), + + Section::make(__('intervention_plan.headings.integration_and_participation_in_social_service')) + ->columns() + ->schema([ + Select::make('data.communication') + ->label(__('intervention_plan.labels.communication')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()), + + TextInput::make('data.communication_observations') + ->label(__('intervention_plan.labels.communication_observations')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(100), + + Select::make('data.socialization') + ->label(__('intervention_plan.labels.socialization')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()), + + TextInput::make('data.socialization_observations') + ->label(__('intervention_plan.labels.socialization_observations')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(100), + + Select::make('data.rules_compliance') + ->label(__('intervention_plan.labels.rules_compliance')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()), + + TextInput::make('data.rules_compliance_observations') + ->label(__('intervention_plan.labels.rules_compliance_observations')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(100), + + Select::make('data.participation_in_individual_counseling') + ->label(__('intervention_plan.labels.participation_in_individual_counseling')) + ->placeholder(__('intervention_plan.placeholders.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')) + ->maxLength(100), + + Select::make('data.participation_in_joint_activities') + ->label(__('intervention_plan.labels.participation_in_joint_activities')) + ->placeholder(__('intervention_plan.placeholders.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')) + ->maxLength(100), + + Select::make('data.self_management') + ->label(__('intervention_plan.labels.self_management')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()), + + TextInput::make('data.self_management_observations') + ->label(__('intervention_plan.labels.self_management_observations')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(100), + + Select::make('data.addictive_behavior') + ->label(__('intervention_plan.labels.addictive_behavior')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()), + + TextInput::make('data.addictive_behavior_observations') + ->label(__('intervention_plan.labels.addictive_behavior_observations')) + ->placeholder(__('intervention_plan.placeholders.observations')) + ->maxLength(100), + + Select::make('data.financial_education') + ->label(__('intervention_plan.labels.financial_education')) + ->placeholder(__('intervention_plan.placeholders.select')) + ->options(Ternary::options()), + + TextInput::make('data.financial_education_observations') + ->label(__('intervention_plan.labels.financial_education_observations')) + ->placeholder(__('intervention_plan.placeholders.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')) + ->columnSpanFull() + ->maxLength(1000), + ]), + ]; + } } diff --git a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php index fe9444f3..1b417b67 100644 --- a/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php +++ b/app/Filament/Organizations/Resources/InterventionServiceResource/Widgets/CounselingSheetWidget.php @@ -5,16 +5,24 @@ namespace App\Filament\Organizations\Resources\InterventionServiceResource\Widgets; use App\Enums\CounselingSheet; +use App\Enums\FamilyRelationship; use App\Enums\FileDocumentType; use App\Enums\Frequency; +use App\Enums\Gender; +use App\Enums\HomeType; use App\Enums\Patrimony; +use App\Enums\PaymentMethod; use App\Enums\PossessionMode; +use App\Enums\ProtectionMeasuringType; +use App\Enums\SocialRelationship; +use App\Enums\Ternary; use App\Filament\Organizations\Resources\InterventionPlanResource; use App\Infolists\Components\EnumEntry; use App\Infolists\Components\SectionHeader; use App\Models\InterventionService; use App\Widgets\InfolistWidget; use Filament\Infolists\Components\Actions\Action; +use Filament\Infolists\Components\Grid; use Filament\Infolists\Components\Group; use Filament\Infolists\Components\RepeatableEntry; use Filament\Infolists\Components\Section; @@ -51,6 +59,10 @@ protected function getInfoListSchema(): array $schema = $this->getSchemaForPsychologicalAssistance(); } + if (CounselingSheet::isValue($counselingSheet, CounselingSheet::SOCIAL_ASSISTANCE)) { + $schema = $this->getSchemaForSocialAssistance(); + } + return [ Section::make() ->relationship('counselingSheet') @@ -256,6 +268,277 @@ private function getSchemaForPsychologicalAssistance(): array ]; } + public static function getSchemaForSocialAssistance(): array + { + return [ + Section::make(__('intervention_plan.headings.family_relationship')) + ->schema([ + RepeatableEntry::make('data.family') + ->hiddenLabel() +// TODO add item label +// ->itemLabel(function () { +// static $index = 1; +// +// return __('intervention_plan.labels.family', ['number' => $index++]); +// }) + ->columns() + ->maxWidth('3xl') + ->schema([ + + EnumEntry::make('relationship') + ->label(__('intervention_plan.labels.relationship')) + ->enumClass(FamilyRelationship::class), + + TextEntry::make('first_and_last_name') + ->label(__('intervention_plan.labels.first_and_last_name')), + + TextEntry::make('age') + ->label(__('intervention_plan.labels.age')), + + TextEntry::make('locality') + ->label(__('intervention_plan.labels.locality')), + + TextEntry::make('occupation') + ->label(__('intervention_plan.labels.occupation')), + + TextEntry::make('relationship_observation') + ->label(__('intervention_plan.labels.relationship_observation')), + + EnumEntry::make('support') + ->label(__('intervention_plan.labels.support')) + ->enumClass(Ternary::class), + + TextEntry::make('support_observations') + ->label(__('intervention_plan.labels.support_observations')), + + ]), + ]), + + Section::make(__('intervention_plan.headings.support_group')) + ->schema([ + RepeatableEntry::make('data.support_group') + ->hiddenLabel() + // TODO add item label +// ->itemLabel(function () { +// static $index = 1; +// +// return __('intervention_plan.labels.social_relationship', ['number' => $index++]); +// }) + ->columns() + ->maxWidth('3xl') + ->schema([ + EnumEntry::make('relationship') + ->label(__('intervention_plan.labels.relationship')) + ->enumClass(SocialRelationship::class), + + TextEntry::make('full_name') + ->label(__('intervention_plan.labels.person_or_group_name')), + + EnumEntry::make('support') + ->label(__('intervention_plan.labels.support')) + ->enumClass(Ternary::class), + + TextEntry::make('support_observations') + ->label(__('intervention_plan.labels.support_observations')), + ]), + ]), + + Section::make(__('intervention_plan.headings.living_conditions')) + ->schema([ + Grid::make() + ->maxWidth('3xl') + ->schema([ + EnumEntry::make('data.home_type') + ->label(__('intervention_plan.labels.home_type')) + ->enumClass(HomeType::class), + + TextEntry::make('data.rooms') + ->label(__('intervention_plan.labels.rooms')), + + TextEntry::make('data.peoples') + ->label(__('intervention_plan.labels.peoples')), + + TextEntry::make('data.utilities') + ->label(__('intervention_plan.labels.utilities')), + + TextEntry::make('data.living_observations') + ->label(__('intervention_plan.labels.living_observations')) + ->columnSpanFull(), + ]), + + ]), + + Section::make(__('intervention_plan.headings.professional_experience')) + ->schema([ + TextEntry::make('data.professional_experience') + ->label(__('intervention_plan.labels.professional_experience')) + ->maxWidth('3xl'), + ]), + + Section::make(__('intervention_plan.headings.children_details')) + ->schema([ + // TODO add child info from beneficiary children + RepeatableEntry::make('data.children') + ->hiddenLabel() + ->schema([ + Grid::make() + ->columns(7) + ->schema([ + TextEntry::make('count') + ->label(__('intervention_plan.labels.count')) + ->state(function () { + static $index = 1; + + return $index++; + }), + + TextEntry::make('name') + ->label(__('intervention_plan.labels.children_name')), + + TextEntry::make('age') + ->label(__('intervention_plan.labels.children_age')), + + EnumEntry::make('gender') + ->label(__('intervention_plan.labels.children_gender')) + ->enumClass(Gender::class), + + TextEntry::make('current_address') + ->label(__('field.current_address')), + + TextEntry::make('status') + ->label(__('field.child_status')), + + TextEntry::make('workspace') + ->label(__('field.workspace')), + ]), + + Grid::make() + ->columns(3) + ->schema([ + EnumEntry::make('paternity_recognized') + ->label(__('intervention_plan.labels.paternity_recognized')) + ->enumClass(Ternary::class), + + EnumEntry::make('another_person_care') + ->label(__('intervention_plan.labels.another_person_care')) + ->enumClass(Ternary::class), + + TextEntry::make('quality_person') + ->label(__('intervention_plan.labels.quality_person')), + + EnumEntry::make('protection_measuring') + ->label(__('intervention_plan.labels.protection_measuring')) + ->enumClass(Ternary::class), + + EnumEntry::make('protection_measuring_type') + ->label(__('intervention_plan.labels.protection_measuring_type')) + ->enumClass(ProtectionMeasuringType::class), + + EnumEntry::make('establishment_year') + ->label(__('intervention_plan.labels.establishment_year')), + ]), + + Grid::make() + ->columns(3) + ->schema([ + EnumEntry::make('allowance') + ->label(__('intervention_plan.labels.allowance')) + ->enumClass(Ternary::class), + + EnumEntry::make('payment_method') + ->label(__('intervention_plan.labels.payment_method')) + ->enumClass(PaymentMethod::class), + ]), + + Grid::make() + ->columns(3) + ->schema([ + EnumEntry::make('family_medic') + ->label(__('intervention_plan.labels.family_medic')) + ->enumClass(Ternary::class), + + TextEntry::make('family_doctor_contact') + ->label(__('intervention_plan.labels.family_doctor_contact')), + + TextEntry::make('health_status') + ->label(__('intervention_plan.labels.health_status')), + ]), + + TextEntry::make('school_coordinator') + ->label(__('intervention_plan.labels.school_coordinator')), + + TextEntry::make('relationship_details') + ->label(__('intervention_plan.labels.relationship_details')) + ->maxWidth('3xl'), + ]), + ]), + + Section::make(__('intervention_plan.headings.integration_and_participation_in_social_service')) + ->columns() + ->schema([ + EnumEntry::make('data.communication') + ->label(__('intervention_plan.labels.communication')) + ->enumClass(Ternary::class), + + TextEntry::make('data.communication_observations') + ->label(__('intervention_plan.labels.communication_observations')), + + EnumEntry::make('data.socialization') + ->label(__('intervention_plan.labels.socialization')) + ->enumClass(Ternary::class), + + TextEntry::make('data.socialization_observations') + ->label(__('intervention_plan.labels.socialization_observations')), + + EnumEntry::make('data.rules_compliance') + ->label(__('intervention_plan.labels.rules_compliance')) + ->enumClass(Ternary::class), + + TextEntry::make('data.rules_compliance_observations') + ->label(__('intervention_plan.labels.rules_compliance_observations')), + + EnumEntry::make('data.participation_in_individual_counseling') + ->label(__('intervention_plan.labels.participation_in_individual_counseling')) + ->enumClass(Ternary::class), + + TextEntry::make('data.participation_in_individual_counseling_observations') + ->label(__('intervention_plan.labels.participation_in_individual_counseling_observations')), + + EnumEntry::make('data.participation_in_joint_activities') + ->label(__('intervention_plan.labels.participation_in_joint_activities')) + ->enumClass(Ternary::class), + + TextEntry::make('data.participation_in_joint_activities_observations') + ->label(__('intervention_plan.labels.participation_in_joint_activities_observations')), + + EnumEntry::make('data.self_management') + ->label(__('intervention_plan.labels.self_management')) + ->enumClass(Ternary::class), + + TextEntry::make('data.self_management_observations') + ->label(__('intervention_plan.labels.self_management_observations')), + + EnumEntry::make('data.addictive_behavior') + ->label(__('intervention_plan.labels.addictive_behavior')) + ->enumClass(Ternary::class), + + TextEntry::make('data.addictive_behavior_observations') + ->label(__('intervention_plan.labels.addictive_behavior_observations')), + + EnumEntry::make('data.financial_education') + ->label(__('intervention_plan.labels.financial_education')) + ->enumClass(Ternary::class), + + TextEntry::make('data.financial_education_observations') + ->label(__('intervention_plan.labels.financial_education_observations')), + + TextEntry::make('data.integration_and_participation_in_social_service_observations') + ->label(__('intervention_plan.labels.integration_and_participation_in_social_service_observations')) + ->columnSpanFull(), + ]), + ]; + } + public function getDisplayName(): string { return __('intervention_plan.headings.counseling_sheet'); diff --git a/app/Filament/Organizations/Resources/ServiceResource/Pages/ViewService.php b/app/Filament/Organizations/Resources/ServiceResource/Pages/ViewService.php index 2b461c69..b712cb88 100644 --- a/app/Filament/Organizations/Resources/ServiceResource/Pages/ViewService.php +++ b/app/Filament/Organizations/Resources/ServiceResource/Pages/ViewService.php @@ -71,6 +71,10 @@ public function infolist(Infolist $infolist): Infolist return EditCounselingSheet::getSchemaForPsychologicalAssistance(); } + if (CounselingSheet::isValue($counselingSheet, CounselingSheet::SOCIAL_ASSISTANCE)) { + return EditCounselingSheet::getSchemaForSocialAssistance(); + } + return []; }) ->disabledForm() diff --git a/app/Forms/Components/DatePicker.php b/app/Forms/Components/DatePicker.php index 10cfbb03..ab67f0d3 100644 --- a/app/Forms/Components/DatePicker.php +++ b/app/Forms/Components/DatePicker.php @@ -4,12 +4,15 @@ namespace App\Forms\Components; -class DatePicker extends \Filament\Forms\Components\DatePicker +use Filament\Forms\Components\DatePicker as BaseDatePicker; + +class DatePicker extends BaseDatePicker { protected function setUp(): void { parent::setUp(); $this->native(false); $this->displayFormat('Y-m-d'); + $this->closeOnDateSelection(); } } diff --git a/lang/ro/enum.php b/lang/ro/enum.php index 0a5ed376..ed85a061 100644 --- a/lang/ro/enum.php +++ b/lang/ro/enum.php @@ -386,7 +386,8 @@ 'counseling_sheet' => [ 'psychological_assistance' => 'Asistență psihologică', - 'legal_assistance' => 'Asistența juridică', + 'legal_assistance' => 'Asistență juridică', + 'social_assistance' => 'Asistență socială', ], 'meeting_status' => [ @@ -498,4 +499,47 @@ 'm' => 'M', 'n' => 'N', ], + + 'family_relationship' => [ + 'partner' => 'Partener', + 'mother' => 'Mamă', + 'father' => 'Tatăl', + 'sister' => 'Soră', + 'brother' => 'Frate', + 'other' => 'Alt membru al familiei', + ], + + 'social_relationship' => [ + 'friend' => 'Prieten(ă)', + 'coworker' => 'Coleg(ă)', + 'support_group' => 'Grup sprijin', + 'other' => 'Altă relație', + ], + + 'home_type' => [ + 'individual_house' => 'Casă individuală', + 'building_with_multiple_houses' => 'Casă cu două sau mai multe locuințe (cuplate, înșiruite, etc)', + 'apartment' => 'Apartament în bloc de locuințe', + 'studio' => 'Garsonieră în loc de locuințe', + 'room' => 'Cameră în unitate de locuit în comun (cămin, internat)', + 'space_in_building_with_non_residential_destination' => 'Spațiu în clădire cu altă destinație decât locuire', + 'other' => 'Alt tip de proprietate', + ], + + 'protection_measuring_type' => [ + 'emergency_placement' => 'Plasament în regim de urgență', + 'placement_in_family' => 'Plasament la o persoană sau familie', + 'placement_at_foster_care' => 'Plasament la un asistent maternal', + 'placement_in_residential_care_service' => 'Plasament la un serviciu de tip rezidențial', + 'specialized_supervision' => 'Supraveghere specializată', + 'other' => 'Altă măsură de protecție', + ], + + 'payment_method' => [ + 'representative' => 'Reprezentant', + 'postal_office' => 'Oficiu poștal', + 'bank_account' => 'Card bancar', + 'other' => 'Altă modalitate de plată', + + ], ]; diff --git a/lang/ro/intervention_plan.php b/lang/ro/intervention_plan.php index ee036124..d1fe9d83 100644 --- a/lang/ro/intervention_plan.php +++ b/lang/ro/intervention_plan.php @@ -107,6 +107,57 @@ 'retried_at' => 'Retras la', 'retried_date' => 'retras (:date)', 'lost_from_monitoring_column' => 'pierdut din monitorizare', + 'family' => 'Relația familială #:number', + 'relationship' => 'Tip relație', + 'first_and_last_name' => 'Nume și prenume', + 'age' => 'Vârsta (în ani împliniți)', + 'locality' => 'Localitatea de domiciliu', + 'occupation' => 'Ocupația', + 'relationship_observation' => 'Relația', + 'support' => 'Susținere', + 'support_observations' => 'Observații susținere', + 'person_or_group_name' => 'Nume persoană / denumire grup sprijin', + 'home_type' => 'Tipul de proprietate', + 'rooms' => 'Număr încăperi', + 'peoples' => 'Nr persoane în locuință', + 'utilities' => 'Utilități', + 'living_observations' => 'Alte observații legate de mediul de locuit', + 'professional_experience' => 'Observații legate de experiența profesională', + 'children_name' => 'Nume și prenume copil', + 'children_age' => 'Vârsta', + 'children_gender' => 'Gen', + 'paternity_recognized' => 'Recunoscută paternitatea', + 'another_person_care' => 'În grija altei persoane', + 'quality_person' => 'Calitatea persoanei', + 'protection_measuring' => 'Măsură de protecție', + 'protection_measuring_type' => 'Tip măsură de protecție', + 'establishment_year' => 'Anul instituirii', + 'allowance' => 'Alocație de stat', + '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', + 'school_coordinator' => 'Dacă este școlarizat, detalii învățător/diriginte', + 'relationship_details' => 'Caracterizarea relației', + 'communication' => 'Comunicare', + 'communication_observations' => 'Observații comunicare', + 'socialization' => 'Socializare', + 'socialization_observations' => 'Observații socializare', + 'rules_compliance' => 'Respectare regulament', + 'rules_compliance_observations' => 'Observații respectare regulament', + 'participation_in_individual_counseling' => 'Participare la consiliere individuală', + 'participation_in_individual_counseling_observations' => 'Observații participare la consiliere', + 'participation_in_joint_activities' => 'Participare la activități comune', + 'participation_in_joint_activities_observations' => 'Observații participare la activități comune', + 'self_management' => 'Autogospodărire', + 'self_management_observations' => 'Observații autogospodărire', + 'addictive_behavior' => 'Comportament adictiv', + 'addictive_behavior_observations' => 'Observații comportament adictiv', + 'financial_education' => 'Educație financiară', + 'financial_education_observations' => 'Observații educație financiară', + 'integration_and_participation_in_social_service_observations' => 'Alte observații legate de integrare și participare în serviciul social', + 'count' => 'Nr', + 'social_relationship' => 'Relația socială #:number', ], 'headings' => [ @@ -160,6 +211,12 @@ 'ended_at' => 'Realizat/ soluționat la', 'observations' => 'Observatii', 'edit_result' => 'Modifică rezultat', + 'family_relationship' => 'Relații sociale: Familia', + 'support_group' => 'Relații sociale: Persoane sau grupuri de sprijin', + 'living_conditions' => 'Condiții de locuit', + 'professional_experience' => 'Experiența profesională', + 'children_details' => 'Date adiționale despre copii', + 'integration_and_participation_in_social_service' => 'Integrare și participare în serviciul social', ], 'actions' => [ @@ -180,6 +237,7 @@ 'view_intervention_plan' => 'Vezi detalii plan', 'add_result' => 'Adaugă rezultat', 'delete_result' => 'Șterge rezultat', + 'add_social_relationship' => 'Adaugă încă o relație socială', ], 'placeholders' => [ @@ -189,6 +247,19 @@ 'specialist' => 'Alege un specialist', 'objections' => 'Descrieți pe scurt obiectivele acordării serviciului', 'benefit_category' => 'Alege o categorie', - 'observations' => 'Notați pe scurt orice observații sau notiție relevante pentru activitate', + 'result_observations' => 'Notați pe scurt orice observații sau notiție relevante pentru activitate', + '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' => 'Alege un răspuns', + 'person_or_group_name' => 'Introdu numele sau denumirea', + 'observations' => 'Specificați', + 'rooms' => 'Total încăperi de locuit', + 'peoples' => 'Introdu un număr', + 'add_details' => 'Adaugă detalii', + 'select_age' => 'Alege un an', ], ];