Create new tickets #12

Merged
luketainton merged 34 commits from feature/issue-6 into main 2020-08-05 17:50:52 +00:00
5 changed files with 118 additions and 144 deletions
Showing only changes of commit b68f299021 - Show all commits

View File

@@ -8,6 +8,11 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#563d7c">
<?php
if (!is_logged_in()) {
echo("<meta http-equiv='refresh' content='0; url=" . $_ENV['APP_URL'] . "/login' />");
}
?>
<title><?php echo( $PAGE_TITLE ); ?></title>
<!-- Bootstrap core CSS -->

View File

@@ -3,7 +3,6 @@
require_once __DIR__ . "/../includes/prereqs.php";
require_once __DIR__ . "/../includes/header.php";
if (is_signed_in()) {
// Get user's own tickets
try {
$user_tickets_stmt = "SELECT uuid, id, title, description, status FROM tickets WHERE created_by=:uuid";
@@ -28,9 +27,6 @@
echo("Error: " . $e->getMessage());
}
$user_tickets_sub = 0; // Force 'no subbed tickets' msg until the code works
}
function get_sub_ticket($db, $ticket_uuid) {
try {
$stmt = "SELECT * FROM tickets WHERE uuid=:uuid";
@@ -77,21 +73,12 @@
is the one-stop shop for all of your IT-related needs. Let us know how we can help you by opening a request.
</p>
<p>
<?php
if (is_signed_in()) {
echo("
<a href='/new' class='btn btn-primary my-2'>Create a request</a>
<a href='/open' class='btn btn-secondary my-2'>View existing requests</a>
");
} else {
echo("<b>Please log in to create or view tickets.</b>");
}
?>
</p>
</div>
</section>
<?php if (is_signed_in()) { ?>
<section>
<div class="card mx-auto" style="width: 80%;">
<div class="card-header">
@@ -129,7 +116,6 @@
</div>
<ul class="list-group list-group-flush">
<?php
// if ($user_tickets_sub == 0) {
if (count($sub_tickets_result) == 0) {
echo("<center><b>No subscribed tickets</b></center>");
} else {
@@ -154,7 +140,6 @@
</ul>
</div>
</section>
<?php } ?>
</main>

View File

@@ -3,10 +3,6 @@
require_once __DIR__ . "/../includes/prereqs.php";
require_once __DIR__ . "/../includes/header.php";
if (!is_signed_in()) {
header('Location: /login');
}
// If form submitted, save to database
if($_SERVER['REQUEST_METHOD'] == 'POST') {
try {
@@ -69,7 +65,7 @@
<section>
<div class="card mx-auto" style="width: 50%;">
<form action="/new" method="post" enctype="multipart/form-data">
<form style="padding: 2%" action="/new" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="title">Title: </label>
<input type="text" class="form-control" id="title">

View File

@@ -2,10 +2,6 @@
$PAGE_NAME = "Open requests";
require_once __DIR__ . "/../includes/prereqs.php";
require_once __DIR__ . "/../includes/header.php";
if (!is_signed_in()) {
header('Location: /login');
}
?>

View File

@@ -3,7 +3,6 @@
require_once __DIR__ . "/../includes/prereqs.php";
require_once __DIR__ . "/../includes/header.php";
if (is_signed_in()) {
// Get ticket
try {
$ticket_stmt = "SELECT * FROM tickets WHERE uuid=:uuid";
@@ -39,7 +38,6 @@
} else {
$is_authorised = false;
}
}
?>
@@ -48,7 +46,7 @@
<!-- Begin page content -->
<main role="main" class="flex-shrink-0">
<?php if (is_signed_in() && $is_authorised == true) { ?>
<?php if ($is_authorised == true) { ?>
<section class="jumbotron text-center">
<div class="container">
<h1><?php echo($request['title']); ?></h1>
@@ -64,18 +62,12 @@
</p>
</div>
</section>
<?php } else if (is_signed_in() && $is_authorised == false) { ?>
<?php } else if ($is_authorised == false) { ?>
<section class="jumbotron text-center">
<div class="container">
<h1>You are not authorised to see this page.</h1>
</div>
</section>
<?php } else { ?>
<section class="jumbotron text-center">
<div class="container">
<h1>You need to be logged in to see this page.</h1>
</div>
</section>
<?php } ?>
</main>