{% extends "./layout/default" %}

{% block breadcrumbs %}
    {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }}
{% endblock %}

{% block content %}
    {{ Form.model(piggyBank, {'class' : 'form-horizontal','id' : 'update','url' : route('piggy-banks.update',piggyBank.id)}) }}

    <input type="hidden" name="repeats" value="0"/>
    <input type="hidden" name="id" value="{{ piggyBank.id }}"/>

    <div class="row">
        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">{{ 'mandatoryFields'|_ }}</h3>
                </div>
                <div class="box-body">

                    {{ ExpandedForm.text('name') }}
                    {{ ExpandedForm.select('account_id',accounts,null,{'label' : 'saveOnAccount'|_}) }}
                    {{ ExpandedForm.amount('targetamount') }}

                </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">{{ 'optionalFields'|_ }}</h3>
                </div>
                <div class="box-body">
                    {{ ExpandedForm.date('targetdate') }}
                    {{ ExpandedForm.textarea('note', null, {helpText: trans('firefly.field_supports_markdown')}) }}
                </div>
            </div>

            <!-- 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','piggy bank') }}
                </div>
                <div class="box-footer">
                    <button type="submit" class="btn btn-success pull-right">
                        {{ 'update_piggy_button'|_ }}
                    </button>
                </div>
            </div>

        </div>
    </div>
    {{ Form.close|raw }}
{% endblock %}
{% block scripts %}
    <script type="text/javascript" src="js/lib/modernizr-custom.js"></script>
    <script type="text/javascript" src="js/lib/jquery-ui.min.js"></script>
    <script type="text/javascript" src="js/ff/piggy-banks/create.js"></script>
{% endblock %}

{% block styles %}
    <link href="css/jquery-ui/jquery-ui.structure.min.css" type="text/css" rel="stylesheet" media="all">
    <link href="css/jquery-ui/jquery-ui.theme.min.css" type="text/css" rel="stylesheet" media="all">
{% endblock %}
