mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Changed product cost to product price as it makes more sense, some cleanup on the new product auto complete feature, added JQueryUI as a local asset instead of a remote asset
This commit is contained in:
53
quote.php
53
quote.php
@@ -76,17 +76,16 @@ if(isset($_GET['quote_id'])){
|
||||
$quote_badge_color = "secondary";
|
||||
}
|
||||
|
||||
//Product autocomplete
|
||||
$products_sql = mysqli_query($mysqli,"SELECT product_name AS label, product_description AS description, product_price AS price FROM products WHERE company_id = $session_company_id");
|
||||
|
||||
// Product autocomplete
|
||||
$product_sql = mysqli_query($mysqli,"SELECT product_name AS label, product_description AS description, product_cost AS price FROM products
|
||||
WHERE products.company_id = $session_company_id");
|
||||
|
||||
if(mysqli_num_rows($product_sql) > 0){
|
||||
while($row = mysqli_fetch_array($product_sql)) {
|
||||
$products[] = $row;
|
||||
if(mysqli_num_rows($products_sql) > 0){
|
||||
while($row = mysqli_fetch_array($products_sql)){
|
||||
$products[] = $row;
|
||||
}
|
||||
$json_products = (json_encode($products));
|
||||
}
|
||||
$json_products = json_encode($products);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<ol class="breadcrumb d-print-none">
|
||||
@@ -248,7 +247,7 @@ if(mysqli_num_rows($product_sql) > 0){
|
||||
<td class="text-center"><?php echo $item_quantity; ?></td>
|
||||
<td class="text-right"><?php echo $client_currency_symbol; ?> <?php echo number_format($item_price,2); ?></td>
|
||||
<td class="text-right"><?php echo $client_currency_symbol; ?> <?php echo number_format($item_tax,2); ?></td>
|
||||
<td class="text-right"><?php echo $client_currency_symbol; ?> <?php echo number_format($item_total,2); ?></td>
|
||||
<td class="text-right"><?php echo $client_currency_symbol; ?><?php echo number_format($item_total,2); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
@@ -265,10 +264,10 @@ if(mysqli_num_rows($product_sql) > 0){
|
||||
<td></td>
|
||||
<td><input type="text" class="form-control" name="name" id="name" placeholder="Item" required></td>
|
||||
<td><textarea class="form-control" rows="2" name="description" id="desc" placeholder="Description"></textarea></td>
|
||||
<td><input type="number" step="0.01" min="0" class="form-control" style="text-align: center;" name="qty" placeholder="QTY"></td>
|
||||
<td><input type="number" step="0.01" min="0" class="form-control" id="qty" style="text-align: center;" name="qty" placeholder="QTY"></td>
|
||||
<td><input type="number" step="0.01" min="0" class="form-control" id="price" style="text-align: right;" name="price" placeholder="Price (<?php echo $client_currency_symbol; ?>)"></td>
|
||||
<td>
|
||||
<select class="form-control select2" name="tax_id" required>
|
||||
<select class="form-control select2" id="tax" name="tax_id" required>
|
||||
<option value="0">None</option>
|
||||
<?php
|
||||
|
||||
@@ -407,23 +406,23 @@ include("footer.php");
|
||||
|
||||
<!-- JSON Autocomplete / type ahead -->
|
||||
<!-- //TODO: Not sure quite how to make this more modular to include elsewhere, I'll leave that design decision down to you.. -->
|
||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
|
||||
<link rel="stylesheet" href="plugins/jquery-ui/jquery-ui.min.css">
|
||||
<script src="plugins/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script>
|
||||
$( function() {
|
||||
var availableProducts = <?php echo $json_products?>;
|
||||
$(function(){
|
||||
var availableProducts = <?php echo $json_products?>;
|
||||
|
||||
$("#name").autocomplete({
|
||||
source: availableProducts,
|
||||
select: function (event, ui){
|
||||
$("#name").val(ui.item.label); // Product name field - this seemingly has to referenced as label
|
||||
$("#desc").val(ui.item.description); // Product description field
|
||||
$("#price").val(ui.item.price); // Product price field
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} );
|
||||
$("#name").autocomplete({
|
||||
source: availableProducts,
|
||||
select: function (event, ui){
|
||||
$("#name").val(ui.item.label); // Product name field - this seemingly has to referenced as label
|
||||
$("#desc").val(ui.item.description); // Product description field
|
||||
$("#qty").val(1); // Product quantity field automatically make it a 1
|
||||
$("#price").val(ui.item.price); // Product price field
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src='plugins/pdfmake/pdfmake.js'></script>
|
||||
|
||||
Reference in New Issue
Block a user