Skip to content

Commit

Permalink
configurable helper text and validation message
Browse files Browse the repository at this point in the history
  • Loading branch information
AzGasim committed Sep 19, 2024
1 parent 93a9093 commit 0757675
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion config/expiry.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@
'ohne_festen_turnus' => 0,
],

'helper_text' => 'Falls kein Turnus festgelegt ist, muss das Ablaufdatum manuell gesetzt werden.',
'helper_text_datetime' => 'Falls kein Turnus festgelegt ist, muss das Ablaufdatum manuell gesetzt werden.',
'after_now' => 'Das Ablaufdatum muss in der Zukunft liegen.',

/*
|--------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion packages/expiry/config/expiry.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@
'ohne_festen_turnus' => 0,
],

'helper_text' => 'Falls kein Turnus festgelegt ist, muss das Ablaufdatum manuell gesetzt werden.',
'helper_text_datetime' => 'Falls kein Turnus festgelegt ist, muss das Ablaufdatum manuell gesetzt werden.',
'after_now' => 'Das Ablaufdatum muss in der Zukunft liegen.',

/*
|--------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion packages/expiry/src/Actions/SetDateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ protected function setUp(): void
->label('Neues Ablaufdatum setzen basierend auf dem Turnus')
->required()
->rule('after:now')
->validationMessages([
'after' => config('expiry.after_now'),
])
->default(function ($record) {
$now = Carbon::now();

Expand All @@ -88,7 +91,7 @@ protected function setUp(): void
return $now->addDays($turnusDays);
})
->columnSpan('full')
->helperText(config('expiry.helper_text')),
->helperText(config('expiry.helper_text_datetime')),

];
})
Expand Down

0 comments on commit 0757675

Please sign in to comment.