<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2024-2025 Nexa Systems Inc.
    License OPL-1 (Odoo Proprietary License v1.0)
    Part of the Fusion Claim Assistant product family.
    Accessibility Equipment Purchase and Installation Agreement - Compact Layout
-->
<odoo>
    <template id="report_accessibility_contract">
        <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-contract { font-family: Arial, sans-serif; font-size: 8pt; line-height: 1.3; }
                        .fc-contract h1 { color: #0066a1; font-size: 14pt; text-align: center; margin: 5px 0 10px 0; }
                        .fc-contract h2 { color: #0066a1; font-size: 9pt; margin: 6px 0 3px 0; font-weight: bold; }
                        .fc-contract h4 { color: #0066a1; margin: 0 0 10px 0; font-size: 13pt; }
                        .fc-contract p { margin: 2px 0; text-align: justify; }
                        .fc-contract .intro { margin-bottom: 8px; font-size: 8pt; }
                        .fc-contract ul { margin: 2px 0 2px 15px; padding: 0; }
                        .fc-contract li { margin-bottom: 1px; }
                        .fc-contract table { width: 100%; border-collapse: collapse; }
                        .fc-contract table.bordered, .fc-contract table.bordered th, .fc-contract table.bordered td { border: 1px solid #000; }
                        .fc-contract th { background-color: #0066a1; color: white; padding: 4px 6px; font-weight: bold; text-align: center; font-size: 8pt; }
                        .fc-contract td { padding: 3px 5px; vertical-align: top; font-size: 8pt; }
                        .fc-contract .text-center { text-align: center; }
                        .fc-contract .text-end { text-align: right; }
                        .fc-contract .info-header { background-color: #f5f5f5; color: #333; }
                        .fc-contract .section-row { background-color: #f0f0f0; font-weight: bold; }
                        .fc-contract .note-row { font-style: italic; }
                        .fc-contract .totals-table { border: 1px solid #000; border-collapse: collapse; }
                        .fc-contract .totals-table td { border: 1px solid #000; padding: 4px 6px; }
                        
                        /* Two-column layout for terms */
                        .fc-contract .terms-container { column-count: 2; column-gap: 20px; margin-top: 8px; }
                        .fc-contract .term-section { break-inside: avoid; margin-bottom: 6px; }
                        
                        /* Declaration */
                        .fc-contract .declaration { margin-top: 12px; padding: 8px; background-color: #fff8e1; border: 2px solid #ffc107; }
                        .fc-contract .declaration-title { font-weight: bold; font-size: 9pt; text-align: center; margin-bottom: 5px; }
                        .fc-contract .declaration-text { font-size: 8pt; text-align: center; font-weight: bold; }
                        
                        /* Clean signature layout */
                        .fc-contract .signatures-container { margin-top: 15px; }
                        .fc-contract .sig-row { display: table; width: 100%; margin-bottom: 20px; }
                        .fc-contract .sig-col { display: table-cell; width: 48%; vertical-align: top; }
                        .fc-contract .sig-spacer { display: table-cell; width: 4%; }
                        .fc-contract .sig-title { font-weight: bold; font-size: 9pt; color: #0066a1; margin-bottom: 8px; border-bottom: 2px solid #0066a1; padding-bottom: 3px; }
                        .fc-contract .sig-field { margin-bottom: 12px; }
                        .fc-contract .sig-line { border-bottom: 1px solid #000; min-height: 25px; }
                        .fc-contract .sig-label { font-size: 7pt; color: #666; margin-top: 2px; }
                    </style>
                    
                    <div class="fc-contract">
                        <div class="page">
                            
                            <!-- ============================================================ -->
                            <!-- PAGE 1: CONTRACT DETAILS -->
                            <!-- ============================================================ -->
                            
                            <!-- Document Title -->
                            <h4>Accessibility Contract <span t-field="doc.name"/></h4>
                            
                            <!-- Address Table -->
                            <table class="bordered" style="margin-bottom: 8px;">
                                <thead>
                                    <tr>
                                        <th style="width: 50%;">BILLING ADDRESS</th>
                                        <th style="width: 50%;">INSTALLATION ADDRESS</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td style="height: 50px;">
                                            <div t-field="doc.partner_invoice_id" 
                                                 t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone'], 'no_marker': True}"/>
                                        </td>
                                        <td style="height: 50px;">
                                            <div t-field="doc.partner_shipping_id" 
                                                 t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone'], 'no_marker': True}"/>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            
                            <!-- Order Info Table -->
                            <table class="bordered" style="margin-bottom: 8px;">
                                <thead>
                                    <tr>
                                        <th class="info-header" style="width: 25%;">CONTRACT DATE</th>
                                        <th class="info-header" style="width: 25%;">VALID UNTIL</th>
                                        <th class="info-header" style="width: 25%;">SALESPERSON</th>
                                        <th class="info-header" style="width: 25%;">PAYMENT TERMS</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td class="text-center">
                                            <span t-field="doc.date_order" t-options="{'widget': 'date'}"/>
                                        </td>
                                        <td class="text-center">
                                            <t t-if="doc.validity_date"><span t-field="doc.validity_date"/></t>
                                            <t t-else="">-</t>
                                        </td>
                                        <td class="text-center"><span t-field="doc.user_id"/></td>
                                        <td class="text-center"><span t-esc="doc.payment_term_id.name or '-'"/></td>
                                    </tr>
                                </tbody>
                            </table>
                            
                            <!-- Order Lines Table -->
                            <table class="bordered" style="margin-bottom: 8px;">
                                <thead>
                                    <tr>
                                        <th class="text-center" style="width: 12%;">CODE</th>
                                        <th style="width: 43%;">DESCRIPTION</th>
                                        <th class="text-center" style="width: 8%;">QTY</th>
                                        <th class="text-center" style="width: 12%;">UNIT PRICE</th>
                                        <th class="text-center" style="width: 10%;">TAX</th>
                                        <th class="text-center" style="width: 15%;">AMOUNT</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <t t-foreach="doc.order_line" t-as="line">
                                        <t t-if="line.display_type == 'line_section'">
                                            <tr class="section-row">
                                                <td colspan="6"><span t-field="line.name"/></td>
                                            </tr>
                                        </t>
                                        <t t-elif="line.display_type == 'line_note'">
                                            <tr class="note-row">
                                                <td colspan="6"><span t-field="line.name"/></td>
                                            </tr>
                                        </t>
                                        <t t-elif="not line.display_type">
                                            <tr>
                                                <td class="text-center"><span t-esc="line.product_id.default_code or ''"/></td>
                                                <td>
                                                    <t t-if="line.name">
                                                        <t t-set="clean_name" t-value="line.name"/>
                                                        <t t-if="'] ' in line.name">
                                                            <t t-set="clean_name" t-value="line.name.split('] ', 1)[1]"/>
                                                        </t>
                                                        <t t-esc="clean_name"/>
                                                    </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-end"><span t-field="line.price_unit"/></td>
                                                <td class="text-center">
                                                    <t t-esc="', '.join([(tax.invoice_label or tax.name) for tax in line.tax_ids]) or '-'"/>
                                                </td>
                                                <td class="text-end"><span t-field="line.price_subtotal"/></td>
                                            </tr>
                                        </t>
                                    </t>
                                </tbody>
                            </table>
                            
                            <!-- Totals - Right Aligned -->
                            <table style="width: 100%; margin-bottom: 10px;">
                                <tr>
                                    <td style="width: 60%; vertical-align: top;">
                                        <t t-if="doc.payment_term_id.note">
                                            <strong>Payment Terms:</strong> <span t-field="doc.payment_term_id.note"/>
                                        </t>
                                    </td>
                                    <td style="width: 40%;">
                                        <table class="totals-table" style="width: 100%;">
                                            <tr>
                                                <td>Subtotal</td>
                                                <td class="text-end"><span t-field="doc.amount_untaxed"/></td>
                                            </tr>
                                            <tr>
                                                <td>Taxes</td>
                                                <td class="text-end"><span t-field="doc.amount_tax"/></td>
                                            </tr>
                                            <tr>
                                                <td><strong>TOTAL</strong></td>
                                                <td class="text-end"><strong><span t-field="doc.amount_total"/></strong></td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                            
                            <!-- Notes if any -->
                            <t t-if="doc.note">
                                <div style="margin-bottom: 8px; padding: 5px; background-color: #f9f9f9; border: 1px solid #ddd; font-size: 8pt;">
                                    <strong>Notes:</strong> <span t-field="doc.note"/>
                                </div>
                            </t>
                            
                            <!-- ============================================================ -->
                            <!-- TERMS AND CONDITIONS - TWO COLUMN LAYOUT -->
                            <!-- ============================================================ -->
                            
                            <h1 style="font-size: 11pt; margin: 10px 0 5px 0;">ACCESSIBILITY CONTRACT TERMS AND CONDITIONS</h1>
                            
                            <div class="intro">
                                <p>This Accessibility Contract ("Contract") is between <strong><t t-esc="company.name"/></strong> ("Company") and the Customer for the purchase, delivery, and installation of accessibility equipment including Stairlifts, Platform Lifts, Ceiling Lifts, Ramps, and Door Openers.</p>
                            </div>
                            
                            <div class="terms-container">
                                
                                <div class="term-section">
                                    <h2>1. Scope of Contract</h2>
                                    <p>This Contract governs the sale, delivery, installation, and ownership of the equipment specified. By signing, the Customer agrees to all terms herein.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>2. Delivery</h2>
                                    <p>The Company will make reasonable efforts to deliver as agreed. Delivery dates are estimates, not guarantees. The Company is not liable for delays. The Customer cannot cancel due to delays unless agreed in writing.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>3. Deposits</h2>
                                    <p>A deposit of <strong>70%</strong> of total value (or as specified) is required at order. Upon receipt, equipment preparation begins. If cancelled, the Company may recover all costs incurred including materials, labor, and administrative expenses.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>4. Power Supply</h2>
                                    <p>The Customer must ensure a suitable power source is available at the installation site. Electrical outlet installation is not included unless stated in the order.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>5. Concrete Work (Porch Lifts)</h2>
                                    <p>For Porch Lifts requiring a concrete base, the Company provides specifications. Unless agreed otherwise, the Customer arranges and pays for concrete work. The Company is not liable for issues from third-party concrete work.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>6. Ownership and Title</h2>
                                    <p>Title remains with the Company until full payment. The Company may reclaim equipment upon non-payment or breach of this Contract.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>7. Warranty</h2>
                                    <p>Equipment is covered by limited warranty as specified. Warranty excludes: accidental damages, normal wear and tear, damages from misuse or lack of maintenance. Claims must be in writing.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>8. Returns and Refunds</h2>
                                    <p>Once submitted for production, orders are final and non-refundable. No returns permitted. Post-submission modifications incur additional charges at Company's discretion.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>9. Liability</h2>
                                    <p>The Company is not liable for injuries or damages from: misuse, unauthorized modifications, failure to follow instructions, lack of maintenance, or use beyond intended purpose. Customer indemnifies Company from related claims.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>10. Indemnification</h2>
                                    <p>Customer indemnifies Company from claims arising from installation site conditions including structural issues, electrical faults, or inadequate site preparation.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>11. Buying Back Goods</h2>
                                    <p>The Company does not buy back goods unless explicitly agreed in writing.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>12. Force Majeure</h2>
                                    <p>Company is not liable for delays from events beyond control: natural disasters, strikes, supply chain disruptions, or governmental actions.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>13. Entire Agreement</h2>
                                    <p>This Contract constitutes the entire understanding and supersedes all prior agreements, written or oral.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>14. Governing Law</h2>
                                    <p>This Contract is governed by laws of the jurisdiction where the Company operates.</p>
                                </div>
                                
                                <div class="term-section">
                                    <h2>15. Acceptance</h2>
                                    <p>By signing, Customer acknowledges reading, understanding, and agreeing to all terms and conditions.</p>
                                </div>
                                
                            </div>
                            
                            <!-- Declaration -->
                            <div class="declaration">
                                <div class="declaration-title">CUSTOMER DECLARATION</div>
                                <div class="declaration-text">
                                    I HAVE READ, UNDERSTOOD AND AGREE TO ALL CONDITIONS SET FORTH IN THIS ACCESSIBILITY CONTRACT AND AGREE TO PAY THE AMOUNT OWED TO <t t-esc="company.name.upper()"/> AS SPECIFIED.
                                </div>
                            </div>
                            
                            <!-- Clean Signature Section - Side by Side -->
                            <div class="signatures-container">
                                <div class="sig-row">
                                    <!-- Customer Signature -->
                                    <div class="sig-col">
                                        <div class="sig-title">CUSTOMER</div>
                                        <div class="sig-field">
                                            <div class="sig-line"></div>
                                            <div class="sig-label">Full Name (Print)</div>
                                        </div>
                                        <div class="sig-field">
                                            <div class="sig-line"></div>
                                            <div class="sig-label">Signature</div>
                                        </div>
                                        <div class="sig-field">
                                            <div class="sig-line" style="width: 50%;"></div>
                                            <div class="sig-label">Date</div>
                                        </div>
                                    </div>
                                    
                                    <div class="sig-spacer"></div>
                                    
                                    <!-- Company Representative Signature -->
                                    <div class="sig-col">
                                        <div class="sig-title">FOR <t t-esc="company.name.upper()"/></div>
                                        <div class="sig-field">
                                            <div class="sig-line"></div>
                                            <div class="sig-label">Authorized Representative Name (Print)</div>
                                        </div>
                                        <div class="sig-field">
                                            <div class="sig-line"></div>
                                            <div class="sig-label">Signature</div>
                                        </div>
                                        <div class="sig-field">
                                            <div class="sig-line" style="width: 50%;"></div>
                                            <div class="sig-label">Date</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                        </div>
                    </div>
                </t>
            </t>
        </t>
    </template>
</odoo>
