Changes in product : GWM
This commit is contained in:
parent
be3216ce2e
commit
17ebca64c9
@ -180,7 +180,7 @@ class Products extends BaseController
|
|||||||
|
|
||||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||||
|
|
||||||
|
dd($this->request->getPost());
|
||||||
$tax= $this->request->getPost('tax')/2;
|
$tax= $this->request->getPost('tax')/2;
|
||||||
$ml = 0; $box = 0; $qty_per_box = 0; $barrel = 0; $ltr_per_barrel = 0;
|
$ml = 0; $box = 0; $qty_per_box = 0; $barrel = 0; $ltr_per_barrel = 0;
|
||||||
if ($this->request->getPost('per') == 'ml') {
|
if ($this->request->getPost('per') == 'ml') {
|
||||||
|
|||||||
@ -15,6 +15,7 @@ class AdditionalProductNameModal extends Model
|
|||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
'product_names_id',
|
'product_names_id',
|
||||||
'product_id',
|
'product_id',
|
||||||
|
'make_id_for_additional_name',
|
||||||
'additional_product_name',
|
'additional_product_name',
|
||||||
'isactive',
|
'isactive',
|
||||||
'created_at',
|
'created_at',
|
||||||
|
|||||||
@ -1,4 +1,35 @@
|
|||||||
<?php include('layout/header.php'); ?>
|
<?php include('layout/header.php'); ?>
|
||||||
|
<style>
|
||||||
|
.select2-container--default .select2-results__option--highlighted[aria-selected]{
|
||||||
|
color:#ffffff;
|
||||||
|
background: #526dee!important;
|
||||||
|
}
|
||||||
|
.select2-container .select2-selection--single{
|
||||||
|
height: 36px;
|
||||||
|
border:1px solid #ced4da;
|
||||||
|
}
|
||||||
|
.select2-container--default .select2-selection--single .select2-selection__rendered{
|
||||||
|
line-height: 36px;
|
||||||
|
}
|
||||||
|
.select2-container--default .select2-selection--single .select2-selection__arrow{
|
||||||
|
top:4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container .select2-selection--multiple .select2-selection__choice{
|
||||||
|
padding: 5px 7px 5px 0 !important;
|
||||||
|
color: #000000;
|
||||||
|
|
||||||
|
}
|
||||||
|
.select2-container--default .select2-results__option{
|
||||||
|
border-bottom: 1px solid #dddddd;
|
||||||
|
}
|
||||||
|
.select2-container--default .select2-results__option[aria-selected=true]{
|
||||||
|
color: #000000;
|
||||||
|
background-color: #3efba4;
|
||||||
|
font-weight: 500;
|
||||||
|
border-bottom: 1px solid #747474;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@ -20,6 +51,7 @@
|
|||||||
<form action="<?= base_url() . "add_product"; ?>" id="productForm" method="post">
|
<form action="<?= base_url() . "add_product"; ?>" id="productForm" method="post">
|
||||||
<h4 class="header-title">Product Details :</h4><br>
|
<h4 class="header-title">Product Details :</h4><br>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="make" class="col-form-label">Make<span class="text-danger">*</span></label>
|
<label for="make" class="col-form-label">Make<span class="text-danger">*</span></label>
|
||||||
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Client"></i>' ?>
|
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Client"></i>' ?>
|
||||||
@ -33,6 +65,7 @@
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="model" class="col-form-label">Model<span class="text-danger">*</span></label>
|
<label for="model" class="col-form-label">Model<span class="text-danger">*</span></label>
|
||||||
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Client"></i>'; ?>
|
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Client"></i>'; ?>
|
||||||
@ -47,10 +80,23 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="inputEmail4" class="col-form-label">Product Name<span class="text-danger">*</span></label>
|
<label for="inputEmail4" class="col-form-label">Product Name<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" name="productname" placeholder="Product Name" value="<?= isset($products['product_name']) ? $products['product_name'] : '' ?>" required>
|
<input type="text" class="form-control" name="productname" placeholder="Product Name" value="<?= isset($products['product_name']) ? $products['product_name'] : '' ?>" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="dynamic-form-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="manufacturer" class="col-form-label">Manufacturer<span class="text-danger">*</span></label>
|
<label for="manufacturer" class="col-form-label">Manufacturer<span class="text-danger">*</span></label>
|
||||||
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addManufacturerButton" style="font-size: 18px;" data-toggle="modal" data-target="#manufacturer_login-modal" title="Add Client"></i>' ?>
|
<?= isset($products['product_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addManufacturerButton" style="font-size: 18px;" data-toggle="modal" data-target="#manufacturer_login-modal" title="Add Client"></i>' ?>
|
||||||
@ -237,8 +283,7 @@
|
|||||||
<textarea class="form-control" name="description" placeholder="Description"value="<?= isset($products['description']) ? $products['description'] : '' ?>" ></textarea>
|
<textarea class="form-control" name="description" placeholder="Description"value="<?= isset($products['description']) ? $products['description'] : '' ?>" ></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div><br>
|
</div><br>
|
||||||
<h4 class="header-title">Additional Product Names :</h4><br>
|
|
||||||
<div id="dynamic-form-container"></div>
|
|
||||||
<button type="submit" class="btn btn-primary" style="float:right;">Submit</button>
|
<button type="submit" class="btn btn-primary" style="float:right;">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -373,48 +418,76 @@ $(document).ready(function() {
|
|||||||
//---------VENKAT-----------------------------------------------------------------------------------
|
//---------VENKAT-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// for Additional Product Name Edit Purpose
|
// for Additional Product Name Edit Purpose
|
||||||
var additionalProductName = <?= json_encode($additionalProdutName) ?>;
|
// var additionalProductName = <?= json_encode($additionalProdutName) ?>;
|
||||||
|
// if (Array.isArray(additionalProductName) && additionalProductName.length > 0) {
|
||||||
|
|
||||||
// console.log(additionalProductName);
|
// var firstProductName = '<?= isset($products['product_name']) ? $products['product_name'] : '' ?>';
|
||||||
// console.log(additionalProductName.length);
|
// console.log('firstProductName', firstProductName);
|
||||||
|
// additionalProductName.forEach(function(item) {
|
||||||
if (Array.isArray(additionalProductName) && additionalProductName.length > 0) {
|
// if (firstProductName !== item.additional_product_name) {
|
||||||
|
// addHTMLInput(item); // for if edit
|
||||||
var firstProductName = '<?= isset($products['product_name']) ? $products['product_name'] : '' ?>';
|
// }
|
||||||
console.log('firstProductName', firstProductName);
|
// });
|
||||||
additionalProductName.forEach(function(item) {
|
// if(additionalProductName.length == 1){
|
||||||
if (firstProductName !== item.additional_product_name) {
|
// addHTMLInput()
|
||||||
addHTMLInput(item); // for if edit
|
// }
|
||||||
}
|
// } else {
|
||||||
});
|
// addHTMLInput(); // for else add
|
||||||
if(additionalProductName.length == 1){
|
// }
|
||||||
addHTMLInput()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
addHTMLInput(); // for else add
|
|
||||||
}
|
|
||||||
// end of Additional Product Name Edit Purpose
|
// end of Additional Product Name Edit Purpose
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/** CALCULATE TOTAL AMOUNT ( UNIT PRICE + TAX ) */
|
const $dynamicContainer = $("#dynamic-form-container");
|
||||||
// $(document).ready(function() {
|
|
||||||
// function calculateTotalAmount() {
|
|
||||||
// var unitPrice = parseFloat($("input[name='unit_price']").val());
|
|
||||||
// var tax = parseFloat($("select[name='tax']").val());
|
|
||||||
// var totalAmount = unitPrice + (unitPrice * tax / 100);
|
|
||||||
// $("input[name='total_amount']").val(totalAmount.toFixed(2));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $("input[name='unit_price'], select[name='tax']").change(function() {
|
$("#model").change(function () {
|
||||||
// calculateTotalAmount();
|
const selectedOptions = $(this).find("option:selected");
|
||||||
// });
|
|
||||||
|
|
||||||
// calculateTotalAmount();
|
// Loop through the selected options
|
||||||
// });
|
selectedOptions.each(function () {
|
||||||
|
const modelId = $(this).val(); // Value of the make option
|
||||||
|
const modelName = $(this).text(); // Name of the make option
|
||||||
|
|
||||||
|
// Check if the field already exists
|
||||||
|
if (!$(`#field_${modelId}`).length) {
|
||||||
|
// Fields to append
|
||||||
|
const fieldSet = `
|
||||||
|
<div id="field_${modelId}" class="form-row">
|
||||||
|
<input type="hidden" class="form-control" id="product_names_id_${modelId}" name="product_names_id[]" >
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="make_option_${modelId}">Make Options:</label>
|
||||||
|
<select class="form-control" id="make_option_${modelId}" name="make_id_for_additional_name[]">
|
||||||
|
<option value="${modelId}">${modelName}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="additional_product_name_${modelId}">Additional Product Name:</label>
|
||||||
|
<input type="text" class="form-control" id="additional_product_name_${modelId}" name="additional_product_name[]" placeholder="Enter Additional Product Name">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
// Append the new field
|
||||||
|
$("#dynamic-form-container").append(fieldSet);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove fields for deselected options
|
||||||
|
$("#dynamic-form-container").find(".form-row").each(function () {
|
||||||
|
const fieldId = $(this).attr("id");
|
||||||
|
const modelId = fieldId.split("_")[1]; // Extract modelId from the field's id
|
||||||
|
|
||||||
|
// If the model is no longer selected, remove the field
|
||||||
|
if (!$(`#model option[value='${modelId}']`).is(":selected")) {
|
||||||
|
$(this).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Check SGST checkbox by default
|
// Check SGST checkbox by default
|
||||||
@ -525,26 +598,7 @@ $('#qty_in_stock').on('keyup change', function() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.select2-container .select2-selection--multiple .select2-selection__choice{
|
|
||||||
padding: 5px 7px 5px 0 !important;
|
|
||||||
color: #000000;
|
|
||||||
|
|
||||||
}
|
|
||||||
.select2-container--default .select2-results__option--highlighted[aria-selected]{
|
|
||||||
color:#ffffff;
|
|
||||||
background-color: #526dee;
|
|
||||||
}
|
|
||||||
.select2-container--default .select2-results__option{
|
|
||||||
border-bottom: 1px solid #dddddd;
|
|
||||||
}
|
|
||||||
.select2-container--default .select2-results__option[aria-selected=true]{
|
|
||||||
color: #000000;
|
|
||||||
background-color: #3efba4;
|
|
||||||
font-weight: 500;
|
|
||||||
border-bottom: 1px solid #747474;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Function to update the quality dropdown based on selected manufacturer
|
// Function to update the quality dropdown based on selected manufacturer
|
||||||
@ -878,22 +932,7 @@ $('#saveMakeBtn').click(function() {
|
|||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
|
||||||
.select2-container--default .select2-results__option--highlighted[aria-selected]{
|
|
||||||
color:#ffffff;
|
|
||||||
background: #526dee!important;
|
|
||||||
}
|
|
||||||
.select2-container .select2-selection--single{
|
|
||||||
height: 36px;
|
|
||||||
border:1px solid #ced4da;
|
|
||||||
}
|
|
||||||
.select2-container--default .select2-selection--single .select2-selection__rendered{
|
|
||||||
line-height: 36px;
|
|
||||||
}
|
|
||||||
.select2-container--default .select2-selection--single .select2-selection__arrow{
|
|
||||||
top:4px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Script for add multiple product name -->
|
<!-- Script for add multiple product name -->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user