Skip to content

Commit

Permalink
Edit page title + other translate (#83)
Browse files Browse the repository at this point in the history
* Edit page title + other translate

* 85

* 86

* redirect initial and detailed evaluation

* feat: sticky footer

* feat: unsavedChangesAlerts

* min

* Apply suggestions from code review

* Apply suggestions from code review

---------

Co-authored-by: Andrei Ioniță <[email protected]>
  • Loading branch information
alexPopaCode4 and andreiio authored Aug 1, 2024
1 parent 7ec0195 commit 0b3497c
Show file tree
Hide file tree
Showing 22 changed files with 156 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public function getBreadcrumb(): string
return __('beneficiary.breadcrumb.wizard_detailed_evaluation');
}

protected function getRedirectUrl(): string
{
return self::$resource::getUrl('view_detailed_evaluation', ['record' => $this->getRecord()]);
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,24 @@
use Filament\Forms\Components\Wizard\Step;
use Filament\Resources\Pages\CreateRecord\Concerns\HasWizard;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Contracts\Support\Htmlable;

class CreateInitialEvaluation extends EditRecord
{
use HasWizard;

protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.initial_evaluation.title');
}

protected function getRedirectUrl(): string
{
return self::$resource::getUrl('view_initial_evaluation', ['record' => $this->getRecord()]);
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ protected function getHeaderActions(): array

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.edit_identity.title', [
'name' => $this->record->full_name,
'id' => $this->record->id,
]);
return __('beneficiary.page.edit_identity.title');
}

public function getBreadcrumbs(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Filament\Forms\Get;
use Filament\Forms\Set;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Str;

class EditBeneficiaryPartner extends EditRecord
Expand All @@ -27,6 +28,11 @@ class EditBeneficiaryPartner extends EditRecord

protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.edit_beneficiary_partner.title');
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Filament\Infolists\Components\Group as InfolistGroup;
use Filament\Infolists\Components\TextEntry;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Str;

class EditBeneficiarySituation extends EditRecord
Expand All @@ -22,6 +23,11 @@ class EditBeneficiarySituation extends EditRecord

protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.edit_beneficiary_situation.title');
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Str;

class EditDetailedEvaluation extends EditRecord
Expand All @@ -22,6 +23,11 @@ class EditDetailedEvaluation extends EditRecord

protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.edit_evaluation_details.title');
}

public function form(Form $form): Form
{
return $form->schema(self::getSchema());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Filament\Forms\Form;
use Filament\Infolists\Components\TextEntry;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Str;

class EditDetailedEvaluationResult extends EditRecord
Expand All @@ -25,6 +26,11 @@ class EditDetailedEvaluationResult extends EditRecord

protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.edit_detailed_evaluation_result.title');
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Filament\Infolists\Components\Group as InfolistGroup;
use Filament\Infolists\Components\TextEntry;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Str;

class EditEvaluationDetails extends EditRecord
Expand All @@ -25,6 +26,11 @@ class EditEvaluationDetails extends EditRecord

protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.edit_evaluation_details.title');
}

