<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <template id="sepa_direct_debit_mandate_document">
        <t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})" />
        <t
            t-set="is_not_english"
            t-value="doc.partner_id.lang and doc.partner_id.lang[:2] != 'en'"
        />
        <div class="page sepa_direct_debit">
            <div class="row mt0">
                <div class="col-12 text-center">
                    <img
                        t-if="doc.company_id.logo"
                        t-att-src="image_data_uri(doc.company_id.logo)"
                        style="max-height: 45px;"
                        class="float-left"
                    />
                    <h4 t-if="doc.scheme != 'B2B'">
                        <strong>Sepa Direct Debit Mandate</strong>
                        <t t-if="is_not_english">
                            <br />
                            <span
                                class="native_lang native_lang_small"
                                t-esc="'Sepa Direct Debit Mandate'"
                            />
                        </t>
                    </h4>
                    <h4 t-if="doc.scheme == 'B2B'">
                        <strong>Sepa Business-To-Business Direct debit Mandate</strong>
                        <t t-if="is_not_english">
                            <br />
                            <span
                                class="native_lang native_lang_small"
                                t-esc="'Sepa Business-To-Business Direct debit Mandate'"
                            />
                        </t>
                    </h4>
                </div>
            </div>
            <div class="row mt8">
                <div class="col-12">
                    <div class="card">
                        <div class="col-12 text-right" style="font-size:8px;">
                            To be completed by the creditor
                            <t t-if="is_not_english">
                                <span
                                    class="native_lang"
                                    t-esc="'(To be completed by the creditor)'"
                                />
                            </t>
                        </div>
                        <div class="card-body">
                            <div class="col-12">
                                <em>Mandate Reference:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Mandate Reference)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span t-field="doc.unique_mandate_reference" />
                            </div>
                            <div class="col-12">
                                <em>Identifier:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Identifier)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span
                                    t-field="doc.company_id.sepa_creditor_identifier"
                                />
                            </div>
                            <div class="col-12">
                                <em>Creditor's Name:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Creditor\'s Name)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span t-field="doc.company_id.partner_id.name" />
                            </div>
                            <div class="col-12">
                                <em>Address:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Address)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span t-field="doc.company_id.partner_id.street" />
                            </div>
                            <div class="col-12">
                                <em>Postal Code - City - Town:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Postal Code - City - Town)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line  mt8">
                                <span t-field="doc.company_id.partner_id.zip" /> -
                                <span t-field="doc.company_id.partner_id.city" /> -
                                <span t-field="doc.company_id.partner_id.state_id" />
                            </div>
                            <div class="col-12">
                                <em>Country:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Country)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span t-field="doc.company_id.partner_id.country_id" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row mt0">
                <div class="col-12">
                    <p>By signing this mandate form, you authorise (A) <strong
                            t-if="doc.scheme == 'B2B'"
                        >
                            <span t-field="doc.company_id.name" />
                        </strong>
                       to send instructions to your bank to debit your account and (B) your bank to
                       debit your account in accordance with the instructions from <strong
                            t-if="doc.scheme == 'B2B'"
                        >
                            <span t-field="doc.company_id.name" />
                        </strong>.
                       <t t-if="is_not_english">
                           <br />
                           <span
                                class="native_lang"
                                t-esc="'(By signing this mandate form, you authorise (A) '"
                            />
                           <t t-if="doc.scheme == 'B2B'">
                                <span
                                    class="native_lang"
                                    t-field="doc.company_id.name"
                                />
                            </t>
                           <span
                                class="native_lang"
                                t-esc="' to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with the instructions from '"
                            />
                           <t t-if="doc.scheme == 'B2B'">
                                <span
                                    class="native_lang"
                                    t-field="doc.company_id.name"
                                />
                            </t>.)
                       </t>
                    </p>
                </div>
            </div>
            <div class="row">
                <div class="col-12">
                    <p t-if="doc.scheme == 'B2B'">
                        This mandate is only intended for business-to-business transactions.
                        You are not entitled to a refund from your bank after your account has
                        been debited, but you are entitled to request your bank
                        not to debit your account up until the day on which the payment is due.
                        <t t-if="is_not_english">
                            <br />
                            <span
                                class="native_lang"
                                t-esc="'(This mandate is only intended for business-to-business transactions. You are not entitled to a refund from your bank after your account has been debited, but you are entitled to request your bank not to debit your account up until the day on which the payment is due.)'"
                            />
                        </t>
                    </p>
                    <p t-if="doc.scheme != 'B2B'">
                        As part of your rights, you are entitled to a refund from
                        your bank under the terms and conditions of your agreement
                        with your bank.
                        A refund must be claimed within 8 weeks starting from the date on which your account was debited.
                        <t t-if="is_not_english">
                            <br />
                            <span
                                class="native_lang"
                                t-esc="'(As part of your rights, you are entitled to a refund from your bank under the terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited.)'"
                            />
                        </t>
                    </p>
                </div>
            </div>
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="col-12 text-right" style="font-size:8px;">
                            To be completed by the debtor
                            <t t-if="is_not_english">
                                <span
                                    class="native_lang"
                                    t-esc="'(To be completed by the debtor)'"
                                />
                            </t>
                        </div>
                        <div class="card-body">
                            <div class="col-12">
                                <em>Debtor's Name:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Debtor\'s Name)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span t-field="doc.partner_id" />
                            </div>
                            <div class="col-12">
                                <em>Address of the Debtor:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Address of the Debtor)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span t-field="doc.partner_id.street" />
                            </div>
                            <div class="col-12">
                                <em>Postal Code - City - Town:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Postal Code - City - Town)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span t-field="doc.partner_id.zip" /> -
                                <span t-field="doc.partner_id.city" /> -
                                <span t-field="doc.partner_id.state_id" />
                            </div>
                            <div class="col-12">
                                <em>Country of the debtor:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Country of the debtor)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span t-field="doc.partner_id.country_id" />
                            </div>
                            <div class="col-12">
                                <em>Swift BIC (up to 8 or 11 characteres):</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Swift BIC, up to 8 or 11 characteres)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span t-field="doc.partner_bank_id.bank_bic" />
                            </div>
                            <div class="col-12">
                                <em>Account Number - IBAN:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Account Number - IBAN)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt4">
                                <span t-field="doc.partner_bank_id.acc_number" />
                            </div>
                            <div class="col-12">
                                <em>Type of payment:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Type of payment)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 mt4">
                                <input
                                    type="checkbox"
                                    t-att-checked="doc.type=='recurrent' or None"
                                >
                                    Recurrent
                                    <t t-if="is_not_english">
                                        <span
                                            class="native_lang native_lang_small"
                                            t-esc="'(Recurrent)'"
                                        />
                                    </t>
                                </input>
                                -
                                <input
                                    type="checkbox"
                                    t-att-checked="doc.type=='oneoff' or None"
                                >
                                    One-Off
                                    <t t-if="is_not_english">
                                        <span
                                            class="native_lang native_lang_small"
                                            t-esc="'(One-Off)'"
                                        />
                                    </t>
                                </input>
                            </div>
                            <div class="col-12">
                                <em>Date - Location:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Date - Location)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt16" />
                            <div class="col-12">
                                <em>Signature of the debtor:</em>
                                <t t-if="is_not_english">
                                    <span
                                        class="native_lang native_lang_small"
                                        t-esc="'(Signature of the debtor)'"
                                    />
                                </t>
                            </div>
                            <div class="col-10 offset-2 under-line mt16" />
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-12 text-center">
                    <p t-if="doc.scheme != 'B2B'">
                        ALL GAPS ARE MANDATORY. ONCE THIS MANDATE HAS BEEN SIGNED MUST BE SENT TO CREDITOR FOR STORAGE.
                        <t t-if="is_not_english">
                            <br />
                            <span
                                class="native_lang"
                                t-esc="'(ALL GAPS ARE MANDATORY. ONCE THIS MANDATE HAS BEEN SIGNED MUST BE SENT TO CREDITOR FOR STORAGE.)'"
                            />
                        </t>
                    </p>
                    <p t-if="doc.scheme == 'B2B'">
                        ALL GAPS ARE MANDATORY. ONCE THIS MANDATE HAS BEEN SIGNED MUST BE SENT TO CREDITOR FOR STORAGE.
                        NEVERTHELESS, THE BANK OF DEBTOR REQUIRES DEBTOR’S AUTHORIZATION BEFORE DEBITING B2B DIRECT DEBITS IN THE ACCOUNT.
                        THE DEBTOR WILL BE ABLE TO MANAGE THE MENTIONED AUTHORIZATION THROUGH THE MEANS PROVIDED BY HIS BANK.
                        <t t-if="is_not_english">
                            <br />
                            <span
                                class="native_lang"
                                t-esc="'(ALL GAPS ARE MANDATORY. ONCE THIS MANDATE HAS BEEN SIGNED MUST BE SENT TO CREDITOR FOR STORAGE. NEVERTHELESS, THE BANK OF DEBTOR REQUIRES DEBTOR’S AUTHORIZATION BEFORE DEBITING B2B DIRECT DEBITS IN THE ACCOUNT. THE DEBTOR WILL BE ABLE TO MANAGE THE MENTIONED AUTHORIZATION THROUGH THE MEANS PROVIDED BY HIS BANK.)'"
                            />
                        </t>
                    </p>
                </div>
            </div>
        </div>
    </template>
    <template id="sepa_direct_debit_mandate">
        <t t-call="web.html_container">
            <t t-foreach="docs" t-as="doc">
                <t t-call="web.basic_layout">
                    <t
                        t-call="account_banking_sepa_direct_debit.sepa_direct_debit_mandate_document"
                        t-lang="doc.partner_id.lang"
                    />
                </t>
            </t>
        </t>
    </template>
</odoo>
