<?php
include_once "global.php";

$pageTitle = 'Add Event - ';
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">Events 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">Add Event</li>
            </ol>
        </nav>
    </div>
</div>
<!--end breadcrumb-->
<div class="card">
    <div class="card-body p-4">
        <h5 class="mb-4">My Events</h5>
        <form id="eventAddForm" class="row g-3" method="post">
            <div class="col-md-6">
                <label for="eventTitle" class="form-label">Title <span>*</span></label>
                <input type="text" name="eventTitle" id="eventTitle" class="form-control" required>
            </div>
            <div class="col-md-6">
                <label for="eventCategory" class="form-label">Category <span>*</span></label>
                <select name="eventCategory" id="eventCategory" class="form-select" required>
                    <option value="" disabled selected>Select...</option>
                    <option value="Event">Event</option>
                    <option value="Task">Task</option>
                    <option value="Reminder">Reminder</option>
                </select>
            </div>
            <div class="col-md-6">
                <label for="eventDueDate" class="form-label">Due Date <span>*</span></label>
                <input type="date" name="eventDueDate" id="eventDueDate" class="form-control" required>
            </div>
            <div class="col-md-6">
                <label for="eventClientId" class="form-label">Client <span>*</span></label>
                <select id="eventClientId" name="eventClientId" class="form-select" required>
                    <option value="" disabled selected>Select...</option>
                    <?php
                    $clients = $productClass->AllClientsArray();
                    foreach ($clients as $client) {
                        $clientId = $client["acc_id"];
                        $name = $client["acc_name"];
                        echo "<option value='$clientId'>$name</option>";
                    }
                    ?>
                </select>
            </div>
            <div class="col-md-6">
                <label for="eventAssignTo" class="form-label">Delegate Task <span>*</span></label>
                <select id="eventAssignTo" name="eventAssignTo" class="form-select" required>
                    <option value="" disabled selected>Select...</option>
                    <?php
                    $users = $productClass->getStaffArray();
                    foreach ($users as $user) {
                        $userId = $user["acc_id"];
                        $name = $user["acc_name"];
                        echo "<option value='$userId'>$name</option>";
                    }
                    ?>
                </select>
            </div>
            <div class="col-md-12">
                <label for="eventDetails" class="form-label">Detail <span>*</span></label>
                <textarea class="form-control" id="eventDetails" name="eventDetails" rows="3" required></textarea>
            </div>
            <div class="col-md-12">
                <button type="submit" class="btn btn-grd-primary px-4">Submit</button>
            </div>
        </form>
    </div>
</div>

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