feat: Add force delete and restore actions to Partner and Announcement resources, and apply minor formatting adjustments across several Filament resources and relation managers.
This commit is contained in:
parent
ff54d97d98
commit
b88660b8c8
@ -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,7 +138,7 @@ 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([
|
||||
|
||||
@ -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,10 +102,11 @@ public function table(Table $table): Table
|
||||
->headerActions([
|
||||
CreateAction::make()
|
||||
->label('Buat Penugasan')
|
||||
->visible(fn () => $this->canCreateTaskAssignment()),
|
||||
->visible(fn() => $this->canCreateTaskAssignment()),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
|
||||
@ -56,9 +56,9 @@ public static function configure(Table $table): Table
|
||||
->sortable()
|
||||
->date('l, d F Y')
|
||||
->description(
|
||||
fn (Cooperation $record): string => now()->greaterThan($record->final_submission_date)
|
||||
fn(Cooperation $record): string => now()->greaterThan($record->final_submission_date)
|
||||
? 'Waktu Pengajuan Habis'
|
||||
: 'Sisa waktu pengajuan: '.now()->diffForHumans(
|
||||
: 'Sisa waktu pengajuan: ' . now()->diffForHumans(
|
||||
$record->final_submission_date,
|
||||
['syntax' => CarbonInterface::DIFF_ABSOLUTE]
|
||||
)
|
||||
@ -90,9 +90,9 @@ public static function configure(Table $table): Table
|
||||
->html()
|
||||
->getStateUsing(function (Cooperation $record) {
|
||||
$record->loadCount([
|
||||
'partnerMedia as approved_count' => fn ($query) => $query->where('status', ApprovalStatus::ACCEPTED),
|
||||
'partnerMedia as rejected_count' => fn ($query) => $query->where('status', ApprovalStatus::REJECTED),
|
||||
'partnerMedia as pending_count' => fn ($query) => $query->where('status', ApprovalStatus::PENDING),
|
||||
'partnerMedia as approved_count' => fn($query) => $query->where('status', ApprovalStatus::ACCEPTED),
|
||||
'partnerMedia as rejected_count' => fn($query) => $query->where('status', ApprovalStatus::REJECTED),
|
||||
'partnerMedia as pending_count' => fn($query) => $query->where('status', ApprovalStatus::PENDING),
|
||||
]);
|
||||
|
||||
$totalCount = $record->partnerMedia()->count();
|
||||
@ -152,6 +152,7 @@ public static function configure(Table $table): Table
|
||||
])
|
||||
->recordActions([
|
||||
ViewAction::make(),
|
||||
|
||||
Action::make('accept')
|
||||
->label('Terima')
|
||||
->icon(Heroicon::OutlinedCheck)
|
||||
@ -188,6 +189,7 @@ public static function configure(Table $table): Table
|
||||
|
||||
return $cooperationMedia && $cooperationMedia->status === ApprovalStatus::PENDING;
|
||||
}),
|
||||
|
||||
Action::make('reject')
|
||||
->label('Tolak')
|
||||
->icon(Heroicon::XMark)
|
||||
@ -224,6 +226,7 @@ public static function configure(Table $table): Table
|
||||
|
||||
return $cooperationMedia && $cooperationMedia->status === ApprovalStatus::PENDING;
|
||||
}),
|
||||
|
||||
Action::make('send_proposal')
|
||||
->label('Ajukan Proposal')
|
||||
->icon(Heroicon::DocumentText)
|
||||
@ -249,7 +252,7 @@ public static function configure(Table $table): Table
|
||||
->disk(config('filesystems.default'))
|
||||
->acceptedFileTypes(['application/pdf'])
|
||||
->maxSize(1024 * 10)
|
||||
->directory('cooperation/proposal/'.now()->toDateString())
|
||||
->directory('cooperation/proposal/' . now()->toDateString())
|
||||
->required(),
|
||||
])
|
||||
->action(function ($record, array $data) {
|
||||
@ -301,6 +304,7 @@ public static function configure(Table $table): Table
|
||||
->exists();
|
||||
})
|
||||
->modalWidth(Width::Large),
|
||||
|
||||
Action::make('create_task_assignment')
|
||||
->label('Buat Penugasan')
|
||||
->icon(Heroicon::Plus)
|
||||
@ -308,7 +312,7 @@ public static function configure(Table $table): Table
|
||||
->schema([
|
||||
DatePicker::make('start_date')
|
||||
->label('Tanggal Mulai')
|
||||
->placeholder(fn () => now()->translatedFormat('l, d F Y'))
|
||||
->placeholder(fn() => now()->translatedFormat('l, d F Y'))
|
||||
->native(false)
|
||||
->displayFormat('l, d F Y')
|
||||
->locale('id')
|
||||
@ -316,7 +320,7 @@ public static function configure(Table $table): Table
|
||||
|
||||
DatePicker::make('end_date')
|
||||
->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)
|
||||
->displayFormat('l, d F Y')
|
||||
->required()
|
||||
@ -361,15 +365,17 @@ public static function configure(Table $table): Table
|
||||
->modalHeading('Buat Penugasan')
|
||||
->modalSubmitActionLabel('Simpan')
|
||||
->visible(
|
||||
fn (Cooperation $record): bool => ! auth()->user()->hasRole('Perusahaan')
|
||||
fn(Cooperation $record): bool => ! auth()->user()->hasRole('Perusahaan')
|
||||
&& ! $record->taskAssignments()->exists()
|
||||
&& $record->status === CooperationStatus::ASSIGNMENT
|
||||
)
|
||||
->modalWidth(Width::Large),
|
||||
|
||||
EditAction::make()
|
||||
->visible(fn () => ! auth()->user()->hasRole('Perusahaan')),
|
||||
->visible(fn() => ! auth()->user()->hasRole('Perusahaan')),
|
||||
|
||||
DeleteAction::make()
|
||||
->visible(fn () => ! auth()->user()->hasRole('Perusahaan')),
|
||||
->visible(fn() => ! auth()->user()->hasRole('Perusahaan')),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::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()
|
||||
@ -249,7 +249,9 @@ public static function table(Table $table): Table
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
|
||||
ForceDeleteBulkAction::make(),
|
||||
|
||||
RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
|
||||
@ -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')
|
||||
@ -81,30 +81,25 @@ public static function table(Table $table): Table
|
||||
->wrap(),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
TrashedFilter::make()
|
||||
->native(false),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->filters([
|
||||
TrashedFilter::make()->native(false),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->modalWidth(Width::Large),
|
||||
EditAction::make()
|
||||
->modalWidth(Width::Large),
|
||||
|
||||
DeleteAction::make(),
|
||||
|
||||
ForceDeleteAction::make(),
|
||||
|
||||
RestoreAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
|
||||
ForceDeleteBulkAction::make(),
|
||||
|
||||
RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
|
||||
@ -95,9 +95,13 @@ public static function table(Table $table): Table
|
||||
TrashedFilter::make()->native(false),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->modalWidth(Width::Large),
|
||||
EditAction::make()
|
||||
->modalWidth(Width::Large),
|
||||
|
||||
DeleteAction::make(),
|
||||
|
||||
ForceDeleteAction::make(),
|
||||
|
||||
RestoreAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
|
||||
Loading…
Reference in New Issue
Block a user