FEATURE_MANUFACTURER:AADHAVAN
This commit is contained in:
parent
d38a073698
commit
5951a89879
@ -36,6 +36,7 @@ $routes->get("delete_business/(:any)", "Business::delete_business/$1");
|
||||
|
||||
// Products//
|
||||
$routes->get('product_index/', 'Products::product_index');
|
||||
$routes->get('product_index/(:any)', 'Products::product_index/$1');
|
||||
$routes->post("add_product", "Products::add_product");
|
||||
$routes->get("new_product/(:any)", "Products::new_product/$1");
|
||||
$routes->get("delete_product/(:any)", "Products::delete_product/$1");
|
||||
@ -85,7 +86,7 @@ $routes->get('dashboard', 'Users::dashboard');
|
||||
|
||||
|
||||
|
||||
//---------------------- Make And Model | Service | Spare Manufacturer and Category
|
||||
//---------------------- Make And Model | Service | Manufacturer
|
||||
// Make
|
||||
$routes->get('make_index', 'Make::index');
|
||||
$routes->post('create_make', 'Make::create_make');
|
||||
@ -108,11 +109,6 @@ $routes->get("delete_service/(:any)", "Service::delete_service/$1");
|
||||
|
||||
//Spare manufacturer
|
||||
|
||||
$routes->get('spare_manufacturer_index', 'SpareManufacturer::index');
|
||||
$routes->post('create_spare_manufacturer', 'SpareManufacturer::create_make');
|
||||
$routes->get('spare_manufacturer_index', 'Manufacturer::index');
|
||||
$routes->post('create_manufacturer', 'Manufacturer::create_manufacturer');
|
||||
|
||||
//Spare category
|
||||
|
||||
$routes->get('spare_category_index/(:any)', 'SpareCategory::index/$1');
|
||||
$routes->post('create_model', 'SpareCategory::create_model');
|
||||
$routes->post('status_model', 'SpareCategory::status_model');
|
||||
@ -2,11 +2,11 @@
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\SpareManufacturerModel;
|
||||
use App\Models\ManufacturerModel;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
class SpareManufacturer extends BaseController
|
||||
class Manufacturer extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
@ -16,30 +16,32 @@ class SpareManufacturer extends BaseController
|
||||
{
|
||||
|
||||
$this->session = session();
|
||||
$this->SpareManufacturerModel = new SpareManufacturerModel();
|
||||
$this->ManufacturerModel = new ManufacturerModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$SpareManufacturerModel = new SpareManufacturerModel();
|
||||
$spare_manufacturer = $SpareManufacturerModel->findAll();
|
||||
$data['spare_manufacturer']=$spare_manufacturer;
|
||||
$ManufacturerModel = new ManufacturerModel();
|
||||
$spare_manufacturer = $ManufacturerModel->findAll();
|
||||
$data['manufacturer']=$spare_manufacturer;
|
||||
|
||||
return view('spare_manufacturer_list',$data);
|
||||
return view('manufacturer_list',$data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function create_make()
|
||||
public function create_manufacturer()
|
||||
{
|
||||
try {
|
||||
$make_name = $this->request->getPost('makename');
|
||||
$SpareManufacturerModel = new SpareManufacturerModel();
|
||||
$manufacturer_name = $this->request->getPost('manufacturername');
|
||||
$quantity = $this->request->getPost('quantity');
|
||||
$ManufacturerModel = new ManufacturerModel();
|
||||
$data = [
|
||||
'make' => $make_name
|
||||
'manufacturer_name' => $manufacturer_name,
|
||||
'quantity' => $quantity,
|
||||
];
|
||||
$inserted = $SpareManufacturerModel->insert($data);
|
||||
$inserted = $ManufacturerModel->insert($data);
|
||||
if ($inserted) {
|
||||
$result = $data;
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
@ -18,16 +18,33 @@ class Products extends BaseController
|
||||
$this->session = session();
|
||||
}
|
||||
|
||||
public function product_index()
|
||||
public function product_index($manufacturer_id = null)
|
||||
{
|
||||
|
||||
$ProductModel = new ProductModel();
|
||||
$products = $ProductModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
|
||||
$data['products']=$products;
|
||||
if ($manufacturer_id) {
|
||||
$ProductModel = new ProductModel();
|
||||
$products = $ProductModel->where('manufacturer_id',$manufacturer_id)->findAll();
|
||||
$data['products']=$products;
|
||||
$data['manufacturer_id'] = $manufacturer_id;
|
||||
|
||||
return view('product_list',$data);
|
||||
} else {
|
||||
$ProductModel = new ProductModel();
|
||||
$products = $ProductModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
|
||||
$data['products']=$products;
|
||||
$data['manufacturer_id'] = $manufacturer_id;
|
||||
|
||||
|
||||
return view('product_list',$data);
|
||||
}
|
||||
|
||||
|
||||
return view('product_list',$data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function new_product($product_id)
|
||||
{
|
||||
|
||||
11
app/Models/ManufacturerModel.php
Normal file
11
app/Models/ManufacturerModel.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class ManufacturerModel extends Model
|
||||
{
|
||||
protected $table = 'manufacturer';
|
||||
protected $primaryKey = 'manufacturer_id';
|
||||
protected $allowedFields = ['manufacturer_id','manufacturer_name','isactive','quantity'];
|
||||
|
||||
|
||||
}
|
||||
@ -5,7 +5,7 @@ class ProductModel extends Model
|
||||
{
|
||||
protected $table = 'products';
|
||||
protected $primaryKey = 'product_id';
|
||||
protected $allowedFields = ['product_id','make_id','models_id','quality','product_name','branch_id','search_tag','product_category','mfr_part_no','purchase_order_level','serial_no','unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level','handler','qty_in_demand','product_image','description','isactive'];
|
||||
protected $allowedFields = ['sku_id','product_id','manufacturer_id','make_id','models_id','quality','product_name','branch_id','search_tag','product_category','mfr_part_no','purchase_order_level','serial_no','unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level','handler','qty_in_demand','product_image','description','isactive'];
|
||||
|
||||
|
||||
public function getTax()
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class SpareManufacturerModel extends Model
|
||||
{
|
||||
protected $table = 'spare_manufacturer';
|
||||
protected $primaryKey = 'spare_manufacturer_id';
|
||||
protected $allowedFields = ['spare_manufacturer_id','manufacturer_name','isactive','quantity'];
|
||||
|
||||
|
||||
}
|
||||
@ -172,11 +172,10 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<li>
|
||||
<a href="<?php echo base_url('spare_manufacturer_index') ?>">
|
||||
<i class="fas fa-cogs"></i>
|
||||
<span> Spare </span>
|
||||
<span> Manufacturer </span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
122
app/Views/manufacturer_list.php
Normal file
122
app/Views/manufacturer_list.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php include('layout/header.php'); ?>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title">Manufacturer List</h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="">
|
||||
<a href="#" data-toggle="modal" data-target="#manufacturer_login-modal" class="btn btn-primary waves-effect">
|
||||
<i class="ri-add-line"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Manufacturer </th>
|
||||
<th>Quantity</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($manufacturer as $item): ?>
|
||||
<tr>
|
||||
<td><?php echo $item['manufacturer_name']; ?></td>
|
||||
<td><?php echo $item['quantity']; ?></td>
|
||||
<td>
|
||||
<a href="<?= "product_index/" . $item['manufacturer_id']; ?>" class="view-list-button" title="Model List" style="margin-left: 16px;">
|
||||
<i class="ri-list-check-2 icon-large"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Start Bike Make Create Pop-UP -->
|
||||
<div id="manufacturer_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="text-center mt-2 mb-4">
|
||||
<h4>Add Manufacturer</h4>
|
||||
</div>
|
||||
|
||||
<form id="model_form_data" class="px-3">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="manufacturername">Manufacturer Name </label>
|
||||
<input class="form-control" type="text" id="manufacturer_name" required="" placeholder="Make Name....">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="manufacturername">Quantity</label>
|
||||
<select name="quantity" id="quantity" class="form-control" style="border-color: lightgray;color: #6c757d;">
|
||||
<option value="0">Select Quantity</option>
|
||||
<option value="q1">Q1</option>
|
||||
<option value="q2">Q2</option>
|
||||
<option value="q3">Q3</option>
|
||||
<option value="q4">Q4</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitMake(this)">Submit</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
<!-- End Bike Make Create Pop-UP -->
|
||||
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
function submitMake(params) {
|
||||
var formData = {
|
||||
manufacturername: $('#manufacturer_name').val(),
|
||||
quantity: $('#quantity').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo base_url()."create_manufacturer"?>',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
$('#bike_model_login-modal').modal('hide');
|
||||
$('#bike_make_name').val('');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -6,9 +6,10 @@
|
||||
<h4 class="page-title">Product List</h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<?php if(!$manufacturer_id) { ?>
|
||||
<li class=""> <a href="<?= base_url() . "new_product/0"; ?>" class="btn btn-primary waves-effect"> <i class="ri-add-line"></i></a>
|
||||
</li>
|
||||
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
@ -29,7 +30,6 @@
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Product Name</th>
|
||||
<th>Category</th>
|
||||
<th>Serial Number</th>
|
||||
@ -37,10 +37,7 @@
|
||||
<th>Qty in Stock</th>
|
||||
<th>Sgst</th>
|
||||
<th>Cgst</th>
|
||||
|
||||
|
||||
<th>Actions</th>
|
||||
|
||||
<?php if(!$manufacturer_id) { ?><th>Actions</th><?php } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@ -50,7 +47,7 @@
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<td><?= $value['product_name']; ?></td>
|
||||
<td><?= $value['product_category']; ?></td>
|
||||
<td><?= $value['product_category']; ?></td>
|
||||
<td><?= $value['serial_no']; ?></td>
|
||||
<td><?= number_format($value['unit_price']); ?></td>
|
||||
<td><?= $value['qty_stock']; ?></td>
|
||||
@ -58,13 +55,14 @@
|
||||
<td><?= $value['sgst']; ?>%</td>
|
||||
|
||||
<!-- Call the model method -->
|
||||
<td>
|
||||
<a href="<?= "new_product/" . $value['product_id']; ?>" class="edit-button"><i
|
||||
class="ri-pencil-line"></i></a>
|
||||
<a href="<?= "delete_product/" . $value['product_id']; ?>"
|
||||
class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
</td>
|
||||
|
||||
<?php if(!$manufacturer_id) { ?>
|
||||
<td>
|
||||
<a href="<?= "new_product/" . $value['product_id']; ?>" class="edit-button"><i
|
||||
class="ri-pencil-line"></i></a>
|
||||
<a href="<?= "delete_product/" . $value['product_id']; ?>"
|
||||
class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php endif?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
@ -1,179 +0,0 @@
|
||||
<?php include('layout/header.php'); ?>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title">Spare Manufacturer List</h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="">
|
||||
<a href="#" data-toggle="modal" data-target="#bike_make_login-modal" class="btn btn-primary waves-effect">
|
||||
<i class="ri-add-line"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Spare Manufacturer </th>
|
||||
<th>Quantity</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($spare_manufacturer as $item): ?>
|
||||
<tr>
|
||||
<td><?php echo $item['manufacturer_name']; ?></td>
|
||||
<td><?php echo $item['quantity']; ?></td>
|
||||
<td>
|
||||
<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" class="add-button" title="Add" data-id="<?php echo $item['make_id']; ?>" data-value="<?php echo $item['make']; ?>" onclick="setMakeName(this)">
|
||||
<i class="ri-add-line icon-large"></i>
|
||||
</a>
|
||||
<a href="<?= "bike_model_index/" . $item['make_id']; ?>" class="view-list-button" title="Model List" style="margin-left: 16px;">
|
||||
<i class="ri-list-check-2 icon-large"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Start Bike Make Create Pop-UP -->
|
||||
<div id="bike_make_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="text-center mt-2 mb-4">
|
||||
<h4>Add Bike Make</h4>
|
||||
</div>
|
||||
|
||||
<form id="model_form_data" class="px-3">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="makename">Make Name </label>
|
||||
<input class="form-control" type="text" id="bike_make_name" required="" placeholder="Make Name....">
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitMake(this)">Submit</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
<!-- End Bike Make Create Pop-UP -->
|
||||
|
||||
<!-- Start Bike Model Create Pop-UP -->
|
||||
<div id="bike_model_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body">
|
||||
<div class="text-center mt-2 mb-4">
|
||||
<h4>Add Models</h4>
|
||||
</div>
|
||||
|
||||
<form id="model_form_data" class="px-3">
|
||||
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="text" id="make_id" required="" placeholder="Make Name...." style="display:none;">
|
||||
<label for="makename">Make Name </label>
|
||||
<input class="form-control" type="text" id="makename" required="" placeholder="Make Name...." disabled>
|
||||
<label for="modelname">Model Name </label>
|
||||
<input class="form-control" type="text" id="modelname" required="" placeholder="Model Name....">
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitModel(this)">Submit</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
<!-- End Bike Model Create Pop-UP -->
|
||||
|
||||
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function setMakeName(params) {
|
||||
|
||||
$('#make_id').val(params.getAttribute('data-id'));
|
||||
$('#makename').val(params.getAttribute('data-value'));
|
||||
}
|
||||
|
||||
|
||||
function submitModel(params) {
|
||||
console.log( $('#modelname').val());
|
||||
var formData = {
|
||||
make_id: $('#make_id').val(),
|
||||
modelname: $('#modelname').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'create_model',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
// Handle success response here
|
||||
console.log(response);
|
||||
$('#bike_model_login-modal').modal('hide');
|
||||
$('#modelname').val('');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function submitMake(params) {
|
||||
var formData = {
|
||||
makename: $('#bike_make_name').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'create_make',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
$('#bike_model_login-modal').modal('hide');
|
||||
$('#bike_make_name').val('');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user