{extends file="admin-layout.tpl"}

{block name="no-return-functions"}
{$admin_current_location = 'module'}
{/block}

{block name="page-title"}{intl l='Edit planified payment' d="paypal.bo.default"}{/block}

{block name="main-content"}
<div class="planified-payment edit-planified-payment">
    <div id="wrapper" class="container">
        {loop name="paypal_planified_payment" type="paypal_planified_payment" id=$planifiedPaymentId backend_context=true}

        <nav>
            <ul class="breadcrumb">
                <li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
                <li><a href="{url path='/admin/module/paypal/configure/planified'}">{intl l='Planified payments' d='paypal.bo.default'}</a></li>
                <li>{intl l='Editing planified payment "%title"' d="paypal.bo.default" title=$planifiedPayment->getTitle()}</li>
            </ul>
        </nav>

        <div class="row">
            <div class="col-md-12 general-block-decorator">

                <div class="row">
                    <div class="col-md-7 title">
                        {intl l='Edit planified payment %title' d="paypal.bo.default" title=$planifiedPayment->getTitle()}
                    </div>
                </div>

                <ul class="nav nav-tabs" id="tabbed-menu">
                    <li class="active">
                        <a href="#general" data-toggle="tab">{intl l="General description"  d="paypal.bo.default"}</a>
                    </li>
                </ul>

                <div class="tab-content">

                    <div class="tab-pane fade active in" id="general">

                        <div class="form-container">

                            {form name="paypal_planified_payment_update_form"}
                            <form method="POST" action="{url path="/admin/module/paypal/configure/planified/%id" id=$planifiedPayment->getId()}" {form_enctype} class="clearfix">

                            {include file="includes/inner-form-toolbar.html" hide_flags=true close_url={url path="/admin/module/paypal/configure/planified"}}

                            <input type="hidden" name="current_tab" value="general"/>

                            {* Be sure to get the planified payment ID, even if the form could not be validated *}
                            <input type="hidden" name="planifiedPaymentId" value="{$planifiedPayment->getId()}" />

                            {form_hidden_fields}

                            {render_form_field field="id"}

                            {render_form_field field="success_url" value={url path="/admin/module/paypal/configure/planified"}}

                            {if $form_error}
                            <div class="alert alert-danger">{$form_error_message}</div>
                            {/if}

                            <div class="row">
                                {include file = "paypal/form/create-or-update-planified-payment-form.html"}
                            </div>

                            {include
                                file="includes/inner-form-toolbar.html"
                                hide_submit_buttons = false
                                hide_flags = true

                                close_url={url path="/admin/module/paypal/configure/planified"}
                            }

                            <small>{intl l='Planified payment created on %date_create. Last modification: %date_change' d="paypal.bo.default" date_create={format_date date=$CREATE_DATE} date_change={format_date date=$UPDATE_DATE} }</small>
                            </form>
                            {/form}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {/loop}
    </div>
</div>
{/block}