mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Clean up old JS.
This commit is contained in:
parent
bc8bcf7a1a
commit
9c5523252d
@ -87,12 +87,10 @@ class AccountController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function create(Request $request, string $what = 'asset')
|
public function create(Request $request, string $what = 'asset')
|
||||||
{
|
{
|
||||||
$allCurrencies = $this->currencyRepos->get();
|
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||||
$currencySelectList = ExpandedForm::makeSelectList($allCurrencies);
|
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
$subTitle = trans('firefly.make_new_' . $what . '_account');
|
||||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
|
$roles = [];
|
||||||
$subTitle = trans('firefly.make_new_' . $what . '_account');
|
|
||||||
$roles = [];
|
|
||||||
foreach (config('firefly.accountRoles') as $role) {
|
foreach (config('firefly.accountRoles') as $role) {
|
||||||
$roles[$role] = (string)trans('firefly.account_role_' . $role);
|
$roles[$role] = (string)trans('firefly.account_role_' . $role);
|
||||||
}
|
}
|
||||||
@ -106,7 +104,7 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
$request->session()->forget('accounts.create.fromStore');
|
$request->session()->forget('accounts.create.fromStore');
|
||||||
|
|
||||||
return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle', 'currencySelectList', 'allCurrencies', 'roles'));
|
return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle', 'roles'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,12 +163,10 @@ class AccountController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
|
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$what = config('firefly.shortNamesByFullName')[$account->accountType->type];
|
$what = config('firefly.shortNamesByFullName')[$account->accountType->type];
|
||||||
$subTitle = trans('firefly.edit_' . $what . '_account', ['name' => $account->name]);
|
$subTitle = trans('firefly.edit_' . $what . '_account', ['name' => $account->name]);
|
||||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
|
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
|
||||||
$allCurrencies = $this->currencyRepos->get();
|
$roles = [];
|
||||||
$currencySelectList = ExpandedForm::makeSelectList($allCurrencies);
|
|
||||||
$roles = [];
|
|
||||||
foreach (config('firefly.accountRoles') as $role) {
|
foreach (config('firefly.accountRoles') as $role) {
|
||||||
$roles[$role] = (string)trans('firefly.account_role_' . $role);
|
$roles[$role] = (string)trans('firefly.account_role_' . $role);
|
||||||
}
|
}
|
||||||
@ -217,8 +213,6 @@ class AccountController extends Controller
|
|||||||
return view(
|
return view(
|
||||||
'accounts.edit',
|
'accounts.edit',
|
||||||
compact(
|
compact(
|
||||||
'allCurrencies',
|
|
||||||
'currencySelectList',
|
|
||||||
'account',
|
'account',
|
||||||
'currency',
|
'currency',
|
||||||
'subTitle',
|
'subTitle',
|
||||||
|
@ -27,6 +27,7 @@ use Carbon\Carbon;
|
|||||||
use Eloquent;
|
use Eloquent;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@ -188,6 +189,41 @@ class ExpandedForm
|
|||||||
return $html;
|
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 $name
|
||||||
* @param null $value
|
* @param null $value
|
||||||
|
@ -188,7 +188,7 @@ return [
|
|||||||
'is_safe' => [
|
'is_safe' => [
|
||||||
'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location',
|
'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location',
|
||||||
'multiRadio', 'file', 'multiCheckbox', 'staticText', 'amountSmall', 'password', 'nonSelectableBalance', 'nonSelectableAmount',
|
'multiRadio', 'file', 'multiCheckbox', 'staticText', 'amountSmall', 'password', 'nonSelectableBalance', 'nonSelectableAmount',
|
||||||
'number', 'assetAccountList','amountNoCurrency'
|
'number', 'assetAccountList','amountNoCurrency','currencyList'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'Form' => [
|
'Form' => [
|
||||||
|
10
public/js/ff/accounts/create.js
vendored
10
public/js/ff/accounts/create.js
vendored
@ -29,14 +29,4 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// on change currency drop down list:
|
|
||||||
$('#ffInput_currency_id').change(updateCurrencyItems);
|
|
||||||
updateCurrencyItems();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateCurrencyItems() {
|
|
||||||
var value = $('#ffInput_currency_id').val();
|
|
||||||
var symbol = currencies[value];
|
|
||||||
$('.non-selectable-currency-symbol').text(symbol);
|
|
||||||
}
|
|
||||||
|
9
public/js/ff/accounts/edit.js
vendored
9
public/js/ff/accounts/edit.js
vendored
@ -30,13 +30,4 @@ $(document).ready(function () {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// on change currency drop down list:
|
|
||||||
$('#ffInput_currency_id').change(updateCurrencyItems);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateCurrencyItems() {
|
|
||||||
var value = $('#ffInput_currency_id').val();
|
|
||||||
var symbol = currencies[value];
|
|
||||||
$('.non-selectable-currency-symbol').text(symbol);
|
|
||||||
}
|
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
{{ ExpandedForm.text('name') }}
|
{{ ExpandedForm.text('name') }}
|
||||||
{% if what == 'asset' %}
|
{% if what == 'asset' %}
|
||||||
{# Not really mandatory but OK #}
|
{{ ExpandedForm.currencyList('currency_id', null, {helpText:'account_default_currency'|_}) }}
|
||||||
{{ ExpandedForm.select('currency_id', currencySelectList, null, {helpText:'account_default_currency'|_}) }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -39,10 +38,10 @@
|
|||||||
|
|
||||||
{% if what == 'asset' %}
|
{% if what == 'asset' %}
|
||||||
|
|
||||||
{{ ExpandedForm.nonSelectableBalance('openingBalance') }}
|
{{ ExpandedForm.amountNoCurrency('openingBalance') }}
|
||||||
{{ ExpandedForm.date('openingBalanceDate') }}
|
{{ ExpandedForm.date('openingBalanceDate') }}
|
||||||
{{ ExpandedForm.select('accountRole', roles,null,{'helpText' : 'asset_account_role_help'|_}) }}
|
{{ ExpandedForm.select('accountRole', roles,null,{'helpText' : 'asset_account_role_help'|_}) }}
|
||||||
{{ ExpandedForm.nonSelectableBalance('virtualBalance') }}
|
{{ ExpandedForm.amountNoCurrency('virtualBalance') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }}
|
{{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }}
|
||||||
|
|
||||||
@ -71,13 +70,6 @@
|
|||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script type="text/javascript" src="js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
|
<script type="text/javascript" src="js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
|
||||||
<script type="text/javascript" src="js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>
|
<script type="text/javascript" src="js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>
|
||||||
{# JS currency list for update thing #}
|
|
||||||
<script type="text/javascript">
|
|
||||||
var currencies = [];
|
|
||||||
{% for currency in allCurrencies %}
|
|
||||||
currencies[{{ currency.id }}] = "{{ currency.symbol }}";
|
|
||||||
{% endfor %}
|
|
||||||
</script>
|
|
||||||
<script type="text/javascript" src="js/ff/accounts/create.js?v={{ FF_VERSION }}"></script>
|
<script type="text/javascript" src="js/ff/accounts/create.js?v={{ FF_VERSION }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -17,9 +17,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
{{ ExpandedForm.text('name') }}
|
{{ ExpandedForm.text('name') }}
|
||||||
{% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %}
|
{% if account.accountType.type == 'Default account' or account.accountType.type == 'Asset account' %}
|
||||||
{# Not really mandatory but OK #}
|
{{ ExpandedForm.currencyList('currency_id', null, {helpText:'account_default_currency'|_}) }}
|
||||||
{{ ExpandedForm.select('currency_id', currencySelectList) }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -42,10 +41,10 @@
|
|||||||
{% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %}
|
{% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %}
|
||||||
|
|
||||||
{# get opening balance entry for this thing! #}
|
{# get opening balance entry for this thing! #}
|
||||||
{{ ExpandedForm.nonSelectableBalance('openingBalance',null, {'currency' : currency }) }}
|
{{ ExpandedForm.amountNoCurrency('openingBalance',null) }}
|
||||||
{{ ExpandedForm.date('openingBalanceDate') }}
|
{{ ExpandedForm.date('openingBalanceDate') }}
|
||||||
{{ ExpandedForm.select('accountRole', roles) }}
|
{{ ExpandedForm.select('accountRole', roles) }}
|
||||||
{{ ExpandedForm.nonSelectableBalance('virtualBalance',null, {'currency' : currency }) }}
|
{{ ExpandedForm.amountNoCurrency('virtualBalance',null) }}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }}
|
{{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }}
|
||||||
@ -87,15 +86,6 @@
|
|||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script type="text/javascript" src="js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
|
<script type="text/javascript" src="js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
|
||||||
<script type="text/javascript" src="js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>
|
<script type="text/javascript" src="js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>
|
||||||
|
|
||||||
{# JS currency list for update thing #}
|
|
||||||
<script type="text/javascript">
|
|
||||||
var currencies = [];
|
|
||||||
{% for currency in allCurrencies %}
|
|
||||||
currencies[{{ currency.id }}] = "{{ currency.symbol }}";
|
|
||||||
{% endfor %}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="js/ff/accounts/edit.js?v={{ FF_VERSION }}"></script>
|
<script type="text/javascript" src="js/ff/accounts/edit.js?v={{ FF_VERSION }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user