mirror of https://github.com/itflow-org/itflow
Moved the client Nav to the sidebar to free up space, fixed balance showing red under client even though it was 0
This commit is contained in:
parent
fa12d23b2f
commit
eecdb18a06
10
client.php
10
client.php
|
|
@ -1,4 +1,4 @@
|
|||
<?php include("header.php"); ?>
|
||||
<?php include("config.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
|
|
@ -74,6 +74,8 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
?>
|
||||
|
||||
<?php include("header.php"); ?>
|
||||
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="clients.php">Clients</a>
|
||||
|
|
@ -97,11 +99,11 @@ if(isset($_GET['client_id'])){
|
|||
</div>
|
||||
<div class="col border-right">
|
||||
<h4 class="text-secondary">Contact</h4>
|
||||
<i class="fa fa-envelope mx-1"></i> <a href="mailto:<?php echo $client_email; ?>"><?php echo $client_email; ?></a>
|
||||
<i class="fa fa-fw fa-envelope mx-1"></i> <a href="mailto:<?php echo $client_email; ?>"><?php echo $client_email; ?></a>
|
||||
<br>
|
||||
<i class="fa fa-phone mx-1"></i> <?php echo $client_phone; ?>
|
||||
<i class="fa fa-fw fa-phone mx-1"></i> <?php echo $client_phone; ?>
|
||||
<br>
|
||||
<i class="fa fa-globe mx-1"></i> <a target="_blank" href="//<?php echo $client_website; ?>"><?php echo $client_website; ?></a>
|
||||
<i class="fa fa-fw fa-globe mx-1"></i> <a target="_blank" href="//<?php echo $client_website; ?>"><?php echo $client_website; ?></a>
|
||||
</div>
|
||||
<div class="col border-right">
|
||||
<h4 class="text-secondary">Standings</h4>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,114 @@
|
|||
<!-- Sidebar -->
|
||||
|
||||
<ul class="sidebar navbar-nav d-print-none">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="clients.php">
|
||||
<i class="fas fa-fw fa-arrow-left mx-2"></i>
|
||||
<span>Back</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "contacts") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=contacts">
|
||||
<i class="fas fa-fw fa-users mx-2"></i>
|
||||
<span>Contacts</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "locations") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=locations">
|
||||
<i class="fas fa-fw fa-map-marker mx-2"></i>
|
||||
<span>Locations</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "assets") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=assets">
|
||||
<i class="fas fa-fw fa-tag mx-2"></i>
|
||||
<span>Assets</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "vendors") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=vendors">
|
||||
<i class="fas fa-fw fa-building mx-2"></i>
|
||||
<span>Vendors</span></a>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "logins") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=logins">
|
||||
<i class="fas fa-fw fa-key mx-2"></i>
|
||||
<span>Logins</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "networks") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=networks">
|
||||
<i class="fas fa-fw fa-network-wired mx-2"></i>
|
||||
<span>Networks</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "domains") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=domains">
|
||||
<i class="fas fa-fw fa-globe mx-2"></i>
|
||||
<span>Domains</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "applications") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=applications">
|
||||
<i class="fas fa-fw fa-box mx-2"></i>
|
||||
<span>Applications</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "invoices") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=invoices">
|
||||
<i class="fas fa-fw fa-file mx-2"></i>
|
||||
<span>Invoices</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "recurring") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=recurring">
|
||||
<i class="fas fa-fw fa-copy mx-2"></i>
|
||||
<span>Recurring</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "quotes") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=quotes">
|
||||
<i class="fas fa-fw fa-file mx-2"></i>
|
||||
<span>Quotes</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "files") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=files">
|
||||
<i class="fas fa-fw fa-paperclip mx-2"></i>
|
||||
<span>Files</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php if($_GET['tab'] == "notes") { echo "active"; } ?>"
|
||||
href="?client_id=<?php echo $client_id; ?>&tab=notes">
|
||||
<i class="fas fa-fw fa-edit mx-2"></i>
|
||||
<span>Notes</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
<?php include("header.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
if(isset($_GET['orderby'])){
|
||||
$sql_orderby = "ORDER BY " . $_GET['orderby'];
|
||||
$sql_order = "ASC";
|
||||
}
|
||||
|
||||
if(isset($_GET['search'])){
|
||||
$search = $_GET['search'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM clients WHERE client_name LIKE '%$search%' $sql_orderby $sql_order LIMIT 10"); ?>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<form>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="Search clients..." name="search">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark" type="submit"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<button type="button" class="btn btn-primary mr-auto float-right" data-toggle="modal" data-target="#addClientModal"><i class="fas fa-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><a href="<?php echo $_SERVER['REQUEST_URI']; ?>?orderby=client_name">Name <i class="fa fa-sort-alpha-down"></i></a></th>
|
||||
<th><a href="?orderby=client_email">Email</a></th>
|
||||
<th><a href="?sortby=client_phone">Phone</a></th>
|
||||
<th class="text-right">Balance</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
$client_phone = $row['client_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
}
|
||||
$client_email = $row['client_email'];
|
||||
$client_website = $row['client_website'];
|
||||
$client_net_terms = $row['client_net_terms'];
|
||||
|
||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE client_id = $client_id AND invoice_status NOT LIKE 'Draft'");
|
||||
$row = mysqli_fetch_array($sql_invoice_amounts);
|
||||
|
||||
$invoice_amounts = $row['invoice_amounts'];
|
||||
|
||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.client_id = $client_id");
|
||||
$row = mysqli_fetch_array($sql_amount_paid);
|
||||
|
||||
$amount_paid = $row['amount_paid'];
|
||||
|
||||
$balance = $invoice_amounts - $amount_paid;
|
||||
//set Text color on balance
|
||||
if($balance > 0){
|
||||
$balance_text_color = "text-danger";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="client.php?client_id=<?php echo $client_id; ?>"><?php echo "$client_name"; ?></a></td>
|
||||
<td><a href="mailto:<?php echo$email; ?>"><?php echo "$client_email"; ?></a></td>
|
||||
<td><?php echo "$client_phone"; ?></td>
|
||||
<td class="text-right text-monospace <?php echo $balance_text_color; ?>">$<?php echo number_format($balance,2); ?></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="#" data-toggle="modal" data-target="#editClientModal<?php echo $client_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="post.php?delete_client=<?php echo $client_id; ?>">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
include("edit_client_modal.php");
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<nav aria-label="Page navigation example">
|
||||
<ul class="pagination justify-content-end">
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a>
|
||||
</li>
|
||||
<li class="page-item active"><a class="page-link" href="#">1</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">2</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">3</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">4</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">5</a></li>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="#">Next</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("add_client_modal.php"); ?>
|
||||
|
||||
<?php include("footer.php");
|
||||
|
|
@ -53,6 +53,8 @@
|
|||
//set Text color on balance
|
||||
if($balance > 0){
|
||||
$balance_text_color = "text-danger";
|
||||
}else{
|
||||
$balance_text_color = "";
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -47,8 +47,13 @@
|
|||
<?php include("top_nav.php"); ?>
|
||||
|
||||
<div id="wrapper">
|
||||
|
||||
<?php include("side_nav.php"); ?>
|
||||
<?php
|
||||
if(basename(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH)) == "client.php"){
|
||||
include("client_side_nav.php");
|
||||
}else{
|
||||
include("side_nav.php");
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="content-wrapper">
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
<!-- Sidebar -->
|
||||
<ul class="sidebar navbar-nav d-print-none">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="dashboard.php">
|
||||
<i class="fas fa-fw fa-arrow-left mx-2"></i>
|
||||
<span>Back</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="clients.php">
|
||||
<i class="fas fa-fw fa-cog mx-2"></i>
|
||||
<span>General</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="calendar_events.php">
|
||||
<i class="fas fa-fw fa-building mx-2"></i>
|
||||
<span>Company</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="products.php">
|
||||
<i class="fas fa-fw fa-file mx-2"></i>
|
||||
<span>Invoice</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="vendors.php">
|
||||
<i class="fas fa-fw fa-image mx-2"></i>
|
||||
<span>Logo</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="invoices.php">
|
||||
<i class="fas fa-fw fa-database mx-2"></i>
|
||||
<span>Backup</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
Loading…
Reference in New Issue