Skip to content

Commit

Permalink
Merge branch 'main' into 27-documents
Browse files Browse the repository at this point in the history
  • Loading branch information
alexPopaCode4 authored Jun 7, 2024
2 parents 33e8b5c + 39ecc6f commit d4e4c87
Show file tree
Hide file tree
Showing 83 changed files with 4,120 additions and 29 deletions.
21 changes: 21 additions & 0 deletions app/Concerns/BelongsToBeneficiary.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace App\Concerns;

use App\Models\Beneficiary;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

trait BelongsToBeneficiary
{
public function initializeBelongsToBeneficiary(): void
{
$this->fillable[] = 'beneficiary_id';
}

public function beneficiary(): BelongsTo
{
return $this->belongsTo(Beneficiary::class);
}
}
30 changes: 30 additions & 0 deletions app/Concerns/HasEffectiveAddress.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace App\Concerns;

use App\Models\Beneficiary;
use App\Models\BeneficiaryPartner;

trait HasEffectiveAddress
{
protected static function bootHasEffectiveAddress(): void
{
static::creating(fn (Beneficiary | BeneficiaryPartner $model) => self::copyLegalResidenceToEffectiveResidence($model));

static::updating(fn (Beneficiary | BeneficiaryPartner $model) => self::copyLegalResidenceToEffectiveResidence($model));
}

protected static function copyLegalResidenceToEffectiveResidence(Beneficiary | BeneficiaryPartner $model): void
{
if ($model->same_as_legal_residence) {
$model->effective_residence_county_id = $model->legal_residence_county_id;
$model->effective_residence_city_id = $model->legal_residence_city_id;
$model->effective_residence_address = $model->legal_residence_address;
if (isset($model->legal_residence_environment)) {
$model->effective_residence_environment = $model->legal_residence_environment;
}
}
}
}
27 changes: 27 additions & 0 deletions app/Enums/AggravatingFactorsSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum AggravatingFactorsSchema: string
{
use Arrayable;
use Comparable;
use HasLabel;

case SEPARATION = 'separation';
case AGGRESSOR_PARENT_HAS_CONTACT_WITH_CHILDREN = 'aggressor_parent_has_contact_with_children';
case AGGRESSOR_PARENT_THREATEN_THE_VICTIM_IN_THE_VISITATION_PROGRAM = 'aggressor_parent_threaten_the_victim_in_the_visitation_program';
case CHILDREN_FROM_OTHER_MARRIAGE_ARE_INTEGRATED_INTO_FAMILY = 'children_from_other_marriage_are_integrated_into_family';
case DOMESTIC_VIOLENCE_DURING_PREGNANCY = 'domestic_violence_during_pregnancy';

protected function labelKeyPrefix(): ?string
{
return 'beneficiary.section.initial_evaluation.labels';
}
}
24 changes: 24 additions & 0 deletions app/Enums/Applicant.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum Applicant: string
{
use Arrayable;
use Comparable;
use HasLabel;

case BENEFICIARY = 'beneficiary';
case OTHER = 'other';

protected function labelKeyPrefix(): ?string
{
return 'enum.applicant';
}
}
26 changes: 26 additions & 0 deletions app/Enums/Frequency.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum Frequency: string
{
use Arrayable;
use Comparable;
use HasLabel;

case DAILY = 'daily';
case WEEKLY = 'weekly';
case MONTHLY = 'monthly';
case LASS_THAN_MONTHLY = 'lass_than_monthly';

protected function labelKeyPrefix(): ?string
{
return 'enum.frequency';
}
}
28 changes: 28 additions & 0 deletions app/Enums/Helps.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum Helps: string
{
use Arrayable;
use Comparable;
use HasLabel;

case TEMPORARY_SHELTER = 'temporary_shelter';
case EMERGENCY_BAG_STORAGE = 'emergency_bag_storage';
case FINANCIAL_SUPPORT = 'financial_support';
case EMOTIONAL_SUPPORT = 'emotional_support';
case ACCOMPANYING_ACTIONS = 'accompanying_actions';
case EMERGENCY_CALL = 'emergency_call';

protected function labelKeyPrefix(): ?string
{
return 'enum.helps';
}
}
34 changes: 34 additions & 0 deletions app/Enums/Level.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum Level: string
{
use Arrayable;
use Comparable;
use HasLabel;

case HIGH = 'high';
case MEDIUM = 'medium';
case LOW = 'low';

protected function labelKeyPrefix(): ?string
{
return 'enum.level';
}

public static function colors(): array
{
return [
'success' => Level::LOW,
'warning' => Level::MEDIUM,
'danger' => Level::HIGH,
];
}
}
38 changes: 38 additions & 0 deletions app/Enums/RecommendationService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum RecommendationService: string
{
use Arrayable;
use Comparable;
use HasLabel;

case PSYCHOLOGICAL_ADVICE = 'psychological_advice';
case LEGAL_ADVICE = 'legal_advice';
case LEGAL_ASSISTANCE = 'legal_assistance';
case FAMILY_COUNSELING = 'family_counseling';
case PRENATAL_ADVICE = 'prenatal_advice';
case SOCIAL_ADVICE = 'social_advice';
case MEDICAL_SERVICES = 'medical_services';
case MEDICAL_PAYMENT = 'medical_payment';
case SECURING_RESIDENTIAL_SPACES = 'securing_residential_spaces';
case OCCUPATIONAL_PROGRAM_SERVICES = 'occupational_program_services';
case EDUCATIONAL_SERVICES_FOR_CHILDREN = 'educational_services_for_children';
case TEMPORARY_SHELTER_SERVICES = 'temporary_shelter_services';
case PROTECTION_ORDER = 'protection_order';
case CRISIS_ASSISTANCE = 'crisis_assistance';
case SAFETY_PLAN = 'safety_plan';
case OTHER_SERVICES = 'other_services';

protected function labelKeyPrefix(): ?string
{
return 'beneficiary.section.detailed_evaluation.labels';
}
}
26 changes: 26 additions & 0 deletions app/Enums/RiskFactorsSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum RiskFactorsSchema: string
{
use Arrayable;
use Comparable;
use HasLabel;

case AGGRESSOR_PRESENT_RISK_RELATED_TO_VICES = 'aggressor_present_risk_related_to_vices';
case AGGRESSOR_IS_POSSESSIVE_OR_JEALOUS = 'aggressor_is_possessive_or_jealous';
case AGGRESSOR_HAVE_MENTAL_PROBLEMS = 'aggressor_have_mental_problems';
case AGGRESSOR_PRESENT_MANIFESTATIONS_OF_ECONOMIC_STRESS = 'aggressor_present_manifestations_of_economic_stress';

protected function labelKeyPrefix(): ?string
{
return 'beneficiary.section.initial_evaluation.labels';
}
}
38 changes: 38 additions & 0 deletions app/Enums/Role.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum Role: string
{
use Arrayable;
use Comparable;
use HasLabel;

case COORDINATOR = 'coordinator';
case MANGER = 'manger';
case CHEF_MANAGER = 'chef_manager';
case CHEF_SERVICE = 'chef_service';
case PSYCHOLOGICAL_ADVICE = 'psychological_advice';
case PSYCHOTHERAPIST = 'psychotherapist';
case CLINICAL_PSYCHOLOGIST = 'clinical_psychologist';
case PSYCHO_PEDAGOGUE = 'psycho_pedagogue';
case SOCIAL_WORKER = 'social_worker';
case LEGAL_ADVISOR = 'legal_advisor';
case FACILITATOR = 'facilitator';
case TRAINER = 'trainer';
case DOCTOR = 'doctor';
case MEDICAL_ASSISTANT = 'medical_assistant';
case OCCUPATIONAL_THERAPIST = 'occupational_therapist';
case OTHER = 'other';

protected function labelKeyPrefix(): ?string
{
return 'enum.role';
}
}
24 changes: 24 additions & 0 deletions app/Enums/VictimPerceptionOfTheRiskSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum VictimPerceptionOfTheRiskSchema: string
{
use Arrayable;
use Comparable;
use HasLabel;

case VICTIM_AFRAID_FOR_HIMSELF = 'victim_afraid_for_himself';
case VICTIM_HAS_AN_ATTITUDE_OF_ACCEPTANCE = 'victim_has_an_attitude_of_acceptance';

protected function labelKeyPrefix(): ?string
{
return 'beneficiary.section.initial_evaluation.labels';
}
}
27 changes: 27 additions & 0 deletions app/Enums/ViolenceHistorySchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum ViolenceHistorySchema: string
{
use Arrayable;
use Comparable;
use HasLabel;

case PREVIOUS_ACTS_OF_VIOLENCE = 'previous_acts_of_violence';
case VIOLENCE_AGAINST_CHILDREN_OR_FAMILY_MEMBERS = 'violence_against_children_or_family_members';
case ABUSER_EXHIBITED_GENERALIZED_VIOLENT = 'abuser_exhibited_generalized_violent';
case PROTECTION_ORDER_IN_PAST = 'protection_order_in_past';
case ABUSER_VIOLATED_PROTECTION_ORDER = 'abuser_violated_protection_order';

protected function labelKeyPrefix(): ?string
{
return 'beneficiary.section.initial_evaluation.labels';
}
}
29 changes: 29 additions & 0 deletions app/Enums/ViolencesTypesSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums\Arrayable;
use App\Concerns\Enums\Comparable;
use App\Concerns\Enums\HasLabel;

enum ViolencesTypesSchema: string
{
use Arrayable;
use Comparable;
use HasLabel;

case FREQUENCY_OF_VIOLENCE_ACTS = 'frequency_of_violence_acts';
case USE_WEAPONS_IN_ACT_OF_VIOLENCE = 'use_weapons_in_act_of_violence';
case CONTROLLING_AND_ISOLATING = 'controlling_and_isolating';
case STALKED_OR_HARASSED = 'stalked_or_harassed';
case SEXUAL_VIOLENCE = 'sexual_violence';
case DEATH_THREATS = 'death_threats';
case STRANGULATION_ATTEMPT = 'strangulation_attempt';

protected function labelKeyPrefix(): ?string
{
return 'beneficiary.section.initial_evaluation.labels';
}
}
Loading

0 comments on commit d4e4c87

Please sign in to comment.