<div class="row">
    <div class="col-md-12 general-block-decorator">
        <div class="row">
            <div class="col-md-12 title title-without-tabs">
                {intl d='atos.bo.default' l="Atos Configuration"}
            </div>
        </div>

        <div class="form-container">
            <div class="row">
                <div class="col-md-12">
                    {form name="atos_configuration"}
                        <form action="{url path="/admin/module/atos/configure"}" method="post">
                            {form_hidden_fields form=$form}

                            {include file = "includes/inner-form-toolbar.html"
                                hide_flags = true
                                page_url   = "{url path='/admin/module/Atos'}"
                                close_url  = "{url path='/admin/modules'}"
                            }

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

                            <div class="row">
                                <div class="col-md-4">
                                    <p class="title title-without-tabs">{intl d='atos.bo.default' l="Atos-SIPS Platform configuration"}</p>

                                    {render_form_field form=$form field="atos_merchantId" value=$atos_merchantId}
                                    {render_form_field form=$form field="atos_certificate" value=$atos_certificate}

                                    <div class="form-group">
                                        <label class="control-label">
                                            {intl d='atos.bo.default' l="Callback URL"}
                                        </label>

                                        <div class="well well-sm">{url path='/atos/callback'}</div>

                                        <span class="help-block">
                                            {intl d='atos.bo.default' l="This is the callback URL, that will be called by Atos SIPS after customer payment. Be sure that this URL is reachable by remote mechines"}
                                        </span>
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <p class="title title-without-tabs">{intl d='atos.bo.default' l="Operation mode"}</p>

                                    {render_form_field form=$form field="atos_mode" value=$atos_mode}
                                    {render_form_field form=$form field="atos_allowed_ip_list" value=$atos_allowed_ip_list}
    
                                    <p class="title title-without-tabs">{intl d='atos.bo.default' l="Payment by N installment"}</p>
    
                                    {loop name="multi-plugin-enabled" type="module" code="AtosNx" active="1"}{/loop}
                                    {elseloop rel="multi-plugin-enabled"}
                                        <div class="alert alert-info">
                                            {intl l="Install and activate Atos multiple times payment module (AtoxNx) to get configuration options." d='payzen.ai'}
                                        </div>
                                    {/elseloop}
    
                                    {render_form_field form=$form field="nx_nb_installments" value=$nx_nb_installments|default:3}
                                    {render_form_field form=$form field="nx_minimum_amount" value=$nx_minimum_amount|default:0}
                                    {render_form_field form=$form field="nx_maximum_amount" value=$nx_maximum_amount|default:0}
                                </div>

                                <div class="col-md-4">
                                    <p class="title title-without-tabs">{intl d='atos.bo.default' l="Payment configuration"}</p>

                                    {custom_render_form_field form=$form field="send_confirmation_message_only_if_paid"}
                                        <input type="checkbox" {form_field_attributes form=$form field="send_confirmation_message_only_if_paid"} {if $send_confirmation_message_only_if_paid}checked{/if}>
                                    {$label}
                                    {/custom_render_form_field}

                                    {custom_render_form_field form=$form field="send_payment_confirmation_message"}
                                        <input type="checkbox" {form_field_attributes form=$form field="send_payment_confirmation_message"} {if $send_payment_confirmation_message}checked{/if}>
                                    {$label}
                                    {/custom_render_form_field}

                                    <div class="well well-sm">
                                        <span class="glyphicon glyphicon-info-sign"></span>
                                        {intl d='paypal.bo.default' l='You can <a href="%url">edit the payment confirmation email</a> sent to the customer after a successful payment.' url={url path="/admin/configuration/messages"}}
                                    </div>

                                    {render_form_field form=$form field="atos_minimum_amount" value=$atos_minimum_amount}
                                    {render_form_field form=$form field="atos_maximum_amount" value=$atos_maximum_amount}
                                </div>
                            </div>
                        </form>
                    {/form}

                    <div class="row">
                        <div class="col-xs-12">
                            <div class="panel panel-primary">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        <span class="glyphicon glyphicon-cog"></span>
                                        {intl d='atos.bo.default' l="Atos-SIPS call log to callback URL"}
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    <div id="log-container" style="font-family: monospace; font-size: 12px; max-height: 400px; overflow-y: scroll">
                                        {$trace_content nofilter}
                                    </div>
                                </div>
                                <div class="panel-footer">
                                    <a href="{url path='/admin/module/atos/log'}" class="btn btn-sm btn-primary">{intl d='atos.bo.default' l="Download full log"}</a>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
