Order Tracking

<div class="order-redirect-container" style="max-width: 500px; margin: 50px auto; padding: 20px;">
  <p>Enter your order number below:</p>
  
  <input type="text" id="orderNumber" placeholder="e.g., 12345 or 5B12345 (please include '#')" style="width: 100%; padding: 12px; font-size: 16px; margin: 10px 0; border: 1px solid #ccc; border-radius: 4px;">
  
  <button onclick="redirectOrder()" style="width: 100%; padding: 12px; background: #000; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 16px;">
    Find Order
  </button>
  
  <div id="error" style="color: red; margin-top: 10px; display: none;">Invalid order number format</div>
</div>
<script>
function redirectOrder() {
  let orderNumber = document.getElementById('orderNumber').value.trim().toUpperCase();
  const error = document.getElementById('error');
  
  error.style.display = 'none';
  
  if (!orderNumber) {
    error.textContent = 'Please enter an order number';
    error.style.display = 'block';
    return;
  }
  
  // Remove "#" if it exists at the beginning
  if (orderNumber.startsWith('#')) {
    orderNumber = orderNumber.substring(1);
  }
  
  // Define your prefix rules and redirect URLs
  if (orderNumber.startsWith('1')) {
    window.location.href = 'https://bloomandbond.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('3B')) {
    window.location.href = 'https://thebondandblume.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('4B')) {
    window.location.href = 'https://thebloomingbond.co/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('5B')) {
    window.location.href = 'https://thebloomingbond.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('6B')) {
    window.location.href = 'https://getbloomingbond.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('7B')) {
    window.location.href = 'https://getbloomingbond.co/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('8B')) {
    window.location.href = 'https://trybloomingbond.co/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('2')) {
    window.location.href = 'https://bloomandbond.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('3')) {
    window.location.href = 'https://bloomandbond.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('4')) {
    window.location.href = 'https://bloomandbond.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('5')) {
    window.location.href = 'https://bloomandbond.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('6')) {
    window.location.href = 'https://bloomandbond.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('7')) {
    window.location.href = 'https://bloomandbond.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('8')) {
    window.location.href = 'https://bloomandbond.com/a/track?order=' + orderNumber;
  } else if (orderNumber.startsWith('9')) {
    window.location.href = 'https://bloomandbond.com/a/track?order=' + orderNumber;
  } else {
    error.textContent = 'Order number prefix not recognized';
    error.style.display = 'block';
  }
}
// Allow Enter key to submit
document.getElementById('orderNumber').addEventListener('keypress', function(e) {
  if (e.key === 'Enter') {
    redirectOrder();
  }
});
</script>