<?php include('includes/header.php'); ?>

<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-header">
                <h4>
                    Add Project
                    <a href="projects.php" class="btn btn-danger float-end">Back</a>
                </h4>
            </div>
            <div class="card-body">
                <?= alertMessage(); ?>
                <form action="code.php" method="POST">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="mb-3">
                                <label>Project Name</label>
                                <input type="text" name="projectName" class="form-control">
                            </div>
                        </div>

                        <div class="col-md-6">
                            <div class="mb-3">
                                <label>Client Name</label>
                                <select name = "clientID" class="form-control">
                                    <option value="">Select Client</option>
                                    <?php
                                    $sqlFetchClients = "SELECT clientID, clientName FROM clients";
                                    $result = mysqli_query($conn, $sqlFetchClients);
                                    while ($row = mysqli_fetch_assoc($result)) {
                                        $clientID = $row['clientID'];
                                        $clientName = $row['clientName'];
                                        echo "<option value='$clientID'>$clientName</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="mb-3">
                                <label>Contract Value</label>
                                <input type="text" name="contractValue" class="form-control">
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="mb-3">
                                <br>
                                <button type="submit" name="saveProject" class="btn btn-primary">Save</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>



<?php include('includes/footer.php'); ?>