Forms\Components\DateTimePicker::make('paid_at')
->label(__('Paid at'))
->disabled()
->when(
value: function (Forms\Components\DateTimePicker $dateTimePicker, Payment $record): bool {
return $record->has_users;
},
callback: function (Forms\Components\DateTimePicker $dateTimePicker): Forms\Components\DateTimePicker {
return $dateTimePicker
->hint(function (Payment $record): ?string {
if (is_null($record->paid_by_id)) {
return null;
}
return "{$record->paid_at->diffForHumans()}";
})
->hintIcon('heroicon-s-question-mark-circle')
->hintIconTooltip(function (Payment $record): ?string {
if (is_null($record->paid_by_id)) {
return null;
}
return __('Paid by') . " {$record->paidBy->getFullname()} ({$record->paidBy->email}), {$record->paid_at->diffForHumans()}";
})
;
},
default: function (Forms\Components\DateTimePicker $dateTimePicker): Forms\Components\DateTimePicker {
return $dateTimePicker
->hint('false') // ⚠️ todo
;
}
)
,
Forms\Components\DateTimePicker::make('paid_at')
->label(__('Paid at'))
->disabled()
->when(
value: function (Forms\Components\DateTimePicker $dateTimePicker, Payment $record): bool {
return $record->has_users;
},
callback: function (Forms\Components\DateTimePicker $dateTimePicker): Forms\Components\DateTimePicker {
return $dateTimePicker
->hint(function (Payment $record): ?string {
if (is_null($record->paid_by_id)) {
return null;
}
return "{$record->paid_at->diffForHumans()}";
})
->hintIcon('heroicon-s-question-mark-circle')
->hintIconTooltip(function (Payment $record): ?string {
if (is_null($record->paid_by_id)) {
return null;
}
return __('Paid by') . " {$record->paidBy->getFullname()} ({$record->paidBy->email}), {$record->paid_at->diffForHumans()}";
})
;
},
default: function (Forms\Components\DateTimePicker $dateTimePicker): Forms\Components\DateTimePicker {
return $dateTimePicker
->hint('false') // ⚠️ todo
;
}
)
,