<?php
/**
 * ADMIN DISPUTE NOTIFICATION EMAIL TEMPLATE
 * File: templates/email/dispute-admin-notification.php
 * Uses layout.php wrapper
 */

// Build email content
ob_start();
?>

<div class="alert alert-danger">
    <strong>🚨 DISPUTE REQUIRES REVIEW</strong><br>
    A new dispute has been filed and requires administrative attention.
</div>

<div class="order-summary">
    <h3>Dispute Summary</h3>
    
    <table style="width: 100%; border-collapse: collapse;">
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef; width: 35%;"><strong>Dispute Number:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><?= htmlspecialchars($dispute_number) ?></td>
        </tr>
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><strong>Reported By:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><?= htmlspecialchars($reporter_name) ?> (<?= ucfirst($reporter_type) ?>)</td>
        </tr>
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><strong>Order Number:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;">#<?= htmlspecialchars($order_number) ?></td>
        </tr>
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><strong>Item:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><?= htmlspecialchars($item_title) ?></td>
        </tr>
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><strong>Customer:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><?= htmlspecialchars($customer_name) ?></td>
        </tr>
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><strong>Vendor:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><?= htmlspecialchars($vendor_name) ?></td>
        </tr>
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><strong>Issue Type:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><?= htmlspecialchars($issue_type) ?></td>
        </tr>
        <tr>
            <td style="padding: 8px 0; vertical-align: top;"><strong>Description:</strong></td>
            <td style="padding: 8px 0;"><?= nl2br(htmlspecialchars($description)) ?></td>
        </tr>
        <?php if (isset($amount_involved) && $amount_involved > 0): ?>
        <tr>
            <td style="padding: 8px 0;"><strong>Amount Claimed:</strong></td>
            <td style="padding: 8px 0;"><strong style="color: #dc3545;">₦<?= number_format($amount_involved, 2) ?></strong></td>
        </tr>
        <?php endif; ?>
    </table>
</div>

<div class="alert alert-warning">
    <strong>Required Actions:</strong>
    <ol style="margin: 10px 0 0 20px; padding-left: 0;">
        <li>Review all evidence and statements from both parties</li>
        <li>Assess the validity of the claim</li>
        <li>Contact parties if additional information is needed</li>
        <li>Mediate between customer and vendor if possible</li>
        <li>Make a fair decision within 5-10 business days</li>
    </ol>
</div>

<div class="alert alert-info">
    <strong>⏰ Action Timeline:</strong><br>
    Platform policy requires disputes to be reviewed within 48 hours and resolved within 5-10 business days.
</div>

<?php
$content = ob_get_clean();

// Prepare email data for layout
$email_data = [
    'title' => '🚨 NEW DISPUTE ALERT - ' . $dispute_number,
    'greeting' => "Dear Admin,",
    'alert_type' => 'danger',
    'alert_message' => '<strong>⚠️ REQUIRES ATTENTION:</strong> A new dispute has been reported on the platform.',
    'content' => $content,
    'action_url' => $admin_url,
    'action_text' => 'Review Dispute in Admin Panel',
    'footer_note' => 'This is an automated admin notification. Please take action as soon as possible.',
    'signature' => "Rentidium Admin Notification System<br>disputes@rentidium.ng"
];

// Include layout
include 'layout.php';
?>