itflow/vendors.php

75 lines
2.9 KiB
PHP

<?php include("header.php"); ?>
<?php $sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE client_id = 0 ORDER BY vendor_name ASC"); ?>
<div class="card mb-3">
<div class="card-header">
<h5 class="float-left mt-2"><i class="fa fa-fw fa-building mr-2"></i>Vendors</h5>
<button type="button" class="btn btn-primary badge-pill float-right" data-toggle="modal" data-target="#addVendorModal"><i class="fas fa-fw fa-plus"></i></button>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover" id="dataTable" width="100%" cellspacing="0">
<thead class="thead-dark">
<tr>
<th>Vendor</th>
<th>Description</th>
<th>Account Number</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
$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_contact_name = $row['vendor_contact_name'];
$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'];
?>
<tr>
<td><?php echo $vendor_name; ?></td>
<td><?php echo $vendor_description; ?></td>
<td><?php echo $vendor_account_number; ?></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="#editVendorModal<?php echo $vendor_id; ?>">Edit</a>
<a class="dropdown-item" href="post.php?delete_vendor=<?php echo $vendor_id; ?>">Delete</a>
</div>
</div>
<?php include("edit_vendor_modal.php"); ?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php include("add_vendor_modal.php"); ?>
<?php include("footer.php");