style: Apply minor formatting adjustments to anonymous function syntax and string concatenations.

This commit is contained in:
Yoga Pangestu 2025-12-16 14:22:06 +07:00
parent 32afed7f7b
commit 825c1b210c
8 changed files with 25 additions and 23 deletions

View File

@ -24,7 +24,7 @@
class CustomMedia extends Page class CustomMedia extends Page
{ {
use HasPageShield; use HasPageShield;
protected string $view = 'filament.pages.custom-media'; protected string $view = 'filament.pages.custom-media';
protected static ?string $title = 'Media'; protected static ?string $title = 'Media';

View File

@ -42,7 +42,7 @@ public function table(Table $table): Table
TextColumn::make('e_catalog') TextColumn::make('e_catalog')
->label('E-Catalog') ->label('E-Catalog')
->url(fn($record) => $record->e_catalog) ->url(fn ($record) => $record->e_catalog)
->openUrlInNewTab() ->openUrlInNewTab()
->color('primary'), ->color('primary'),
@ -88,7 +88,7 @@ public function table(Table $table): Table
->success() ->success()
->send(); ->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') Action::make('reject')
->label('Tolak') ->label('Tolak')
@ -114,7 +114,7 @@ public function table(Table $table): Table
->warning() ->warning()
->send(); ->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), ->modalWidth(Width::Large),
]) ])
->toolbarActions([ ->toolbarActions([

View File

@ -40,7 +40,7 @@ public function form(Schema $schema): Schema
DatePicker::make('publication_date') DatePicker::make('publication_date')
->label('Tanggal Publikasi') ->label('Tanggal Publikasi')
->placeholder(fn() => now()->format('l, d F Y')) ->placeholder(fn () => now()->format('l, d F Y'))
->native(false) ->native(false)
->displayFormat('l, d F Y') ->displayFormat('l, d F Y')
->required(), ->required(),
@ -85,7 +85,7 @@ public function table(Table $table): Table
TextColumn::make('link') TextColumn::make('link')
->label('Link') ->label('Link')
->limit(30) ->limit(30)
->url(fn($record) => $record->link) ->url(fn ($record) => $record->link)
->openUrlInNewTab(), ->openUrlInNewTab(),
TextColumn::make('status') TextColumn::make('status')
@ -113,7 +113,7 @@ public function table(Table $table): Table
->success() ->success()
->send(); ->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') Action::make('reject')
->label('Tolak') ->label('Tolak')
@ -138,7 +138,7 @@ public function table(Table $table): Table
->warning() ->warning()
->send(); ->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), ->modalWidth(Width::Large),
]) ])
->headerActions([ ->headerActions([

View File

@ -93,7 +93,7 @@ public function table(Table $table): Table
TextColumn::make('report_count') TextColumn::make('report_count')
->label('Laporan Diterima') ->label('Laporan Diterima')
->getStateUsing(function (TaskAssignment $record) { ->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([ ->filters([
@ -102,7 +102,7 @@ public function table(Table $table): Table
->headerActions([ ->headerActions([
CreateAction::make() CreateAction::make()
->label('Buat Penugasan') ->label('Buat Penugasan')
->visible(fn() => $this->canCreateTaskAssignment()), ->visible(fn () => $this->canCreateTaskAssignment()),
]) ])
->recordActions([ ->recordActions([
EditAction::make(), EditAction::make(),

View File

@ -56,9 +56,9 @@ public static function configure(Table $table): Table
->sortable() ->sortable()
->date('l, d F Y') ->date('l, d F Y')
->description( ->description(
fn(Cooperation $record): string => now()->greaterThan($record->final_submission_date) fn (Cooperation $record): string => now()->greaterThan($record->final_submission_date)
? 'Waktu Pengajuan Habis' ? 'Waktu Pengajuan Habis'
: 'Sisa waktu pengajuan: ' . now()->diffForHumans( : 'Sisa waktu pengajuan: '.now()->diffForHumans(
$record->final_submission_date, $record->final_submission_date,
['syntax' => CarbonInterface::DIFF_ABSOLUTE] ['syntax' => CarbonInterface::DIFF_ABSOLUTE]
) )
@ -90,9 +90,9 @@ public static function configure(Table $table): Table
->html() ->html()
->getStateUsing(function (Cooperation $record) { ->getStateUsing(function (Cooperation $record) {
$record->loadCount([ $record->loadCount([
'partnerMedia as approved_count' => fn($query) => $query->where('status', ApprovalStatus::ACCEPTED), 'partnerMedia as approved_count' => fn ($query) => $query->where('status', ApprovalStatus::ACCEPTED),
'partnerMedia as rejected_count' => fn($query) => $query->where('status', ApprovalStatus::REJECTED), 'partnerMedia as rejected_count' => fn ($query) => $query->where('status', ApprovalStatus::REJECTED),
'partnerMedia as pending_count' => fn($query) => $query->where('status', ApprovalStatus::PENDING), 'partnerMedia as pending_count' => fn ($query) => $query->where('status', ApprovalStatus::PENDING),
]); ]);
$totalCount = $record->partnerMedia()->count(); $totalCount = $record->partnerMedia()->count();
@ -252,7 +252,7 @@ public static function configure(Table $table): Table
->disk(config('filesystems.default')) ->disk(config('filesystems.default'))
->acceptedFileTypes(['application/pdf']) ->acceptedFileTypes(['application/pdf'])
->maxSize(1024 * 10) ->maxSize(1024 * 10)
->directory('cooperation/proposal/' . now()->toDateString()) ->directory('cooperation/proposal/'.now()->toDateString())
->required(), ->required(),
]) ])
->action(function ($record, array $data) { ->action(function ($record, array $data) {
@ -312,7 +312,7 @@ public static function configure(Table $table): Table
->schema([ ->schema([
DatePicker::make('start_date') DatePicker::make('start_date')
->label('Tanggal Mulai') ->label('Tanggal Mulai')
->placeholder(fn() => now()->translatedFormat('l, d F Y')) ->placeholder(fn () => now()->translatedFormat('l, d F Y'))
->native(false) ->native(false)
->displayFormat('l, d F Y') ->displayFormat('l, d F Y')
->locale('id') ->locale('id')
@ -320,7 +320,7 @@ public static function configure(Table $table): Table
DatePicker::make('end_date') DatePicker::make('end_date')
->label('Tanggal Seleisa') ->label('Tanggal Seleisa')
->placeholder(fn() => now()->addDays(30)->translatedFormat('l, d F Y')) ->placeholder(fn () => now()->addDays(30)->translatedFormat('l, d F Y'))
->native(false) ->native(false)
->displayFormat('l, d F Y') ->displayFormat('l, d F Y')
->required() ->required()
@ -365,17 +365,17 @@ public static function configure(Table $table): Table
->modalHeading('Buat Penugasan') ->modalHeading('Buat Penugasan')
->modalSubmitActionLabel('Simpan') ->modalSubmitActionLabel('Simpan')
->visible( ->visible(
fn(Cooperation $record): bool => ! auth()->user()->hasRole('Perusahaan') fn (Cooperation $record): bool => ! auth()->user()->hasRole('Perusahaan')
&& ! $record->taskAssignments()->exists() && ! $record->taskAssignments()->exists()
&& $record->status === CooperationStatus::ASSIGNMENT && $record->status === CooperationStatus::ASSIGNMENT
) )
->modalWidth(Width::Large), ->modalWidth(Width::Large),
EditAction::make() EditAction::make()
->visible(fn() => ! auth()->user()->hasRole('Perusahaan')), ->visible(fn () => ! auth()->user()->hasRole('Perusahaan')),
DeleteAction::make() DeleteAction::make()
->visible(fn() => ! auth()->user()->hasRole('Perusahaan')), ->visible(fn () => ! auth()->user()->hasRole('Perusahaan')),
]) ])
->toolbarActions([ ->toolbarActions([
BulkActionGroup::make([ BulkActionGroup::make([

View File

@ -104,7 +104,7 @@ public static function form(Schema $schema): Schema
->schema( ->schema(
collect($documents) collect($documents)
->map( ->map(
fn($doc) => Section::make($doc['title']) fn ($doc) => Section::make($doc['title'])
->schema([ ->schema([
TextInput::make($doc['text_name']) TextInput::make($doc['text_name'])
->hiddenLabel() ->hiddenLabel()

View File

@ -59,7 +59,7 @@ public static function table(Table $table): Table
->label('Perusahaan') ->label('Perusahaan')
->searchable() ->searchable()
->sortable() ->sortable()
->description(fn(User $record) => $record->company?->director_name), ->description(fn (User $record) => $record->company?->director_name),
TextColumn::make('company.partnerMedia.name') TextColumn::make('company.partnerMedia.name')
->label('Media') ->label('Media')

View File

@ -473,6 +473,8 @@ public function run(): void
"name": "Perusahaan", "name": "Perusahaan",
"guard_name": "web", "guard_name": "web",
"permissions": [ "permissions": [
"View:CustomCompany",
"View:CustomMedia",
"ViewAny:Cooperation", "ViewAny:Cooperation",
"View:Cooperation", "View:Cooperation",
"Create:Cooperation", "Create:Cooperation",