🐛 Tickets do not close

Signed-off-by: Luke Tainton <luke@tainton.uk>
This commit is contained in:
2020-08-09 22:10:12 +01:00
parent 6f48c86265
commit adb915bb03
3 changed files with 48 additions and 8 deletions

View File

@@ -10,8 +10,7 @@
if ($is_authorised == true) {
if($_SERVER['REQUEST_METHOD'] == 'POST') {
try {
// Process ticket data
$stmt = "UPDATE tickets SET status = 'Closed' WHERE uuid=:uuid";
$stmt = "UPDATE tickets SET status='Closed' WHERE uuid=:uuid";
$sql = $db->prepare($stmt);
$sql->bindParam(':uuid', $request['uuid']);
$sql->execute();

View File

@@ -14,6 +14,24 @@
<!-- Begin page content -->
<main role="main" class="flex-shrink-0">
<section>
<?php
if(isset($alert)) {
echo("
<div class='container'>
<div class='alert alert-" . $alert[0] . " alert-dismissible fade show' role='alert'>
" . $alert[1] . "
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>&times;</span>
</button>
</div>
</div>
");
unset($alert);
}
?>
</section>
<section class="jumbotron text-center">
<div class="container">
<h1>Welcome to <?php echo($_ENV['APP_NAME']); ?></h1>

View File

@@ -27,7 +27,7 @@
</div>
</div>
");
unset($new_ticket_alert);
unset($alert);
}
?>
</section>
@@ -50,12 +50,35 @@
<h1><?php echo($request['title']); ?></h1>
<p style="color: gray; font-style: italic;"><?php echo("#" . sprintf("%'.05d\n", $request["id"])); ?></p>
<p class="lead text-muted"><?php echo($request['description']); ?></p>
<p>
<a href='/update?rid=<?php echo($request["uuid"]); ?>' class='btn btn-primary my-2'>Update the request</a>
<a href='/upload?rid=<?php echo($request["uuid"]); ?>' class='btn btn-secondary my-2'>Add attachment(s)</a>
<a href='/actions/close?rid=<?php echo($request["uuid"]); ?>' class='btn btn-danger my-2'>Close the request</a>
</p>
<?php if ($request['status'] != 'Closed') { ?>
<p>
<a href='/update?rid=<?php echo($request["uuid"]); ?>' class='btn btn-primary my-2'>Update the request</a>
<a href='/upload?rid=<?php echo($request["uuid"]); ?>' class='btn btn-secondary my-2'>Add attachment(s)</a>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#closeModal">Close the request</button>
</p>
<?php } ?>
</div>
<div class="modal fade" id="closeModal" tabindex="-1" aria-labelledby="closeModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="closeModalLabel">Close the request?</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Are you sure you want to close request <b><?php echo($request['title']); ?></b>? This action is irreversible.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<a href='/actions/close?rid=<?php echo($request["uuid"]); ?>' class='btn btn-danger'>Close request</a>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="container-fluid">