Skip to content

Commit

Permalink
Merge pull request #469 from code4romania/267-general-implement-consi…
Browse files Browse the repository at this point in the history
…stent-edit-buttons-all-across-the-platform

EditAction
  • Loading branch information
gheorghelupu17 authored Dec 31, 2024
2 parents 1d0e976 + 3ec7bf3 commit 9572836
Show file tree
Hide file tree
Showing 30 changed files with 68 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use App\Filament\Admin\Resources\InstitutionResource;
use App\Filament\Admin\Resources\InstitutionResource\Actions\ActivateInstitution;
use App\Filament\Admin\Resources\InstitutionResource\Actions\InactivateInstitution;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\DocumentPreview;
use App\Infolists\Components\Location;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
Expand Down Expand Up @@ -51,10 +51,7 @@ public function infolist(Infolist $infolist): Infolist
return $infolist->schema([
Section::make(__('institution.headings.institution_details'))
->headerActions([
Action::make('edit')
->label(__('general.action.edit'))
->icon('heroicon-o-pencil')
->link()
EditAction::make()
->url(self::$resource::getUrl('edit_institution_details', ['record' => $this->getRecord()])),
])
->maxWidth('3xl')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
namespace App\Filament\Admin\Resources\InstitutionResource\RelationManagers;

use App\Filament\Admin\Resources\InstitutionResource;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\DocumentPreview;
use App\Infolists\Components\SectionHeader;
use App\Models\Institution;
use Filament\Facades\Filament;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\RepeatableEntry;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
Expand Down Expand Up @@ -37,10 +37,7 @@ public function infolist(Infolist $infolist): Infolist
SectionHeader::make('center_details')
->state(__('institution.headings.center_details'))
->action(
Action::make('edit_centers')
->label(__('general.action.edit'))
->icon('heroicon-o-pencil')
->link()
EditAction::make('edit_centers')
->url(InstitutionResource::getUrl('edit_institution_centers', ['record' => $this->getOwnerRecord()]))
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Filament\Admin\Resources\OrganizationResource\RelationManagers;

use App\Tables\Actions\EditAction;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
Expand Down Expand Up @@ -52,7 +53,7 @@ public function table(Table $table): Table
Tables\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\EditAction::make(),
EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Expand Down
5 changes: 2 additions & 3 deletions app/Filament/Admin/Resources/ResultResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use App\Enums\GeneralStatus;
use App\Filament\Admin\Resources\ResultResource\Pages;
use App\Models\Result;
use App\Tables\Actions\EditAction;
use App\Tables\Filters\SelectFilter;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\CreateAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
Expand Down Expand Up @@ -66,8 +66,7 @@ public static function table(Table $table): Table
->options(GeneralStatus::options()),
])
->actions([
Tables\Actions\EditAction::make()
->label(__('general.action.change')),
EditAction::make(),
])
->emptyStateHeading(__('nomenclature.headings.empty_state_results_table'))
->emptyStateDescription(null)
Expand Down
5 changes: 2 additions & 3 deletions app/Filament/Admin/Resources/RoleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
use App\Filament\Admin\Resources\RoleResource\Pages;
use App\Forms\Components\Spacer;
use App\Models\Role;
use App\Tables\Actions\EditAction;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\Placeholder;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\CreateAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
Expand Down Expand Up @@ -106,8 +106,7 @@ public static function table(Table $table): Table
->options(GeneralStatus::options()),
])
->actions([
Tables\Actions\EditAction::make()
->label(__('nomenclature.actions.edit')),
EditAction::make(),
])
->emptyStateHeading(__('nomenclature.labels.empty_state_role_table'))
->emptyStateDescription(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
use App\Filament\Admin\Resources\UserInstitutionResource\Actions\ActivateUserAction;
use App\Filament\Admin\Resources\UserInstitutionResource\Actions\DeactivateUserAction;
use App\Filament\Admin\Resources\UserInstitutionResource\Actions\ResendInvitationAction;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\DateTimeEntry;
use App\Infolists\Components\SectionHeader;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
Expand Down Expand Up @@ -85,9 +85,7 @@ public function infolist(Infolist $infolist): Infolist
SectionHeader::make('edit_user')
->state(__('user.heading.specialist_details'))
->action(
Action::make('edit')
->label(__('general.action.edit'))
->link()
EditAction::make()
->url(self::getParentResource()::getUrl('user.edit', [
'parent' => $this->parent,
'record' => $this->getRecord(),
Expand Down
3 changes: 2 additions & 1 deletion app/Filament/Admin/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Filament\Admin\Resources\UserResource\Pages;
use App\Forms\Components\Select;
use App\Models\User;
use App\Tables\Actions\EditAction;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
Expand Down Expand Up @@ -126,7 +127,7 @@ public static function table(Table $table): Table
->multiple(),
])
->actions([
Tables\Actions\EditAction::make(),
EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Models\BeneficiaryIntervention;
use App\Models\InterventionService;
use App\Models\OrganizationServiceIntervention;
use App\Tables\Actions\EditAction;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
Expand Down Expand Up @@ -127,7 +128,7 @@ public static function table(Table $table): Table
//
])
->actions([
Tables\Actions\EditAction::make(),
EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
use App\Filament\Organizations\Resources\BeneficiaryInterventionResource;
use App\Filament\Organizations\Resources\InterventionPlanResource;
use App\Filament\Organizations\Resources\InterventionServiceResource;
use App\Infolists\Components\Actions\EditAction;
use App\Services\Breadcrumb\InterventionPlanBreadcrumb;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Grid;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
Expand Down Expand Up @@ -58,10 +58,7 @@ public function infolist(Infolist $infolist): Infolist
->schema([
Section::make(__('intervention_plan.headings.intervention_indicators'))
->headerActions([
Action::make('edit_intervention')
->label(__('general.action.edit'))
->icon('heroicon-o-pencil')
->link()
EditAction::make('edit_intervention')
->url(fn () => InterventionServiceResource::getUrl('edit_intervention', [
'parent' => $this->record->interventionService,
'record' => $this->record,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use App\Forms\Components\DatePicker;
use App\Forms\Components\Select;
use App\Infolists\Components\Actions\CreateAction;
use App\Infolists\Components\Actions\Edit;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\SectionHeader;
use App\Models\InterventionMeeting;
use App\Services\Breadcrumb\InterventionPlanBreadcrumb;
Expand Down Expand Up @@ -140,8 +140,7 @@ public function infolist(Infolist $infolist): Infolist
})
->badge(fn (InterventionMeeting $record) => $record->status)
->action(
Edit::make('edit')
->icon('heroicon-o-pencil')
EditAction::make()
->modalHeading(__('general.action.edit'))
->form($this->getFormSchema())
->fillForm(fn (InterventionMeeting $record) => $record->toArray())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use App\Actions\BackAction;
use App\Enums\CloseMethod;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Infolists\Components\Actions\Edit;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\DateEntry;
use App\Infolists\Components\Notice;
use App\Models\Beneficiary;
Expand Down Expand Up @@ -73,7 +73,7 @@ public function infolist(Infolist $infolist): Infolist
->columns()
->relationship('closeFile')
->headerActions([
Edit::make('edit_details')
EditAction::make('edit_details')
->url(self::getResource()::getUrl('edit_close_file_details', ['record' => $this->getRecord()])),
])
->schema([
Expand Down Expand Up @@ -131,7 +131,7 @@ public function infolist(Infolist $infolist): Infolist
->columns()
->relationship('closeFile')
->headerActions([
Edit::make('edit_details')
EditAction::make('edit_details')
->url(self::getResource()::getUrl('edit_close_file_general_details', ['record' => $this->getRecord()])),
])
->schema([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use App\Enums\Ternary;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Filament\Organizations\Resources\BeneficiaryResource\Pages\ViewBeneficiaryIdentity;
use App\Infolists\Components\Actions\Edit;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\DateEntry;
use App\Infolists\Components\Location;
use App\Services\Breadcrumb\BeneficiaryBreadcrumb;
Expand Down Expand Up @@ -59,7 +59,7 @@ public function infolist(Infolist $infolist): Infolist
->schema([
Section::make(__('beneficiary.wizard.detailed_evaluation.label'))
->headerActions([
Edit::make('edit')
EditAction::make()
->url(fn ($record) => BeneficiaryResource::getUrl(
'edit_detailed_evaluation',
['record' => $record]
Expand All @@ -85,7 +85,7 @@ public function infolist(Infolist $infolist): Infolist
->schema([
Section::make(__('beneficiary.section.detailed_evaluation.heading.partner'))
->headerActions([
Edit::make('edit')
EditAction::make()
->url(fn ($record) => BeneficiaryResource::getUrl(
'edit_beneficiary_partner',
['record' => $record]
Expand All @@ -100,7 +100,7 @@ public function infolist(Infolist $infolist): Infolist
->schema([
Section::make(__('beneficiary.wizard.multidisciplinary_evaluation.label'))
->headerActions([
Edit::make('edit')
EditAction::make()
->url(fn ($record) => BeneficiaryResource::getUrl(
'edit_multidisciplinary_evaluation',
['record' => $record]
Expand All @@ -117,7 +117,7 @@ public function infolist(Infolist $infolist): Infolist
->schema([
Section::make(__('beneficiary.wizard.results.label'))
->headerActions([
Edit::make('edit')
EditAction::make()
->url(fn ($record) => BeneficiaryResource::getUrl(
'edit_detailed_evaluation_result',
['record' => $record]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
use App\Enums\Ternary;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Filament\Organizations\Resources\BeneficiaryResource\Pages\ViewBeneficiaryIdentity;
use App\Infolists\Components\Actions\Edit;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\Notice;
use App\Infolists\Components\SectionHeader;
use App\Services\Breadcrumb\BeneficiaryBreadcrumb;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\Tabs;
use Filament\Infolists\Components\TextEntry;
Expand Down Expand Up @@ -56,7 +55,7 @@ public function infolist(Infolist $infolist): Infolist
->schema([
Section::make(__('beneficiary.wizard.details.label'))
->headerActions([
Edit::make('edit')
EditAction::make()
->url(fn ($record) => BeneficiaryResource::getUrl(
'edit_initial_evaluation_details',
['record' => $record]
Expand All @@ -77,7 +76,7 @@ public function infolist(Infolist $infolist): Infolist
->schema([
Section::make(__('beneficiary.wizard.violence.label'))
->headerActions([
Edit::make('edit')
EditAction::make()
->url(fn ($record) => BeneficiaryResource::getUrl(
'edit_initial_evaluation_violence',
['record' => $record]
Expand All @@ -94,13 +93,11 @@ public function infolist(Infolist $infolist): Infolist
SectionHeader::make('riskFactors')
->state(__('beneficiary.wizard.risk_factors.label'))
->action(
Action::make('view')
->label(__('general.action.edit'))
EditAction::make()
->url(BeneficiaryResource::getUrl(
'edit_initial_evaluation_risk_factors',
['record' => $this->getRecord()]
))
->link(),
)),
),

...EditRiskFactors::getInfoListSchema(),
Expand All @@ -111,7 +108,7 @@ public function infolist(Infolist $infolist): Infolist
->schema([
Section::make(__('beneficiary.wizard.requested_services.label'))
->headerActions([
Edit::make('edit')
EditAction::make()
->url(fn ($record) => BeneficiaryResource::getUrl(
'edit_initial_evaluation_requested_services',
['record' => $record]
Expand All @@ -123,7 +120,7 @@ public function infolist(Infolist $infolist): Infolist
->schema([
Section::make(__('beneficiary.wizard.beneficiary_situation.label'))
->headerActions([
Edit::make('edit')
EditAction::make()
->url(fn ($record) => BeneficiaryResource::getUrl(
'edit_initial_evaluation_beneficiary_situation',
['record' => $record]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use App\Actions\BackAction;
use App\Enums\AddressType;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Infolists\Components\Actions\Edit;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\DateEntry;
use App\Infolists\Components\EnumEntry;
use App\Infolists\Components\Location;
Expand Down Expand Up @@ -72,7 +72,7 @@ public static function getBeneficiaryIdentityFormSchema(): array
return [
Section::make(__('beneficiary.section.identity.tab.beneficiary'))
->headerActions([
Edit::make('edit')
EditAction::make('edit')
->url(fn ($record) => BeneficiaryResource::getUrl('edit_identity', ['record' => $record])),
])
->schema(self::identitySchema()),
Expand Down Expand Up @@ -210,7 +210,7 @@ public static function getChildrenIdentityFormSchema(): array
return [
Section::make(__('beneficiary.section.identity.tab.children'))
->headerActions([
Edit::make('edit')
EditAction::make('edit')
->url(fn ($record) => BeneficiaryResource::getUrl('edit_children', ['record' => $record])),
])
->schema(self::childrenSchema()),
Expand Down
Loading

0 comments on commit 9572836

Please sign in to comment.