Purchase-sale-Product-vendor
This commit is contained in:
commit
181d8b4ad7
@ -313,10 +313,14 @@ public function save_model() {
|
||||
];
|
||||
|
||||
|
||||
$BikemodelsModel->insert($modelData);
|
||||
$model_id = $BikemodelsModel->insert($modelData);
|
||||
|
||||
$modelData = $BikemodelsModel->where('make_id',$make_id)->findAll();
|
||||
|
||||
|
||||
$response['success'] = true;
|
||||
$response['model_id'] = $model_id;
|
||||
$response['model_value'] = $model;
|
||||
} else {
|
||||
|
||||
$response['success'] = false;
|
||||
|
||||
@ -121,6 +121,8 @@
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
|
||||
session()->get('logged_user_role') == 'Job Card Manager' ||
|
||||
@ -144,7 +146,7 @@
|
||||
<a href="<?php echo base_url('vendor_index') ?>">Vendor</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url('purchase_index') ?>">Purchase</a>
|
||||
<a href="<?php echo base_url('purchase_index') ?>">Purchase Order</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -156,18 +158,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="menu-title">Masters</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url('make_index') ?>">
|
||||
<i class="fas fa-bicycle"></i>
|
||||
<span> Make & Models</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="<?php echo base_url('spare_manufacturer_index') ?>">
|
||||
<i class="fas fa-cogs"></i>
|
||||
@ -175,6 +166,9 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
|
||||
|
||||
<a href="<?php echo base_url('reorder_level_index') ?>">
|
||||
<i class="fas fa-angle-double-up"></i>
|
||||
<span> Reorder Level Products </span>
|
||||
@ -207,7 +201,19 @@
|
||||
<li class="menu-title mt-2">Apps</li>
|
||||
<li> <a href="<?php echo base_url('business_index') ?>"><i class="ri-layout-line"></i><span> Business </span></a></li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="menu-title">Masters</li>
|
||||
<li>
|
||||
<a href="<?php echo base_url('make_index') ?>">
|
||||
<i class="fas fa-bicycle"></i>
|
||||
<span> Make & Models</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
@ -26,53 +26,56 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
|
||||
<label for="make" class="col-form-label">Make<span class="text-danger">*</span><i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Client"></i></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>' ?>
|
||||
<select class="form-control SelExample" id="make" name="make" required>
|
||||
<option value="">Select a Make</option>
|
||||
|
||||
<!-- Options for make -->
|
||||
<?php foreach ($make as $value): ?>
|
||||
<option value="<?= $value['make_id'] ?>" <?= isset($products['make_id']) && $products['make_id'] == $value['make_id'] ? 'selected' : '' ?>>
|
||||
<?= $value['make'] ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php foreach ($make as $value): ?>
|
||||
<option value="<?= $value['make_id'] ?>" <?= isset($products['make_id']) && $products['make_id'] == $value['make_id'] ? 'selected' : '' ?>>
|
||||
<?= $value['make'] ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="model" class="col-form-label">Model<span class="text-danger">*</span><i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Client"></i></label>
|
||||
<select class="form-control SelExample" id="model" name="model[]" required multiple>
|
||||
<!-- Options for model will be populated dynamically via AJAX -->
|
||||
<?php if(isset($models) && !empty($models)): ?>
|
||||
<?php foreach($models as $model): ?>
|
||||
<option value="<?= $model['model_id'] ?>" <?= isset($products['models_id']) && in_array($model['model_id'], json_decode($products['models_id'], true)) ? 'selected' : '' ?>>
|
||||
<?= $model['model_name'] ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
<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>'; ?>
|
||||
<select class="form-control SelExample" id="model" name="model[]" required multiple>
|
||||
<!-- Options for model will be populated dynamically via AJAX -->
|
||||
<?php if(isset($models) && !empty($models)): ?>
|
||||
<?php foreach($models as $model): ?>
|
||||
<option value="<?= $model['model_id'] ?>" <?= isset($products['models_id']) && in_array($model['model_id'], json_decode($products['models_id'], true)) ? 'selected' : '' ?>>
|
||||
<?= $model['model_name'] ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<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>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="manufacturer" class="col-form-label">Manufacturer<span class="text-danger">*</span></label>
|
||||
<select class="form-control SelExample" id="manufacturer" name="manufacturer" required>
|
||||
<option value="">Select a Manufacturer</option>
|
||||
<?php foreach ($manufacturers as $value): ?>
|
||||
<option value="<?= $value['manufacturer_id'] ?>" <?= isset($products['manufacturer_id']) && $products['manufacturer_id'] == $value['manufacturer_id'] ? 'selected' : '' ?>>
|
||||
<?= $value['manufacturer_name'] ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="quality" class="col-form-label">Quality<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="quality" id="quality" required data-toggle="select2">
|
||||
<!-- Options for quality will be populated dynamically via JavaScript -->
|
||||
</select>
|
||||
</div>
|
||||
<label for="manufacturer" class="col-form-label">Manufacturer<span class="text-danger">*</span></label>
|
||||
<select class="form-control SelExample" id="manufacturer" name="manufacturer" required>
|
||||
<option value="">Select a Manufacturer</option>
|
||||
<?php foreach ($manufacturers as $value): ?>
|
||||
<option value="<?= $value['manufacturer_id'] ?>" <?= isset($products['manufacturer_id']) && $products['manufacturer_id'] == $value['manufacturer_id'] ? 'selected' : '' ?>>
|
||||
<?= $value['manufacturer_name'] ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="quality" class="col-form-label">Quality<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="quality" id="quality" required data-toggle="select2">
|
||||
<!-- Options for quality will be populated dynamically via JavaScript -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputAddress" class="col-form-label">Manfacturer Part Number</label>
|
||||
@ -139,9 +142,9 @@
|
||||
$tax = $sgst + $cgst; // Total tax (sum of SGST and CGST)
|
||||
?>
|
||||
<option value="0" <?= ($tax == 0) ? 'selected' : '' ?>>0%</option>
|
||||
<option value="18" <?= ($tax == 18) ?'selected' : '' ?>>18%</option>
|
||||
<option value="5" <?= ($tax == 5) ? 'selected' : '' ?>>5%</option>
|
||||
<option value="5" <?= ($tax == 5) ? 'selected' : '' ?>>5%</option>
|
||||
<option value="12" <?= ($tax == 12) ? 'selected' : '' ?>>12%</option>
|
||||
<option value="18" <?= ($tax == 18) ?'selected' : '' ?>>18%</option>
|
||||
<option value="28" <?= ($tax == 28) ? 'selected' : '' ?>>28%</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -230,9 +233,9 @@
|
||||
<div class="modal-body">
|
||||
<form id="addModelForm">
|
||||
<div class="form-group">
|
||||
<label for="makeSelect">Make</label>
|
||||
<label for="makeSelect">Make</label><span id="makeSelectMessage" style="color: red;font-size: 12px; padding-left: 10px;"> (Please select Make from Product Form)</span>
|
||||
<select class="form-control" id="makeSelect" required>
|
||||
<!-- Options will be populated dynamically via JavaScript -->
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -293,6 +296,10 @@ $(document).ready(function(){
|
||||
$(document).ready(function() {
|
||||
$('#make').change(function() {
|
||||
var make_id = $(this).val(); // Get the selected make ID
|
||||
make_value = $('option:selected', this).text();
|
||||
$('#makeSelect').empty();
|
||||
$('#makeSelect').append('<option value="' + make_id + '">' + make_value + '</option>');
|
||||
$('#makeSelectMessage').hide();
|
||||
|
||||
// AJAX request to get models based on the selected make ID
|
||||
$.ajax({
|
||||
@ -486,7 +493,8 @@ function populateMakeDropdown() {
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('#makeSelect').empty().append('<option value="">Select Make</option>');
|
||||
$('#makeSelect').empty();
|
||||
$('#makeSelect').append('<option value="">Select Make</option>');
|
||||
response.forEach(function(make) {
|
||||
$('#makeSelect').append('<option value="' + make.make_id + '">' + make.make + '</option>');
|
||||
});
|
||||
@ -499,7 +507,7 @@ function populateMakeDropdown() {
|
||||
|
||||
// Call the function to populate make dropdown initially
|
||||
$(document).ready(function() {
|
||||
populateMakeDropdown();
|
||||
// populateMakeDropdown();
|
||||
});
|
||||
|
||||
// Save model function
|
||||
@ -519,7 +527,9 @@ console.log(model);
|
||||
if (response.success) {
|
||||
$('#addModelModal').modal('hide');
|
||||
toastr.success("Model saved successfully");
|
||||
window.location.reload();
|
||||
|
||||
$('#model').append('<option value="' + response.model_id + '">' + response.model_value + '</option>');
|
||||
|
||||
} else {
|
||||
toastr.error("Failed to save model");
|
||||
}
|
||||
|
||||
@ -832,6 +832,7 @@ document.getElementById('reg_no').addEventListener('input', function(event) {
|
||||
$('#formType').val('create');
|
||||
|
||||
$('#clientName').val('');
|
||||
// $('.select2-selection__rendered').html('');
|
||||
$('#clientMobile').val('');
|
||||
|
||||
|
||||
|
||||
@ -23,7 +23,8 @@
|
||||
<h4 class="header-title">Vehicle Details :</h4>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Make<span class="text-danger">*</span><i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Client"></i></label>
|
||||
<label for="inputPassword4" class="col-form-label">Make<span class="text-danger">*</span></label>
|
||||
<?= isset($vehicle['client_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addMakeModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addMakeModal" title="Add Client"></i>' ?>
|
||||
<select class="form-control SelExample" name="make" id="make" <?= isset($vehicle['make']) ? '' : 'required' ?>>
|
||||
<?= isset($vehicle['make']) ? '' : '<option value="">Select a Make</option>' ?>
|
||||
<?php foreach ($makeData as $value) : ?>
|
||||
@ -36,7 +37,8 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputPassword4" class="col-form-label">Model<span class="text-danger">*</span><i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Client"></i></label>
|
||||
<label for="inputPassword4" class="col-form-label">Model<span class="text-danger">*</span></label>
|
||||
<?= isset($vehicle['client_id']) ? '' : '<i type="button" class="fe-plus-circle" id="addModelModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addModelModal" title="Add Client"></i>' ?>
|
||||
<select class="form-control SelExample" name="model" id="model" <?= isset($vehicle['model']) ? '' : 'required' ?>>
|
||||
<?php if (isset($vehicle["model_name"])) : ?>
|
||||
<option value="<?= $vehicle["model"] ?>" >
|
||||
@ -199,9 +201,9 @@
|
||||
<div class="modal-body">
|
||||
<form id="addModelForm">
|
||||
<div class="form-group">
|
||||
<label for="makeSelect">Make</label>
|
||||
<label for="makeSelect">Make</label><span id="makeSelectMessage" style="color: red;font-size: 12px; padding-left: 10px;"> (Please select Make from Product Form)</span>
|
||||
<select class="form-control" id="makeSelect" required>
|
||||
<!-- Options will be populated dynamically via JavaScript -->
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -249,6 +251,10 @@ $(document).ready(function() {
|
||||
// Event listener for change in make select dropdown
|
||||
$("#make").on('change', function() {
|
||||
var selected_makes = $(this).val(); // Get an array of selected make IDs
|
||||
make_value = $('option:selected', this).text();
|
||||
$('#makeSelect').empty();
|
||||
$('#makeSelect').append('<option value="' + selected_makes + '">' + make_value + '</option>');
|
||||
$('#makeSelectMessage').hide();
|
||||
// AJAX request to fetch models based on selected make IDs
|
||||
$.ajax({
|
||||
url: '<?= base_url("fetch_models") ?>', // URL to your controller method for fetching models
|
||||
@ -316,7 +322,8 @@ $(document).ready(function() {
|
||||
console.log(response.clientData);
|
||||
$("#clientData").append('<option value="' + response.clientData.client_id + '">' + response.clientData.client_name + '</option>');
|
||||
// Manually select the newly added option
|
||||
$("#clientData").val(response.clientData.client_id).trigger('change');
|
||||
$("#clientData").val(response.clientData.client_id);
|
||||
$('input[name="mobile_no"]').val(response.clientData.mobile_no);
|
||||
} else {
|
||||
// Client save operation failed, display error message
|
||||
toastr.warning("Failed to save client. Please try again");
|
||||
@ -384,7 +391,8 @@ function populateMakeDropdown() {
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
$('#makeSelect').empty().append('<option value="">Select Make</option>');
|
||||
$('#makeSelect').empty();
|
||||
$('#makeSelect').append('<option value="">Select Make</option>');
|
||||
response.forEach(function(make) {
|
||||
$('#makeSelect').append('<option value="' + make.make_id + '">' + make.make + '</option>');
|
||||
});
|
||||
@ -397,7 +405,7 @@ function populateMakeDropdown() {
|
||||
|
||||
// Call the function to populate make dropdown initially
|
||||
$(document).ready(function() {
|
||||
populateMakeDropdown();
|
||||
//populateMakeDropdown();
|
||||
});
|
||||
|
||||
// Save model function
|
||||
@ -417,7 +425,7 @@ console.log(model);
|
||||
if (response.success) {
|
||||
$('#addModelModal').modal('hide');
|
||||
toastr.success("Model saved successfully");
|
||||
window.location.reload();
|
||||
$('#model').append('<option value="' + response.model_id + '">' + response.model_value + '</option>');
|
||||
} else {
|
||||
toastr.error("Failed to save model");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user