Skip to content

Commit

Permalink
Merge pull request #475 from code4romania/371-ngo-admin-specialist-ca…
Browse files Browse the repository at this point in the history
…zuri-plan-de-interventie-implement-extra-variable-in-the-beneficii-sociale-section-of-the-intervention-plan

add award methods for benefits
  • Loading branch information
gheorghelupu17 authored Jan 9, 2025
2 parents d31aaef + 7e6d62e commit f9ece95
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/Enums/AwardMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums;
use Filament\Support\Contracts\HasLabel;

enum AwardMethod: string implements HasLabel
{
use Enums\HasLabel;
use Enums\Arrayable;
use Enums\Comparable;

case POSTAL_MONEY_ORDER_AT_HOME = 'postal_money_order_at_home';
case BANK_ACCOUNT = 'bank_account';
case PAYROLL = 'payroll';
case OTHER = 'other';

protected function labelKeyPrefix(): ?string
{
return 'enum.award_method';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Filament\Organizations\Resources\InterventionPlanResource\Widgets;

use App\Enums\AwardMethod;
use App\Forms\Components\Select;
use App\Models\BenefitType;
use App\Models\InterventionPlan;
Expand Down Expand Up @@ -53,6 +54,9 @@ public function table(Table $table): Table
->join(', ')
),

TextColumn::make('award_methods')
->label(__('intervention_plan.headings.award_methods')),

TextColumn::make('description')
->label(__('intervention_plan.headings.benefit_description'))
->html(),
Expand Down Expand Up @@ -111,6 +115,10 @@ public function getBenefitSchema(): array
// self::getBenefitTypes((int) $get('benefit_id'))->isEmpty()
// ),

CheckboxList::make('award_methods')
->label(__('intervention_plan.labels.award_methods'))
->options(AwardMethod::options()),

RichEditor::make('description')
->label(__('intervention_plan.labels.benefit_description'))
->placeholder(__('intervention_plan.placeholders.benefit_description'))
Expand Down
4 changes: 4 additions & 0 deletions app/Models/BenefitService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace App\Models;

use App\Enums\AwardMethod;
use Illuminate\Database\Eloquent\Casts\AsEnumCollection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
Expand All @@ -16,11 +18,13 @@ class BenefitService extends Model
'intervention_plan_id',
'benefit_id',
'benefit_types',
'award_methods',
'description',
];

protected $casts = [
'benefit_types' => 'json',
'award_methods' => AsEnumCollection::class . ':' . AwardMethod::class,
];

public function interventionPlan(): BelongsTo
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
Schema::table('benefit_services', function (Blueprint $table) {
$table->json('award_methods')->nullable();
});
}
};
8 changes: 8 additions & 0 deletions lang/ro/enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,4 +561,12 @@
'tomorrow' => 'Mâine',
'one_week' => '7 zile',
],

'award_method' => [
'postal_money_order_at_home' => 'Mandat poștal la domiciliu',
'bank_account' => 'Cont bancar',
'payroll' => 'Stat de plată',
'other' => 'Altă modalitate de acordare',

],
];
2 changes: 2 additions & 0 deletions lang/ro/intervention_plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
'actions' => 'Acțiuni',
'selected_interval' => 'Interval selectat',
'service_details' => 'Detalii acordare serviciu',
'award_methods' => 'Modalitatea de acordare',
'intervention_details' => 'Detalii acordare intervenții',
],

Expand Down Expand Up @@ -251,6 +252,7 @@
'edit_monthly_plan_title' => 'Editează plan lunar',
'edit_monthly_plan_services_and_interventions_title' => 'Editează servicii si intervenții',
'delete_monthly_plan_modal' => 'Șterge plan lunar',
'award_methods' => 'Modalitatea de acordare',
],

'actions' => [
Expand Down

0 comments on commit f9ece95

Please sign in to comment.