<?php include_once('header.php'); ?>
<?php
$project_id = '';
if (isset($_GET['id'])) {
    $project_id = $_GET['id'];
}

$project = $con->getRows('projects', array('where' => 'project_id="' . $project_id . '"', 'return_type' => 'single'));

?>

<div class="container">
    <div class="card-deck mb-3 text-center">
        <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mt-3 mb-3 border-bottom" style="width: 100%;">
            <h1 class="h2">Update Project</h1>
            <div class="btn-toolbar mb-2 mb-md-0">
                <div class="btn-group mr-2">
                    <a class="btn btn-sm btn-outline-secondary" href="projects.php" id="">View Projects</a>
                    <a class="btn btn-sm btn-outline-secondary" href="create-project.php" id="">Add New Projects</a>
                </div>
            </div>
        </div>

        <div id="error"></div>

        <!-- new vacancy section -->
        <div id="new-vacancy" style="width: 100%">
            <div class="d-flex justify-content-between flex-wrap flex-md-nowrap  pb-2 mb-3 border-bottom" style="width: 100%; text-align: left;">
                <div class="col-md-12 order-md-2">
                    <?php include_once('sql_statements.php');  ?>
                    <form class="needs-validation" id="" method="post" enctype="multipart/form-data">


                        <input type="hidden" name="update_project">
                        <input type="hidden" name="id" value="<?= $project_id ?>" ?>
                        <div class="row">

                            <div class="col-md-3 mb-3">
                                <label for="Password">Update Project Status</label>
                                <select class="form-control" name="status">
                                    <option value="">Select Status</option>
                                    <option value="0" <?php if($project['active'] == 0){echo "selected";} ?>>Ongoing</option>
                                    <option value="1" <?php if($project['active'] == 1){echo "selected";} ?>>Completed</option>
                                </select>

                            </div>
                            <div class="col-md-9 mb-3">
                                <label for="Password">Project Title</label>
                                <input type="text" class="form-control" id="" name="title" value="<?= $project['title'] ?>">

                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-12 mb-3">
                                <label for="Password">Project Details</label><br>
                                <textarea class="form-control" name="details" id="textbox" rows="9"><?= $project['details'] ?></textarea>
                            </div>
                        </div>

                        <button class="btn btn-primary btn-md" type="reset" name="reset" id="reset" style="float: right;">
                            Clear Form
                        </button>
                        <button class="btn btn-primary btn-md" type="submit" name="update_project" id="create_blog" style="float: right; margin-right: 5px;">
                            Save Project
                        </button>

                    </form>
                </div>
            </div>

        </div>
        <!-- end new user form -->


    </div>

</div>


<!-- Bootstrap core JavaScript
    ================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script>
    window.jQuery || document.write('<script src="../../js/vendor/jquery-slim.min.js"><\/script>')
</script>
<script src="../../js/vendor/popper.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/vendor/holder.min.js"></script>
<script type="text/javascript" src="../../js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../../js/validation.min.js"></script>
<script src="../../js/tables/jquery.dataTables.js"></script>
<script src="../../js/tables/dataTables.bootstrap4.js"></script>

<!--  summernote JS
        ============================================ -->
<script src="../../js/summernote/summernote-updated.min.js"></script>
<script src="../../js/summernote/summernote-active.js"></script>

</body>

</html>