<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">

        <record id="email_template_membership_expiry" model="mail.template">
            <field name="name">Membership: Renewal Reminder</field>
            <field name="model_id" ref="base.model_res_partner"/>
            <field name="subject">Reminder: your membership expires soon</field>
            <field name="email_from">{{ (object.company_id.email_formatted or user.email_formatted) }}</field>
            <field name="partner_to">{{ object.id }}</field>
            <field name="lang">{{ object.lang }}</field>
            <field name="auto_delete" eval="True"/>
            <field name="body_html" type="html">
<div style="margin:0px;padding:0px;font-family:Arial,Helvetica,sans-serif;">
    <table style="width:100%;max-width:600px;margin:auto;border-collapse:collapse;">
        <tr>
            <td style="padding:24px 24px 8px;background:#f8f8f8;border-bottom:2px solid #e0e0e0;">
                <h2 style="margin:0;color:#333;">
                    Dear <t t-out="object.name or ''">Member Name</t>,
                </h2>
            </td>
        </tr>
        <tr>
            <td style="padding:24px;">
                <p style="color:#555;font-size:15px;line-height:1.6;">
                    This is a friendly reminder that your membership with
                    <strong t-out="object.company_id.name or ''">Your Organisation</strong>
                    is due to expire on
                    <strong t-out="format_date(object.membership_stop) or ''">expiry date</strong>.
                </p>
                <p style="color:#555;font-size:15px;line-height:1.6;">
                    To continue enjoying your membership benefits without interruption,
                    please renew your membership before that date.
                </p>

                <t t-set="last_line" t-value="object.member_lines and object.member_lines[0] or False"/>
                <t t-if="last_line and last_line.membership_id and last_line.membership_id.product_tmpl_id.website_url">
                    <t t-set="product_url" t-value="object.get_base_url() + last_line.membership_id.product_tmpl_id.website_url"/>
                    <p style="text-align:center;margin:32px 0;">
                        <a t-att-href="product_url"
                           style="background:#875A7B;color:#fff;padding:14px 32px;border-radius:4px;
                                  text-decoration:none;font-size:16px;font-weight:bold;display:inline-block;">
                            Renew my membership
                        </a>
                    </p>
                    <p style="color:#888;font-size:13px;text-align:center;">
                        Or copy this link into your browser:<br/>
                        <a t-att-href="product_url" style="color:#875A7B;">
                            <t t-out="product_url"/>
                        </a>
                    </p>
                </t>

                <p style="color:#555;font-size:15px;line-height:1.6;margin-top:24px;">
                    If you have any questions, please do not hesitate to contact us.
                </p>
                <p style="color:#555;font-size:15px;">
                    Kind regards,<br/>
                    <strong t-out="object.company_id.name or ''">Your Organisation</strong>
                </p>
            </td>
        </tr>
        <tr>
            <td style="padding:16px 24px;background:#f8f8f8;border-top:1px solid #e0e0e0;
                       color:#aaa;font-size:12px;text-align:center;">
                <t t-out="object.company_id.name or ''">Your Organisation</t>
                <t t-if="object.company_id.street">
                    &#x2022; <t t-out="object.company_id.street"/>
                </t>
                <t t-if="object.company_id.email">
                    &#x2022; <t t-out="object.company_id.email"/>
                </t>
            </td>
        </tr>
    </table>
</div>
            </field>
        </record>

    </data>
</odoo>
