<?php
// control.php
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sales Report Filter</title>
<style>
  
    /* Main Content */
    .main-content {
        flex: 1;
        padding: 40px;
    }

    h1 {
        margin-bottom: 30px;
        color: #2c3e50;
        text-align: center;
    }

    form {
        background: #fff;
        padding: 30px;
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        max-width: 600px;
        margin: 0 auto;
    }

    form label {
        display: block;
        margin-bottom: 8px;
        font-weight: bold;
        color: #34495e;
    }

    form select, form input[type="date"] {
        width: 100%;
        padding: 10px 15px;
        margin-bottom: 20px;
        border-radius: 6px;
        border: 1px solid #ccc;
        font-size: 15px;
    }

    form button {
        background: #3498db;
        color: #fff;
        border: none;
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 6px;
        cursor: pointer;
        transition: 0.3s;
        width: 100%;
    }

    form button:hover {
        background: #2980b9;
    }

    #customDates {
        display: none;
    }

    /* Responsive */
    @media(max-width: 768px){
        body {
            flex-direction: column;
        }
        .main-content {
            padding: 20px;
        }
        form {
            width: 100%;
            padding: 20px;
        }
    }
</style>
</head>
<body>

<?php include 'sidebar.php'; ?>


<div class="main-content">
    <h1>Generate Sales Report</h1>

   <form action="business_report.php" method="get" target="_blank">
    <label for="preset">Preset Range:</label>
    <select name="preset" id="preset" onchange="toggleCustom(this.value)">
        <option value="">Select</option>
        <option value="7">Last 7 Days</option>
        <option value="15">Last 15 Days</option>
        <option value="30">Last 1 Month</option>
        <option value="365">Last 1 Year</option>
        <option value="custom">Custom Range</option>
    </select>

    <div id="customDates">
        <label for="start_date">Start Date:</label>
        <input type="date" name="start_date" id="start_date">

        <label for="end_date">End Date:</label>
        <input type="date" name="end_date" id="end_date">
    </div>

    <button type="submit">Generate PDF</button>
</form>
</div>

<div class="recent-sales mt-5">
            <?php
                  include 'footer.php';
            ?>
        </div>


<script>
function toggleCustom(value){
    document.getElementById('customDates').style.display = (value === 'custom') ? 'block' : 'none';
}
</script>


</body>
</html>