Added Ack all Alerts and view alerts, you can now ack alerts now

This commit is contained in:
root 2019-04-19 15:44:25 -04:00
parent 8e9c694f2b
commit 37f99eb093
3 changed files with 43 additions and 17 deletions

View File

@ -15,8 +15,7 @@
<th>Date</th>
<th>Type</th>
<th>Alert</th>
<th>Ack</th>
<th class="text-center">Actions</th>
<th class="text-center">Ack</th>
</tr>
</thead>
<tbody>
@ -27,23 +26,19 @@
$alert_type = $row['alert_type'];
$alert_message = $row['alert_message'];
$alert_date = $row['alert_date'];
$alert_read = $row['alert_read'];
$alert_ack_date = $row['alert_ack_date'];
?>
<tr>
<tr class="row-danger">
<td><?php echo $alert_date; ?></td>
<td><?php echo $alert_type; ?></td>
<td><?php echo $alert_message; ?></td>
<td><?php echo $alert_read; ?></td>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="post.php?delete_alert=<?php echo $client_id; ?>">Delete</a>
</div>
</div>
<td class="text-center">
<?php if($alert_ack_date == 0){ ?>
<a class="btn btn-success btn-sm" href="post.php?alert_ack=<?php echo $alert_id; ?>"><i class="fa fa-check"></i></a>
<?php }else{ ?>
<?php echo $alert_ack_date; ?>
<?php } ?>
</td>
</tr>

View File

@ -347,6 +347,37 @@ if(isset($_GET['delete_category'])){
}
if(isset($_GET['alert_ack'])){
$alert_id = intval($_GET['alert_ack']);
mysqli_query($mysqli,"UPDATE alerts SET alert_ack_date = CURDATE() WHERE alert_id = $alert_id");
$_SESSION['alert_message'] = "Alert Acknowledged";
header("Location: alerts.php");
}
if(isset($_GET['ack_all_alerts'])){
$sql = mysqli_query($mysqli,"SELECT * FROM alerts ORDER BY alert_id DESC");
while($row = mysqli_fetch_array($sql)){
$alert_id = $row['alert_id'];
$alert_ack_date = $row['alert_ack_date'];
if($alert_ack_date = 0 ){
mysqli_query($mysqli,"UPDATE alerts SET alert_ack_date = CURDATE() WHERE alert_id = $alert_id");
}
}
$_SESSION['alert_message'] = "Alerts Acknowledged";
header("Location: alerts.php");
}
if(isset($_POST['add_expense'])){
$date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));

View File

@ -26,10 +26,10 @@
<span class="badge badge-danger">9+</span>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="alertsDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="alerts.php">New Alerts</a>
<a class="dropdown-item" href="alerts.php">Acknowledged</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
<a class="dropdown-item" href="post.php?ack_all_alerts">Acknowledge All</a>
</div>
</li>
<li class="nav-item dropdown no-arrow">