<?php
include_once('head.php');
include_once('controllers/controllerReport.php');
?>
<!DOCTYPE html>
<html>

<body>
    <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="get">
        <div class="container">
            <div class="alert alert-warning alert-dismissible">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                <strong>Welcome!</strong>
            </div>
            <br>
            <h6>Select a date range to get your report</h6>
            <p></p>
            <div class="row">
            <div class="col-sm-3">
                <h6>Date Start: </h6>
                <input 
                    name="dateStart" 
                    type="date" 
                    class="form-control" 
                    required 
                    value="<?php echo isset($_GET['dateStart']) ? htmlspecialchars($_GET['dateStart']) : ''; ?>">
                <br>
                <h6>Date End: </h6>
                <input 
                    name="dateEnd" 
                    type="date" 
                    class="form-control" 
                    required 
                    value="<?php echo isset($_GET['dateEnd']) ? htmlspecialchars($_GET['dateEnd']) : ''; ?>">
            </div>
            <div class="col-sm-3">
                <h6>Time Start:</h6>
                <input 
                    name="timeStart" 
                    class="form-control" 
                    type="time" 
                    required 
                    value="<?php echo isset($_GET['timeStart']) ? htmlspecialchars($_GET['timeStart']) : ''; ?>">
                <br>
                <h6>Time End:</h6>
                <input 
                    name="timeEnd" 
                    class="form-control" 
                    type="time" 
                    required 
                    value="<?php echo isset($_GET['timeEnd']) ? htmlspecialchars($_GET['timeEnd']) : ''; ?>">
            </div>
                <div class="col-sm-3">
                    <h6>Select Report</h6>
                    <select name="reporte" id="reporte" class="form-control">
                        <option name="9" value="9"> Agents Performance Report </option>
                        <option name="20" value="20"> Agents Performance Detail Report </option>
                        <option name="24" value="24"> Agent Times Report </option>
                        <option name="25" value="25"> Agent Break Report </option>
                        <option name="26" value="26"> Average Attention Time Report </option>
                        <option name="11" value="11"> Overall SLA AHT Report </option>
                        <option name="27" value="27"> Operation Panel 2 Report </option>
                        <option name="28" value="28"> Operation Panel 2 Detail Report </option>
                        <optgroup label='Daily Statistics Reports:'>
                            <option name="21" value="21"> Daily Statistics </option>
                            <option name="22" value="22"> Answered Calls Average Waiting Time </option>
                            <option name="23" value="23"> Abandoned Calls Average Waiting Time </option>
                        </optgroup>
                        <optgroup label='Overall SLA Reports:'>
                            <option name="2" value="2"> Calls Answered </option>
                            <option name="2.1" value="2.1"> Calls Abandoned </option>
                            <option name="2.3" value="2.3"> Calls Answered < 60 Sec </option>
                            <option name="6" value="6"> Calls Offered </option>
                            <option name="3" value="3"> Calls Answered Detail </option>
                            <option name="4" value="4"> Calls Abandoned Detail </option>
                            <option name="7" value="7"> Calls Offered Detail </option>
                        </optgroup>
                        <optgroup label='Charts:'>
                            <option name="17" value="17"> Agents Performance Chart </option>
                            <option name="18" value="18"> Overall SLA AHT Chart </option>
                            <option name="19" value="19"> Overall SLA Chart </option>
                        </optgroup>
                    </select>
                    <br>
                    <h6>Select Service</h6>

                    <select name="service" id="service" class="form-control">
                        <option name="" value="All Services"> All Services </option>
                        <?php
                        $result = $mysqli->query($queryService);
                        while ($row = mysqli_fetch_array($result)) {
                            $serviceId = $row["Id"];
                            $serviceName = $row["Nombre"];
                        ?>
                            <option name="<?php echo $serviceName ?>" value="<?php echo $serviceName ?>"> <?php echo $serviceName ?> </option>
                        <?php
                        }
                        ?>
                    </select>
                </div>
                <br>
                <div class="col-sm-3">
                    <br>
                    <button type="submit" name="view" class="btn btn-success btn-block">View Report</button>
                    <br>
                    <h6></h6>
                    <button type="button" class="btn btn-info btn-block" onclick="window.location.href='<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>';">Clear Data</button>
                </div>
            </div>
        </div>
    </form>
    <?php include_once('foot.php'); ?>
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>

</html>