Tons of UI and code cleanups, renamed many sql tables and fields, started adding created_at and updated_at fields

This commit is contained in:
root
2019-05-17 01:09:16 -04:00
parent 4b3c2c8c2a
commit fa08853640
72 changed files with 1625 additions and 3305 deletions

View File

@@ -1,9 +1,9 @@
<?php $sql = mysqli_query($mysqli,"SELECT * FROM client_vendors WHERE client_id = $client_id ORDER BY client_vendor_id DESC"); ?>
<?php $sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE client_id = $client_id ORDER BY vendor_id DESC"); ?>
<div class="card">
<div class="card-header">
<h6 class="float-left mt-1"><i class="fa fa-building"></i> Vendors</h6>
<button class="btn btn-primary btn-sm float-right" data-toggle="modal" data-target="#addClientVendorModal"><i class="fa fa-plus"></i></button>
<h6 class="float-left mt-1"><i class="fa fa-fw fa-building mr-2"></i>Vendors</h6>
<button class="btn btn-primary btn-sm float-right" data-toggle="modal" data-target="#addVendorModal"><i class="fa fa-plus"></i></button>
</div>
<div class="card-body">
<div class="table-responsive">
@@ -21,27 +21,36 @@
<?php
while($row = mysqli_fetch_array($sql)){
$client_vendor_id = $row['client_vendor_id'];
$client_vendor_name = $row['client_vendor_name'];
$client_vendor_description = $row['client_vendor_description'];
$client_vendor_account_number = $row['client_vendor_account_number'];
$client_login_id = $row['client_login_id'];
$vendor_id = $row['vendor_id'];
$vendor_name = $row['vendor_name'];
$vendor_description = $row['vendor_description'];
$vendor_account_number = $row['vendor_account_number'];
$vendor_address = $row['vendor_address'];
$vendor_city = $row['vendor_city'];
$vendor_state = $row['vendor_state'];
$vendor_zip = $row['vendor_zip'];
$vendor_phone = $row['vendor_phone'];
if(strlen($vendor_phone)>2){
$vendor_phone = substr($row['vendor_phone'],0,3)."-".substr($row['vendor_phone'],3,3)."-".substr($row['vendor_phone'],6,4);
}
$vendor_email = $row['vendor_email'];
$vendor_website = $row['vendor_website'];
$sql2 = mysqli_query($mysqli,"SELECT * FROM client_logins WHERE client_vendor_id = $client_vendor_id");
$sql2 = mysqli_query($mysqli,"SELECT * FROM client_logins WHERE vendor_id = $vendor_id");
$row = mysqli_fetch_array($sql2);
$client_login_id = $row['client_login_id'];
$client_login_username = $row['client_login_username'];
$client_login_password = $row['client_login_password'];
$client_vendor_id_relation = $row['client_vendor_id'];
$vendor_id_relation = $row['vendor_id'];
?>
<tr>
<td><?php echo $client_vendor_name; ?></td>
<td><?php echo $client_vendor_description; ?></td>
<td><?php echo $client_vendor_account_number; ?></td>
<td><?php echo $vendor_name; ?></td>
<td><?php echo $vendor_description; ?></td>
<td><?php echo $vendor_account_number; ?></td>
<td>
<?php
if($client_vendor_id == $client_vendor_id_relation){
if($vendor_id == $vendor_id_relation){
?>
<button type="button" class="btn btn-dark btn-sm" data-toggle="modal" data-target="#viewPasswordModal<?php echo $client_login_id; ?>"><i class="fas fa-key"></i></button>
@@ -49,7 +58,7 @@
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-key"></i> <?php echo $client_vendor_name; ?> Login</h5>
<h5 class="modal-title"><i class="fa fa-key"></i> <?php echo $vendor_name; ?> Login</h5>
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
</button>
@@ -86,15 +95,15 @@
<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="#editClientVendorModal<?php echo $client_vendor_id; ?>">Edit</a>
<a class="dropdown-item" href="post.php?delete_client_vendor=<?php echo $client_vendor_id; ?>">Delete</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editVendorModal<?php echo $vendor_id; ?>">Edit</a>
<a class="dropdown-item" href="post.php?delete_vendor=<?php echo $vendor_id; ?>">Delete</a>
</div>
</div>
</td>
</tr>
<?php
include("edit_client_vendor_modal.php");
include("edit_vendor_modal.php");
}
?>
@@ -104,4 +113,4 @@
</div>
</div>
<?php include("add_client_vendor_modal.php"); ?>
<?php include("add_vendor_modal.php"); ?>