Restructure code to rename a variable.

This commit is contained in:
James Cole
2018-06-30 05:21:21 +02:00
parent 2d7b7c2f3f
commit c9356c1237
50 changed files with 325 additions and 321 deletions

View File

@@ -70,7 +70,7 @@
<td>
{# SOURCE ACCOUNT ID FOR TRANSFER OR WITHDRAWAL #}
{% if transaction.type == 'Transfer' or transaction.type == 'Withdrawal' %}
<select class="form-control input-sm" name="source_account_id[{{ transaction.journal_id }}]">
<select class="form-control input-sm" name="source_id[{{ transaction.journal_id }}]">
{% for account in accounts %}
<!-- {{ transaction.type }}: {{ transaction.source_name }} -->
<option value="{{ account.id }}"{% if account.id == transaction.source_id %} selected{% endif %} label="{{ account.name }}">{{ account.name }}</option>
@@ -79,13 +79,13 @@
{% else %}
{# SOURCE ACCOUNT NAME FOR DEPOSIT #}
<input class="form-control input-sm" placeholder="{% if transaction.source_type != 'Cash account' %}{{ transaction.source_name }}{% endif %}" autocomplete="off"
name="source_account_name[{{ transaction.journal_id }}]" type="text" value="{% if transaction.source_type != 'Cash account' %}{{ transaction.source_name }}{% endif %}">
name="source_name[{{ transaction.journal_id }}]" type="text" value="{% if transaction.source_type != 'Cash account' %}{{ transaction.source_name }}{% endif %}">
{% endif %}
</td>
<td>
{% if transaction.type == 'Transfer' or transaction.type == 'Deposit' %}
{# DESTINATION ACCOUNT NAME FOR TRANSFER AND DEPOSIT #}
<select class="form-control input-sm" name="destination_account_id[{{ transaction.journal_id }}]">
<select class="form-control input-sm" name="destination_id[{{ transaction.journal_id }}]">
{% for account in accounts %}
<option value="{{ account.id }}"{% if account.id == transaction.destination_id %} selected="selected"{% endif %}
label="{{ account.name }}">{{ account.name }}</option>
@@ -95,7 +95,7 @@
{# DESTINATION ACCOUNT NAME FOR EXPENSE #}
<input class="form-control input-sm" placeholder="{% if transaction.destination_type != 'Cash account' %}{{ transaction.destination_name }}{% endif %}"
name="destination_account_name[{{ transaction.journal_id }}]" type="text" autocomplete="off"
name="destination_name[{{ transaction.journal_id }}]" type="text" autocomplete="off"
value="{% if transaction.destination_type != 'Cash account' %}{{ transaction.destination_name }}{% endif %}">
{% endif %}
</td>

View File

@@ -33,16 +33,16 @@
{{ ExpandedForm.text('description') }}
{# SELECTABLE SOURCE ACCOUNT ONLY FOR WITHDRAWALS AND TRANSFERS #}
{{ ExpandedForm.activeAssetAccountList('source_account_id', null, {label: trans('form.asset_source_account')}) }}
{{ ExpandedForm.activeAssetAccountList('source_id', null, {label: trans('form.asset_source_account')}) }}
{# FREE FORMAT SOURCE ACCOUNT ONLY FOR DEPOSITS #}
{{ ExpandedForm.text('source_account_name', null, {label: trans('form.revenue_account')}) }}
{{ ExpandedForm.text('source_name', null, {label: trans('form.revenue_account')}) }}
{# FREE FORMAT DESTINATION ACCOUNT ONLY FOR EXPENSES #}
{{ ExpandedForm.text('destination_account_name', null, {label: trans('form.expense_account')}) }}
{{ ExpandedForm.text('destination_name', null, {label: trans('form.expense_account')}) }}
{# SELECTABLE DESTINATION ACCOUNT ONLY FOR TRANSFERS AND DEPOSITS #}
{{ ExpandedForm.activeAssetAccountList('destination_account_id', null, {label: trans('form.asset_destination_account')} ) }}
{{ ExpandedForm.activeAssetAccountList('destination_id', null, {label: trans('form.asset_destination_account')} ) }}
{# ALWAYS SHOW AMOUNT #}
{{ ExpandedForm.amount('amount') }}

View File

@@ -39,22 +39,22 @@
{# SELECTABLE SOURCE ACCOUNT ONLY FOR WITHDRAWALS AND TRANSFERS #}
{% if what == 'transfer' or what == 'withdrawal' %}
{{ ExpandedForm.assetAccountList('source_account_id', data.source_account_id, {label: trans('form.asset_source_account')}) }}
{{ ExpandedForm.assetAccountList('source_id', data.source_id, {label: trans('form.asset_source_account')}) }}
{% endif %}
{# FREE FORMAT SOURCE ACCOUNT ONLY FOR DEPOSITS #}
{% if what == 'deposit' %}
{{ ExpandedForm.text('source_account_name',data.source_account_name, {label: trans('form.revenue_account')}) }}
{{ ExpandedForm.text('source_name',data.source_name, {label: trans('form.revenue_account')}) }}
{% endif %}
{# FREE FORMAT DESTINATION ACCOUNT ONLY FOR EXPENSES #}
{% if what == 'withdrawal' %}
{{ ExpandedForm.text('destination_account_name',data.destination_account_name, {label: trans('form.expense_account')}) }}
{{ ExpandedForm.text('destination_name',data.destination_name, {label: trans('form.expense_account')}) }}
{% endif %}
{# SELECTABLE DESTINATION ACCOUNT ONLY FOR TRANSFERS AND DEPOSITS #}
{% if what == 'transfer' or what == 'deposit' %}
{{ ExpandedForm.assetAccountList('destination_account_id', data.destination_account_id, {label: trans('form.asset_destination_account')} ) }}
{{ ExpandedForm.assetAccountList('destination_id', data.destination_id, {label: trans('form.asset_destination_account')} ) }}
{% endif %}
{# ALWAYS SHOW AMOUNT #}

View File

@@ -42,12 +42,12 @@
{# show source if withdrawal or transfer #}
{% if preFilled.what == 'withdrawal' or preFilled.what == 'transfer' %}
{{ ExpandedForm.activeAssetAccountList('journal_source_account_id', preFilled.journal_source_account_id) }}
{{ ExpandedForm.activeAssetAccountList('journal_source_id', preFilled.journal_source_id) }}
{% endif %}
{# show destination account id, if deposit (is asset): #}
{% if preFilled.what == 'deposit' or preFilled.what == 'transfer' %}
{{ ExpandedForm.activeAssetAccountList('journal_destination_account_id', preFilled.journal_destination_account_id) }}
{{ ExpandedForm.activeAssetAccountList('journal_destination_id', preFilled.journal_destination_id) }}
{% endif %}
{# show amount and some helper text when making splits: #}