Added delete quotes which also deletes all history of that quote added status to recurring under client, changed password view to from its own th button to just an icon

This commit is contained in:
root 2019-05-18 00:01:21 -04:00
parent 3dd1905176
commit 9b8f48794f
6 changed files with 45 additions and 11 deletions

View File

@ -16,7 +16,6 @@
<th>Make</th>
<th>Model</th>
<th>Serial</th>
<th></th>
<th class="text-center">Actions</th>
</tr>
</thead>
@ -74,15 +73,11 @@
?>
<tr>
<td><i class="fa fa-fw text-secondary fa-<?php echo $device_icon; ?> mr-3"></i><?php echo $asset_type; ?></td>
<td><?php echo $asset_name; ?></td>
<td><?php echo $asset_make; ?></td>
<td><?php echo $asset_model; ?></td>
<td><?php echo $asset_serial; ?></td>
<td>
<?php
if($asset_id == $asset_id_relation){
?>
<button type="button" class="btn btn-dark btn-sm" data-toggle="modal" data-target="#viewPasswordModal<?php echo $login_id; ?>"><i class="fas fa-key"></i></button>
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#viewPasswordModal<?php echo $login_id; ?>"><i class="fas fa-key text-dark"></i></button>
<div class="modal" id="viewPasswordModal<?php echo $login_id; ?>" tabindex="-1">
<div class="modal-dialog modal-sm">
@ -114,10 +109,15 @@
</div>
</div>
</div>
<?php echo $asset_name; ?>
<?php
}
?>
</td>
<td><?php echo $asset_make; ?></td>
<td><?php echo $asset_model; ?></td>
<td><?php echo $asset_serial; ?></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">

View File

@ -14,6 +14,7 @@
<th>Name</th>
<th>Address</th>
<th>Phone</th>
<th>Hours</th>
<th class="text-center">Actions</th>
</tr>
</thead>
@ -32,12 +33,16 @@
$location_phone = substr($row['location_phone'],0,3)."-".substr($row['location_phone'],3,3)."-".substr($row['location_phone'],6,4);
}
$location_hours = $row['location_hours'];
if(empty($location_hours)){
$location_hours = '-';
}
?>
<tr>
<td><?php echo "$location_name"; ?></td>
<td><a href="//maps.<?php echo $session_map_source; ?>.com?q=<?php echo "$location_address $location_zip"; ?>" target="_blank"><?php echo "$location_address"; ?></a></td>
<td><?php echo "$location_phone"; ?></td>
<td><a href="//maps.<?php echo $session_map_source; ?>.com?q=<?php echo "$location_address $location_zip"; ?>" target="_blank"><?php echo $location_address; ?></a></td>
<td><?php echo $location_phone; ?></td>
<td><?php echo $location_hours; ?></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">

View File

@ -1,8 +1,9 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM recurring, invoices
$sql = mysqli_query($mysqli,"SELECT * FROM recurring, invoices, categories
WHERE invoices.invoice_id = recurring.invoice_id
AND invoices.client_id = $client_id
AND invoices.category_id = categories.category_id
ORDER BY recurring.recurring_id DESC");
?>
@ -38,6 +39,8 @@
$recurring_last_sent = "-";
}
$recurring_next_date = $row['recurring_next_date'];
$category_id = $row['category_id'];
$category_name = $row['category_name'];
$invoice_id = $row['invoice_id'];
if($recurring_status == 1){
$status = "Active";
@ -54,6 +57,7 @@
<td><?php echo $recurring_start_date; ?></td>
<td><?php echo $recurring_last_sent; ?></td>
<td><?php echo $recurring_next_date; ?></td>
<td><?php echo $category_name; ?></td>
<td>
<span class="p-2 badge badge-<?php echo $status_badge_color; ?>">
<?php echo $status; ?>

View File

@ -4,7 +4,6 @@
//GET ALERTS
//DOMAINS EXPIRING
$domainAlertArray = [1, 14, 30, 90];

View File

@ -861,6 +861,31 @@ if(isset($_POST['edit_quote'])){
}
if(isset($_GET['delete_quote'])){
$quote_id = intval($_GET['delete_quote']);
mysqli_query($mysqli,"DELETE FROM quotes WHERE quote_id = $quote_id");
//Delete Items Associated with the Quote
$sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE quote_id = $quote_id");
while($row = mysqli_fetch_array($sql)){;
$item_id = $row['item_id'];
mysqli_query($mysqli,"DELETE FROM invoice_items WHERE item_id = $item_id");
}
//Delete History Associated with the Quote
$sql = mysqli_query($mysqli,"SELECT * FROM invoice_history WHERE quote_id = $quote_id");
while($row = mysqli_fetch_array($sql)){;
$invoice_history_id = $row['invoice_history_id'];
mysqli_query($mysqli,"DELETE FROM invoice_history WHERE invoice_history_id = $invoice_history_id");
}
$_SESSION['alert_message'] = "Quotes deleted";
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
if(isset($_POST['add_quote_copy'])){
$quote_id = intval($_POST['quote_id']);

View File

@ -22,8 +22,9 @@
<ul class="navbar-nav ml-auto ml-md-0">
<li class="nav-item dropdown no-arrow mx-2">
<a class="nav-link dropdown-toggle" href="#" id="alertsDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-bell mt-2"></i>
<?php if($num_alerts > 0){ ?> <span class="badge badge-danger"><?php echo $num_alerts; ?></span> <?php } ?>
<i class="fas fa-bell mt-2"></i>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="alertsDropdown">
<a class="dropdown-item" href="alerts.php">New Alerts</a>