Skip to content

Commit

Permalink
wip in WK
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghelupu17 committed Dec 30, 2024
1 parent 6ad5d3b commit 81e756f
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 16 deletions.
4 changes: 3 additions & 1 deletion app/Enums/DisabilityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ enum DisabilityType: string implements HasLabel
case DEAF = 'deaf';
case SOMATIC = 'somatic';
case MENTAL = 'mental';
case PSYCHIC = 'psychic';
case NEUROPSYCHIC = 'neuropsychic';
case HIV_AIDS = 'hiv_aids';
case ASSOCIATE = 'associate';
case RARE_DISEASES = 'rare_diseases';

case UNKNOWN = 'unknown';

protected function labelKeyPrefix(): ?string
{
return 'enum.disability_type';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
use App\Services\Breadcrumb\BeneficiaryBreadcrumb;
use Filament\Forms\Components\Actions\Action;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Forms\Get;
Expand Down Expand Up @@ -112,6 +114,15 @@ public static function aggressorSection(): array
->enum(AggressorRelationship::class)
->live(),

Textarea::make('relationship_other')
->label(__('field.aggressor_relationship_other'))
->placeholder(__('placeholder.input_text'))
->extraAttributes([
'class' => 'h-full',
])
->visible(fn (Get $get) => AggressorRelationship::isValue($get('relationship'), AggressorRelationship::OTHER))
->maxLength(100),

TextInput::make('age')
->label(__('field.aggressor_age'))
->placeholder(__('placeholder.number'))
Expand Down Expand Up @@ -158,13 +169,17 @@ public static function aggressorSection(): array
->enum(Ternary::class)
->live(),

Select::make('violence_types')
->label(__('field.aggressor_violence_types'))
->placeholder(__('placeholder.select_many'))
->visible(fn (Get $get) => Ternary::isYes($get('has_violence_history')))
->options(Violence::options())
->rule(new MultipleIn(Violence::values()))
->multiple(),
Group::make([
Select::make('violence_types')
->label(__('field.aggressor_violence_types'))
->placeholder(__('placeholder.select_many'))
->options(Violence::options())
->rule(new MultipleIn(Violence::values()))
->multiple(),

])->visible(fn (Get $get) => Ternary::isYes($get('has_violence_history')))
->columns(2)
->columnSpanFull(),

]),

Expand All @@ -173,12 +188,18 @@ public static function aggressorSection(): array
Select::make('legal_history')
->label(__('field.aggressor_legal_history'))
->placeholder(__('placeholder.select_many'))
->visible(fn (Get $get) => Ternary::isYes($get('has_violence_history')))
->options(AggressorLegalHistory::options())
->rule(new MultipleIn(AggressorLegalHistory::values()))
->multiple()
->live(),
]),
Textarea::make('legal_history_notes')
->label(__('field.aggressor_legal_history_notes'))
->placeholder(__('placeholder.input_text'))
->extraAttributes([
'class' => 'h-full',
])
->maxLength(100),
])->visible(fn (Get $get) => Ternary::isYes($get('has_violence_history'))),

