Clean up old JS.

This commit is contained in:
James Cole
2018-04-28 05:40:08 +02:00
parent bc8bcf7a1a
commit 9c5523252d
7 changed files with 53 additions and 60 deletions

View File

@@ -27,6 +27,7 @@ use Carbon\Carbon;
use Eloquent;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Illuminate\Support\Collection;
@@ -188,6 +189,41 @@ class ExpandedForm
return $html;
}
/**
* @param string $name
* @param null $value
* @param array $options
*
* @return string
*/
public function currencyList(string $name, $value = null, array $options = []): string
{
// properties for cache
$cache = new CacheProperties;
$cache->addProperty('exp-form-currency-list');
$cache->addProperty($name);
$cache->addProperty($value);
$cache->addProperty($options);
if ($cache->has()) {
return $cache->get();
}
/** @var CurrencyRepositoryInterface $currencyRepos */
$currencyRepos = app(CurrencyRepositoryInterface::class);
// get all currencies:
$list = $currencyRepos->get();
$array = [];
/** @var TransactionCurrency $currency */
foreach ($list as $currency) {
$array[$currency->id] = $currency->name . ' (' . $currency->symbol . ')';
}
$res = $this->select($name, $array, $value, $options);
$cache->store($res);
return $res;
}
/**
* @param $name
* @param null $value