-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
942 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<?php | ||
|
||
// Default Column Sortby/Order Filter | ||
$sort = "inventory_created_at"; | ||
$order = "DESC"; | ||
|
||
require_once "inc_all.php"; | ||
|
||
//Rebuild URL | ||
$url_query_strings_sort = http_build_query($get_copy); | ||
|
||
$sql = mysqli_query( | ||
$mysqli, | ||
"SELECT | ||
product_name, | ||
SUM(inventory_quantity) as total_inventory, | ||
inventory_product_id, | ||
GROUP_CONCAT(DISTINCT inventory_locations_name SEPARATOR ', ') AS inventory_locations | ||
FROM inventory | ||
LEFT JOIN inventory_locations ON inventory_locations_id = inventory_location_id | ||
LEFT JOIN products ON inventory_product_id = product_id | ||
LEFT JOIN users on inventory_locations_user_id = user_id | ||
LEFT JOIN vendors ON inventory_vendor_id = vendor_id | ||
GROUP BY inventory_product_id | ||
"); | ||
|
||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); | ||
|
||
?> | ||
|
||
<div class="card card-dark"> | ||
<div class="card-header py-2"> | ||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-box mr-2"></i>Inventory</h3> | ||
</div> | ||
|
||
<div class="card-body"> | ||
<form class="mb-4" autocomplete="off"> | ||
<div class="row"> | ||
<div class="col-sm-4"> | ||
<div class="input-group"> | ||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Inventory"> | ||
<div class="input-group-append"> | ||
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button> | ||
<button class="btn btn-primary"><i class="fa fa-search"></i></button> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-sm-8"> | ||
<div class="btn-group float-right"> | ||
<a href="inventory_locations.php" class="btn btn-outline-primary"><i class="fa fa-fw fa-map-marker-alt mr-2"></i>Locations</b></a> | ||
<div class="dropdown ml-2" id="bulkActionButton" hidden> | ||
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown"> | ||
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>) | ||
</button> | ||
<div class="dropdown-menu"> | ||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditCategoryModal"> | ||
<i class="fas fa-fw fa-list mr-2"></i>Set Category | ||
</a> | ||
<div class="dropdown-divider"></div> | ||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditAccountModal"> | ||
<i class="fas fa-fw fa-piggy-bank mr-2"></i>Set Account | ||
</a> | ||
<div class="dropdown-divider"></div> | ||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditClientModal"> | ||
<i class="fas fa-fw fa-user mr-2"></i>Set Client | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
<hr> | ||
<form id="bulkActions" action="post.php" method="post"> | ||
<div class="table-responsive-sm"> | ||
<table class="table table-striped table-borderless table-hover"> | ||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>"> | ||
<tr> | ||
<td class="bg-light pr-0"> | ||
<div class="form-check"> | ||
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)"> | ||
</div> | ||
</td> | ||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=inventory_date&order=<?php echo $disp; ?>">Product Name</a></th> | ||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=vendor_name&order=<?php echo $disp; ?>">Quantity</a></th> | ||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=category_name&order=<?php echo $disp; ?>">Locations</a></th> | ||
<th class="text-center">Manage product</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php | ||
|
||
while ($row = mysqli_fetch_array($sql)) { | ||
$inventory_id = $row['inventory_id']; | ||
$inventory_name = $row['product_name']; | ||
$inventory_quantity = $row['total_inventory']; | ||
$inventory_product_id = $row['inventory_product_id']; | ||
$inventory_locations = $row['inventory_locations']; | ||
?> | ||
|
||
<tr> | ||
<td class="bg-light pr-0"> | ||
<div class="form-check"> | ||
<input class="form-check-input" type="checkbox" name="selected[]" value="<?php echo $inventory_product_id; ?>"> | ||
</div> | ||
</td> | ||
<td><?php echo $inventory_name; ?></td> | ||
<td><?php echo $inventory_quantity; ?></td> | ||
<td><?php echo $inventory_locations; ?></td> | ||
<td class="text-center"> | ||
<div class="btn-group"> | ||
<a href="inventory_manage.php?inventory_product_id=<?php echo $inventory_product_id; ?>" class="btn btn-primary btn-sm"><i class="fas fa-fw fa-edit"></i></a> | ||
</div> | ||
</td> | ||
|
||
<?php | ||
} | ||
|
||
?> | ||
|
||
</tbody> | ||
</table> | ||
</div> | ||
|
||
</form> | ||
<?php require_once "pagination.php"; | ||
?> | ||
</div> | ||
</div> | ||
|
||
<script src="js/bulk_actions.js"></script> | ||
|
||
<?php | ||
|
||
require_once "footer.php"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<div class="modal" id="editInventoryLocations<?php echo $inventory_product_id; ?>" tabindex="-1"> | ||
<div class="modal-dialog modal-md"> | ||
<div class="modal-content bg-dark"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title"><i class="fa fa-fw fa-clone mr-2"></i>Move Inventory</h5> | ||
<button type="button" class="close text-white" data-dismiss="modal"> | ||
<span>×</span> | ||
</button> | ||
</div> | ||
<form action="post.php" method="post" autocomplete="off"> | ||
<input type="hidden" id="inventory_product_id" name="inventory_product_id" value="<?php echo $inventory_product_id; ?>"> | ||
<input type="hidden" id="inventory_location_id" name="inventory_location_id" value="<?php echo $inventory_location_id; ?>"> | ||
<div class="modal-body bg-white"> | ||
<div class="form-row"> | ||
<div class="form-group"> | ||
<label for="inventory_location_id">Move to location</label> | ||
<select class="form-control select2" id="inventory_new_location_id" name="inventory_new_location_id"> | ||
<option value="">Select location</option> | ||
<?php | ||
$inventory_locations = mysqli_query($mysqli, "SELECT * FROM inventory_locations WHERE inventory_locations_id != $inventory_location_id"); | ||
while ($inventory_location = mysqli_fetch_array($inventory_locations)) { | ||
echo "<option value='" . $inventory_location['inventory_locations_id'] . "'>" . $inventory_location['inventory_locations_name'] . "</option>"; | ||
} | ||
?> | ||
</select> | ||
<small>Choose the location to move the inventory to</small> | ||
</div> | ||
</div> | ||
<div class="form-row"> | ||
<div class="form-group"> | ||
<label for="inventory_quantity">Quantity</label> | ||
<input type="number" class="form-control" id="inventory_quantity" name="inventory_quantity" value="<?php echo $inventory_quantity; ?>"> | ||
<small class="form-text text-muted">Enter the quantity to move</small> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer bg-white"> | ||
<button type="submit" id="move_inventory_btn" name="move_inventory" class="btn btn-primary text-bold"><i class="fa fa-fw fa-clone mr-2"></i>Move Inventory</button> | ||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
|
Oops, something went wrong.