public function form(Form $form): Form
{
return $form->schema(self::getSchema());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Str;
use Livewire\Component;

Expand All @@ -27,6 +28,11 @@ class EditMultidisciplinaryEvaluation extends EditRecord

protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.edit_multidisciplinary_evaluation.title');
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Filament\Infolists\Components\Group as InfolistGroup;
use Filament\Infolists\Components\Section as InfolistSection;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Str;

class EditRequestedServices extends EditRecord
Expand All @@ -21,6 +22,11 @@ class EditRequestedServices extends EditRecord

protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.edit_requested_services.title');
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Filament\Infolists\Components\TextEntry;
use Filament\Resources\Pages\EditRecord;
use Filament\Support\Colors\Color;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Str;

class EditRiskFactors extends EditRecord
Expand All @@ -35,6 +36,11 @@ class EditRiskFactors extends EditRecord

protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.edit_risk_factors.title');
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Filament\Infolists\Components\TextEntry;
use Filament\Resources\Pages\EditRecord;
use Filament\Support\Colors\Color;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Str;

class EditViolence extends EditRecord
Expand All @@ -26,6 +27,11 @@ class EditViolence extends EditRecord

protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.edit_violence.title');
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function infolist(Infolist $infolist): Infolist

protected function identitySectionSection(): Section
{
return Section::make(__('beneficiary.section.identity.title'))
return Section::make(__('beneficiary.page.identity.title'))
->columnSpan(1)
->columns()
->headerActions([
Expand Down Expand Up @@ -127,7 +127,7 @@ protected function identitySectionSection(): Section

protected function personalInformationSection(): Section
{
return Section::make(__('beneficiary.section.personal_information.title'))
return Section::make(__('beneficiary.page.personal_information.title'))
->columnSpan(1)
->columns()
->headerActions([
Expand All @@ -153,6 +153,7 @@ protected function personalInformationSection(): Section
->url(fn ($state) => "tel:{$state}"),

RepeatableEntry::make('aggressor')
->label(__('beneficiary.section.personal_information.section.aggressor'))
->columns()
->columnSpanFull()
->schema([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ViewBeneficiaryIdentity extends ViewRecord

public function getTitle(): string|Htmlable
{
return __('beneficiary.section.identity.title');
return __('beneficiary.page.identity.title');
}

public function getBreadcrumbs(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ViewBeneficiaryPersonalInformation extends ViewRecord

public function getTitle(): string|Htmlable
{
return __('beneficiary.section.personal_information.title');
return __('beneficiary.page.personal_information.title');
}

public function getBreadcrumbs(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
use Filament\Resources\Pages\ViewRecord;
use Illuminate\Contracts\Support\Htmlable;

class ViewDetailedEvaluation extends ViewRecord
{
protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.view_detailed_evaluation.title');
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down Expand Up @@ -300,6 +306,7 @@ public function getDetailedEvaluationSchema(): array
return [
RepeatableEntry::make('specialists')
->columns(4)
->label(__('beneficiary.section.detailed_evaluation.labels.specialists'))
->schema([
TextEntry::make('full_name')
->label(__('beneficiary.section.detailed_evaluation.labels.full_name')),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@
use Filament\Infolists\Components\Tabs;
use Filament\Infolists\Infolist;
use Filament\Resources\Pages\ViewRecord;
use Illuminate\Contracts\Support\Htmlable;

class ViewInitialEvaluation extends ViewRecord
{
protected static string $resource = BeneficiaryResource::class;

public function getTitle(): string|Htmlable
{
return __('beneficiary.page.initial_evaluation.title');
}

public function getBreadcrumbs(): array
{
return BeneficiaryBreadcrumb::make($this->getRecord())
Expand Down
2 changes: 2 additions & 0 deletions app/Providers/Filament/AdminPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ public function panel(Panel $panel): Panel
// Widgets\AccountWidget::class,
])
->bootUsing(function () {
Page::stickyFormActions();
Page::alignFormActionsEnd();
})
->unsavedChangesAlerts()
->plugins([
BreezyCore::make()
->myProfile(
Expand Down
2 changes: 2 additions & 0 deletions app/Providers/Filament/OrganizationPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ public function panel(Panel $panel): Panel
// Widgets\AccountWidget::class,
])
->bootUsing(function () {
Page::stickyFormActions();
Page::alignFormActionsEnd();
MountableAction::configureUsing(function (MountableAction $action) {
$action->modalFooterActionsAlignment(Alignment::Right);
});
})
->unsavedChangesAlerts()
// ->databaseNotifications()
->plugins([
BreezyCore::make()
Expand Down
2 changes: 1 addition & 1 deletion app/Services/Breadcrumb/BeneficiaryBreadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getBaseBreadcrumbs(): array

public function getIdentityBreadcrumbs(): array
{
$breadcrumb = __('beneficiary.section.identity.title');
$breadcrumb = __('beneficiary.page.identity.title');

return array_merge(
$this->getBaseBreadcrumbs(),
Expand Down
Loading

0 comments on commit 0b3497c

Please sign in to comment.