Skip to content

Commit d30b94a

Browse files
wip on #570
1 parent 012f857 commit d30b94a

File tree

5 files changed

+22
-72
lines changed

5 files changed

+22
-72
lines changed

app/Filament/Organizations/Resources/BeneficiaryResource/Pages/DetailedEvaluation/EditDetailedEvaluation.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
use App\Filament\Organizations\Resources\BeneficiaryResource;
1010
use App\Forms\Components\DatePicker;
1111
use App\Forms\Components\Repeater;
12-
use App\Forms\Components\TableRepeater;
1312
use App\Services\Breadcrumb\BeneficiaryBreadcrumb;
14-
use Awcodes\TableRepeater\Header;
1513
use Filament\Facades\Filament;
1614
use Filament\Forms\Components\TextInput;
1715
use Filament\Resources\Pages\EditRecord;
@@ -22,8 +20,8 @@
2220

2321
class EditDetailedEvaluation extends EditRecord
2422
{
25-
use RedirectToDetailedEvaluation;
2623
use PreventSubmitFormOnEnter;
24+
use RedirectToDetailedEvaluation;
2725

2826
protected static string $resource = BeneficiaryResource::class;
2927

@@ -54,26 +52,14 @@ protected function getFormSchema(): array
5452
Section::make()
5553
->maxWidth('3xl')
5654
->schema([
57-
TableRepeater::make('detailedEvaluationSpecialists')
55+
Repeater::make('detailedEvaluationSpecialists')
5856
->relationship('detailedEvaluationSpecialists')
5957
->label(__('beneficiary.section.detailed_evaluation.labels.specialists'))
60-
->defaultItems(3)
58+
->minItems(3)
6159
->addActionLabel(__('beneficiary.action.add_row'))
62-
->showLabels(false)
6360
->deletable()
64-
->headers([
65-
Header::make('full_name')
66-
->label(__('beneficiary.section.detailed_evaluation.labels.full_name')),
67-
68-
Header::make('institution')
69-
->label(__('beneficiary.section.detailed_evaluation.labels.institution')),
70-
71-
Header::make('relationship')
72-
->label(__('beneficiary.section.detailed_evaluation.labels.relationship')),
73-
74-
Header::make('date')
75-
->label(__('beneficiary.section.detailed_evaluation.labels.contact_date')),
76-
])
61+
->columns(4)
62+
->itemLabel(fn (array $state): ?string => $state['full_name'] ?? null)
7763
->schema([
7864
TextInput::make('full_name')
7965
->label(__('beneficiary.section.detailed_evaluation.labels.full_name'))

app/Filament/Organizations/Resources/BeneficiaryResource/Resources/MonitoringResource/Pages/EditDetails.php

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
use App\Concerns\RedirectToMonitoring;
99
use App\Filament\Organizations\Resources\BeneficiaryResource\Resources\MonitoringResource;
1010
use App\Forms\Components\DatePicker;
11+
use App\Forms\Components\Repeater;
1112
use App\Forms\Components\Select;
12-
use App\Forms\Components\TableRepeater;
1313
use App\Models\Monitoring;
1414
use App\Models\UserRole;
1515
use App\Services\Breadcrumb\BeneficiaryBreadcrumb;
16-
use Awcodes\TableRepeater\Header;
1716
use Filament\Forms\Components\Hidden;
1817
use Filament\Forms\Components\Placeholder;
1918
use Filament\Forms\Components\TextInput;
@@ -27,8 +26,8 @@
2726

2827
class EditDetails extends EditRecord
2928
{
30-
use RedirectToMonitoring;
3129
use PreventSubmitFormOnEnter;
30+
use RedirectToMonitoring;
3231

3332
protected static string $resource = MonitoringResource::class;
3433

@@ -60,8 +59,8 @@ public function form(Schema $schema): Schema
6059

6160
public static function getFormSchemaStatic(): array
6261
{
63-
$instance = new static();
64-
$instance->record = new Monitoring();
62+
$instance = new static;
63+
$instance->record = new Monitoring;
6564

6665
return $instance->getFormSchema();
6766
}
@@ -89,23 +88,14 @@ protected function getFormSchema(): array
8988
Hidden::make('beneficiary_id')
9089
->formatStateUsing(fn ($record, $state) => $state ?? ($record?->beneficiary_id ?? $this->getParentRecord()?->id)),
9190

92-
TableRepeater::make('specialistsTeam')
91+
Repeater::make('specialistsTeam')
9392
->relationship('specialistsTeam')
94-
->defaultItems(1)
93+
->minItems(1)
9594
->hiddenLabel()
96-
->emptyLabel()
9795
->columnSpanFull()
9896
->addActionLabel(__('monitoring.actions.add_specialist'))
99-
->headers([
100-
Header::make('id')
101-
->label(__('nomenclature.labels.nr')),
102-
103-
Header::make('role_id')
104-
->label(__('monitoring.labels.role')),
105-
106-
Header::make('user_id')
107-
->label(__('monitoring.labels.specialist_name')),
108-
])
97+
->columns(3)
98+
->itemLabel(fn (array $state): ?string => $state['user_id'] ? \App\Models\User::find($state['user_id'])?->name : null)
10999
->schema([
110100
Placeholder::make('id')
111101
->label(__('nomenclature.labels.nr'))
@@ -137,7 +127,7 @@ protected function getFormSchema(): array
137127
),
138128

139129
Hidden::make('specialistable_type')
140-
->formatStateUsing(fn ($state) => (new Monitoring())->getMorphClass()),
130+
->formatStateUsing(fn ($state) => (new Monitoring)->getMorphClass()),
141131

142132
]),
143133
]),

app/Filament/Organizations/Resources/InterventionServiceResource/Pages/EditCounselingSheet.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
use App\Forms\Components\Select;
2828
use App\Models\InterventionService;
2929
use App\Services\Breadcrumb\InterventionPlanBreadcrumb;
30-
use Awcodes\TableRepeater\Components\TableRepeater;
31-
use Awcodes\TableRepeater\Header;
3230
use Filament\Actions\Action;
3331
use Filament\Forms\Components\CheckboxList;
3432
use Filament\Forms\Components\Placeholder;
@@ -163,22 +161,11 @@ public static function getLegalAssistanceForm(): array
163161

164162
Section::make(__('intervention_plan.headings.institution_contacted'))
165163
->schema([
166-
TableRepeater::make('data.institutions')
164+
Repeater::make('data.institutions')
167165
->hiddenLabel()
168166
->addActionLabel(__('intervention_plan.actions.add_institution'))
169-
->headers([
170-
Header::make('institution')
171-
->label(__('intervention_plan.labels.responsible_institution')),
172-
173-
Header::make('contact_date')
174-
->label(__('intervention_plan.labels.contact_date')),
175-
176-
Header::make('phone')
177-
->label(__('intervention_plan.labels.phone')),
178-
179-
Header::make('contact_person')
180-
->label(__('intervention_plan.labels.contact_person')),
181-
])
167+
->columns(4)
168+
->itemLabel(fn (array $state): ?string => $state['institution'] ?? null)
182169
->schema([
183170
TextInput::make('institution')
184171
->label(__('intervention_plan.labels.responsible_institution'))

app/Filament/Organizations/Resources/MonthlyPlanResource/Pages/EditMonthlyPlanServicesAndInterventions.php

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
use App\Forms\Components\DatePicker;
1313
use App\Forms\Components\Repeater;
1414
use App\Forms\Components\Select;
15-
use App\Forms\Components\TableRepeater;
1615
use App\Models\Service;
1716
use App\Models\ServiceIntervention;
1817
use App\Services\Breadcrumb\InterventionPlanBreadcrumb;
19-
use Awcodes\TableRepeater\Header;
2018
use Filament\Actions\Action;
2119
use Filament\Facades\Filament;
2220
use Filament\Forms\Components\Placeholder;
@@ -40,7 +38,7 @@ class EditMonthlyPlanServicesAndInterventions extends EditRecord
4038

4139
public function getBreadcrumbs(): array
4240
{
43-
return InterventionPlanBreadcrumb::make($this->parent)
41+
return InterventionPlanBreadcrumb::make($this->parent)
4442
->getViewMonthlyPlan($this->getRecord());
4543
}
4644

@@ -146,23 +144,12 @@ protected function getFormSchema(): array
146144
->maxLength(2000),
147145
]),
148146

149-
TableRepeater::make('monthlyPlanInterventions')
147+
Repeater::make('monthlyPlanInterventions')
150148
->relationship('monthlyPlanInterventions')
151149
->hiddenLabel()
152150
->addActionLabel(__('intervention_plan.actions.add_intervention_repeater'))
153-
->headers([
154-
Header::make('number')
155-
->label(__('intervention_plan.labels.count')),
156-
157-
Header::make('service_intervention_id')
158-
->label(__('intervention_plan.headings.interventions')),
159-
160-
Header::make('objections')
161-
->label(__('intervention_plan.labels.objections')),
162-
163-
Header::make('observations')
164-
->label(__('intervention_plan.labels.observations')),
165-
])
151+
->columns(4)
152+
->itemLabel(fn (array $state): ?string => $state['service_intervention_id'] ? ServiceIntervention::find($state['service_intervention_id'])?->name : null)
166153
->schema([
167154
Placeholder::make('number')
168155
->label(__('intervention_plan.labels.count'))

resources/views/components/notice.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
2121
$actions = array_filter(
2222
$getActions(),
23-
fn(\Filament\Infolists\Components\Actions\Action $action): bool => $action->isVisible(),
23+
fn (\Filament\Actions\Action $action): bool => $action->isVisible(),
2424
);
2525
2626
@endphp

0 commit comments

Comments
 (0)