Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Dec 18, 2024
1 parent c06d87d commit 2050c71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Models/TaxRate.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function rate(): Attribute
protected function formattedValue(): Attribute
{
return new Attribute(
get: fn (): string => Number::percentage($this->value, 2)
get: fn (): string => Number::percentage($this->value, 0, 2)
);
}

Expand Down
10 changes: 9 additions & 1 deletion src/Resources/TaxRateResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public function getModel(): string
return $this->model::getProxiedClass();
}

/**
* {@inheritdoc}
*/
public function modelTitle(Model $model): string
{
return sprintf('%s (%s)', $model->name, $model->formattedValue);
}

/**
* Define the fields.
*/
Expand All @@ -48,7 +56,7 @@ public function fields(Request $request): array
Number::make(__('Rate'), 'value')
->required()
->rules(['required', 'numeric', 'min:0'])
->step(1)
->step(0.1)
->min(0)
->suffix('%')
->format(static function (Request $request, Model $model): string {
Expand Down

0 comments on commit 2050c71

Please sign in to comment.