Skip to content

Commit

Permalink
Table EditAction
Browse files Browse the repository at this point in the history
  • Loading branch information
alexPopaCode4 committed Dec 30, 2024
1 parent 0bf3239 commit 89c6e17
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 86 deletions.
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
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 @@ -63,13 +63,12 @@ public function table(Table $table): Table
EditAction::make()
->form($this->getFormSchema())
->fillForm(function (Specialist $record) {
if (!$record->role_id) {
if (! $record->role_id) {
$record->role_id = -1;
}

return $record->toArray();
})
->label(__('beneficiary.section.specialists.change_action'))
->modalHeading(__('beneficiary.section.specialists.heading.edit_modal'))
->extraModalFooterActions([
DeleteAction::make()
Expand Down Expand Up @@ -128,7 +127,7 @@ public function getFormSchema(): array
->label(__('beneficiary.section.specialists.labels.name'))
->options(
function (Get $get, $state) {
$roleID = (int)$get('role_id');
$roleID = (int) $get('role_id');
if ($roleID === -1) {
if ($state) {
return [$state => User::find($state)->full_name];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public function table(Table $table): Table
])
->actions([
EditAction::make()
->label(__('intervention_plan.actions.edit'))
->form($this->getBenefitSchema())
->extraModalFooterActions([
DeleteAction::make()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public function table(Table $table): Table
])
->actions([
EditAction::make()
->label(__('general.action.change'))
->form($this->getFormSchema())
->modalHeading(__('intervention_plan.headings.edit_result'))
->extraModalFooterActions([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
use App\Filament\Organizations\Resources\BeneficiaryInterventionResource\Pages\ViewUnfoldedMeetings;
use App\Filament\Organizations\Resources\InterventionServiceResource\Pages;
use App\Models\InterventionService;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;

class InterventionServiceResource extends Resource
{
Expand All @@ -23,40 +20,6 @@ class InterventionServiceResource extends Resource

public static string $parentResource = InterventionPlanResource::class;

public static function form(Form $form): Form
{
return $form
->schema([

]);
}

public static function table(Table $table): Table
{
return $table
->columns([
//
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

public static function getRelations(): array
{
return [
//
];
}

public static function getPages(): array
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
namespace App\Filament\Organizations\Resources\InterventionServiceResource\Widgets;

use App\Filament\Organizations\Resources\InterventionPlanResource;
use App\Infolists\Components\Actions\EditAction;
use App\Models\InterventionService;
use App\Widgets\InfolistWidget;
use Filament\Infolists\Components\Actions\Action;
//use Filament\Actions\Action;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;

Expand All @@ -28,10 +27,7 @@ protected function getInfolistSchema(): array
->maxWidth('3xl')
->columns()
->headerActions([
Action::make('edit')
->label(__('intervention_plan.actions.edit'))
->icon('heroicon-o-pencil')
->link()
EditAction::make('edit')
->url(InterventionPlanResource::getUrl('edit_intervention_service', [
'parent' => $this->record->interventionPlan,
'record' => $this->record,
Expand Down
26 changes: 0 additions & 26 deletions app/Filament/Organizations/Resources/MonitoringResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,4 @@ public static function getRecordTitle(Model|null $record): string|null|Htmlable
return $record->number;
}

public static function form(Form $form): Form
{
return $form
->schema([
//
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
//
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
}
8 changes: 8 additions & 0 deletions app/Tables/Actions/EditAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@
class EditAction extends BaseEditAction
{
use HasModalExtraFooterActionsAlignment;

protected function setUp(): void
{
parent::setUp();

$this->label(__('general.action.change'));
$this->icon(null);
}
}
1 change: 0 additions & 1 deletion lang/ro/beneficiary.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@
'specialists' => [
'title' => 'Echipa de caz',
'add_action' => 'Adaugă membru echipă',
'change_action' => 'Modifică',
'heading' => [
'add_modal' => 'Adaugă membru în echipă',
'edit_modal' => 'Modifică membru în echipă',
Expand Down
1 change: 0 additions & 1 deletion lang/ro/intervention_plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@

'actions' => [
'create' => 'Creează plan',
'edit' => 'Editează',
'edit_intervention_plan' => 'Actualizează detalii',
'add_service' => 'Adaugă serviciu',
'add_service_repeater' => 'Adaugă încă un serviciu',
Expand Down
1 change: 0 additions & 1 deletion lang/ro/nomenclature.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
'add_role' => 'Adaugă rol specialist',
'edit_role' => 'Modifică rol specialist',
'delete_role' => 'Șterge rol',
'edit' => 'Modifică',
'add_benefit' => 'Adaugă beneficiu social',
'add_benefit_type' => 'Adaugă încă un tip',
'edit_benefit' => 'Modifică beneficiu',
Expand Down

0 comments on commit 89c6e17

Please sign in to comment.