mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-11-02 20:25:28 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			338 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			Twig
		
	
	
	
	
	
			
		
		
	
	
			338 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			Twig
		
	
	
	
	
	
{% extends "./layout/default" %}
 | 
						|
 | 
						|
{% block breadcrumbs %}
 | 
						|
    {{ Breadcrumbs.render(Route.getCurrentRoute.getName, journal) }}
 | 
						|
{% endblock %}
 | 
						|
{% block content %}
 | 
						|
    <form method="POST" action="{{ route('transactions.split.update',journal.id) }}" accept-charset="UTF-8" class="form-horizontal" id="update"
 | 
						|
          enctype="multipart/form-data">
 | 
						|
        <input name="_token" type="hidden" value="{{ csrf_token() }}">
 | 
						|
        <input type="hidden" name="id" value="{{ journal.id }}"/>
 | 
						|
        <input type="hidden" name="what" value="{{ preFilled.what }}"/>
 | 
						|
        <input type="hidden" name="journal_currency_id" value="{{ journal.transaction_currency_id }}"/>
 | 
						|
 | 
						|
        {% if errors.all()|length > 0 %}
 | 
						|
            <div class="row">
 | 
						|
                <div class="col-lg-12 col-md-12 col-sm-12">
 | 
						|
                    <div class="box box-danger">
 | 
						|
                        <div class="box-header with-border">
 | 
						|
                            <h3 class="box-title">{{ 'errors'|_ }}</h3>
 | 
						|
                        </div>
 | 
						|
                        <div class="box-body">
 | 
						|
                            <ul>
 | 
						|
                                {% for key, err in errors.all() %}
 | 
						|
                                    <li class="text-danger">{{ err }}</li>
 | 
						|
                                {% endfor %}
 | 
						|
                            </ul>
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        {% endif %}
 | 
						|
        <div class="row">
 | 
						|
            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
 | 
						|
                <div class="box">
 | 
						|
                    <div class="box-header with-border">
 | 
						|
                        <h3 class="box-title">{{ 'transaction_data'|_ }}</h3>
 | 
						|
                    </div>
 | 
						|
                    <div class="box-body">
 | 
						|
 | 
						|
                        {# DESCRIPTION IS ALWAYS AVAILABLE #}
 | 
						|
                        {{ ExpandedForm.text('journal_description', journal.description) }}
 | 
						|
 | 
						|
                        {# show source if withdrawal or transfer #}
 | 
						|
                        {% if preFilled.what == 'withdrawal' or preFilled.what == 'transfer' %}
 | 
						|
                            {{ ExpandedForm.activeLongAccountList('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.activeLongAccountList('journal_destination_id', preFilled.journal_destination_id) }}
 | 
						|
                        {% endif %}
 | 
						|
 | 
						|
                        {# show amount and some helper text when making splits: #}
 | 
						|
                            {# amount #}
 | 
						|
                            <div id="journal_amount_holder" class="form-group">
 | 
						|
                                <label for="ffInput_journal_amount" class="col-sm-4 control-label">{{ trans('form.amount') }}</label>
 | 
						|
                                <div class="col-sm-8">
 | 
						|
                                    <p id="ffInput_journal_amount" class="form-control-static">
 | 
						|
                                        {{ formatAmountBySymbol(preFilled.journal_amount|default("0"), preFilled.transactions[0].currency_symbol|default("x"), preFilled.transactions[0].currency_dp) }}
 | 
						|
                                    </p>
 | 
						|
                                </div>
 | 
						|
                            </div>
 | 
						|
 | 
						|
                            {# foreign amount, if not zero. #}
 | 
						|
                            {% if preFilled.journal_foreign_amount != 0 %}
 | 
						|
                                <div id="journal_foreign_amount_holder" class="form-group">
 | 
						|
                                    <label for="ffInput_foreign_journal_amount" class="col-sm-4 control-label">{{ trans('form.foreign_amount') }}</label>
 | 
						|
                                    <div class="col-sm-8">
 | 
						|
                                        <p id="ffInput_foreign_journal_amount" class="form-control-static">
 | 
						|
                                            {{ formatAmountBySymbol(preFilled.journal_foreign_amount, preFilled.transactions[0].foreign_currency_symbol, preFilled.transactions[0].foreign_currency_dp) }}
 | 
						|
                                        </p>
 | 
						|
                                    </div>
 | 
						|
                                </div>
 | 
						|
                            {% endif %}
 | 
						|
                        <input type="hidden" name="journal_amount" value="{{ preFilled.journal_amount }}"/>
 | 
						|
                        {# DATE #}
 | 
						|
                        {{ ExpandedForm.date('date', journal.date) }}
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
 | 
						|
                <div class="box">
 | 
						|
                    <div class="box-header with-border">
 | 
						|
                        <h3 class="box-title">{{ 'optional_field_meta_data'|_ }}</h3>
 | 
						|
                    </div>
 | 
						|
                    <div class="box-body">
 | 
						|
                        {# ALWAYS TAGS #}
 | 
						|
                        {{ ExpandedForm.text('tags', preFilled.tags) }}
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
 | 
						|
                {# EXPLANATION IF NECESSARY: #}
 | 
						|
                {% if
 | 
						|
                    not optionalFields.interest_date or
 | 
						|
                    not optionalFields.book_date or
 | 
						|
                    not optionalFields.process_date or
 | 
						|
                    not optionalFields.due_date or
 | 
						|
                    not optionalFields.payment_date or
 | 
						|
                    not optionalFields.invoice_date or
 | 
						|
                    not optionalFields.internal_reference or
 | 
						|
                    not optionalFields.notes or
 | 
						|
                    not optionalFields.attachments %}
 | 
						|
                    <p class="text-center text-success"><i class="fa fa-info-circle"></i>
 | 
						|
                        <em>{{ trans('firefly.hidden_fields_preferences', {link: route('preferences.index')})|raw }}</em></p>
 | 
						|
                {% endif %}
 | 
						|
 | 
						|
                {# BOX FOR DATES #}
 | 
						|
                {% if
 | 
						|
                    optionalFields.interest_date or optionalFields.book_date or optionalFields.process_date
 | 
						|
                    or optionalFields.due_date or optionalFields.payment_date
 | 
						|
                    or optionalFields.invoice_date %}
 | 
						|
                    <div class="box">
 | 
						|
                        <div class="box-header with-border">
 | 
						|
                            <h3 class="box-title">{{ 'optional_field_meta_dates'|_ }}</h3>
 | 
						|
                        </div>
 | 
						|
                        <div class="box-body">
 | 
						|
 | 
						|
                            {# INTEREST DATE #}
 | 
						|
                            {% if optionalFields.interest_date or journal.interest_date %}
 | 
						|
                                {{ ExpandedForm.date('interest_date', journal.interest_date) }}
 | 
						|
                            {% endif %}
 | 
						|
 | 
						|
                            {# BOOK DATE #}
 | 
						|
                            {% if optionalFields.book_date or journal.book_date %}
 | 
						|
                                {{ ExpandedForm.date('book_date', journal.book_date) }}
 | 
						|
                            {% endif %}
 | 
						|
 | 
						|
                            {# PROCESSING DATE #}
 | 
						|
                            {% if optionalFields.process_date or journal.process_date %}
 | 
						|
                                {{ ExpandedForm.date('process_date', journal.process_date) }}
 | 
						|
                            {% endif %}
 | 
						|
 | 
						|
                            {# DUE DATE #}
 | 
						|
                            {% if optionalFields.due_date or journal.due_date %}
 | 
						|
                                {{ ExpandedForm.date('due_date', journal.due_date) }}
 | 
						|
                            {% endif %}
 | 
						|
 | 
						|
                            {# PAYMENT DATE #}
 | 
						|
                            {% if optionalFields.payment_date or journal.payment_date %}
 | 
						|
                                {{ ExpandedForm.date('payment_date', journal.payment_date) }}
 | 
						|
                            {% endif %}
 | 
						|
 | 
						|
                            {# INVOICE DATE #}
 | 
						|
                            {% if optionalFields.invoice_date or journal.invoice_date %}
 | 
						|
                                {{ ExpandedForm.date('invoice_date', journal.invoice_date) }}
 | 
						|
                            {% endif %}
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                {% endif %}
 | 
						|
 | 
						|
                {# BOX FOR BUSINESS FIELDS #}
 | 
						|
                {% if optionalFields.internal_reference or optionalFields.notes %}
 | 
						|
                    <div class="box">
 | 
						|
                        <div class="box-header with-border">
 | 
						|
                            <h3 class="box-title">{{ 'optional_field_meta_business'|_ }}</h3>
 | 
						|
                        </div>
 | 
						|
                        <div class="box-body">
 | 
						|
 | 
						|
                            {# INTERNAL REFERENCE #}
 | 
						|
                            {% if optionalFields.internal_reference or journal.internal_reference %}
 | 
						|
                                {{ ExpandedForm.text('internal_reference', journal.internal_reference) }}
 | 
						|
                            {% endif %}
 | 
						|
 | 
						|
                            {# NOTES #}
 | 
						|
                            {% if optionalFields.notes  or journal.notes %}
 | 
						|
                                {{ ExpandedForm.textarea('notes',preFilled.notes) }}
 | 
						|
                            {% endif %}
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                {% endif %}
 | 
						|
 | 
						|
                {# BOX FOR ATTACHMENTS #}
 | 
						|
                {% if optionalFields.attachments %}
 | 
						|
                    <div class="box">
 | 
						|
                        <div class="box-header with-border">
 | 
						|
                            <h3 class="box-title">{{ 'optional_field_attachments'|_ }}</h3>
 | 
						|
                        </div>
 | 
						|
                        <div class="box-body">
 | 
						|
                            {# ATTACHMENTS #}
 | 
						|
                            {% if optionalFields.attachments %}
 | 
						|
                                {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
 | 
						|
                            {% endif %}
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                {% endif %}
 | 
						|
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
        <div class="row">
 | 
						|
            <div class="col-lg-12 col-md-12 col-sm-12">
 | 
						|
                <div class="box">
 | 
						|
                    <div class="box-header with-border">
 | 
						|
                        <h3 class="box-title">{{ 'splits'|_ }}</h3>
 | 
						|
                    </div>
 | 
						|
                    <div class="box-body">
 | 
						|
                        <div class="container-fluid split_row_holder">
 | 
						|
                            <div class="row bg-gray-light" style="padding-bottom:3px;">
 | 
						|
                                {# HEADER #}
 | 
						|
                                <div class="col-lg-1 col-md-1 col-sm-6 col-xs-6"><strong>{{ trans('list.split_number') }}</strong></div>
 | 
						|
                                <div class="col-lg-3 col-md-5 col-sm-12 col-xs-12"><strong>{{ trans('list.description') }}</strong></div>
 | 
						|
                                {# withdrawal and deposit have a destination. #}
 | 
						|
                                {% if preFilled.what == 'withdrawal' %}
 | 
						|
                                    <div class="col-lg-2 col-md-5 col-sm-12 col-xs-12"><strong>{{ trans('list.destination') }}</strong></div>
 | 
						|
                                {% endif %}
 | 
						|
                                {# Deposit has a source #}
 | 
						|
                                {% if preFilled.what == 'deposit' %}
 | 
						|
                                    <div class="col-lg-2 col-md-5 col-sm-12 col-xs-12"><strong>{{ trans('list.source') }}</strong></div>
 | 
						|
                                {% endif %}
 | 
						|
                                <div class="col-lg-2 col-md-5 col-sm-12 col-xs-12"><strong>{{ trans('list.amount') }}</strong></div>
 | 
						|
                                {# only withdrawal has budget #}
 | 
						|
                                {% if preFilled.what == 'withdrawal' %}
 | 
						|
                                    <div class="col-lg-2 col-md-6 col-sm-12 col-xs-12"><strong>{{ trans('list.budget') }}</strong></div>
 | 
						|
                                {% endif %}
 | 
						|
                                <div class="col-lg-2 col-md-6 col-sm-12 col-xs-12"><strong>{{ trans('list.category') }}</strong></div>
 | 
						|
                            </div>
 | 
						|
 | 
						|
                            {# ROWS #}
 | 
						|
 | 
						|
 | 
						|
                            {% for index, transaction in preFilled.transactions %}
 | 
						|
                                <div class="row {% if loop.index0 % 2 == 1 %}bg-gray-light{% endif %} split_row" data-split="{{ loop.index0 }}">
 | 
						|
                                    {# button #}
 | 
						|
                                    <div class="col-lg-1 col-md-1 col-sm-6 col-xs-6">
 | 
						|
                                        <a href="#" class="btn btn-xs btn-danger remove-current-split" data-split="{{ loop.index0 }}">
 | 
						|
                                            <i class="fa fa-trash" data-split="{{ loop.index0 }}"></i><span> #{{ loop.index }}</span></a>
 | 
						|
                                    </div>
 | 
						|
 | 
						|
                                    {# description #}
 | 
						|
                                    <div class="col-lg-3 col-md-5 col-sm-12 col-xs-12">
 | 
						|
                                        <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][transaction_description]"
 | 
						|
                                               value="{{ transaction.transaction_description }}"
 | 
						|
                                               class="form-control"/>
 | 
						|
                                    </div>
 | 
						|
 | 
						|
                                    {# destination for withdrawals: #}
 | 
						|
                                    {% if preFilled.what == 'withdrawal' %}
 | 
						|
                                        <div class="col-lg-2 col-md-5 col-sm-12 col-xs-12">
 | 
						|
                                            <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][destination_name]"
 | 
						|
                                                   value="{% if transaction.destination_type != 'Cash account' %}{{ transaction.destination_name }}{% endif %}"
 | 
						|
                                                   class="form-control"/>
 | 
						|
                                        </div>
 | 
						|
                                    {% endif %}
 | 
						|
 | 
						|
                                    {# source for deposits #}
 | 
						|
                                    {% if preFilled.what == 'deposit' %}
 | 
						|
                                        <div class="col-lg-2 col-md-5 col-sm-12 col-xs-12">
 | 
						|
                                            <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][source_name]"
 | 
						|
                                                   value="{{ transaction.source_name }}" class="form-control"/>
 | 
						|
                                        </div>
 | 
						|
                                    {% endif %}
 | 
						|
 | 
						|
                                    {# amount#}
 | 
						|
                                    <div class="col-lg-2 col-md-5 col-sm-12 col-xs-12">
 | 
						|
                                        {{ transaction.currency_symbol }} <input class="split_amount_input" type="number"
 | 
						|
                                                                                      name="transactions[{{ loop.index0 }}][amount]"
 | 
						|
                                                                                      value="{{ transaction.amount }}"
 | 
						|
                                                                                      autocomplete="off" step="any">
 | 
						|
                                        {% if transaction.foreign_amount != null %}
 | 
						|
                                            {{ transaction.foreign_currency_symbol }} <input class="split_amount_input" type="number"
 | 
						|
                                                                                                  name="transactions[{{ loop.index0 }}][foreign_amount]"
 | 
						|
                                                                                                  value="{{ transaction.foreign_amount }}" autocomplete="off"
 | 
						|
                                                                                                  step="any">
 | 
						|
                                            <input type="hidden" name="transactions[{{ loop.index0 }}][foreign_currency_id]"
 | 
						|
                                                   value="{{ transaction.foreign_currency_id }}">
 | 
						|
                                        {% endif %}
 | 
						|
                                        <input type="hidden" name="transactions[{{ loop.index0 }}][transaction_currency_id]"
 | 
						|
                                               value="{{ transaction.currency_id }}">
 | 
						|
                                    </div>
 | 
						|
                                    {# budget #}
 | 
						|
                                    {% if preFilled.what == 'withdrawal' %}
 | 
						|
                                        <div class="col-lg-2 col-md-6 col-sm-12 col-xs-12">
 | 
						|
                                            <select class="form-control" name="transactions[{{ loop.index0 }}][budget_id]">
 | 
						|
                                                {% for key, budget in budgets %}
 | 
						|
                                                    <option label="{{ budget }}" value="{{ key }}"
 | 
						|
                                                            {% if transaction.budget_id == key %} selected="selected"{% endif %}>{{ budget }}</option>
 | 
						|
                                                {% endfor %}
 | 
						|
                                            </select>
 | 
						|
                                        </div>
 | 
						|
                                    {% endif %}
 | 
						|
 | 
						|
                                    {# category #}
 | 
						|
                                    <div class="col-lg-2 col-md-6 col-sm-12 col-xs-12">
 | 
						|
                                        <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][category_name]"
 | 
						|
                                               value="{{ transaction.category_name }}"
 | 
						|
                                               class="form-control"/>
 | 
						|
                                    </div>
 | 
						|
                                </div>
 | 
						|
                            {% endfor %}
 | 
						|
                        </div>
 | 
						|
                        <p>
 | 
						|
                            <br/>
 | 
						|
                            <a href="#" class="btn btn-default btn-do-split"><i class="fa fa-plus-circle"></i> {{ 'add_another_split'|_ }}</a>
 | 
						|
                        </p>
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
        <div class="row">
 | 
						|
            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
 | 
						|
                {# panel for options #}
 | 
						|
                <div class="box">
 | 
						|
                    <div class="box-header with-border">
 | 
						|
                        <h3 class="box-title">{{ 'options'|_ }}</h3>
 | 
						|
                    </div>
 | 
						|
                    <div class="box-body">
 | 
						|
                        {{ ExpandedForm.optionsList('update','split-transaction') }}
 | 
						|
                    </div>
 | 
						|
                    <div class="box-footer">
 | 
						|
                        <button type="submit" class="pull-right btn btn-success">{{ ('update_' ~ preFilled.what)|_ }}</button>
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
    </form>
 | 
						|
 | 
						|
{% endblock %}
 | 
						|
{% block styles %}
 | 
						|
    <link href="v1/css/bootstrap-tagsinput.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
 | 
						|
    <link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
 | 
						|
    <link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
 | 
						|
{% endblock %}
 | 
						|
{% block scripts %}
 | 
						|
    <script type="text/javascript" src="{{ route('javascript.currencies') }}?ext=.js&v={{ FF_VERSION }}"></script>
 | 
						|
    <script type="text/javascript">
 | 
						|
        var currencySymbol = "{{ preFilled.transactions[0].currency_symbol }}";
 | 
						|
        var foreignCurrencySymbol = "{{ preFilled.transactions[0].foreign_currency_symbol }}";
 | 
						|
        var originalSum = {{ preFilled.journal_amount }};
 | 
						|
        var originalForeignSum = {{ preFilled.journal_foreign_amount }};
 | 
						|
        var what = "{{ preFilled.what }}";
 | 
						|
    </script>
 | 
						|
    <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/lib/bootstrap-tagsinput.min.js?v={{ FF_VERSION }}"></script>
 | 
						|
    <script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>
 | 
						|
    <script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
 | 
						|
    <script type="text/javascript" src="v1/js/ff/transactions/split/edit.js?v={{ FF_VERSION }}"></script>
 | 
						|
{% endblock %}
 |