<?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.
    Standard Proof of Delivery Document
-->
<odoo>
    <template id="report_proof_of_delivery_standard">
        <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)"/>
                    
                    <style>
                        .fc-pod { font-family: Arial, sans-serif; font-size: 10pt; }
                        .fc-pod table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
                        .fc-pod table.bordered, .fc-pod table.bordered th, .fc-pod table.bordered td { border: 1px solid #000; }
                        .fc-pod th { background-color: #0066a1; color: white; padding: 6px 8px; font-weight: bold; font-size: 9pt; }
                        .fc-pod td { padding: 5px 6px; vertical-align: top; font-size: 9pt; }
                        .fc-pod .text-center { text-align: center; }
                        .fc-pod .text-end { text-align: right; }
                        .fc-pod .text-start { text-align: left; }
                        .fc-pod .section-row { background-color: #f0f0f0; font-weight: bold; }
                        .fc-pod .note-row { font-style: italic; }
                        .fc-pod h2 { color: #0066a1; margin: 8px 0; font-size: 16pt; }
                        .fc-pod .info-table td { padding: 6px 10px; font-size: 10pt; }
                        .fc-pod .info-table th { background-color: #f5f5f5; color: #333; font-size: 9pt; padding: 5px 10px; }
                        .fc-pod .signature-section { margin-top: 20px; border: 1px solid #000; padding: 15px; }
                        .fc-pod .signature-line { border-bottom: 1px solid #000; min-height: 30px; margin-bottom: 5px; }
                        .fc-pod .signature-label { font-size: 8pt; color: #666; margin-bottom: 15px; }
                        .fc-pod .policy-section { font-size: 8pt; margin-top: 15px; padding: 10px; background-color: #f9f9f9; border: 1px solid #ddd; }
                        .fc-pod .policy-title { font-weight: bold; font-size: 9pt; margin-bottom: 5px; }
                        .fc-pod .acknowledgment { font-size: 9pt; margin: 15px 0; padding: 10px; background-color: #fff8e1; border-left: 3px solid #ffc107; }
                    </style>
                    
                    <div class="fc-pod">
                        <div class="page">
                            
                            <!-- Document Title -->
                            <h2 style="text-align: center; margin-bottom: 15px;">
                                PROOF OF DELIVERY
                            </h2>
                            
                            <!-- Order Reference -->
                            <div style="text-align: center; margin-bottom: 15px; font-size: 11pt;">
                                <strong>Order Reference:</strong> <span t-field="doc.name"/>
                            </div>
                            
                            <!-- Customer Info Table -->
                            <table class="bordered">
                                <thead>
                                    <tr>
                                        <th style="width: 50%;">CUSTOMER INFORMATION</th>
                                        <th style="width: 50%;">DELIVERY ADDRESS</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td style="height: 60px; font-size: 10pt;">
                                            <div t-field="doc.partner_invoice_id" 
                                                 t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone'], 'no_marker': True}"/>
                                        </td>
                                        <td style="height: 60px; font-size: 10pt;">
                                            <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 info-table">
                                <thead>
                                    <tr>
                                        <th>ORDER DATE</th>
                                        <th>DELIVERY DATE</th>
                                        <th>SALES REP</th>
                                        <th>AUTHORIZER</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.commitment_date">
                                                <span t-field="doc.commitment_date" t-options="{'widget': 'date'}"/>
                                            </t>
                                            <t t-elif="doc.x_fc_adp_delivery_date">
                                                <span t-field="doc.x_fc_adp_delivery_date"/>
                                            </t>
                                            <t t-else="">-</t>
                                        </td>
                                        <td class="text-center">
                                            <span t-field="doc.user_id"/>
                                        </td>
                                        <td class="text-center">
                                            <span t-if="doc.x_fc_authorizer_id" t-field="doc.x_fc_authorizer_id"/>
                                            <span t-else="">-</span>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            
                            <!-- Products Delivered Table -->
                            <table class="bordered">
                                <thead>
                                    <tr>
                                        <th class="text-center" style="width: 15%;">PRODUCT CODE</th>
                                        <th class="text-start" style="width: 50%;">DESCRIPTION</th>
                                        <th class="text-center" style="width: 20%;">SERIAL #</th>
                                        <th class="text-center" style="width: 15%;">QTY</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <t t-foreach="doc.order_line" t-as="line">
                                        <!-- Section Header -->
                                        <t t-if="line.display_type == 'line_section'">
                                            <tr class="section-row">
                                                <td colspan="4">
                                                    <strong><span t-field="line.name"/></strong>
                                                </td>
                                            </tr>
                                        </t>
                                        <!-- Note Line -->
                                        <t t-elif="line.display_type == 'line_note'">
                                            <tr class="note-row">
                                                <td colspan="4">
                                                    <span t-field="line.name"/>
                                                </td>
                                            </tr>
                                        </t>
                                        <!-- Product Line -->
                                        <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="line.x_fc_serial_number or ''"/>
                                                </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>
                                            </tr>
                                        </t>
                                    </t>
                                </tbody>
                            </table>
                            
                            <!-- Acknowledgment Section -->
                            <div class="acknowledgment">
                                <p style="margin: 0;">
                                    <strong>Full Refund Policy:</strong> <span t-out="doc.company_id.website or ''"/><t t-if="doc.company_id.website">/return-policy/</t>
                                </p>
                                <p style="margin: 10px 0 0 0;">
                                    By signing below, you are acknowledging that you had the opportunity to inspect the product and found it to be free from any reasonably discoverable defects. You are also agreeing that you had the opportunity to review the entire transaction and the refund policy on the back side of the page, and it has satisfactorily addressed any questions or concerns you had, and nothing has been promised to you that has not been put into writing. This Delivery Confirmation Form is hereby incorporated into this transaction.
                                </p>
                                <p style="margin: 10px 0 0 0; font-weight: bold; text-transform: uppercase;">
                                    I HAVE RECEIVED ALL OF THE PRODUCTS AND SERVICES PROMISED TO ME IN CONNECTION WITH THIS TRANSACTION AT THE TIME OF DELIVERY.
                                </p>
                            </div>
                            
                            <!-- Signature Section -->
                            <div class="signature-section">
                                <t t-if="doc.x_fc_pod_signature">
                                    <!-- Captured Digital Signature -->
                                    <div class="row">
                                        <div class="col-6">
                                            <div class="signature-label">PRINT NAME</div>
                                            <div class="signature-line" style="padding: 5px 0; font-size: 12pt; font-weight: bold;">
                                                <t t-out="doc.x_fc_pod_client_name or ''"/>
                                            </div>
                                        </div>
                                        <div class="col-6">
                                            <div class="signature-label">DATE</div>
                                            <div class="signature-line" style="padding: 5px 0; font-size: 12pt;">
                                                <t t-if="doc.x_fc_pod_signature_date">
                                                    <span t-field="doc.x_fc_pod_signature_date"/>
                                                </t>
                                            </div>
                                        </div>
                                    </div>
                                    <div style="margin-top: 20px;">
                                        <div class="signature-label">SIGNATURE</div>
                                        <div style="min-height: 60px; padding: 5px; border-bottom: 1px solid #000;">
                                            <img t-att-src="'data:image/png;base64,' + doc.x_fc_pod_signature.decode('utf-8')" 
                                                 style="max-height: 80px; max-width: 300px;"
                                                 alt="Client Signature"/>
                                        </div>
                                        <t t-if="doc.x_fc_pod_signed_by_user_id">
                                            <div style="font-size: 7pt; color: #666; margin-top: 5px;">
                                                Collected by: <t t-out="doc.x_fc_pod_signed_by_user_id.name"/>
                                            </div>
                                        </t>
                                    </div>
                                </t>
                                <t t-else="">
                                    <!-- Empty signature lines for manual signing -->
                                    <div class="row">
                                        <div class="col-6">
                                            <div class="signature-label">PRINT NAME</div>
                                            <div class="signature-line"></div>
                                        </div>
                                        <div class="col-6">
                                            <div class="signature-label">DATE</div>
                                            <div class="signature-line"></div>
                                        </div>
                                    </div>
                                    <div style="margin-top: 20px;">
                                        <div class="signature-label">SIGNATURE</div>
                                        <div class="signature-line" style="min-height: 50px;"></div>
                                    </div>
                                </t>
                            </div>
                            
                            <!-- Page Break for Policy -->
                            <div style="page-break-before: always;"></div>
                            
                            <!-- Refund Policy Page -->
                            <h2 style="text-align: center; margin-bottom: 15px;">
                                RETURN AND REFUND POLICY
                            </h2>
                            
                            <div class="policy-section" style="font-size: 9pt;">
                                <p style="margin: 0 0 10px 0;">
                                    <strong><t t-esc="doc.company_id.name"/></strong> does not accept any returns or refunds for custom-built orders or any modified products.
                                </p>
                                <p style="margin: 0 0 10px 0;">
                                    The following policy applies to all <t t-esc="doc.company_id.name"/> customers:
                                </p>
                                
                                <div class="policy-title" style="margin-top: 15px;">Change Order and Cancellation Policy</div>
                                <p style="margin: 5px 0;">
                                    <t t-esc="doc.company_id.name"/> sells custom Mobility products according to customer specifications. Quote, and order acknowledgments must be reviewed for accuracy.
                                </p>
                                <p style="margin: 5px 0;">
                                    Customized, specially ordered, or fabricated mobility and accessibility devices are not returnable or eligible for a refund. We also do not accept returns or exchanges for items that have come in contact with the skin. This includes, but is not limited to, lift chairs, seating, and positioning products, including wheelchair cushions and back supports, TENS units, patient lifts, blood pressure units, breast pumps, bathroom safety items, pillows, bedding, and mattresses, bracing, and continence care products.
                                </p>
                                
                                <div class="policy-title" style="margin-top: 15px;">Restocking Fees</div>
                                <p style="margin: 5px 0;">
                                    Product or parts returns for warranty items (i.e. product defects) are subject to <t t-esc="doc.company_id.name"/>'s evaluation but not subject to a restocking fee.
                                </p>
                                <p style="margin: 5px 0;">
                                    <strong>30% Restocking Fee:</strong> Some products require a 30% restocking fee for returns. These include: Patient lifts, Hospital Beds, Transport Wheelchairs, Standard Rollators &amp; Walkers
                                </p>
                                
                                <div class="policy-title" style="margin-top: 15px;">Non-Returnable Items</div>
                                <p style="margin: 5px 0;">
                                    There are certain products that are custom-made by the manufacturer and are non-returnable. These include:
                                </p>
                                <ul style="margin: 5px 0 5px 20px; padding: 0;">
                                    <li>Built to order items / Custom wheelchairs, Rigid ultra lightweight wheelchairs</li>
                                    <li>Type/Category 2, 3, 4 &amp; 5 Wheelchair</li>
                                    <li>Tilt &amp; Reclining wheelchairs</li>
                                    <li>Sports wheelchairs</li>
                                    <li>Custom Power Wheelchairs</li>
                                    <li>All Spare Parts</li>
                                    <li>Adaptive Strollers</li>
                                    <li>Geri chairs</li>
                                    <li>Custom-built lift chairs/Recliners, including those with upgraded fabrics, heat and massage, Power Pillow, footrest extension or left-hand control options are non-returnable.</li>
                                    <li>Custom-built stairlifts, porch-lifts, vertical platform lifts, custom ceiling lifts.</li>
                                    <li>Open-Box Items</li>
                                    <li>Wheelchair scales</li>
                                </ul>
                                <p style="margin: 5px 0;">
                                    <strong>For hygienic reasons, the following products are non-returnable:</strong> Bathroom Safety products, Incontinence products, Cushions and Backs
                                </p>
                            </div>
                            
                        </div>
                    </div>
                </t>
            </t>
        </t>
    </template>
</odoo>
