public function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('reference_number')
->searchable()
->sortable(),
TextColumn::make('amount')
->money('PHP')
->color(fn ($state) => $state > 0 ? 'success' : 'danger')
->sortable(),
TextColumn::make('created_at')
->label('Transaction date')
->dateTime()
->sortable(),
TextColumn::make('notes'),
])
->headerActions([
Action::make('send_money')
->label('Send Money')
->form([
TextInput::make('username')
->label('Send money to')
->placeholder('Type username')
->required()
->maxLength(255),
TextInput::make('amount')
->required()
->numeric()
->minValue(1)
->maxValue(auth()->user()->getBalance()),
])
->action(function (SendMoneyAction $send_money_action, $action, array $data, Page $livewire) {
$livewire->replaceMountedAction('send_money_confirmation');
})
->modalHeading('Send Money To Any Distributor')
->modalSubmitActionLabel('Send Money')
])
->defaultSort('created_at', 'desc');
}