<commit_before>{% extends "./layout/default" %}

{% block breadcrumbs %}
    {{ Breadcrumbs.render(Route.getCurrentRoute.getName, destinationType, journal) }}
{% endblock %}

{% block content %}
    <form method="POST" action="{{ route('transactions.convert.index.post', [destinationType.type|lower, journal.id]) }}" accept-charset="UTF-8"
          class="form-horizontal" id="store"
          enctype="multipart/form-data">
        <input name="_token" type="hidden" value="{{ csrf_token() }}">
        <div class="row">
            <div class="col-lg-10 col-md-12 col-sm-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">{{ ('convert_options_'~sourceType.type~destinationType.type)|_ }}</h3>
                    </div>
                    <div class="box-body">
                        {{ ExpandedForm.staticText('type', sourceType.type|_) }}
                        {{ ExpandedForm.staticText('description', '<a href="'~route('transactions.show', journal.id)~'">'~journal.description~'</a>') }}
                        {{ ExpandedForm.staticText('date', journal.date.formatLocalized(monthAndDayFormat)) }}

                        {# in case of withdrawal #}
                        {% if sourceType.type == "Withdrawal" %}
                            {{ ExpandedForm.staticText('source_account_asset', '<a href="'~route('accounts.show',[sourceAccount.id])~'">'~sourceAccount.name~'</a>') }}
                            {# if destination is cash, show (cash) #}
                            {% if destinationAccount.accountType.type == "Cash account" %}
                                {{ ExpandedForm.staticText('destination_account_expense', '<span class="text-success">(cash)</a>') }}
                            {% else %}
                                {{ ExpandedForm.staticText('destination_account_expense', '<a href="'~route('accounts.show',[destinationAccount.id])~'">'~destinationAccount.name~'</a>') }}
                            {% endif %}

                        {% endif %}

                        {# in case of deposit #}
                        {% if sourceType.type == "Deposit" %}
                            {# if source is cash, show (cash) #}
                            {% if sourceAccount.accountType.type == "Cash account" %}
                                {{ ExpandedForm.staticText('source_account_revenue', '<span class="text-success">(cash)</a>') }}
                            {% else %}
                                {{ ExpandedForm.staticText('source_account_revenue', '<a href="'~route('accounts.show',[sourceAccount.id])~'">'~sourceAccount.name~'</a>') }}
                            {% endif %}
                            {{ ExpandedForm.staticText('destination_account_asset', '<a href="'~route('accounts.show',[destinationAccount.id])~'">'~destinationAccount.name~'</a>') }}
                        {% endif %}

                        {# in case of transfer #}
                        {% if sourceType.type == "Transfer" %}
                            {{ ExpandedForm.staticText('source_account_asset', '<a href="'~route('accounts.show',[sourceAccount.id])~'">'~sourceAccount.name~'</a>') }}
                            {{ ExpandedForm.staticText('destination_account_asset', '<a href="'~route('accounts.show',[destinationAccount.id])~'">'~destinationAccount.name~'</a>') }}
                        {% endif %}

                        {# ONE #}
                        {% if sourceType.type == 'Withdrawal' and destinationType.type == 'Deposit' %}
                            <p><em>
                                    {{ trans('firefly.convert_explanation_withdrawal_deposit',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name,
                                        })|raw }}
                                </em>
                            </p>
                            <p><em>
                                    {{ 'convert_please_set_revenue_source'|_ }}
                                </em>
                            </p>
                            {% if destinationAccount.accountType.type == "Cash account" %}
                                {{ ExpandedForm.text('source_account_revenue', '') }}
                            {% else %}
                                {{ ExpandedForm.text('source_account_revenue', destinationAccount.name) }}
                            {% endif %}
                        {% endif %}

                        {# TWO #}
                        {% if sourceType.type == 'Withdrawal' and destinationType.type == 'Transfer' %}
                            <p><em>
                                    {{ trans('firefly.convert_explanation_withdrawal_transfer',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name,
                                        })|raw }}
                                </em></p>

                            <p>
                                <em>
                                    {{ 'convert_please_set_asset_destination'|_ }}

                                </em>
                            </p>
                            {{ ExpandedForm.activeLongAccountList('destination_account_asset', null) }}

                        {% endif %}

                        {# THREE #}
                        {% if sourceType.type == 'Deposit' and destinationType.type == 'Withdrawal' %}
                            <p>
                                <em>
                                    {{ trans('firefly.convert_explanation_deposit_withdrawal',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name,
                                        })|raw }}
                                </em>
                            </p>
                            <p>
                                <em>
                                    {{ 'convert_please_set_expense_destination'|_ }}

                                </em>
                            </p>
                            {% if sourceAccount.accountType.type == "Cash account" %}
                                {{ ExpandedForm.text('destination_account_expense', '') }}
                            {% else %}
                                {{ ExpandedForm.text('destination_account_expense', destinationAccount.name) }}
                            {% endif %}

                        {% endif %}

                        {# FOUR #}
                        {% if sourceType.type == 'Deposit' and destinationType.type == 'Transfer' %}

                            <p>
                                <em>
                                    {{ trans('firefly.convert_explanation_deposit_transfer',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name,
                                        })|raw }}
                                </em>
                            </p>
                            <p>
                                <em>
                                    {{ 'convert_please_set_asset_source'|_ }}

                                </em>
                            </p>
                            {{ ExpandedForm.activeLongAccountList('source_account_asset', null) }}
                        {% endif %}

                        {# FIVE #}
                        {% if sourceType.type == 'Transfer' and destinationType.type == 'Withdrawal' %}

                            <p>
                                <em>
                                    {{ trans('firefly.convert_explanation_transfer_withdrawal',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name,
                                        })|raw }}
                                </em>
                            </p>

                            <p>
                                <em>
                                    {{ 'convert_please_set_expense_destination'|_ }}
                                </em>
                            </p>

                            {{ ExpandedForm.text('destination_account_expense', destinationAccount.name) }}

                        {% endif %}

                        {# SIX #}
                        {% if sourceType.type == 'Transfer' and destinationType.type == 'Deposit' %}


                            <p>
                                <em>
                                    {{ trans('firefly.convert_explanation_transfer_deposit',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name,
                                        })|raw }}
                                </em>
                            </p>

                            <p>
                                <em>
                                    {{ 'convert_please_set_revenue_source'|_ }}
                                </em>
                            </p>

                            {{ ExpandedForm.text('source_account_revenue', sourceAccount.name) }}

                        {% endif %}

                    </div>
                    <div class="box-footer">
                        <a href="{{ route('transactions.show', journal.id) }}" class="btn btn-danger">{{ 'cancel'|_ }}</a>
                        <button type="submit" id="transaction-btn" class="btn btn-success pull-right">
                            {{ trans('form.convert_'~sourceType.type) }}
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </form>

{% endblock %}
{% block scripts %}
    <script type="text/javascript" src="v1/js/lib/typeahead/typeahead.bundle.min.js?v={{ FF_VERSION }}"></script>
    <script type="text/javascript" src="v1/js/ff/common/autocomplete.js?v={{ FF_VERSION }}"></script>
    <script type="text/javascript" src="v1/js/ff/transactions/convert.js?v={{ FF_VERSION }}"></script>
{% endblock %}
<commit_msg>Fix #2363<commit_after>{% extends "./layout/default" %}

{% block breadcrumbs %}
    {{ Breadcrumbs.render(Route.getCurrentRoute.getName, destinationType, journal) }}
{% endblock %}

{% block content %}
    <form method="POST" action="{{ route('transactions.convert.index.post', [destinationType.type|lower, journal.id]) }}" accept-charset="UTF-8"
          class="form-horizontal" id="store"
          enctype="multipart/form-data">
        <input name="_token" type="hidden" value="{{ csrf_token() }}">
        <div class="row">
            <div class="col-lg-10 col-md-12 col-sm-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">{{ ('convert_options_'~sourceType.type~destinationType.type)|_ }}</h3>
                    </div>
                    <div class="box-body">
                        {{ ExpandedForm.staticText('type', sourceType.type|_) }}
                        {{ ExpandedForm.staticText('description', '<a href="'~route('transactions.show', journal.id)~'">'~journal.description~'</a>') }}
                        {{ ExpandedForm.staticText('date', journal.date.formatLocalized(monthAndDayFormat)) }}

                        {# in case of withdrawal #}
                        {% if sourceType.type == "Withdrawal" %}
                            {{ ExpandedForm.staticText('source_account_asset', '<a href="'~route('accounts.show',[sourceAccount.id])~'">'~sourceAccount.name|escape~'</a>') }}
                            {# if destination is cash, show (cash) #}
                            {% if destinationAccount.accountType.type == "Cash account" %}
                                {{ ExpandedForm.staticText('destination_account_expense', '<span class="text-success">(cash)</a>') }}
                            {% else %}
                                {{ ExpandedForm.staticText('destination_account_expense', '<a href="'~route('accounts.show',[destinationAccount.id])~'">'~destinationAccount.name|escape~'</a>') }}
                            {% endif %}

                        {% endif %}

                        {# in case of deposit #}
                        {% if sourceType.type == "Deposit" %}
                            {# if source is cash, show (cash) #}
                            {% if sourceAccount.accountType.type == "Cash account" %}
                                {{ ExpandedForm.staticText('source_account_revenue', '<span class="text-success">(cash)</a>') }}
                            {% else %}
                                {{ ExpandedForm.staticText('source_account_revenue', '<a href="'~route('accounts.show',[sourceAccount.id])~'">'~sourceAccount.name|escape~'</a>') }}
                            {% endif %}
                            {{ ExpandedForm.staticText('destination_account_asset', '<a href="'~route('accounts.show',[destinationAccount.id])~'">'~destinationAccount.name|escape~'</a>') }}
                        {% endif %}

                        {# in case of transfer #}
                        {% if sourceType.type == "Transfer" %}
                            {{ ExpandedForm.staticText('source_account_asset', '<a href="'~route('accounts.show',[sourceAccount.id])~'">'~sourceAccount.name|escape~'</a>') }}
                            {{ ExpandedForm.staticText('destination_account_asset', '<a href="'~route('accounts.show',[destinationAccount.id])~'">'~destinationAccount.name|escape~'</a>') }}
                        {% endif %}

                        {# ONE #}
                        {% if sourceType.type == 'Withdrawal' and destinationType.type == 'Deposit' %}
                            <p><em>
                                    {{ trans('firefly.convert_explanation_withdrawal_deposit',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name|escape,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name|escape,
                                        })|raw }}
                                </em>
                            </p>
                            <p><em>
                                    {{ 'convert_please_set_revenue_source'|_ }}
                                </em>
                            </p>
                            {% if destinationAccount.accountType.type == "Cash account" %}
                                {{ ExpandedForm.text('source_account_revenue', '') }}
                            {% else %}
                                {{ ExpandedForm.text('source_account_revenue', destinationAccount.name|escape) }}
                            {% endif %}
                        {% endif %}

                        {# TWO #}
                        {% if sourceType.type == 'Withdrawal' and destinationType.type == 'Transfer' %}
                            <p><em>
                                    {{ trans('firefly.convert_explanation_withdrawal_transfer',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name|escape,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name|escape,
                                        })|raw }}
                                </em></p>

                            <p>
                                <em>
                                    {{ 'convert_please_set_asset_destination'|_ }}

                                </em>
                            </p>
                            {{ ExpandedForm.activeLongAccountList('destination_account_asset', null) }}

                        {% endif %}

                        {# THREE #}
                        {% if sourceType.type == 'Deposit' and destinationType.type == 'Withdrawal' %}
                            <p>
                                <em>
                                    {{ trans('firefly.convert_explanation_deposit_withdrawal',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name|escape,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name|escape,
                                        })|raw }}
                                </em>
                            </p>
                            <p>
                                <em>
                                    {{ 'convert_please_set_expense_destination'|_ }}

                                </em>
                            </p>
                            {% if sourceAccount.accountType.type == "Cash account" %}
                                {{ ExpandedForm.text('destination_account_expense', '') }}
                            {% else %}
                                {{ ExpandedForm.text('destination_account_expense', destinationAccount.name|escape) }}
                            {% endif %}

                        {% endif %}

                        {# FOUR #}
                        {% if sourceType.type == 'Deposit' and destinationType.type == 'Transfer' %}

                            <p>
                                <em>
                                    {{ trans('firefly.convert_explanation_deposit_transfer',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name|escape,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name|escape,
                                        })|raw }}
                                </em>
                            </p>
                            <p>
                                <em>
                                    {{ 'convert_please_set_asset_source'|_ }}

                                </em>
                            </p>
                            {{ ExpandedForm.activeLongAccountList('source_account_asset', null) }}
                        {% endif %}

                        {# FIVE #}
                        {% if sourceType.type == 'Transfer' and destinationType.type == 'Withdrawal' %}

                            <p>
                                <em>
                                    {{ trans('firefly.convert_explanation_transfer_withdrawal',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name|escape,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name|escape,
                                        })|raw }}
                                </em>
                            </p>

                            <p>
                                <em>
                                    {{ 'convert_please_set_expense_destination'|_ }}
                                </em>
                            </p>

                            {{ ExpandedForm.text('destination_account_expense', destinationAccount.name|escape) }}

                        {% endif %}

                        {# SIX #}
                        {% if sourceType.type == 'Transfer' and destinationType.type == 'Deposit' %}


                            <p>
                                <em>
                                    {{ trans('firefly.convert_explanation_transfer_deposit',
                                        {
                                            amount: positiveAmount|formatAmount,
                                            sourceRoute: route('accounts.show', [sourceAccount.id]),
                                            sourceName: sourceAccount.name|escape,
                                            destinationRoute: route('accounts.show', [destinationAccount.id]),
                                            destinationName: destinationAccount.name|escape,
                                        })|raw }}
                                </em>
                            </p>

                            <p>
                                <em>
                                    {{ 'convert_please_set_revenue_source'|_ }}
                                </em>
                            </p>

                            {{ ExpandedForm.text('source_account_revenue', sourceAccount.name|escape) }}

                        {% endif %}

                    </div>
                    <div class="box-footer">
                        <a href="{{ route('transactions.show', journal.id) }}" class="btn btn-danger">{{ 'cancel'|_ }}</a>
                        <button type="submit" id="transaction-btn" class="btn btn-success pull-right">
                            {{ trans('form.convert_'~sourceType.type) }}
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </form>

{% endblock %}
{% block scripts %}
    <script type="text/javascript" src="v1/js/lib/typeahead/typeahead.bundle.min.js?v={{ FF_VERSION }}"></script>
    <script type="text/javascript" src="v1/js/ff/common/autocomplete.js?v={{ FF_VERSION }}"></script>
    <script type="text/javascript" src="v1/js/ff/transactions/convert.js?v={{ FF_VERSION }}"></script>
{% endblock %}

{'fraction_non_alphanumeric': 0.11586388689192427, 'fraction_numerical': 0.0011183001837207444, 'mean_word_length': 0.9796805819101835, 'pattern_counts': {'":': 0, '<': 189, '<?xml version=': 0, '>': 189, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 184, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2130497', 'n_tokens_mistral': 5554, 'n_tokens_neox': 5047, 'n_words': 753}