From a030df68ad684ad42154cf3a90311de4f749f72d Mon Sep 17 00:00:00 2001 From: RiFav <13521075@std.stei.itb.ac.id> Date: Sat, 7 Oct 2023 22:44:07 +0700 Subject: [PATCH] feat: add button to create & update event --- app/Views/home/home.php | 7 ++++++- app/Views/template/event.php | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Views/home/home.php b/app/Views/home/home.php index 5d6168c..ebfc812 100644 --- a/app/Views/home/home.php +++ b/app/Views/home/home.php @@ -34,7 +34,7 @@ <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>CRUD Test</title> + <title>HOME • TICKET KU</title> <link rel="stylesheet" type="text/css" href="/../../styles/global.css"> <link rel="stylesheet" type="text/css" href="/../../styles/form.css"> <link rel="stylesheet" type="text/css" href="/../../styles/footer.css"> @@ -50,6 +50,7 @@ <div class="main-content"> <div class="column"> + <button onclick="openCreateEventPage()" id="createEventBtn" class="admin">Create Event</button> <div class="row"> <input type="text" placeholder="Search.." value="<?= htmlspecialchars($searchQuery)?>" style="width:250%;"> <?php if (!empty($searchQuery) || !empty($minStock) || !empty($sortKey)) : ?> @@ -82,6 +83,10 @@ const navbar = document.querySelector('.navbar ul'); navbar.classList.toggle('show'); } + + function openCreateEventPage() { + window.location.href = "/app/Views/event/create.php"; + } </script> <script src="js/script.js"></script> </body> diff --git a/app/Views/template/event.php b/app/Views/template/event.php index 2c30aec..09bb8f9 100644 --- a/app/Views/template/event.php +++ b/app/Views/template/event.php @@ -12,6 +12,10 @@ <input type="hidden" name="eventId" value="<?php echo $event['event_id']; ?>"> <button type="submit" id="buyTicket">Buy Ticket</button> </form> + <form id="viewEventForm" method="get" action="../event/update.php"> + <input type="hidden" name="id" value="<?php echo $event['event_id']; ?>"> + <button type="submit" id="updateEvent">Update Event</button> + </form> </div> <!-- <a href="#">Buy Tickets</a> --> </div> \ No newline at end of file -- GitLab