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\ManufacturerModel;
|
||||
use App\Models\ProductModel;
|
||||
|
||||
use App\Models\ProductCategoryModel;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
@ -46,12 +46,16 @@ class Vendor extends BaseController
|
||||
$data['page_name'] = "Add Vendor";
|
||||
$ManufacturerModel = new ManufacturerModel();
|
||||
$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 {
|
||||
$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();
|
||||
$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";
|
||||
|
||||
|
||||
|
||||
@ -32,6 +32,18 @@
|
||||
<link href="https://cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.min.css" rel="stylesheet">
|
||||
|
||||
<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 */
|
||||
.toast-warning {
|
||||
color: black !important;
|
||||
|
||||
@ -190,7 +190,7 @@
|
||||
<option value>Select ML</option>
|
||||
<?php
|
||||
$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' : '';
|
||||
echo "<option value=\"$i\" $selected>$i</option>";
|
||||
}
|
||||
@ -475,7 +475,7 @@ $(document).ready(function() {
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$('#qty_in_stock').on('keyup', function() {
|
||||
$('#qty_in_stock').on('keyup change', function() {
|
||||
var qtyInStockInput = document.getElementById('qty_in_stock');
|
||||
var purchaseOrderLevelInput = document.getElementById('purchase_order_level');
|
||||
var purchaseReorderLevelInput = document.getElementById('purchase_reorder_level');
|
||||
|
||||
@ -167,7 +167,7 @@
|
||||
<tr>
|
||||
<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>
|
||||
<?php foreach ($product as $value) : ?>
|
||||
<?php if ($value['per'] == 'ml') {
|
||||
@ -444,7 +444,7 @@ $(document).ready(function() {
|
||||
}).get();
|
||||
|
||||
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++)
|
||||
{
|
||||
|
||||
@ -120,8 +120,8 @@
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td style="width:10%;">
|
||||
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;">
|
||||
<td style="width:30%;">
|
||||
<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="<?= $product["product_id"] ?>" <?= isset($product['product_id']) ? 'selected' : '' ?>>
|
||||
<?= $product["product_name"].$value_ml.' - '. $product['manufacturer_name']; ?>
|
||||
@ -173,7 +173,7 @@
|
||||
const productarray = JSON.parse($('#pr_data').val())
|
||||
console.log($('#pr_data').val());
|
||||
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++) {
|
||||
var product = productarray[i];
|
||||
@ -192,14 +192,29 @@
|
||||
|
||||
|
||||
$('#itemTable tbody').append(newRow);
|
||||
initializeSelect2();
|
||||
updateCalculations();
|
||||
initializeRowCalculations(row);
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', '.remove-item', function() {
|
||||
$(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>
|
||||
|
||||
|
||||
@ -564,7 +564,7 @@ $(document).ready(function() {
|
||||
// var taxamount = amount * tax / 100;
|
||||
// var finalamt = amount + taxamount;
|
||||
var finalamt = amount;
|
||||
// console.log("samount".samount);
|
||||
|
||||
$(row).find('.item-amount').val(parseFloat(finalamt).toFixed(2));
|
||||
}
|
||||
|
||||
@ -586,14 +586,14 @@ $(document).ready(function() {
|
||||
var sgst = parseInt(product.sgst);
|
||||
var totalTax = cgst + sgst;
|
||||
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);
|
||||
|
||||
|
||||
// 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-result').val(unitPrice);
|
||||
$(this).closest('tr').find('.tax-amount').val(total_tax_amount);
|
||||
@ -1066,19 +1066,15 @@ $(document).on('click', '#selectClient', function() {
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
finalValue = parseFloat(result).toFixed(2)
|
||||
input.parentNode.nextElementSibling.querySelector('.item-result').value = finalValue;
|
||||
// After updating the third column, also update tax amount
|
||||
updateTaxAmount(input);
|
||||
//updateTaxAmount(input);
|
||||
}
|
||||
|
||||
function updateTaxAmount(input) {
|
||||
|
||||
@ -7,9 +7,7 @@
|
||||
<a href="<?= base_url() . "vendor_index"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@ -36,7 +34,33 @@
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<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 class="form-group col-md-3">
|
||||
@ -227,6 +251,8 @@ $(document).ready(function() {
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
|
||||
|
||||
.select2-container .select2-selection--multiple .select2-selection__choice{
|
||||
padding: 5px 7px 5px 0 !important;
|
||||
color: #000000;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user