fix: replace deprecated package

This commit is contained in:
James Cole
2023-06-04 15:16:17 +02:00
parent 0438fb5a2e
commit 3d02468828
38 changed files with 327 additions and 512 deletions

View File

@@ -176,7 +176,7 @@ class ExpandedForm
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
$options['step'] = '1';
$options['step'] = $options['step'] ?? '1';
try {
$html = view('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
@@ -242,65 +242,6 @@ class ExpandedForm
return $selectList;
}
/**
* @param string $name
* @param mixed $value
* @param array|null $options
*
* @return string
* @throws FireflyException
*/
public function nonSelectableAmount(string $name, $value = null, array $options = null): string
{
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
$options['step'] = 'any';
$selectedCurrency = $options['currency'] ?? Amt::getDefaultCurrency();
unset($options['currency'], $options['placeholder']);
// make sure value is formatted nicely:
if (null !== $value && '' !== $value) {
// $value = round((float)$value, $selectedCurrency->decimal_places);
}
try {
$html = view('form.non-selectable-amount', compact('selectedCurrency', 'classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render nonSelectableAmount(): %s', $e->getMessage()));
$html = 'Could not render nonSelectableAmount.';
throw new FireflyException($html, 0, $e);
}
return $html;
}
/**
* @param string $name
* @param mixed $value
* @param array|null $options
*
* @return string
* @throws FireflyException
*/
public function number(string $name, $value = null, array $options = null): string
{
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
$options['step'] = 'any';
unset($options['placeholder']);
try {
$html = view('form.number', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render number(): %s', $e->getMessage()));
$html = 'Could not render number.';
throw new FireflyException($html, 0, $e);
}
return $html;
}
/**
* @param null $value