Added badge count to client side nav, switched from js active nav to using php

This commit is contained in:
root 2019-05-10 18:04:03 -04:00
parent 5af085a40b
commit f9d6f4d316
9 changed files with 167 additions and 77 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules
uploads

View File

@ -18,7 +18,7 @@
$file_name = $row['file_name'];
?>
<div class="col-2 mb-3">
<div class=" col-xl-2 col-lg-3 col-md-6 col-sm-6 mb-3">
<?php echo $file_name; ?>
<a href="#" data-toggle="modal" data-target="#viewClientFileModal<?php echo $file_id; ?>">
<img class="img-fluid" src="<?php echo $file_name; ?>">

View File

@ -15,115 +15,207 @@
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "overview") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "overview") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=overview">
<i class="fas fa-fw fa-chart-bar mx-2"></i>
<span>Overview</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "contacts") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "contacts") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=contacts">
<i class="fas fa-fw fa-users mx-2"></i>
<span>Contacts</span>
<span>Contacts
<?php
if($num_contacts > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_contacts; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "locations") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "locations") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=locations">
<i class="fas fa-fw fa-map-marker mx-2"></i>
<span>Locations</span>
<span>Locations
<?php
if($num_locations > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_locations; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "assets") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "assets") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=assets">
<i class="fas fa-fw fa-tag mx-2"></i>
<span>Assets</span>
<span>Assets
<?php
if($num_assets > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_assets; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "vendors") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "vendors") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=vendors">
<i class="fas fa-fw fa-building mx-2"></i>
<span>Vendors</span></a>
<span>Vendors
<?php
if($num_vendors > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_vendors; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "logins") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "logins") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=logins">
<i class="fas fa-fw fa-key mx-2"></i>
<span>Logins</span>
<span>Logins
<?php
if($num_logins > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_logins; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "networks") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "networks") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=networks">
<i class="fas fa-fw fa-network-wired mx-2"></i>
<span>Networks</span>
<span>Networks
<?php
if($num_networks > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_networks; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "domains") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "domains") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=domains">
<i class="fas fa-fw fa-globe mx-2"></i>
<span>Domains</span>
<span>Domains
<?php
if($num_domains > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_domains; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "applications") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "applications") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=applications">
<i class="fas fa-fw fa-box mx-2"></i>
<span>Applications</span>
<span>Applications
<?php
if($num_applications > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_applications; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "invoices") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "invoices") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=invoices">
<i class="fas fa-fw fa-file mx-2"></i>
<span>Invoices</span>
<span>Invoices
<?php
if($num_invoices > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_invoices; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "recurring") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "recurring") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=recurring">
<i class="fas fa-fw fa-copy mx-2"></i>
<span>Recurring</span>
<span>Recurring
<?php
if($num_recurring > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_recurring; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "quotes") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "quotes") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=quotes">
<i class="fas fa-fw fa-file mx-2"></i>
<span>Quotes</span>
<span>Quotes
<?php
if($num_quotes > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_quotes; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "files") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "files") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=files">
<i class="fas fa-fw fa-paperclip mx-2"></i>
<span>Files</span>
<span>Files
<?php
if($num_files > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_files; ?></small>
<?php
}
?>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link <?php if($_GET['tab'] == "notes") { echo "active"; } ?>"
<li class="nav-item <?php if($_GET['tab'] == "notes") { echo "active"; } ?>">
<a class="nav-link"
href="?client_id=<?php echo $client_id; ?>&tab=notes">
<i class="fas fa-fw fa-edit mx-2"></i>
<span>Notes</span>
<span>Notes
<?php
if($num_notes > 0){ ?>
<small class="float-right badge-secondary badge-pill mt-1"><?php echo $num_notes; ?></small>
<?php
}
?>
</span>
</a>
</li>
</ul>

View File

@ -10,7 +10,7 @@
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover" id="dataTable" width="100%" cellspacing="0">
<table class="table table-striped table-borderless table-hover" id="dT" width="100%" cellspacing="0">
<thead class="thead-dark">
<tr>
<th>Name</th>

View File

