<?php
include_once "global.php";

$pageTitle = "User Report - ";
include_once 'header.php';
?>

<!--breadcrumb-->
<div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
    <div class="breadcrumb-title pe-3">User Management</div>
    <div class="ps-3">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb mb-0 p-0">
                <li class="breadcrumb-item"><a href="javascript:;"></a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">User Report</li>
            </ol>
        </nav>
    </div>
</div>
<!--end breadcrumb-->
<div class="row">
    <div class="col-xl-12">
        <h6 class="mb-0 text-uppercase">User Report</h6>
        <hr>
        <div class="card">
            <div class="card-body p-4">
                <h5 class="mb-4"></h5>
                <form id="userReportForm" class="row g-3" method="post">
                    <div class="col-md-6">
                        <label for="fromdate" class="form-label">From <span>*</span></label>
                        <input type="date" class="form-control" id="fromdate" name="fromdate">
                    </div>
                    <div class="col-md-6">
                        <label for="todate" class="form-label">To <span>*</span></label>
                        <input type="date" class="form-control" id="todate" name="todate">
                    </div>
                    <?php if ($webUserType === 1 || $webUserType === 2) { ?>
                        <div class="col-md-6">
                            <label for="userId" class="form-label">User <span>*</span></label>
                            <select id="userId" name="userId" class="form-select" required>
                                <option value="" disabled selected>Select...</option>
                                <?php
                                $users = $productClass->AllEmployeesAndManagersArray();
                                foreach ($users as $user) {
                                    $userId = $user["acc_id"];
                                    $name = $user["acc_name"];
                                    echo "<option value='$userId'>$name</option>";
                                }
                                ?>
                            </select>
                        </div>
                    <?php } else { ?>
                        <input type="hidden" name="userId" value="<?php echo $_SESSION["webUser"]["id"]; ?>">
                    <?php } ?>
                    <div class="col-md-12">
                        <button type="submit" class="btn btn-grd-primary px-4">Get Results</button>
                    </div>
                </form>
            </div>
        </div>
        <div id="userReportResults" class="mt-4"></div>
    </div>
</div>

<?php
include_once 'footer.php';
?>