<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">
        <record id="email_template_rental_approved" model="mail.template">
            <field name="name">Event Rental: Approved &amp; Quotation Ready</field>
            <field name="model_id" ref="event_rental.model_event_rental_request"/>
            <field name="subject">Your Event Rental Request {{ object.name }} has been Approved</field>
            <field name="email_from">{{ object.create_uid.email_formatted or object.env.company.email_formatted }}</field>
            <field name="email_to">{{ object.customer_email }}</field>
            <field name="body_html" type="html">
                <div style="margin: 0px; padding: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; color: #333333;">
                    <h2 style="color: #007bff; font-weight: 500; margin-top: 0px;">Rental Request Approved!</h2>
                    <p>Dear <strong t-out="object.customer_name or 'Customer'"/>,</p>
                    <p>We are happy to inform you that your event rental request <strong t-out="object.name"/> has been approved for your event scheduled on <strong t-out="object.event_date"/>.</p>
                    <p>We have generated a Sales Quotation for you. Please review the rental details:</p>
                    <table style="width: 100%; border-collapse: collapse; margin-bottom: 20px;">
                        <tr>
                            <td style="padding: 8px; border: 1px solid #dddddd; background-color: #f9f9f9; width: 30%;"><strong>Request Number:</strong></td>
                            <td style="padding: 8px; border: 1px solid #dddddd;"><span t-out="object.name"/></td>
                        </tr>
                        <tr>
                            <td style="padding: 8px; border: 1px solid #dddddd; background-color: #f9f9f9;"><strong>Rental Period:</strong></td>
                            <td style="padding: 8px; border: 1px solid #dddddd;">
                                From <span t-out="object.start_date"/> to <span t-out="object.end_date"/>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding: 8px; border: 1px solid #dddddd; background-color: #f9f9f9;"><strong>Event Location:</strong></td>
                            <td style="padding: 8px; border: 1px solid #dddddd;"><span t-out="object.location"/></td>
                        </tr>
                        <tr>
                            <td style="padding: 8px; border: 1px solid #dddddd; background-color: #f9f9f9;"><strong>Event Type:</strong></td>
                            <td style="padding: 8px; border: 1px solid #dddddd;"><span t-out="object.event_type.capitalize()"/></td>
                        </tr>
                    </table>
                    
                    <p>To view your detailed quotation, check pricing, and make online payment to confirm your booking, please click the button below:</p>
                    <div style="margin: 25px 0px; text-align: center;">
                        <a t-att-href="object.sale_order_id.get_portal_url() if object.sale_order_id else '#'" 
                           style="background-color: #28a745; color: #ffffff; padding: 12px 25px; text-decoration: none; border-radius: 4px; font-weight: bold; display: inline-block; box-shadow: 0 2px 5px rgba(0,0,0,0.15);">
                            Review &amp; Pay Rental Quotation
                        </a>
                    </div>
                    
                    <p>Please note that your items are tentatively held. Payment is required to guarantee your rental reservation.</p>
                    <p>Thank you for choosing us for your event!</p>
                    <p style="margin-top: 30px;">Best regards,<br/>
                    <strong>Event Rental Team</strong></p>
                </div>
            </field>
        </record>
    </data>
</odoo>