Grid::make()
->schema([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,19 @@ public static function beneficiarySection(): array

TextInput::make('net_income')
->label(__('field.net_income'))
->placeholder(__('placeholder.net_income'))
->placeholder(__('placeholder.input_sum'))
->mask('9999999999'),

Select::make('income')
->label(__('field.income'))
->placeholder(__('placeholder.select_one'))
->placeholder(__('placeholder.choose_situation'))
->options(Income::options())
->enum(Income::class),

Select::make('income_source')
->label(__('beneficiary.section.personal_information.label.income_source'))
->options(IncomeSource::options())
->placeholder(__('placeholder.choose_one_or_more'))
->multiple(),

TextInput::make('elder_care_count')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace App\Filament\Organizations\Resources\BeneficiaryResource\Pages;

use App\Actions\BackAction;
use App\Enums\AggressorRelationship;
use App\Enums\Diseases;
use App\Enums\Ternary;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Infolists\Components\Actions\Edit;
use App\Infolists\Components\EnumEntry;
use App\Infolists\Components\SectionHeader;
use App\Models\Aggressor;
use App\Models\Beneficiary;
use App\Services\Breadcrumb\BeneficiaryBreadcrumb;
use Filament\Infolists\Components\Grid;
Expand Down Expand Up @@ -266,6 +268,10 @@ protected static function aggressorSection(): array
->label(__('field.aggressor_relationship'))
->placeholder(__('placeholder.select_one')),

TextEntry::make('relationship_other')
->label(__('field.aggressor_relationship_other'))
->visible(fn (Aggressor $record) => $record->relationship === AggressorRelationship::OTHER),

TextEntry::make('age')
->label(__('field.aggressor_age'))
->placeholder(__('placeholder.number'))
Expand Down Expand Up @@ -306,6 +312,8 @@ protected static function aggressorSection(): array
->schema([
TextEntry::make('legal_history')
->label(__('field.aggressor_legal_history')),
TextEntry::make('legal_history_notes')
->label(__('field.aggressor_legal_history_notes')),
]),

Grid::make()
Expand Down
2 changes: 2 additions & 0 deletions app/Models/Aggressor.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ class Aggressor extends Model
'has_psychiatric_history',
'has_violence_history',
'legal_history',
'legal_history_notes',
'occupation',
'psychiatric_history_notes',
'relationship',
'relationship_other',
'studies',
'violence_types',
'has_protection_order',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/FlowPresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FlowPresentation extends Model

protected $casts = [
'presentation_mode' => PresentationMode::class,
'referral_mode' => ReferralMode::class,
'referral_mode' => AsEnumCollection::class . ':' . ReferralMode::class,
'notification_mode' => NotificationMode::class,
'notifier' => Notifier::class,
'act_location' => AsEnumCollection::class . ':' . ActLocation::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function up(): void
$table->string('citizenship')->nullable();

$table->string('relationship')->nullable();
$table->string('relationship_other')->nullable();
$table->tinyInteger('age')->unsigned()->nullable();
$table->string('gender')->nullable();
$table->string('civil_status')->nullable();
Expand All @@ -42,6 +43,7 @@ public function up(): void
$table->json('drugs')->nullable();

$table->json('legal_history')->nullable();
$table->text('legal_history_notes')->nullable();
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function up(): void
->nullable()
->constrained()
->cascadeOnDelete();
$table->string('referral_mode')->nullable();
$table->json('referral_mode')->nullable();
$table->string('notifier')->nullable();
$table->string('notification_mode')->nullable();
$table->string('notifier_other')->nullable();
Expand Down
3 changes: 2 additions & 1 deletion lang/ro/enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,11 @@
'deaf' => 'Surdocecitate',
'somatic' => 'Somatic',
'mental' => 'Mintal',
'psychic' => 'Psihic',
'neuropsychic' => 'Neuropsihic',
'hiv_aids' => 'HIV/SIDA',
'associate' => 'Asociat',
'rare_diseases' => 'Boli rare',
'unknown' => 'Nu știe/Nu răspunde',

],

Expand Down
3 changes: 3 additions & 0 deletions lang/ro/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
'workspace' => 'Unitate învățământ/ Loc muncă',

'aggressor_relationship' => 'Relația victimei cu agresorul',
'aggressor_relationship_other' => 'Defineşte altǎ situație',
'aggressor_age' => 'Vârsta agresorului (ani)',
'aggressor_gender' => 'Genul agresorului',
'aggressor_citizenship' => 'Cetățenia agresorului',
Expand All @@ -112,6 +113,8 @@
'aggressor_has_drug_history' => 'Consum de substanțe agresor',
'aggressor_drugs' => 'Tip de substanțe consumate',
'aggressor_legal_history' => 'Aspecte legale agresor',
'aggressor_legal_history_notes' => 'Observații aspecte legale',

'has_protection_order' => 'Ordin de protecție',
'electronically_monitored' => 'Monitorizat electronic',
'protection_order_notes' => 'Observații ordin de protecție',
Expand Down
6 changes: 5 additions & 1 deletion lang/ro/placeholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'civil_status' => 'Alege starea civilă',
'cnp' => 'Cod Numeric Personal',
'select_many' => 'Alege răspunsurile care se aplică',
'input_text' => 'Specificați',
'select_one' => 'Alege un răspuns',
'birthplace' => 'Localitatea în care s-a născut',
'id_number' => 'Introdu număr act',
Expand All @@ -34,8 +35,11 @@
'email' => 'Introdu adresa de email',
'url' => 'URL',

'net_income' => 'Alege toate variantele care se potrivesc',
'input_sum' => 'Introdu o sumă',
'observations' => 'Specificați',
'choose_situation' => 'Alege o situație',

'choose_one_or_more' => 'Alege toate variantele care se potrivesc',

// 'accreditation_number' => 'Introdu seria și numărul',
// 'activity' => 'Introdu activitatea',
Expand Down

0 comments on commit 81e756f

Please sign in to comment.