@ -12,40 +12,42 @@
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>" >
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" name="name" value="<?php echo "$client_name"; ?>" required>
<input type="text" class="form-control" name="name" value="<?php echo $client_name; ?>" required>
</div>
<div class="form-group">
<label>Phone</label>
<input type="text" class="form-control" name="phone" data-inputmask="'mask': '999-999-9999'" value="<?php echo "$client_phone"; ?>" required>
<input type="text" class="form-control" name="phone" data-inputmask="'mask': '999-999-9999'" value="<?php echo $client_phone; ?>" required>
</div>
<div class="form-group">
<label>Email</label>
<input type="email" class="form-control" name="email" value="<?php echo "$client_email"; ?>" required>
<input type="email" class="form-control" name="email" value="<?php echo $client_email; ?>" required>
</div>
<div class="form-group">
<label>Website</label>
<input type="text" class="form-control" name="website" value="<?php echo "$client_website"; ?>">
<input type="text" class="form-control" name="website" value="<?php echo $client_website; ?>">
</div>
<div class="form-group">
<label>Address</label>
<input type="text" class="form-control" name="address" value="<?php echo "$client_address"; ?>" required>
<input type="text" class="form-control" name="address" value="<?php echo $client_address; ?>" required>
</div>
<div class="form-group">
<label>City</label>
<input type="text" class="form-control" name="city" value="<?php echo "$client_city"; ?>" required>
<input type="text" class="form-control" name="city" value="<?php echo $client_city; ?>" required>
</div>
<div class="form-group">
<label>State</label>
<select class="form-control" name="state" required>
<option value="">Select a state...</option>
<?php foreach($states_array as $state_abbr => $state_name) { ?>
<?php
foreach($states_array as $state_abbr => $state_name){
?>
<option <?php if($client_state == $state_abbr) { echo "selected"; } ?> value="<?php echo $state_abbr; ?>"><?php echo $state_name; ?></option>
<?php } ?>
</select>
</div>
<div class="form-group">
<label>Zip</label>
<input type="text" class="form-control" name="zip" value="<?php echo "$client_zip"; ?>" required>
<input type="text" class="form-control" name="zip" value="<?php echo $client_zip; ?>" required>
</div>
</div>
<div class="modal-footer">

View File

@ -42,7 +42,7 @@
<div id="wrapper">
<?php
if(basename(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH)) == "client.php"){
if(basename(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH)) == "client.php" or basename(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH)) == "client_print.php"){
include("client_side_nav.php");
}else{
include("side_nav.php");

View File

@ -1,4 +1,4 @@
//Prevents resubmit on refresh or back
//Prevents resubmit on forms
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
@ -42,13 +42,6 @@ $('#dT').dataTable( {
});
// Highlight the active nav link on side nav
$(function() {
var url = window.location.pathname;
var filename = url.substr(url.lastIndexOf('/') + 1);
$('.navbar-nav a[href$="' + filename + '"]').parent().addClass("active");
});
new EasyMDE({
autoDownloadFontAwesome: false,
element: document.getElementById('addClientNote')

View File

@ -1030,7 +1030,7 @@ if(isset($_POST['add_payment'])){
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = "Thank You! - Partial Payment Recieved for Invoice INV-$invoice_number";
$mail->Body = "Hello $client_name,<br><br>We have recieved your payment of $amount on $date for invoice INV-$invoice_number by $payment_method, although you still have a balance of $balance<br><br>If you have any questions please contact us at the number below.<br><br>~<br>$config_company_name<br>Automated Billing Department<br>$config_company_phone";
$mail->Body = "Hello $client_name,<br><br>We have recieved your payment of $amount on $date for invoice INV-$invoice_number by $payment_method, although you still have a balance of $invoice_balance<br><br>If you have any questions please contact us at the number below.<br><br>~<br>$config_company_name<br>Automated Billing Department<br>$config_company_phone";
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();

View File

@ -3,76 +3,78 @@
<li class="nav-item">
<h2 class="text-white text-center my-3"><?php echo $config_company_name; ?></h2>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "dashboard.php") { echo "active"; } ?>">
<a class="nav-link" href="dashboard.php">
<i class="fas fa-fw fa-tachometer-alt mx-2"></i>
<span>Dashboard</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "clients.php") { echo "active"; } ?>">
<a class="nav-link" href="clients.php">
<i class="fas fa-fw fa-users mx-2"></i>
<span>Clients</span></a>
<span>Clients</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "calendar_events.php") { echo "active"; } ?>">
<a class="nav-link" href="calendar_events.php">
<i class="fas fa-fw fa-calendar mx-2"></i>
<span>Calendar</span></a>
<span>Calendar</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "products.php") { echo "active"; } ?>">
<a class="nav-link" href="products.php">
<i class="fas fa-fw fa-box mx-2"></i>
<span>Products</span></a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "vendors.php") { echo "active"; } ?>">
<a class="nav-link" href="vendors.php">
<i class="fas fa-fw fa-building mx-2"></i>
<span>Vendors</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "invoices.php") { echo "active"; } ?>">
<a class="nav-link" href="invoices.php">
<i class="fas fa-fw fa-file-invoice-dollar mx-2"></i>
<span>Invoices</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "quotes.php") { echo "active"; } ?>">
<a class="nav-link" href="quotes.php">
<i class="fas fa-fw fa-file-invoice mx-2"></i>
<span>Quotes</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "expenses.php") { echo "active"; } ?>">
<a class="nav-link" href="expenses.php">
<i class="fas fa-fw fa-shopping-cart mx-2"></i>
<span>Expenses</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "payments.php") { echo "active"; } ?>">
<a class="nav-link" href="payments.php">
<i class="fas fa-fw fa-credit-card mx-2"></i>
<span>Payments</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "recurring.php") { echo "active"; } ?>">
<a class="nav-link" href="recurring.php">
<i class="fas fa-fw fa-copy mx-2"></i>
<span>Recurring</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "accounts.php") { echo "active"; } ?>">
<a class="nav-link" href="accounts.php">
<i class="fas fa-fw fa-piggy-bank mx-2"></i>
<span>Accounts</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "transfers.php") { echo "active"; } ?>">
<a class="nav-link" href="transfers.php">
<i class="fas fa-fw fa-exchange-alt mx-2"></i>
<span>Transfers</span>
</a>
</li>
<li class="nav-item">
<li class="nav-item <?php if(basename($_SERVER["REQUEST_URI"]) == "mileage.php") { echo "active"; } ?>">
<a class="nav-link" href="mileage.php">
<i class="fas fa-fw fa-car mx-2"></i>
<span>Mileage</span>