<?php
/**
 * VENDOR ORDER COMPLETION EMAIL TEMPLATE
 * File: templates/email/order-completion-vendor.php
 */

// Email content
ob_start();
?>

<div class="alert alert-success">
    <strong>Order Completed!</strong><br>
    An order has been successfully completed and your earnings have been released to your wallet.
</div>

<div class="order-summary">
    <h3>Order Details</h3>
    <p><strong>Order Number:</strong> #<?= $order_number ?></p>
    <p><strong>Item:</strong> <?= htmlspecialchars($item_title) ?></p>
    <p><strong>Customer:</strong> <?= htmlspecialchars($customer_name) ?></p>
    <p><strong>Status:</strong> <span style="color: #28a745; font-weight: bold;">Completed</span></p>
</div>

<table class="table">
    <tr>
        <th colspan="2" style="background: #f8f9fa;">Earnings Released</th>
    </tr>
    <tr style="font-weight: bold; font-size: 16px;">
        <td>Your Earnings</td>
        <td style="text-align: right; color: #28a745;">₦<?= number_format($earnings, 2) ?></td>
    </tr>
</table>

<div class="alert alert-success">
    <strong>Funds Available!</strong><br>
    Your earnings of <strong>₦<?= number_format($earnings, 2) ?></strong> have been released to your wallet and are now available for:
    <ul style="margin: 10px 0 0 20px;">
        <li>Withdrawal to your bank account</li>
        <li>Viewing in your vendor dashboard</li>
        <li>Tracking in your transaction history</li>
    </ul>
</div>

<div class="alert alert-info">
    <strong>What's Next?</strong>
    <ul style="margin: 10px 0 0 20px;">
        <li>Check your wallet balance in your vendor dashboard</li>
        <li>Withdraw funds to your bank account anytime</li>
        <li>Continue listing more items to increase your earnings</li>
        <li>Review your performance statistics</li>
    </ul>
</div>

<div class="alert alert-warning">
    <strong>Keep Growing Your Business:</strong>
    <ul style="margin: 10px 0 0 20px;">
        <li>Update your item inventory regularly</li>
        <li>Respond quickly to customer inquiries</li>
        <li>Maintain high service quality for better ratings</li>
        <li>Offer competitive pricing to attract more bookings</li>
    </ul>
</div>

<p>Thank you for being a valued vendor on <?= APP_NAME ?>! Keep up the great work!</p>

<?php
$content = ob_get_clean();

// Prepare email data
$email_data = [
    'title' => 'Order Completed - #' . $order_number,
    'greeting' => "Hello {$vendor_name}!",
    'content' => $content,
    'action_url' => APP_URL . '/vendor/wallet.php',
    'action_text' => 'View Wallet',
    'secondary_action_url' => APP_URL . '/vendor/orders.php',
    'secondary_action_text' => 'View Orders',
    'footer_note' => 'Keep providing excellent service!',
    'signature' => "Best regards,<br>The " . APP_NAME . " Team<br>support@rentidium.com"
];

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