<?php
/**
 * Reusable enquiry box for listing/company/deal detail pages.
 * Before include, set:
 * $mjSourceType = 'listing'|'company'|'deal'; $mjSourceId; $mjSourceTitle; $mjSellerUserId; optional $mjCountry.
 */
require_once __DIR__ . '/mj_v304_bootstrap.php';
$assetPrefix = (strpos($_SERVER['SCRIPT_NAME'] ?? '', '/admin/') !== false) ? '../' : '';
$mjSourceType = $mjSourceType ?? 'listing';
$mjSourceId = (int)($mjSourceId ?? 0);
$mjSourceTitle = (string)($mjSourceTitle ?? '');
$mjSellerUserId = (int)($mjSellerUserId ?? 0);
$mjCountry = (string)($mjCountry ?? '');
?>
<link rel="stylesheet" href="<?php echo $assetPrefix; ?>assets/css/mj-v304.css?v=304">
<div class="mj-card mj-detail-enquiry" id="send-enquiry">
  <h3>Send Enquiry</h3>
  <p class="mj-muted">Ask the seller about this <?php echo mjv304_e($mjSourceType); ?>. No customer-to-seller payment is collected on this platform.</p>
  <form method="post" action="<?php echo $assetPrefix; ?>ajax/mj-v304-create-lead.php" style="display:grid;gap:10px;">
    <input type="hidden" name="source_type" value="<?php echo mjv304_e($mjSourceType); ?>">
    <input type="hidden" name="source_id" value="<?php echo (int)$mjSourceId; ?>">
    <input type="hidden" name="source_title" value="<?php echo mjv304_e($mjSourceTitle); ?>">
    <input type="hidden" name="seller_user_id" value="<?php echo (int)$mjSellerUserId; ?>">
    <input type="hidden" name="country" value="<?php echo mjv304_e($mjCountry); ?>">
    <input name="customer_name" required placeholder="Your name" style="padding:11px;border:1px solid #e8edf5;border-radius:12px;">
    <input name="customer_phone" required placeholder="Phone / WhatsApp" style="padding:11px;border:1px solid #e8edf5;border-radius:12px;">
    <input type="email" name="customer_email" placeholder="Email optional" style="padding:11px;border:1px solid #e8edf5;border-radius:12px;">
    <textarea name="customer_message" rows="4" required placeholder="Message" style="padding:11px;border:1px solid #e8edf5;border-radius:12px;">Hi, I am interested in <?php echo mjv304_e($mjSourceTitle); ?>. Please contact me.</textarea>
    <button class="mj-btn mj-btn-primary" type="submit">Send Enquiry</button>
  </form>
  <div class="mj-note-box"><b>Safety note:</b> Contact/enquiry only. Any seller subscription, listing slot, sponsored, featured, renewal, wallet, or payment request is paid by seller/user to admin only.</div>
</div>
<div class="mj-mobile-enquiry-bar"><a class="mj-btn mj-btn-primary" style="flex:1" href="#send-enquiry">Send Enquiry</a></div>
