<?xml version="1.0" encoding="UTF-8"?>
<!--
    Fusion Rental
    License OPL-1 (Odoo Proprietary License v1.0)
    Rental Agreement Document - Compact 2-Page Layout
-->
<odoo>
    <template id="report_rental_agreement">
        <t t-call="web.html_container">
            <t t-foreach="docs" t-as="doc">
                <t t-call="web.external_layout">
                    <t t-set="doc" t-value="doc.with_context(lang=doc.partner_id.lang)"/>
                    <t t-set="company" t-value="doc.company_id"/>
                    
                    <style>
                        .fc-rental { font-family: Arial, sans-serif; font-size: 8pt; line-height: 1.3; }
                        .fc-rental h1 { color: #0066a1; font-size: 14pt; text-align: center; margin: 5px 0 8px 0; }
                        .fc-rental h2 { color: #0066a1; font-size: 8.5pt; margin: 6px 0 2px 0; font-weight: bold; }
                        .fc-rental p { margin: 2px 0; text-align: justify; }
                        .fc-rental .parties { font-size: 8pt; margin-bottom: 6px; }
                        .fc-rental .intro { margin-bottom: 6px; font-size: 8pt; }
                        .fc-rental table { width: 100%; border-collapse: collapse; }
                        .fc-rental table.bordered, .fc-rental table.bordered th, .fc-rental table.bordered td { border: 1px solid #000; }
                        .fc-rental th { background-color: #0066a1; color: white; padding: 4px 6px; font-weight: bold; font-size: 8pt; }
                        .fc-rental td { padding: 3px 5px; vertical-align: top; font-size: 8pt; }
                        .fc-rental .text-center { text-align: center; }
                        .fc-rental .text-right { text-align: right; }
                        .fc-rental .info-header { background-color: #f5f5f5; color: #333; font-weight: bold; }
                        
                        /* Two-column layout for terms (table-based for wkhtmltopdf) */
                        .fc-rental .terms-table { width: 100%; margin-top: 6px; }
                        .fc-rental .terms-table td { width: 50%; vertical-align: top; padding: 4px 12px; }
                        .fc-rental .term-section { margin-bottom: 5px; }
                        
                        /* Credit card section */
                        .fc-rental .cc-section { margin-top: 12px; padding: 12px; border: 2px solid #0066a1; background-color: #f8f9fa; }
                        .fc-rental .cc-title { font-size: 10pt; font-weight: bold; color: #0066a1; margin-bottom: 10px; text-align: center; }
                        .fc-rental .authorization-text { font-size: 7pt; margin-top: 10px; font-style: italic; }
                        
                        /* Signature */
                        .fc-rental .signature-section { margin-top: 15px; }
                        .fc-rental .signature-line { border-bottom: 1px solid #000; min-height: 35px; margin-bottom: 5px; }
                        .fc-rental .signature-label { font-size: 7pt; color: #666; text-transform: uppercase; }

                        .fc-rental .text-end { text-align: right; }
                    </style>
                    
                    <div class="fc-rental">
                        <div class="page">
                            
                            <!-- ============================================================ -->
                            <!-- PAGE 1: TERMS AND CONDITIONS -->
                            <!-- ============================================================ -->
                            
                            <h1>RENTAL AGREEMENT</h1>
                            
                            <!-- Parties - Compact -->
                            <div class="parties">
                                <strong>BETWEEN:</strong> <t t-esc="company.name"/> ("Company") 
                                <strong style="margin-left: 20px;">AND:</strong> <t t-esc="doc.partner_id.name"/> ("Renter")
                            </div>
                            
                            <!-- Introduction -->
                            <div class="intro">
                                <p><t t-esc="company.name"/> rents to the Renter medical equipment (hospital beds, patient lifts, trapeze, over-bed tables, mobility scooters, electric wheelchairs, manual wheelchairs, stairlifts, ceiling lifts and lift chairs) subject to the terms and conditions set forth in this Rental Agreement.</p>
                            </div>
                            
                            <!-- ============================================================ -->
                            <!-- TERMS - PAGE 1 (two columns) -->
                            <!-- ============================================================ -->
                            <table class="terms-table" style="border: none;">
                                <tr>
                                    <td style="border: none;">
                                        <div class="term-section">
                                            <h2>1. Ownership &amp; Condition of Equipment</h2>
                                            <p>All equipment remains the sole property of <t t-esc="company.name"/> and is provided in good, sanitized, working condition. The Renter shall not modify, alter, disassemble, relocate, or permit any third party to service or repair the equipment. The Renter shall not sublease, lend, or transfer the equipment to any other person or location without prior written consent from <t t-esc="company.name"/>. <t t-esc="company.name"/> may repossess equipment without notice if used in violation of this agreement.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>2. Safe Use &amp; Renter Responsibilities</h2>
                                            <p>The Renter shall use equipment strictly in accordance with the manufacturer's instructions, rated weight capacity, and any guidelines provided by <t t-esc="company.name"/> at the time of delivery. Equipment must only be used for its intended purpose. The Renter shall not permit use by individuals under 18, persons under the influence of alcohol or narcotics, or in any unsafe manner. The Renter must immediately notify <t t-esc="company.name"/> of any malfunction, accident, damage, or incident. Failure to report damage promptly may result in additional liability.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>3. Battery Safety &amp; Maintenance</h2>
                                            <p>For equipment with batteries (power wheelchairs, mobility scooters, patient lifts): (a) The Renter must use ONLY the charger provided by <t t-esc="company.name"/>. Use of any third-party charger is strictly prohibited and may result in equipment damage, fire hazard, and full replacement charges. (b) If the provided charger is lost or damaged, the Renter must notify <t t-esc="company.name"/> immediately and will be charged for a replacement. (c) Batteries must not be routinely discharged below 30% capacity. (d) Batteries must not be left on the charger for extended, unattended periods beyond a full charge. (e) Equipment must not be used in a manner that causes excessive battery overheating. (f) Upon return, all batteries must be charged to at least 80%. Equipment returned with batteries below 80% will incur a conditioning and service charge. (g) The Renter assumes all risk for battery misuse, including but not limited to overcharging, deep discharge, or use of unauthorized charging equipment.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>4. Cleaning, Sanitation &amp; Return Condition</h2>
                                            <p>The Renter is responsible for keeping all equipment clean and sanitary throughout the rental period. Prior to return, all equipment must be thoroughly cleaned and free of bodily fluids, stains, food residue, pet hair, and debris. <strong>Specific requirements by equipment type:</strong></p>
                                            <p><strong>Mattresses &amp; Cushions:</strong> Mattresses must be kept clean and dry at all times. If a mattress is soiled with urine, vomit, blood, or any liquid that penetrates the cover, the mattress is deemed unrecoverable and the Renter will be charged the full replacement cost. Use of a waterproof mattress protector is strongly recommended. Wheelchair seat cushion covers must be washed (cold water, no heat drying) prior to return.</p>
                                            <p><strong>Wheelchairs &amp; Scooters:</strong> All surfaces must be wiped clean. Any liquid spills must be cleaned immediately. Missing parts, accessories, or hardware will result in replacement charges for both the parts and any associated labour.</p>
                                            <p><strong>Patient Lift Slings:</strong> Reusable slings must be washed before return. <t t-esc="company.name"/> does not rent hygiene slings. If a reusable sling is used for toileting or incontinence purposes, the Renter must purchase the sling at full cost and it will not be accepted for return.</p>
                                            <p>If equipment is returned unclean, a cleaning fee will be assessed and deducted from the security deposit or charged to the card on file. If the item is deemed unrecoverable due to contamination, the full replacement cost applies. <t t-esc="company.name"/> has sole discretion in determining cleaning and replacement charges.</p>
                                        </div>
                                    </td>
                                    <td style="border: none;">
                                        <div class="term-section">
                                            <h2>5. Delivery, Installation &amp; Site Preparation</h2>
                                            <p>Delivery, installation, and pickup fees are one-time, non-refundable charges. The Renter is responsible for ensuring the following before the technician arrives:</p>
                                            <p>(a) <strong>Hospital Beds:</strong> The designated room must be cleared of existing furniture to allow adequate space for installation. There must be sufficient clearance for the bed frame, side rails, and technician access on all sides. (b) <strong>All Equipment:</strong> Walkways and entry paths must be clear of obstacles, ice, snow, and tripping hazards. Pets must be secured in a separate room during delivery and pickup. (c) There must be adequate doorway width and turning space for the equipment to pass through.</p>
                                            <p>If the technician is unable to complete delivery or pickup due to site conditions not meeting these requirements, the visit will be rescheduled and the Renter will be charged fifty percent (50%) of the original delivery fee for each additional visit.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>6. Pickup &amp; Return</h2>
                                            <p>Upon cancellation or end of rental, <t t-esc="company.name"/> will schedule equipment pickup. The Renter must make all equipment and accessories available at the scheduled time. If the Renter denies or is unavailable for a scheduled pickup, a rebooking fee of fifty percent (50%) of the delivery fee will be charged for each subsequent visit. The Renter must ensure there is adequate room and clear pathways for safe removal of the equipment.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>7. Return Inspection</h2>
                                            <p>A technician will inspect equipment on-site at pickup for damage, cleanliness, completeness (including all accessories, chargers, remotes, rails, and hardware), and battery charge level. If the equipment is in good condition, the deposit refund process begins. If damage, missing parts, contamination, or unsanitary conditions are identified, the order is flagged for internal review, the Renter is notified, and the deposit is held until the matter is resolved. Both parts and labour will be charged for any missing or damaged components.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>8. Security Deposit</h2>
                                            <p>A refundable security deposit is collected at the start of the rental. After return and inspection, the deposit is held for a review period (typically three business days). If the equipment is returned in good, clean condition with all accessories, the full deposit is refunded to the original card. Deductions may be applied for: damage, excessive wear, missing parts, cleaning charges, battery conditioning, and replacement costs. If total charges exceed the deposit, the remaining balance is charged to the card on file and an invoice is issued. Deposit refunds take 1 to 3 business days to process; bank posting times may vary. <t t-esc="company.name"/> is not responsible for delays by the Renter's financial institution.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>9. Automatic Renewal &amp; Recurring Payments</h2>
                                            <p>This rental renews automatically at the end of each rental period for the same duration and rate unless the Renter cancels. The card on file will be charged automatically on each renewal date. A renewal reminder will be sent prior to the renewal date; the timing is proportional to the rental period (e.g. approximately three days before a 30-day rental, or same-day for a short-term rental). To cancel, the Renter must submit a cancellation request before the renewal date. Cancellation requests received on or after the renewal date will not be processed until the following cycle. For short-term rentals (typically under three days), a grace period applies: the auto-renewal charge is deferred for a brief window after the scheduled return time, allowing the Renter to return the equipment without incurring an additional renewal charge. If the equipment is not returned within the grace period, the renewal is processed automatically.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>10. Cancellation &amp; Early Return</h2>
                                            <p>The Renter may cancel before delivery with a 25% restocking fee. Once delivered, the rental charge for the current period is non-refundable. To stop future renewals, the Renter must cancel at least one (1) day before the next renewal date. Upon cancellation, equipment pickup will be scheduled by <t t-esc="company.name"/>.</p>
                                        </div>
                                    </td>
                                </tr>
                            </table>

                            <!-- ============================================================ -->
                            <!-- TERMS - PAGE 2 (two columns, continued) -->
                            <!-- ============================================================ -->
                            <div style="page-break-before: always;"></div>
                            <h1>RENTAL AGREEMENT <span style="font-size: 10pt;">(continued)</span></h1>

                            <table class="terms-table" style="border: none;">
                                <tr>
                                    <td style="border: none;">
                                        <div class="term-section">
                                            <h2>11. Card on File &amp; Payment Authorization</h2>
                                            <p>By signing this agreement, the Renter authorizes <t t-esc="company.name"/> to securely store payment card details using industry-standard tokenization. The card on file will be used for: initial rental charges, security deposit collection, automatic renewal payments, damage charges, cleaning fees, missing parts charges, battery conditioning fees, rebooking fees, overage invoices, and deposit refunds. <t t-esc="company.name"/> does not store full card numbers. All card data is purged upon rental completion.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>12. Liability, Risk &amp; Medical Disclaimer</h2>
                                            <p>The Renter assumes all risk and liability for any loss, damage, injury, illness, or death arising from the use, storage, or possession of the equipment. The equipment is provided as a mobility or comfort aid only and is <strong>NOT a medical device</strong>, nor a substitute for professional medical advice, diagnosis, or treatment. <t t-esc="company.name"/> makes no representations or warranties regarding the equipment's suitability for any specific medical condition. The Renter confirms they have independently assessed the equipment's suitability for their needs or the needs of the intended user. <t t-esc="company.name"/> is not liable for any property left, stored, or transported with the equipment, nor for any indirect, incidental, special, or consequential damages of any kind. The Renter is responsible for the full replacement cost of any equipment that is damaged, lost, stolen, or destroyed.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>13. Indemnification</h2>
                                            <p>The Renter shall indemnify, defend, and hold harmless <t t-esc="company.name"/>, its owners, directors, agents, officers, employees, contractors, and technicians from any and all claims, demands, liabilities, damages, injuries, losses, and expenses (including legal fees and court costs) arising from the Renter's use, possession, maintenance, or return of the equipment, or from any third party's use of the equipment while in the Renter's possession, except where caused solely by <t t-esc="company.name"/>'s gross negligence.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>14. Purchase Option</h2>
                                            <p>During the rental period, <t t-esc="company.name"/> may offer the Renter an option to purchase the rented or equivalent new equipment at a discounted price. If accepted, the purchase is subject to internal approval by <t t-esc="company.name"/>. The security deposit is always refunded in full and is never applied toward the purchase price. Delivery of the purchased item and pickup of the rental equipment will be coordinated by <t t-esc="company.name"/>.</p>
                                        </div>
                                    </td>
                                    <td style="border: none;">
                                        <div class="term-section">
                                            <h2>15. Communication Consent</h2>
                                            <p>The Renter consents to receive automated communications from <t t-esc="company.name"/> related to this rental, including but not limited to: renewal reminders, payment confirmations, invoices, delivery and pickup notifications, inspection results, deposit status updates, and promotional offers, via email and SMS to the contact information on file.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>16. Costs &amp; Expenses</h2>
                                            <p>The Renter agrees to cover all costs, expenses, and legal fees incurred by <t t-esc="company.name"/> in collecting overdue payments, recovering equipment, enforcing claims for damage, loss, or contamination, or otherwise enforcing the terms of this agreement.</p>
                                        </div>
                                        <div class="term-section">
                                            <h2>17. General Provisions</h2>
                                            <p>The Renter is not an agent or employee of <t t-esc="company.name"/>. Any individual signing this agreement on behalf of a corporation, trust, or other entity shall be personally liable for all obligations under this agreement. This agreement is binding upon the heirs, executors, administrators, and assigns of the Renter. <t t-esc="company.name"/> reserves the right to refuse rental to any individual or entity at its sole discretion. <t t-esc="company.name"/> shall not be liable for any delays or failures in performance caused by events beyond its reasonable control, including but not limited to natural disasters, pandemics, supplier delays, or government orders. If any provision of this agreement is found to be unenforceable, the remaining provisions shall remain in full force and effect. This Agreement is governed by and construed in accordance with the laws of the Province of Ontario, Canada, and constitutes the entire understanding between the parties, superseding all prior agreements, representations, or understandings, whether written or oral.</p>
                                        </div>
                                    </td>
                                </tr>
                            </table>

                            <!-- ============================================================ -->
                            <!-- PAGE 3: RENTAL DETAILS, PAYMENT, AND SIGNATURE -->
                            <!-- ============================================================ -->
                            <div style="page-break-before: always;"></div>
                            
                            <h1>RENTAL DETAILS</h1>

                            <!-- Renter &amp; Rental Info - Two Column Table with Rows -->
                            <table class="bordered" style="margin-bottom: 10px;">
                                <thead>
                                    <tr>
                                        <th style="width: 18%;">FIELD</th>
                                        <th style="width: 32%;">DETAILS</th>
                                        <th style="width: 18%;">FIELD</th>
                                        <th style="width: 32%;">DETAILS</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td style="font-weight: bold; background-color: #f5f5f5;">Name</td>
                                        <td><t t-esc="doc.partner_id.name"/></td>
                                        <td style="font-weight: bold; background-color: #f5f5f5;">Order Ref</td>
                                        <td><t t-esc="doc.name"/></td>
                                    </tr>
                                    <tr>
                                        <td style="font-weight: bold; background-color: #f5f5f5;">Phone</td>
                                        <td><t t-esc="doc.partner_id.phone or ''"/></td>
                                        <td style="font-weight: bold; background-color: #f5f5f5;">Start Date</td>
                                        <td>
                                            <t t-if="doc.rental_start_date"><span t-field="doc.rental_start_date" t-options="{'widget': 'date'}"/></t>
                                            <t t-else="">-</t>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="font-weight: bold; background-color: #f5f5f5;">Address</td>
                                        <td>
                                            <div t-field="doc.partner_shipping_id"
                                                 t-options="{'widget': 'contact', 'fields': ['address'], 'no_marker': True}"/>
                                        </td>
                                        <td style="font-weight: bold; background-color: #f5f5f5;">Return Date</td>
                                        <td>
                                            <t t-if="doc.rental_return_date"><span t-field="doc.rental_return_date" t-options="{'widget': 'date'}"/></t>
                                            <t t-else="">-</t>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="font-weight: bold; background-color: #f5f5f5;"></td>
                                        <td></td>
                                        <td style="font-weight: bold; background-color: #f5f5f5;">Duration</td>
                                        <td>
                                            <t t-if="doc.duration_days">
                                                <span t-esc="doc.duration_days"/> Day<t t-if="doc.duration_days != 1">s</t>
                                                <t t-if="doc.remaining_hours and doc.remaining_hours > 0">
                                                    , <t t-esc="doc.remaining_hours"/> Hr<t t-if="doc.remaining_hours != 1">s</t>
                                                </t>
                                            </t>
                                            <t t-elif="doc.rental_start_date and doc.rental_return_date">Less than 1 day</t>
                                            <t t-else="">-</t>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>

                            <!-- Equipment / Order Lines Table -->
                            <table class="bordered" style="margin-bottom: 10px;">
                                <thead>
                                    <tr>
                                        <th style="width: 48%;">DESCRIPTION</th>
                                        <th class="text-center" style="width: 7%;">QTY</th>
                                        <th class="text-right" style="width: 15%;">UNIT PRICE</th>
                                        <th class="text-right" style="width: 15%;">TAXES</th>
                                        <th class="text-right" style="width: 15%;">TOTAL</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <t t-foreach="doc.order_line" t-as="line">
                                        <t t-if="not line.display_type">
                                            <tr>
                                                <td>
                                                    <t t-esc="line.product_id.name"/>
                                                    <t t-if="line.is_security_deposit">
                                                        <br/><small style="color: #666; font-size: 7pt;">REFUNDABLE UPON RETURN IN GOOD &amp; CLEAN CONDITION</small>
                                                    </t>
                                                </td>
                                                <td class="text-center">
                                                    <span t-esc="int(line.product_uom_qty) if line.product_uom_qty == int(line.product_uom_qty) else line.product_uom_qty"/>
                                                </td>
                                                <td class="text-right">
                                                    <span t-field="line.price_unit" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
                                                </td>
                                                <td class="text-right">
                                                    <t t-if="line.tax_ids">
                                                        <t t-esc="', '.join(line.tax_ids.mapped('name'))"/>
                                                    </t>
                                                </td>
                                                <td class="text-right">
                                                    <span t-field="line.price_total" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>
                                                </td>
                                            </tr>
                                        </t>
                                    </t>
                                </tbody>
                            </table>

                            <!-- Totals - right-aligned bordered table -->
                            <div style="text-align: right; margin-bottom: 10px;">
                                <table class="bordered" style="width: auto; margin-left: auto;">
                                    <tr>
                                        <td style="min-width: 140px; padding: 4px 8px;">Subtotal</td>
                                        <td class="text-right" style="min-width: 100px; padding: 4px 8px;"><span t-field="doc.amount_untaxed"/></td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 4px 8px;">Taxes</td>
                                        <td class="text-right" style="padding: 4px 8px;"><span t-field="doc.amount_tax"/></td>
                                    </tr>
                                    <tr style="background-color: #0066a1; color: white;">
                                        <td style="padding: 4px 8px;"><strong>Total</strong></td>
                                        <td class="text-right" style="padding: 4px 8px;"><strong><span t-field="doc.amount_total"/></strong></td>
                                    </tr>
                                </table>
                            </div>

                            <!-- Credit Card Authorization - outer border only, row lines inside -->
                            <t t-set="deposit_lines" t-value="doc.order_line.filtered(lambda l: l.is_security_deposit)"/>
                            <t t-set="rental_charge_total" t-value="doc.amount_total - sum(deposit_lines.mapped('price_total'))"/>
                            <div class="cc-section">
                                <div class="cc-title">CREDIT CARD PAYMENT AUTHORIZATION</div>

                                <table style="width: 100%; border-collapse: collapse;">
                                    <tr>
                                        <td style="width: 18%; padding: 6px 8px; border: none; border-bottom: 1px solid #ccc;"><strong>Card #:</strong></td>
                                        <td style="padding: 6px 8px; border: none; border-bottom: 1px solid #ccc;">
                                            <span style="font-size: 12px; letter-spacing: 1px;">**** **** **** <t t-out="doc._get_card_last_four() or '____'">1234</t></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 6px 8px; border: none; border-bottom: 1px solid #ccc;"><strong>Exp Date:</strong></td>
                                        <td style="padding: 6px 8px; border: none; border-bottom: 1px solid #ccc;">
                                            <span style="font-size: 12px;">**/**</span>
                                            <span style="margin-left: 25px;"><strong>CVV:</strong> ***</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 6px 8px; border: none; border-bottom: 1px solid #ccc;"><strong>Cardholder:</strong></td>
                                        <td style="padding: 6px 8px; border: none; border-bottom: 1px solid #ccc;">
                                            <t t-if="doc.rental_agreement_signer_name">
                                                <span t-out="doc.rental_agreement_signer_name">Name</span>
                                            </t>
                                            <t t-else="">
                                                <span style="color: #999;">_________________________________</span>
                                            </t>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 6px 8px; border: none; border-bottom: 1px solid #ccc;"><strong>Billing Address:</strong></td>
                                        <td style="padding: 6px 8px; border: none; border-bottom: 1px solid #ccc;">
                                            <t t-if="doc.rental_billing_address">
                                                <span t-out="doc.rental_billing_address">Address</span>
                                                <t t-if="doc.rental_billing_postal_code">, <span t-out="doc.rental_billing_postal_code">Postal</span></t>
                                            </t>
                                            <t t-else="">
                                                <span style="color: #999;">_________________________________</span>
                                            </t>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 6px 8px; border: none;"><strong>Rental Charges:</strong></td>
                                        <td style="padding: 6px 8px; border: none;">
                                            $<t t-out="'%.2f' % rental_charge_total">0.00</t>
                                            <span style="margin-left: 40px;"><strong>Security Deposit:</strong>
                                                <t t-if="deposit_lines">
                                                    $<t t-out="'%.2f' % sum(deposit_lines.mapped('price_total'))">0.00</t>
                                                </t>
                                                <t t-else="">$___________</t>
                                            </span>
                                        </td>
                                    </tr>
                                </table>

                                <div class="authorization-text">
                                    <p>I authorize <t t-esc="company.name"/> to charge the credit card indicated above for: (a) the initial rental charges and security deposit; (b) automatic recurring renewal payments on each renewal date until I cancel; (c) any damage, loss, or overage charges as described in the terms above; and (d) to process refunds to this card. I certify that I am an authorized user of this credit card and will not dispute legitimate charges. By signing this form, I acknowledge that I have read and agree to all terms and conditions of this Rental Agreement, including the automatic renewal, cancellation, security deposit, inspection, and communication provisions.</p>
                                </div>
                            </div>

                            <!-- Signature Section - outer border only, three equal columns -->
                            <div class="signature-section">
                                <table style="width: 100%; border: 1px solid #000; border-collapse: collapse;">
                                    <tr>
                                        <td style="width: 33.33%; padding: 10px 14px; border: none; height: 80px; vertical-align: top;">
                                            <div class="signature-label">FULL NAME (PRINT)</div>
                                            <t t-if="doc.rental_agreement_signer_name">
                                                <div style="min-height: 50px; font-size: 14px; padding-top: 8px;" t-out="doc.rental_agreement_signer_name">Name</div>
                                            </t>
                                            <t t-else=""><div style="border-bottom: 1px solid #000; min-height: 50px; margin-top: 20px;"></div></t>
                                        </td>
                                        <td style="width: 33.33%; padding: 10px 14px; border: none; border-left: 1px solid #ccc; border-right: 1px solid #ccc; height: 80px; vertical-align: top;">
                                            <div class="signature-label">SIGNATURE</div>
                                            <t t-if="doc.rental_agreement_signature">
                                                <div style="min-height: 50px; padding-top: 8px;">
                                                    <img t-att-src="'data:image/png;base64,' + doc.rental_agreement_signature.decode('utf-8') if doc.rental_agreement_signature else ''" style="max-height: 55px; max-width: 100%;"/>
                                                </div>
                                            </t>
                                            <t t-else=""><div style="border-bottom: 1px solid #000; min-height: 50px; margin-top: 20px;"></div></t>
                                        </td>
                                        <td style="width: 33.34%; padding: 10px 14px; border: none; height: 80px; vertical-align: top;">
                                            <div class="signature-label">DATE</div>
                                            <t t-if="doc.rental_agreement_signed_date">
                                                <div style="min-height: 50px; font-size: 14px; padding-top: 8px;" t-out="format_datetime(doc.rental_agreement_signed_date, tz=doc.company_id.partner_id.tz or 'America/Toronto', dt_format='MM/dd/yyyy')">Date</div>
                                            </t>
                                            <t t-else=""><div style="border-bottom: 1px solid #000; min-height: 50px; margin-top: 20px;"></div></t>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            
                        </div>
                    </div>
                </t>
            </t>
        </t>
    </template>

    <!-- Report Action -->
    <record id="action_report_rental_agreement" model="ir.actions.report">
        <field name="name">Rental Agreement</field>
        <field name="model">sale.order</field>
        <field name="report_type">qweb-pdf</field>
        <field name="report_name">fusion_rental.report_rental_agreement</field>
        <field name="report_file">fusion_rental.report_rental_agreement</field>
        <field name="print_report_name">'Rental Agreement - %s%s' % (object.name, ' - Signed' if object.rental_agreement_signed else '')</field>
        <field name="binding_model_id" ref="sale.model_sale_order"/>
        <field name="binding_type">report</field>
    </record>
</odoo>
