tracker issue:gwm
This commit is contained in:
parent
405799a296
commit
d5c20cd5ce
@ -9,7 +9,7 @@ use App\Models\BikemakeModel;
|
|||||||
use App\Models\BikemodelsModel;
|
use App\Models\BikemodelsModel;
|
||||||
use App\Models\ManufacturerModel;
|
use App\Models\ManufacturerModel;
|
||||||
use App\Models\ProductModel;
|
use App\Models\ProductModel;
|
||||||
|
use App\Models\ProductCategoryModel;
|
||||||
use CodeIgniter\API\ResponseTrait;
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
|
||||||
@ -46,12 +46,16 @@ class Vendor extends BaseController
|
|||||||
$data['page_name'] = "Add Vendor";
|
$data['page_name'] = "Add Vendor";
|
||||||
$ManufacturerModel = new ManufacturerModel();
|
$ManufacturerModel = new ManufacturerModel();
|
||||||
$data['manufacturers']=$ManufacturerModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
$data['manufacturers']=$ManufacturerModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
||||||
|
$ProductCategoryModel = new ProductCategoryModel();
|
||||||
|
$data['productcategory'] = $ProductCategoryModel->orderBy('product_category_id')->findAll();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$VendorModel = new VendorModel();
|
$VendorModel = new VendorModel();
|
||||||
$vendor = $VendorModel->where('vendor_id', $vendor_id)->get()->getRowArray();
|
$data['vendor'] = $VendorModel->where('vendor_id', $vendor_id)->get()->getRowArray();
|
||||||
$ManufacturerModel = new ManufacturerModel();
|
$ManufacturerModel = new ManufacturerModel();
|
||||||
$data['manufacturers']=$ManufacturerModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
$data['manufacturers']=$ManufacturerModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
|
||||||
$data['vendor'] = $vendor;
|
$ProductCategoryModel = new ProductCategoryModel();
|
||||||
|
$data['productcategory'] = $ProductCategoryModel->orderBy('product_category_id')->findAll();
|
||||||
$data['page_name'] = "Edit Vendor";
|
$data['page_name'] = "Edit Vendor";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,18 @@
|
|||||||
<link href="https://cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.min.css" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
|
.select2-container--default .select2-selection--single {
|
||||||
|
height: 37px !important;
|
||||||
|
line-height: 37px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||||
|
padding-top: 3px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Override toastr font color */
|
/* Override toastr font color */
|
||||||
.toast-warning {
|
.toast-warning {
|
||||||
color: black !important;
|
color: black !important;
|
||||||
|
|||||||
@ -190,7 +190,7 @@
|
|||||||
<option value>Select ML</option>
|
<option value>Select ML</option>
|
||||||
<?php
|
<?php
|
||||||
$selectedValue = isset($products['ml']) ? $products['ml'] : 0;
|
$selectedValue = isset($products['ml']) ? $products['ml'] : 0;
|
||||||
for ($i = 25; $i <= 750; $i += 25) {
|
for ($i = 25; $i <= 950; $i += 25) {
|
||||||
$selected = ($selectedValue == $i) ? 'selected' : '';
|
$selected = ($selectedValue == $i) ? 'selected' : '';
|
||||||
echo "<option value=\"$i\" $selected>$i</option>";
|
echo "<option value=\"$i\" $selected>$i</option>";
|
||||||
}
|
}
|
||||||
@ -475,7 +475,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$('#qty_in_stock').on('keyup', function() {
|
$('#qty_in_stock').on('keyup change', function() {
|
||||||
var qtyInStockInput = document.getElementById('qty_in_stock');
|
var qtyInStockInput = document.getElementById('qty_in_stock');
|
||||||
var purchaseOrderLevelInput = document.getElementById('purchase_order_level');
|
var purchaseOrderLevelInput = document.getElementById('purchase_order_level');
|
||||||
var purchaseReorderLevelInput = document.getElementById('purchase_reorder_level');
|
var purchaseReorderLevelInput = document.getElementById('purchase_reorder_level');
|
||||||
|
|||||||
@ -167,7 +167,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="width:10%;">
|
<td style="width:10%;">
|
||||||
|
|
||||||
<select class="form-control book-select SelExample purchase_order_product_edit" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;" readonly>
|
<select class="form-control book-select SelExample purchase_order_product_edit" name="item_details[]" required data-toggle="select2" id="" style="width: 280px !important;" readonly>
|
||||||
<option value="">Select a Product</option>
|
<option value="">Select a Product</option>
|
||||||
<?php foreach ($product as $value) : ?>
|
<?php foreach ($product as $value) : ?>
|
||||||
<?php if ($value['per'] == 'ml') {
|
<?php if ($value['per'] == 'ml') {
|
||||||
@ -444,7 +444,7 @@ $(document).ready(function() {
|
|||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
console.log(valuesArray);
|
console.log(valuesArray);
|
||||||
var newRow = '<tr>' + '<td><select class="form-control book-select SelExample purchase_order_product" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>';
|
var newRow = '<tr>' + '<td><select class="form-control book-select SelExample purchase_order_product" name="item_details[]" required data-toggle="select2" style="width: 280px !important;"><option value="">Select a Product</option>';
|
||||||
|
|
||||||
for (var i = 0; i < productarray.length; i++)
|
for (var i = 0; i < productarray.length; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -120,8 +120,8 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:10%;">
|
<td style="width:30%;">
|
||||||
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;">
|
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 280px !important;">
|
||||||
<option value="">Select a Product</option>
|
<option value="">Select a Product</option>
|
||||||
<option value="<?= $product["product_id"] ?>" <?= isset($product['product_id']) ? 'selected' : '' ?>>
|
<option value="<?= $product["product_id"] ?>" <?= isset($product['product_id']) ? 'selected' : '' ?>>
|
||||||
<?= $product["product_name"].$value_ml.' - '. $product['manufacturer_name']; ?>
|
<?= $product["product_name"].$value_ml.' - '. $product['manufacturer_name']; ?>
|
||||||
@ -173,7 +173,7 @@
|
|||||||
const productarray = JSON.parse($('#pr_data').val())
|
const productarray = JSON.parse($('#pr_data').val())
|
||||||
console.log($('#pr_data').val());
|
console.log($('#pr_data').val());
|
||||||
var newRow = '<tr>' +
|
var newRow = '<tr>' +
|
||||||
'<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option>';
|
'<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 280px !important;"><option value="">Select a Product</option>';
|
||||||
|
|
||||||
for (var i = 0; i < productarray.length; i++) {
|
for (var i = 0; i < productarray.length; i++) {
|
||||||
var product = productarray[i];
|
var product = productarray[i];
|
||||||
@ -192,14 +192,29 @@
|
|||||||
|
|
||||||
|
|
||||||
$('#itemTable tbody').append(newRow);
|
$('#itemTable tbody').append(newRow);
|
||||||
initializeSelect2();
|
|
||||||
updateCalculations();
|
|
||||||
initializeRowCalculations(row);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.remove-item', function() {
|
$(document).on('click', '.remove-item', function() {
|
||||||
$(this).closest('tr').remove();
|
$(this).closest('tr').remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var productAll_json = <?php json_encode($products); ?>
|
||||||
|
var productAll = JSON.parse(productAll_json);
|
||||||
|
// Event listener for product selection
|
||||||
|
$(document).on('change', 'select[name="item_details[]"]', function() {
|
||||||
|
var productId = $(this).val();
|
||||||
|
var quantity = $(this).closest('tr').find('.item-quantity').val(1);
|
||||||
|
|
||||||
|
|
||||||
|
console.log(productAll);
|
||||||
|
var product = productAll.find(function(item) {
|
||||||
|
return item.product_id == productId;
|
||||||
|
});
|
||||||
|
console.log(product);
|
||||||
|
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -564,7 +564,7 @@ $(document).ready(function() {
|
|||||||
// var taxamount = amount * tax / 100;
|
// var taxamount = amount * tax / 100;
|
||||||
// var finalamt = amount + taxamount;
|
// var finalamt = amount + taxamount;
|
||||||
var finalamt = amount;
|
var finalamt = amount;
|
||||||
// console.log("samount".samount);
|
|
||||||
$(row).find('.item-amount').val(parseFloat(finalamt).toFixed(2));
|
$(row).find('.item-amount').val(parseFloat(finalamt).toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,14 +586,14 @@ $(document).ready(function() {
|
|||||||
var sgst = parseInt(product.sgst);
|
var sgst = parseInt(product.sgst);
|
||||||
var totalTax = cgst + sgst;
|
var totalTax = cgst + sgst;
|
||||||
var total_tax_amount = product.unit_price * totalTax / 100;
|
var total_tax_amount = product.unit_price * totalTax / 100;
|
||||||
// var total_tax_amount = product.total_amount;
|
var total_tax_amount = parseFloat(total_tax_amount).toFixed(2);
|
||||||
|
|
||||||
|
|
||||||
$(this).closest('tr').find('.item-quantity').attr('max', product.qty_stock);
|
$(this).closest('tr').find('.item-quantity').attr('max', product.qty_stock);
|
||||||
|
|
||||||
|
|
||||||
// Access unit price from product and set it as rate
|
// Access unit price from product and set it as rate
|
||||||
var unitPrice = parseFloat(product.unit_price); // Convert to float if necessary
|
var unitPrice = parseFloat(product.unit_price).toFixed(2);
|
||||||
$(this).closest('tr').find('.item-rate').val(unitPrice);
|
$(this).closest('tr').find('.item-rate').val(unitPrice);
|
||||||
$(this).closest('tr').find('.item-result').val(unitPrice);
|
$(this).closest('tr').find('.item-result').val(unitPrice);
|
||||||
$(this).closest('tr').find('.tax-amount').val(total_tax_amount);
|
$(this).closest('tr').find('.tax-amount').val(total_tax_amount);
|
||||||
@ -1066,19 +1066,15 @@ $(document).on('click', '#selectClient', function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function updateThirdColumnValue(input) {
|
function updateThirdColumnValue(input) {
|
||||||
const itemRate = parseFloat(input.parentNode.previousElementSibling.querySelector('.item-rate').value);
|
const itemRate = parseFloat(input.parentNode.previousElementSibling.querySelector('.item-rate').value);
|
||||||
const quantity = parseFloat(input.value);
|
const quantity = parseFloat(input.value);
|
||||||
const result = itemRate * quantity;
|
const result = itemRate * quantity;
|
||||||
input.parentNode.nextElementSibling.querySelector('.item-result').value = result;
|
finalValue = parseFloat(result).toFixed(2)
|
||||||
}
|
input.parentNode.nextElementSibling.querySelector('.item-result').value = finalValue;
|
||||||
function updateThirdColumnValue(input) {
|
|
||||||
const itemRate = parseFloat(input.parentNode.previousElementSibling.querySelector('.item-rate').value);
|
|
||||||
const quantity = parseFloat(input.value);
|
|
||||||
const result = itemRate * quantity;
|
|
||||||
input.parentNode.nextElementSibling.querySelector('.item-result').value = result;
|
|
||||||
// After updating the third column, also update tax amount
|
// After updating the third column, also update tax amount
|
||||||
updateTaxAmount(input);
|
//updateTaxAmount(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTaxAmount(input) {
|
function updateTaxAmount(input) {
|
||||||
|
|||||||
@ -7,9 +7,7 @@
|
|||||||
<a href="<?= base_url() . "vendor_index"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
<a href="<?= base_url() . "vendor_index"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||||
<ol class="breadcrumb m-0">
|
<ol class="breadcrumb m-0">
|
||||||
|
|
||||||
</li>
|
|
||||||
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Tables</a></li>
|
|
||||||
<li class="breadcrumb-item active">Datatables</li> -->
|
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -36,7 +34,33 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="inputEmail4" class="col-form-label">Category<span class="text-danger"></span></label>
|
<label for="inputEmail4" class="col-form-label">Category<span class="text-danger"></span></label>
|
||||||
<input type="text" class="form-control" name="category" placeholder="Category" value="<?= isset($vendor['category']) ? $vendor['category'] : '' ?>" >
|
|
||||||
|
<select class="form-control status-select SelExample" name="category" required data-toggle="select2">
|
||||||
|
<option value="">Select Category</option>
|
||||||
|
<?php
|
||||||
|
if (isset($vendor['vendor_id']) && $vendor['vendor_id']) {
|
||||||
|
foreach ($productcategory as $category) :
|
||||||
|
$isDisabled = ((int)$category['isactive'] == 0);
|
||||||
|
$isSelected = (isset($vendor['category']) && $vendor['category'] === $category['product_category_name']); ?>
|
||||||
|
|
||||||
|
<option value="<?= $category['product_category_name'] ?>"
|
||||||
|
<?php if ($isSelected) echo "selected"; ?>
|
||||||
|
<?= $isDisabled ? 'disabled' : ''; ?>>
|
||||||
|
<?= $category['product_category_name'] . ($isDisabled ? " (Disabled)" : ""); ?>
|
||||||
|
</option>
|
||||||
|
|
||||||
|
<?php endforeach;
|
||||||
|
} else {
|
||||||
|
foreach ($productcategory as $category) :
|
||||||
|
if ((int)$category['isactive'] == 1) { ?>
|
||||||
|
<option value="<?= $category['product_category_name'] ?>">
|
||||||
|
<?= $category['product_category_name']; ?>
|
||||||
|
</option>
|
||||||
|
<?php }
|
||||||
|
endforeach;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
@ -227,6 +251,8 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
.select2-container .select2-selection--multiple .select2-selection__choice{
|
.select2-container .select2-selection--multiple .select2-selection__choice{
|
||||||
padding: 5px 7px 5px 0 !important;
|
padding: 5px 7px 5px 0 !important;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user