refactor: Standardize anonymous function syntax and update modal width definitions to use Filament's Width enum.
This commit is contained in:
parent
89f0d511e4
commit
ff54d97d98
@ -72,9 +72,9 @@ public static function infolist(Schema $schema): Schema
|
||||
Section::make('Informasi Kerja Sama')
|
||||
->headerActions([
|
||||
Action::make('status')
|
||||
->label(fn($record) => $record->status->getLabel())
|
||||
->label(fn ($record) => $record->status->getLabel())
|
||||
->badge()
|
||||
->color(fn($record) => $record->status->getColor())
|
||||
->color(fn ($record) => $record->status->getColor())
|
||||
->disabled(),
|
||||
])
|
||||
->schema([
|
||||
@ -117,7 +117,7 @@ public static function infolist(Schema $schema): Schema
|
||||
->placeholder('Belum dibayar'),
|
||||
]),
|
||||
])
|
||||
->visible(fn($record) => $record->payment_amount || $record->payment_date),
|
||||
->visible(fn ($record) => $record->payment_amount || $record->payment_date),
|
||||
|
||||
TextEntry::make('description')
|
||||
->label('Deskripsi')
|
||||
|
||||
@ -42,7 +42,7 @@ public function table(Table $table): Table
|
||||
|
||||
TextColumn::make('e_catalog')
|
||||
->label('E-Catalog')
|
||||
->url(fn($record) => $record->e_catalog)
|
||||
->url(fn ($record) => $record->e_catalog)
|
||||
->openUrlInNewTab()
|
||||
->color('primary'),
|
||||
|
||||
@ -88,7 +88,7 @@ public function table(Table $table): Table
|
||||
->success()
|
||||
->send();
|
||||
})
|
||||
->visible(fn(CooperationProposal $record) => ! auth()->user()->hasRole('Perusahaan') && $record->status === ApprovalStatus::PENDING),
|
||||
->visible(fn (CooperationProposal $record) => ! auth()->user()->hasRole('Perusahaan') && $record->status === ApprovalStatus::PENDING),
|
||||
|
||||
Action::make('reject')
|
||||
->label('Tolak')
|
||||
@ -114,7 +114,7 @@ public function table(Table $table): Table
|
||||
->warning()
|
||||
->send();
|
||||
})
|
||||
->visible(fn(CooperationProposal $record) => ! auth()->user()->hasRole('Perusahaan') && $record->status === ApprovalStatus::PENDING)
|
||||
->visible(fn (CooperationProposal $record) => ! auth()->user()->hasRole('Perusahaan') && $record->status === ApprovalStatus::PENDING)
|
||||
->modalWidth(Width::Large),
|
||||
])
|
||||
->toolbarActions([
|
||||
|
||||
@ -40,7 +40,7 @@ public function form(Schema $schema): Schema
|
||||
|
||||
DatePicker::make('publication_date')
|
||||
->label('Tanggal Publikasi')
|
||||
->placeholder(fn() => now()->format('l, d F Y'))
|
||||
->placeholder(fn () => now()->format('l, d F Y'))
|
||||
->native(false)
|
||||
->displayFormat('l, d F Y')
|
||||
->required(),
|
||||
@ -85,7 +85,7 @@ public function table(Table $table): Table
|
||||
TextColumn::make('link')
|
||||
->label('Link')
|
||||
->limit(30)
|
||||
->url(fn($record) => $record->link)
|
||||
->url(fn ($record) => $record->link)
|
||||
->openUrlInNewTab(),
|
||||
|
||||
TextColumn::make('status')
|
||||
@ -113,7 +113,7 @@ public function table(Table $table): Table
|
||||
->success()
|
||||
->send();
|
||||
})
|
||||
->visible(fn(Report $record) => ! auth()->user()->hasRole('Perusahaan') && $record->status === ApprovalStatus::PENDING),
|
||||
->visible(fn (Report $record) => ! auth()->user()->hasRole('Perusahaan') && $record->status === ApprovalStatus::PENDING),
|
||||
|
||||
Action::make('reject')
|
||||
->label('Tolak')
|
||||
@ -138,13 +138,13 @@ public function table(Table $table): Table
|
||||
->warning()
|
||||
->send();
|
||||
})
|
||||
->visible(fn(Report $record) => ! auth()->user()->hasRole('Perusahaan') && $record->status === ApprovalStatus::PENDING)
|
||||
->visible(fn (Report $record) => ! auth()->user()->hasRole('Perusahaan') && $record->status === ApprovalStatus::PENDING)
|
||||
->modalWidth(Width::Large),
|
||||
])
|
||||
->headerActions([
|
||||
CreateAction::make()
|
||||
->label('Buat Laporan')
|
||||
->modalWidth('lg')
|
||||
->modalWidth(Width::Large)
|
||||
->modalHeading('Buat Laporan')
|
||||
->mutateDataUsing(function (array $data): array {
|
||||
$data['task_assignment_id'] = $this->getOwnerRecord()->taskAssignments()->first()?->id;
|
||||
|
||||
@ -93,7 +93,7 @@ public function table(Table $table): Table
|
||||
TextColumn::make('report_count')
|
||||
->label('Laporan Diterima')
|
||||
->getStateUsing(function (TaskAssignment $record) {
|
||||
return $record->reports()->count() . ' / ' . ($record->report_amount * $record->partnerMedia()->count());
|
||||
return $record->reports()->count().' / '.($record->report_amount * $record->partnerMedia()->count());
|
||||
}),
|
||||
])
|
||||
->filters([
|
||||
@ -102,7 +102,7 @@ public function table(Table $table): Table
|
||||
->headerActions([
|
||||
CreateAction::make()
|
||||
->label('Buat Penugasan')
|
||||
->visible(fn() => $this->canCreateTaskAssignment()),
|
||||
->visible(fn () => $this->canCreateTaskAssignment()),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\TrashedFilter;
|
||||
@ -299,7 +300,7 @@ public static function configure(Table $table): Table
|
||||
])
|
||||
->exists();
|
||||
})
|
||||
->modalWidth('lg'),
|
||||
->modalWidth(Width::Large),
|
||||
Action::make('create_task_assignment')
|
||||
->label('Buat Penugasan')
|
||||
->icon(Heroicon::Plus)
|
||||
@ -364,7 +365,7 @@ public static function configure(Table $table): Table
|
||||
&& ! $record->taskAssignments()->exists()
|
||||
&& $record->status === CooperationStatus::ASSIGNMENT
|
||||
)
|
||||
->modalWidth('lg'),
|
||||
->modalWidth(Width::Large),
|
||||
EditAction::make()
|
||||
->visible(fn () => ! auth()->user()->hasRole('Perusahaan')),
|
||||
DeleteAction::make()
|
||||
|
||||
@ -104,7 +104,7 @@ public static function form(Schema $schema): Schema
|
||||
->schema(
|
||||
collect($documents)
|
||||
->map(
|
||||
fn($doc) => Section::make($doc['title'])
|
||||
fn ($doc) => Section::make($doc['title'])
|
||||
->schema([
|
||||
TextInput::make($doc['text_name'])
|
||||
->hiddenLabel()
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
use App\Filament\Resources\Manage\Journalists\JournalistResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
@ -26,7 +27,7 @@ protected function getHeaderActions(): array
|
||||
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
|
||||
->label('Simpan dan Tambah Lagi'),
|
||||
])
|
||||
->modalWidth('lg')
|
||||
->modalWidth(Width::Large)
|
||||
->using(function (array $data, string $model): Model {
|
||||
$data['partner_media_id'] = auth()->user()->company?->partnerMedia?->id;
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ public static function table(Table $table): Table
|
||||
->label('Perusahaan')
|
||||
->searchable()
|
||||
->sortable()
|
||||
->description(fn(User $record) => $record->company?->director_name),
|
||||
->description(fn (User $record) => $record->company?->director_name),
|
||||
|
||||
TextColumn::make('company.partnerMedia.name')
|
||||
->label('Media')
|
||||
@ -96,7 +96,7 @@ public static function table(Table $table): Table
|
||||
TrashedFilter::make()->native(false),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->modalWidth('lg'),
|
||||
EditAction::make()->modalWidth(Width::Large),
|
||||
DeleteAction::make(),
|
||||
ForceDeleteAction::make(),
|
||||
RestoreAction::make(),
|
||||
|
||||
@ -70,7 +70,7 @@ public static function table(Table $table): Table
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Aktif?')
|
||||
->sortable()
|
||||
->getStateUsing(fn(Classification $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->getStateUsing(fn (Classification $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->updateStateUsing(function (Classification $record, bool $state) {
|
||||
$record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE;
|
||||
$record->save();
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
use App\Filament\Resources\Master\Classifications\ClassificationResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Filament\Support\Enums\Width;
|
||||
|
||||
class ManageClassifications extends ManageRecords
|
||||
{
|
||||
@ -24,7 +25,7 @@ protected function getHeaderActions(): array
|
||||
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
|
||||
->label('Simpan dan Tambah Lagi'),
|
||||
])
|
||||
->modalWidth('lg'),
|
||||
->modalWidth(Width::Large),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public static function table(Table $table): Table
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Aktif?')
|
||||
->sortable()
|
||||
->getStateUsing(fn(Department $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->getStateUsing(fn (Department $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->updateStateUsing(function (Department $record, bool $state) {
|
||||
$record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE;
|
||||
$record->save();
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
use App\Filament\Resources\Master\Departments\DepartmentResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Filament\Support\Enums\Width;
|
||||
|
||||
class ManageDepartments extends ManageRecords
|
||||
{
|
||||
@ -24,7 +25,7 @@ protected function getHeaderActions(): array
|
||||
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
|
||||
->label('Simpan dan Tambah Lagi'),
|
||||
])
|
||||
->modalWidth('lg'),
|
||||
->modalWidth(Width::Large),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public static function table(Table $table): Table
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Aktif?')
|
||||
->sortable()
|
||||
->getStateUsing(fn(Location $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->getStateUsing(fn (Location $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->updateStateUsing(function (Location $record, bool $state) {
|
||||
$record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE;
|
||||
$record->save();
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
use App\Filament\Resources\Master\Locations\LocationResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Filament\Support\Enums\Width;
|
||||
|
||||
class ManageLocations extends ManageRecords
|
||||
{
|
||||
@ -24,7 +25,7 @@ protected function getHeaderActions(): array
|
||||
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
|
||||
->label('Simpan dan Tambah Lagi'),
|
||||
])
|
||||
->modalWidth('lg'),
|
||||
->modalWidth(Width::Large),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
use App\Filament\Resources\Master\SubClassifications\SubClassificationResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Filament\Support\Enums\Width;
|
||||
|
||||
class ManageSubClassifications extends ManageRecords
|
||||
{
|
||||
@ -24,7 +25,7 @@ protected function getHeaderActions(): array
|
||||
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
|
||||
->label('Simpan dan Tambah Lagi'),
|
||||
])
|
||||
->modalWidth('lg'),
|
||||
->modalWidth(Width::Large),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public static function table(Table $table): Table
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Aktif?')
|
||||
->sortable()
|
||||
->getStateUsing(fn(SubClassification $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->getStateUsing(fn (SubClassification $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->updateStateUsing(function (SubClassification $record, bool $state) {
|
||||
$record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE;
|
||||
$record->save();
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
use App\Filament\Resources\Master\SubLocations\SubLocationResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Filament\Support\Enums\Width;
|
||||
|
||||
class ManageSubLocations extends ManageRecords
|
||||
{
|
||||
@ -24,7 +25,7 @@ protected function getHeaderActions(): array
|
||||
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
|
||||
->label('Simpan dan Tambah Lagi'),
|
||||
])
|
||||
->modalWidth('lg'),
|
||||
->modalWidth(Width::Large),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public static function table(Table $table): Table
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Aktif?')
|
||||
->sortable()
|
||||
->getStateUsing(fn(SubLocation $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->getStateUsing(fn (SubLocation $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->updateStateUsing(function (SubLocation $record, bool $state) {
|
||||
$record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE;
|
||||
$record->save();
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
use App\Filament\Resources\Master\Themes\ThemeResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Filament\Support\Enums\Width;
|
||||
|
||||
class ManageThemes extends ManageRecords
|
||||
{
|
||||
@ -24,7 +25,7 @@ protected function getHeaderActions(): array
|
||||
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
|
||||
->label('Simpan dan Tambah Lagi'),
|
||||
])
|
||||
->modalWidth('lg'),
|
||||
->modalWidth(Width::Large),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public static function table(Table $table): Table
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Aktif?')
|
||||
->sortable()
|
||||
->getStateUsing(fn(Theme $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->getStateUsing(fn (Theme $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->updateStateUsing(function (Theme $record, bool $state) {
|
||||
$record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE;
|
||||
$record->save();
|
||||
|
||||
@ -80,13 +80,13 @@ public static function form(Schema $schema): Schema
|
||||
Select::make('roles')
|
||||
->label('Peran')
|
||||
->required()
|
||||
->relationship('roles', 'name', fn($query) => $query->whereNotIn('name', [RoleEnum::DEVELOPER, RoleEnum::PERUSAHAAN]))
|
||||
->relationship('roles', 'name', fn ($query) => $query->whereNotIn('name', [RoleEnum::DEVELOPER, RoleEnum::PERUSAHAAN]))
|
||||
->multiple()
|
||||
->preload()
|
||||
->searchable(),
|
||||
|
||||
Hidden::make('password')
|
||||
->default(fn($record) => $record ? null : config('auth.password_default')),
|
||||
->default(fn ($record) => $record ? null : config('auth.password_default')),
|
||||
])
|
||||
->columns(1);
|
||||
}
|
||||
@ -114,7 +114,7 @@ public static function table(Table $table): Table
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Status')
|
||||
->sortable()
|
||||
->getStateUsing(fn(User $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->getStateUsing(fn (User $record) => $record->is_active === IsActive::ACTIVE)
|
||||
->updateStateUsing(function (User $record, bool $state) {
|
||||
$record->is_active = $state ? IsActive::ACTIVE : IsActive::INACTIVE;
|
||||
$record->save();
|
||||
@ -131,7 +131,7 @@ public static function table(Table $table): Table
|
||||
->searchable()
|
||||
->sortable()
|
||||
->badge()
|
||||
->getStateUsing(fn(User $record) => $record->roles->pluck('name', 'id')->toArray()),
|
||||
->getStateUsing(fn (User $record) => $record->roles->pluck('name', 'id')->toArray()),
|
||||
|
||||
...TimestampColumns::make(),
|
||||
])
|
||||
|
||||
@ -80,7 +80,7 @@ public static function configure(Schema $schema): Schema
|
||||
|
||||
Select::make('themes')
|
||||
->label('Tema')
|
||||
->relationship('themes', 'name', fn($query) => $query->active())
|
||||
->relationship('themes', 'name', fn ($query) => $query->active())
|
||||
->native(false)
|
||||
->multiple()
|
||||
->preload()
|
||||
@ -88,7 +88,7 @@ public static function configure(Schema $schema): Schema
|
||||
|
||||
DatePicker::make('release_date')
|
||||
->label('Tanggal Rilis')
|
||||
->placeholder(fn() => now()->format('Y-m-d'))
|
||||
->placeholder(fn () => now()->format('Y-m-d'))
|
||||
->native(false)
|
||||
->displayFormat('l, d F Y')
|
||||
->required(),
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\TrashedFilter;
|
||||
@ -94,7 +95,7 @@ public static function table(Table $table): Table
|
||||
TrashedFilter::make()->native(false),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->modalWidth('lg'),
|
||||
EditAction::make()->modalWidth(Width::Large),
|
||||
DeleteAction::make(),
|
||||
ForceDeleteAction::make(),
|
||||
RestoreAction::make(),
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
use App\Filament\Resources\Publication\Announcements\AnnouncementResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Filament\Support\Enums\Width;
|
||||
|
||||
class ManageAnnouncements extends ManageRecords
|
||||
{
|
||||
@ -24,7 +25,7 @@ protected function getHeaderActions(): array
|
||||
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
|
||||
->label('Simpan dan Tambah Lagi'),
|
||||
])
|
||||
->modalWidth('lg'),
|
||||
->modalWidth(Width::Large),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user