<?php
/**
 * ADMIN NEW ITEM SUBMISSION NOTIFICATION EMAIL TEMPLATE
 * File: templates/email/item-new-submission.php
 *
 * Variables available via Mailer::getTemplate() extract():
 *   $item_id        - item ID
 *   $item_title     - item title
 *   $category_name  - category name
 *   $price_per_day  - daily rental price
 *   $vendor_name    - vendor business name
 *   $vendor_email   - vendor email address
 *   $submitted_at   - submission datetime
 *   $app_name       - platform name (APP_NAME)
 *   $app_url        - platform URL  (APP_URL)
 */

ob_start();
?>

<div class="alert alert-info">
    <strong>📦 A vendor has submitted a new item listing for your review.</strong><br>
    Please log in to the admin panel to approve or reject it.
</div>

<div class="order-summary">
    <h3>Submission Details</h3>
    <p><strong>Item Title:</strong> <?= htmlspecialchars($item_title) ?></p>
    <p><strong>Category:</strong> <?= htmlspecialchars($category_name ?? 'N/A') ?></p>
    <p><strong>Price Per Day:</strong> ₦<?= number_format((float)($price_per_day ?? 0), 2) ?></p>
    <p><strong>Submitted By:</strong> <?= htmlspecialchars($vendor_name) ?> (<?= htmlspecialchars($vendor_email) ?>)</p>
    <p><strong>Submitted At:</strong> <?= htmlspecialchars($submitted_at ?? date('Y-m-d H:i:s')) ?></p>
</div>

<div class="alert alert-warning">
    <strong>⚠ Action Required</strong><br>
    This item is currently <strong>pending</strong>. The vendor is awaiting your decision.
    Please review the full listing including images, description, and pricing before approving.
</div>

<p>Click the button below to review the item in the admin panel.</p>

<?php
$content = ob_get_clean();

$email_data = [
    'title'                 => 'New Item Submitted for Review',
    'greeting'              => 'Hello Admin,',
    'content'               => $content,
    'action_url'            => APP_URL . '/admin/item-details.php?id=' . (int)$item_id,
    'action_text'           => 'Review This Item',
    'secondary_action_url'  => APP_URL . '/admin/items.php?status=pending',
    'secondary_action_text' => 'View All Pending Items',
    'footer_note'           => 'This is an automated notification from ' . APP_NAME . '.',
    'signature'             => "The " . APP_NAME . " System",
];

extract($email_data);
include 'layout.php';
?>