<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>R2 Special Handling Log - {{ doc.name }}</title>
    <style>
        @page { size: letter; margin: 0.5in; }
        body { font-family: Arial, sans-serif; font-size: 10pt; }
        .header { border: 3px solid #28a745; padding: 15px; margin-bottom: 15px; }
        .title { font-size: 20pt; font-weight: bold; text-align: center; margin-bottom: 5px; color: #28a745; }
        .subtitle { font-size: 11pt; text-align: center; margin-bottom: 15px; font-style: italic; }
        .info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 15px; }
        .info-field { }
        .info-label { font-weight: bold; display: inline-block; width: 70px; }
        .info-value { border-bottom: 1px solid #000; display: inline-block; min-width: 180px; padding: 2px 5px; }
        .client-block { border: 1px solid #000; padding: 10px; margin: 10px 0; background: #f9f9f9; }
        .section { border: 1px solid #000; padding: 10px; margin: 10px 0; }
        .section-title { font-size: 11pt; font-weight: bold; background: #28a745; color: white; padding: 5px 10px; margin: -10px -10px 10px -10px; border-bottom: 1px solid #000; }
        .red-line { border: 2px solid #d63384; }
        .red-line .section-title { background: #d63384; }
        table { width: 100%; border-collapse: collapse; margin: 10px 0; }
        th, td { border: 1px solid #000; padding: 6px; text-align: left; font-size: 9pt; }
        th { background: #f0f0f0; font-weight: bold; }
        .instructions-list { list-style: none; padding: 0; margin: 0; }
        .instructions-list li { margin: 5px 0; padding-left: 15px; position: relative; }
        .instructions-list li:before { content: "•"; position: absolute; left: 0; font-weight: bold; }
        .checkbox { display: inline-block; width: 14px; height: 14px; border: 1px solid #000; margin-right: 5px; vertical-align: middle; }
        .footer { margin-top: 20px; font-size: 8pt; text-align: center; border-top: 2px solid #28a745; padding-top: 10px; }
    </style>
</head>
<body>
    <div class="header">
        <div class="title">R2: SPECIAL HANDLING LOG</div>
        <div class="subtitle">COR must include: {{ doc.job_number or 'Job #________' }}</div>
        
        <div class="info-grid">
            <div class="info-field">
                <span class="info-label">Date:</span>
                <span class="info-value">{{ doc.received_date or nowdate() }}</span>
            </div>
            <div class="info-field">
                <span class="info-label">Truck #:</span>
                <span class="info-value">{{ doc.truck_number or '____' }}</span>
            </div>
            <div class="info-field">
                <span class="info-label">Driver:</span>
                <span class="info-value">{{ doc.driver or '________________' }}</span>
            </div>
            <div class="info-field">
                <span class="info-label">Service Level:</span>
                <span class="info-value" style="font-weight:bold; color:#d63384;">{{ doc.service_level or '________' }}</span>
            </div>
        </div>
        
        <div class="client-block">
            <div class="info-field" style="margin-bottom: 8px;">
                <span class="info-label">Client:</span>
                <span class="info-value" style="min-width: 400px; font-weight:bold;">{{ doc.customer_name or '________________________________' }}</span>
            </div>
            <div class="info-field" style="margin-bottom: 8px;">
                <span class="info-label">Address:</span>
                <span class="info-value" style="min-width: 400px;">{{ doc.customer_address or '________________________________________' }}</span>
            </div>
            <div class="info-grid" style="margin-bottom: 0;">
                <div class="info-field">
                    <span class="info-label">Contact:</span>
                    <span class="info-value">{{ doc.contact_name or '________________' }}</span>
                </div>
                <div class="info-field">
                    <span class="info-label">Email:</span>
                    <span class="info-value">{{ doc.contact_email or '________________' }}</span>
                </div>
                <div class="info-field">
                    <span class="info-label">Phone:</span>
                    <span class="info-value">{{ doc.contact_phone or '________________' }}</span>
                </div>
            </div>
        </div>
        
        <div class="info-field">
            <span class="info-label">Equipment:</span>
            <span class="info-value" style="min-width: 400px;">{{ doc.equipment_description or '________________________________________' }}</span>
        </div>
        
        <div class="info-field" style="margin-top: 10px;">
            <span class="info-label">Driver Notes:</span><br>
            <div style="border: 1px solid #000; min-height: 40px; padding: 5px; margin-top: 5px;">
                {{ doc.driver_notes or '' }}
            </div>
        </div>
    </div>

    <div class="section red-line">
        <div class="section-title">RED LINE INSTRUCTIONS</div>
        <ul class="instructions-list">
            <li>Remove all asset tags/company identifiers from the equipment</li>
            <li>Weigh and record weight for COR. Company Name on COR should be <strong>{{ doc.customer_name or '________' }}</strong></li>
            <li>Load must be processed within 30 days of retrieval</li>
            <li>Forward the COR to David Huff upon completion of Job. David will upload the COR and report to the RecycleGX platform to complete process within 30 days.</li>
            <li>COR must include Job #<strong>{{ doc.job_number or '____' }}</strong></li>
            <li>Westech is charging $<strong>{{ doc.service_charge or '____' }}</strong> for this equipment. RGX will send payment to Westech when David Huff closes the job on the portal.</li>
        </ul>
    </div>

    <div class="section">
        <div class="section-title">Material Weight Log</div>
        <table>
            <thead>
                <tr>
                    <th style="width: 35%;">MATERIAL</th>
                    <th style="width: 15%;">% OF MATERIAL</th>
                    <th style="width: 15%;">WEIGHT</th>
                    <th style="width: 15%;">SIGN OFF</th>
                    <th style="width: 20%;">DATE</th>
                </tr>
            </thead>
            <tbody>
                {% for item in doc.items %}
                <tr>
                    <td>{{ item.material_type or '________________' }}</td>
                    <td>{{ item.percentage or '____%' }}</td>
                    <td>{{ item.weight or '____' }}</td>
                    <td>{{ item.sign_off or '____' }}</td>
                    <td>{{ item.date or '________' }}</td>
                </tr>
                {% else %}
                <tr><td colspan="5" style="height: 25px;"></td></tr>
                <tr><td colspan="5" style="height: 25px;"></td></tr>
                <tr><td colspan="5" style="height: 25px;"></td></tr>
                <tr><td colspan="5" style="height: 25px;"></td></tr>
                <tr><td colspan="5" style="height: 25px;"></td></tr>
                <tr><td colspan="5" style="height: 25px;"></td></tr>
                {% endfor %}
            </tbody>
        </table>
    </div>

    <div class="section">
        <div class="section-title">PC/Server Hard Drive Tracking</div>
        <table>
            <thead>
                <tr>
                    <th style="width: 20%;">Category</th>
                    <th style="width: 20%;">SCAN HARD DRIVES</th>
                    <th style="width: 20%;">LIST SENT?</th>
                    <th style="width: 20%;">SIGN OFF</th>
                    <th style="width: 20%;">DATE</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td><b># OF PCs</b></td>
                    <td>{{ doc.pc_hdd_count or '____' }}</td>
                    <td style="text-align:center;"><span class="checkbox"></span></td>
                    <td>____</td>
                    <td>________</td>
                </tr>
                <tr>
                    <td><b># OF SERVERS</b></td>
                    <td>{{ doc.server_hdd_count or '____' }}</td>
                    <td style="text-align:center;"><span class="checkbox"></span></td>
                    <td>____</td>
                    <td>________</td>
                </tr>
                <tr>
                    <td><b># OF HARD DRIVES</b></td>
                    <td>{{ doc.loose_hdd_count or '____' }}</td>
                    <td style="text-align:center;"><span class="checkbox"></span></td>
                    <td>____</td>
                    <td>________</td>
                </tr>
            </tbody>
        </table>
    </div>

    <div class="section">
        <div class="section-title">Laptop Hard Drive Tracking</div>
        <table>
            <thead>
                <tr>
                    <th style="width: 20%;">Category</th>
                    <th style="width: 20%;">SCAN HARD DRIVES</th>
                    <th style="width: 20%;">LIST SENT?</th>
                    <th style="width: 20%;">SIGN OFF</th>
                    <th style="width: 20%;">DATE</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td><b># OF LAPTOPS</b></td>
                    <td>{{ doc.laptop_count or '____' }}</td>
                    <td style="text-align:center;"><span class="checkbox"></span></td>
                    <td>____</td>
                    <td>________</td>
                </tr>
                <tr>
                    <td><b># OF HARD DRIVES</b></td>
                    <td>{{ doc.laptop_hdd_count or '____' }}</td>
                    <td style="text-align:center;"><span class="checkbox"></span></td>
                    <td>____</td>
                    <td>________</td>
                </tr>
            </tbody>
        </table>
    </div>

    <div class="footer">
        <strong>Westech Electronics</strong> | R2 Certified Recycling | RecycleGX Platform<br>
        Load: {{ doc.name }} | Printed: {{ doc.modified }} | Page 1 of 1<br>
        <em>Forward COR to: David Huff | Job #{{ doc.job_number or '____' }}</em>
    </div>
</body>
</html>
