<?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.
    Proof of Pickup Document (for rental returns)
-->
<odoo>
    <template id="report_proof_of_pickup">
        <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-pop { font-family: Arial, sans-serif; font-size: 10pt; }
                        .fc-pop table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
                        .fc-pop table.bordered, .fc-pop table.bordered th, .fc-pop table.bordered td { border: 1px solid #000; }
                        .fc-pop th { background-color: #2e7d32; color: white; padding: 6px 8px; font-weight: bold; font-size: 9pt; }
                        .fc-pop td { padding: 5px 6px; vertical-align: top; font-size: 9pt; }
                        .fc-pop .text-center { text-align: center; }
                        .fc-pop .text-end { text-align: right; }
                        .fc-pop .text-start { text-align: left; }
                        .fc-pop .section-row { background-color: #f0f0f0; font-weight: bold; }
                        .fc-pop .note-row { font-style: italic; }
                        .fc-pop h2 { color: #2e7d32; margin: 8px 0; font-size: 16pt; }
                        .fc-pop .info-table td { padding: 6px 10px; font-size: 10pt; }
                        .fc-pop .info-table th { background-color: #f5f5f5; color: #333; font-size: 9pt; padding: 5px 10px; }
                        .fc-pop .signature-section { margin-top: 20px; border: 1px solid #000; padding: 15px; }
                        .fc-pop .signature-line { border-bottom: 1px solid #000; min-height: 30px; margin-bottom: 5px; }
                        .fc-pop .signature-label { font-size: 8pt; color: #666; margin-bottom: 15px; }
                        .fc-pop .policy-section { font-size: 8pt; margin-top: 15px; padding: 10px; background-color: #f9f9f9; border: 1px solid #ddd; }
                        .fc-pop .policy-title { font-weight: bold; font-size: 9pt; margin-bottom: 5px; }
                        .fc-pop .acknowledgment { font-size: 9pt; margin: 15px 0; padding: 10px; background-color: #e8f5e9; border-left: 3px solid #4caf50; }
                    </style>
                    
                    <div class="fc-pop">
                        <div class="page">
                            
                            <!-- Document Title -->
                            <h2 style="text-align: center; margin-bottom: 15px;">
                                PROOF OF PICKUP
                            </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%;">PICKUP 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>PICKUP 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 Picked Up 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>Equipment Return Acknowledgment</strong>
                                </p>
                                <p style="margin: 10px 0 0 0;">
                                    By signing below, you are confirming that you have returned the above listed equipment to <t t-esc="doc.company_id.name"/>. You acknowledge that all items listed have been picked up by our authorized representative, and you no longer have possession of these products. You are also confirming that the equipment was returned in the same condition as when it was delivered, normal wear and tear excepted, and that you are aware of any applicable charges related to the rental period or equipment condition.
                                </p>
                                <p style="margin: 10px 0 0 0; font-weight: bold; text-transform: uppercase;">
                                    I CONFIRM THAT ALL OF THE PRODUCTS LISTED ABOVE HAVE BEEN RETURNED AND PICKED UP BY AN AUTHORIZED REPRESENTATIVE OF <t t-esc="doc.company_id.name.upper()"/>.
                                </p>
                            </div>
                            
                            <!-- Signature Section -->
                            <div class="signature-section">
                                <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>
                            </div>
                            
                            <!-- Page Break for Policy -->
                            <div style="page-break-before: always;"></div>
                            
                            <!-- Return Policy Page -->
                            <h2 style="text-align: center; margin-bottom: 15px;">
                                RENTAL RETURN TERMS AND CONDITIONS
                            </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> - Rental Equipment Return Policy
                                </p>
                                <p style="margin: 0 0 10px 0;">
                                    The following terms apply to all rental equipment returns:
                                </p>
                                
                                <div class="policy-title" style="margin-top: 15px;">Equipment Condition</div>
                                <p style="margin: 5px 0;">
                                    All rental equipment must be returned in the same condition as when delivered, allowing for normal wear and tear. The customer is responsible for any damage beyond normal use. Equipment will be inspected upon return, and any damage or missing parts will be assessed and charged accordingly.
                                </p>
                                
                                <div class="policy-title" style="margin-top: 15px;">Rental Period</div>
                                <p style="margin: 5px 0;">
                                    Rental charges are calculated based on the agreed rental period. Early returns may be subject to minimum rental fees as specified in the rental agreement. Late returns may incur additional daily rental charges.
                                </p>
                                
                                <div class="policy-title" style="margin-top: 15px;">Pickup and Scheduling</div>
                                <p style="margin: 5px 0;">
                                    Equipment pickup must be scheduled in advance. The customer is responsible for ensuring the equipment is accessible and ready for pickup at the scheduled time. Missed pickup appointments may result in continued rental charges.
                                </p>
                                
                                <div class="policy-title" style="margin-top: 15px;">Cleaning Requirements</div>
                                <p style="margin: 5px 0;">
                                    Equipment should be returned clean and sanitized. Additional cleaning fees may apply if equipment is returned in an unsanitary condition.
                                </p>
                                
                                <div class="policy-title" style="margin-top: 15px;">Damage Assessment</div>
                                <p style="margin: 5px 0;">
                                    Upon pickup, our representative will conduct an inspection of the equipment. Any damage will be documented and the customer will be notified of repair or replacement costs. The following are examples of damage that may result in charges:
                                </p>
                                <ul style="margin: 5px 0 5px 20px; padding: 0;">
                                    <li>Broken or bent frames</li>
                                    <li>Torn or stained upholstery</li>
                                    <li>Missing parts or accessories</li>
                                    <li>Non-functional electrical components</li>
                                    <li>Excessive wear on wheels or tires</li>
                                    <li>Water damage or rust</li>
                                    <li>Modifications made without authorization</li>
                                </ul>
                                
                                <div class="policy-title" style="margin-top: 15px;">Security Deposit</div>
                                <p style="margin: 5px 0;">
                                    If a security deposit was collected at the time of rental, it will be refunded within 14 business days after the equipment has been inspected and cleared, less any applicable charges for damage, cleaning, or extended rental periods.
                                </p>
                                
                                <div class="policy-title" style="margin-top: 15px;">Contact Information</div>
                                <p style="margin: 5px 0;">
                                    For questions regarding your rental return or any charges, please contact <t t-esc="doc.company_id.name"/> customer service.
                                </p>
                            </div>
                            
                        </div>
                    </div>
                </t>
            </t>
        </t>
    </template>
</odoo>
