<?php $page = "Event"; $action="edit"; ?>
<?php include "../../routes/event.php"; ?>
<?php include "../layout/header.php"; ?>
<body>

    <?php include "../layout/navbar.php"; ?>

    <div class="container-fluid">
      <div class="row">
        <?php include "../layout/sidenav.php"; ?>
        
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
            <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                <h1 class="h2">Edit <?php echo $page; ?></h1>
            </div>
            <form action="" method="POST" autocomplete="off" enctype="multipart/form-data">
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text" id="title">Title</span>
                    </div>
                    <input type="text" name="title" value="<?php echo $event->title; ?>" class="form-control" placeholder="Write the title here" aria-label="Title" aria-describedby="title" required>
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text" id="date">Date</span>
                    </div>
                    <input type="date" name="date" value="<?php echo $event->date; ?>" class="form-control" required>
                    <div class="input-group-prepend ml-3">
                        <span class="input-group-text" id="title">Time</span>
                    </div>
                    <input type="time" name="time" value="<?php echo $event->time; ?>" class="form-control"required>
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text" id="venue">Venue</span>
                    </div>
                    <input type="text" name="venue" value="<?php echo $event->venue; ?>" class="form-control" required>
                    <div class="custom-file ml-3">
                        <input type="hidden" name="oldImage" value="<?php echo $event->thumbnail; ?>">                                
                        <input type="file" name="fileToUpload" class="custom-file-input" id="thumbnail" aria-describedby="thumbnail">
                        <label class="custom-file-label" for="thumbnail">Choose thumbnail</label>
                    </div>    
                </div>
                <div class="input-group mb-3 justify-content-center">
                    <div class="col-6" id="displayThumbnail"> 
                        <img src="../assets/images/<?php echo $image->filename;?>" class="img-fluid">
                    </div>
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text" id="url">Form URL</span>
                    </div>
                    <input type="text" name="url" value="<?php echo $event->url; ?>" class="form-control" required>
                    <div class="input-group-prepend ml-3">
                        <span class="input-group-text" id="url_text">Form Button Name</span>
                    </div>
                    <input type="text" name="url_text" value="<?php echo $event->url_text; ?>" class="form-control"required>
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text" id="fee">Fee</span>
                    </div>
                    <input type="number" name="fee" value="<?php echo $event->fee; ?>" class="form-control" required>
                </div>
                <div class="input-group mb-3">
                    <textarea name="description" class="form-control editor-main" placeholder="Write description here"><?php echo $event->description; ?></textarea>
                </div>
                <div class="input-group mb-3">
                    <input type="submit" class="btn btn-sm btn-primary wln-text-white" name="edit" value="Edit">
                </div>
            </form>
        </main>

      </div>
    </div>
</body>
</html>